A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::Radvd Class Reference

Router advertisement daemon. More...

#include "radvd.h"

+ Inheritance diagram for ns3::Radvd:
+ Collaboration diagram for ns3::Radvd:

Public Member Functions

 Radvd ()
 Constructor.
 
 ~Radvd () override
 Destructor.
 
void AddConfiguration (Ptr< RadvdInterface > routerInterface)
 Add configuration for an interface;.
 
int64_t AssignStreams (int64_t stream) override
 Assign a fixed random variable stream number to the random variables used by this Application object.
 
- Public Member Functions inherited from ns3::Application
 Application ()
 
 ~Application () override
 
virtual int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this Application object.
 
Ptr< NodeGetNode () const
 
void SetNode (Ptr< Node > node)
 
void SetStartTime (Time start)
 Specify application start time.
 
void SetStopTime (Time stop)
 Specify application stop time.
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Application
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Static Public Attributes

static const uint32_t MAX_INITIAL_RTR_ADVERT_INTERVAL = 16000
 Default value for maximum initial RA advertisements interval (ms)
 
static const uint32_t MAX_INITIAL_RTR_ADVERTISEMENTS = 3
 Default value for maximum initial RA advertisements.
 
static const uint32_t MAX_RA_DELAY_TIME = 500
 Default value for maximum delay of RA (ms)
 
static const uint32_t MIN_DELAY_BETWEEN_RAS = 3000
 Default value for minimum delay between RA advertisements (ms)
 

Protected Member Functions

void DoDispose () override
 Destructor implementation.
 
- Protected Member Functions inherited from ns3::Application
void DoDispose () override
 Destructor implementation.
 
void DoInitialize () override
 Initialize() implementation.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoDispose ()
 Destructor implementation.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

Private Types

typedef std::map< uint32_t, EventIdEventIdMap
 Container: interface number, EventId.
 
typedef std::map< uint32_t, EventId >::const_iterator EventIdMapCI
 Container Const Iterator: interface number, EventId.
 
typedef std::map< uint32_t, EventId >::iterator EventIdMapI
 Container Iterator: interface number, EventId.
 
typedef std::list< Ptr< RadvdInterface > > RadvdInterfaceList
 Container: Ptr to RadvdInterface.
 
typedef std::list< Ptr< RadvdInterface > >::const_iterator RadvdInterfaceListCI
 Container Const Iterator: Ptr to RadvdInterface.
 
typedef std::list< Ptr< RadvdInterface > >::iterator RadvdInterfaceListI
 Container Iterator: Ptr to RadvdInterface.
 
typedef std::map< uint32_t, Ptr< Socket > > SocketMap
 Container: interface number, Socket.
 
typedef std::map< uint32_t, Ptr< Socket > >::const_iterator SocketMapCI
 Container Const Iterator: interface number, Socket.
 
typedef std::map< uint32_t, Ptr< Socket > >::iterator SocketMapI
 Container Iterator: interface number, Socket.
 

Private Member Functions

void HandleRead (Ptr< Socket > socket)
 Handle received packet, especially router solicitation.
 
void Send (Ptr< RadvdInterface > config, Ipv6Address dst=Ipv6Address::GetAllNodesMulticast(), bool reschedule=false)
 Send a packet.
 
void StartApplication () override
 Application specific startup code.
 
void StopApplication () override
 Application specific shutdown code.
 

Private Attributes

RadvdInterfaceList m_configurations
 List of configuration for interface.
 
Ptr< UniformRandomVariablem_jitter
 Variable to provide jitter in advertisement interval.
 
Ptr< Socketm_recvSocket
 Raw socket to receive RS.
 
SocketMap m_sendSockets
 Raw socket to send RA.
 
EventIdMap m_solicitedEventIds
 Event ID map for solicited RAs.
 
EventIdMap m_unsolicitedEventIds
 Event ID map for unsolicited RAs.
 

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.
 
typedef void(* StateTransitionCallback) (const std::string &oldState, const std::string &newState)
 Common signature used by callbacks to application's state transition trace source.
 
- Protected Attributes inherited from ns3::Application
Ptr< Nodem_node
 The node that this application is installed on.
 
EventId m_startEvent
 The event that will fire at m_startTime to start the application.
 
Time m_startTime
 The simulation time that the application will start.
 
EventId m_stopEvent
 The event that will fire at m_stopTime to end the application.
 
Time m_stopTime
 The simulation time that the application will end.
 

Detailed Description

Router advertisement daemon.

Config Paths

ns3::Radvd is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/ApplicationList/[i]/$ns3::Radvd"

Attributes

Attributes defined in parent class ns3::Application

  • StartTime: Time at which the application will start
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +0ns
    • Flags: constructwriteread
  • StopTime: Time at which the application will stop
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +0ns
    • Flags: constructwriteread

No TraceSources are defined for this type.
Size of this type is 304 bytes (on a 64-bit architecture).

Definition at line 46 of file radvd.h.

Member Typedef Documentation

◆ EventIdMap

typedef std::map<uint32_t, EventId> ns3::Radvd::EventIdMap
private

Container: interface number, EventId.

Definition at line 105 of file radvd.h.

◆ EventIdMapCI

typedef std::map<uint32_t,EventId>::const_iterator ns3::Radvd::EventIdMapCI
private

Container Const Iterator: interface number, EventId.

Definition at line 109 of file radvd.h.

◆ EventIdMapI

typedef std::map<uint32_t,EventId>::iterator ns3::Radvd::EventIdMapI
private

Container Iterator: interface number, EventId.

Definition at line 107 of file radvd.h.

◆ RadvdInterfaceList

typedef std::list<Ptr<RadvdInterface> > ns3::Radvd::RadvdInterfaceList
private

Container: Ptr to RadvdInterface.

Definition at line 98 of file radvd.h.

◆ RadvdInterfaceListCI

typedef std::list<Ptr<RadvdInterface>>::const_iterator ns3::Radvd::RadvdInterfaceListCI
private

Container Const Iterator: Ptr to RadvdInterface.

Definition at line 102 of file radvd.h.

◆ RadvdInterfaceListI

typedef std::list<Ptr<RadvdInterface>>::iterator ns3::Radvd::RadvdInterfaceListI
private

Container Iterator: Ptr to RadvdInterface.

Definition at line 100 of file radvd.h.

◆ SocketMap

typedef std::map<uint32_t, Ptr<Socket> > ns3::Radvd::SocketMap
private

Container: interface number, Socket.

Definition at line 112 of file radvd.h.

◆ SocketMapCI

typedef std::map<uint32_t,Ptr<Socket>>::const_iterator ns3::Radvd::SocketMapCI
private

Container Const Iterator: interface number, Socket.

Definition at line 116 of file radvd.h.

◆ SocketMapI

typedef std::map<uint32_t,Ptr<Socket>>::iterator ns3::Radvd::SocketMapI
private

Container Iterator: interface number, Socket.

Definition at line 114 of file radvd.h.

Constructor & Destructor Documentation

◆ Radvd()

ns3::Radvd::Radvd ( )

Constructor.

Definition at line 70 of file radvd.cc.

References NS_LOG_FUNCTION.

◆ ~Radvd()

ns3::Radvd::~Radvd ( )
override

Destructor.

Definition at line 75 of file radvd.cc.

References m_configurations, m_recvSocket, and NS_LOG_FUNCTION.

Member Function Documentation

◆ AddConfiguration()

void ns3::Radvd::AddConfiguration ( Ptr< RadvdInterface routerInterface)

Add configuration for an interface;.

Parameters
routerInterfaceconfiguration

Definition at line 176 of file radvd.cc.

References m_configurations, and NS_LOG_FUNCTION.

Referenced by ns3::RadvdHelper::DoInstall().

+ Here is the caller graph for this function:

◆ AssignStreams()

int64_t ns3::Radvd::AssignStreams ( int64_t  stream)
overridevirtual

Assign a fixed random variable stream number to the random variables used by this Application object.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this Application object

Reimplemented from ns3::Application.

Definition at line 183 of file radvd.cc.

References m_jitter, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

◆ DoDispose()

void ns3::Radvd::DoDispose ( )
overrideprotectedvirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.

It is safe to call GetObject() from within this method.

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.

+ Here is the call graph for this function:

◆ GetTypeId()

TypeId ns3::Radvd::GetTypeId ( )
static

Get the type ID.

Returns
type ID

Definition at line 53 of file radvd.cc.

References m_jitter, ns3::MakePointerAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ HandleRead()

void ns3::Radvd::HandleRead ( Ptr< Socket socket)
private

Handle received packet, especially router solicitation.

Parameters
socketsocket to read data from

Definition at line 314 of file radvd.cc.

References 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::Simulator::Schedule(), and Send().

Referenced by StartApplication().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Send()

void ns3::Radvd::Send ( Ptr< RadvdInterface config,
Ipv6Address  dst = Ipv6Address::GetAllNodesMulticast(),
bool  reschedule = false 
)
private

Send a packet.

Parameters
configinterface configuration
dstdestination address (default ff02::1)
rescheduleif true another send will be reschedule (periodic)

Definition at line 191 of file radvd.cc.

References ns3::Icmpv6OptionPrefixInformation::AUTADDRCONF, ns3::Icmpv6Header::CalculatePseudoHeaderChecksum(), ns3::Inet6SocketAddress::ConvertFrom(), ns3::Ipv6Address::GetAllNodesMulticast(), ns3::Inet6SocketAddress::GetIpv6(), ns3::Application::GetNode(), ns3::Object::GetObject(), ns3::Icmpv6RA::GetSerializedSize(), ns3::UniformRandomVariable::GetValue(), 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(), Send(), ns3::Icmpv6RA::SetCurHopLimit(), ns3::Icmpv6RA::SetFlagH(), ns3::Icmpv6RA::SetFlagM(), ns3::Icmpv6RA::SetFlagO(), ns3::Icmpv6OptionPrefixInformation::SetFlags(), 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(), Send(), and StartApplication().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StartApplication()

void ns3::Radvd::StartApplication ( )
overrideprivatevirtual

Application specific startup code.

The StartApplication method is called at the start time specified by Start This method should be overridden by all or most application subclasses.

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().

+ Here is the call graph for this function:

◆ StopApplication()

void ns3::Radvd::StopApplication ( )
overrideprivatevirtual

Application specific shutdown code.

The StopApplication method is called at the stop time specified by Stop This method should be overridden by all or most application subclasses.

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().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_configurations

RadvdInterfaceList ns3::Radvd::m_configurations
private

List of configuration for interface.

Definition at line 147 of file radvd.h.

Referenced by ~Radvd(), AddConfiguration(), HandleRead(), and StartApplication().

◆ m_jitter

Ptr<UniformRandomVariable> ns3::Radvd::m_jitter
private

Variable to provide jitter in advertisement interval.

Definition at line 162 of file radvd.h.

Referenced by AssignStreams(), GetTypeId(), HandleRead(), and Send().

◆ m_recvSocket

Ptr<Socket> ns3::Radvd::m_recvSocket
private

Raw socket to receive RS.

Definition at line 137 of file radvd.h.

Referenced by ~Radvd(), DoDispose(), StartApplication(), and StopApplication().

◆ m_sendSockets

SocketMap ns3::Radvd::m_sendSockets
private

Raw socket to send RA.

Definition at line 142 of file radvd.h.

Referenced by DoDispose(), Send(), and StartApplication().

◆ m_solicitedEventIds

EventIdMap ns3::Radvd::m_solicitedEventIds
private

Event ID map for solicited RAs.

Definition at line 157 of file radvd.h.

Referenced by HandleRead(), and StopApplication().

◆ m_unsolicitedEventIds

EventIdMap ns3::Radvd::m_unsolicitedEventIds
private

Event ID map for unsolicited RAs.

Definition at line 152 of file radvd.h.

Referenced by HandleRead(), Send(), StartApplication(), and StopApplication().

◆ MAX_INITIAL_RTR_ADVERT_INTERVAL

const uint32_t ns3::Radvd::MAX_INITIAL_RTR_ADVERT_INTERVAL = 16000
static

Default value for maximum initial RA advertisements interval (ms)

Definition at line 76 of file radvd.h.

Referenced by Send().

◆ MAX_INITIAL_RTR_ADVERTISEMENTS

const uint32_t ns3::Radvd::MAX_INITIAL_RTR_ADVERTISEMENTS = 3
static

Default value for maximum initial RA advertisements.

Definition at line 72 of file radvd.h.

◆ MAX_RA_DELAY_TIME

const uint32_t ns3::Radvd::MAX_RA_DELAY_TIME = 500
static

Default value for maximum delay of RA (ms)

Definition at line 68 of file radvd.h.

Referenced by HandleRead().

◆ MIN_DELAY_BETWEEN_RAS

const uint32_t ns3::Radvd::MIN_DELAY_BETWEEN_RAS = 3000
static

Default value for minimum delay between RA advertisements (ms)

Definition at line 80 of file radvd.h.

Referenced by HandleRead().


The documentation for this class was generated from the following files: