18#include "ns3/application.h"
19#include "ns3/ipv4-address.h"
64 static const int PORT = 67;
101 using LeasedAddress = std::map<DhcpChaddr, std::pair<Ipv4Address, uint32_t>>;
a polymophic address class
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).
std::map< DhcpChaddr, std::pair< Ipv4Address, uint32_t > > LeasedAddress
Leased address container - chaddr + IP addr / lease time.
void AddStaticDhcpEntry(Address macAddr, Ipv4Address addr)
Add a static entry to the pool.
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).
void StartApplication() override
Application specific startup code.
static constexpr uint32_t PERMANENT_LEASE
The maximum representable lease time means permanent lease.
LeasedAddress m_leasedAddresses
Leased address and their status (cache memory).
Ipv4Address m_minAddress
The first address in the address pool.
Ipv4Address m_gateway
The gateway address.
static TypeId GetTypeId()
Get the type ID.
std::list< Ipv4Address > AvailableAddress
Available address container - IP addr.
Time m_renew
The renewal time for an address.
Ipv4Address m_maxAddress
The last address in the address pool.
std::list< DhcpChaddr > ExpiredAddress
Expired address container - chaddr.
Ipv4Address m_poolAddress
The network address available to the server.
void TimerHandler()
Modifies the remaining lease time of addresses.
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.
void SendOffer(Ptr< NetDevice > iDev, DhcpHeader header, InetSocketAddress from)
Sends DHCP offer after receiving DHCP Discover.
void DoDispose() override
Destructor implementation.
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.
A low-level Socket API based loosely on the BSD Socket API.
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.