16#include "ns3/application.h"
17#include "ns3/inet6-socket-address.h"
18#include "ns3/net-device-container.h"
19#include "ns3/random-variable-stream.h"
20#include "ns3/socket.h"
21#include "ns3/traced-callback.h"
22#include "ns3/trickle-timer.h"
252 std::unordered_map<Ipv6Address, uint32_t, Ipv6AddressHash>
m_iaidMap;
The base class for all ns3 applications.
DHCPv6 client config details about each interface on the node.
State m_state
The DHCPv6 state of the client interface.
void DeclineOffer()
Send a Decline message to the DHCPv6 server.
Ptr< Dhcp6Client > m_client
The Dhcp6Client on which the interface is present.
Time m_msgStartTime
Time when message exchange starts.
uint8_t m_nAcceptedAddresses
Number of addresses accepted by client.
Time m_prefLifetime
Preferred lifetime of the address.
std::vector< Ipv6Address > m_declinedAddresses
List of addresses to be declined by the client.
std::optional< Callback< void, const Ipv6Address & > > m_declinedAddressCb
Callback for the declined addresses - needed for cleanup.
Time m_rebindTime
REB_MAX_RT, Time after which client should send a Rebind message.
~InterfaceConfig()
Destructor.
Duid m_serverDuid
The server DUID.
Ptr< Socket > m_socket
The socket that has been opened for this interface.
void AcceptedAddress(const Ipv6Address &offeredAddress)
Accept the DHCPv6 offer.
std::vector< Ipv6Address > m_offeredAddresses
List of addresses offered to the client.
std::vector< uint32_t > m_iaids
The IAIDs associated with this DHCPv6 client interface.
EventId m_rebindEvent
Event ID for the rebind event.
uint32_t m_transactId
Transaction ID of the client-initiated message.
EventId m_renewEvent
Event ID for the Renew event.
InterfaceConfig()
The default constructor.
std::optional< Callback< void, const Ipv6Address & > > m_acceptedAddressCb
Callback for the accepted addresses - needed for cleanup.
void DeclinedAddress(const Ipv6Address &offeredAddress)
Add a declined address to the list maintained by the client.
TrickleTimer m_solicitTimer
TrickleTimer to schedule Solicit messages.
void Cleanup()
Cleanup the internal callbacks and timers.
Time m_renewTime
REN_MAX_RT, Time after which lease should be renewed.
std::vector< EventId > m_releaseEvent
Store all the Event IDs for the addresses being Released.
uint32_t m_interfaceIndex
The IPv6 interface index of this configuration.
Time m_validLifetime
Valid lifetime of the address.
Implements the DHCPv6 client.
void CheckLeaseStatus(Ptr< NetDevice > iDev, Dhcp6Header header, Inet6SocketAddress server) const
Check lease status after sending a Decline or Release message.
std::vector< uint32_t > GetIaids()
Retrieve all existing IAIDs.
Duid GetSelfDuid() const
Get the DUID.
std::unordered_map< uint32_t, Ptr< InterfaceConfig > > m_interfaces
Map each interface to its corresponding configuration details.
std::unordered_map< Ipv6Address, uint32_t, Ipv6AddressHash > m_iaidMap
Track the IPv6 Address - IAID association.
void ReceiveMflag(uint32_t recvInterface)
Callback for when an M flag is received.
void LinkStateHandler(bool isUp, int32_t ifIndex)
Handle changes in the link state.
Ptr< RandomVariableStream > m_solicitJitter
Random jitter before sending the first Solicit.
void SendRelease(Ipv6Address address)
Send a Release message to the DHCPv6 server.
static TypeId GetTypeId()
Get the type ID.
TracedCallback< const Ipv6Address & > m_newLease
Trace the new lease.
bool ValidateAdvertise(Dhcp6Header header, Ptr< NetDevice > iDev)
Verify the incoming advertise message.
void Boot(Ptr< NetDevice > device)
Used to send the Solicit message and start the DHCPv6 client.
State
State of the DHCPv6 client.
@ WAIT_REPLY_AFTER_DECLINE
@ WAIT_REPLY_AFTER_RELEASE
void ProcessReply(Ptr< NetDevice > iDev, Dhcp6Header header, Inet6SocketAddress server)
Send a request to the DHCPv6 server.
Ptr< RandomVariableStream > m_transactionId
Random variable to set transaction ID.
void SendRequest(Ptr< NetDevice > iDev, Dhcp6Header header, Inet6SocketAddress server)
Send a request to the DHCPv6 server.
void StartApplication() override
Application specific startup code.
void StopApplication() override
Application specific shutdown code.
void NetHandler(Ptr< Socket > socket)
Handles incoming packets from the network.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this Application object.
Ptr< RandomVariableStream > m_iaidStream
Random variable used to create the IAID.
void SendRebind(uint32_t interfaceIndex)
Send a rebind message to the DHCPv6 server.
void SendRenew(uint32_t interfaceIndex)
Send a renew message to the DHCPv6 server.
Time m_solicitInterval
SOL_MAX_RT, time between solicitations.
Duid m_clientDuid
The client DUID.
void DoDispose() override
Destructor implementation.
Implements the unique identifier for DHCPv6.
An identifier for simulation events.
Describes an IPv6 address.
Smart pointer class similar to boost::intrusive_ptr.
A template-based reference counting class.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
A Trickle Timer following RFC 6206 .
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)