#include <OSPFRoutingTableEntry.h>
typedef unsigned char OSPF::RoutingTableEntry::RoutingDestinationType |
00031 { 00032 IntraArea = 0, 00033 InterArea = 1, 00034 Type1External = 2, 00035 Type2External = 3 00036 };
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 }
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] |
void OSPF::RoutingTableEntry::SetDestinationType | ( | RoutingDestinationType | type | ) | [inline] |
RoutingDestinationType OSPF::RoutingTableEntry::GetDestinationType | ( | void | ) | const [inline] |
Referenced by OSPF::Area::FindSameOrWorseCostRoute(), operator<<(), and OSPF::Area::OriginateSummaryLSA().
00068 { return destinationType; }
void OSPF::RoutingTableEntry::SetDestinationID | ( | IPAddress | destID | ) | [inline] |
IPAddress OSPF::RoutingTableEntry::GetDestinationID | ( | void | ) | const [inline] |
Referenced by OSPF::Area::FindSameOrWorseCostRoute(), operator<<(), and OSPF::Area::OriginateSummaryLSA().
00070 { return host; }
void OSPF::RoutingTableEntry::SetAddressMask | ( | IPAddress | destMask | ) | [inline] |
IPAddress OSPF::RoutingTableEntry::GetAddressMask | ( | void | ) | const [inline] |
void OSPF::RoutingTableEntry::SetOptionalCapabilities | ( | OSPFOptions | options | ) | [inline] |
OSPFOptions OSPF::RoutingTableEntry::GetOptionalCapabilities | ( | void | ) | const [inline] |
AreaID OSPF::RoutingTableEntry::GetArea | ( | void | ) | const [inline] |
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] |
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] |
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] |
void OSPF::RoutingTableEntry::SetLinkStateOrigin | ( | const OSPFLSA * | lsa | ) | [inline] |
const OSPFLSA* OSPF::RoutingTableEntry::GetLinkStateOrigin | ( | void | ) | const [inline] |
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] |
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]; }
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 GetDestinationType(), operator==(), and SetDestinationType().
OSPFOptions OSPF::RoutingTableEntry::optionalCapabilities [private] |
Referenced by GetOptionalCapabilities(), operator==(), RoutingTableEntry(), and SetOptionalCapabilities().
AreaID OSPF::RoutingTableEntry::area [private] |
Referenced by GetArea(), operator==(), and SetArea().
Referenced by GetPathType(), operator==(), SetCost(), SetPathType(), and SetType2Cost().
Metric OSPF::RoutingTableEntry::cost [private] |
Referenced by GetCost(), operator==(), SetCost(), SetPathType(), and SetType2Cost().
Metric OSPF::RoutingTableEntry::type2Cost [private] |
Referenced by GetType2Cost(), operator==(), SetCost(), SetPathType(), and SetType2Cost().
const OSPFLSA* OSPF::RoutingTableEntry::linkStateOrigin [private] |
Referenced by GetLinkStateOrigin(), operator==(), and SetLinkStateOrigin().
std::vector<NextHop> OSPF::RoutingTableEntry::nextHops [private] |
Referenced by AddNextHop(), ClearNextHops(), GetNextHop(), GetNextHopCount(), and operator==().