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

Represents a route in the route table. More...

#include <Ipv6Route.h>

Inheritance diagram for inet::Ipv6Route:
inet::IRoute inet::ospfv3::Ospfv3RoutingTableEntry

Public Types

enum  RouteAdminDist {
  dDirectlyConnected = 0, dStatic = 1, dEIGRPSummary = 5, dBGPExternal = 20,
  dEIGRPInternal = 90, dIGRP = 100, dOSPF = 110, dISIS = 115,
  dRIP = 120, dEGP = 140, dODR = 160, dEIGRPExternal = 170,
  dBGPInternal = 200, dDHCPlearned = 254, dBABEL = 125, dLISP = 210,
  dUnknown = 255
}
 Cisco like administrative distances (includes Ipv4 protocols) More...
 
- Public Types inherited from inet::IRoute
enum  SourceType {
  MANUAL, IFACENETMASK, ROUTER_ADVERTISEMENT, OWN_ADV_PREFIX,
  ICMP_REDIRECT, RIP, OSPF, BGP,
  ZEBRA, MANET, MANET2, DYMO,
  AODV, EIGRP, LISP, BABEL,
  ODR, UNKNOWN, ISIS
}
 Specifies where the route comes from. More...
 
enum  ChangeCodes {
  F_DESTINATION, F_PREFIX_LENGTH, F_NEXTHOP, F_IFACE,
  F_SOURCE, F_TYPE, F_ADMINDIST, F_METRIC,
  F_EXPIRYTIME, F_LAST
}
 Field codes for NB_ROUTE_CHANGED notifications. More...
 
enum  RouteAdminDist {
  dDirectlyConnected = 0, dStatic = 1, dEIGRPSummary = 5, dBGPExternal = 20,
  dEIGRPInternal = 90, dIGRP = 100, dOSPF = 110, dISIS = 115,
  dRIP = 120, dEGP = 140, dODR = 160, dEIGRPExternal = 170,
  dBGPInternal = 200, dDHCPlearned = 254, dBABEL = 125, dLISP = 210,
  dUnknown = 255
}
 Cisco like administrative distances. More...
 

Public Member Functions

 Ipv6Route (Ipv6Address destPrefix, int prefixLength, SourceType sourceType)
 Constructor. More...
 
virtual ~Ipv6Route ()
 
virtual std::string str () const override
 
virtual std::string detailedInfo () const
 
virtual void setRoutingTable (Ipv6RoutingTable *rt)
 To be called by the routing table when this route is added or removed from it. More...
 
Ipv6RoutingTablegetRoutingTable () const
 
void setNextHop (const Ipv6Address &nextHop)
 
void setExpiryTime (simtime_t expiryTime)
 
void setMetric (int metric) override
 
void setAdminDist (unsigned int adminDist) override
 
const Ipv6AddressgetDestPrefix () const
 
virtual int getPrefixLength () const override
 Represents length of prefix to match. More...
 
virtual SourceType getSourceType () const override
 Source type of the route. More...
 
const Ipv6AddressgetNextHop () const
 
simtime_t getExpiryTime () const
 
virtual int getMetric () const override
 Cost to reach the destination. More...
 
unsigned int getAdminDist () const
 
virtual IRoutingTablegetRoutingTableAsGeneric () const override
 The routing table in which this route is inserted, or nullptr. More...
 
virtual void setDestination (const L3Address &dest) override
 
virtual void setPrefixLength (int prefixLength) override
 
virtual void setNextHop (const L3Address &nextHop) override
 
virtual void setSource (cObject *source) override
 
virtual void setSourceType (SourceType type) override
 
const char * getSourceTypeAbbreviation () const
 
virtual L3Address getDestinationAsGeneric () const override
 Destination address prefix to match. More...
 
virtual L3Address getNextHopAsGeneric () const override
 Next hop address. More...
 
virtual NetworkInterfacegetInterface () const override
 Next hop interface. More...
 
virtual void setInterface (NetworkInterface *ie) override
 
virtual cObject * getSource () const override
 Source of route. More...
 
virtual cObject * getProtocolData () const override
 
virtual void setProtocolData (cObject *protocolData) override
 
- Public Member Functions inherited from inet::IRoute
virtual ~IRoute ()
 

Protected Member Functions

void changed (int fieldCode)
 Routing Protocol specific data. More...
 

Protected Attributes

Ipv6RoutingTable_rt
 
Ipv6Address _destPrefix
 
short _prefixLength
 
SourceType _sourceType
 
NetworkInterface_interfacePtr
 
Ipv6Address _nextHop
 
simtime_t _expiryTime
 
int _metric
 
unsigned int _adminDist
 
cObject * _source
 
cObject * _protocolData
 Object identifying the source. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from inet::IRoute
static const char * sourceTypeName (SourceType sourceType)
 

Detailed Description

Represents a route in the route table.

Routes with sourceType=ROUTER_ADVERTISEMENT represent on-link prefixes advertised by routers.

Member Enumeration Documentation

◆ RouteAdminDist

Cisco like administrative distances (includes Ipv4 protocols)

Enumerator
dDirectlyConnected 
dStatic 
dEIGRPSummary 
dBGPExternal 
dEIGRPInternal 
dIGRP 
dOSPF 
dISIS 
dRIP 
dEGP 
dODR 
dEIGRPExternal 
dBGPInternal 
dDHCPlearned 
dBABEL 
dLISP 
dUnknown 
29  {
31  dStatic = 1,
32  dEIGRPSummary = 5,
33  dBGPExternal = 20,
34  dEIGRPInternal = 90,
35  dIGRP = 100,
36  dOSPF = 110,
37  dISIS = 115,
38  dRIP = 120,
39  dEGP = 140,
40  dODR = 160,
41  dEIGRPExternal = 170,
42  dBGPInternal = 200,
43  dDHCPlearned = 254,
44  dBABEL = 125,
45  dLISP = 210,
46  dUnknown = 255
47  };

Constructor & Destructor Documentation

◆ Ipv6Route()

inet::Ipv6Route::Ipv6Route ( Ipv6Address  destPrefix,
int  prefixLength,
SourceType  sourceType 
)
inline

Constructor.

The destination prefix and the route source is passed to the constructor and cannot be changed afterwards.

71  {
72  _rt = nullptr;
73  _destPrefix = destPrefix;
74  _prefixLength = prefixLength;
75  _sourceType = sourceType;
76  _interfacePtr = nullptr;
77  _expiryTime = 0;
78  _metric = 0;
80  _source = nullptr;
81  _protocolData = nullptr;
82  }

◆ ~Ipv6Route()

virtual inet::Ipv6Route::~Ipv6Route ( )
inlinevirtual
84 { delete _protocolData; }

Member Function Documentation

◆ changed()

void inet::Ipv6Route::changed ( int  fieldCode)
protected

Routing Protocol specific data.

70 {
71  if (_rt)
72  _rt->routeChanged(this, fieldCode);
73 }

◆ detailedInfo()

std::string inet::Ipv6Route::detailedInfo ( ) const
virtual
65 {
66  return std::string();
67 }

◆ getAdminDist()

◆ getDestinationAsGeneric()

virtual L3Address inet::Ipv6Route::getDestinationAsGeneric ( ) const
inlineoverridevirtual

Destination address prefix to match.

Implements inet::IRoute.

113 { return getDestPrefix(); } // TODO rename Ipv6 method

Referenced by inet::ospfv3::operator<<(), inet::ospfv3::Ospfv3RoutingTableEntry::operator==(), and inet::ospfv3::Ospfv3RoutingTableEntry::Ospfv3RoutingTableEntry().

◆ getDestPrefix()

◆ getExpiryTime()

simtime_t inet::Ipv6Route::getExpiryTime ( ) const
inline

◆ getInterface()

◆ getMetric()

virtual int inet::Ipv6Route::getMetric ( ) const
inlineoverridevirtual

◆ getNextHop()

◆ getNextHopAsGeneric()

virtual L3Address inet::Ipv6Route::getNextHopAsGeneric ( ) const
inlineoverridevirtual

Next hop address.

Implements inet::IRoute.

114 { return getNextHop(); }

◆ getPrefixLength()

◆ getProtocolData()

virtual cObject* inet::Ipv6Route::getProtocolData ( ) const
inlineoverridevirtual

Implements inet::IRoute.

118 { return _protocolData; }

◆ getRoutingTable()

Ipv6RoutingTable* inet::Ipv6Route::getRoutingTable ( ) const
inline

◆ getRoutingTableAsGeneric()

IRoutingTable * inet::Ipv6Route::getRoutingTableAsGeneric ( ) const
overridevirtual

The routing table in which this route is inserted, or nullptr.

Implements inet::IRoute.

76 {
77  return getRoutingTable();
78 }

◆ getSource()

virtual cObject* inet::Ipv6Route::getSource ( ) const
inlineoverridevirtual

Source of route.

Implements inet::IRoute.

117 { return _source; }

◆ getSourceType()

◆ getSourceTypeAbbreviation()

const char * inet::Ipv6Route::getSourceTypeAbbreviation ( ) const
16  {
17  switch (_sourceType) {
18  case IFACENETMASK:
19  return "C";
20  case MANUAL:
21  return getDestPrefix().isUnspecified() ? "S*" : "S";
23  return "ra";
24  case RIP:
25  return "R";
26  case OSPF:
27  return "O";
28  case BGP:
29  return "B";
30  case EIGRP:
31  return getAdminDist() < Ipv6Route::dEIGRPExternal ? "D" : "D EX";
32  case LISP:
33  return "l";
34  case BABEL:
35  return "ba";
36  case ODR:
37  return "o";
38  default:
39  return "???";
40  }
41 }

Referenced by str().

◆ setAdminDist()

◆ setDestination()

virtual void inet::Ipv6Route::setDestination ( const L3Address dest)
inlineoverridevirtual

Implements inet::IRoute.

107 { if (_destPrefix != dest.toIpv6()) { _destPrefix = dest.toIpv6(); changed(F_DESTINATION); } }

Referenced by inet::ospfv3::Ospfv3RoutingTableEntry::Ospfv3RoutingTableEntry().

◆ setExpiryTime()

◆ setInterface()

◆ setMetric()

◆ setNextHop() [1/2]

◆ setNextHop() [2/2]

virtual void inet::Ipv6Route::setNextHop ( const L3Address nextHop)
inlineoverridevirtual

Implements inet::IRoute.

109 { if (_nextHop != nextHop.toIpv6()) { _nextHop = nextHop.toIpv6(); changed(F_NEXTHOP); } }

◆ setPrefixLength()

virtual void inet::Ipv6Route::setPrefixLength ( int  prefixLength)
inlineoverridevirtual

Implements inet::IRoute.

108 { if (_prefixLength != prefixLength) { _prefixLength = prefixLength; changed(F_PREFIX_LENGTH); } }

Referenced by inet::ospfv3::Ospfv3RoutingTableEntry::Ospfv3RoutingTableEntry().

◆ setProtocolData()

virtual void inet::Ipv6Route::setProtocolData ( cObject *  protocolData)
inlineoverridevirtual

Implements inet::IRoute.

119 { _protocolData = protocolData; }

◆ setRoutingTable()

virtual void inet::Ipv6Route::setRoutingTable ( Ipv6RoutingTable rt)
inlinevirtual

To be called by the routing table when this route is added or removed from it.

90 { _rt = rt; }

Referenced by inet::Ipv6RoutingTable::internalAddRoute(), and inet::Ipv6RoutingTable::internalRemoveRoute().

◆ setSource()

virtual void inet::Ipv6Route::setSource ( cObject *  source)
inlineoverridevirtual

Implements inet::IRoute.

110 { if (_source != source) { _source = source; changed(F_SOURCE); } }

◆ setSourceType()

virtual void inet::Ipv6Route::setSourceType ( SourceType  type)
inlineoverridevirtual

◆ str()

std::string inet::Ipv6Route::str ( ) const
overridevirtual
44 {
45  std::stringstream out;
47  if (getDestPrefix().isUnspecified())
48  out << " ::";
49  else
50  out << " " << getDestPrefix();
51  out << "/" << getPrefixLength();
52  if (getNextHop().isUnspecified()) {
53  out << " is directly connected";
54  }
55  else {
56  out << " [" << getAdminDist() << "/" << getMetric() << "]";
57  out << " via ";
58  out << getNextHop();
59  }
60  out << ", " << getInterface()->getInterfaceName();
61  return out.str();
62 }

Member Data Documentation

◆ _adminDist

unsigned int inet::Ipv6Route::_adminDist
protected

◆ _destPrefix

Ipv6Address inet::Ipv6Route::_destPrefix
protected

◆ _expiryTime

simtime_t inet::Ipv6Route::_expiryTime
protected

◆ _interfacePtr

NetworkInterface* inet::Ipv6Route::_interfacePtr
protected

◆ _metric

int inet::Ipv6Route::_metric
protected

◆ _nextHop

Ipv6Address inet::Ipv6Route::_nextHop
protected

◆ _prefixLength

short inet::Ipv6Route::_prefixLength
protected

◆ _protocolData

cObject* inet::Ipv6Route::_protocolData
protected

Object identifying the source.

◆ _rt

Ipv6RoutingTable* inet::Ipv6Route::_rt
protected

Referenced by changed().

◆ _source

cObject* inet::Ipv6Route::_source
protected

◆ _sourceType

SourceType inet::Ipv6Route::_sourceType
protected

The documentation for this class was generated from the following files:
inet::IRoute::F_IFACE
@ F_IFACE
Definition: IRoute.h:50
inet::Ipv6Route::dRIP
@ dRIP
Definition: Ipv6Route.h:38
inet::Ipv6Route::_metric
int _metric
Definition: Ipv6Route.h:57
inet::IRoute::ODR
@ ODR
Definition: IRoute.h:42
inet::Ipv6Route::dStatic
@ dStatic
Definition: Ipv6Route.h:31
inet::IRoute::F_DESTINATION
@ F_DESTINATION
Definition: IRoute.h:47
inet::Ipv6Route::getAdminDist
unsigned int getAdminDist() const
Definition: Ipv6Route.h:104
inet::IRoute::RIP
@ RIP
managed by the given routing protocol
Definition: IRoute.h:34
inet::Ipv6Route::getPrefixLength
virtual int getPrefixLength() const override
Represents length of prefix to match.
Definition: Ipv6Route.h:99
inet::Ipv6Route::getMetric
virtual int getMetric() const override
Cost to reach the destination.
Definition: Ipv6Route.h:103
inet::IRoute::MANUAL
@ MANUAL
manually added static route
Definition: IRoute.h:29
inet::Ipv6Route::dDirectlyConnected
@ dDirectlyConnected
Definition: Ipv6Route.h:30
inet::Ipv6RoutingTable::routeChanged
virtual void routeChanged(Ipv6Route *entry, int fieldCode)
To be called from route objects whenever a field changes.
Definition: Ipv6RoutingTable.cc:203
inet::Ipv6Route::dBABEL
@ dBABEL
Definition: Ipv6Route.h:44
inet::Ipv6Route::getInterface
virtual NetworkInterface * getInterface() const override
Next hop interface.
Definition: Ipv6Route.h:115
inet::IRoute::LISP
@ LISP
Definition: IRoute.h:42
inet::IRoute::ROUTER_ADVERTISEMENT
@ ROUTER_ADVERTISEMENT
on-link prefix, from Router Advertisement
Definition: IRoute.h:31
inet::Ipv6Route::_sourceType
SourceType _sourceType
Definition: Ipv6Route.h:53
inet::Ipv6Route::dEIGRPExternal
@ dEIGRPExternal
Definition: Ipv6Route.h:41
inet::NetworkInterface::getInterfaceName
const char * getInterfaceName() const
Definition: NetworkInterface.h:233
inet::IRoute::EIGRP
@ EIGRP
Definition: IRoute.h:42
inet::IRoute::BGP
@ BGP
managed by the given routing protocol
Definition: IRoute.h:36
inet::Ipv6Route::dOSPF
@ dOSPF
Definition: Ipv6Route.h:36
inet::Ipv6Route::getSourceTypeAbbreviation
const char * getSourceTypeAbbreviation() const
Definition: Ipv6Route.cc:16
inet::IRoute::F_EXPIRYTIME
@ F_EXPIRYTIME
Definition: IRoute.h:55
inet::Ipv6Route::dODR
@ dODR
Definition: Ipv6Route.h:40
inet::Ipv6Route::_protocolData
cObject * _protocolData
Object identifying the source.
Definition: Ipv6Route.h:60
inet::IRoute::F_SOURCE
@ F_SOURCE
Definition: IRoute.h:51
inet::Ipv6Route::getRoutingTable
Ipv6RoutingTable * getRoutingTable() const
Definition: Ipv6Route.h:91
inet::Ipv6Route::dEIGRPSummary
@ dEIGRPSummary
Definition: Ipv6Route.h:32
inet::IRoute::OSPF
@ OSPF
managed by the given routing protocol
Definition: IRoute.h:35
inet::Ipv6Route::_expiryTime
simtime_t _expiryTime
Definition: Ipv6Route.h:56
inet::Ipv6Route::_destPrefix
Ipv6Address _destPrefix
Definition: Ipv6Route.h:51
inet::Ipv6Route::dLISP
@ dLISP
Definition: Ipv6Route.h:45
type
removed type
Definition: IUdp-gates.txt:7
inet::IRoute::F_TYPE
@ F_TYPE
Definition: IRoute.h:52
inet::Ipv6Route::_rt
Ipv6RoutingTable * _rt
Definition: Ipv6Route.h:50
inet::Ipv6Route::dBGPExternal
@ dBGPExternal
Definition: Ipv6Route.h:33
inet::Ipv6Route::getDestPrefix
const Ipv6Address & getDestPrefix() const
Definition: Ipv6Route.h:98
inet::Ipv6Route::dIGRP
@ dIGRP
Definition: Ipv6Route.h:35
inet::Ipv6Route::_prefixLength
short _prefixLength
Definition: Ipv6Route.h:52
inet::Ipv6Route::getNextHop
const Ipv6Address & getNextHop() const
Definition: Ipv6Route.h:101
inet::Ipv6Route::_nextHop
Ipv6Address _nextHop
Definition: Ipv6Route.h:55
inet::Ipv6Route::_source
cObject * _source
Definition: Ipv6Route.h:59
inet::Ipv6Route::_interfacePtr
NetworkInterface * _interfacePtr
Definition: Ipv6Route.h:54
inet::Ipv6Route::dEIGRPInternal
@ dEIGRPInternal
Definition: Ipv6Route.h:34
inet::Ipv6Route::_adminDist
unsigned int _adminDist
Definition: Ipv6Route.h:58
inet::Ipv6Address::isUnspecified
bool isUnspecified() const
Check if the Ipv6 Address is undefined.
Definition: Ipv6Address.h:280
inet::Ipv6Route::dBGPInternal
@ dBGPInternal
Definition: Ipv6Route.h:42
inet::Ipv6Route::changed
void changed(int fieldCode)
Routing Protocol specific data.
Definition: Ipv6Route.cc:69
inet::IRoute::BABEL
@ BABEL
Definition: IRoute.h:42
inet::IRoute::F_PREFIX_LENGTH
@ F_PREFIX_LENGTH
Definition: IRoute.h:48
inet::Ipv6Route::dDHCPlearned
@ dDHCPlearned
Definition: Ipv6Route.h:43
inet::IRoute::F_METRIC
@ F_METRIC
Definition: IRoute.h:54
inet::IRoute::F_NEXTHOP
@ F_NEXTHOP
Definition: IRoute.h:49
inet::Ipv6Route::dISIS
@ dISIS
Definition: Ipv6Route.h:37
inet::IRoute::IFACENETMASK
@ IFACENETMASK
comes from an interface's netmask
Definition: IRoute.h:30
inet::Ipv6Route::dEGP
@ dEGP
Definition: Ipv6Route.h:39
inet::Ipv6Route::dUnknown
@ dUnknown
Definition: Ipv6Route.h:46
inet::IRoute::F_ADMINDIST
@ F_ADMINDIST
Definition: IRoute.h:53