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

A generic route that uses generic addresses as destination and next hop. More...

#include <GenericRoute.h>

Inheritance diagram for inet::GenericRoute:
inet::IRoute

Public Member Functions

 GenericRoute ()
 
virtual ~GenericRoute ()
 
virtual std::string info () const override
 
virtual std::string detailedInfo () const override
 
bool equals (const IRoute &route) const
 
virtual void setRoutingTable (GenericRoutingTable *owner)
 
virtual void setDestination (const L3Address &dest) override
 
virtual void setPrefixLength (int l) override
 
virtual void setNextHop (const L3Address &nextHop) override
 
virtual void setInterface (InterfaceEntry *ie) override
 
virtual void setSourceType (SourceType sourceType) override
 
virtual void setSource (cObject *source) override
 
virtual void setMetric (int metric) override
 
virtual void setProtocolData (cObject *protocolData) override
 
virtual IRoutingTablegetRoutingTableAsGeneric () const override
 The routing table in which this route is inserted, or nullptr. More...
 
virtual L3Address getDestinationAsGeneric () const override
 Destination address prefix to match. More...
 
virtual int getPrefixLength () const override
 Represents length of prefix to match. More...
 
virtual L3Address getNextHopAsGeneric () const override
 Next hop address. More...
 
virtual InterfaceEntrygetInterface () const override
 Next hop interface. More...
 
SourceType getSourceType () const override
 Source type of the route. More...
 
virtual cObject * getSource () const override
 Source of route. More...
 
virtual int getMetric () const override
 Cost to reach the destination. More...
 
virtual cObject * getProtocolData () const override
 
- Public Member Functions inherited from inet::IRoute
virtual ~IRoute ()
 

Protected Member Functions

void changed (int fieldCode)
 

Private Attributes

GenericRoutingTableowner
 
int prefixLength
 
L3Address destination
 
L3Address nextHop
 
InterfaceEntryinterface
 
SourceType sourceType
 
cObject * source
 
cObject * protocolData
 
int metric
 

Additional Inherited Members

- 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...
 
- Static Public Member Functions inherited from inet::IRoute
static const char * sourceTypeName (SourceType sourceType)
 

Detailed Description

A generic route that uses generic addresses as destination and next hop.

Constructor & Destructor Documentation

inet::GenericRoute::GenericRoute ( )
inline
51  : owner(nullptr), prefixLength(0), interface(nullptr), sourceType(IRoute::MANUAL),
52  source(nullptr), protocolData(nullptr), metric(0) {}
int prefixLength
Definition: GenericRoute.h:38
cObject * source
Definition: GenericRoute.h:43
SourceType sourceType
Definition: GenericRoute.h:42
InterfaceEntry * interface
Definition: GenericRoute.h:41
int metric
Definition: GenericRoute.h:45
cObject * protocolData
Definition: GenericRoute.h:44
manually added static route
Definition: IRoute.h:40
GenericRoutingTable * owner
Definition: GenericRoute.h:37
virtual inet::GenericRoute::~GenericRoute ( )
inlinevirtual
53 { delete protocolData; }
cObject * protocolData
Definition: GenericRoute.h:44

Member Function Documentation

void inet::GenericRoute::changed ( int  fieldCode)
protected
66 {
67  if (owner)
68  owner->routeChanged(this, fieldCode);
69 }
virtual void routeChanged(GenericRoute *entry, int fieldCode)
To be called from route objects whenever a field changes.
Definition: GenericRoutingTable.cc:131
GenericRoutingTable * owner
Definition: GenericRoute.h:37
std::string inet::GenericRoute::detailedInfo ( ) const
overridevirtual
56 {
57  return ""; //TODO
58 }
bool inet::GenericRoute::equals ( const IRoute route) const
61 {
62  return false; //TODO
63 }
virtual L3Address inet::GenericRoute::getDestinationAsGeneric ( ) const
inlineoverridevirtual

Destination address prefix to match.

Implements inet::IRoute.

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

74 { return destination; }
L3Address destination
Definition: GenericRoute.h:39
virtual InterfaceEntry* inet::GenericRoute::getInterface ( ) const
inlineoverridevirtual

Next hop interface.

Implements inet::IRoute.

Referenced by inet::GenericRoutingTable::addRoute(), and inet::GenericNetworkProtocol::routePacket().

83 { return interface; }
InterfaceEntry * interface
Definition: GenericRoute.h:41
virtual int inet::GenericRoute::getMetric ( ) const
inlineoverridevirtual

Cost to reach the destination.

Implements inet::IRoute.

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

92 { return metric; }
int metric
Definition: GenericRoute.h:45
virtual L3Address inet::GenericRoute::getNextHopAsGeneric ( ) const
inlineoverridevirtual

Next hop address.

Implements inet::IRoute.

Referenced by inet::GenericNetworkProtocol::routePacket().

80 { return nextHop; }
L3Address nextHop
Definition: GenericRoute.h:40
virtual int inet::GenericRoute::getPrefixLength ( ) const
inlineoverridevirtual

Represents length of prefix to match.

Implements inet::IRoute.

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

77 { return prefixLength; }
int prefixLength
Definition: GenericRoute.h:38
virtual cObject* inet::GenericRoute::getProtocolData ( ) const
inlineoverridevirtual

Implements inet::IRoute.

94 { return protocolData; }
cObject * protocolData
Definition: GenericRoute.h:44
IRoutingTable * inet::GenericRoute::getRoutingTableAsGeneric ( ) const
overridevirtual

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

Implements inet::IRoute.

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

72 {
73  return owner;
74 }
GenericRoutingTable * owner
Definition: GenericRoute.h:37
virtual cObject* inet::GenericRoute::getSource ( ) const
inlineoverridevirtual

Source of route.

Implements inet::IRoute.

89 { return source; }
cObject * source
Definition: GenericRoute.h:43
SourceType inet::GenericRoute::getSourceType ( ) const
inlineoverridevirtual

Source type of the route.

Implements inet::IRoute.

86 { return sourceType; }
SourceType sourceType
Definition: GenericRoute.h:42
std::string inet::GenericRoute::info ( ) const
overridevirtual

Referenced by inet::GenericNetworkConfigurator::addStaticRoutes(), and inet::operator<<().

27 {
28  std::stringstream out;
29 
30  out << "dest:";
32  out << "* ";
33  else
34  out << destination << " ";
35  out << "gw:";
36  if (nextHop.isUnspecified())
37  out << "* ";
38  else
39  out << nextHop << " ";
40  out << "metric:" << metric << " ";
41  out << "if:";
42  if (!interface)
43  out << "*";
44  else
45  out << interface->getName();
47  out << "(" << interface->getGenericNetworkProtocolData()->getAddress() << ")";
48  out << " ";
49  out << (nextHop.isUnspecified() ? "DIRECT" : "REMOTE");
50  out << " " << IRoute::sourceTypeName(sourceType);
51 
52  return out.str();
53 }
static const char * sourceTypeName(SourceType sourceType)
Definition: IRoute.cc:22
GenericNetworkProtocolInterfaceData * getGenericNetworkProtocolData() const
Definition: InterfaceEntry.h:224
SourceType sourceType
Definition: GenericRoute.h:42
InterfaceEntry * interface
Definition: GenericRoute.h:41
bool isUnspecified() const
Definition: L3Address.cc:133
L3Address nextHop
Definition: GenericRoute.h:40
L3Address getAddress() const
Definition: GenericNetworkProtocolInterfaceData.h:60
int metric
Definition: GenericRoute.h:45
L3Address destination
Definition: GenericRoute.h:39
virtual void inet::GenericRoute::setDestination ( const L3Address dest)
inlineoverridevirtual

Implements inet::IRoute.

Referenced by inet::GenericNetworkConfigurator::addStaticRoutes().

61 { if (destination != dest) { this->destination = dest; changed(F_DESTINATION); } }
void changed(int fieldCode)
Definition: GenericRoute.cc:65
Definition: IRoute.h:57
L3Address destination
Definition: GenericRoute.h:39
virtual void inet::GenericRoute::setInterface ( InterfaceEntry ie)
inlineoverridevirtual

Implements inet::IRoute.

Referenced by inet::GenericNetworkConfigurator::addStaticRoutes().

64 { if (interface != ie) { this->interface = ie; changed(F_IFACE); } }
void changed(int fieldCode)
Definition: GenericRoute.cc:65
InterfaceEntry * interface
Definition: GenericRoute.h:41
Definition: IRoute.h:60
virtual void inet::GenericRoute::setMetric ( int  metric)
inlineoverridevirtual

Implements inet::IRoute.

67 { if (this->metric != metric) { this->metric = metric; changed(F_METRIC); } }
Definition: IRoute.h:64
void changed(int fieldCode)
Definition: GenericRoute.cc:65
int metric
Definition: GenericRoute.h:45
virtual void inet::GenericRoute::setNextHop ( const L3Address nextHop)
inlineoverridevirtual

Implements inet::IRoute.

Referenced by inet::GenericNetworkConfigurator::addStaticRoutes().

63 { if (this->nextHop != nextHop) { this->nextHop = nextHop; changed(F_NEXTHOP); } }
void changed(int fieldCode)
Definition: GenericRoute.cc:65
L3Address nextHop
Definition: GenericRoute.h:40
Definition: IRoute.h:59
virtual void inet::GenericRoute::setPrefixLength ( int  l)
inlineoverridevirtual

Implements inet::IRoute.

62 { if (prefixLength != l) { this->prefixLength = l; changed(F_PREFIX_LENGTH); } }
int prefixLength
Definition: GenericRoute.h:38
void changed(int fieldCode)
Definition: GenericRoute.cc:65
Definition: IRoute.h:58
virtual void inet::GenericRoute::setProtocolData ( cObject *  protocolData)
inlineoverridevirtual

Implements inet::IRoute.

68 { this->protocolData = protocolData; }
cObject * protocolData
Definition: GenericRoute.h:44
virtual void inet::GenericRoute::setRoutingTable ( GenericRoutingTable owner)
inlinevirtual

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

60 { this->owner = owner; }
GenericRoutingTable * owner
Definition: GenericRoute.h:37
virtual void inet::GenericRoute::setSource ( cObject *  source)
inlineoverridevirtual

Implements inet::IRoute.

66 { if (this->source != source) { this->source = source; changed(F_SOURCE); } }
void changed(int fieldCode)
Definition: GenericRoute.cc:65
Definition: IRoute.h:61
cObject * source
Definition: GenericRoute.h:43
virtual void inet::GenericRoute::setSourceType ( SourceType  sourceType)
inlineoverridevirtual

Implements inet::IRoute.

Referenced by inet::GenericNetworkConfigurator::addStaticRoutes().

65 { if (this->sourceType != sourceType) { this->sourceType = sourceType; changed(F_TYPE); } }
void changed(int fieldCode)
Definition: GenericRoute.cc:65
SourceType sourceType
Definition: GenericRoute.h:42
Definition: IRoute.h:62

Member Data Documentation

L3Address inet::GenericRoute::destination
private

Referenced by info().

InterfaceEntry* inet::GenericRoute::interface
private

Referenced by info().

int inet::GenericRoute::metric
private

Referenced by info().

L3Address inet::GenericRoute::nextHop
private

Referenced by info().

GenericRoutingTable* inet::GenericRoute::owner
private
int inet::GenericRoute::prefixLength
private
cObject* inet::GenericRoute::protocolData
private
cObject* inet::GenericRoute::source
private
SourceType inet::GenericRoute::sourceType
private

Referenced by info().


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