Public Types | Public Member Functions | Static Public Attributes | Private Attributes

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

Detailed Description

Definition at line 28 of file OSPFRoutingTableEntry.h.


Member Typedef Documentation

Definition at line 38 of file OSPFRoutingTableEntry.h.


Member Enumeration Documentation

Enumerator:
IntraArea 
InterArea 
Type1External 
Type2External 

Definition at line 31 of file OSPFRoutingTableEntry.h.


Constructor & Destructor Documentation

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

Definition at line 106 of file OSPFRoutingTableEntry.h.

                                                                              :
    destinationType(entry.destinationType),
    optionalCapabilities(entry.optionalCapabilities),
    area(entry.area),
    pathType(entry.pathType),
    cost(entry.cost),
    type2Cost(entry.type2Cost),
    linkStateOrigin(entry.linkStateOrigin),
    nextHops(entry.nextHops)
{
    host          = entry.host;
    netmask       = entry.netmask;
    gateway       = entry.gateway;
    interfacePtr  = entry.interfacePtr;
    type          = entry.type;
    source        = entry.source;
    metric        = entry.metric;
}

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

Definition at line 62 of file OSPFRoutingTableEntry.h.

{}


Member Function Documentation

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

Definition at line 158 of file OSPFRoutingTableEntry.h.

{
    if (nextHops.size() == 0) {
        InterfaceEntry*    routingInterface = InterfaceTableAccess().get()->getInterfaceById(hop.ifIndex);

        interfacePtr = routingInterface;
        //gateway = ULongFromIPv4Address(hop.hopAddress); // TODO: verify this isn't necessary
    }
    nextHops.push_back(hop);
}

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

Definition at line 86 of file OSPFRoutingTableEntry.h.

{ nextHops.clear(); }

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

Definition at line 72 of file OSPFRoutingTableEntry.h.

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

{ return netmask; }

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

Definition at line 76 of file OSPFRoutingTableEntry.h.

Referenced by operator<<().

{ return area; }

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

Definition at line 80 of file OSPFRoutingTableEntry.h.

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

{ return cost; }

IPAddress OSPF::RoutingTableEntry::GetDestinationID ( void   )  const [inline]
RoutingDestinationType OSPF::RoutingTableEntry::GetDestinationType ( void   )  const [inline]
const OSPFLSA* OSPF::RoutingTableEntry::GetLinkStateOrigin ( void   )  const [inline]

Definition at line 84 of file OSPFRoutingTableEntry.h.

Referenced by operator<<().

{ return linkStateOrigin; }

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

Definition at line 88 of file OSPFRoutingTableEntry.h.

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

{ return nextHops[index]; }

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

Definition at line 87 of file OSPFRoutingTableEntry.h.

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

{ return nextHops.size(); }

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

Definition at line 74 of file OSPFRoutingTableEntry.h.

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

Definition at line 78 of file OSPFRoutingTableEntry.h.

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

{ return pathType; }

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

Definition at line 82 of file OSPFRoutingTableEntry.h.

Referenced by operator<<().

{ return type2Cost; }

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

Definition at line 65 of file OSPFRoutingTableEntry.h.

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

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

Definition at line 169 of file OSPFRoutingTableEntry.h.

{
    unsigned int hopCount = nextHops.size();
    unsigned int i        = 0;

    if (hopCount != entry.nextHops.size()) {
        return false;
    }
    for (i = 0; i < hopCount; i++) {
        if ((nextHops[i] != entry.nextHops[i]))
        {
            return false;
        }
    }

    return ((destinationType      == entry.destinationType)      &&
            (host                 == entry.host)                 &&
            (netmask              == entry.netmask)              &&
            (optionalCapabilities == entry.optionalCapabilities) &&
            (area                 == entry.area)                 &&
            (pathType             == entry.pathType)             &&
            (cost                 == entry.cost)                 &&
            (type2Cost            == entry.type2Cost)            &&
            (linkStateOrigin      == entry.linkStateOrigin));
}

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

Definition at line 71 of file OSPFRoutingTableEntry.h.

{ netmask = destMask; }

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

Definition at line 75 of file OSPFRoutingTableEntry.h.

{ area = source; }

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

Definition at line 136 of file OSPFRoutingTableEntry.h.

Referenced by OSPFRouting::LoadExternalRoute().

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

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

Definition at line 69 of file OSPFRoutingTableEntry.h.

{ host = destID; }

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

Definition at line 67 of file OSPFRoutingTableEntry.h.

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

Definition at line 83 of file OSPFRoutingTableEntry.h.

{ linkStateOrigin = lsa; }

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

Definition at line 73 of file OSPFRoutingTableEntry.h.

{ optionalCapabilities = options; }

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

Definition at line 125 of file OSPFRoutingTableEntry.h.

Referenced by OSPFRouting::LoadExternalRoute().

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

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

Definition at line 147 of file OSPFRoutingTableEntry.h.

Referenced by OSPFRouting::LoadExternalRoute().

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


Member Data Documentation

Definition at line 50 of file OSPFRoutingTableEntry.h.

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

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

Definition at line 54 of file OSPFRoutingTableEntry.h.

Referenced by GetLinkStateOrigin(), operator==(), and SetLinkStateOrigin().


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