INET Framework for OMNeT++/OMNEST
|
Implementation of the Routing Information Protocol. More...
#include <RIPRouting.h>
Public Member Functions | |
RIPRouting () | |
~RIPRouting () | |
Public Member Functions inherited from inet::ILifecycle | |
virtual | ~ILifecycle () |
Protected Member Functions | |
virtual int | numInitStages () const override |
virtual void | initialize (int stage) override |
virtual void | handleMessage (cMessage *msg) override |
virtual void | receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override |
Listen on interface/route changes and update private data structures. More... | |
virtual bool | handleOperationStage (LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) override |
Perform one stage of a lifecycle operation. More... | |
virtual void | startRIPRouting () |
virtual void | stopRIPRouting () |
virtual void | configureInterfaces (cXMLElement *config) |
Creates a RIPInterfaceEntry for each interface found in the interface table. More... | |
virtual void | configureInitialRoutes () |
Import interface/static/default routes from the routing table. More... | |
virtual RIPRoute * | importRoute (IRoute *route, RIPRoute::RouteType type, int metric=1, uint16 routeTag=0) |
Adds a new route the RIP routing table for an existing IRoute. More... | |
virtual void | sendRIPRequest (const RIPInterfaceEntry &ripInterface) |
Sends a RIP request to routers on the specified link. More... | |
virtual void | processRequest (RIPPacket *packet) |
Processes a request received from a RIP router or a monitoring process. More... | |
virtual void | processUpdate (bool triggered) |
This method called when a triggered or regular update timer expired. More... | |
virtual void | sendRoutes (const L3Address &address, int port, const RIPInterfaceEntry &ripInterface, bool changedOnly) |
Send all or changed part of the routing table to address/port on the specified interface. More... | |
virtual void | processResponse (RIPPacket *packet) |
Processes the RIP response and updates the routing table. More... | |
virtual bool | isValidResponse (RIPPacket *packet) |
virtual void | addRoute (const L3Address &dest, int prefixLength, const InterfaceEntry *ie, const L3Address &nextHop, int metric, uint16 routeTag, const L3Address &from) |
RFC 2453 3.9.2: More... | |
virtual void | updateRoute (RIPRoute *route, const InterfaceEntry *ie, const L3Address &nextHop, int metric, uint16 routeTag, const L3Address &from) |
Updates an existing route with the information learned from a RIP packet. More... | |
virtual void | triggerUpdate () |
Sets the update timer to trigger an update in the [1s,5s] interval. More... | |
virtual RIPRoute * | checkRouteIsExpired (RIPRoute *route) |
Should be called regularly to handle expiry and purge of routes. More... | |
virtual void | invalidateRoute (RIPRoute *route) |
virtual void | purgeRoute (RIPRoute *route) |
Removes the route from the routing table. More... | |
virtual void | sendPacket (RIPPacket *packet, const L3Address &destAddr, int destPort, const InterfaceEntry *destInterface) |
Sends the packet to the specified destination. More... | |
Private Types | |
enum | Mode { RIPv2, RIPng } |
typedef std::vector< RIPInterfaceEntry > | InterfaceVector |
typedef std::vector< RIPRoute * > | RouteVector |
Private Member Functions | |
RIPInterfaceEntry * | findInterfaceById (int interfaceId) |
RIPRoute * | findRoute (const L3Address &destAddress, int prefixLength) |
RIPRoute * | findRoute (const L3Address &destination, int prefixLength, RIPRoute::RouteType type) |
RIPRoute * | findRoute (const IRoute *route) |
RIPRoute * | findRoute (const InterfaceEntry *ie, RIPRoute::RouteType type) |
void | addInterface (const InterfaceEntry *ie, cXMLElement *config) |
void | deleteInterface (const InterfaceEntry *ie) |
void | invalidateRoutes (const InterfaceEntry *ie) |
IRoute * | addRoute (const L3Address &dest, int prefixLength, const InterfaceEntry *ie, const L3Address &nextHop, int metric) |
void | deleteRoute (IRoute *route) |
bool | isLoopbackInterfaceRoute (const IRoute *route) |
bool | isLocalInterfaceRoute (const IRoute *route) |
bool | isDefaultRoute (const IRoute *route) |
std::string | getHostName () |
int | getInterfaceMetric (InterfaceEntry *ie) |
Private Attributes | |
cModule * | host = nullptr |
IInterfaceTable * | ift = nullptr |
IRoutingTable * | rt = nullptr |
IL3AddressType * | addressType = nullptr |
InterfaceVector | ripInterfaces |
RouteVector | ripRoutes |
UDPSocket | socket |
cMessage * | updateTimer = nullptr |
cMessage * | triggeredUpdateTimer = nullptr |
cMessage * | startupTimer = nullptr |
cMessage * | shutdownTimer = nullptr |
Mode | mode = (Mode)-1 |
int | ripUdpPort = -1 |
simtime_t | updateInterval |
simtime_t | routeExpiryTime |
simtime_t | routePurgeTime |
simtime_t | shutdownTime |
bool | isOperational = false |
Static Private Attributes | |
static simsignal_t | sentRequestSignal = registerSignal("sentRequest") |
static simsignal_t | sentUpdateSignal = registerSignal("sentUpdate") |
static simsignal_t | rcvdResponseSignal = registerSignal("rcvdResponse") |
static simsignal_t | badResponseSignal = registerSignal("badResponse") |
static simsignal_t | numRoutesSignal = registerSignal("numRoutes") |
Implementation of the Routing Information Protocol.
This module supports RIPv2 (RFC 2453) and RIPng (RFC 2080).
RIP is a distance vector routing protocol. Each RIP router periodically sends its whole routing table to neighbor routers, and updates its own routing table according to the received information. If a route changed the router might send a notification to its neighbors immediately (or rather with a small delay) which contains only the changed routes (triggered updates).
TODO
|
private |
|
private |
|
private |
inet::RIPRouting::~RIPRouting | ( | ) |
|
private |
|
private |
|
protectedvirtual |
RFC 2453 3.9.2:
Adding a route to the routing table consists of:
Should be called regularly to handle expiry and purge of routes.
If the route is valid, then returns it, otherwise returns nullptr.
|
protectedvirtual |
Import interface/static/default routes from the routing table.
|
protectedvirtual |
Creates a RIPInterfaceEntry for each interface found in the interface table.
|
private |
|
private |
|
private |
|
private |
|
private |
|
inlineprivate |
|
private |
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
Perform one stage of a lifecycle operation.
Processing may be done entirely within this method, or may be a longer process that involves nonzero simulation time or several events, and is triggered by this method call.
Return value: true = "done"; false = "not yet done, will invoke doneCallback when done"
Implements inet::ILifecycle.
|
protectedvirtual |
Adds a new route the RIP routing table for an existing IRoute.
This route will be advertised with the specified metric and routeTag fields.
|
overrideprotectedvirtual |
|
protectedvirtual |
|
private |
|
inlineprivate |
|
private |
|
private |
|
protectedvirtual |
|
inlineoverrideprotectedvirtual |
|
protectedvirtual |
Processes a request received from a RIP router or a monitoring process.
The request processing follows the guidelines described in RFC 2453 3.9.1.
There are two cases:
|
protectedvirtual |
Processes the RIP response and updates the routing table.
First it validates the packet to avoid corrupting the routing table with a wrong packet. Valid responses must come from a neighboring RIP router.
Next each RIPEntry is processed one by one. Check that destination address and metric are valid. Then compute the new metric by adding the metric of the interface to the metric found in the entry.
If there is no route to the destination, and the new metric is not infinity, then add a new route to the routing table.
If there is an existing route to the destination,
|
protectedvirtual |
This method called when a triggered or regular update timer expired.
It either sends the changed/all routes to neighbors.
|
protectedvirtual |
Removes the route from the routing table.
|
overrideprotectedvirtual |
Listen on interface/route changes and update private data structures.
|
protectedvirtual |
Sends the packet to the specified destination.
If the destAddr is a multicast, then the destInterface must be specified.
|
protectedvirtual |
Sends a RIP request to routers on the specified link.
|
protectedvirtual |
Send all or changed part of the routing table to address/port on the specified interface.
This method is called by regular updates (every 30s), triggered updates (when some route changed), and when RIP requests are processed.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Sets the update timer to trigger an update in the [1s,5s] interval.
If the update is already scheduled, it does nothing.
|
protectedvirtual |
Updates an existing route with the information learned from a RIP packet.
If the metric is infinite (16), then the route is invalidated. It triggers an update, so neighbor routers are notified about the change.
RFC 2453 3.9.2:
Do the following actions:
|
private |
|
staticprivate |
Referenced by ~RIPRouting().
|
private |
|
private |
|
private |
|
staticprivate |
Referenced by ~RIPRouting().
|
staticprivate |
Referenced by ~RIPRouting().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
Referenced by ~RIPRouting().
|
staticprivate |
Referenced by ~RIPRouting().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |