28 #include "ns3/application.h"    29 #include "ns3/traced-value.h"    37 class RandomVariableStream;
 virtual void StartApplication(void)
Application specific startup code. 
Ipv4Mask m_myMask
Mask of the address assigned. 
Simulation virtual time values and global simulation resolution. 
void OfferHandler(DhcpHeader header)
Stores DHCP offers in m_offerList. 
Smart pointer class similar to boost::intrusive_ptr. 
Time m_renew
Store the renew time of address. 
uint8_t m_state
State of the DHCP client. 
Ptr< NetDevice > GetDhcpClientNetDevice(void)
Get the the NetDevice DHCP should work on. 
a class to represent an Ipv4 address mask 
EventId m_refreshEvent
Message refresh event. 
Forward calls to a chain of Callback. 
bool m_firstBoot
First boot (used to add the link state change callback) 
void Request(void)
Sends the DHCP REQUEST message and changes the client state to WAIT_ACK. 
static TypeId GetTypeId(void)
Get the type ID. 
Ipv4Address m_myAddress
Address assigned to the client. 
a polymophic address class 
void AcceptAck(DhcpHeader header, Address from)
Receives the DHCP ACK and configures IP address of the client. 
Ipv4Address m_server
Address of the DHCP server. 
Ipv4Address GetDhcpServer(void)
Get the IPv4Address of current DHCP server. 
uint32_t m_tran
Stores the current transaction number to be used. 
Ptr< RandomVariableStream > m_ran
Uniform random variable for transaction ID. 
bool m_offered
Specify if the client has got any offer. 
The base class for all ns3 applications. 
void LinkStateHandler(void)
Handles changes in LinkState. 
EventId m_rebindEvent
Message rebind event. 
void RemoveAndStart()
Remove the current DHCP information and restart the process. 
EventId m_collectEvent
Offer collection event. 
Ipv4Address m_gateway
Address of the gateway. 
void Select(void)
Selects an OFFER from m_offerList. 
Time m_collect
Time for which client should collect offers. 
EventId m_timeout
The timeout period. 
EventId m_requestEvent
Address refresh event. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
static const int DHCP_PEER_PORT
DHCP server port. 
void SetDhcpClientNetDevice(Ptr< NetDevice > netDevice)
Set the NetDevice DHCP should work on. 
virtual void StopApplication(void)
Application specific shutdown code. 
TracedCallback< const Ipv4Address & > m_newLease
Trace of new lease. 
void NetHandler(Ptr< Socket > socket)
Handles incoming packets from the network. 
Ptr< NetDevice > m_device
NetDevice pointer. 
virtual void DoDispose(void)
Destructor implementation. 
Time m_nextoffer
Time to try the next offer (if request gets no reply) 
Ptr< Socket > m_socket
Socket for remote communication. 
Ipv4 addresses are stored in host order in this class. 
Ipv4Address m_offeredAddress
Address offered to the client. 
An identifier for simulation events. 
std::list< DhcpHeader > m_offerList
Stores all the offers given to the client. 
Address m_chaddr
chaddr of the interface (stored as an Address for convenience). 
State of a client that needs to refresh the lease. 
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
EventId m_nextOfferEvent
Message next offer event. 
Implements the functionality of a DHCP client. 
State of a client that waits for the offer. 
EventId m_discoverEvent
Message retransmission event. 
State of a client that waits for acknowledgment. 
Time m_rtrs
Defining the time for retransmission. 
void Boot(void)
Sends DHCP DISCOVER and changes the client state to WAIT_OFFER. 
Time m_lease
Store the lease time of address. 
a unique identifier for an interface. 
TracedCallback< const Ipv4Address & > m_expiry
Trace of lease expire. 
Ipv4Address m_remoteAddress
Initially set to 255.255.255.255 to start DHCP. 
Time m_rebind
Store the rebind time of address.