INET Framework for OMNeT++/OMNEST
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 

Constructor & Destructor Documentation

OSPF::RoutingTableEntry::RoutingTableEntry ( void  ) [inline]
OSPF::RoutingTableEntry::RoutingTableEntry ( const RoutingTableEntry entry) [inline]
                                                                              :
    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]
{}

Member Function Documentation

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

Referenced by OSPF::Router::CalculateASExternalRoutes(), OSPF::Area::CalculateInterAreaRoutes(), OSPF::Area::CalculateShortestPathTree(), and OSPF::Area::ReCheckSummaryLSAs().

{
    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]
IPAddress OSPF::RoutingTableEntry::GetAddressMask ( void  ) const [inline]
const OSPFLSA* OSPF::RoutingTableEntry::GetLinkStateOrigin ( void  ) const [inline]
unsigned int OSPF::RoutingTableEntry::GetNextHopCount ( void  ) const [inline]
OSPFOptions OSPF::RoutingTableEntry::GetOptionalCapabilities ( void  ) const [inline]
Metric OSPF::RoutingTableEntry::GetType2Cost ( void  ) const [inline]
bool OSPF::RoutingTableEntry::operator!= ( const RoutingTableEntry entry) const [inline]
{ return (!((*this) == entry)); }
bool OSPF::RoutingTableEntry::operator== ( const RoutingTableEntry entry) const [inline]
{
    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]
void OSPF::RoutingTableEntry::SetArea ( AreaID  source) [inline]
void OSPF::RoutingTableEntry::SetCost ( Metric  pathCost) [inline]

Referenced by OSPF::Router::CalculateASExternalRoutes(), OSPF::Area::CalculateShortestPathTree(), and 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]
void OSPF::RoutingTableEntry::SetDestinationType ( RoutingDestinationType  type) [inline]
void OSPF::RoutingTableEntry::SetLinkStateOrigin ( const OSPFLSA *  lsa) [inline]
void OSPF::RoutingTableEntry::SetOptionalCapabilities ( OSPFOptions  options) [inline]
void OSPF::RoutingTableEntry::SetPathType ( RoutingPathType  type) [inline]

Referenced by OSPF::Router::CalculateASExternalRoutes(), OSPF::Area::CalculateShortestPathTree(), OSPFRouting::LoadExternalRoute(), and OSPF::Router::Lookup().

{
    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]

Referenced by OSPF::Router::CalculateASExternalRoutes(), and 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


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