INET Framework for OMNeT++/OMNEST
inet::ospfv3::Ospfv3RoutingTableEntry Class Reference

#include <Ospfv3RoutingTableEntry.h>

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

Public Types

enum  RoutingPathType { INTRAAREA = 0, INTERAREA = 1, TYPE1_EXTERNAL = 2, TYPE2_EXTERNAL = 3 }
 
typedef unsigned char RoutingDestinationType
 
- Public Types inherited from inet::Ipv6Route
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

 Ospfv3RoutingTableEntry (const Ospfv3RoutingTableEntry &entry, Ipv6Address destPrefix, int prefixLength, SourceType sourceType)
 
 Ospfv3RoutingTableEntry (IInterfaceTable *ift, Ipv6Address destPrefix, int prefixLength, SourceType sourceType)
 
virtual ~Ospfv3RoutingTableEntry ()
 
bool operator== (const Ospfv3RoutingTableEntry &entry) const
 
bool operator!= (const Ospfv3RoutingTableEntry &entry) const
 
void setDestinationType (RoutingDestinationType type)
 
RoutingDestinationType getDestinationType () const
 
void setOptionalCapabilities (Ospfv3Options options)
 
Ospfv3Options getOptionalCapabilities () const
 
void setArea (AreaID source)
 
AreaID getArea () const
 
void setPathType (RoutingPathType type)
 
RoutingPathType getPathType () const
 
void setCost (Metric pathCost)
 
Metric getCost () const
 
void setType2Cost (Metric pathCost)
 
Metric getType2Cost () const
 
void setLinkStateOrigin (const Ospfv3Lsa *lsa)
 
const Ospfv3LsagetLinkStateOrigin () const
 
void addNextHop (NextHop hop)
 
void clearNextHops ()
 
unsigned int getNextHopCount () const
 
NextHop getNextHop (unsigned int index) const
 
- Public Member Functions inherited from inet::Ipv6Route
 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 ()
 

Static Public Attributes

static const unsigned char NETWORK_DESTINATION = 0
 
static const unsigned char AREA_BORDER_ROUTER_DESTINATION = 1
 
static const unsigned char AS_BOUNDARY_ROUTER_DESTINATION = 2
 

Private Attributes

IInterfaceTableift = nullptr
 
RoutingDestinationType destinationType = 0
 
Ospfv3Options optionalCapabilities
 
AreaID area
 
RoutingPathType pathType = (RoutingPathType) - 1
 
Metric cost = 0
 
Metric type2Cost = 0
 
const Ospfv3LsalinkStateOrigin = nullptr
 
std::vector< NextHopnextHops
 

Additional Inherited Members

- Static Public Member Functions inherited from inet::IRoute
static const char * sourceTypeName (SourceType sourceType)
 
- Protected Member Functions inherited from inet::Ipv6Route
void changed (int fieldCode)
 Routing Protocol specific data. More...
 
- Protected Attributes inherited from inet::Ipv6Route
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...
 

Member Typedef Documentation

◆ RoutingDestinationType

Member Enumeration Documentation

◆ RoutingPathType

Enumerator
INTRAAREA 
INTERAREA 
TYPE1_EXTERNAL 
TYPE2_EXTERNAL 
19  {
20  INTRAAREA = 0,
21  INTERAREA = 1,
22  TYPE1_EXTERNAL = 2,
23  TYPE2_EXTERNAL = 3
24  };

Constructor & Destructor Documentation

◆ Ospfv3RoutingTableEntry() [1/2]

inet::ospfv3::Ospfv3RoutingTableEntry::Ospfv3RoutingTableEntry ( const Ospfv3RoutingTableEntry entry,
Ipv6Address  destPrefix,
int  prefixLength,
SourceType  sourceType 
)
16  :
17  Ipv6Route(destPrefix, prefixLength, sourceType),
18  destinationType(entry.destinationType),
19  optionalCapabilities(entry.optionalCapabilities),
20  area(entry.area),
21  pathType(entry.pathType),
22  cost(entry.cost),
23  type2Cost(entry.type2Cost),
24  linkStateOrigin(entry.linkStateOrigin),
25  nextHops(entry.nextHops)
26 {
27  this->setDestination(entry.getDestinationAsGeneric());
28  this->setPrefixLength(prefixLength);
29  this->setInterface(entry.getInterface());
30  this->setSourceType(entry.getSourceType());
31  this->setMetric(entry.getMetric());
32 }

◆ Ospfv3RoutingTableEntry() [2/2]

inet::ospfv3::Ospfv3RoutingTableEntry::Ospfv3RoutingTableEntry ( IInterfaceTable ift,
Ipv6Address  destPrefix,
int  prefixLength,
SourceType  sourceType 
)
6  :
7  Ipv6Route(destPrefix, prefixLength, sourceType),
8  ift(ift),
11 {
12  this->setPrefixLength(prefixLength);
14 }

◆ ~Ospfv3RoutingTableEntry()

virtual inet::ospfv3::Ospfv3RoutingTableEntry::~Ospfv3RoutingTableEntry ( )
inlinevirtual
49 {}

Member Function Documentation

◆ addNextHop()

void inet::ospfv3::Ospfv3RoutingTableEntry::addNextHop ( NextHop  hop)
71 {
72  if (nextHops.size() == 0) {
73  NetworkInterface *routingInterface = ift->getInterfaceById(hop.ifIndex);
74 
75  setInterface(routingInterface);
76  // TODO this used to be commented out, but it seems we need it
77  // otherwise gateways will never be filled in and gateway is needed for broadcast networks
78 // setGateway(hop.hopAddress);
79  }
80  nextHops.push_back(hop);
81 }

Referenced by inet::ospfv3::Ospfv3Area::addRouterEntry(), inet::ospfv3::Ospfv3Area::calculateInterAreaRoutes(), inet::ospfv3::Ospfv3Area::calculateShortestPathTree(), inet::ospfv3::Ospfv3Area::createRoutingTableEntryFromInterAreaPrefixLSA(), and inet::ospfv3::Ospfv3Area::recheckInterAreaPrefixLSAs().

◆ clearNextHops()

void inet::ospfv3::Ospfv3RoutingTableEntry::clearNextHops ( )
inline

◆ getArea()

AreaID inet::ospfv3::Ospfv3RoutingTableEntry::getArea ( ) const
inline

◆ getCost()

◆ getDestinationType()

◆ getLinkStateOrigin()

const Ospfv3Lsa* inet::ospfv3::Ospfv3RoutingTableEntry::getLinkStateOrigin ( ) const
inline

◆ getNextHop()

◆ getNextHopCount()

◆ getOptionalCapabilities()

Ospfv3Options inet::ospfv3::Ospfv3RoutingTableEntry::getOptionalCapabilities ( ) const
inline
57 { return optionalCapabilities; }

◆ getPathType()

◆ getType2Cost()

Metric inet::ospfv3::Ospfv3RoutingTableEntry::getType2Cost ( ) const
inline
65 { return type2Cost; }

Referenced by inet::ospfv3::operator<<().

◆ operator!=()

bool inet::ospfv3::Ospfv3RoutingTableEntry::operator!= ( const Ospfv3RoutingTableEntry entry) const
inline
52 { return !((*this) == entry); }

◆ operator==()

bool inet::ospfv3::Ospfv3RoutingTableEntry::operator== ( const Ospfv3RoutingTableEntry entry) const
84 {
85  unsigned int hopCount = nextHops.size();
86  unsigned int i = 0;
87 
88  if (hopCount != entry.nextHops.size()) {
89  return false;
90  }
91  for (i = 0; i < hopCount; i++) {
92  if ((nextHops[i] != entry.nextHops[i])) {
93  return false;
94  }
95  }
96 
97  return (this->destinationType == entry.destinationType) &&
98  (this->getDestinationAsGeneric() == entry.getDestinationAsGeneric()) &&
99  (this->getPrefixLength() == entry.getPrefixLength()) &&
100  (this->optionalCapabilities == entry.optionalCapabilities) &&
101  (this->area == entry.area) &&
102  (this->pathType == entry.pathType) &&
103  (this->cost == entry.cost) &&
104  (this->type2Cost == entry.type2Cost) &&
105  (this->linkStateOrigin == entry.linkStateOrigin);
106 }

◆ setArea()

◆ setCost()

void inet::ospfv3::Ospfv3RoutingTableEntry::setCost ( Metric  pathCost)
47 {
48  cost = pathCost;
49  // FIXME this is a hack. But the correct way to do it is to implement a separate IIPv4RoutingTable module for OSPF...
51  setMetric(cost + type2Cost * 1000);
52  }
53  else {
54  setMetric(cost);
55  }
56 }

Referenced by inet::ospfv3::Ospfv3Area::addRouterEntry(), inet::ospfv3::Ospfv3Area::calculateShortestPathTree(), and inet::ospfv3::Ospfv3Area::createRoutingTableEntryFromInterAreaPrefixLSA().

◆ setDestinationType()

◆ setLinkStateOrigin()

void inet::ospfv3::Ospfv3RoutingTableEntry::setLinkStateOrigin ( const Ospfv3Lsa lsa)
inline

◆ setOptionalCapabilities()

void inet::ospfv3::Ospfv3RoutingTableEntry::setOptionalCapabilities ( Ospfv3Options  options)
inline

◆ setPathType()

void inet::ospfv3::Ospfv3RoutingTableEntry::setPathType ( RoutingPathType  type)
35 {
36  pathType = type;
37  // FIXME this is a hack. But the correct way to do it is to implement a separate IIPv4RoutingTable module for OSPF...
39  setMetric(cost + type2Cost * 1000);
40  }
41  else {
42  setMetric(cost);
43  }
44 }

Referenced by inet::ospfv3::Ospfv3Area::addRouterEntry(), inet::ospfv3::Ospfv3Area::calculateShortestPathTree(), and inet::ospfv3::Ospfv3Area::createRoutingTableEntryFromInterAreaPrefixLSA().

◆ setType2Cost()

void inet::ospfv3::Ospfv3RoutingTableEntry::setType2Cost ( Metric  pathCost)
59 {
60  type2Cost = pathCost;
61  // FIXME this is a hack. But the correct way to do it is to implement a separate IIPv4RoutingTable module for OSPF...
63  setMetric(cost + type2Cost * 1000);
64  }
65  else {
66  setMetric(cost);
67  }
68 }

Member Data Documentation

◆ area

AreaID inet::ospfv3::Ospfv3RoutingTableEntry::area
private

Referenced by operator==().

◆ AREA_BORDER_ROUTER_DESTINATION

◆ AS_BOUNDARY_ROUTER_DESTINATION

◆ cost

Metric inet::ospfv3::Ospfv3RoutingTableEntry::cost = 0
private

◆ destinationType

RoutingDestinationType inet::ospfv3::Ospfv3RoutingTableEntry::destinationType = 0
private

Referenced by operator==().

◆ ift

IInterfaceTable* inet::ospfv3::Ospfv3RoutingTableEntry::ift = nullptr
private

Referenced by addNextHop().

◆ linkStateOrigin

const Ospfv3Lsa* inet::ospfv3::Ospfv3RoutingTableEntry::linkStateOrigin = nullptr
private

Referenced by operator==().

◆ NETWORK_DESTINATION

◆ nextHops

std::vector<NextHop> inet::ospfv3::Ospfv3RoutingTableEntry::nextHops
private

Referenced by addNextHop(), and operator==().

◆ optionalCapabilities

Ospfv3Options inet::ospfv3::Ospfv3RoutingTableEntry::optionalCapabilities
private

Referenced by operator==().

◆ pathType

RoutingPathType inet::ospfv3::Ospfv3RoutingTableEntry::pathType = (RoutingPathType) - 1
private

◆ type2Cost

Metric inet::ospfv3::Ospfv3RoutingTableEntry::type2Cost = 0
private

The documentation for this class was generated from the following files:
inet::ospfv3::Ospfv3RoutingTableEntry::optionalCapabilities
Ospfv3Options optionalCapabilities
Definition: Ospfv3RoutingTableEntry.h:36
inet::ospfv3::Ospfv3RoutingTableEntry::area
AreaID area
Definition: Ospfv3RoutingTableEntry.h:37
inet::Ipv6Route::getPrefixLength
virtual int getPrefixLength() const override
Represents length of prefix to match.
Definition: Ipv6Route.h:99
inet::ospfv3::Ospfv3RoutingTableEntry::destinationType
RoutingDestinationType destinationType
Definition: Ospfv3RoutingTableEntry.h:35
inet::ospfv3::Ospfv3RoutingTableEntry::pathType
RoutingPathType pathType
Definition: Ospfv3RoutingTableEntry.h:38
inet::ospfv3::Ospfv3RoutingTableEntry::INTERAREA
@ INTERAREA
Definition: Ospfv3RoutingTableEntry.h:21
inet::ospfv3::Ospfv3RoutingTableEntry::nextHops
std::vector< NextHop > nextHops
Definition: Ospfv3RoutingTableEntry.h:42
inet::IInterfaceTable::getInterfaceById
virtual NetworkInterface * getInterfaceById(int id) const =0
Returns an interface by its Id.
inet::ospfv3::BACKBONE_AREAID
const Ipv4Address BACKBONE_AREAID(0, 0, 0, 0)
inet::ospfv3::Ospfv3RoutingTableEntry::linkStateOrigin
const Ospfv3Lsa * linkStateOrigin
Definition: Ospfv3RoutingTableEntry.h:41
inet::IRoute::OSPF
@ OSPF
managed by the given routing protocol
Definition: IRoute.h:35
inet::Ipv6Route::setDestination
virtual void setDestination(const L3Address &dest) override
Definition: Ipv6Route.h:107
inet::Ipv6Route::setMetric
void setMetric(int metric) override
Definition: Ipv6Route.h:95
type
removed type
Definition: IUdp-gates.txt:7
inet::ospfv3::Ospfv3RoutingTableEntry::INTRAAREA
@ INTRAAREA
Definition: Ospfv3RoutingTableEntry.h:20
inet::ospfv3::Ospfv3RoutingTableEntry::TYPE1_EXTERNAL
@ TYPE1_EXTERNAL
Definition: Ospfv3RoutingTableEntry.h:22
inet::ospfv3::Ospfv3RoutingTableEntry::ift
IInterfaceTable * ift
Definition: Ospfv3RoutingTableEntry.h:34
inet::ospfv3::Ospfv3RoutingTableEntry::TYPE2_EXTERNAL
@ TYPE2_EXTERNAL
Definition: Ospfv3RoutingTableEntry.h:23
inet::Ipv6Route::getDestinationAsGeneric
virtual L3Address getDestinationAsGeneric() const override
Destination address prefix to match.
Definition: Ipv6Route.h:113
inet::ospfv3::Ospfv3RoutingTableEntry::cost
Metric cost
Definition: Ospfv3RoutingTableEntry.h:39
inet::Ipv6Route::Ipv6Route
Ipv6Route(Ipv6Address destPrefix, int prefixLength, SourceType sourceType)
Constructor.
Definition: Ipv6Route.h:70
inet::ospfv3::Ospfv3RoutingTableEntry::type2Cost
Metric type2Cost
Definition: Ospfv3RoutingTableEntry.h:40
inet::Ipv6Route::setInterface
virtual void setInterface(NetworkInterface *ie) override
Definition: Ipv6Route.h:116
inet::Ipv6Route::setSourceType
virtual void setSourceType(SourceType type) override
Definition: Ipv6Route.h:111
inet::Ipv6Route::setPrefixLength
virtual void setPrefixLength(int prefixLength) override
Definition: Ipv6Route.h:108