RIP Routing Protocol, defined in RFC 2453. More...
#include "rip.h"
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::SocketErrno > | ErrorCallback |
Callback for routing errors (e.g., no route found) More... | |
typedef Callback< void, Ptr< const Packet >, const Ipv4Header &, uint32_t > | LocalDeliverCallback |
Callback for packets to be locally delivered. More... | |
typedef Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const Ipv4Header & > | MulticastForwardCallback |
Callback for multicast packets to be forwarded. More... | |
typedef Callback< void, Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > | UnicastForwardCallback |
Callback for unicast packets to be forwarded. More... | |
Public Member Functions | |
Rip () | |
virtual | ~Rip () |
void | AddDefaultRouteTo (Ipv4Address nextHop, uint32_t interface) |
Add a default route to the router through the nextHop located on interface. More... | |
int64_t | AssignStreams (int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. More... | |
std::set< uint32_t > | GetInterfaceExclusions () const |
Get the set of interface excluded from the protocol. More... | |
uint8_t | GetInterfaceMetric (uint32_t interface) const |
Get the metric for an interface. More... | |
virtual void | NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) |
virtual void | NotifyInterfaceDown (uint32_t interface) |
virtual void | NotifyInterfaceUp (uint32_t interface) |
virtual void | NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) |
virtual void | PrintRoutingTable (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const |
Print the Routing Table entries. More... | |
bool | RouteInput (Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) |
Route an input packet (to be forwarded or locally delivered) More... | |
Ptr< Ipv4Route > | RouteOutput (Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) |
Query routing cache for an existing route, for an outbound packet. More... | |
void | SetInterfaceExclusions (std::set< uint32_t > exceptions) |
Set the set of interface excluded from the protocol. More... | |
void | SetInterfaceMetric (uint32_t interface, uint8_t metric) |
Set the metric for an interface. More... | |
virtual void | SetIpv4 (Ptr< Ipv4 > ipv4) |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose (void) |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator (void) const |
Get an iterator to the Objects aggregated to this one. More... | |
virtual TypeId | GetInstanceTypeId (void) const |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (void) const |
Get a pointer to the requested aggregated Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
void | Initialize (void) |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized (void) const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising erros. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Ipv4RoutingProtocol | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Protected Member Functions | |
virtual void | DoDispose () |
Dispose this object. More... | |
void | DoInitialize () |
Start protocol operation. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | NotifyNewAggregate (void) |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
Private Types | |
typedef std::list< std::pair< RipRoutingTableEntry *, EventId > > | Routes |
Container for the network routes - pair RipRoutingTableEntry *, EventId (update event) More... | |
typedef std::list< std::pair< RipRoutingTableEntry *, EventId > >::const_iterator | RoutesCI |
Const Iterator for container for the network routes. More... | |
typedef std::list< std::pair< RipRoutingTableEntry *, EventId > >::iterator | RoutesI |
Iterator for container for the network routes. More... | |
typedef std::map< Ptr< Socket >, uint32_t > | SocketList |
Socket list type. More... | |
typedef std::map< Ptr< Socket >, uint32_t >::const_iterator | SocketListCI |
Socket list type const iterator. More... | |
typedef std::map< Ptr< Socket >, uint32_t >::iterator | SocketListI |
Socket list type iterator. More... | |
Private Member Functions | |
void | AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkPrefix, Ipv4Address nextHop, uint32_t interface) |
Add route to network. More... | |
void | AddNetworkRouteTo (Ipv4Address network, Ipv4Mask networkPrefix, uint32_t interface) |
Add route to network. More... | |
void | DeleteRoute (RipRoutingTableEntry *route) |
Delete a route. More... | |
void | DoSendRouteUpdate (bool periodic) |
Send Routing Updates on all interfaces. More... | |
void | HandleRequests (RipHeader hdr, Ipv4Address senderAddress, uint16_t senderPort, uint32_t incomingInterface, uint8_t hopLimit) |
Handle RIP requests. More... | |
void | HandleResponses (RipHeader hdr, Ipv4Address senderAddress, uint32_t incomingInterface, uint8_t hopLimit) |
Handle RIP responses. More... | |
void | InvalidateRoute (RipRoutingTableEntry *route) |
Invalidate a route. More... | |
Ptr< Ipv4Route > | Lookup (Ipv4Address dest, Ptr< NetDevice >=0) |
Lookup in the forwarding table for destination. More... | |
void | Receive (Ptr< Socket > socket) |
Receive RIP packets. More... | |
void | RecvMulticastRip (Ptr< Socket > socket) |
Receive and process multicast packet. More... | |
void | RecvUnicastRip (Ptr< Socket > socket) |
Receive and process unicast packet. More... | |
void | SendRouteRequest () |
Send Routing Request on all interfaces. More... | |
void | SendTriggeredRouteUpdate () |
Send Triggered Routing Updates on all interfaces. More... | |
void | SendUnsolicitedRouteUpdate (void) |
Send Unsolicited Routing Updates on all interfaces. More... | |
Private Attributes | |
Time | m_garbageCollectionDelay |
Delay before deleting an INVALID route. More... | |
bool | m_initialized |
flag to allow socket's late-creation. More... | |
std::set< uint32_t > | m_interfaceExclusions |
Set of excluded interfaces. More... | |
std::map< uint32_t, uint8_t > | m_interfaceMetrics |
Map of interface metrics. More... | |
Ptr< Ipv4 > | m_ipv4 |
IPv4 reference. More... | |
uint32_t | m_linkDown |
Link down value. More... | |
Time | m_maxTriggeredUpdateDelay |
Max cooldown delay after a Triggered Update. More... | |
Time | m_minTriggeredUpdateDelay |
Min cooldown delay after a Triggered Update. More... | |
EventId | m_nextTriggeredUpdate |
Next Triggered Update event. More... | |
EventId | m_nextUnsolicitedUpdate |
Next Unsolicited Update event. More... | |
Ptr< Socket > | m_recvSocket |
receive socket More... | |
Ptr< UniformRandomVariable > | m_rng |
Rng stream. More... | |
Routes | m_routes |
the forwarding table for network. More... | |
SocketList | m_sendSocketList |
list of sockets for sending (socket, interface index) More... | |
SplitHorizonType_e | m_splitHorizonStrategy |
Split Horizon strategy. More... | |
Time | m_startupDelay |
Random delay before protocol startup. More... | |
Time | m_timeoutDelay |
Delay before invalidating a route. More... | |
Time | m_unsolicitedUpdate |
time between two Unsolicited Routing Updates More... | |
Additional Inherited Members | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
RIP Routing Protocol, defined in RFC 2453.
Introspection did not find any typical Config paths.
No TraceSources are defined for this type.
Size of this type is 264 bytes (on a 64-bit architecture).
|
private |
Container for the network routes - pair RipRoutingTableEntry *, EventId (update event)
|
private |
|
private |
|
private |
|
private |
|
private |
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).
nextHop | the next hop |
interface | the interface |
Definition at line 1269 of file rip.cc.
References AddNetworkRouteTo(), ns3::Ipv4Mask::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 |
Definition at line 647 of file rip.cc.
References m_routes, NS_LOG_FUNCTION, ns3::RipRoutingTableEntry::RIP_VALID, ns3::RipRoutingTableEntry::SetRouteChanged(), ns3::RipRoutingTableEntry::SetRouteMetric(), and ns3::RipRoutingTableEntry::SetRouteStatus().
Referenced by AddDefaultRouteTo(), NotifyAddAddress(), and NotifyInterfaceUp().
|
private |
Add route to network.
network | network address |
networkPrefix | network prefix |
interface | interface index |
Definition at line 659 of file rip.cc.
References m_routes, NS_LOG_FUNCTION, ns3::RipRoutingTableEntry::RIP_VALID, ns3::RipRoutingTableEntry::SetRouteChanged(), ns3::RipRoutingTableEntry::SetRouteMetric(), and ns3::RipRoutingTableEntry::SetRouteStatus().
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.
stream | first stream index to use |
Definition at line 102 of file rip.cc.
References m_rng, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().
|
private |
Delete a route.
route | the route to be removed |
Definition at line 693 of file rip.cc.
References m_routes, NS_ABORT_MSG, and NS_LOG_FUNCTION.
Referenced by InvalidateRoute().
|
protectedvirtual |
Dispose this object.
Reimplemented from ns3::Object.
Definition at line 543 of file rip.cc.
References ns3::EventId::Cancel(), ns3::Socket::Close(), ns3::Object::DoDispose(), m_ipv4, m_nextTriggeredUpdate, m_nextUnsolicitedUpdate, m_recvSocket, m_routes, m_sendSocketList, and NS_LOG_FUNCTION.
|
protectedvirtual |
Start protocol operation.
Reimplemented from ns3::Object.
Definition at line 110 of file rip.cc.
References first::address, ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::Object::DoInitialize(), DoSendRouteUpdate(), ns3::Time::GetSeconds(), ns3::UniformRandomVariable::GetValue(), ns3::Ipv4InterfaceAddress::GLOBAL, ns3::Ipv4InterfaceAddress::HOST, ns3::TypeId::LookupByName(), m_initialized, m_interfaceExclusions, m_ipv4, m_maxTriggeredUpdateDelay, m_minTriggeredUpdateDelay, m_nextTriggeredUpdate, m_nextUnsolicitedUpdate, m_recvSocket, m_rng, m_sendSocketList, m_startupDelay, m_unsolicitedUpdate, ns3::MakeCallback(), NS_ASSERT_MSG(), NS_LOG_FUNCTION, NS_LOG_LOGIC(), Receive(), RIP_ALL_NODE, RIP_PORT, ns3::Simulator::Schedule(), ns3::Seconds(), SendRouteRequest(), SendUnsolicitedRouteUpdate(), ns3::Socket::SetIpRecvTtl(), ns3::Socket::SetRecvCallback(), and ns3::Socket::SetRecvPktInfo().
|
private |
Send Routing Updates on all interfaces.
periodic | true for periodic update, else triggered. |
Definition at line 1066 of file rip.cc.
References ns3::Packet::AddHeader(), ns3::Packet::AddPacketTag(), ns3::RipHeader::AddRte(), ns3::RipHeader::ClearRtes(), ns3::Ipv4Address::CombineMask(), ns3::Ipv4Address::GetAny(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4InterfaceAddress::GetMask(), ns3::RipHeader::GetRteNumber(), ns3::Ipv4InterfaceAddress::GetScope(), ns3::RipRte::GetSerializedSize(), ns3::UdpHeader::GetSerializedSize(), ns3::RipHeader::GetSerializedSize(), ns3::Ipv4Header::GetSerializedSize(), ns3::Ipv4Mask::GetZero(), ns3::Ipv4InterfaceAddress::GLOBAL, m_interfaceExclusions, m_ipv4, m_linkDown, m_routes, m_sendSocketList, m_splitHorizonStrategy, NS_LOG_DEBUG, NS_LOG_FUNCTION, POISON_REVERSE, ns3::Packet::RemoveHeader(), ns3::RipHeader::RESPONSE, RIP_ALL_NODE, RIP_PORT, ns3::RipHeader::SetCommand(), ns3::RipRte::SetPrefix(), ns3::RipRte::SetRouteMetric(), ns3::RipRte::SetRouteTag(), ns3::RipRte::SetSubnetMask(), ns3::SocketIpTtlTag::SetTtl(), and SPLIT_HORIZON.
Referenced by DoInitialize(), SendTriggeredRouteUpdate(), and SendUnsolicitedRouteUpdate().
std::set< uint32_t > ns3::Rip::GetInterfaceExclusions | ( | ) | const |
Get the set of interface excluded from the protocol.
Definition at line 1202 of file rip.cc.
References m_interfaceExclusions.
uint8_t ns3::Rip::GetInterfaceMetric | ( | uint32_t | interface | ) | const |
Get the metric for an interface.
interface | the interface |
Definition at line 1214 of file rip.cc.
References m_interfaceMetrics, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 58 of file rip.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(), NO_SPLIT_HORIZON, POISON_REVERSE, ns3::Seconds(), ns3::TypeId::SetParent(), and SPLIT_HORIZON.
|
private |
Handle RIP requests.
hdr | message header (including RTEs) |
senderAddress | sender address |
senderPort | sender port |
incomingInterface | incoming interface |
hopLimit | packet's hop limit |
Definition at line 764 of file rip.cc.
References ns3::Packet::AddHeader(), ns3::Packet::AddPacketTag(), ns3::RipHeader::AddRte(), ns3::RipHeader::ClearRtes(), ns3::Ipv4Address::CombineMask(), ns3::Ipv4Address::GetAny(), ns3::RipHeader::GetRteList(), ns3::RipHeader::GetRteNumber(), ns3::Ipv4InterfaceAddress::GetScope(), ns3::RipRte::GetSerializedSize(), ns3::UdpHeader::GetSerializedSize(), ns3::RipHeader::GetSerializedSize(), ns3::Ipv4Header::GetSerializedSize(), ns3::Ipv4Mask::GetZero(), ns3::Ipv4InterfaceAddress::GLOBAL, m_interfaceExclusions, m_ipv4, m_linkDown, m_recvSocket, m_routes, m_sendSocketList, m_splitHorizonStrategy, NS_ASSERT_MSG(), NS_LOG_DEBUG, NS_LOG_FUNCTION, POISON_REVERSE, ns3::Packet::RemoveHeader(), ns3::Packet::RemovePacketTag(), 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(), and SPLIT_HORIZON.
Referenced by Receive().
|
private |
Handle RIP responses.
hdr | message header (including RTEs) |
senderAddress | sender address |
incomingInterface | incoming interface |
hopLimit | packet's hop limit |
Definition at line 926 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(), SendTriggeredRouteUpdate(), ns3::RipRoutingTableEntry::SetRouteChanged(), ns3::RipRoutingTableEntry::SetRouteMetric(), ns3::RipRoutingTableEntry::SetRouteStatus(), and ns3::RipRoutingTableEntry::SetRouteTag().
Referenced by Receive().
|
private |
Invalidate a route.
route | the route to be removed |
Definition at line 671 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().
|
private |
Lookup in the forwarding table for destination.
dest | destination address |
interface | output interface if any (put 0 otherwise) |
Definition at line 573 of file rip.cc.
References ns3::Ipv4RoutingTableEntry::GetDest(), ns3::Ipv4Route::GetDestination(), ns3::Ipv4RoutingTableEntry::GetDestNetwork(), ns3::Ipv4RoutingTableEntry::GetDestNetworkMask(), ns3::Ipv4Route::GetGateway(), 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(), ns3::RipRoutingTableEntry::RIP_VALID, ns3::Ipv4Route::SetDestination(), ns3::Ipv4Route::SetGateway(), ns3::Ipv4Route::SetOutputDevice(), and ns3::Ipv4Route::SetSource().
Referenced by RouteInput(), and RouteOutput().
|
virtual |
interface | the index of the interface we are being notified about |
address | a 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 402 of file rip.cc.
References AddNetworkRouteTo(), first::address, ns3::Ipv4InterfaceAddress::GLOBAL, m_interfaceExclusions, m_ipv4, NS_LOG_FUNCTION, and SendTriggeredRouteUpdate().
|
virtual |
interface | the 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 371 of file rip.cc.
References InvalidateRoute(), m_interfaceExclusions, m_routes, m_sendSocketList, NS_LOG_FUNCTION, NS_LOG_INFO, and SendTriggeredRouteUpdate().
Referenced by SetIpv4().
|
virtual |
interface | the 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 290 of file rip.cc.
References AddNetworkRouteTo(), first::address, ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::Ipv4InterfaceAddress::GLOBAL, ns3::Ipv4InterfaceAddress::HOST, ns3::TypeId::LookupByName(), m_initialized, m_interfaceExclusions, m_ipv4, m_recvSocket, m_sendSocketList, 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().
|
virtual |
interface | the index of the interface we are being notified about |
address | a 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 427 of file rip.cc.
References first::address, ns3::Ipv4InterfaceAddress::GLOBAL, InvalidateRoute(), m_interfaceExclusions, m_ipv4, m_routes, NS_LOG_FUNCTION, and SendTriggeredRouteUpdate().
|
virtual |
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::Ipv4RoutingProtocol.
Definition at line 485 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::OutputStreamWrapper::GetStream(), ns3::Ipv4RoutingTableEntry::IsGateway(), ns3::Ipv4RoutingTableEntry::IsHost(), m_ipv4, m_routes, ns3::Now(), NS_LOG_FUNCTION, and ns3::RipRoutingTableEntry::RIP_VALID.
Receive RIP packets.
socket | the socket the packet was received to. |
Definition at line 710 of file rip.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::RipHeader::GetCommand(), ns3::Node::GetDevice(), ns3::InetSocketAddress::GetIpv4(), ns3::InetSocketAddress::GetPort(), ns3::Ipv4PacketInfoTag::GetRecvIf(), ns3::SocketIpTtlTag::GetTtl(), HandleRequests(), HandleResponses(), m_ipv4, NS_ABORT_MSG, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC(), ns3::Socket::RecvFrom(), ns3::Packet::RemoveHeader(), ns3::Packet::RemovePacketTag(), ns3::RipHeader::REQUEST, and ns3::RipHeader::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 |
|
virtual |
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.
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::Ipv4RoutingProtocol.
Definition at line 216 of file rip.cc.
References ns3::Socket::ERROR_NOROUTETOHOST, ns3::Ipv4Header::GetDestination(), ns3::Ipv4Header::GetSource(), ns3::Ipv4Address::IsBroadcast(), ns3::Ipv4Address::IsMulticast(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), Lookup(), m_ipv4, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC().
|
virtual |
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.
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 Netdevice. May be zero, or may be bound via socket options to a particular output interface. |
sockerr | Output parameter; socket errno |
Implements ns3::Ipv4RoutingProtocol.
Definition at line 186 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().
|
private |
Send Routing Request on all interfaces.
Definition at line 1236 of file rip.cc.
References ns3::Packet::AddHeader(), ns3::Packet::AddPacketTag(), ns3::RipHeader::AddRte(), ns3::Ipv4Address::GetAny(), ns3::Ipv4Mask::GetZero(), m_interfaceExclusions, m_linkDown, m_sendSocketList, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Packet::RemovePacketTag(), ns3::RipHeader::REQUEST, RIP_ALL_NODE, RIP_PORT, ns3::RipHeader::SetCommand(), ns3::RipRte::SetPrefix(), ns3::RipRte::SetRouteMetric(), and ns3::RipRte::SetSubnetMask().
Referenced by DoInitialize().
|
private |
Send Triggered Routing Updates on all interfaces.
Definition at line 1157 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().
|
private |
Send Unsolicited Routing Updates on all interfaces.
Definition at line 1187 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(), and ns3::Seconds().
Referenced by DoInitialize().
void ns3::Rip::SetInterfaceExclusions | ( | std::set< uint32_t > | exceptions | ) |
Set the set of interface excluded from the protocol.
exceptions | the set of excluded interfaces |
Definition at line 1207 of file rip.cc.
References m_interfaceExclusions, and NS_LOG_FUNCTION.
void ns3::Rip::SetInterfaceMetric | ( | uint32_t | interface, |
uint8_t | metric | ||
) |
Set the metric for an interface.
interface | the interface |
metric | the interface metric |
Definition at line 1226 of file rip.cc.
References m_interfaceMetrics, m_linkDown, and NS_LOG_FUNCTION.
ipv4 | the ipv4 object this routing protocol is being associated with |
Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol
Implements ns3::Ipv4RoutingProtocol.
Definition at line 464 of file rip.cc.
References m_ipv4, NotifyInterfaceDown(), NotifyInterfaceUp(), NS_ASSERT, and NS_LOG_FUNCTION.
|
private |
Delay before deleting an INVALID route.
Definition at line 381 of file rip.h.
Referenced by GetTypeId(), and InvalidateRoute().
|
private |
flag to allow socket's late-creation.
Definition at line 405 of file rip.h.
Referenced by DoInitialize(), and NotifyInterfaceUp().
|
private |
Set of excluded interfaces.
Definition at line 400 of file rip.h.
Referenced by DoInitialize(), DoSendRouteUpdate(), GetInterfaceExclusions(), HandleRequests(), HandleResponses(), NotifyAddAddress(), NotifyInterfaceDown(), NotifyInterfaceUp(), NotifyRemoveAddress(), SendRouteRequest(), and SetInterfaceExclusions().
|
private |
Map of interface metrics.
Definition at line 401 of file rip.h.
Referenced by GetInterfaceMetric(), HandleResponses(), and SetInterfaceMetric().
IPv4 reference.
Definition at line 375 of file rip.h.
Referenced by DoDispose(), DoInitialize(), DoSendRouteUpdate(), HandleRequests(), Lookup(), NotifyAddAddress(), NotifyInterfaceUp(), NotifyRemoveAddress(), PrintRoutingTable(), Receive(), RouteInput(), and SetIpv4().
|
private |
Link down value.
Definition at line 406 of file rip.h.
Referenced by DoSendRouteUpdate(), GetTypeId(), HandleRequests(), HandleResponses(), InvalidateRoute(), SendRouteRequest(), and SetInterfaceMetric().
|
private |
Max cooldown delay after a Triggered Update.
Definition at line 378 of file rip.h.
Referenced by DoInitialize(), GetTypeId(), and SendTriggeredRouteUpdate().
|
private |
Min cooldown delay after a Triggered Update.
Definition at line 377 of file rip.h.
Referenced by DoInitialize(), GetTypeId(), and SendTriggeredRouteUpdate().
|
private |
Next Triggered Update event.
Definition at line 396 of file rip.h.
Referenced by DoDispose(), DoInitialize(), SendTriggeredRouteUpdate(), and SendUnsolicitedRouteUpdate().
|
private |
Next Unsolicited Update event.
Definition at line 395 of file rip.h.
Referenced by DoDispose(), DoInitialize(), and SendUnsolicitedRouteUpdate().
receive socket
Definition at line 393 of file rip.h.
Referenced by DoDispose(), DoInitialize(), HandleRequests(), and NotifyInterfaceUp().
|
private |
Rng stream.
Definition at line 398 of file rip.h.
Referenced by AssignStreams(), DoInitialize(), Rip(), SendTriggeredRouteUpdate(), and SendUnsolicitedRouteUpdate().
|
private |
the forwarding table for network.
Definition at line 374 of file rip.h.
Referenced by AddNetworkRouteTo(), DeleteRoute(), DoDispose(), DoSendRouteUpdate(), HandleRequests(), HandleResponses(), InvalidateRoute(), Lookup(), NotifyInterfaceDown(), NotifyRemoveAddress(), and PrintRoutingTable().
|
private |
list of sockets for sending (socket, interface index)
Definition at line 392 of file rip.h.
Referenced by DoDispose(), DoInitialize(), DoSendRouteUpdate(), HandleRequests(), NotifyInterfaceDown(), NotifyInterfaceUp(), and SendRouteRequest().
|
private |
Split Horizon strategy.
Definition at line 403 of file rip.h.
Referenced by DoSendRouteUpdate(), GetTypeId(), and HandleRequests().
|
private |
Random delay before protocol startup.
Definition at line 376 of file rip.h.
Referenced by DoInitialize(), and GetTypeId().
|
private |
Delay before invalidating a route.
Definition at line 380 of file rip.h.
Referenced by GetTypeId(), and HandleResponses().
|
private |
time between two Unsolicited Routing Updates
Definition at line 379 of file rip.h.
Referenced by DoInitialize(), GetTypeId(), and SendUnsolicitedRouteUpdate().