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