Router advertisement daemon. More...
#include <radvd.h>
Public Member Functions | |
Radvd () | |
Constructor. | |
virtual | ~Radvd () |
Destructor. | |
void | AddConfiguration (Ptr< RadvdInterface > routerInterface) |
Add configuration for an interface;. | |
int64_t | AssignStreams (int64_t stream) |
Public Member Functions inherited from ns3::Application | |
Application () | |
virtual | ~Application () |
Ptr< Node > | GetNode () 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 () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Start (void) |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get the type ID. |
Static Public Attributes | |
static const uint32_t | MAX_RA_DELAY_TIME = 500 |
Default value for maximum delay of RA (ms) |
Protected Member Functions | |
virtual void | DoDispose () |
Dispose the instance. | |
Protected Member Functions inherited from ns3::Application | |
virtual void | DoStart (void) |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | NotifyNewAggregate (void) |
Private Types | |
typedef std::map< uint32_t, EventId > | EventIdMap |
typedef std::map< uint32_t, EventId >::const_iterator | EventIdMapCI |
typedef std::map< uint32_t, EventId >::iterator | EventIdMapI |
typedef std::list< Ptr < RadvdInterface > > | RadvdInterfaceList |
typedef std::list< Ptr < RadvdInterface > >::const_iterator | RadvdInterfaceListCI |
typedef std::list< Ptr < RadvdInterface > >::iterator | RadvdInterfaceListI |
Private Member Functions | |
void | HandleRead (Ptr< Socket > socket) |
Handle received packet, especially router solicitation. | |
void | ScheduleTransmit (Time dt, Ptr< RadvdInterface > config, EventId &eventId, Ipv6Address dst=Ipv6Address::GetAllNodesMulticast(), bool reschedule=false) |
Schedule sending a packet. | |
void | Send (Ptr< RadvdInterface > config, Ipv6Address dst=Ipv6Address::GetAllNodesMulticast(), bool reschedule=false) |
Send a packet. | |
virtual void | StartApplication () |
Start the application. | |
virtual void | StopApplication () |
Stop the application. |
Private Attributes | |
RadvdInterfaceList | m_configurations |
List of configuration for interface. | |
EventIdMap | m_eventIds |
Event ID map. | |
Ptr< UniformRandomVariable > | m_jitter |
Variable to provide jitter in advertisement interval. | |
Ptr< Socket > | m_socket |
Raw socket to send RA. |
Additional Inherited Members | |
Protected Attributes inherited from ns3::Application | |
Ptr< Node > | m_node |
EventId | m_startEvent |
Time | m_startTime |
EventId | m_stopEvent |
Time | m_stopTime |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
ns3::Radvd::Radvd | ( | ) |
|
virtual |
Destructor.
Definition at line 66 of file radvd.cc.
References m_configurations, m_socket, and NS_LOG_FUNCTION_NOARGS.
void ns3::Radvd::AddConfiguration | ( | Ptr< RadvdInterface > | routerInterface | ) |
Add configuration for an interface;.
routerInterface | configuration |
Definition at line 123 of file radvd.cc.
References m_configurations.
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 129 of file radvd.cc.
References m_jitter, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().
|
protectedvirtual |
Dispose the instance.
Reimplemented from ns3::Application.
Definition at line 77 of file radvd.cc.
References NS_LOG_FUNCTION_NOARGS.
|
static |
Get the type ID.
This method returns the TypeId associated to ns3::Radvd.
This object is accessible through the following paths with Config::Set and Config::Connect:
Attributes defined for this type:
Attributes defined in parent class ns3::Application:
No TraceSources defined for this type.
Reimplemented from ns3::Application.
Definition at line 47 of file radvd.cc.
References m_jitter, and ns3::TypeId::SetParent().
Handle received packet, especially router solicitation.
socket | socket to read data from |
Definition at line 245 of file radvd.cc.
References ns3::Inet6SocketAddress::ConvertFrom(), ns3::Packet::CopyData(), ns3::Icmpv6Header::GetCode(), ns3::Inet6SocketAddress::GetIpv6(), ns3::Ipv6Header::GetSourceAddress(), ns3::Time::GetTimeStep(), ns3::UniformRandomVariable::GetValue(), ns3::Icmpv6Header::ICMPV6_ND_ROUTER_SOLICITATION, ns3::Inet6SocketAddress::IsMatchingType(), m_configurations, m_eventIds, m_jitter, MAX_RA_DELAY_TIME, ns3::MilliSeconds(), ns3::Now(), NS_LOG_FUNCTION, NS_LOG_INFO, ns3::Socket::RecvFrom(), ns3::Packet::RemoveHeader(), and ScheduleTransmit().
Referenced by StartApplication().
|
private |
Schedule sending a packet.
dt | interval between packet |
config | interface configuration |
eventId | event ID associated |
dst | IPv6 destination address |
reschedule | if true another send will be reschedule (periodic) |
Definition at line 136 of file radvd.cc.
References NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and Send().
Referenced by HandleRead(), Send(), and 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 142 of file radvd.cc.
References ns3::Packet::AddHeader(), ns3::Packet::AddPacketTag(), ns3::Socket::Bind(), ns3::Socket::Connect(), ns3::Ipv6Address::GetAllNodesMulticast(), ns3::RadvdInterface::GetCurHopLimit(), ns3::RadvdInterface::GetDefaultLifeTime(), ns3::RadvdInterface::GetInterface(), 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::Packet::GetSize(), ns3::UniformRandomVariable::GetValue(), ns3::RadvdInterface::IsHomeAgentFlag(), ns3::RadvdInterface::IsManagedFlag(), ns3::RadvdInterface::IsOtherConfigFlag(), ns3::RadvdInterface::IsSourceLLAddress(), list, m_eventIds, m_jitter, m_socket, ns3::MilliSeconds(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, ScheduleTransmit(), ns3::Socket::Send(), ns3::Icmpv6OptionPrefixInformation::SetFlags(), ns3::Icmpv6OptionPrefixInformation::SetPreferredTime(), ns3::Icmpv6OptionPrefixInformation::SetPrefix(), ns3::Icmpv6OptionPrefixInformation::SetPrefixLength(), ns3::SocketIpTtlTag::SetTtl(), and ns3::Icmpv6OptionPrefixInformation::SetValidTime().
Referenced by ScheduleTransmit().
|
privatevirtual |
Start the application.
Definition at line 83 of file radvd.cc.
References ns3::Socket::CreateSocket(), ns3::Ipv6Address::GetAllNodesMulticast(), ns3::Application::GetNode(), HandleRead(), ns3::Ipv6Header::IPV6_ICMPV6, ns3::TypeId::LookupByName(), m_configurations, m_eventIds, m_socket, ns3::MakeCallback(), NS_ASSERT, NS_LOG_FUNCTION_NOARGS, ScheduleTransmit(), ns3::Seconds(), ns3::ObjectBase::SetAttribute(), and ns3::Socket::SetRecvCallback().
|
privatevirtual |
Stop the application.
Definition at line 107 of file radvd.cc.
References ns3::Simulator::Cancel(), m_eventIds, m_socket, ns3::MakeNullCallback(), NS_LOG_FUNCTION_NOARGS, and ns3::Socket::SetRecvCallback().
|
private |
List of configuration for interface.
Definition at line 144 of file radvd.h.
Referenced by AddConfiguration(), HandleRead(), StartApplication(), and ~Radvd().
|
private |
Event ID map.
Definition at line 149 of file radvd.h.
Referenced by HandleRead(), Send(), StartApplication(), and StopApplication().
|
private |
Variable to provide jitter in advertisement interval.
Definition at line 154 of file radvd.h.
Referenced by AssignStreams(), GetTypeId(), HandleRead(), and Send().
Raw socket to send RA.
Definition at line 139 of file radvd.h.
Referenced by Send(), StartApplication(), StopApplication(), and ~Radvd().
|
static |
Default value for maximum delay of RA (ms)
Definition at line 69 of file radvd.h.
Referenced by HandleRead().