RIPng Routing Protocol, defined in RFC 2080 . More...
#include "ripng.h"
Public Types | |
enum | SplitHorizonType_e { NO_SPLIT_HORIZON , SPLIT_HORIZON , POISON_REVERSE } |
Split Horizon strategy type. More... | |
Public Types inherited from ns3::Ipv6RoutingProtocol | |
typedef Callback< void, Ptr< const Packet >, const Ipv6Header &, Socket::SocketErrno > | ErrorCallback |
Callback for routing errors (e.g., no route found) | |
typedef Callback< void, Ptr< const Packet >, const Ipv6Header &, uint32_t > | LocalDeliverCallback |
Callback for packets to be locally delivered. | |
typedef Callback< void, Ptr< const NetDevice >, Ptr< Ipv6MulticastRoute >, Ptr< const Packet >, const Ipv6Header & > | MulticastForwardCallback |
Callback for multicast packets to be forwarded. | |
typedef Callback< void, Ptr< const NetDevice >, Ptr< Ipv6Route >, Ptr< const Packet >, const Ipv6Header & > | UnicastForwardCallback |
Callback for unicast packets to be forwarded. | |
Public Member Functions | |
RipNg () | |
~RipNg () override | |
void | AddDefaultRouteTo (Ipv6Address nextHop, uint32_t interface) |
Add a default route to the router through the nextHop located on interface. | |
int64_t | AssignStreams (int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. | |
std::set< uint32_t > | GetInterfaceExclusions () const |
Get the set of interface excluded from the protocol. | |
uint8_t | GetInterfaceMetric (uint32_t interface) const |
Get the metric for an interface. | |
void | NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address) override |
Notify when specified interface add an address. | |
void | NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero()) override |
Notify a new route. | |
void | NotifyInterfaceDown (uint32_t interface) override |
Notify when specified interface goes DOWN. | |
void | NotifyInterfaceUp (uint32_t interface) override |
Notify when specified interface goes UP. | |
void | NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address) override |
Notify when specified interface add an address. | |
void | NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero()) override |
Notify route removing. | |
void | PrintRoutingTable (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const override |
Print the Routing Table entries. | |
bool | RouteInput (Ptr< const Packet > p, const Ipv6Header &header, Ptr< const NetDevice > idev, const UnicastForwardCallback &ucb, const MulticastForwardCallback &mcb, const LocalDeliverCallback &lcb, const ErrorCallback &ecb) override |
Route an input packet (to be forwarded or locally delivered) | |
Ptr< Ipv6Route > | RouteOutput (Ptr< Packet > p, const Ipv6Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) override |
Query routing cache for an existing route, for an outbound packet. | |
void | SetInterfaceExclusions (std::set< uint32_t > exceptions) |
Set the set of interface excluded from the protocol. | |
void | SetInterfaceMetric (uint32_t interface, uint8_t metric) |
Set the metric for an interface. | |
void | SetIpv6 (Ptr< Ipv6 > ipv6) override |
Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol. | |
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< Object > | GetObject () 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< Object > | GetObject (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. | |
SimpleRefCount & | operator= (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, bool permissive=false) 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. | |
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::Ipv6RoutingProtocol | |
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. | |
Protected Member Functions | |
void | DoDispose () override |
Dispose this object. | |
void | DoInitialize () override |
Start protocol operation. | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
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::list< std::pair< RipNgRoutingTableEntry *, EventId > > | Routes |
Container for the network routes - pair RipNgRoutingTableEntry *, EventId (update event) | |
typedef std::list< std::pair< RipNgRoutingTableEntry *, EventId > >::const_iterator | RoutesCI |
Const Iterator for container for the network routes. | |
typedef std::list< std::pair< RipNgRoutingTableEntry *, EventId > >::iterator | RoutesI |
Iterator for container for the network routes. | |
typedef std::map< Ptr< Socket >, uint32_t > | SocketList |
Socket list type. | |
typedef std::map< Ptr< Socket >, uint32_t >::const_iterator | SocketListCI |
Socket list type const iterator. | |
typedef std::map< Ptr< Socket >, uint32_t >::iterator | SocketListI |
Socket list type iterator. | |
Private Member Functions | |
void | AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse) |
Add route to network. | |
void | AddNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface) |
Add route to network. | |
void | DeleteRoute (RipNgRoutingTableEntry *route) |
Delete a route. | |
void | DoSendRouteUpdate (bool periodic) |
Send Routing Updates on all interfaces. | |
void | HandleRequests (RipNgHeader hdr, Ipv6Address senderAddress, uint16_t senderPort, uint32_t incomingInterface, uint8_t hopLimit) |
Handle RIPng requests. | |
void | HandleResponses (RipNgHeader hdr, Ipv6Address senderAddress, uint32_t incomingInterface, uint8_t hopLimit) |
Handle RIPng responses. | |
void | InvalidateRoute (RipNgRoutingTableEntry *route) |
Invalidate a route. | |
Ptr< Ipv6Route > | Lookup (Ipv6Address dest, bool setSource, Ptr< NetDevice >=nullptr) |
Lookup in the forwarding table for destination. | |
void | Receive (Ptr< Socket > socket) |
Receive RIPng packets. | |
void | RecvMulticastRipng (Ptr< Socket > socket) |
Receive and process multicast packet. | |
void | RecvUnicastRipng (Ptr< Socket > socket) |
Receive and process unicast packet. | |
void | SendRouteRequest () |
Send Routing Request on all interfaces. | |
void | SendTriggeredRouteUpdate () |
Send Triggered Routing Updates on all interfaces. | |
void | SendUnsolicitedRouteUpdate () |
Send Unsolicited Routing Updates on all interfaces. | |
Private Attributes | |
Time | m_garbageCollectionDelay |
Delay before deleting an INVALID route. | |
bool | m_initialized |
flag to allow socket's late-creation. | |
std::set< uint32_t > | m_interfaceExclusions |
Set of excluded interfaces. | |
std::map< uint32_t, uint8_t > | m_interfaceMetrics |
Map of interface metrics. | |
Ptr< Ipv6 > | m_ipv6 |
IPv6 reference. | |
uint8_t | m_linkDown |
Link down value. | |
Time | m_maxTriggeredUpdateDelay |
Max cooldown delay after a Triggered Update. | |
Time | m_minTriggeredUpdateDelay |
Min cooldown delay after a Triggered Update. | |
Ptr< Socket > | m_multicastRecvSocket |
multicast receive socket | |
EventId | m_nextTriggeredUpdate |
Next Triggered Update event. | |
EventId | m_nextUnsolicitedUpdate |
Next Unsolicited Update event. | |
Ptr< UniformRandomVariable > | m_rng |
Rng stream. | |
Routes | m_routes |
the forwarding table for network. | |
SplitHorizonType_e | m_splitHorizonStrategy |
Split Horizon strategy. | |
Time | m_startupDelay |
Random delay before protocol startup. | |
Time | m_timeoutDelay |
Delay before invalidating a route. | |
SocketList | m_unicastSocketList |
list of sockets for unicast messages (socket, interface index) | |
Time | m_unsolicitedUpdate |
time between two Unsolicited Routing Updates | |
Additional Inherited Members | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
|
private |
Container for the network routes - pair RipNgRoutingTableEntry *, EventId (update event)
|
private |
|
private |
|
private |
|
private |
|
private |
ns3::RipNg::RipNg | ( | ) |
Definition at line 38 of file ripng.cc.
References ns3::CreateObject(), and m_rng.
void ns3::RipNg::AddDefaultRouteTo | ( | Ipv6Address | nextHop, |
uint32_t | interface ) |
Add a default route to the router through the nextHop located on interface.
The default route is usually installed manually, or it is the result of some "other" routing protocol (e.g., BGP).
nextHop | the next hop |
interface | the interface |
Definition at line 1385 of file ripng.cc.
References AddNetworkRouteTo(), ns3::Ipv6Prefix::GetZero(), and NS_LOG_FUNCTION.
|
private |
Add route to network.
network | network address |
networkPrefix | network prefix |
nextHop | next hop address to route the packet. |
interface | interface index |
prefixToUse | prefix that should be used for source address for this destination |
Definition at line 685 of file ripng.cc.
References ns3::Ipv6Address::IsLinkLocal(), m_routes, NS_LOG_FUNCTION, NS_LOG_WARN, and ns3::RipNgRoutingTableEntry::RIPNG_VALID.
Referenced by AddDefaultRouteTo(), NotifyAddAddress(), and NotifyInterfaceUp().
|
private |
Add route to network.
network | network address |
networkPrefix | network prefix |
interface | interface index |
Definition at line 708 of file ripng.cc.
References m_routes, NS_LOG_FUNCTION, and ns3::RipNgRoutingTableEntry::RIPNG_VALID.
int64_t ns3::RipNg::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 107 of file ripng.cc.
References m_rng, and NS_LOG_FUNCTION.
|
private |
Delete a route.
route | the route to be removed |
Definition at line 745 of file ripng.cc.
References m_routes, NS_ABORT_MSG, and NS_LOG_FUNCTION.
Referenced by InvalidateRoute().
|
overrideprotectedvirtual |
Dispose this object.
Reimplemented from ns3::Object.
Definition at line 564 of file ripng.cc.
References ns3::EventId::Cancel(), ns3::Socket::Close(), ns3::Object::DoDispose(), m_ipv6, m_multicastRecvSocket, m_nextTriggeredUpdate, m_nextUnsolicitedUpdate, m_routes, m_unicastSocketList, and NS_LOG_FUNCTION.
|
overrideprotectedvirtual |
Start protocol operation.
Reimplemented from ns3::Object.
Definition at line 116 of file ripng.cc.
References ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::Object::DoInitialize(), DoSendRouteUpdate(), ns3::Ipv6::GetAddress(), ns3::Ipv6::GetNAddresses(), ns3::Ipv6::GetNetDevice(), ns3::Ipv6::GetNInterfaces(), ns3::Object::GetObject(), ns3::Ipv6InterfaceAddress::GetScope(), ns3::Time::GetSeconds(), ns3::Ipv6InterfaceAddress::GLOBAL, ns3::Ipv6InterfaceAddress::LINKLOCAL, ns3::TypeId::LookupByName(), m_initialized, m_interfaceExclusions, m_ipv6, m_maxTriggeredUpdateDelay, m_minTriggeredUpdateDelay, m_multicastRecvSocket, m_nextTriggeredUpdate, m_nextUnsolicitedUpdate, m_rng, m_startupDelay, m_unicastSocketList, m_unsolicitedUpdate, ns3::MakeCallback(), NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, Receive(), RIPNG_ALL_NODE, RIPNG_PORT, ns3::Simulator::Schedule(), ns3::Seconds(), SendRouteRequest(), SendUnsolicitedRouteUpdate(), ns3::Ipv6::SetForwarding(), ns3::Socket::SetIpv6RecvHopLimit(), ns3::Socket::SetRecvCallback(), and ns3::Socket::SetRecvPktInfo().
|
private |
Send Routing Updates on all interfaces.
periodic | true for periodic update, else triggered. |
Definition at line 1180 of file ripng.cc.
References ns3::RipNgHeader::AddRte(), ns3::RipNgHeader::ClearRtes(), ns3::Create(), ns3::Ipv6Address::GetAny(), ns3::Ipv6::GetMtu(), ns3::RipNgHeader::GetRteNumber(), ns3::Ipv6InterfaceAddress::GetScope(), ns3::Ipv6Header::GetSerializedSize(), ns3::RipNgHeader::GetSerializedSize(), ns3::RipNgRte::GetSerializedSize(), ns3::UdpHeader::GetSerializedSize(), ns3::Ipv6Prefix::GetZero(), ns3::Ipv6InterfaceAddress::GLOBAL, m_interfaceExclusions, m_ipv6, m_linkDown, m_routes, m_splitHorizonStrategy, m_unicastSocketList, NS_LOG_DEBUG, NS_LOG_FUNCTION, POISON_REVERSE, ns3::RipNgHeader::RESPONSE, RIPNG_ALL_NODE, RIPNG_PORT, ns3::RipNgHeader::SetCommand(), ns3::SocketIpv6HopLimitTag::SetHopLimit(), ns3::RipNgRte::SetPrefix(), ns3::RipNgRte::SetPrefixLen(), ns3::RipNgRte::SetRouteMetric(), ns3::RipNgRte::SetRouteTag(), and SPLIT_HORIZON.
Referenced by DoInitialize(), SendTriggeredRouteUpdate(), and SendUnsolicitedRouteUpdate().
std::set< uint32_t > ns3::RipNg::GetInterfaceExclusions | ( | ) | const |
Get the set of interface excluded from the protocol.
Definition at line 1313 of file ripng.cc.
References m_interfaceExclusions.
uint8_t ns3::RipNg::GetInterfaceMetric | ( | uint32_t | interface | ) | const |
Get the metric for an interface.
interface | the interface |
Definition at line 1327 of file ripng.cc.
References m_interfaceMetrics, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 51 of file ripng.cc.
References m_garbageCollectionDelay, m_linkDown, m_maxTriggeredUpdateDelay, m_minTriggeredUpdateDelay, m_splitHorizonStrategy, m_startupDelay, m_timeoutDelay, m_unsolicitedUpdate, ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeUintegerAccessor(), ns3::MakeUintegerChecker(), NO_SPLIT_HORIZON, POISON_REVERSE, ns3::Seconds(), ns3::TypeId::SetParent(), and SPLIT_HORIZON.
|
private |
Handle RIPng requests.
hdr | message header (including RTEs) |
senderAddress | sender address |
senderPort | sender port |
incomingInterface | incoming interface |
hopLimit | packet's hop limit |
Definition at line 816 of file ripng.cc.
References ns3::RipNgHeader::AddRte(), ns3::RipNgHeader::ClearRtes(), ns3::Ipv6Address::CombinePrefix(), ns3::Create(), ns3::Ipv6Address::GetAny(), ns3::Ipv6::GetMtu(), ns3::RipNgHeader::GetRteList(), ns3::RipNgHeader::GetRteNumber(), ns3::Ipv6InterfaceAddress::GetScope(), ns3::Ipv6Header::GetSerializedSize(), ns3::RipNgHeader::GetSerializedSize(), ns3::RipNgRte::GetSerializedSize(), ns3::UdpHeader::GetSerializedSize(), ns3::Ipv6Prefix::GetZero(), ns3::Ipv6InterfaceAddress::GLOBAL, ns3::Ipv6Address::IsLinkLocal(), m_interfaceExclusions, m_ipv6, m_linkDown, m_multicastRecvSocket, m_routes, m_splitHorizonStrategy, m_unicastSocketList, NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, POISON_REVERSE, ns3::RipNgHeader::RESPONSE, RIPNG_PORT, ns3::RipNgRoutingTableEntry::RIPNG_VALID, ns3::RipNgHeader::SetCommand(), ns3::SocketIpv6HopLimitTag::SetHopLimit(), ns3::RipNgRte::SetPrefix(), ns3::RipNgRte::SetPrefixLen(), ns3::RipNgRte::SetRouteMetric(), ns3::RipNgRte::SetRouteTag(), and SPLIT_HORIZON.
Referenced by Receive().
|
private |
Handle RIPng responses.
hdr | message header (including RTEs) |
senderAddress | sender address |
incomingInterface | incoming interface |
hopLimit | packet's hop limit |
Definition at line 994 of file ripng.cc.
References ns3::Ipv6Address::CombinePrefix(), ns3::Ipv6Address::GetAny(), ns3::Simulator::GetDelayLeft(), ns3::RipNgHeader::GetRteList(), InvalidateRoute(), ns3::Ipv6Address::IsLinkLocal(), m_interfaceExclusions, m_interfaceMetrics, m_linkDown, m_routes, m_timeoutDelay, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::RipNgRoutingTableEntry::RIPNG_VALID, ns3::Simulator::Schedule(), and SendTriggeredRouteUpdate().
Referenced by Receive().
|
private |
Invalidate a route.
route | the route to be removed |
Definition at line 721 of file ripng.cc.
References DeleteRoute(), m_garbageCollectionDelay, m_linkDown, m_routes, NS_ABORT_MSG, NS_LOG_FUNCTION, ns3::RipNgRoutingTableEntry::RIPNG_INVALID, ns3::Simulator::Schedule(), ns3::RipNgRoutingTableEntry::SetRouteChanged(), ns3::RipNgRoutingTableEntry::SetRouteMetric(), and ns3::RipNgRoutingTableEntry::SetRouteStatus().
Referenced by HandleResponses(), NotifyInterfaceDown(), and NotifyRemoveAddress().
|
private |
Lookup in the forwarding table for destination.
dest | destination address |
setSource | set source address in the route |
interface | output interface if any (put 0 otherwise) |
Definition at line 594 of file ripng.cc.
References ns3::Create(), ns3::Ipv6RoutingTableEntry::GetDest(), ns3::Ipv6RoutingTableEntry::GetDestNetwork(), ns3::Ipv6RoutingTableEntry::GetDestNetworkPrefix(), ns3::Ipv6RoutingTableEntry::GetGateway(), ns3::Ipv6RoutingTableEntry::GetInterface(), ns3::Ipv6::GetInterfaceForDevice(), ns3::Ipv6::GetNetDevice(), ns3::Ipv6Prefix::GetPrefixLength(), ns3::Ipv6RoutingTableEntry::GetPrefixToUse(), ns3::RipNgRoutingTableEntry::GetRouteStatus(), ns3::Ipv6Address::GetZero(), ns3::Ipv6Address::IsAny(), ns3::Ipv6Address::IsLinkLocalMulticast(), ns3::Ipv6Prefix::IsMatch(), m_ipv6, m_routes, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::RipNgRoutingTableEntry::RIPNG_VALID, and ns3::Ipv6::SourceAddressSelection().
Referenced by RouteInput(), and RouteOutput().
|
overridevirtual |
Notify when specified interface add an address.
Protocols are expected to implement this method to be notified whenever a new address is added to an interface. Typically used to add a 'network route' on an interface. Can be invoked on an up or down interface.
interface | the index of the interface we are being notified about |
address | a new address being added to an interface |
Implements ns3::Ipv6RoutingProtocol.
Definition at line 393 of file ripng.cc.
References AddNetworkRouteTo(), ns3::Ipv6InterfaceAddress::GLOBAL, ns3::Ipv6::IsUp(), m_interfaceExclusions, m_ipv6, NS_LOG_FUNCTION, and SendTriggeredRouteUpdate().
|
overridevirtual |
Notify a new route.
Typically this is used to add another route from IPv6 stack (i.e. ICMPv6 redirect case, ...).
dst | destination address |
mask | destination mask |
nextHop | nextHop for this destination |
interface | output interface |
prefixToUse | prefix to use as source with this route |
Implements ns3::Ipv6RoutingProtocol.
Definition at line 455 of file ripng.cc.
References NS_LOG_INFO.
|
overridevirtual |
Notify when specified interface goes DOWN.
Protocols are expected to implement this method to be notified of the state change of an interface in a node.
interface | the index of the interface we are being notified about |
Implements ns3::Ipv6RoutingProtocol.
Definition at line 361 of file ripng.cc.
References InvalidateRoute(), m_interfaceExclusions, m_routes, m_unicastSocketList, NS_LOG_FUNCTION, NS_LOG_INFO, and SendTriggeredRouteUpdate().
Referenced by SetIpv6().
|
overridevirtual |
Notify when specified interface goes UP.
Protocols are expected to implement this method to be notified of the state change of an interface in a node.
interface | the index of the interface we are being notified about |
Implements ns3::Ipv6RoutingProtocol.
Definition at line 283 of file ripng.cc.
References AddNetworkRouteTo(), ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::Ipv6::GetAddress(), ns3::Ipv6::GetNAddresses(), ns3::Ipv6::GetNetDevice(), ns3::Object::GetObject(), ns3::Ipv6InterfaceAddress::GLOBAL, ns3::Ipv6InterfaceAddress::LINKLOCAL, ns3::TypeId::LookupByName(), m_initialized, m_interfaceExclusions, m_ipv6, m_multicastRecvSocket, m_unicastSocketList, ns3::MakeCallback(), NS_LOG_FUNCTION, NS_LOG_LOGIC, Receive(), RIPNG_ALL_NODE, RIPNG_PORT, SendTriggeredRouteUpdate(), ns3::Ipv6::SetForwarding(), ns3::Socket::SetIpv6RecvHopLimit(), ns3::Socket::SetRecvCallback(), and ns3::Socket::SetRecvPktInfo().
Referenced by SetIpv6().
|
overridevirtual |
Notify when specified interface add an address.
Protocols are expected to implement this method to be notified whenever a new address is removed from an interface. Typically used to remove the 'network route' of an interface. Can be invoked on an up or down interface.
interface | the index of the interface we are being notified about |
address | a new address being added to an interface |
Implements ns3::Ipv6RoutingProtocol.
Definition at line 419 of file ripng.cc.
References ns3::Ipv6InterfaceAddress::GLOBAL, InvalidateRoute(), ns3::Ipv6::IsUp(), m_interfaceExclusions, m_ipv6, m_routes, NS_LOG_FUNCTION, and SendTriggeredRouteUpdate().
|
overridevirtual |
Notify route removing.
dst | destination address |
mask | destination mask |
nextHop | nextHop for this destination |
interface | output interface |
prefixToUse | prefix to use as source with this route |
Implements ns3::Ipv6RoutingProtocol.
Definition at line 466 of file ripng.cc.
References NS_LOG_FUNCTION.
|
overridevirtual |
Print the Routing Table entries.
stream | The ostream the Routing table is printed to |
unit | The time unit to be used in the report |
Implements ns3::Ipv6RoutingProtocol.
Definition at line 499 of file ripng.cc.
References ns3::Time::As(), ns3::Names::FindName(), ns3::Ipv6RoutingTableEntry::GetDest(), ns3::Ipv6RoutingTableEntry::GetDestNetworkPrefix(), ns3::Ipv6RoutingTableEntry::GetGateway(), ns3::Ipv6RoutingTableEntry::GetInterface(), ns3::Ipv6::GetNetDevice(), ns3::Object::GetObject(), ns3::Ipv6Prefix::GetPrefixLength(), ns3::RipNgRoutingTableEntry::GetRouteMetric(), ns3::RipNgRoutingTableEntry::GetRouteStatus(), ns3::Ipv6RoutingTableEntry::IsGateway(), ns3::Ipv6RoutingTableEntry::IsHost(), m_ipv6, m_routes, ns3::Now(), NS_LOG_FUNCTION, and ns3::RipNgRoutingTableEntry::RIPNG_VALID.
Receive RIPng packets.
socket | the socket the packet was received to. |
Definition at line 762 of file ripng.cc.
References ns3::Inet6SocketAddress::ConvertFrom(), ns3::RipNgHeader::GetCommand(), ns3::SocketIpv6HopLimitTag::GetHopLimit(), ns3::Ipv6::GetInterfaceForAddress(), ns3::Ipv6::GetInterfaceForDevice(), ns3::Inet6SocketAddress::GetIpv6(), ns3::Object::GetObject(), ns3::Inet6SocketAddress::GetPort(), ns3::Ipv6PacketInfoTag::GetRecvIf(), HandleRequests(), HandleResponses(), m_ipv6, NS_ABORT_MSG, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, ns3::RipNgHeader::REQUEST, and ns3::RipNgHeader::RESPONSE.
Referenced by DoInitialize(), and NotifyInterfaceUp().
Receive and process multicast packet.
socket | socket where packet is arrived |
Receive and process unicast packet.
socket | socket where packet is arrived |
|
overridevirtual |
Route an input packet (to be forwarded or locally delivered)
This lookup is used in the forwarding process. The packet is handed over to the Ipv6RoutingProtocol, and will get forwarded onward by one of the callbacks. The Linux equivalent is ip_route_input (). There are four valid outcomes, and a matching callbacks to handle each.
p | received packet |
header | input parameter used to form a search key for a route |
idev | Pointer to ingress network device |
ucb | Callback for the case in which the packet is to be forwarded as unicast |
mcb | Callback for the case in which the packet is to be forwarded as multicast |
lcb | Callback for the case in which the packet is to be locally delivered |
ecb | Callback to call if there is an error in forwarding |
Implements ns3::Ipv6RoutingProtocol.
Definition at line 223 of file ripng.cc.
References ns3::Socket::ERROR_NOROUTETOHOST, ns3::Ipv6Header::GetDestination(), ns3::Ipv6::GetInterfaceForDevice(), ns3::Ipv6Header::GetSource(), ns3::Ipv6::IsForwarding(), ns3::Ipv6Address::IsLinkLocal(), ns3::Ipv6Address::IsMulticast(), ns3::Callback< R, UArgs >::IsNull(), Lookup(), m_ipv6, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
|
overridevirtual |
Query routing cache for an existing route, for an outbound packet.
This lookup is used by transport protocols. It does not cause any packet to be forwarded, and is synchronous. Can be used for multicast or unicast. The Linux equivalent is ip_route_output ()
p | packet to be routed. Note that this method may modify the packet. Callers may also pass in a null pointer. |
header | input parameter (used to form key to search for the route) |
oif | Output interface device. May be zero, or may be bound via socket options to a particular output interface. |
sockerr | Output parameter; socket errno |
Implements ns3::Ipv6RoutingProtocol.
Definition at line 189 of file ripng.cc.
References ns3::Socket::ERROR_NOROUTETOHOST, ns3::Socket::ERROR_NOTERROR, ns3::Ipv6Header::GetDestination(), ns3::Ipv6Address::IsMulticast(), Lookup(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.
|
private |
Send Routing Request on all interfaces.
Definition at line 1351 of file ripng.cc.
References ns3::RipNgHeader::AddRte(), ns3::Create(), ns3::Ipv6Address::GetAny(), m_interfaceExclusions, m_linkDown, m_unicastSocketList, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::RipNgHeader::REQUEST, RIPNG_ALL_NODE, RIPNG_PORT, ns3::RipNgHeader::SetCommand(), ns3::SocketIpv6HopLimitTag::SetHopLimit(), ns3::RipNgRte::SetPrefix(), ns3::RipNgRte::SetPrefixLen(), and ns3::RipNgRte::SetRouteMetric().
Referenced by DoInitialize().
|
private |
Send Triggered Routing Updates on all interfaces.
Definition at line 1264 of file ripng.cc.
References DoSendRouteUpdate(), ns3::Time::GetSeconds(), ns3::EventId::IsPending(), m_maxTriggeredUpdateDelay, m_minTriggeredUpdateDelay, m_nextTriggeredUpdate, m_rng, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Simulator::Schedule(), and ns3::Seconds().
Referenced by HandleResponses(), NotifyAddAddress(), NotifyInterfaceDown(), NotifyInterfaceUp(), and NotifyRemoveAddress().
|
private |
Send Unsolicited Routing Updates on all interfaces.
Definition at line 1296 of file ripng.cc.
References ns3::EventId::Cancel(), DoSendRouteUpdate(), ns3::Time::GetSeconds(), ns3::EventId::IsPending(), m_nextTriggeredUpdate, m_nextUnsolicitedUpdate, m_rng, m_unsolicitedUpdate, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ns3::Seconds(), and SendUnsolicitedRouteUpdate().
Referenced by DoInitialize(), and SendUnsolicitedRouteUpdate().
void ns3::RipNg::SetInterfaceExclusions | ( | std::set< uint32_t > | exceptions | ) |
Set the set of interface excluded from the protocol.
exceptions | the set of excluded interfaces |
Definition at line 1319 of file ripng.cc.
References m_interfaceExclusions, and NS_LOG_FUNCTION.
void ns3::RipNg::SetInterfaceMetric | ( | uint32_t | interface, |
uint8_t | metric ) |
Set the metric for an interface.
interface | the interface |
metric | the interface metric |
Definition at line 1340 of file ripng.cc.
References m_interfaceMetrics, m_linkDown, and NS_LOG_FUNCTION.
Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol.
ipv6 | the ipv6 object this routing protocol is being associated with |
Implements ns3::Ipv6RoutingProtocol.
Definition at line 477 of file ripng.cc.
References ns3::Ipv6::GetNInterfaces(), ns3::Ipv6::IsUp(), m_ipv6, NotifyInterfaceDown(), NotifyInterfaceUp(), NS_ASSERT, and NS_LOG_FUNCTION.
|
private |
Delay before deleting an INVALID route.
Definition at line 404 of file ripng.h.
Referenced by GetTypeId(), and InvalidateRoute().
|
private |
flag to allow socket's late-creation.
Definition at line 429 of file ripng.h.
Referenced by DoInitialize(), and NotifyInterfaceUp().
|
private |
Set of excluded interfaces.
Definition at line 424 of file ripng.h.
Referenced by DoInitialize(), DoSendRouteUpdate(), GetInterfaceExclusions(), HandleRequests(), HandleResponses(), NotifyAddAddress(), NotifyInterfaceDown(), NotifyInterfaceUp(), NotifyRemoveAddress(), SendRouteRequest(), and SetInterfaceExclusions().
|
private |
Map of interface metrics.
Definition at line 425 of file ripng.h.
Referenced by GetInterfaceMetric(), HandleResponses(), and SetInterfaceMetric().
IPv6 reference.
Definition at line 398 of file ripng.h.
Referenced by DoDispose(), DoInitialize(), DoSendRouteUpdate(), HandleRequests(), Lookup(), NotifyAddAddress(), NotifyInterfaceUp(), NotifyRemoveAddress(), PrintRoutingTable(), Receive(), RouteInput(), and SetIpv6().
|
private |
Link down value.
Definition at line 430 of file ripng.h.
Referenced by DoSendRouteUpdate(), GetTypeId(), HandleRequests(), HandleResponses(), InvalidateRoute(), SendRouteRequest(), and SetInterfaceMetric().
|
private |
Max cooldown delay after a Triggered Update.
Definition at line 401 of file ripng.h.
Referenced by DoInitialize(), GetTypeId(), and SendTriggeredRouteUpdate().
|
private |
Min cooldown delay after a Triggered Update.
Definition at line 400 of file ripng.h.
Referenced by DoInitialize(), GetTypeId(), and SendTriggeredRouteUpdate().
multicast receive socket
Definition at line 417 of file ripng.h.
Referenced by DoDispose(), DoInitialize(), HandleRequests(), and NotifyInterfaceUp().
|
private |
Next Triggered Update event.
Definition at line 420 of file ripng.h.
Referenced by DoDispose(), DoInitialize(), SendTriggeredRouteUpdate(), and SendUnsolicitedRouteUpdate().
|
private |
Next Unsolicited Update event.
Definition at line 419 of file ripng.h.
Referenced by DoDispose(), DoInitialize(), and SendUnsolicitedRouteUpdate().
|
private |
Rng stream.
Definition at line 422 of file ripng.h.
Referenced by RipNg(), AssignStreams(), DoInitialize(), SendTriggeredRouteUpdate(), and SendUnsolicitedRouteUpdate().
|
private |
the forwarding table for network.
Definition at line 397 of file ripng.h.
Referenced by AddNetworkRouteTo(), AddNetworkRouteTo(), DeleteRoute(), DoDispose(), DoSendRouteUpdate(), HandleRequests(), HandleResponses(), InvalidateRoute(), Lookup(), NotifyInterfaceDown(), NotifyRemoveAddress(), and PrintRoutingTable().
|
private |
Split Horizon strategy.
Definition at line 427 of file ripng.h.
Referenced by DoSendRouteUpdate(), GetTypeId(), and HandleRequests().
|
private |
Random delay before protocol startup.
Definition at line 399 of file ripng.h.
Referenced by DoInitialize(), and GetTypeId().
|
private |
Delay before invalidating a route.
Definition at line 403 of file ripng.h.
Referenced by GetTypeId(), and HandleResponses().
|
private |
list of sockets for unicast messages (socket, interface index)
Definition at line 416 of file ripng.h.
Referenced by DoDispose(), DoInitialize(), DoSendRouteUpdate(), HandleRequests(), NotifyInterfaceDown(), NotifyInterfaceUp(), and SendRouteRequest().
|
private |
time between two Unsolicited Routing Updates
Definition at line 402 of file ripng.h.
Referenced by DoInitialize(), GetTypeId(), and SendUnsolicitedRouteUpdate().