OSPF::RoutingTableEntry Class Reference

#include <OSPFRoutingTableEntry.h>

Inheritance diagram for OSPF::RoutingTableEntry:

IPRoute

List of all members.

Public Types

enum  RoutingPathType { IntraArea = 0, InterArea = 1, Type1External = 2, Type2External = 3 }
typedef unsigned char RoutingDestinationType

Public Member Functions

 RoutingTableEntry (void)
 RoutingTableEntry (const RoutingTableEntry &entry)
virtual ~RoutingTableEntry (void)
bool operator== (const RoutingTableEntry &entry) const
bool operator!= (const RoutingTableEntry &entry) const
void SetDestinationType (RoutingDestinationType type)
RoutingDestinationType GetDestinationType (void) const
void SetDestinationID (IPAddress destID)
IPAddress GetDestinationID (void) const
void SetAddressMask (IPAddress destMask)
IPAddress GetAddressMask (void) const
void SetOptionalCapabilities (OSPFOptions options)
OSPFOptions GetOptionalCapabilities (void) const
void SetArea (AreaID source)
AreaID GetArea (void) const
void SetPathType (RoutingPathType type)
RoutingPathType GetPathType (void) const
void SetCost (Metric pathCost)
Metric GetCost (void) const
void SetType2Cost (Metric pathCost)
Metric GetType2Cost (void) const
void SetLinkStateOrigin (const OSPFLSA *lsa)
const OSPFLSA * GetLinkStateOrigin (void) const
void AddNextHop (NextHop hop)
void ClearNextHops (void)
unsigned int GetNextHopCount (void) const
NextHop GetNextHop (unsigned int index) const

Static Public Attributes

static const unsigned char NetworkDestination = 0
static const unsigned char AreaBorderRouterDestination = 1
static const unsigned char ASBoundaryRouterDestination = 2

Private Attributes

RoutingDestinationType destinationType
OSPFOptions optionalCapabilities
AreaID area
RoutingPathType pathType
Metric cost
Metric type2Cost
const OSPFLSA * linkStateOrigin
std::vector< NextHopnextHops


Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
IntraArea 
InterArea 
Type1External 
Type2External 
00031                          {
00032         IntraArea     = 0,
00033         InterArea     = 1,
00034         Type1External = 2,
00035         Type2External = 3
00036     };


Constructor & Destructor Documentation

OSPF::RoutingTableEntry::RoutingTableEntry ( void   )  [inline]

00093                                                     :
00094     IPRoute(),
00095     destinationType(OSPF::RoutingTableEntry::NetworkDestination),
00096     area(OSPF::BackboneAreaID),
00097     pathType(OSPF::RoutingTableEntry::IntraArea),
00098     type2Cost(0),
00099     linkStateOrigin(NULL)
00100 {
00101     netmask = 0xFFFFFFFF;
00102     source  = IPRoute::OSPF;
00103     memset(&optionalCapabilities, 0, sizeof(OSPFOptions));
00104 }

OSPF::RoutingTableEntry::RoutingTableEntry ( const RoutingTableEntry entry  )  [inline]

00106                                                                               :
00107     destinationType(entry.destinationType),
00108     optionalCapabilities(entry.optionalCapabilities),
00109     area(entry.area),
00110     pathType(entry.pathType),
00111     cost(entry.cost),
00112     type2Cost(entry.type2Cost),
00113     linkStateOrigin(entry.linkStateOrigin),
00114     nextHops(entry.nextHops)
00115 {
00116     host          = entry.host;
00117     netmask       = entry.netmask;
00118     gateway       = entry.gateway;
00119     interfacePtr  = entry.interfacePtr;
00120     type          = entry.type;
00121     source        = entry.source;
00122     metric        = entry.metric;
00123 }

virtual OSPF::RoutingTableEntry::~RoutingTableEntry ( void   )  [inline, virtual]

00062 {}


Member Function Documentation

bool OSPF::RoutingTableEntry::operator== ( const RoutingTableEntry entry  )  const [inline]

00170 {
00171     unsigned int hopCount = nextHops.size();
00172     unsigned int i        = 0;
00173 
00174     if (hopCount != entry.nextHops.size()) {
00175         return false;
00176     }
00177     for (i = 0; i < hopCount; i++) {
00178         if ((nextHops[i] != entry.nextHops[i]))
00179         {
00180             return false;
00181         }
00182     }
00183 
00184     return ((destinationType      == entry.destinationType)      &&
00185             (host                 == entry.host)                 &&
00186             (netmask              == entry.netmask)              &&
00187             (optionalCapabilities == entry.optionalCapabilities) &&
00188             (area                 == entry.area)                 &&
00189             (pathType             == entry.pathType)             &&
00190             (cost                 == entry.cost)                 &&
00191             (type2Cost            == entry.type2Cost)            &&
00192             (linkStateOrigin      == entry.linkStateOrigin));
00193 }

bool OSPF::RoutingTableEntry::operator!= ( const RoutingTableEntry entry  )  const [inline]

00065 { return (!((*this) == entry)); }

void OSPF::RoutingTableEntry::SetDestinationType ( RoutingDestinationType  type  )  [inline]

00067 { destinationType = type; }

RoutingDestinationType OSPF::RoutingTableEntry::GetDestinationType ( void   )  const [inline]

void OSPF::RoutingTableEntry::SetDestinationID ( IPAddress  destID  )  [inline]

00069 { host = destID; }

IPAddress OSPF::RoutingTableEntry::GetDestinationID ( void   )  const [inline]

void OSPF::RoutingTableEntry::SetAddressMask ( IPAddress  destMask  )  [inline]

00071 { netmask = destMask; }

IPAddress OSPF::RoutingTableEntry::GetAddressMask ( void   )  const [inline]

Referenced by operator<<(), and OSPF::Area::OriginateSummaryLSA().

00072 { return netmask; }

void OSPF::RoutingTableEntry::SetOptionalCapabilities ( OSPFOptions  options  )  [inline]

00073 { optionalCapabilities = options; }

OSPFOptions OSPF::RoutingTableEntry::GetOptionalCapabilities ( void   )  const [inline]

00074 { return optionalCapabilities; }

void OSPF::RoutingTableEntry::SetArea ( AreaID  source  )  [inline]

00075 { area = source; }

AreaID OSPF::RoutingTableEntry::GetArea ( void   )  const [inline]

Referenced by operator<<().

00076 { return area; }

void OSPF::RoutingTableEntry::SetPathType ( RoutingPathType  type  )  [inline]

Referenced by OSPFRouting::LoadExternalRoute().

00126 {
00127     pathType = type;
00128     // FIXME: this is a hack. But the correct way to do it is to implement a separate IRoutingTable module for OSPF...
00129     if (pathType == OSPF::RoutingTableEntry::Type2External) {
00130         metric = cost + type2Cost * 1000;
00131     } else {
00132         metric = cost;
00133     }
00134 }

RoutingPathType OSPF::RoutingTableEntry::GetPathType ( void   )  const [inline]

Referenced by OSPF::Area::FindSameOrWorseCostRoute(), and operator<<().

00078 { return pathType; }

void OSPF::RoutingTableEntry::SetCost ( Metric  pathCost  )  [inline]

Referenced by OSPFRouting::LoadExternalRoute().

00137 {
00138     cost = pathCost;
00139     // FIXME: this is a hack. But the correct way to do it is to implement a separate IRoutingTable module for OSPF...
00140     if (pathType == OSPF::RoutingTableEntry::Type2External) {
00141         metric = cost + type2Cost * 1000;
00142     } else {
00143         metric = cost;
00144     }
00145 }

Metric OSPF::RoutingTableEntry::GetCost ( void   )  const [inline]

Referenced by OSPF::Area::FindSameOrWorseCostRoute(), and operator<<().

00080 { return cost; }

void OSPF::RoutingTableEntry::SetType2Cost ( Metric  pathCost  )  [inline]

Referenced by OSPFRouting::LoadExternalRoute().

00148 {
00149     type2Cost = pathCost;
00150     // FIXME: this is a hack. But the correct way to do it is to implement a separate IRoutingTable module for OSPF...
00151     if (pathType == OSPF::RoutingTableEntry::Type2External) {
00152         metric = cost + type2Cost * 1000;
00153     } else {
00154         metric = cost;
00155     }
00156 }

Metric OSPF::RoutingTableEntry::GetType2Cost ( void   )  const [inline]

Referenced by operator<<().

00082 { return type2Cost; }

void OSPF::RoutingTableEntry::SetLinkStateOrigin ( const OSPFLSA *  lsa  )  [inline]

00083 { linkStateOrigin = lsa; }

const OSPFLSA* OSPF::RoutingTableEntry::GetLinkStateOrigin ( void   )  const [inline]

Referenced by operator<<().

00084 { return linkStateOrigin; }

void OSPF::RoutingTableEntry::AddNextHop ( OSPF::NextHop  hop  )  [inline]

00159 {
00160     if (nextHops.size() == 0) {
00161         InterfaceEntry*    routingInterface = InterfaceTableAccess().get()->getInterfaceById(hop.ifIndex);
00162 
00163         interfacePtr = routingInterface;
00164         //gateway = ULongFromIPv4Address(hop.hopAddress); // TODO: verify this isn't necessary
00165     }
00166     nextHops.push_back(hop);
00167 }

void OSPF::RoutingTableEntry::ClearNextHops ( void   )  [inline]

00086 { nextHops.clear(); }

unsigned int OSPF::RoutingTableEntry::GetNextHopCount ( void   )  const [inline]

Referenced by OSPF::Area::CreateRoutingTableEntryFromSummaryLSA(), and operator<<().

00087 { return nextHops.size(); }

NextHop OSPF::RoutingTableEntry::GetNextHop ( unsigned int  index  )  const [inline]

Referenced by OSPF::Area::CreateRoutingTableEntryFromSummaryLSA(), and operator<<().

00088 { return nextHops[index]; }


Member Data Documentation

const unsigned char OSPF::RoutingTableEntry::NetworkDestination = 0 [static]

const unsigned char OSPF::RoutingTableEntry::AreaBorderRouterDestination = 1 [static]

const unsigned char OSPF::RoutingTableEntry::ASBoundaryRouterDestination = 2 [static]

Referenced by GetArea(), operator==(), and SetArea().

const OSPFLSA* OSPF::RoutingTableEntry::linkStateOrigin [private]


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

Generated on Fri Mar 20 18:51:24 2009 for INET Framework for OMNeT++/OMNEST by  doxygen 1.5.5