28 #include "ns3/application.h"
29 #include "ns3/traced-value.h"
37 class 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.
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 Select(void)
Selects an OFFER from m_offerList.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
uint32_t m_tran
Stores the current transaction number to be used.
void RemoveAndStart()
Remove the current DHCP information and restart the process.
virtual void StopApplication(void)
Application specific shutdown code.
Ptr< Socket > m_socket
Socket for remote communication.
void LinkStateHandler(void)
Handles changes in LinkState.
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.
Ptr< NetDevice > m_device
NetDevice pointer.
EventId m_timeout
The timeout period.
virtual void DoDispose(void)
Destructor implementation.
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.
void Boot(void)
Sends DHCP DISCOVER and changes the client state to WAIT_OFFER.
Ipv4Address m_server
Address of the DHCP server.
EventId m_nextOfferEvent
Message next offer event.
bool m_offered
Specify if the client has got any offer.
void Request(void)
Sends the DHCP REQUEST message and changes the client state to WAIT_ACK.
Ipv4Address GetDhcpServer(void)
Get the IPv4Address of current DHCP server.
void OfferHandler(DhcpHeader header)
Stores DHCP offers in m_offerList.
TracedCallback< const Ipv4Address & > m_expiry
Trace of lease expire.
Ptr< NetDevice > GetDhcpClientNetDevice(void)
Get the the NetDevice DHCP should work on.
TracedCallback< const Ipv4Address & > m_newLease
Trace of new lease.
virtual void StartApplication(void)
Application specific startup code.
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.
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.
static TypeId GetTypeId(void)
Get the type ID.
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
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.