INET Framework for OMNeT++/OMNEST
|
This module provides the global static configuration for the IPv4RoutingTable and the IPv4 network interfaces of all nodes in the network. More...
#include <IPv4NetworkConfigurator.h>
Classes | |
class | InterfaceInfo |
Represents an interface in the network. More... | |
class | Node |
Represents a node in the network. More... | |
class | RouteInfo |
Simplified route representation used by the optimizer. More... | |
class | RoutingTableInfo |
Simplified routing table representation used by the optimizer. More... | |
class | Topology |
Public Member Functions | |
virtual void | computeConfiguration () |
Computes the IPv4 network configuration for all nodes in the network. More... | |
virtual void | configureAllInterfaces () |
Configures all interfaces in the network based on the current network configuration. More... | |
virtual void | configureInterface (InterfaceEntry *interfaceEntry) |
Configures the provided interface based on the current network configuration. More... | |
virtual void | configureAllRoutingTables () |
Configures all routing tables in the network based on the current network configuration. More... | |
virtual void | configureRoutingTable (IIPv4RoutingTable *routingTable) |
Configures the provided routing table based on the current network configuration. More... | |
Public Member Functions inherited from inet::L3AddressResolver | |
L3AddressResolver () | |
virtual | ~L3AddressResolver () |
virtual L3Address | resolve (const char *str, int addrType=DEFAULT_ADDR_TYPE) |
Accepts dotted decimal notation ("127.0.0.1"), module name of the host or router ("host[2]"), and empty string (""). More... | |
virtual std::vector< L3Address > | resolve (std::vector< std::string > strs, int addrType=DEFAULT_ADDR_TYPE) |
Utility function: Calls resolve() for each item in the string vector, and returns the result in an address vector. More... | |
virtual bool | tryResolve (const char *str, L3Address &result, int addrType=DEFAULT_ADDR_TYPE) |
Similar to resolve(), but returns false (instead of throwing an error) if the address cannot be resolved because the given host (or interface) doesn't have an address assigned yet. More... | |
virtual L3Address | addressOf (cModule *host, int addrType=DEFAULT_ADDR_TYPE) |
Returns IPv4 or IPv6 address of the given host or router. More... | |
virtual L3Address | addressOf (cModule *host, const char *ifname, int addrType=DEFAULT_ADDR_TYPE) |
Similar to addressOf(), but only looks at the given interface. More... | |
virtual L3Address | addressOf (cModule *host, cModule *destmod, int addrType=DEFAULT_ADDR_TYPE) |
Returns IPv4 or IPv6 address of the given host or router. More... | |
virtual L3Address | routerIdOf (cModule *host) |
Returns the router Id of the given router. More... | |
virtual L3Address | getAddressFrom (IInterfaceTable *ift, int addrType=DEFAULT_ADDR_TYPE) |
Returns the IPv4 or IPv6 address of the given host or router, given its IInterfaceTable module. More... | |
virtual L3Address | getAddressFrom (InterfaceEntry *ie, int addrType=DEFAULT_ADDR_TYPE) |
Returns the IPv4 or IPv6 address of the given interface (of a host or router). More... | |
virtual IInterfaceTable * | interfaceTableOf (cModule *host) |
The function tries to look up the IInterfaceTable module as submodule "interfaceTable" or "networkLayer.interfaceTable" within the host/router module. More... | |
virtual IIPv4RoutingTable * | routingTableOf (cModule *host) |
The function tries to look up the IIPv4RoutingTable module as submodule "routingTable" or "networkLayer.routingTable" within the host/router module. More... | |
virtual IPv6RoutingTable * | routingTable6Of (cModule *host) |
The function tries to look up the IPv6RoutingTable module as submodule "routingTable6" or "networkLayer.routingTable6" within the host/router module. More... | |
virtual IInterfaceTable * | findInterfaceTableOf (cModule *host) |
Like interfaceTableOf(), but doesn't throw error if not found. More... | |
virtual IIPv4RoutingTable * | findIPv4RoutingTableOf (cModule *host) |
Like routingTableOf(), but doesn't throw error if not found. More... | |
virtual IPv6RoutingTable * | findIPv6RoutingTableOf (cModule *host) |
Like interfaceTableOf(), but doesn't throw error if not found. More... | |
virtual GenericRoutingTable * | findGenericRoutingTableOf (cModule *host) |
Like interfaceTableOf(), but doesn't throw error if not found. More... | |
virtual cModule * | findHostWithAddress (const L3Address &addr) |
Find the Host with the specified address. More... | |
Protected Member Functions | |
virtual int | numInitStages () const override |
virtual void | handleMessage (cMessage *msg) override |
virtual void | initialize (int stage) override |
virtual void | readInterfaceConfiguration (Topology &topology) |
Reads interface elements from the configuration file and stores result. More... | |
virtual void | readMulticastGroupConfiguration (Topology &topology) |
Reads multicast-group elements from the configuration file and stores the result. More... | |
virtual void | readManualRouteConfiguration (Topology &topology) |
Reads route elements from configuration file and stores the result. More... | |
virtual void | readManualMulticastRouteConfiguration (Topology &topology) |
Reads multicast-route elements from configuration file and stores the result. More... | |
virtual void | assignAddresses (Topology &topology) |
Assigns the addresses for all interfaces based on the parameters given in the configuration file. More... | |
virtual void | addStaticRoutes (Topology &topology, cXMLElement *element) |
Adds static routes to all routing tables in the network. More... | |
virtual void | optimizeRoutes (std::vector< IPv4Route * > &routes) |
Destructively optimizes the given IPv4 routes by merging some of them. More... | |
void | ensureConfigurationComputed (Topology &topology) |
void | configureInterface (InterfaceInfo *interfaceInfo) |
void | configureRoutingTable (Node *node) |
virtual void | dumpConfiguration () |
Prints the current network configuration to the module output. More... | |
virtual void | dumpLinks (Topology &topology) |
virtual void | dumpAddresses (Topology &topology) |
virtual void | dumpRoutes (Topology &topology) |
virtual void | dumpConfig (Topology &topology) |
virtual InterfaceInfo * | createInterfaceInfo (NetworkConfiguratorBase::Topology &topology, NetworkConfiguratorBase::Node *node, LinkInfo *linkInfo, InterfaceEntry *interfaceEntry) override |
virtual void | parseAddressAndSpecifiedBits (const char *addressAttr, uint32_t &outAddress, uint32_t &outAddressSpecifiedBits) |
virtual bool | linkContainsMatchingHostExcept (LinkInfo *linkInfo, Matcher *hostMatcher, cModule *exceptModule) |
virtual const char * | getMandatoryAttribute (cXMLElement *element, const char *attr) |
virtual void | resolveInterfaceAndGateway (Node *node, const char *interfaceAttr, const char *gatewayAttr, InterfaceEntry *&outIE, IPv4Address &outGateway, Topology &topology) |
virtual InterfaceInfo * | findInterfaceOnLinkByNode (LinkInfo *linkInfo, cModule *node) |
virtual InterfaceInfo * | findInterfaceOnLinkByNodeAddress (LinkInfo *linkInfo, IPv4Address address) |
virtual LinkInfo * | findLinkOfInterface (Topology &topology, InterfaceEntry *interfaceEntry) |
virtual IRoutingTable * | findRoutingTable (NetworkConfiguratorBase::Node *node) override |
void | collectCompatibleInterfaces (const std::vector< InterfaceInfo * > &interfaces, std::vector< InterfaceInfo * > &compatibleInterfaces, uint32 &mergedAddress, uint32 &mergedAddressSpecifiedBits, uint32 &mergedAddressIncompatibleBits, uint32 &mergedNetmask, uint32 &mergedNetmaskSpecifiedBits, uint32 &mergedNetmaskIncompatibleBits) |
Returns a subset of the given interfaces that have compatible address and netmask specifications. More... | |
bool | containsRoute (const std::vector< IPv4Route * > &routes, IPv4Route *route) |
bool | routesHaveSameColor (IPv4Route *route1, IPv4Route *route2) |
Returns true if the two routes are the same except their address prefix and netmask. More... | |
int | findRouteIndexWithSameColor (const std::vector< IPv4Route * > &routes, IPv4Route *route) |
Returns the index of the first route that has the same color. More... | |
bool | routesCanBeSwapped (RouteInfo *routeInfo1, RouteInfo *routeInfo2) |
Returns true if swapping two ADJACENT routes in the routing table does not change the table's meaning. More... | |
bool | routesCanBeNeighbors (const std::vector< RouteInfo * > &routeInfos, int i, int j) |
Returns true if the routes can be neighbors by repeatedly swapping routes in the routing table without changing their meaning. More... | |
bool | interruptsOriginalRoute (const RoutingTableInfo &routingTableInfo, int begin, int end, RouteInfo *originalRouteInfo) |
Returns true if the original route is interrupted by any of the routes in the routing table between begin and end. More... | |
bool | interruptsAnyOriginalRoute (const RoutingTableInfo &routingTableInfo, int begin, int end, const std::vector< RouteInfo * > &originalRouteInfos) |
Returns true if any of the original routes is interrupted by any of the routes in the routing table between begin and end. More... | |
bool | interruptsSubsequentOriginalRoutes (const RoutingTableInfo &routingTableInfo, int index) |
Returns true if any of the original routes attached to the routes in the routing table below index are interrupted by the route at index. More... | |
void | checkOriginalRoutes (const RoutingTableInfo &routingTableInfo, const std::vector< RouteInfo * > &originalRouteInfos) |
Asserts that all original routes are still routed the same way as by the original routing table. More... | |
void | findLongestCommonDestinationPrefix (uint32 destination1, uint32 netmask1, uint32 destination2, uint32 netmask2, uint32 &destinationOut, uint32 &netmaskOut) |
Returns the longest shared address prefix and netmask by iterating through bits from left to right. More... | |
void | addOriginalRouteInfos (RoutingTableInfo &routingTableInfo, int begin, int end, const std::vector< RouteInfo * > &originalRouteInfos) |
Adds all of the original routes to the matching optimized routes between begin and end. More... | |
bool | tryToMergeTwoRoutes (RoutingTableInfo &routingTableInfo, int i, int j, RouteInfo *routeInfoI, RouteInfo *routeInfoJ) |
Try to merge two routes that have the same color and could be neighbours in table without changing the table's meaning. More... | |
bool | tryToMergeAnyTwoRoutes (RoutingTableInfo &routingTableInfo) |
Iteratively checks if any two routes can be aggressively merged without changing the meaning of all original routes. More... | |
bool | getInterfaceIPv4Address (L3Address &ret, InterfaceEntry *interfaceEntry, bool netmask) override |
Protected Member Functions inherited from inet::NetworkConfiguratorBase | |
virtual void | extractTopology (Topology &topology) |
Extracts network topology by walking through the module hierarchy. More... | |
virtual void | extractWiredNeighbors (Topology &topology, Topology::LinkOut *linkOut, LinkInfo *linkInfo, std::set< InterfaceEntry * > &interfacesSeen, std::vector< Node * > &nodesVisited) |
virtual void | extractWirelessNeighbors (Topology &topology, const char *wirelessId, LinkInfo *linkInfo, std::set< InterfaceEntry * > &interfacesSeen, std::vector< Node * > &nodesVisited) |
virtual void | extractDeviceNeighbors (Topology &topology, Node *node, LinkInfo *linkInfo, std::set< InterfaceEntry * > &interfacesSeen, std::vector< Node * > &deviceNodesVisited) |
virtual InterfaceInfo * | determineGatewayForLink (LinkInfo *linkInfo) |
If this link has exactly one node that connects to other links as well, we can assume it is a "gateway" and return that (we'll use it in routing); otherwise return nullptr. More... | |
virtual double | computeNodeWeight (Node *node, const char *metric, cXMLElement *parameters) |
virtual double | computeLinkWeight (Link *link, const char *metric, cXMLElement *parameters) |
virtual double | computeWiredLinkWeight (Link *link, const char *metric, cXMLElement *parameters) |
virtual double | computeWirelessLinkWeight (Link *link, const char *metric, cXMLElement *parameters) |
virtual bool | isBridgeNode (Node *node) |
virtual bool | isWirelessInterface (InterfaceEntry *interfaceEntry) |
virtual const char * | getWirelessId (InterfaceEntry *interfaceEntry) |
If this function returns the same string for two wireless interfaces, they will be regarded as being in the same wireless network. More... | |
virtual Topology::LinkOut * | findLinkOut (Node *node, int gateId) |
virtual InterfaceInfo * | findInterfaceInfo (Node *node, InterfaceEntry *interfaceEntry) |
virtual IInterfaceTable * | findInterfaceTable (Node *node) |
virtual void | dumpTopology (Topology &topology) |
Protected Member Functions inherited from inet::L3AddressResolver | |
virtual bool | getIPv4AddressFrom (L3Address &retAddr, IInterfaceTable *ift, bool netmask) |
virtual bool | getIPv6AddressFrom (L3Address &retAddr, IInterfaceTable *ift, bool netmask) |
virtual bool | getMACAddressFrom (L3Address &retAddr, IInterfaceTable *ift, bool netmask) |
virtual bool | getModulePathAddressFrom (L3Address &retAddr, IInterfaceTable *ift, bool netmask) |
virtual bool | getModuleIdAddressFrom (L3Address &retAddr, IInterfaceTable *ift, bool netmask) |
virtual bool | getInterfaceIPv6Address (L3Address &ret, InterfaceEntry *ie, bool mask) |
virtual bool | getInterfaceMACAddress (L3Address &ret, InterfaceEntry *ie, bool mask) |
virtual bool | getInterfaceModulePathAddress (L3Address &ret, InterfaceEntry *ie, bool mask) |
virtual bool | getInterfaceModuleIdAddress (L3Address &ret, InterfaceEntry *ie, bool mask) |
Static Protected Member Functions | |
static bool | compareInterfaceInfos (InterfaceInfo *i, InterfaceInfo *j) |
Protected Attributes | |
bool | assignAddressesParameter |
bool | assignDisjunctSubnetAddressesParameter |
bool | addStaticRoutesParameter |
bool | addSubnetRoutesParameter |
bool | addDefaultRoutesParameter |
bool | optimizeRoutesParameter |
Topology | topology |
Protected Attributes inherited from inet::NetworkConfiguratorBase | |
double | minLinkWeight = NaN |
cXMLElement * | configuration = nullptr |
Additional Inherited Members | |
Public Types inherited from inet::L3AddressResolver | |
enum | { ADDR_IPv4 = 1, ADDR_IPv6 = 2, ADDR_MAC = 4, ADDR_MODULEPATH = 8, ADDR_MODULEID = 16, ADDR_MASK = 32 } |
This module provides the global static configuration for the IPv4RoutingTable and the IPv4 network interfaces of all nodes in the network.
For more info please see the NED file.
|
protected |
Adds all of the original routes to the matching optimized routes between begin and end.
Referenced by tryToMergeTwoRoutes().
|
protectedvirtual |
Adds static routes to all routing tables in the network.
The algorithm uses Dijkstra's weighted shortest path algorithm. May add default routes and subnet routes if possible and requested.
Referenced by computeConfiguration().
|
protectedvirtual |
Assigns the addresses for all interfaces based on the parameters given in the configuration file.
See the NED file for details.
Referenced by computeConfiguration().
|
protected |
Asserts that all original routes are still routed the same way as by the original routing table.
Referenced by optimizeRoutes().
|
protected |
Returns a subset of the given interfaces that have compatible address and netmask specifications.
Determine the merged address and netmask specifications according to the following table. The '?' symbol means the bit is unspecified, the 'X' symbol means the bit is incompatible. | * | 0 | 1 | ? | | 0 | 0 | X | 0 | | 1 | X | 1 | 1 | | ? | 0 | 1 | ? |
Referenced by assignAddresses().
|
staticprotected |
Referenced by collectCompatibleInterfaces().
|
virtual |
Computes the IPv4 network configuration for all nodes in the network.
The result of the computation is only stored in the network configurator.
Referenced by ensureConfigurationComputed().
|
virtual |
Configures all interfaces in the network based on the current network configuration.
|
virtual |
Configures all routing tables in the network based on the current network configuration.
|
virtual |
Configures the provided interface based on the current network configuration.
Referenced by configureAllInterfaces(), and inet::IPv4NodeConfigurator::configureInterface().
|
protected |
|
virtual |
Configures the provided routing table based on the current network configuration.
Referenced by configureAllRoutingTables(), and inet::IPv4NodeConfigurator::configureRoutingTable().
|
protected |
|
protected |
Referenced by addStaticRoutes().
|
overrideprotectedvirtual |
Reimplemented from inet::NetworkConfiguratorBase.
|
protectedvirtual |
Referenced by dumpConfiguration().
|
protectedvirtual |
Referenced by dumpConfiguration().
|
protectedvirtual |
Prints the current network configuration to the module output.
Referenced by initialize().
|
protectedvirtual |
Referenced by dumpConfiguration().
|
protectedvirtual |
Referenced by dumpConfiguration().
|
protected |
Referenced by configureAllInterfaces(), configureAllRoutingTables(), configureInterface(), configureRoutingTable(), and initialize().
|
protectedvirtual |
Referenced by resolveInterfaceAndGateway().
|
protectedvirtual |
Referenced by resolveInterfaceAndGateway().
|
protectedvirtual |
Referenced by resolveInterfaceAndGateway().
|
protected |
Returns the longest shared address prefix and netmask by iterating through bits from left to right.
Referenced by tryToMergeTwoRoutes().
|
protected |
Returns the index of the first route that has the same color.
Referenced by optimizeRoutes().
|
overrideprotectedvirtual |
Reimplemented from inet::NetworkConfiguratorBase.
|
overrideprotectedvirtual |
Reimplemented from inet::L3AddressResolver.
|
protectedvirtual |
Referenced by readManualRouteConfiguration().
|
inlineoverrideprotectedvirtual |
Reimplemented from inet::NetworkConfiguratorBase.
|
overrideprotectedvirtual |
Reimplemented from inet::NetworkConfiguratorBase.
|
protected |
Returns true if any of the original routes is interrupted by any of the routes in the routing table between begin and end.
Referenced by interruptsSubsequentOriginalRoutes(), and tryToMergeTwoRoutes().
|
protected |
Returns true if the original route is interrupted by any of the routes in the routing table between begin and end.
Referenced by interruptsAnyOriginalRoute().
|
protected |
Returns true if any of the original routes attached to the routes in the routing table below index are interrupted by the route at index.
Referenced by tryToMergeTwoRoutes().
|
protectedvirtual |
Referenced by readInterfaceConfiguration(), and readMulticastGroupConfiguration().
|
inlineoverrideprotectedvirtual |
Reimplemented from inet::NetworkConfiguratorBase.
|
protectedvirtual |
Destructively optimizes the given IPv4 routes by merging some of them.
The resulting routes might be different in that they will route packets that the original routes did not. Nevertheless the following invariant holds: any packet routed by the original routes will still be routed the same way by the optimized routes.
Referenced by addStaticRoutes().
|
protectedvirtual |
Referenced by readInterfaceConfiguration().
|
protectedvirtual |
Reads interface elements from the configuration file and stores result.
Referenced by computeConfiguration().
|
protectedvirtual |
Reads multicast-route elements from configuration file and stores the result.
Referenced by computeConfiguration().
|
protectedvirtual |
Reads route elements from configuration file and stores the result.
Referenced by computeConfiguration().
|
protectedvirtual |
Reads multicast-group elements from the configuration file and stores the result.
Referenced by computeConfiguration().
|
protectedvirtual |
Referenced by readManualRouteConfiguration().
|
protected |
Returns true if the routes can be neighbors by repeatedly swapping routes in the routing table without changing their meaning.
Referenced by tryToMergeAnyTwoRoutes().
|
protected |
Returns true if swapping two ADJACENT routes in the routing table does not change the table's meaning.
Referenced by routesCanBeNeighbors().
|
protected |
Returns true if the two routes are the same except their address prefix and netmask.
If it returns true we say that the routes have the same color.
Referenced by findRouteIndexWithSameColor().
|
protected |
Iteratively checks if any two routes can be aggressively merged without changing the meaning of all original routes.
The merged route will have the longest shared address prefix and netmask with the two merged routes. This optimization might change the meaning of the routing table in that it will route packets that it did not route before. Nevertheless, any packet routed by the original routing table will still be routed the same way by the optimized routing table. Returns true if two routes has been merged, otherwise returns false.
Referenced by optimizeRoutes().
|
protected |
Try to merge two routes that have the same color and could be neighbours in table without changing the table's meaning.
There are two merge opportunities: (1) one route's network contains the other one (then the second can be dropped), and (2) use a shorter common prefix that covers both (this is only possible if this doesn't interfere with existing routes in the table). Returns true if the two routes have been merged, otherwise returns false.
Referenced by tryToMergeAnyTwoRoutes().
|
protected |
Referenced by addStaticRoutes(), and initialize().
|
protected |
Referenced by computeConfiguration(), and initialize().
|
protected |
Referenced by addStaticRoutes(), and initialize().
|
protected |
Referenced by computeConfiguration(), configureInterface(), and initialize().
|
protected |
Referenced by assignAddresses(), and initialize().
|
protected |
Referenced by addStaticRoutes(), and initialize().
|
protected |