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

RIP Routing Protocol, defined in RFC 2453. More...

#include "rip.h"

+ Inheritance diagram for ns3::Rip:
+ Collaboration diagram for ns3::Rip:

Public Types

enum  SplitHorizonType_e { NO_SPLIT_HORIZON , SPLIT_HORIZON , POISON_REVERSE }
 Split Horizon strategy type. More...
 
- Public Types inherited from ns3::Ipv4RoutingProtocol
typedef Callback< void, Ptr< const Packet >, const Ipv4Header &, Socket::SocketErrnoErrorCallback
 Callback for routing errors (e.g., no route found)
 
typedef Callback< void, Ptr< const Packet >, const Ipv4Header &, uint32_tLocalDeliverCallback
 Callback for packets to be locally delivered.
 
typedef Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const Ipv4Header & > MulticastForwardCallback
 Callback for multicast packets to be forwarded.
 
typedef Callback< void, Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > UnicastForwardCallback
 Callback for unicast packets to be forwarded.
 

Public Member Functions

 Rip ()
 
 ~Rip () override
 
void AddDefaultRouteTo (Ipv4Address 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_tGetInterfaceExclusions () 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, Ipv4InterfaceAddress address) override
 
void NotifyInterfaceDown (uint32_t interface) override
 
void NotifyInterfaceUp (uint32_t interface) override
 
void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) override
 
void PrintRoutingTable (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const override
 Print the Routing Table entries.
 
bool RouteInput (Ptr< const Packet > p, const Ipv4Header &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< Ipv4RouteRouteOutput (Ptr< Packet > p, const Ipv4Header &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 SetIpv4 (Ptr< Ipv4 > ipv4) override
 
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)=0
 
virtual void NotifyInterfaceDown (uint32_t interface)=0
 
virtual void NotifyInterfaceUp (uint32_t interface)=0
 
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)=0
 
virtual void PrintRoutingTable (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const =0
 Print the Routing Table entries.
 
virtual bool RouteInput (Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, const UnicastForwardCallback &ucb, const MulticastForwardCallback &mcb, const LocalDeliverCallback &lcb, const ErrorCallback &ecb)=0
 Route an input packet (to be forwarded or locally delivered)
 
virtual Ptr< Ipv4RouteRouteOutput (Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)=0
 Query routing cache for an existing route, for an outbound packet.
 
virtual void SetIpv4 (Ptr< Ipv4 > ipv4)=0
 
- 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::Ipv4RoutingProtocol
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 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::list< std::pair< RipRoutingTableEntry *, EventId > > Routes
 Container for the network routes - pair RipRoutingTableEntry *, EventId (update event)
 
typedef std::list< std::pair< RipRoutingTableEntry *, EventId > >::const_iterator RoutesCI
 Const Iterator for container for the network routes.
 
typedef std::list< std::pair< RipRoutingTableEntry *, EventId > >::iterator RoutesI
 Iterator for container for the network routes.
 
typedef std::map< Ptr< Socket >, uint32_tSocketList
 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 (Ipv4Address network, Ipv4Mask networkPrefix, Ipv4Address nextHop, uint32_t interface)
 Add route to network.
 
void AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkPrefix, uint32_t interface)
 Add route to network.
 
void DeleteRoute (RipRoutingTableEntry *route)
 Delete a route.
 
void DoSendRouteUpdate (bool periodic)
 Send Routing Updates on all interfaces.
 
void HandleRequests (RipHeader hdr, Ipv4Address senderAddress, uint16_t senderPort, uint32_t incomingInterface, uint8_t hopLimit)
 Handle RIP requests.
 
void HandleResponses (RipHeader hdr, Ipv4Address senderAddress, uint32_t incomingInterface, uint8_t hopLimit)
 Handle RIP responses.
 
void InvalidateRoute (RipRoutingTableEntry *route)
 Invalidate a route.
 
Ptr< Ipv4RouteLookup (Ipv4Address dest, bool setSource, Ptr< NetDevice >=nullptr)
 Lookup in the forwarding table for destination.
 
void Receive (Ptr< Socket > socket)
 Receive RIP packets.
 
void RecvMulticastRip (Ptr< Socket > socket)
 Receive and process multicast packet.
 
void RecvUnicastRip (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_tm_interfaceExclusions
 Set of excluded interfaces.
 
std::map< uint32_t, uint8_t > m_interfaceMetrics
 Map of interface metrics.
 
Ptr< Ipv4m_ipv4
 IPv4 reference.
 
uint32_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< Socketm_multicastRecvSocket
 multicast receive socket
 
EventId m_nextTriggeredUpdate
 Next Triggered Update event.
 
EventId m_nextUnsolicitedUpdate
 Next Unsolicited Update event.
 
Ptr< UniformRandomVariablem_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

Detailed Description

RIP Routing Protocol, defined in RFC 2453.

Introspection did not find any typical Config paths.


Attributes

  • GarbageCollectionDelay: The delay to delete an expired route.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1.2e+11ns
    • Flags: constructwriteread
  • LinkDownValue: Value for link down in count to infinity.
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Initial value: 16
    • Flags: constructwriteread
  • MaxTriggeredCooldown: Max cooldown delay after a Triggered Update.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +5e+09ns
    • Flags: constructwriteread
  • MinTriggeredCooldown: Min cooldown delay after a Triggered Update.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+09ns
    • Flags: constructwriteread
  • SplitHorizon: Split Horizon strategy.
  • StartupDelay: Maximum random delay for protocol startup (send route requests).
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1e+09ns
    • Flags: constructwriteread
  • TimeoutDelay: The delay to invalidate a route.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +1.8e+11ns
    • Flags: constructwriteread
  • UnsolicitedRoutingUpdate: The time between two Unsolicited Routing Updates.
    • Set with class: ns3::TimeValue
    • Underlying type: Time +9.22337e+18ns:+9.22337e+18ns
    • Initial value: +3e+10ns
    • Flags: constructwriteread

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

Definition at line 175 of file rip.h.

Member Typedef Documentation

◆ Routes

typedef std::list<std::pair<RipRoutingTableEntry*, EventId> > ns3::Rip::Routes
private

Container for the network routes - pair RipRoutingTableEntry *, EventId (update event)

Definition at line 278 of file rip.h.

◆ RoutesCI

typedef std::list<std::pair<RipRoutingTableEntry*,EventId>>::const_iterator ns3::Rip::RoutesCI
private

Const Iterator for container for the network routes.

Definition at line 281 of file rip.h.

◆ RoutesI

typedef std::list<std::pair<RipRoutingTableEntry*,EventId>>::iterator ns3::Rip::RoutesI
private

Iterator for container for the network routes.

Definition at line 284 of file rip.h.

◆ SocketList

typedef std::map<Ptr<Socket>, uint32_t> ns3::Rip::SocketList
private

Socket list type.

Definition at line 406 of file rip.h.

◆ SocketListCI

typedef std::map<Ptr<Socket>,uint32_t>::const_iterator ns3::Rip::SocketListCI
private

Socket list type const iterator.

Definition at line 410 of file rip.h.

◆ SocketListI

typedef std::map<Ptr<Socket>,uint32_t>::iterator ns3::Rip::SocketListI
private

Socket list type iterator.

Definition at line 408 of file rip.h.

Member Enumeration Documentation

◆ SplitHorizonType_e

Split Horizon strategy type.

See RFC 2453.

Enumerator
NO_SPLIT_HORIZON 

No Split Horizon.

SPLIT_HORIZON 

Split Horizon.

POISON_REVERSE 

Poison Reverse Split Horizon.

Definition at line 211 of file rip.h.

Constructor & Destructor Documentation

◆ Rip()

ns3::Rip::Rip ( )

Definition at line 49 of file rip.cc.

References m_rng.

◆ ~Rip()

ns3::Rip::~Rip ( )
override

Definition at line 57 of file rip.cc.

Member Function Documentation

◆ AddDefaultRouteTo()

void ns3::Rip::AddDefaultRouteTo ( Ipv4Address  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).

Parameters
nextHopthe next hop
interfacethe interface

Definition at line 1398 of file rip.cc.

References AddNetworkRouteTo(), ns3::Ipv4Mask::GetZero(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ AddNetworkRouteTo() [1/2]

void ns3::Rip::AddNetworkRouteTo ( Ipv4Address  network,
Ipv4Mask  networkPrefix,
Ipv4Address  nextHop,
uint32_t  interface 
)
private

Add route to network.

Parameters
networknetwork address
networkPrefixnetwork prefix
nextHopnext hop address to route the packet.
interfaceinterface index

Definition at line 704 of file rip.cc.

References m_routes, NS_LOG_FUNCTION, and ns3::RipRoutingTableEntry::RIP_VALID.

Referenced by AddDefaultRouteTo(), NotifyAddAddress(), and NotifyInterfaceUp().

+ Here is the caller graph for this function:

◆ AddNetworkRouteTo() [2/2]

void ns3::Rip::AddNetworkRouteTo ( Ipv4Address  network,
Ipv4Mask  networkPrefix,
uint32_t  interface 
)
private

Add route to network.

Parameters
networknetwork address
networkPrefixnetwork prefix
interfaceinterface index

Definition at line 720 of file rip.cc.

References m_routes, NS_LOG_FUNCTION, and ns3::RipRoutingTableEntry::RIP_VALID.

◆ AssignStreams()

int64_t ns3::Rip::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.

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

Definition at line 118 of file rip.cc.

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

+ Here is the call graph for this function:

◆ DeleteRoute()

void ns3::Rip::DeleteRoute ( RipRoutingTableEntry route)
private

Delete a route.

Parameters
routethe route to be removed

Definition at line 757 of file rip.cc.

References m_routes, NS_ABORT_MSG, and NS_LOG_FUNCTION.

Referenced by InvalidateRoute().

+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::Rip::DoDispose ( )
overrideprotectedvirtual

Dispose this object.

Reimplemented from ns3::Object.

Definition at line 591 of file rip.cc.

References ns3::EventId::Cancel(), ns3::Socket::Close(), ns3::Object::DoDispose(), m_ipv4, m_multicastRecvSocket, m_nextTriggeredUpdate, m_nextUnsolicitedUpdate, m_routes, m_unicastSocketList, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ DoInitialize()

◆ DoSendRouteUpdate()

void ns3::Rip::DoSendRouteUpdate ( bool  periodic)
private

◆ GetInterfaceExclusions()

std::set< uint32_t > ns3::Rip::GetInterfaceExclusions ( ) const

Get the set of interface excluded from the protocol.

Returns
the set of excluded interfaces

Definition at line 1326 of file rip.cc.

References m_interfaceExclusions.

◆ GetInterfaceMetric()

uint8_t ns3::Rip::GetInterfaceMetric ( uint32_t  interface) const

Get the metric for an interface.

Parameters
interfacethe interface
Returns
the interface metric

Definition at line 1340 of file rip.cc.

References m_interfaceMetrics, and NS_LOG_FUNCTION.

◆ GetTypeId()

TypeId ns3::Rip::GetTypeId ( )
static

Get the type ID.

Returns
type ID

Definition at line 62 of file rip.cc.

References m_garbageCollectionDelay, m_linkDown, m_maxTriggeredUpdateDelay, m_minTriggeredUpdateDelay, m_splitHorizonStrategy, m_startupDelay, m_timeoutDelay, m_unsolicitedUpdate, ns3::MakeEnumChecker(), ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeUintegerAccessor(), NO_SPLIT_HORIZON, POISON_REVERSE, ns3::Seconds(), ns3::TypeId::SetParent(), and SPLIT_HORIZON.

+ Here is the call graph for this function:

◆ HandleRequests()

void ns3::Rip::HandleRequests ( RipHeader  hdr,
Ipv4Address  senderAddress,
uint16_t  senderPort,
uint32_t  incomingInterface,
uint8_t  hopLimit 
)
private

Handle RIP requests.

Parameters
hdrmessage header (including RTEs)
senderAddresssender address
senderPortsender port
incomingInterfaceincoming interface
hopLimitpacket's hop limit

Definition at line 842 of file rip.cc.

References ns3::RipHeader::AddRte(), ns3::RipHeader::ClearRtes(), ns3::Ipv4Address::CombineMask(), ns3::Ipv4Address::GetAny(), ns3::RipHeader::GetRteList(), ns3::RipHeader::GetRteNumber(), ns3::Ipv4InterfaceAddress::GetScope(), ns3::Ipv4Header::GetSerializedSize(), ns3::RipRte::GetSerializedSize(), ns3::RipHeader::GetSerializedSize(), ns3::UdpHeader::GetSerializedSize(), ns3::Ipv4Mask::GetZero(), ns3::Ipv4InterfaceAddress::GLOBAL, m_interfaceExclusions, m_ipv4, m_linkDown, m_multicastRecvSocket, m_routes, m_splitHorizonStrategy, m_unicastSocketList, NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, POISON_REVERSE, ns3::RipHeader::RESPONSE, RIP_ALL_NODE, RIP_PORT, ns3::RipRoutingTableEntry::RIP_VALID, ns3::Socket::SendTo(), ns3::RipHeader::SetCommand(), ns3::RipRte::SetPrefix(), ns3::RipRte::SetRouteMetric(), ns3::RipRte::SetRouteTag(), ns3::RipRte::SetSubnetMask(), ns3::SocketIpTtlTag::SetTtl(), and SPLIT_HORIZON.

Referenced by Receive().

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

◆ HandleResponses()

void ns3::Rip::HandleResponses ( RipHeader  hdr,
Ipv4Address  senderAddress,
uint32_t  incomingInterface,
uint8_t  hopLimit 
)
private

Handle RIP responses.

Parameters
hdrmessage header (including RTEs)
senderAddresssender address
incomingInterfaceincoming interface
hopLimitpacket's hop limit

Definition at line 1017 of file rip.cc.

References ns3::Ipv4Address::CombineMask(), ns3::Simulator::GetDelayLeft(), ns3::RipHeader::GetRteList(), InvalidateRoute(), m_interfaceExclusions, m_interfaceMetrics, m_linkDown, m_routes, m_timeoutDelay, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::RipRoutingTableEntry::RIP_VALID, ns3::Simulator::Schedule(), and SendTriggeredRouteUpdate().

Referenced by Receive().

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

◆ InvalidateRoute()

void ns3::Rip::InvalidateRoute ( RipRoutingTableEntry route)
private

Invalidate a route.

Parameters
routethe route to be removed

Definition at line 733 of file rip.cc.

References DeleteRoute(), m_garbageCollectionDelay, m_linkDown, m_routes, NS_ABORT_MSG, NS_LOG_FUNCTION, ns3::RipRoutingTableEntry::RIP_INVALID, ns3::Simulator::Schedule(), ns3::RipRoutingTableEntry::SetRouteChanged(), ns3::RipRoutingTableEntry::SetRouteMetric(), and ns3::RipRoutingTableEntry::SetRouteStatus().

Referenced by HandleResponses(), NotifyInterfaceDown(), and NotifyRemoveAddress().

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

◆ Lookup()

Ptr< Ipv4Route > ns3::Rip::Lookup ( Ipv4Address  dest,
bool  setSource,
Ptr< NetDevice interface = nullptr 
)
private

Lookup in the forwarding table for destination.

Parameters
destdestination address
setSourceset source address in the route
interfaceoutput interface if any (put 0 otherwise)
Returns
Ipv4Route to route the packet to reach dest address

Definition at line 621 of file rip.cc.

References ns3::Ipv4RoutingTableEntry::GetDest(), ns3::Ipv4RoutingTableEntry::GetDestNetwork(), ns3::Ipv4RoutingTableEntry::GetDestNetworkMask(), ns3::Ipv4RoutingTableEntry::GetGateway(), ns3::Ipv4RoutingTableEntry::GetInterface(), ns3::Ipv4Mask::GetPrefixLength(), ns3::RipRoutingTableEntry::GetRouteStatus(), ns3::Ipv4Address::GetZero(), ns3::Ipv4Address::IsAny(), ns3::Ipv4Address::IsLocalMulticast(), ns3::Ipv4Mask::IsMatch(), m_ipv4, m_routes, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::RipRoutingTableEntry::RIP_VALID.

Referenced by RouteInput(), and RouteOutput().

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

◆ NotifyAddAddress()

void ns3::Rip::NotifyAddAddress ( uint32_t  interface,
Ipv4InterfaceAddress  address 
)
overridevirtual
Parameters
interfacethe index of the interface we are being notified about
addressa new address being added to an interface

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.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 436 of file rip.cc.

References AddNetworkRouteTo(), ns3::Ipv4InterfaceAddress::GLOBAL, m_interfaceExclusions, m_ipv4, NS_LOG_FUNCTION, and SendTriggeredRouteUpdate().

+ Here is the call graph for this function:

◆ NotifyInterfaceDown()

void ns3::Rip::NotifyInterfaceDown ( uint32_t  interface)
overridevirtual
Parameters
interfacethe index of the interface we are being notified about

Protocols are expected to implement this method to be notified of the state change of an interface in a node.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 404 of file rip.cc.

References InvalidateRoute(), m_interfaceExclusions, m_routes, m_unicastSocketList, NS_LOG_FUNCTION, NS_LOG_INFO, and SendTriggeredRouteUpdate().

Referenced by SetIpv4().

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

◆ NotifyInterfaceUp()

void ns3::Rip::NotifyInterfaceUp ( uint32_t  interface)
overridevirtual
Parameters
interfacethe index of the interface we are being notified about

Protocols are expected to implement this method to be notified of the state change of an interface in a node.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 321 of file rip.cc.

References AddNetworkRouteTo(), ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::Ipv4InterfaceAddress::GLOBAL, ns3::Ipv4InterfaceAddress::HOST, ns3::TypeId::LookupByName(), m_initialized, m_interfaceExclusions, m_ipv4, m_multicastRecvSocket, m_unicastSocketList, ns3::MakeCallback(), NS_LOG_FUNCTION, NS_LOG_LOGIC, Receive(), RIP_ALL_NODE, RIP_PORT, SendTriggeredRouteUpdate(), ns3::Socket::SetIpRecvTtl(), ns3::Socket::SetRecvCallback(), and ns3::Socket::SetRecvPktInfo().

Referenced by SetIpv4().

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

◆ NotifyRemoveAddress()

void ns3::Rip::NotifyRemoveAddress ( uint32_t  interface,
Ipv4InterfaceAddress  address 
)
overridevirtual
Parameters
interfacethe index of the interface we are being notified about
addressa new address being added to an interface

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.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 462 of file rip.cc.

References ns3::Ipv4InterfaceAddress::GLOBAL, InvalidateRoute(), m_interfaceExclusions, m_ipv4, m_routes, NS_LOG_FUNCTION, and SendTriggeredRouteUpdate().

+ Here is the call graph for this function:

◆ PrintRoutingTable()

void ns3::Rip::PrintRoutingTable ( Ptr< OutputStreamWrapper stream,
Time::Unit  unit = Time::S 
) const
overridevirtual

Print the Routing Table entries.

Parameters
streamThe ostream the Routing table is printed to
unitThe time unit to be used in the report

Implements ns3::Ipv4RoutingProtocol.

Definition at line 520 of file rip.cc.

References ns3::Time::As(), ns3::Names::FindName(), ns3::Ipv4RoutingTableEntry::GetDest(), ns3::Ipv4RoutingTableEntry::GetDestNetworkMask(), ns3::Ipv4RoutingTableEntry::GetGateway(), ns3::Ipv4RoutingTableEntry::GetInterface(), ns3::RipRoutingTableEntry::GetRouteMetric(), ns3::RipRoutingTableEntry::GetRouteStatus(), ns3::Ipv4RoutingTableEntry::IsGateway(), ns3::Ipv4RoutingTableEntry::IsHost(), m_ipv4, m_routes, ns3::Now(), NS_LOG_FUNCTION, and ns3::RipRoutingTableEntry::RIP_VALID.

+ Here is the call graph for this function:

◆ Receive()

void ns3::Rip::Receive ( Ptr< Socket socket)
private

Receive RIP packets.

Parameters
socketthe socket the packet was received to.

Definition at line 774 of file rip.cc.

References ns3::InetSocketAddress::ConvertFrom(), ns3::RipHeader::GetCommand(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::Ipv4PacketInfoTag::GetRecvIf(), ns3::SocketIpTtlTag::GetTtl(), HandleRequests(), HandleResponses(), m_ipv4, m_multicastRecvSocket, NS_ABORT_MSG, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, ns3::RipHeader::REQUEST, and ns3::RipHeader::RESPONSE.

Referenced by DoInitialize(), and NotifyInterfaceUp().

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

◆ RecvMulticastRip()

void ns3::Rip::RecvMulticastRip ( Ptr< Socket socket)
private

Receive and process multicast packet.

Parameters
socketsocket where packet is arrived

◆ RecvUnicastRip()

void ns3::Rip::RecvUnicastRip ( Ptr< Socket socket)
private

Receive and process unicast packet.

Parameters
socketsocket where packet is arrived

◆ RouteInput()

bool ns3::Rip::RouteInput ( Ptr< const Packet p,
const Ipv4Header header,
Ptr< const NetDevice idev,
const UnicastForwardCallback ucb,
const MulticastForwardCallback mcb,
const LocalDeliverCallback lcb,
const ErrorCallback ecb 
)
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 Ipv4RoutingProtocol, 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.

Parameters
preceived packet
headerinput parameter used to form a search key for a route
idevPointer to ingress network device
ucbCallback for the case in which the packet is to be forwarded as unicast
mcbCallback for the case in which the packet is to be forwarded as multicast
lcbCallback for the case in which the packet is to be locally delivered
ecbCallback to call if there is an error in forwarding
Returns
true if the Ipv4RoutingProtocol takes responsibility for forwarding or delivering the packet, false otherwise

Implements ns3::Ipv4RoutingProtocol.

Definition at line 242 of file rip.cc.

References ns3::Socket::ERROR_NOROUTETOHOST, ns3::Ipv4Header::GetDestination(), ns3::Ipv4Header::GetSource(), ns3::Ipv4Address::IsBroadcast(), ns3::Ipv4Address::IsMulticast(), ns3::Callback< R, UArgs >::IsNull(), Lookup(), m_ipv4, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ RouteOutput()

Ptr< Ipv4Route > ns3::Rip::RouteOutput ( Ptr< Packet p,
const Ipv4Header header,
Ptr< NetDevice oif,
Socket::SocketErrno sockerr 
)
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()

The header input parameter may have an uninitialized value for the source address, but the destination address should always be properly set by the caller.

Parameters
ppacket to be routed. Note that this method may modify the packet. Callers may also pass in a null pointer.
headerinput parameter (used to form key to search for the route)
oifOutput interface Netdevice. May be zero, or may be bound via socket options to a particular output interface.
sockerrOutput parameter; socket errno
Returns
a code that indicates what happened in the lookup

Implements ns3::Ipv4RoutingProtocol.

Definition at line 208 of file rip.cc.

References ns3::Socket::ERROR_NOROUTETOHOST, ns3::Socket::ERROR_NOTERROR, ns3::Ipv4Header::GetDestination(), ns3::Ipv4Address::IsMulticast(), Lookup(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ SendRouteRequest()

void ns3::Rip::SendRouteRequest ( )
private

Send Routing Request on all interfaces.

Definition at line 1364 of file rip.cc.

References ns3::RipHeader::AddRte(), ns3::Ipv4Address::GetAny(), ns3::Ipv4Mask::GetZero(), m_interfaceExclusions, m_linkDown, m_unicastSocketList, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::RipHeader::REQUEST, RIP_ALL_NODE, RIP_PORT, ns3::RipHeader::SetCommand(), ns3::RipRte::SetPrefix(), ns3::RipRte::SetRouteMetric(), ns3::RipRte::SetSubnetMask(), and ns3::SocketIpTtlTag::SetTtl().

Referenced by DoInitialize().

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

◆ SendTriggeredRouteUpdate()

void ns3::Rip::SendTriggeredRouteUpdate ( )
private

Send Triggered Routing Updates on all interfaces.

Definition at line 1277 of file rip.cc.

References DoSendRouteUpdate(), ns3::Time::GetSeconds(), ns3::UniformRandomVariable::GetValue(), ns3::EventId::IsRunning(), 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().

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

◆ SendUnsolicitedRouteUpdate()

void ns3::Rip::SendUnsolicitedRouteUpdate ( )
private

Send Unsolicited Routing Updates on all interfaces.

Definition at line 1309 of file rip.cc.

References ns3::EventId::Cancel(), DoSendRouteUpdate(), ns3::Time::GetSeconds(), ns3::UniformRandomVariable::GetValue(), ns3::EventId::IsRunning(), m_nextTriggeredUpdate, m_nextUnsolicitedUpdate, m_rng, m_unsolicitedUpdate, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), ns3::Seconds(), and SendUnsolicitedRouteUpdate().

Referenced by DoInitialize(), and SendUnsolicitedRouteUpdate().

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

◆ SetInterfaceExclusions()

void ns3::Rip::SetInterfaceExclusions ( std::set< uint32_t exceptions)

Set the set of interface excluded from the protocol.

Parameters
exceptionsthe set of excluded interfaces

Definition at line 1332 of file rip.cc.

References m_interfaceExclusions, and NS_LOG_FUNCTION.

◆ SetInterfaceMetric()

void ns3::Rip::SetInterfaceMetric ( uint32_t  interface,
uint8_t  metric 
)

Set the metric for an interface.

Parameters
interfacethe interface
metricthe interface metric

Definition at line 1353 of file rip.cc.

References m_interfaceMetrics, m_linkDown, and NS_LOG_FUNCTION.

◆ SetIpv4()

void ns3::Rip::SetIpv4 ( Ptr< Ipv4 ipv4)
overridevirtual
Parameters
ipv4the ipv4 object this routing protocol is being associated with

Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol

Implements ns3::Ipv4RoutingProtocol.

Definition at line 498 of file rip.cc.

References m_ipv4, NotifyInterfaceDown(), NotifyInterfaceUp(), NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_garbageCollectionDelay

Time ns3::Rip::m_garbageCollectionDelay
private

Delay before deleting an INVALID route.

Definition at line 401 of file rip.h.

Referenced by GetTypeId(), and InvalidateRoute().

◆ m_initialized

bool ns3::Rip::m_initialized
private

flag to allow socket's late-creation.

Definition at line 426 of file rip.h.

Referenced by DoInitialize(), and NotifyInterfaceUp().

◆ m_interfaceExclusions

◆ m_interfaceMetrics

std::map<uint32_t, uint8_t> ns3::Rip::m_interfaceMetrics
private

Map of interface metrics.

Definition at line 422 of file rip.h.

Referenced by GetInterfaceMetric(), HandleResponses(), and SetInterfaceMetric().

◆ m_ipv4

◆ m_linkDown

uint32_t ns3::Rip::m_linkDown
private

◆ m_maxTriggeredUpdateDelay

Time ns3::Rip::m_maxTriggeredUpdateDelay
private

Max cooldown delay after a Triggered Update.

Definition at line 398 of file rip.h.

Referenced by DoInitialize(), GetTypeId(), and SendTriggeredRouteUpdate().

◆ m_minTriggeredUpdateDelay

Time ns3::Rip::m_minTriggeredUpdateDelay
private

Min cooldown delay after a Triggered Update.

Definition at line 397 of file rip.h.

Referenced by DoInitialize(), GetTypeId(), and SendTriggeredRouteUpdate().

◆ m_multicastRecvSocket

Ptr<Socket> ns3::Rip::m_multicastRecvSocket
private

multicast receive socket

Definition at line 414 of file rip.h.

Referenced by DoDispose(), DoInitialize(), HandleRequests(), NotifyInterfaceUp(), and Receive().

◆ m_nextTriggeredUpdate

EventId ns3::Rip::m_nextTriggeredUpdate
private

Next Triggered Update event.

Definition at line 417 of file rip.h.

Referenced by DoDispose(), DoInitialize(), SendTriggeredRouteUpdate(), and SendUnsolicitedRouteUpdate().

◆ m_nextUnsolicitedUpdate

EventId ns3::Rip::m_nextUnsolicitedUpdate
private

Next Unsolicited Update event.

Definition at line 416 of file rip.h.

Referenced by DoDispose(), DoInitialize(), and SendUnsolicitedRouteUpdate().

◆ m_rng

Ptr<UniformRandomVariable> ns3::Rip::m_rng
private

Rng stream.

Definition at line 419 of file rip.h.

Referenced by Rip(), AssignStreams(), DoInitialize(), SendTriggeredRouteUpdate(), and SendUnsolicitedRouteUpdate().

◆ m_routes

Routes ns3::Rip::m_routes
private

◆ m_splitHorizonStrategy

SplitHorizonType_e ns3::Rip::m_splitHorizonStrategy
private

Split Horizon strategy.

Definition at line 424 of file rip.h.

Referenced by DoSendRouteUpdate(), GetTypeId(), and HandleRequests().

◆ m_startupDelay

Time ns3::Rip::m_startupDelay
private

Random delay before protocol startup.

Definition at line 396 of file rip.h.

Referenced by DoInitialize(), and GetTypeId().

◆ m_timeoutDelay

Time ns3::Rip::m_timeoutDelay
private

Delay before invalidating a route.

Definition at line 400 of file rip.h.

Referenced by GetTypeId(), and HandleResponses().

◆ m_unicastSocketList

SocketList ns3::Rip::m_unicastSocketList
private

list of sockets for unicast messages (socket, interface index)

Definition at line 413 of file rip.h.

Referenced by DoDispose(), DoInitialize(), DoSendRouteUpdate(), HandleRequests(), NotifyInterfaceDown(), NotifyInterfaceUp(), and SendRouteRequest().

◆ m_unsolicitedUpdate

Time ns3::Rip::m_unsolicitedUpdate
private

time between two Unsolicited Routing Updates

Definition at line 399 of file rip.h.

Referenced by DoInitialize(), GetTypeId(), and SendUnsolicitedRouteUpdate().


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