INET Framework for OMNeT++/OMNEST
|
A C++ interface to abstract the functionality of a routing table, regardless of address type. More...
#include <GenericRoutingTable.h>
Public Member Functions | |
GenericRoutingTable () | |
virtual | ~GenericRoutingTable () |
virtual IRoute * | createRoute () override |
virtual void | printRoutingTable () const override |
Prints routing table. More... | |
Miscellaneous functions | |
virtual bool | isForwardingEnabled () const override |
Forwarding on/off. More... | |
virtual bool | isMulticastForwardingEnabled () const override |
Multicast forwarding on/off. More... | |
virtual L3Address | getRouterIdAsGeneric () const override |
Returns routerId. More... | |
virtual bool | isLocalAddress (const L3Address &dest) const override |
Checks if the address is a local one, i.e. More... | |
virtual InterfaceEntry * | getInterfaceByAddress (const L3Address &address) const override |
Returns an interface given by its address. More... | |
virtual void | routeChanged (GenericRoute *entry, int fieldCode) |
To be called from route objects whenever a field changes. More... | |
Routing functions (query the route table) | |
virtual GenericRoute * | findBestMatchingRoute (const L3Address &dest) const override |
The routing function. More... | |
virtual InterfaceEntry * | getOutputInterfaceForDestination (const L3Address &dest) const override |
Convenience function based on findBestMatchingRoute(). More... | |
virtual L3Address | getNextHopForDestination (const L3Address &dest) const override |
Convenience function based on findBestMatchingRoute(). More... | |
Multicast routing functions | |
virtual bool | isLocalMulticastAddress (const L3Address &dest) const override |
Checks if the address is in one of the local multicast group address list. More... | |
virtual IMulticastRoute * | findBestMatchingMulticastRoute (const L3Address &origin, const L3Address &group) const override |
Returns route for a multicast origin and group. More... | |
Route table manipulation | |
virtual int | getNumRoutes () const override |
Returns the total number of unicast routes. More... | |
virtual IRoute * | getRoute (int k) const override |
Returns the kth route. More... | |
virtual IRoute * | getDefaultRoute () const override |
Finds and returns the default route, or nullptr if it doesn't exist. More... | |
virtual void | addRoute (IRoute *entry) override |
Adds a route to the routing table. More... | |
virtual IRoute * | removeRoute (IRoute *entry) override |
Removes the given route from the routing table, and returns it. More... | |
virtual bool | deleteRoute (IRoute *entry) override |
Deletes the given route from the routing table. More... | |
virtual int | getNumMulticastRoutes () const override |
Returns the total number of multicast routes. More... | |
virtual IMulticastRoute * | getMulticastRoute (int k) const override |
Returns the kth multicast route. More... | |
virtual void | addMulticastRoute (IMulticastRoute *entry) override |
Adds a multicast route to the routing table. More... | |
virtual IMulticastRoute * | removeMulticastRoute (IMulticastRoute *entry) override |
Removes the given route from the routing table, and returns it. More... | |
virtual bool | deleteMulticastRoute (IMulticastRoute *entry) override |
Deletes the given multicast route from the routing table. More... | |
Public Member Functions inherited from inet::IRoutingTable | |
virtual | ~IRoutingTable () |
Protected Member Functions | |
virtual int | numInitStages () const override |
virtual void | initialize (int stage) override |
virtual void | handleMessage (cMessage *) override |
Raises an error. More... | |
virtual void | receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override |
Called by the signal handler whenever a change of a category occurs to which this client has subscribed. More... | |
virtual void | configureRouterId () |
virtual void | refreshDisplay () const override |
virtual void | configureInterface (InterfaceEntry *ie) |
virtual void | configureLoopback () |
void | internalAddRoute (GenericRoute *route) |
GenericRoute * | internalRemoveRoute (GenericRoute *route) |
Static Protected Member Functions | |
static bool | routeLessThan (const GenericRoute *a, const GenericRoute *b) |
Private Types | |
typedef std::vector< GenericRoute * > | RouteVector |
typedef std::vector< GenericMulticastRoute * > | MulticastRouteVector |
Private Attributes | |
IInterfaceTable * | ift = nullptr |
L3Address | routerId |
L3Address::AddressType | addressType = L3Address::NONE |
bool | forwarding = false |
bool | multicastForwarding = false |
RouteVector | routes |
MulticastRouteVector | multicastRoutes |
A C++ interface to abstract the functionality of a routing table, regardless of address type.
|
private |
|
private |
|
virtual |
|
overridevirtual |
Adds a multicast route to the routing table.
Routes are allowed to be modified while in the routing table. (There is a notification mechanism that allows routing table internals to be updated on a routing entry change.)
Implements inet::IRoutingTable.
|
overridevirtual |
Adds a route to the routing table.
Routes are allowed to be modified while in the routing table. (There is a notification mechanism that allows routing table internals to be updated on a routing entry change.)
Implements inet::IRoutingTable.
Referenced by inet::GenericNetworkConfigurator::addStaticRoutes().
|
protectedvirtual |
Referenced by initialize().
|
protectedvirtual |
Referenced by initialize().
|
protectedvirtual |
Referenced by initialize().
|
overridevirtual |
Implements inet::IRoutingTable.
|
overridevirtual |
Deletes the given multicast route from the routing table.
Returns true if the route was deleted, and false if it was not in the routing table.
Implements inet::IRoutingTable.
|
overridevirtual |
Deletes the given route from the routing table.
Returns true if the route was deleted, and false if it was not in the routing table.
Implements inet::IRoutingTable.
|
overridevirtual |
Returns route for a multicast origin and group.
Implements inet::IRoutingTable.
|
overridevirtual |
The routing function.
Performs longest prefix match for the given destination address, and returns the resulting route. Returns nullptr if there is no matching route.
Implements inet::IRoutingTable.
Referenced by getNextHopForDestination(), getOutputInterfaceForDestination(), and inet::GenericNetworkProtocol::routePacket().
|
overridevirtual |
Finds and returns the default route, or nullptr if it doesn't exist.
Implements inet::IRoutingTable.
|
overridevirtual |
Returns an interface given by its address.
Returns nullptr if not found.
Implements inet::IRoutingTable.
Referenced by inet::GenericNetworkProtocol::encapsulate().
|
overridevirtual |
Returns the kth multicast route.
Implements inet::IRoutingTable.
|
overridevirtual |
Convenience function based on findBestMatchingRoute().
Returns the gateway for the destination address. Returns the unspecified address if the destination is not in routing table or the gateway field is not filled in in the route.
Implements inet::IRoutingTable.
|
overridevirtual |
Returns the total number of multicast routes.
Implements inet::IRoutingTable.
|
overridevirtual |
|
overridevirtual |
Convenience function based on findBestMatchingRoute().
Returns the output interface for the packets with dest as destination address, or nullptr if the destination is not in routing table.
Implements inet::IRoutingTable.
|
overridevirtual |
|
overridevirtual |
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
|
protected |
Referenced by addRoute(), and routeChanged().
|
protected |
Referenced by removeRoute(), and routeChanged().
|
overridevirtual |
Forwarding on/off.
Implements inet::IRoutingTable.
Referenced by inet::GenericNetworkProtocol::routePacket().
|
overridevirtual |
Checks if the address is a local one, i.e.
one of the host's.
Implements inet::IRoutingTable.
Referenced by inet::GenericNetworkProtocol::routePacket().
|
overridevirtual |
Checks if the address is in one of the local multicast group address list.
Implements inet::IRoutingTable.
Referenced by inet::GenericNetworkProtocol::routeMulticastPacket().
|
overridevirtual |
Multicast forwarding on/off.
Implements inet::IRoutingTable.
|
inlineoverrideprotectedvirtual |
|
overridevirtual |
Prints routing table.
Implements inet::IRoutingTable.
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
|
overridevirtual |
Removes the given route from the routing table, and returns it.
nullptr is returned of the route was not in the routing table.
Implements inet::IRoutingTable.
Removes the given route from the routing table, and returns it.
nullptr is returned if the route was not in the routing table.
Implements inet::IRoutingTable.
Referenced by deleteRoute().
|
virtual |
To be called from route objects whenever a field changes.
Used for maintaining internal data structures and firing "routing table changed" notifications.
Referenced by inet::GenericRoute::changed().
|
staticprotected |
Referenced by internalAddRoute().
|
private |
Referenced by configureInterface(), and initialize().
|
private |
Referenced by initialize(), and isForwardingEnabled().
|
private |
Referenced by configureRouterId(), getInterfaceByAddress(), initialize(), and isLocalAddress().
|
private |
Referenced by initialize(), and isMulticastForwardingEnabled().
|
private |
Referenced by initialize(), and ~GenericRoutingTable().
|
private |
Referenced by configureRouterId(), getRouterIdAsGeneric(), and initialize().
|
private |