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

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, 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
}
 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...
 

Public Member Functions

 IPv6Route (IPv6Address destPrefix, int prefixLength, SourceType sourceType)
 Constructor. More...
 
virtual ~IPv6Route ()
 
virtual std::string info () const override
 
virtual std::string detailedInfo () const override
 
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)
 
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
 
virtual L3Address getDestinationAsGeneric () const override
 Destination address prefix to match. More...
 
virtual L3Address getNextHopAsGeneric () const override
 Next hop address. More...
 
virtual InterfaceEntrygetInterface () const override
 Next hop interface. More...
 
virtual void setInterface (InterfaceEntry *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 ()
 
virtual void setSourceType (SourceType type)=0
 

Protected Member Functions

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

Protected Attributes

IPv6RoutingTable_rt
 
IPv6Address _destPrefix
 
short _prefixLength
 
SourceType _sourceType
 
InterfaceEntry_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

Cisco like administrative distances (includes IPv4 protocols)

Enumerator
dDirectlyConnected 
dStatic 
dEIGRPSummary 
dBGPExternal 
dEIGRPInternal 
dIGRP 
dOSPF 
dISIS 
dRIP 
dEGP 
dODR 
dEIGRPExternal 
dBGPInternal 
dDHCPlearned 
dUnknown 
41  {
43  dStatic = 1,
44  dEIGRPSummary = 5,
45  dBGPExternal = 20,
46  dEIGRPInternal = 90,
47  dIGRP = 100,
48  dOSPF = 110,
49  dISIS = 115,
50  dRIP = 120,
51  dEGP = 140,
52  dODR = 160,
53  dEIGRPExternal = 170,
54  dBGPInternal = 200,
55  dDHCPlearned = 254,
56  dUnknown = 255
57  };
Definition: IPv6Route.h:50
Definition: IPv6Route.h:52
Definition: IPv6Route.h:56
Definition: IPv6Route.h:54
Definition: IPv6Route.h:51
Definition: IPv6Route.h:46
Definition: IPv6Route.h:43
Definition: IPv6Route.h:44
Definition: IPv6Route.h:55
Definition: IPv6Route.h:53
Definition: IPv6Route.h:42
Definition: IPv6Route.h:45
Definition: IPv6Route.h:48
Definition: IPv6Route.h:49
Definition: IPv6Route.h:47

Constructor & Destructor Documentation

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.

81  {
82  _rt = nullptr;
83  _destPrefix = destPrefix;
84  _prefixLength = prefixLength;
85  _sourceType = sourceType;
86  _interfacePtr = nullptr;
87  _expiryTime = 0;
88  _metric = 0;
90  _source = nullptr;
91  _protocolData = nullptr;
92  }
SourceType _sourceType
Definition: IPv6Route.h:63
simtime_t _expiryTime
Definition: IPv6Route.h:66
IPv6Address _destPrefix
Definition: IPv6Route.h:61
Definition: IPv6Route.h:56
int _metric
Definition: IPv6Route.h:67
cObject * _source
Definition: IPv6Route.h:69
IPv6RoutingTable * _rt
Definition: IPv6Route.h:60
InterfaceEntry * _interfacePtr
Definition: IPv6Route.h:64
cObject * _protocolData
Object identifying the source.
Definition: IPv6Route.h:70
unsigned int _adminDist
Definition: IPv6Route.h:68
short _prefixLength
Definition: IPv6Route.h:62
virtual inet::IPv6Route::~IPv6Route ( )
inlinevirtual
94 { delete _protocolData; }
cObject * _protocolData
Object identifying the source.
Definition: IPv6Route.h:70

Member Function Documentation

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

Routing Protocol specific data.

46 {
47  if (_rt)
48  _rt->routeChanged(this, fieldCode);
49 }
virtual void routeChanged(IPv6Route *entry, int fieldCode)
To be called from route objects whenever a field changes.
Definition: IPv6RoutingTable.cc:209
IPv6RoutingTable * _rt
Definition: IPv6Route.h:60
std::string inet::IPv6Route::detailedInfo ( ) const
overridevirtual
41 {
42  return std::string();
43 }
unsigned int inet::IPv6Route::getAdminDist ( ) const
inline

Referenced by inet::IPv6RoutingTable::routeLessThan().

114 { return _adminDist; }
unsigned int _adminDist
Definition: IPv6Route.h:68
virtual L3Address inet::IPv6Route::getDestinationAsGeneric ( ) const
inlineoverridevirtual

Destination address prefix to match.

Implements inet::IRoute.

122 { return getDestPrefix(); } //TODO rename IPv6 method
const IPv6Address & getDestPrefix() const
Definition: IPv6Route.h:108
const IPv6Address& inet::IPv6Route::getDestPrefix ( ) const
inline

Referenced by info().

108 { return _destPrefix; }
IPv6Address _destPrefix
Definition: IPv6Route.h:61
simtime_t inet::IPv6Route::getExpiryTime ( ) const
inline

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

112 { return _expiryTime; }
simtime_t _expiryTime
Definition: IPv6Route.h:66
virtual InterfaceEntry* inet::IPv6Route::getInterface ( ) const
inlineoverridevirtual
virtual int inet::IPv6Route::getMetric ( ) const
inlineoverridevirtual

Cost to reach the destination.

Implements inet::IRoute.

Referenced by inet::IPv6RoutingTable::routeLessThan().

113 { return _metric; }
int _metric
Definition: IPv6Route.h:67
const IPv6Address& inet::IPv6Route::getNextHop ( ) const
inline

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

111 { return _nextHop; }
IPv6Address _nextHop
Definition: IPv6Route.h:65
virtual L3Address inet::IPv6Route::getNextHopAsGeneric ( ) const
inlineoverridevirtual

Next hop address.

Implements inet::IRoute.

Referenced by inet::IPv6RoutingTable::getNextHopForDestination().

123 { return getNextHop(); }
const IPv6Address & getNextHop() const
Definition: IPv6Route.h:111
virtual int inet::IPv6Route::getPrefixLength ( ) const
inlineoverridevirtual

Represents length of prefix to match.

Implements inet::IRoute.

Referenced by info(), and inet::IPv6RoutingTable::routeLessThan().

109 { return _prefixLength; }
short _prefixLength
Definition: IPv6Route.h:62
virtual cObject* inet::IPv6Route::getProtocolData ( ) const
inlineoverridevirtual

Implements inet::IRoute.

127 { return _protocolData; }
cObject * _protocolData
Object identifying the source.
Definition: IPv6Route.h:70
IPv6RoutingTable* inet::IPv6Route::getRoutingTable ( ) const
inline

Referenced by getRoutingTableAsGeneric(), inet::IPv6RoutingTable::internalAddRoute(), and inet::IPv6RoutingTable::internalRemoveRoute().

101 { return _rt; }
IPv6RoutingTable * _rt
Definition: IPv6Route.h:60
IRoutingTable * inet::IPv6Route::getRoutingTableAsGeneric ( ) const
overridevirtual

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

Implements inet::IRoute.

52 {
53  return getRoutingTable();
54 }
IPv6RoutingTable * getRoutingTable() const
Definition: IPv6Route.h:101
virtual cObject* inet::IPv6Route::getSource ( ) const
inlineoverridevirtual

Source of route.

Implements inet::IRoute.

126 { return _source; }
cObject * _source
Definition: IPv6Route.h:69
virtual SourceType inet::IPv6Route::getSourceType ( ) const
inlineoverridevirtual

Source type of the route.

Implements inet::IRoute.

Referenced by info().

110 { return _sourceType; }
SourceType _sourceType
Definition: IPv6Route.h:63
std::string inet::IPv6Route::info ( ) const
overridevirtual

Referenced by inet::operator<<().

29 {
30  std::stringstream out;
31  out << getDestPrefix() << "/" << getPrefixLength() << " --> ";
32  out << "if:" << (_interfacePtr ? _interfacePtr->getName() : "* ");
33  out << " next hop:" << getNextHop();
34  out << " " << IRoute::sourceTypeName(getSourceType());
35  if (getExpiryTime() > 0)
36  out << " exp:" << getExpiryTime();
37  return out.str();
38 }
virtual int getPrefixLength() const override
Represents length of prefix to match.
Definition: IPv6Route.h:109
const IPv6Address & getDestPrefix() const
Definition: IPv6Route.h:108
static const char * sourceTypeName(SourceType sourceType)
Definition: IRoute.cc:22
virtual SourceType getSourceType() const override
Source type of the route.
Definition: IPv6Route.h:110
simtime_t getExpiryTime() const
Definition: IPv6Route.h:112
InterfaceEntry * _interfacePtr
Definition: IPv6Route.h:64
const IPv6Address & getNextHop() const
Definition: IPv6Route.h:111
void inet::IPv6Route::setAdminDist ( unsigned int  adminDist)
inline

Referenced by inet::IPv6RoutingTable::addDefaultRoute(), inet::IPv6RoutingTable::addOrUpdateOnLinkPrefix(), inet::IPv6RoutingTable::addOrUpdateOwnAdvPrefix(), and inet::IPv6RoutingTable::addStaticRoute().

106 { if (_adminDist != adminDist) { _adminDist = adminDist; changed(F_ADMINDIST); } }
void changed(int fieldCode)
Routing Protocol specific data.
Definition: IPv6Route.cc:45
unsigned int _adminDist
Definition: IPv6Route.h:68
Definition: IRoute.h:63
virtual void inet::IPv6Route::setDestination ( const L3Address dest)
inlineoverridevirtual

Implements inet::IRoute.

117 { if (_destPrefix != dest.toIPv6()) { _destPrefix = dest.toIPv6(); changed(F_DESTINATION); } }
IPv6Address _destPrefix
Definition: IPv6Route.h:61
Definition: IRoute.h:57
void changed(int fieldCode)
Routing Protocol specific data.
Definition: IPv6Route.cc:45
void inet::IPv6Route::setExpiryTime ( simtime_t  expiryTime)
inline

Referenced by inet::IPv6RoutingTable::addDefaultRoute(), inet::IPv6RoutingTable::addOrUpdateOnLinkPrefix(), and inet::IPv6RoutingTable::addOrUpdateOwnAdvPrefix().

104 { if (expiryTime != _expiryTime) { _expiryTime = expiryTime; changed(F_EXPIRYTIME); } }
simtime_t _expiryTime
Definition: IPv6Route.h:66
Definition: IRoute.h:65
void changed(int fieldCode)
Routing Protocol specific data.
Definition: IPv6Route.cc:45
virtual void inet::IPv6Route::setInterface ( InterfaceEntry ie)
inlineoverridevirtual

Implements inet::IRoute.

Referenced by inet::IPv6RoutingTable::addDefaultRoute(), inet::IPv6RoutingTable::addOrUpdateOnLinkPrefix(), inet::IPv6RoutingTable::addOrUpdateOwnAdvPrefix(), and inet::IPv6RoutingTable::addStaticRoute().

125 { if (_interfacePtr != ie) { _interfacePtr = ie; changed(F_IFACE); } }
void changed(int fieldCode)
Routing Protocol specific data.
Definition: IPv6Route.cc:45
InterfaceEntry * _interfacePtr
Definition: IPv6Route.h:64
Definition: IRoute.h:60
void inet::IPv6Route::setMetric ( int  metric)
inlineoverridevirtual

Implements inet::IRoute.

Referenced by inet::IPv6RoutingTable::addDefaultRoute(), inet::IPv6RoutingTable::addOrUpdateOnLinkPrefix(), inet::IPv6RoutingTable::addOrUpdateOwnAdvPrefix(), and inet::IPv6RoutingTable::addStaticRoute().

105 { if (_metric != metric) { _metric = metric; changed(F_METRIC); } }
Definition: IRoute.h:64
int _metric
Definition: IPv6Route.h:67
void changed(int fieldCode)
Routing Protocol specific data.
Definition: IPv6Route.cc:45
void inet::IPv6Route::setNextHop ( const IPv6Address nextHop)
inline

Referenced by inet::IPv6RoutingTable::addDefaultRoute(), and inet::IPv6RoutingTable::addStaticRoute().

103 { if (_nextHop != nextHop) { _nextHop = nextHop; changed(F_NEXTHOP); } }
Definition: IRoute.h:59
void changed(int fieldCode)
Routing Protocol specific data.
Definition: IPv6Route.cc:45
IPv6Address _nextHop
Definition: IPv6Route.h:65
virtual void inet::IPv6Route::setNextHop ( const L3Address nextHop)
inlineoverridevirtual

Implements inet::IRoute.

119 { if (_nextHop != nextHop.toIPv6()) { _nextHop = nextHop.toIPv6(); changed(F_NEXTHOP); } }
Definition: IRoute.h:59
void changed(int fieldCode)
Routing Protocol specific data.
Definition: IPv6Route.cc:45
IPv6Address _nextHop
Definition: IPv6Route.h:65
virtual void inet::IPv6Route::setPrefixLength ( int  prefixLength)
inlineoverridevirtual

Implements inet::IRoute.

118 { if (_prefixLength != prefixLength) { _prefixLength = prefixLength; changed(F_PREFIX_LENGTH); } }
void changed(int fieldCode)
Routing Protocol specific data.
Definition: IPv6Route.cc:45
Definition: IRoute.h:58
short _prefixLength
Definition: IPv6Route.h:62
virtual void inet::IPv6Route::setProtocolData ( cObject *  protocolData)
inlineoverridevirtual

Implements inet::IRoute.

128 { _protocolData = protocolData; }
cObject * _protocolData
Object identifying the source.
Definition: IPv6Route.h:70
virtual void inet::IPv6Route::setRoutingTable ( IPv6RoutingTable rt)
inlinevirtual

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

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

100 { _rt = rt; }
IPv6RoutingTable * _rt
Definition: IPv6Route.h:60
virtual void inet::IPv6Route::setSource ( cObject *  source)
inlineoverridevirtual

Implements inet::IRoute.

120 { if (_source != source) { _source = source; changed(F_SOURCE); } }
Definition: IRoute.h:61
cObject * _source
Definition: IPv6Route.h:69
void changed(int fieldCode)
Routing Protocol specific data.
Definition: IPv6Route.cc:45
virtual void inet::IPv6Route::setSourceType ( SourceType  type)
inlineoverridevirtual
121 { if (_sourceType != type) { _sourceType = type; changed(F_TYPE); } }
SourceType _sourceType
Definition: IPv6Route.h:63
void changed(int fieldCode)
Routing Protocol specific data.
Definition: IPv6Route.cc:45
Definition: IRoute.h:62

Member Data Documentation

unsigned int inet::IPv6Route::_adminDist
protected
IPv6Address inet::IPv6Route::_destPrefix
protected
simtime_t inet::IPv6Route::_expiryTime
protected
InterfaceEntry* inet::IPv6Route::_interfacePtr
protected

Referenced by info().

int inet::IPv6Route::_metric
protected
IPv6Address inet::IPv6Route::_nextHop
protected
short inet::IPv6Route::_prefixLength
protected
cObject* inet::IPv6Route::_protocolData
protected

Object identifying the source.

IPv6RoutingTable* inet::IPv6Route::_rt
protected

Referenced by changed().

cObject* inet::IPv6Route::_source
protected
SourceType inet::IPv6Route::_sourceType
protected

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