Router advertisement daemon. More...
#include "radvd.h"
Public Member Functions | |
Radvd () | |
Constructor. More... | |
~Radvd () override | |
Destructor. More... | |
void | AddConfiguration (Ptr< RadvdInterface > routerInterface) |
Add configuration for an interface;. More... | |
int64_t | AssignStreams (int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. More... | |
Public Member Functions inherited from ns3::Application | |
Application () | |
~Application () override | |
Ptr< Node > | GetNode () const |
void | SetNode (Ptr< Node > node) |
void | SetStartTime (Time start) |
Specify application start time. More... | |
void | SetStopTime (Time stop) |
Specify application stop time. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Application | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Attributes | |
static const uint32_t | MAX_INITIAL_RTR_ADVERT_INTERVAL = 16000 |
Default value for maximum initial RA advertisements interval (ms) More... | |
static const uint32_t | MAX_INITIAL_RTR_ADVERTISEMENTS = 3 |
Default value for maximum initial RA advertisements. More... | |
static const uint32_t | MAX_RA_DELAY_TIME = 500 |
Default value for maximum delay of RA (ms) More... | |
static const uint32_t | MIN_DELAY_BETWEEN_RAS = 3000 |
Default value for minimum delay between RA advertisements (ms) More... | |
Protected Member Functions | |
void | DoDispose () override |
Dispose the instance. More... | |
Protected Member Functions inherited from ns3::Application | |
void | DoDispose () override |
Destructor implementation. More... | |
void | DoInitialize () override |
Initialize() implementation. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Private Types | |
typedef std::map< uint32_t, EventId > | EventIdMap |
Container: interface number, EventId. More... | |
typedef std::map< uint32_t, EventId >::const_iterator | EventIdMapCI |
Container Const Iterator: interface number, EventId. More... | |
typedef std::map< uint32_t, EventId >::iterator | EventIdMapI |
Container Iterator: interface number, EventId. More... | |
typedef std::list< Ptr< RadvdInterface > > | RadvdInterfaceList |
Container: Ptr to RadvdInterface. More... | |
typedef std::list< Ptr< RadvdInterface > >::const_iterator | RadvdInterfaceListCI |
Container Const Iterator: Ptr to RadvdInterface. More... | |
typedef std::list< Ptr< RadvdInterface > >::iterator | RadvdInterfaceListI |
Container Iterator: Ptr to RadvdInterface. More... | |
typedef std::map< uint32_t, Ptr< Socket > > | SocketMap |
Container: interface number, Socket. More... | |
typedef std::map< uint32_t, Ptr< Socket > >::const_iterator | SocketMapCI |
Container Const Iterator: interface number, Socket. More... | |
typedef std::map< uint32_t, Ptr< Socket > >::iterator | SocketMapI |
Container Iterator: interface number, Socket. More... | |
Private Member Functions | |
void | HandleRead (Ptr< Socket > socket) |
Handle received packet, especially router solicitation. More... | |
void | Send (Ptr< RadvdInterface > config, Ipv6Address dst=Ipv6Address::GetAllNodesMulticast(), bool reschedule=false) |
Send a packet. More... | |
void | StartApplication () override |
Start the application. More... | |
void | StopApplication () override |
Stop the application. More... | |
Private Attributes | |
RadvdInterfaceList | m_configurations |
List of configuration for interface. More... | |
Ptr< UniformRandomVariable > | m_jitter |
Variable to provide jitter in advertisement interval. More... | |
Ptr< Socket > | m_recvSocket |
Raw socket to receive RS. More... | |
SocketMap | m_sendSockets |
Raw socket to send RA. More... | |
EventIdMap | m_solicitedEventIds |
Event ID map for solicited RAs. More... | |
EventIdMap | m_unsolicitedEventIds |
Event ID map for unsolicited RAs. More... | |
Additional Inherited Members | |
Public Types inherited from ns3::Application | |
typedef void(* | DelayAddressCallback) (const Time &delay, const Address &from) |
Common callback signature for packet delay and address. More... | |
typedef void(* | StateTransitionCallback) (const std::string &oldState, const std::string &newState) |
Common signature used by callbacks to application's state transition trace source. More... | |
Protected Attributes inherited from ns3::Application | |
Ptr< Node > | m_node |
The node that this application is installed on. More... | |
EventId | m_startEvent |
The event that will fire at m_startTime to start the application. More... | |
Time | m_startTime |
The simulation time that the application will start. More... | |
EventId | m_stopEvent |
The event that will fire at m_stopTime to end the application. More... | |
Time | m_stopTime |
The simulation time that the application will end. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
|
private |
|
private |
|
private |
|
private |
Container: Ptr to RadvdInterface.
|
private |
Container Const Iterator: Ptr to RadvdInterface.
|
private |
Container Iterator: Ptr to RadvdInterface.
|
private |
|
private |
|
private |
ns3::Radvd::Radvd | ( | ) |
|
override |
Destructor.
Definition at line 75 of file radvd.cc.
References m_configurations, m_recvSocket, and NS_LOG_FUNCTION.
void ns3::Radvd::AddConfiguration | ( | Ptr< RadvdInterface > | routerInterface | ) |
Add configuration for an interface;.
routerInterface | configuration |
Definition at line 176 of file radvd.cc.
References m_configurations, and NS_LOG_FUNCTION.
int64_t ns3::Radvd::AssignStreams | ( | int64_t | stream | ) |
Assign a fixed random variable stream number to the random variables used by this model.
Return the number of streams (possibly zero) that have been assigned.
stream | first stream index to use |
Definition at line 183 of file radvd.cc.
References m_jitter, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().
|
overrideprotectedvirtual |
Dispose the instance.
Reimplemented from ns3::Object.
Definition at line 87 of file radvd.cc.
References ns3::Socket::Close(), ns3::Application::DoDispose(), m_recvSocket, m_sendSockets, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 53 of file radvd.cc.
References m_jitter, ns3::MakePointerAccessor(), and ns3::TypeId::SetParent().
Referenced by ns3::RadvdHelper::RadvdHelper().
Handle received packet, especially router solicitation.
socket | socket to read data from |
Definition at line 314 of file radvd.cc.
References ns3::Packet::CopyData(), ns3::Ipv6Address::GetAllNodesMulticast(), ns3::Icmpv6Header::GetCode(), ns3::Node::GetDevice(), ns3::Application::GetNode(), ns3::Object::GetObject(), ns3::Ipv6PacketInfoTag::GetRecvIf(), ns3::Ipv6Header::GetSource(), ns3::Time::GetTimeStep(), ns3::UniformRandomVariable::GetValue(), ns3::Icmpv6Header::ICMPV6_ND_ROUTER_SOLICITATION, ns3::Inet6SocketAddress::IsMatchingType(), m_configurations, m_jitter, m_solicitedEventIds, m_unsolicitedEventIds, MAX_RA_DELAY_TIME, ns3::MilliSeconds(), MIN_DELAY_BETWEEN_RAS, ns3::Simulator::Now(), NS_ABORT_MSG, NS_LOG_FUNCTION, NS_LOG_INFO, ns3::Socket::RecvFrom(), ns3::Packet::RemoveHeader(), ns3::Packet::RemovePacketTag(), ns3::Simulator::Schedule(), Send(), and check-style-clang-format::type.
Referenced by StartApplication().
|
private |
Send a packet.
config | interface configuration |
dst | destination address (default ff02::1) |
reschedule | if true another send will be reschedule (periodic) |
Definition at line 191 of file radvd.cc.
References ns3::Packet::AddHeader(), ns3::Packet::AddPacketTag(), ns3::Icmpv6OptionPrefixInformation::AUTADDRCONF, ns3::Icmpv6Header::CalculatePseudoHeaderChecksum(), ns3::Inet6SocketAddress::ConvertFrom(), ns3::Ipv6Address::GetAllNodesMulticast(), ns3::RadvdInterface::GetCurHopLimit(), ns3::RadvdInterface::GetDefaultLifeTime(), ns3::RadvdInterface::GetInterface(), ns3::Inet6SocketAddress::GetIpv6(), ns3::RadvdInterface::GetLinkMtu(), ns3::RadvdInterface::GetMaxRtrAdvInterval(), ns3::RadvdInterface::GetMinRtrAdvInterval(), ns3::Application::GetNode(), ns3::Object::GetObject(), ns3::RadvdInterface::GetPrefixes(), ns3::RadvdInterface::GetReachableTime(), ns3::RadvdInterface::GetRetransTimer(), ns3::Icmpv6RA::GetSerializedSize(), ns3::Packet::GetSize(), ns3::UniformRandomVariable::GetValue(), ns3::RadvdInterface::IsHomeAgentFlag(), ns3::RadvdInterface::IsInitialRtrAdv(), ns3::RadvdInterface::IsManagedFlag(), ns3::RadvdInterface::IsOtherConfigFlag(), ns3::RadvdInterface::IsSourceLLAddress(), m_jitter, m_sendSockets, m_unsolicitedEventIds, MAX_INITIAL_RTR_ADVERT_INTERVAL, ns3::MilliSeconds(), ns3::Simulator::Now(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, ns3::Icmpv6OptionPrefixInformation::ONLINK, ns3::Icmpv6OptionPrefixInformation::ROUTERADDR, ns3::Simulator::Schedule(), ns3::Icmpv6RA::SetCurHopLimit(), ns3::Icmpv6RA::SetFlagH(), ns3::Icmpv6RA::SetFlagM(), ns3::Icmpv6RA::SetFlagO(), ns3::Icmpv6OptionPrefixInformation::SetFlags(), ns3::RadvdInterface::SetLastRaTxTime(), ns3::Icmpv6RA::SetLifeTime(), ns3::Icmpv6OptionPrefixInformation::SetPreferredTime(), ns3::Icmpv6OptionPrefixInformation::SetPrefix(), ns3::Icmpv6OptionPrefixInformation::SetPrefixLength(), ns3::Icmpv6RA::SetReachableTime(), ns3::Icmpv6RA::SetRetransmissionTime(), ns3::SocketIpTtlTag::SetTtl(), and ns3::Icmpv6OptionPrefixInformation::SetValidTime().
Referenced by HandleRead(), and StartApplication().
|
overrideprivatevirtual |
Start the application.
Reimplemented from ns3::Application.
Definition at line 104 of file radvd.cc.
References ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::Ipv6Address::GetAllNodesMulticast(), ns3::Ipv6Address::GetAllRoutersMulticast(), ns3::Application::GetNode(), ns3::Object::GetObject(), HandleRead(), ns3::Ipv6Header::IPV6_ICMPV6, ns3::TypeId::LookupByName(), m_configurations, m_recvSocket, m_sendSockets, m_unsolicitedEventIds, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ns3::Seconds(), Send(), ns3::ObjectBase::SetAttribute(), ns3::Socket::SetRecvCallback(), ns3::Socket::SetRecvPktInfo(), and ns3::Socket::ShutdownSend().
|
overrideprivatevirtual |
Stop the application.
Reimplemented from ns3::Application.
Definition at line 153 of file radvd.cc.
References ns3::Simulator::Cancel(), m_recvSocket, m_solicitedEventIds, m_unsolicitedEventIds, ns3::MakeNullCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().
|
private |
List of configuration for interface.
Definition at line 165 of file radvd.h.
Referenced by ~Radvd(), AddConfiguration(), HandleRead(), and StartApplication().
|
private |
Variable to provide jitter in advertisement interval.
Definition at line 180 of file radvd.h.
Referenced by AssignStreams(), GetTypeId(), HandleRead(), and Send().
Raw socket to receive RS.
Definition at line 155 of file radvd.h.
Referenced by ~Radvd(), DoDispose(), StartApplication(), and StopApplication().
|
private |
Raw socket to send RA.
Definition at line 160 of file radvd.h.
Referenced by DoDispose(), Send(), and StartApplication().
|
private |
Event ID map for solicited RAs.
Definition at line 175 of file radvd.h.
Referenced by HandleRead(), and StopApplication().
|
private |
Event ID map for unsolicited RAs.
Definition at line 170 of file radvd.h.
Referenced by HandleRead(), Send(), StartApplication(), and StopApplication().
|
static |
|
static |
|
static |
Default value for maximum delay of RA (ms)
Definition at line 68 of file radvd.h.
Referenced by HandleRead().
|
static |
Default value for minimum delay between RA advertisements (ms)
Definition at line 80 of file radvd.h.
Referenced by HandleRead().