INET Framework for OMNeT++/OMNEST
inet::IPv6RoutingTable Class Reference

Represents the IPv6 routing table and neighbour discovery data structures. More...

#include <IPv6RoutingTable.h>

Inheritance diagram for inet::IPv6RoutingTable:
inet::IRoutingTable inet::ILifecycle

Classes

struct  DestCacheEntry
 
class  RouteLessThan
 

Public Member Functions

 IPv6RoutingTable ()
 
virtual ~IPv6RoutingTable ()
 
virtual bool isRouter () const
 IP forwarding on/off. More...
 
virtual bool isMulticastForwardingEnabled ()
 
virtual void routeChanged (IPv6Route *entry, int fieldCode)
 To be called from route objects whenever a field changes. More...
 
bool isHomeAgent () const
 Determine whether normal Router or Home Agent. More...
 
void setIsHomeAgent (bool value)
 Define whether normal Router or Home Agent. More...
 
bool isMobileNode () const
 Determine whether a node is a Mobile Node or Correspondent Node: MN if TRUE or else a CN. More...
 
void setIsMobileNode (bool value)
 Define whether a node is a Mobile Node or Correspondent Node: MN if TRUE or else a CN. More...
 
const IPv6AddressgetHomeAddress ()
 
bool isHomeAddress (const IPv6Address &addr)
 Check whether provided address is a HoA. More...
 
void deleteDefaultRoutes (int interfaceID)
 Deletes the current default routes for the given interface. More...
 
void deleteAllRoutes ()
 Deletes all routes from the routing table. More...
 
void deletePrefixes (int interfaceID)
 Deletes all prefixes registered for the given interface. More...
 
bool hasMIPv6Support ()
 Can be used to check whether this node supports MIPv6 or not (MN, MR, HA or CN). More...
 
void setMIPv6Support (bool value)
 This method is used to define whether the node support MIPv6 or not (MN, MR, HA or CN). More...
 
bool isOnLinkAddress (const IPv6Address &address)
 Checks whether the provided address is in an on-link address with respect to the prefix advertisement list. More...
 
virtual bool handleOperationStage (LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) override
 ILifecycle method. More...
 
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 bool isLocalBroadcastAddress (const L3Address &dest) const
 
virtual InterfaceEntrygetInterfaceByAddress (const L3Address &address) const override
 Returns an interface given by its address. More...
 
virtual InterfaceEntryfindInterfaceByLocalBroadcastAddress (const L3Address &dest) const
 
virtual IRoutefindBestMatchingRoute (const L3Address &dest) const override
 The routing function. More...
 
virtual InterfaceEntrygetOutputInterfaceForDestination (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...
 
virtual bool isLocalMulticastAddress (const L3Address &dest) const override
 Checks if the address is in one of the local multicast group address list. More...
 
virtual IMulticastRoutefindBestMatchingMulticastRoute (const L3Address &origin, const L3Address &group) const override
 Returns route for a multicast origin and group. More...
 
virtual IRoutegetDefaultRoute () 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 IRouteremoveRoute (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 IMulticastRoutegetMulticastRoute (int i) const override
 Returns the kth multicast route. More...
 
virtual int getNumMulticastRoutes () const override
 Returns the total number of multicast routes. More...
 
virtual void addMulticastRoute (IMulticastRoute *entry) override
 Adds a multicast route to the routing table. More...
 
virtual IMulticastRouteremoveMulticastRoute (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...
 
virtual IRoutecreateRoute () override
 
virtual void printRoutingTable () const override
 Prints the routing table. More...
 
Interfaces
virtual InterfaceEntrygetInterfaceByAddress (const IPv6Address &address) const
 Returns an interface given by its address. More...
 
Routing functions
virtual bool isLocalAddress (const IPv6Address &dest) const
 Checks if the address is one of the host's addresses, i.e. More...
 
const IPv6AddresslookupDestCache (const IPv6Address &dest, int &outInterfaceId)
 Looks up the given destination address in the Destination Cache, then returns the next-hop address and the interface in the outInterfaceId variable. More...
 
const IPv6RoutedoLongestPrefixMatch (const IPv6Address &dest)
 Performs longest prefix match in the routing table and returns the resulting route, or nullptr if there was no match. More...
 
virtual bool isPrefixPresent (const IPv6Address &prefix) const
 Checks if the given prefix already exists in the routing table (prefix list) More...
 
Managing the destination cache
virtual void updateDestCache (const IPv6Address &dest, const IPv6Address &nextHopAddr, int interfaceId, simtime_t expiryTime)
 Add or update a destination cache entry. More...
 
virtual void purgeDestCache ()
 Discard all entries in destination cache. More...
 
virtual void purgeDestCacheEntriesToNeighbour (const IPv6Address &nextHopAddr, int interfaceId)
 Discard all entries in destination cache where next hop is the given address on the given interface. More...
 
void purgeDestCacheForInterfaceID (int interfaceId)
 Removes all destination cache entries for the specified interface. More...
 
Managing prefixes and the route table
virtual void addOrUpdateOnLinkPrefix (const IPv6Address &destPrefix, int prefixLength, int interfaceId, simtime_t expiryTime)
 Add on-link prefix (route of type FROM_RA), or update existing one. More...
 
virtual void deleteOnLinkPrefix (const IPv6Address &destPrefix, int prefixLength)
 Remove an on-link prefix. More...
 
virtual void addOrUpdateOwnAdvPrefix (const IPv6Address &destPrefix, int prefixLength, int interfaceId, simtime_t expiryTime)
 Add route of type OWN_ADV_PREFIX. More...
 
virtual void addStaticRoute (const IPv6Address &destPrefix, int prefixLength, unsigned int interfaceId, const IPv6Address &nextHop, int metric=0)
 Creates a static route. More...
 
virtual void addDefaultRoute (const IPv6Address &raSrcAddr, unsigned int ifID, simtime_t routerLifetime)
 Adds a default route for a host. More...
 
virtual void addRoutingProtocolRoute (IPv6Route *route)
 Adds the given getRoute(which can be OSPF, BGP, RIP or any other route) with src==ROUTING_PROT. More...
 
virtual IPv6RouteremoveRoute (IPv6Route *route)
 Removes the given route from the routing table, and returns it. More...
 
virtual bool deleteRoute (IPv6Route *route)
 Deletes the given route from the route table. More...
 
virtual void deleteInterfaceRoutes (const InterfaceEntry *entry)
 Deletes the routes that are using the specified interface. More...
 
virtual int getNumRoutes () const override
 Return the number of routes. More...
 
virtual IPv6RoutegetRoute (int i) const override
 Return the ith route. More...
 
- Public Member Functions inherited from inet::IRoutingTable
virtual ~IRoutingTable ()
 
- Public Member Functions inherited from inet::ILifecycle
virtual ~ILifecycle ()
 

Protected Types

typedef std::map< IPv6Address, DestCacheEntryDestCache
 
typedef std::vector< IPv6Route * > RouteList
 

Protected Member Functions

virtual IPv6RoutecreateNewRoute (IPv6Address destPrefix, int prefixLength, IRoute::SourceType src)
 
virtual void addRoute (IPv6Route *route)
 
bool routeLessThan (const IPv6Route *a, const IPv6Route *b) const
 
virtual void configureInterfaceForIPv6 (InterfaceEntry *ie)
 
virtual void assignRequiredNodeAddresses (InterfaceEntry *ie)
 RFC 3513: Section 2.8 A Node's Required Address Assign the various addresses to the node's respective interface. More...
 
virtual void configureInterfaceFromXML (InterfaceEntry *ie, cXMLElement *cfg)
 
virtual void configureTunnelFromXML (cXMLElement *cfg)
 
void internalAddRoute (IPv6Route *route)
 
IPv6RouteinternalRemoveRoute (IPv6Route *route)
 
RouteList::iterator internalDeleteRoute (RouteList::iterator it)
 
virtual void refreshDisplay () const override
 
virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void parseXMLConfigFile ()
 
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...
 

Protected Attributes

IInterfaceTableift = nullptr
 
bool isrouter = false
 
bool multicastForward = false
 
bool useAdminDist = false
 
bool ishome_agent = false
 
bool ismobile_node = false
 
bool mipv6Support = false
 
DestCache destCache
 
RouteList routeList
 

Friends

std::ostream & operator<< (std::ostream &os, const DestCacheEntry &e)
 

Detailed Description

Represents the IPv6 routing table and neighbour discovery data structures.

This object has one instance per host or router.

See the NED documentation for general overview.

This is a simple module without gates, it requires function calls to it (message handling does nothing). Methods are provided for reading and updating the interface table and the route table, as well as for unicast and multicast routing.

The route table is read from a file. The route table can also be read and modified during simulation, typically by routing protocol implementations.

Member Typedef Documentation

typedef std::vector<IPv6Route *> inet::IPv6RoutingTable::RouteList
protected

Constructor & Destructor Documentation

inet::IPv6RoutingTable::IPv6RoutingTable ( )
48 {
49 }
inet::IPv6RoutingTable::~IPv6RoutingTable ( )
virtual
52 {
53  for (auto & elem : routeList)
54  delete elem;
55 }
RouteList routeList
Definition: IPv6RoutingTable.h:82

Member Function Documentation

void inet::IPv6RoutingTable::addDefaultRoute ( const IPv6Address raSrcAddr,
unsigned int  ifID,
simtime_t  routerLifetime 
)
virtual

Adds a default route for a host.

This method requires the RA's source address and the router expiry time plus the simTime().

Referenced by inet::IPv6NeighbourDiscovery::processRAForRouterUpdates().

645 {
646  // create route object
647  IPv6Route *route = createNewRoute(IPv6Address(), 0, IRoute::ROUTER_ADVERTISEMENT);
648  route->setInterface(ift->getInterfaceById(ifID));
649  route->setNextHop(nextHop);
650  route->setMetric(10); //FIXME:should be filled from interface metric
651  route->setAdminDist(IPv6Route::dStatic);
652 
653 #ifdef WITH_xMIPv6
654  route->setExpiryTime(routerLifetime); // lifetime useful after transitioning to new AR // 27.07.08 - CB
655 #endif /* WITH_xMIPv6 */
656 
657  // then add it
658  addRoute(route);
659 }
virtual InterfaceEntry * getInterfaceById(int id) const =0
Returns an interface by its Id.
virtual IPv6Route * createNewRoute(IPv6Address destPrefix, int prefixLength, IRoute::SourceType src)
Definition: IPv6RoutingTable.cc:57
virtual void addRoute(IPv6Route *route)
Definition: IPv6RoutingTable.cc:683
Definition: IPv6Route.h:43
on-link prefix, from Router Advertisement
Definition: IRoute.h:42
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
virtual void inet::IPv6RoutingTable::addMulticastRoute ( IMulticastRoute entry)
inlineoverridevirtual

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.

404 { /*TODO addMulticastRoute(entry);*/ }
void inet::IPv6RoutingTable::addOrUpdateOnLinkPrefix ( const IPv6Address destPrefix,
int  prefixLength,
int  interfaceId,
simtime_t  expiryTime 
)
virtual

Add on-link prefix (route of type FROM_RA), or update existing one.

To be called from code processing on-link prefixes in Router Advertisements. Expiry time can be derived from the Valid Lifetime field in the Router Advertisements.

NOTE: This method does NOT update the lifetime of matching addresses in the IInterfaceTable (see IPv6InterfaceData); that has to be done separately.

Referenced by inet::IPv6NeighbourDiscovery::processRAPrefixInfo().

551 {
552  // see if prefix exists in table
553  IPv6Route *route = nullptr;
554  for (auto & elem : routeList) {
555  if ((elem)->getSourceType() == IRoute::ROUTER_ADVERTISEMENT && (elem)->getDestPrefix() == destPrefix && (elem)->getPrefixLength() == prefixLength) {
556  route = elem;
557  break;
558  }
559  }
560 
561  if (route == nullptr) {
562  // create new route object
563  IPv6Route *route = createNewRoute(destPrefix, prefixLength, IRoute::ROUTER_ADVERTISEMENT);
564  route->setInterface(ift->getInterfaceById(interfaceId));
565  route->setExpiryTime(expiryTime);
566  route->setMetric(0);
567  route->setAdminDist(IPv6Route::dDirectlyConnected);
568 
569  // then add it
570  addRoute(route);
571  }
572  else {
573  // update existing one; notification-wise, we pretend the route got removed then re-added
574  emit(NF_ROUTE_DELETED, route);
575  route->setInterface(ift->getInterfaceById(interfaceId));
576  route->setExpiryTime(expiryTime);
577  emit(NF_ROUTE_ADDED, route);
578  }
579 }
virtual InterfaceEntry * getInterfaceById(int id) const =0
Returns an interface by its Id.
simsignal_t NF_ROUTE_DELETED
Definition: NotifierConsts.cc:58
virtual IPv6Route * createNewRoute(IPv6Address destPrefix, int prefixLength, IRoute::SourceType src)
Definition: IPv6RoutingTable.cc:57
virtual void addRoute(IPv6Route *route)
Definition: IPv6RoutingTable.cc:683
Definition: IPv6Route.h:42
on-link prefix, from Router Advertisement
Definition: IRoute.h:42
simsignal_t NF_ROUTE_ADDED
Definition: NotifierConsts.cc:57
RouteList routeList
Definition: IPv6RoutingTable.h:82
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
void inet::IPv6RoutingTable::addOrUpdateOwnAdvPrefix ( const IPv6Address destPrefix,
int  prefixLength,
int  interfaceId,
simtime_t  expiryTime 
)
virtual

Add route of type OWN_ADV_PREFIX.

This is a prefix that this router advertises on this interface.

Referenced by inet::FlatNetworkConfigurator6::addOwnAdvPrefixRoutes(), and initialize().

583 {
584  // FIXME this is very similar to the one above -- refactor!!
585 
586  // see if prefix exists in table
587  IPv6Route *route = nullptr;
588  for (auto & elem : routeList) {
589  if ((elem)->getSourceType() == IRoute::OWN_ADV_PREFIX && (elem)->getDestPrefix() == destPrefix && (elem)->getPrefixLength() == prefixLength) {
590  route = elem;
591  break;
592  }
593  }
594 
595  if (route == nullptr) {
596  // create new route object
597  IPv6Route *route = createNewRoute(destPrefix, prefixLength, IRoute::OWN_ADV_PREFIX);
598  route->setInterface(ift->getInterfaceById(interfaceId));
599  route->setExpiryTime(expiryTime);
600  route->setMetric(0);
601  route->setAdminDist(IPv6Route::dDirectlyConnected);
602 
603  // then add it
604  addRoute(route);
605  }
606  else {
607  // update existing one; notification-wise, we pretend the route got removed then re-added
608  emit(NF_ROUTE_DELETED, route);
609  route->setInterface(ift->getInterfaceById(interfaceId));
610  route->setExpiryTime(expiryTime);
611  emit(NF_ROUTE_ADDED, route);
612  }
613 }
virtual InterfaceEntry * getInterfaceById(int id) const =0
Returns an interface by its Id.
on routers: on-link prefix that the router itself advertises on the link
Definition: IRoute.h:43
simsignal_t NF_ROUTE_DELETED
Definition: NotifierConsts.cc:58
virtual IPv6Route * createNewRoute(IPv6Address destPrefix, int prefixLength, IRoute::SourceType src)
Definition: IPv6RoutingTable.cc:57
virtual void addRoute(IPv6Route *route)
Definition: IPv6RoutingTable.cc:683
Definition: IPv6Route.h:42
simsignal_t NF_ROUTE_ADDED
Definition: NotifierConsts.cc:57
RouteList routeList
Definition: IPv6RoutingTable.h:82
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
void inet::IPv6RoutingTable::addRoute ( IPv6Route route)
protectedvirtual

Referenced by addDefaultRoute(), addOrUpdateOnLinkPrefix(), addOrUpdateOwnAdvPrefix(), addRoutingProtocolRoute(), and addStaticRoute().

684 {
685  internalAddRoute(route);
686 
687  /*XXX: this deletes some cache entries we want to keep, but the node MUST update
688  the Destination Cache in such a way that the latest route information are used.*/
689  purgeDestCache();
690 
691  emit(NF_ROUTE_ADDED, route);
692 }
void internalAddRoute(IPv6Route *route)
Definition: IPv6RoutingTable.cc:705
virtual void purgeDestCache()
Discard all entries in destination cache.
Definition: IPv6RoutingTable.cc:518
simsignal_t NF_ROUTE_ADDED
Definition: NotifierConsts.cc:57
virtual void inet::IPv6RoutingTable::addRoute ( IRoute entry)
inlineoverridevirtual

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.

399 { addRoutingProtocolRoute(check_and_cast<IPv6Route *>(entry)); } //XXX contrast that with addStaticRoute()!
virtual void addRoutingProtocolRoute(IPv6Route *route)
Adds the given getRoute(which can be OSPF, BGP, RIP or any other route) with src==ROUTING_PROT.
Definition: IPv6RoutingTable.cc:661
void inet::IPv6RoutingTable::addRoutingProtocolRoute ( IPv6Route route)
virtual

Adds the given getRoute(which can be OSPF, BGP, RIP or any other route) with src==ROUTING_PROT.

To store additional information with the route, one can subclass from IPv6Route and add more fields.

662 {
663  // TODO ASSERT(route->getSrc()==IPv6Route::ROUTING_PROT);
664  addRoute(route);
665 }
virtual void addRoute(IPv6Route *route)
Definition: IPv6RoutingTable.cc:683
void inet::IPv6RoutingTable::addStaticRoute ( const IPv6Address destPrefix,
int  prefixLength,
unsigned int  interfaceId,
const IPv6Address nextHop,
int  metric = 0 
)
virtual

Creates a static route.

If metric is omitted, it gets initialized to the interface's metric value.

Referenced by inet::FlatNetworkConfigurator6::addStaticRoutes(), and configureInterfaceForIPv6().

629 {
630  // create route object
631  IPv6Route *route = createNewRoute(destPrefix, prefixLength, IRoute::MANUAL);
632  route->setInterface(ift->getInterfaceById(interfaceId));
633  route->setNextHop(nextHop);
634  if (metric == 0)
635  metric = 10; // TBD should be filled from interface metric
636  route->setMetric(metric);
637  route->setAdminDist(IPv6Route::dStatic);
638 
639  // then add it
640  addRoute(route);
641 }
virtual InterfaceEntry * getInterfaceById(int id) const =0
Returns an interface by its Id.
virtual IPv6Route * createNewRoute(IPv6Address destPrefix, int prefixLength, IRoute::SourceType src)
Definition: IPv6RoutingTable.cc:57
virtual void addRoute(IPv6Route *route)
Definition: IPv6RoutingTable.cc:683
Definition: IPv6Route.h:43
manually added static route
Definition: IRoute.h:40
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
void inet::IPv6RoutingTable::assignRequiredNodeAddresses ( InterfaceEntry ie)
protectedvirtual

RFC 3513: Section 2.8 A Node's Required Address Assign the various addresses to the node's respective interface.

This should be done when the IPv6 Protocol stack is created.

Referenced by configureInterfaceForIPv6().

251 {
252  //RFC 3513 Section 2.8:A Node's Required Addresses
253  /*A host is required to recognize the following addresses as
254  identifying itself:*/
255 
256  //o The loopback address.
257  if (ie->isLoopback()) {
258  ie->ipv6Data()->assignAddress(IPv6Address("::1"), false, SIMTIME_ZERO, SIMTIME_ZERO);
259  return;
260  }
261  //o Its required Link-Local Address for each interface.
262 
263 #ifndef WITH_xMIPv6
264  //IPv6Address linkLocalAddr = IPv6Address().formLinkLocalAddress(ie->getInterfaceToken());
265  //ie->ipv6Data()->assignAddress(linkLocalAddr, true, 0, 0);
266 #else /* WITH_xMIPv6 */
267  IPv6Address linkLocalAddr = IPv6Address().formLinkLocalAddress(ie->getInterfaceToken());
268  ie->ipv6Data()->assignAddress(linkLocalAddr, true, SIMTIME_ZERO, SIMTIME_ZERO);
269 #endif /* WITH_xMIPv6 */
270 
271  /*o Any additional Unicast and Anycast Addresses that have been configured
272  for the node's interfaces (manually or automatically).*/
273 
274  // FIXME FIXME Andras: commented out the following lines, because these addresses
275  // are implicitly checked for in isLocalAddress() (we don't want redundancy,
276  // and manually adding solicited-node mcast address for each and every address
277  // is very error-prone!)
278  //
279  //o The All-Nodes Multicast Addresses defined in section 2.7.1.
280 
281  /*o The Solicited-Node Multicast Address for each of its unicast and anycast
282  addresses.*/
283 
284  //o Multicast Addresses of all other groups to which the node belongs.
285 
286  /*A router is required to recognize all addresses that a host is
287  required to recognize, plus the following addresses as identifying
288  itself:*/
289  /*o The Subnet-Router Anycast Addresses for all interfaces for
290  which it is configured to act as a router.*/
291 
292  //o All other Anycast Addresses with which the router has been configured.
293  //o The All-Routers Multicast Addresses defined in section 2.7.1.
294 }
void inet::IPv6RoutingTable::configureInterfaceForIPv6 ( InterfaceEntry ie)
protectedvirtual

Referenced by initialize().

222 {
223  IPv6InterfaceData *ipv6IfData = new IPv6InterfaceData();
224  ie->setIPv6Data(ipv6IfData);
225 
226  // for routers, turn on advertisements by default
227  //FIXME: we will use this isRouter flag for now. what if future implementations
228  //have 2 interfaces where one interface is configured as a router and the other
229  //as a host?
230  ipv6IfData->setAdvSendAdvertisements(isrouter); //Added by WEI
231 
232  // metric: some hints: OSPF cost (2e9/bps value), MS KB article Q299540, ...
233  //d->setMetric((int)ceil(2e9/ie->getDatarate())); // use OSPF cost as default
234  //FIXME TBD fill in the rest
235 
237 
238  // add link-local prefix to each interface according to RFC 4861 5.1
239  if (!ie->isLoopback())
241 
242  if (ie->isMulticast()) {
243  // XXX join other ALL_NODES_x and ALL_ROUTERS_x addresses too?
244  ipv6IfData->joinMulticastGroup(IPv6Address::ALL_NODES_2);
245  if (isrouter)
246  ipv6IfData->joinMulticastGroup(IPv6Address::ALL_ROUTERS_2);
247  }
248 }
virtual void addStaticRoute(const IPv6Address &destPrefix, int prefixLength, unsigned int interfaceId, const IPv6Address &nextHop, int metric=0)
Creates a static route.
Definition: IPv6RoutingTable.cc:626
static const IPv6Address LINKLOCAL_PREFIX
The link-local prefix (fe80::)
Definition: IPv6Address.h:90
virtual void assignRequiredNodeAddresses(InterfaceEntry *ie)
RFC 3513: Section 2.8 A Node&#39;s Required Address Assign the various addresses to the node&#39;s respective...
Definition: IPv6RoutingTable.cc:250
bool isrouter
Definition: IPv6RoutingTable.h:56
static const IPv6Address UNSPECIFIED_ADDRESS
The unspecified address.
Definition: IPv6Address.h:66
static const IPv6Address ALL_NODES_2
All-nodes multicast address, scope 2 (link-local)
Definition: IPv6Address.h:75
static const IPv6Address ALL_ROUTERS_2
All-routers multicast address, scope 2 (link-local)
Definition: IPv6Address.h:81
void inet::IPv6RoutingTable::configureInterfaceFromXML ( InterfaceEntry ie,
cXMLElement *  cfg 
)
protectedvirtual

Referenced by parseXMLConfigFile().

314 {
315  /*XML parsing capabilities tweaked by WEI. For now, we can configure a specific
316  node's interface. We can set advertising prefixes and other variables to be used
317  in RAs. The IPv6 interface data gets overwritten if lines 249 to 262 is uncommented.
318  The fix is to create an XML file with all the default values. Customised XML files
319  can be used for future protocols that requires different values. (MIPv6)*/
320  IPv6InterfaceData *d = ie->ipv6Data();
321 
322  // parse basic config (attributes)
323  d->setAdvSendAdvertisements(toBool(getRequiredAttr(cfg, "AdvSendAdvertisements")));
324  //TODO: leave this off first!! They overwrite stuff!
325 
326  /* TODO: Wei commented out the stuff below. To be checked why (Andras).
327  d->setMaxRtrAdvInterval(utils::atod(getRequiredAttr(cfg, "MaxRtrAdvInterval")));
328  d->setMinRtrAdvInterval(utils::atod(getRequiredAttr(cfg, "MinRtrAdvInterval")));
329  d->setAdvManagedFlag(toBool(getRequiredAttr(cfg, "AdvManagedFlag")));
330  d->setAdvOtherConfigFlag(toBool(getRequiredAttr(cfg, "AdvOtherConfigFlag")));
331  d->setAdvLinkMTU(utils::atoul(getRequiredAttr(cfg, "AdvLinkMTU")));
332  d->setAdvReachableTime(utils::atoul(getRequiredAttr(cfg, "AdvReachableTime")));
333  d->setAdvRetransTimer(utils::atoul(getRequiredAttr(cfg, "AdvRetransTimer")));
334  d->setAdvCurHopLimit(utils::atoul(getRequiredAttr(cfg, "AdvCurHopLimit")));
335  d->setAdvDefaultLifetime(utils::atoul(getRequiredAttr(cfg, "AdvDefaultLifetime")));
336  ie->setMtu(utils::atoul(getRequiredAttr(cfg, "HostLinkMTU")));
337  d->setCurHopLimit(utils::atoul(getRequiredAttr(cfg, "HostCurHopLimit")));
338  d->setBaseReachableTime(utils::atoul(getRequiredAttr(cfg, "HostBaseReachableTime")));
339  d->setRetransTimer(utils::atoul(getRequiredAttr(cfg, "HostRetransTimer")));
340  d->setDupAddrDetectTransmits(utils::atoul(getRequiredAttr(cfg, "HostDupAddrDetectTransmits")));
341  */
342 
343  // parse prefixes (AdvPrefix elements; they should be inside an AdvPrefixList
344  // element, but we don't check that)
345  cXMLElementList prefixList = cfg->getElementsByTagName("AdvPrefix");
346  for (auto & elem : prefixList) {
347  cXMLElement *node = elem;
348  IPv6InterfaceData::AdvPrefix prefix;
349 
350  // FIXME todo implement: advValidLifetime, advPreferredLifetime can
351  // store (absolute) expiry time (if >0) or lifetime (delta) (if <0);
352  // 0 should be treated as infinity
353  int pfxLen;
354  if (!prefix.prefix.tryParseAddrWithPrefix(node->getNodeValue(), pfxLen))
355  throw cRuntimeError("Element <%s> at %s: wrong IPv6Address/prefix syntax %s",
356  node->getTagName(), node->getSourceLocation(), node->getNodeValue());
357 
358  prefix.prefixLength = pfxLen;
359  prefix.advValidLifetime = utils::atoul(getRequiredAttr(node, "AdvValidLifetime"));
360  prefix.advOnLinkFlag = toBool(getRequiredAttr(node, "AdvOnLinkFlag"));
361  prefix.advPreferredLifetime = utils::atoul(getRequiredAttr(node, "AdvPreferredLifetime"));
362  prefix.advAutonomousFlag = toBool(getRequiredAttr(node, "AdvAutonomousFlag"));
363  d->addAdvPrefix(prefix);
364  }
365 
366  // parse addresses
367  cXMLElementList addrList = cfg->getChildrenByTagName("inetAddr");
368  for (auto & elem : addrList) {
369  cXMLElement *node = elem;
370  IPv6Address address = IPv6Address(node->getNodeValue());
371  //We can now decide if the address is tentative or not.
372  d->assignAddress(address, toBool(getRequiredAttr(node, "tentative")), SIMTIME_ZERO, SIMTIME_ZERO); // set up with infinite lifetimes
373  }
374 }
unsigned long atoul(const char *s)
Converts string to unsigned long.
Definition: INETUtils.cc:47
void inet::IPv6RoutingTable::configureTunnelFromXML ( cXMLElement *  cfg)
protectedvirtual

Referenced by parseXMLConfigFile().

377 {
378  IPv6Tunneling *tunneling = getModuleFromPar<IPv6Tunneling>(par("ipv6TunnelingModule"), this);
379 
380  // parse basic config (attributes)
381  cXMLElementList tunnelList = cfg->getElementsByTagName("tunnelEntry");
382  for (auto & elem : tunnelList) {
383  cXMLElement *node = elem;
384 
385  IPv6Address entry, exit, trigger;
386  entry.set(getRequiredAttr(node, "entryPoint"));
387  exit.set(getRequiredAttr(node, "exitPoint"));
388 
389  cXMLElementList triggerList = node->getElementsByTagName("triggers");
390 
391  if (triggerList.size() != 1)
392  throw cRuntimeError("element <%s> at %s: Only exactly one trigger allowed",
393  node->getTagName(), node->getSourceLocation());
394 
395  cXMLElement *triggerNode = triggerList[0];
396  trigger.set(getRequiredAttr(triggerNode, "destination"));
397 
398  EV_INFO << "New tunnel: " << "entry=" << entry << ",exit=" << exit << ",trigger=" << trigger << endl;
399  tunneling->createTunnel(IPv6Tunneling::NORMAL, entry, exit, trigger);
400  }
401 }
Definition: IPv6Tunneling.h:52
IPv6Route * inet::IPv6RoutingTable::createNewRoute ( IPv6Address  destPrefix,
int  prefixLength,
IRoute::SourceType  src 
)
protectedvirtual

Referenced by addDefaultRoute(), addOrUpdateOnLinkPrefix(), addOrUpdateOwnAdvPrefix(), and addStaticRoute().

58 {
59  return new IPv6Route(destPrefix, prefixLength, src);
60 }
virtual IRoute* inet::IPv6RoutingTable::createRoute ( )
inlineoverridevirtual

Implements inet::IRoutingTable.

407 { return new IPv6Route(IPv6Address(), 0, IRoute::MANUAL); }
manually added static route
Definition: IRoute.h:40
void inet::IPv6RoutingTable::deleteAllRoutes ( )

Deletes all routes from the routing table.

808 {
809  EV_INFO << "/// Removing all routes from rt6 " << endl;
810 
811  for (auto & elem : routeList) {
812  emit(NF_ROUTE_DELETED, elem);
813  delete elem;
814  }
815 
816  routeList.clear();
817  // TODO purge cache?
818 }
simsignal_t NF_ROUTE_DELETED
Definition: NotifierConsts.cc:58
RouteList routeList
Definition: IPv6RoutingTable.h:82
void inet::IPv6RoutingTable::deleteDefaultRoutes ( int  interfaceID)

Deletes the current default routes for the given interface.

Referenced by inet::IPv6NeighbourDiscovery::routersUnreachabilityDetection().

791 {
792  ASSERT(interfaceID >= 0);
793 
794  EV_INFO << "/// Removing default route for interface=" << interfaceID << endl;
795 
796  for (auto it = routeList.begin(); it != routeList.end(); ) {
797  // default routes have prefix length 0
798  if ((*it)->getInterface() && (*it)->getInterface()->getInterfaceId() == interfaceID &&
799  (*it)->getPrefixLength() == 0)
800  it = internalDeleteRoute(it);
801  else
802  ++it;
803  }
804 }
RouteList::iterator internalDeleteRoute(RouteList::iterator it)
Definition: IPv6RoutingTable.cc:729
RouteList routeList
Definition: IPv6RoutingTable.h:82
void inet::IPv6RoutingTable::deleteInterfaceRoutes ( const InterfaceEntry entry)
virtual

Deletes the routes that are using the specified interface.

Referenced by receiveSignal().

852 {
853  bool changed = false;
854 
855  // delete unicast routes using this interface
856  for (auto it = routeList.begin(); it != routeList.end(); ) {
857  IPv6Route *route = *it;
858  if (route->getInterface() == entry) {
859  it = internalDeleteRoute(it);
860  changed = true;
861  }
862  else
863  ++it;
864  }
865 
866  // TODO delete or update multicast routes:
867  // 1. delete routes has entry as parent
868  // 2. remove entry from children list
869 
870  if (changed) {
871  // invalidateCache();
872  }
873 }
RouteList::iterator internalDeleteRoute(RouteList::iterator it)
Definition: IPv6RoutingTable.cc:729
RouteList routeList
Definition: IPv6RoutingTable.h:82
virtual bool inet::IPv6RoutingTable::deleteMulticastRoute ( IMulticastRoute entry)
inlineoverridevirtual

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.

406 { return false; /*TODO: deleteMulticastRoute(entry);*/ }
void inet::IPv6RoutingTable::deleteOnLinkPrefix ( const IPv6Address destPrefix,
int  prefixLength 
)
virtual

Remove an on-link prefix.

To be called when the prefix gets advertised with zero lifetime, or to purge an expired prefix.

NOTE: This method does NOT remove the matching addresses from the IInterfaceTable (see IPv6InterfaceData); that has to be done separately.

Referenced by inet::IPv6NeighbourDiscovery::processRAPrefixInfo(), and inet::IPv6NeighbourDiscovery::timeoutPrefixEntry().

616 {
617  // scan the routing table for this prefix and remove it
618  for (auto it = routeList.begin(); it != routeList.end(); it++) {
619  if ((*it)->getSourceType() == IRoute::ROUTER_ADVERTISEMENT && (*it)->getDestPrefix() == destPrefix && (*it)->getPrefixLength() == prefixLength) {
621  return; // there can be only one such route, addOrUpdateOnLinkPrefix() guarantees that
622  }
623  }
624 }
RouteList::iterator internalDeleteRoute(RouteList::iterator it)
Definition: IPv6RoutingTable.cc:729
on-link prefix, from Router Advertisement
Definition: IRoute.h:42
RouteList routeList
Definition: IPv6RoutingTable.h:82
void inet::IPv6RoutingTable::deletePrefixes ( int  interfaceID)

Deletes all prefixes registered for the given interface.

Referenced by inet::IPv6NeighbourDiscovery::routersUnreachabilityDetection().

822 {
823  ASSERT(interfaceID >= 0);
824 
825  for (auto it = routeList.begin(); it != routeList.end(); ) {
826  // "real" prefixes have a length of larger then 0
827  if ((*it)->getInterface() && (*it)->getInterface()->getInterfaceId() == interfaceID &&
828  (*it)->getPrefixLength() > 0)
829  it = internalDeleteRoute(it);
830  else
831  ++it;
832  }
833 }
RouteList::iterator internalDeleteRoute(RouteList::iterator it)
Definition: IPv6RoutingTable.cc:729
RouteList routeList
Definition: IPv6RoutingTable.h:82
bool inet::IPv6RoutingTable::deleteRoute ( IPv6Route route)
virtual

Deletes the given route from the route table.

Returns true, if it was deleted, false if it was not found in the routing table.

741 {
742  auto it = std::find(routeList.begin(), routeList.end(), route);
743  if (it == routeList.end())
744  return false;
745 
747  return true;
748 }
RouteList::iterator internalDeleteRoute(RouteList::iterator it)
Definition: IPv6RoutingTable.cc:729
RouteList routeList
Definition: IPv6RoutingTable.h:82
std::vector< T >::iterator find(std::vector< T > &v, const T &a)
Definition: stlutils.h:48
virtual bool inet::IPv6RoutingTable::deleteRoute ( IRoute entry)
inlineoverridevirtual

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.

Referenced by deleteRoute().

401 { return deleteRoute(check_and_cast<IPv6Route *>(entry)); }
virtual bool deleteRoute(IPv6Route *route)
Deletes the given route from the route table.
Definition: IPv6RoutingTable.cc:740
const IPv6Route * inet::IPv6RoutingTable::doLongestPrefixMatch ( const IPv6Address dest)

Performs longest prefix match in the routing table and returns the resulting route, or nullptr if there was no match.

Referenced by inet::IPv6NeighbourDiscovery::determineNextHop(), and inet::IPv6::determineOutputInterface().

476 {
477  Enter_Method("doLongestPrefixMatch(%s)", dest.str().c_str());
478 
479  // we'll just stop at the first match, because the table is sorted
480  // by prefix lengths and metric (see addRoute())
481 
482  auto it = routeList.begin();
483  while (it != routeList.end()) {
484  if (dest.matches((*it)->getDestPrefix(), (*it)->getPrefixLength())) {
485  if (simTime() > (*it)->getExpiryTime() && (*it)->getExpiryTime() != 0) { //since 0 represents infinity.
486  if ((*it)->getSourceType() == IRoute::ROUTER_ADVERTISEMENT) {
487  EV_INFO << "Expired prefix detected!!" << endl;
488  it = internalDeleteRoute(it); // TODO update display string
489  }
490  }
491  else
492  return *it;
493  }
494  else
495  ++it;
496  }
497  // FIXME todo: if we selected an expired route, throw it out and select again!
498  return nullptr;
499 }
RouteList::iterator internalDeleteRoute(RouteList::iterator it)
Definition: IPv6RoutingTable.cc:729
on-link prefix, from Router Advertisement
Definition: IRoute.h:42
RouteList routeList
Definition: IPv6RoutingTable.h:82
virtual IMulticastRoute* inet::IPv6RoutingTable::findBestMatchingMulticastRoute ( const L3Address origin,
const L3Address group 
) const
inlineoverridevirtual

Returns route for a multicast origin and group.

Implements inet::IRoutingTable.

397 { return nullptr; /*TODO findBestMatchingMulticastRoute(origin.toIPv6(), group.toIPv6());*/ }
virtual IRoute* inet::IPv6RoutingTable::findBestMatchingRoute ( const L3Address dest) const
inlineoverridevirtual

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.

393 { return const_cast<IPv6Route *>((const_cast<IPv6RoutingTable *>(this))->doLongestPrefixMatch(dest.toIPv6())); } //FIXME what a name??!! also: remove const; ALSO: THIS DOES NOT UPDATE DESTCACHE LIKE METHODS BUILT ON IT!
IPv6RoutingTable()
Definition: IPv6RoutingTable.cc:47
virtual InterfaceEntry* inet::IPv6RoutingTable::findInterfaceByLocalBroadcastAddress ( const L3Address dest) const
inlinevirtual
392 { return nullptr; /*TODO findInterfaceByLocalBroadcastAddress(dest.toIPv6());*/ }
virtual IRoute* inet::IPv6RoutingTable::getDefaultRoute ( ) const
inlineoverridevirtual

Finds and returns the default route, or nullptr if it doesn't exist.

Implements inet::IRoutingTable.

398 { return nullptr; /*TODO getDefaultRoute();*/ }
const IPv6Address & inet::IPv6RoutingTable::getHomeAddress ( )
765 {
766  for (int i = 0; i < ift->getNumInterfaces(); ++i) {
767  InterfaceEntry *ie = ift->getInterface(i);
768 
769  return ie->ipv6Data()->getMNHomeAddress();
770  }
771 
773 }
static const IPv6Address UNSPECIFIED_ADDRESS
The unspecified address.
Definition: IPv6Address.h:66
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
IPv6InterfaceData * ipv6Data() const
Definition: InterfaceEntry.h:223
const IPv6Address & getMNHomeAddress() const
Definition: IPv6InterfaceData.h:775
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
InterfaceEntry * inet::IPv6RoutingTable::getInterfaceByAddress ( const IPv6Address address) const
virtual

Returns an interface given by its address.

Returns nullptr if not found.

Referenced by inet::IPv6::encapsulate(), and getInterfaceByAddress().

404 {
405  Enter_Method("getInterfaceByAddress(%s)=?", addr.str().c_str());
406 
407  if (addr.isUnspecified())
408  return nullptr;
409 
410  for (int i = 0; i < ift->getNumInterfaces(); ++i) {
411  InterfaceEntry *ie = ift->getInterface(i);
412  if (ie->ipv6Data()->hasAddress(addr))
413  return ie;
414  }
415  return nullptr;
416 }
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
InterfaceEntry * inet::IPv6RoutingTable::getInterfaceByAddress ( const L3Address address) const
overridevirtual

Returns an interface given by its address.

Returns nullptr if not found.

Implements inet::IRoutingTable.

419 {
420  return getInterfaceByAddress(address.toIPv6());
421 }
virtual InterfaceEntry * getInterfaceByAddress(const IPv6Address &address) const
Returns an interface given by its address.
Definition: IPv6RoutingTable.cc:403
virtual IMulticastRoute* inet::IPv6RoutingTable::getMulticastRoute ( int  k) const
inlineoverridevirtual

Returns the kth multicast route.

Implements inet::IRoutingTable.

402 { return nullptr; /*TODO*/ }
virtual L3Address inet::IPv6RoutingTable::getNextHopForDestination ( const L3Address dest) const
inlineoverridevirtual

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.

395 { const IPv6Route *e = (const_cast<IPv6RoutingTable *>(this))->doLongestPrefixMatch(dest.toIPv6()); return e ? e->getNextHopAsGeneric() : L3Address(); }
IPv6RoutingTable()
Definition: IPv6RoutingTable.cc:47
const value< double, units::C > e(1.602176487e-19)
virtual int inet::IPv6RoutingTable::getNumMulticastRoutes ( ) const
inlineoverridevirtual

Returns the total number of multicast routes.

Implements inet::IRoutingTable.

403 { return 0; /*TODO getNumMulticastRoutes();*/ }
int inet::IPv6RoutingTable::getNumRoutes ( ) const
overridevirtual

Return the number of routes.

Implements inet::IRoutingTable.

Referenced by refreshDisplay().

751 {
752  return routeList.size();
753 }
RouteList routeList
Definition: IPv6RoutingTable.h:82
virtual InterfaceEntry* inet::IPv6RoutingTable::getOutputInterfaceForDestination ( const L3Address dest) const
inlineoverridevirtual

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.

394 { const IPv6Route *e = (const_cast<IPv6RoutingTable *>(this))->doLongestPrefixMatch(dest.toIPv6()); return e ? e->getInterface() : nullptr; }
IPv6RoutingTable()
Definition: IPv6RoutingTable.cc:47
const value< double, units::C > e(1.602176487e-19)
IPv6Route * inet::IPv6RoutingTable::getRoute ( int  i) const
overridevirtual

Return the ith route.

Implements inet::IRoutingTable.

756 {
757  ASSERT(i >= 0 && i < (int)routeList.size());
758  return routeList[i];
759 }
RouteList routeList
Definition: IPv6RoutingTable.h:82
virtual L3Address inet::IPv6RoutingTable::getRouterIdAsGeneric ( ) const
inlineoverridevirtual

Returns routerId.

Implements inet::IRoutingTable.

388 { return L3Address(IPv6Address()); /*TODO getRouterId();*/ }
void inet::IPv6RoutingTable::handleMessage ( cMessage *  msg)
overrideprotectedvirtual

Raises an error.

170 {
171  throw cRuntimeError("This module doesn't process messages");
172 }
bool inet::IPv6RoutingTable::handleOperationStage ( LifecycleOperation operation,
int  stage,
IDoneCallback doneCallback 
)
overridevirtual

ILifecycle method.

Implements inet::ILifecycle.

876 {
877  Enter_Method_Silent();
878  if (dynamic_cast<NodeStartOperation *>(operation)) {
880  ; // TODO:
881  }
882  else if (dynamic_cast<NodeShutdownOperation *>(operation)) {
884  while (!routeList.empty())
885  delete removeRoute(routeList[0]);
886 
887  }
888  else if (dynamic_cast<NodeCrashOperation *>(operation)) {
890  while (!routeList.empty())
891  delete removeRoute(routeList[0]);
892 
893  }
894  return true;
895 }
Definition: NodeOperations.h:50
virtual IPv6Route * removeRoute(IPv6Route *route)
Removes the given route from the routing table, and returns it.
Definition: IPv6RoutingTable.cc:694
Stage
Definition: NodeOperations.h:71
Stage
Definition: NodeOperations.h:126
RouteList routeList
Definition: IPv6RoutingTable.h:82
Stage
Definition: NodeOperations.h:46
Definition: NodeOperations.h:127
bool inet::IPv6RoutingTable::hasMIPv6Support ( )
inline

Can be used to check whether this node supports MIPv6 or not (MN, MR, HA or CN).

Referenced by inet::IPv6::localDeliver(), inet::IPv6::processExtensionHeaders(), and inet::IPv6NeighbourDiscovery::sendPeriodicRA().

365 { return mipv6Support; }
bool mipv6Support
Definition: IPv6RoutingTable.h:63
void inet::IPv6RoutingTable::initialize ( int  stage)
overrideprotectedvirtual
63 {
64  cSimpleModule::initialize(stage);
65 
66  if (stage == INITSTAGE_LOCAL) {
67  WATCH_PTRVECTOR(routeList);
68  WATCH_MAP(destCache); // FIXME commented out for now
69  isrouter = par("isRouter");
70  multicastForward = par("multicastForwarding");
71  useAdminDist = par("useAdminDist");
72  WATCH(isrouter);
73 
74  ift = getModuleFromPar<IInterfaceTable>(par("interfaceTableModule"), this);
75 
76 #ifdef WITH_xMIPv6
77  // the following MIPv6 related flags will be overridden by the MIPv6 module (if existing)
78  ishome_agent = false;
79  WATCH(ishome_agent);
80 
81  ismobile_node = false;
82  WATCH(ismobile_node);
83 
84  mipv6Support = false; // 4.9.07 - CB
85 #endif /* WITH_xMIPv6 */
86 
87  cModule *host = getContainingNode(this);
88 
89  host->subscribe(NF_INTERFACE_CREATED, this);
90  host->subscribe(NF_INTERFACE_DELETED, this);
91  host->subscribe(NF_INTERFACE_STATE_CHANGED, this);
92  host->subscribe(NF_INTERFACE_CONFIG_CHANGED, this);
93  host->subscribe(NF_INTERFACE_IPv6CONFIG_CHANGED, this);
94  }
95  else if (stage == INITSTAGE_NETWORK_LAYER) {
96  // add IPv6InterfaceData to interfaces
97  for (int i = 0; i < ift->getNumInterfaces(); i++) {
98  InterfaceEntry *ie = ift->getInterface(i);
100  }
101 
103 
104  // skip hosts
105  if (isrouter) {
106  // add globally routable prefixes to routing table
107  for (int x = 0; x < ift->getNumInterfaces(); x++) {
108  InterfaceEntry *ie = ift->getInterface(x);
109 
110  if (ie->isLoopback())
111  continue;
112 
113  for (int y = 0; y < ie->ipv6Data()->getNumAdvPrefixes(); y++)
114  if (ie->ipv6Data()->getAdvPrefix(y).prefix.isGlobal())
115  addOrUpdateOwnAdvPrefix(ie->ipv6Data()->getAdvPrefix(y).prefix,
116  ie->ipv6Data()->getAdvPrefix(y).prefixLength,
117  ie->getInterfaceId(), SIMTIME_ZERO);
118 
119  }
120  }
121  }
122 }
bool mipv6Support
Definition: IPv6RoutingTable.h:63
virtual void addOrUpdateOwnAdvPrefix(const IPv6Address &destPrefix, int prefixLength, int interfaceId, simtime_t expiryTime)
Add route of type OWN_ADV_PREFIX.
Definition: IPv6RoutingTable.cc:581
simsignal_t NF_INTERFACE_CONFIG_CHANGED
Definition: NotifierConsts.cc:51
bool isrouter
Definition: IPv6RoutingTable.h:56
bool useAdminDist
Definition: IPv6RoutingTable.h:58
Initialization of network-layer protocols, stage 1.
Definition: InitStages.h:72
Local initializations.
Definition: InitStages.h:35
simsignal_t NF_INTERFACE_STATE_CHANGED
Definition: NotifierConsts.cc:50
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:65
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
simsignal_t NF_INTERFACE_IPv6CONFIG_CHANGED
Definition: NotifierConsts.cc:54
simsignal_t NF_INTERFACE_CREATED
Definition: NotifierConsts.cc:48
virtual void configureInterfaceForIPv6(InterfaceEntry *ie)
Definition: IPv6RoutingTable.cc:221
bool multicastForward
Definition: IPv6RoutingTable.h:57
RouteList routeList
Definition: IPv6RoutingTable.h:82
DestCache destCache
Definition: IPv6RoutingTable.h:77
bool ishome_agent
Definition: IPv6RoutingTable.h:61
simsignal_t NF_INTERFACE_DELETED
Definition: NotifierConsts.cc:49
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
bool ismobile_node
Definition: IPv6RoutingTable.h:62
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
virtual void parseXMLConfigFile()
Definition: IPv6RoutingTable.cc:124
void inet::IPv6RoutingTable::internalAddRoute ( IPv6Route route)
protected

Referenced by addRoute(), and routeChanged().

706 {
707  ASSERT(route->getRoutingTable() == nullptr);
708 
709  routeList.push_back(route);
710  route->setRoutingTable(this);
711 
712  // we keep entries sorted by prefix length in routeList, so that we can
713  // stop at the first match when doing the longest prefix matching
714  std::stable_sort(routeList.begin(), routeList.end(), RouteLessThan(*this));
715 }
RouteList routeList
Definition: IPv6RoutingTable.h:82
IPv6RoutingTable::RouteList::iterator inet::IPv6RoutingTable::internalDeleteRoute ( RouteList::iterator  it)
protected

Referenced by deleteDefaultRoutes(), deleteInterfaceRoutes(), deleteOnLinkPrefix(), deletePrefixes(), deleteRoute(), and doLongestPrefixMatch().

730 {
731  ASSERT(it != routeList.end());
732  IPv6Route *route = *it;
733  it = routeList.erase(it);
734  emit(NF_ROUTE_DELETED, route);
735  // TODO purge cache?
736  delete route;
737  return it;
738 }
simsignal_t NF_ROUTE_DELETED
Definition: NotifierConsts.cc:58
RouteList routeList
Definition: IPv6RoutingTable.h:82
IPv6Route * inet::IPv6RoutingTable::internalRemoveRoute ( IPv6Route route)
protected

Referenced by removeRoute(), and routeChanged().

718 {
719  auto i = std::find(routeList.begin(), routeList.end(), route);
720  if (i != routeList.end()) {
721  ASSERT(route->getRoutingTable() == this);
722  routeList.erase(i);
723  route->setRoutingTable(nullptr);
724  return route;
725  }
726  return nullptr;
727 }
RouteList routeList
Definition: IPv6RoutingTable.h:82
std::vector< T >::iterator find(std::vector< T > &v, const T &a)
Definition: stlutils.h:48
virtual bool inet::IPv6RoutingTable::isForwardingEnabled ( ) const
inlineoverridevirtual

Forwarding on/off.

Implements inet::IRoutingTable.

386 { return isRouter(); } //XXX inconsistent names
virtual bool isRouter() const
IP forwarding on/off.
Definition: IPv6RoutingTable.h:155
bool inet::IPv6RoutingTable::isHomeAddress ( const IPv6Address addr)

Check whether provided address is a HoA.

Referenced by inet::xMIPv6::processType2RH(), inet::IPv6::routePacket(), and inet::xMIPv6::validateHoTMessage().

777 {
778  // check all interfaces whether they have the
779  // provided address as HoA
780  for (int i = 0; i < ift->getNumInterfaces(); ++i) {
781  InterfaceEntry *ie = ift->getInterface(i);
782  if (ie->ipv6Data()->getMNHomeAddress() == addr)
783  return true;
784  }
785 
786  return false;
787 }
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
bool inet::IPv6RoutingTable::isHomeAgent ( ) const
inline
bool inet::IPv6RoutingTable::isLocalAddress ( const IPv6Address dest) const
virtual

Checks if the address is one of the host's addresses, i.e.

assigned to one of its interfaces (tentatively or not).

Referenced by inet::IPv6Tunneling::createTunnel(), inet::IPv6::handleMessageFromHL(), inet::IPv6NeighbourDiscovery::processNSForTentativeAddress(), inet::IPv6::routeMulticastPacket(), and inet::IPv6::routePacket().

424 {
425  Enter_Method("isLocalAddress(%s) y/n", dest.str().c_str());
426 
427  // first, check if we have an interface with this address
428  for (int i = 0; i < ift->getNumInterfaces(); i++) {
429  InterfaceEntry *ie = ift->getInterface(i);
430  if (ie->ipv6Data()->hasAddress(dest))
431  return true;
432  }
433 
434  // then check for special, preassigned multicast addresses
435  // (these addresses occur more rarely than specific interface addresses,
436  // that's why we check for them last)
437 
438  if (dest == IPv6Address::ALL_NODES_1 || dest == IPv6Address::ALL_NODES_2)
439  return true;
440 
442  return true;
443 
444  // check for solicited-node multicast address
445  if (dest.matches(IPv6Address::SOLICITED_NODE_PREFIX, 104)) {
446  for (int i = 0; i < ift->getNumInterfaces(); i++) {
447  InterfaceEntry *ie = ift->getInterface(i);
448  if (ie->ipv6Data()->matchesSolicitedNodeMulticastAddress(dest))
449  return true;
450  }
451  }
452  return false;
453 }
static const IPv6Address SOLICITED_NODE_PREFIX
The solicited-node multicast address prefix (prefix length = 104)
Definition: IPv6Address.h:87
virtual bool isRouter() const
IP forwarding on/off.
Definition: IPv6RoutingTable.h:155
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
static const IPv6Address ALL_NODES_1
All-nodes multicast address, scope 1 (interface-local)
Definition: IPv6Address.h:72
static const IPv6Address ALL_ROUTERS_1
All-routers multicast address, scope 1 (interface-local)
Definition: IPv6Address.h:78
static const IPv6Address ALL_NODES_2
All-nodes multicast address, scope 2 (link-local)
Definition: IPv6Address.h:75
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
static const IPv6Address ALL_ROUTERS_2
All-routers multicast address, scope 2 (link-local)
Definition: IPv6Address.h:81
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
static const IPv6Address ALL_ROUTERS_5
All-routers multicast address, scope 5 (site-local)
Definition: IPv6Address.h:84
virtual bool inet::IPv6RoutingTable::isLocalAddress ( const L3Address dest) const
inlineoverridevirtual

Checks if the address is a local one, i.e.

one of the host's.

Implements inet::IRoutingTable.

Referenced by isLocalAddress().

389 { return isLocalAddress(dest.toIPv6()); }
virtual bool isLocalAddress(const IPv6Address &dest) const
Checks if the address is one of the host&#39;s addresses, i.e.
Definition: IPv6RoutingTable.cc:423
virtual bool inet::IPv6RoutingTable::isLocalBroadcastAddress ( const L3Address dest) const
inlinevirtual
390 { return false; /*TODO isLocalBroadcastAddress(dest.toIPv6());*/ }
virtual bool inet::IPv6RoutingTable::isLocalMulticastAddress ( const L3Address dest) const
inlineoverridevirtual

Checks if the address is in one of the local multicast group address list.

Implements inet::IRoutingTable.

396 { return false; /*TODO isLocalMulticastAddress(dest.toIPv6());*/ }
virtual bool inet::IPv6RoutingTable::isMulticastForwardingEnabled ( )
inlinevirtual
157 { return multicastForward; }
bool multicastForward
Definition: IPv6RoutingTable.h:57
virtual bool inet::IPv6RoutingTable::isMulticastForwardingEnabled ( ) const
inlineoverridevirtual

Multicast forwarding on/off.

Implements inet::IRoutingTable.

387 { return true; /*TODO isMulticastForwardingEnabled();*/ }
bool inet::IPv6RoutingTable::isOnLinkAddress ( const IPv6Address address)

Checks whether the provided address is in an on-link address with respect to the prefix advertisement list.

Referenced by inet::xMIPv6::processBUMessage().

836 {
837  for (int j = 0; j < ift->getNumInterfaces(); j++) {
838  InterfaceEntry *ie = ift->getInterface(j);
839 
840  for (int i = 0; i < ie->ipv6Data()->getNumAdvPrefixes(); i++)
841  if (address.matches(ie->ipv6Data()->getAdvPrefix(i).prefix, ie->ipv6Data()->getAdvPrefix(i).prefixLength))
842  return true;
843 
844  }
845 
846  return false;
847 }
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
bool inet::IPv6RoutingTable::isPrefixPresent ( const IPv6Address prefix) const
virtual

Checks if the given prefix already exists in the routing table (prefix list)

Referenced by inet::IPv6NeighbourDiscovery::processRAPrefixInfo().

502 {
503  for (const auto & elem : routeList)
504  if (prefix.matches((elem)->getDestPrefix(), 128))
505  return true;
506 
507  return false;
508 }
RouteList routeList
Definition: IPv6RoutingTable.h:82
const IPv6Address & inet::IPv6RoutingTable::lookupDestCache ( const IPv6Address dest,
int &  outInterfaceId 
)

Looks up the given destination address in the Destination Cache, then returns the next-hop address and the interface in the outInterfaceId variable.

If the destination is not in the cache, outInterfaceId is set to -1 and the unspecified address is returned. The caller should check for interfaceId==-1, because unspecified address is also returned if the link layer doesn't use addresses at all (e.g. PPP).

NOTE: outInterfaceId is an OUTPUT parameter – its initial value is ignored, and the lookupDestCache() sets it to the correct value instead.

Referenced by inet::IPv6::determineOutputInterface(), and inet::IPv6Tunneling::encapsulateDatagram().

456 {
457  Enter_Method("lookupDestCache(%s)", dest.str().c_str());
458 
459  auto it = destCache.find(dest);
460  if (it == destCache.end()) {
461  outInterfaceId = -1;
463  }
464  DestCacheEntry& entry = it->second;
465  if (entry.expiryTime > 0 && simTime() > entry.expiryTime) {
466  destCache.erase(it);
467  outInterfaceId = -1;
469  }
470 
471  outInterfaceId = entry.interfaceId;
472  return entry.nextHopAddr;
473 }
static const IPv6Address UNSPECIFIED_ADDRESS
The unspecified address.
Definition: IPv6Address.h:66
DestCache destCache
Definition: IPv6RoutingTable.h:77
virtual int inet::IPv6RoutingTable::numInitStages ( ) const
inlineoverrideprotectedvirtual
128 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::IPv6RoutingTable::parseXMLConfigFile ( )
protectedvirtual

Referenced by initialize().

125 {
126  cModule *host = getContainingNode(this);
127 
128  // configure interfaces from XML config file
129  cXMLElement *config = par("routes");
130  for (cXMLElement *child = config->getFirstChild(); child; child = child->getNextSibling()) {
131  //std::cout << "configuring interfaces from XML file." << endl;
132  //std::cout << "selected element is: " << child->getTagName() << endl;
133  // we ensure that the selected element is local.
134  if (opp_strcmp(child->getTagName(), "local") != 0)
135  continue;
136  //ensure that this is the right parent module we are configuring.
137  if (opp_strcmp(child->getAttribute("node"), host->getFullName()) != 0)
138  continue;
139  //Go one level deeper.
140  //child = child->getFirstChild();
141  for (cXMLElement *ifTag = child->getFirstChild(); ifTag; ifTag = ifTag->getNextSibling()) {
142  //The next tag should be "interface".
143  if (opp_strcmp(ifTag->getTagName(), "interface") == 0) {
144  //std::cout << "Getting attribute: name" << endl;
145  const char *ifname = ifTag->getAttribute("name");
146  if (!ifname)
147  throw cRuntimeError("<interface> without name attribute at %s", child->getSourceLocation());
148 
149  InterfaceEntry *ie = ift->getInterfaceByName(ifname);
150  if (!ie)
151  throw cRuntimeError("no interface named %s was registered, %s", ifname, child->getSourceLocation());
152 
153  configureInterfaceFromXML(ie, ifTag);
154  }
155  else if (opp_strcmp(ifTag->getTagName(), "tunnel") == 0)
156  configureTunnelFromXML(ifTag);
157  }
158  }
159 }
virtual InterfaceEntry * getInterfaceByName(const char *name) const =0
Returns an interface given by its name.
virtual void configureTunnelFromXML(cXMLElement *cfg)
Definition: IPv6RoutingTable.cc:376
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:65
virtual void configureInterfaceFromXML(InterfaceEntry *ie, cXMLElement *cfg)
Definition: IPv6RoutingTable.cc:313
IInterfaceTable * ift
Definition: IPv6RoutingTable.h:54
void inet::IPv6RoutingTable::printRoutingTable ( ) const
overridevirtual

Prints the routing table.

Implements inet::IRoutingTable.

898 {
899  for (const auto & elem : routeList)
900  EV_INFO << (elem)->getInterface()->getFullPath() << " -> " << (elem)->getDestinationAsGeneric().str() << " as " << (elem)->info() << endl;
901 }
RouteList routeList
Definition: IPv6RoutingTable.h:82
void inet::IPv6RoutingTable::purgeDestCache ( )
virtual

Discard all entries in destination cache.

Referenced by addRoute().

519 {
520  destCache.clear();
521 }
DestCache destCache
Definition: IPv6RoutingTable.h:77
void inet::IPv6RoutingTable::purgeDestCacheEntriesToNeighbour ( const IPv6Address nextHopAddr,
int  interfaceId 
)
virtual

Discard all entries in destination cache where next hop is the given address on the given interface.

This is typically called when a router becomes unreachable, and all destinations going via that router have to go though router selection again.

Referenced by inet::IPv6NeighbourDiscovery::timeoutDefaultRouter().

524 {
525  for (auto it = destCache.begin(); it != destCache.end(); ) {
526  if (it->second.interfaceId == interfaceId && it->second.nextHopAddr == nextHopAddr) {
527  // move the iterator past this element before removing it
528  destCache.erase(it++);
529  }
530  else {
531  it++;
532  }
533  }
534 }
DestCache destCache
Definition: IPv6RoutingTable.h:77
void inet::IPv6RoutingTable::purgeDestCacheForInterfaceID ( int  interfaceId)

Removes all destination cache entries for the specified interface.

Referenced by receiveSignal().

537 {
538  for (auto it = destCache.begin(); it != destCache.end(); ) {
539  if (it->second.interfaceId == interfaceId) {
540  // move the iterator past this element before removing it
541  destCache.erase(it++);
542  }
543  else {
544  ++it;
545  }
546  }
547 }
DestCache destCache
Definition: IPv6RoutingTable.h:77
void inet::IPv6RoutingTable::receiveSignal ( cComponent *  source,
simsignal_t  signalID,
cObject *  obj,
cObject *  details 
)
overrideprotectedvirtual

Called by the signal handler whenever a change of a category occurs to which this client has subscribed.

175 {
176  if (getSimulation()->getContextType() == CTX_INITIALIZE)
177  return; // ignore notifications during initialize
178 
179  Enter_Method_Silent();
180  printNotificationBanner(signalID, obj);
181 
182  if (signalID == NF_INTERFACE_CREATED) {
183  //TODO something like this:
184  //InterfaceEntry *ie = check_and_cast<InterfaceEntry*>(details);
185  //configureInterfaceForIPv6(ie);
186  }
187  else if (signalID == NF_INTERFACE_DELETED) {
188  // remove all routes that point to that interface
189  const InterfaceEntry *entry = check_and_cast<const InterfaceEntry *>(obj);
190  deleteInterfaceRoutes(entry);
191  }
192  else if (signalID == NF_INTERFACE_STATE_CHANGED) {
193  const InterfaceEntry *interfaceEntry = check_and_cast<const InterfaceEntryChangeDetails*>(obj)->getInterfaceEntry();
194  int interfaceEntryId = interfaceEntry->getInterfaceId();
195 
196  // an interface went down
197  if (!interfaceEntry->isUp()) {
198  purgeDestCacheForInterfaceID(interfaceEntryId);
199  }
200  }
201  else if (signalID == NF_INTERFACE_CONFIG_CHANGED) {
202  //TODO invalidate routing cache (?)
203  }
204  else if (signalID == NF_INTERFACE_IPv6CONFIG_CHANGED) {
205  //TODO
206  }
207 }
virtual void deleteInterfaceRoutes(const InterfaceEntry *entry)
Deletes the routes that are using the specified interface.
Definition: IPv6RoutingTable.cc:851
void purgeDestCacheForInterfaceID(int interfaceId)
Removes all destination cache entries for the specified interface.
Definition: IPv6RoutingTable.cc:536
simsignal_t NF_INTERFACE_CONFIG_CHANGED
Definition: NotifierConsts.cc:51
simsignal_t NF_INTERFACE_STATE_CHANGED
Definition: NotifierConsts.cc:50
simsignal_t NF_INTERFACE_IPv6CONFIG_CHANGED
Definition: NotifierConsts.cc:54
simsignal_t NF_INTERFACE_CREATED
Definition: NotifierConsts.cc:48
void printNotificationBanner(simsignal_t signalID, const cObject *obj)
Utility function.
Definition: NotifierConsts.cc:109
simsignal_t NF_INTERFACE_DELETED
Definition: NotifierConsts.cc:49
void inet::IPv6RoutingTable::refreshDisplay ( ) const
overrideprotectedvirtual
162 {
163  std::stringstream os;
164 
165  os << getNumRoutes() << " routes\n" << destCache.size() << " destcache entries";
166  getDisplayString().setTagArg("t", 0, os.str().c_str());
167 }
DestCache destCache
Definition: IPv6RoutingTable.h:77
virtual int getNumRoutes() const override
Return the number of routes.
Definition: IPv6RoutingTable.cc:750
virtual IMulticastRoute* inet::IPv6RoutingTable::removeMulticastRoute ( IMulticastRoute entry)
inlineoverridevirtual

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.

405 { /*TODO removeMulticastRoute(entry);*/ return entry; }
IPv6Route * inet::IPv6RoutingTable::removeRoute ( IPv6Route route)
virtual

Removes the given route from the routing table, and returns it.

nullptr is returned if the route was not in the routing table.

Referenced by handleOperationStage().

695 {
696  route = internalRemoveRoute(route);
697  if (route) {
698  // TODO purge cache?
699 
700  emit(NF_ROUTE_DELETED, route); // rather: going to be deleted
701  }
702  return route;
703 }
simsignal_t NF_ROUTE_DELETED
Definition: NotifierConsts.cc:58
IPv6Route * internalRemoveRoute(IPv6Route *route)
Definition: IPv6RoutingTable.cc:717
virtual IRoute* inet::IPv6RoutingTable::removeRoute ( IRoute entry)
inlineoverridevirtual

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 removeRoute().

400 { return removeRoute(check_and_cast<IPv6Route *>(entry)); }
virtual IPv6Route * removeRoute(IPv6Route *route)
Removes the given route from the routing table, and returns it.
Definition: IPv6RoutingTable.cc:694
void inet::IPv6RoutingTable::routeChanged ( IPv6Route entry,
int  fieldCode 
)
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::IPv6Route::changed().

210 {
211  if (fieldCode == IPv6Route::F_DESTINATION || fieldCode == IPv6Route::F_PREFIX_LENGTH || fieldCode == IPv6Route::F_METRIC) { // our data structures depend on these fields
212  entry = internalRemoveRoute(entry);
213  ASSERT(entry != nullptr); // failure means inconsistency: route was not found in this routing table
214  internalAddRoute(entry);
215 
216  // invalidateCache();
217  }
218  emit(NF_ROUTE_CHANGED, entry); // TODO include fieldCode in the notification
219 }
Definition: IRoute.h:64
void internalAddRoute(IPv6Route *route)
Definition: IPv6RoutingTable.cc:705
IPv6Route * internalRemoveRoute(IPv6Route *route)
Definition: IPv6RoutingTable.cc:717
Definition: IRoute.h:57
simsignal_t NF_ROUTE_CHANGED
Definition: NotifierConsts.cc:59
Definition: IRoute.h:58
bool inet::IPv6RoutingTable::routeLessThan ( const IPv6Route a,
const IPv6Route b 
) const
protected

Referenced by inet::IPv6RoutingTable::RouteLessThan::operator()().

668 {
669  // helper for sort() in addRoute(). We want routes with longer
670  // prefixes to be at front, so we compare them as "less".
671  // For metric, a smaller value is better (we report that as "less").
672  if (a->getPrefixLength() != b->getPrefixLength())
673  return a->getPrefixLength() > b->getPrefixLength();
674 
675  // smaller administrative distance is better
676  if (useAdminDist && (a->getAdminDist() != b->getAdminDist()))
677  return a->getAdminDist() < b->getAdminDist();
678 
679  // smaller metric is better
680  return a->getMetric() < b->getMetric();
681 }
bool useAdminDist
Definition: IPv6RoutingTable.h:58
value< double, units::m > b
Definition: Units.h:1054
void inet::IPv6RoutingTable::setIsHomeAgent ( bool  value)
inline

Define whether normal Router or Home Agent.

Referenced by inet::xMIPv6::initialize().

175 { ishome_agent = value; }
bool ishome_agent
Definition: IPv6RoutingTable.h:61
void inet::IPv6RoutingTable::setIsMobileNode ( bool  value)
inline

Define whether a node is a Mobile Node or Correspondent Node: MN if TRUE or else a CN.

Referenced by inet::xMIPv6::initialize().

187 { ismobile_node = value; }
bool ismobile_node
Definition: IPv6RoutingTable.h:62
void inet::IPv6RoutingTable::setMIPv6Support ( bool  value)
inline

This method is used to define whether the node support MIPv6 or not (MN, MR, HA or CN).

Referenced by inet::xMIPv6::initialize().

371 { mipv6Support = value; }
bool mipv6Support
Definition: IPv6RoutingTable.h:63
void inet::IPv6RoutingTable::updateDestCache ( const IPv6Address dest,
const IPv6Address nextHopAddr,
int  interfaceId,
simtime_t  expiryTime 
)
virtual

Add or update a destination cache entry.

Referenced by inet::IPv6NeighbourDiscovery::determineNextHop(), and inet::IPv6::determineOutputInterface().

511 {
512  DestCacheEntry& entry = destCache[dest];
513  entry.nextHopAddr = nextHopAddr;
514  entry.interfaceId = interfaceId;
515  entry.expiryTime = expiryTime;
516 }
DestCache destCache
Definition: IPv6RoutingTable.h:77

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const DestCacheEntry e 
)
friend
42 {
43  os << "if=" << e.interfaceId << " " << e.nextHopAddr; //FIXME try printing interface name
44  return os;
45 };
const value< double, units::C > e(1.602176487e-19)

Member Data Documentation

bool inet::IPv6RoutingTable::ishome_agent = false
protected

Referenced by initialize().

bool inet::IPv6RoutingTable::ismobile_node = false
protected

Referenced by initialize().

bool inet::IPv6RoutingTable::isrouter = false
protected
bool inet::IPv6RoutingTable::mipv6Support = false
protected

Referenced by initialize().

bool inet::IPv6RoutingTable::multicastForward = false
protected

Referenced by initialize().

bool inet::IPv6RoutingTable::useAdminDist = false
protected

Referenced by initialize(), and routeLessThan().


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