18#include "ns3/application.h"
19#include "ns3/ipv4-address.h"
26class InetSocketAddress;
63 static const int PORT = 67;
a polymophic address class
The base class for all ns3 applications.
Implements the functionality of a DHCP server.
EventId m_expiredEvent
The Event to trigger TimerHandler.
void StopApplication() override
Application specific shutdown code.
static const int PORT
Port number of DHCP server.
AvailableAddress m_availableAddresses
Available addresses to be used (IP addresses)
Time m_rebind
The rebinding time for an address.
Time m_lease
The granted lease time for an address.
Ipv4Mask m_poolMask
The network mask of the pool.
Ptr< Socket > m_socket
The socket bound to port 67.
ExpiredAddress m_expiredAddresses
Expired addresses to be reused (chaddr of the clients)
std::map< Address, std::pair< Ipv4Address, uint32_t > > LeasedAddress
Leased address container - chaddr + IP addr / lease time.
void StartApplication() override
Application specific startup code.
std::map< Address, std::pair< Ipv4Address, uint32_t > >::const_iterator LeasedAddressCIter
Leased address const iterator - chaddr + IP addr / lease time.
std::list< Ipv4Address > AvailableAddress
Available address container - IP addr.
void AddStaticDhcpEntry(Address chaddr, Ipv4Address addr)
Add a static entry to the pool.
LeasedAddress m_leasedAddresses
Leased address and their status (cache memory)
Ipv4Address m_minAddress
The first address in the address pool.
std::list< Address >::iterator ExpiredAddressIter
Expired address iterator - chaddr.
Ipv4Address m_gateway
The gateway address.
static TypeId GetTypeId()
Get the type ID.
Time m_renew
The renewal time for an address.
Ipv4Address m_maxAddress
The last address in the address pool.
Ipv4Address m_poolAddress
The network address available to the server.
void TimerHandler()
Modifies the remaining lease time of addresses.
std::list< Address >::const_iterator ExpiredAddressCIter
Expired address const iterator - chaddr.
void NetHandler(Ptr< Socket > socket)
Handles incoming packets from the network.
void SendAck(Ptr< NetDevice > iDev, DhcpHeader header, InetSocketAddress from)
Sends DHCP ACK (or NACK) after receiving Request.
std::map< Address, std::pair< Ipv4Address, uint32_t > >::iterator LeasedAddressIter
Leased address iterator - chaddr + IP addr / lease time.
void SendOffer(Ptr< NetDevice > iDev, DhcpHeader header, InetSocketAddress from)
Sends DHCP offer after receiving DHCP Discover.
void DoDispose() override
Destructor implementation.
std::list< Address > ExpiredAddress
Expired address container - chaddr.
An identifier for simulation events.
Ipv4 addresses are stored in host order in this class.
a class to represent an Ipv4 address mask
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.