#include <IPRoute.h>
Public Types | |
enum | RouteType { DIRECT, REMOTE } |
enum | RouteSource { MANUAL, IFACENETMASK, RIP, OSPF, BGP, ZEBRA } |
Public Member Functions | |
IPRoute () | |
virtual | ~IPRoute () |
virtual std::string | info () const |
virtual std::string | detailedInfo () const |
void | setHost (IPAddress host) |
void | setNetmask (IPAddress netmask) |
void | setGateway (IPAddress gateway) |
void | setInterface (InterfaceEntry *interfacePtr) |
void | setType (RouteType type) |
void | setSource (RouteSource source) |
void | setMetric (int metric) |
IPAddress | getHost () const |
IPAddress | getNetmask () const |
IPAddress | getGateway () const |
InterfaceEntry * | getInterface () const |
const char * | getInterfaceName () const |
RouteType | getType () const |
RouteSource | getSource () const |
int | getMetric () const |
Protected Attributes | |
IPAddress | host |
Destination. | |
IPAddress | netmask |
Route mask. | |
IPAddress | gateway |
Next hop. | |
InterfaceEntry * | interfacePtr |
interface | |
RouteType | type |
direct or remote | |
RouteSource | source |
manual, routing prot, etc. | |
int | metric |
Metric ("cost" to reach the destination). | |
Private Member Functions | |
IPRoute (const IPRoute &obj) | |
IPRoute & | operator= (const IPRoute &obj) |
enum IPRoute::RouteType |
enum IPRoute::RouteSource |
Specifies where the route comes from
IPRoute::IPRoute | ( | const IPRoute & | obj | ) | [private] |
IPRoute::IPRoute | ( | ) |
std::string IPRoute::info | ( | ) | const [virtual] |
Referenced by operator<<().
00035 { 00036 std::stringstream out; 00037 out << "dest:"; if (host.isUnspecified()) out << "* "; else out << host << " "; 00038 out << "gw:"; if (gateway.isUnspecified()) out << "* "; else out << gateway << " "; 00039 out << "mask:"; if (netmask.isUnspecified()) out << "* "; else out << netmask << " "; 00040 out << "metric:" << metric << " "; 00041 out << "if:"; if (!interfacePtr) out << "* "; else out << interfacePtr->getName() << " "; 00042 out << (type==DIRECT ? "DIRECT" : "REMOTE"); 00043 switch (source) 00044 { 00045 case MANUAL: out << " MANUAL"; break; 00046 case IFACENETMASK: out << " IFACENETMASK"; break; 00047 case RIP: out << " RIP"; break; 00048 case OSPF: out << " OSPF"; break; 00049 case BGP: out << " BGP"; break; 00050 case ZEBRA: out << " ZEBRA"; break; 00051 default: out << " ???"; break; 00052 } 00053 return out.str(); 00054 }
std::string IPRoute::detailedInfo | ( | ) | const [virtual] |
void IPRoute::setHost | ( | IPAddress | host | ) | [inline] |
Referenced by NetworkConfigurator::addDefaultRoutes(), FlatNetworkConfigurator::addDefaultRoutes(), NetworkConfigurator::addPointToPointPeerRoutes(), FlatNetworkConfigurator::fillRoutingTables(), RoutingTableParser::parseRouting(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
void IPRoute::setNetmask | ( | IPAddress | netmask | ) | [inline] |
Referenced by NetworkConfigurator::addDefaultRoutes(), FlatNetworkConfigurator::addDefaultRoutes(), NetworkConfigurator::addPointToPointPeerRoutes(), FlatNetworkConfigurator::fillRoutingTables(), RoutingTableParser::parseRouting(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
void IPRoute::setGateway | ( | IPAddress | gateway | ) | [inline] |
void IPRoute::setInterface | ( | InterfaceEntry * | interfacePtr | ) | [inline] |
Referenced by NetworkConfigurator::addDefaultRoutes(), FlatNetworkConfigurator::addDefaultRoutes(), NetworkConfigurator::addPointToPointPeerRoutes(), FlatNetworkConfigurator::fillRoutingTables(), RoutingTableParser::parseRouting(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
void IPRoute::setType | ( | RouteType | type | ) | [inline] |
Referenced by NetworkConfigurator::addDefaultRoutes(), FlatNetworkConfigurator::addDefaultRoutes(), NetworkConfigurator::addPointToPointPeerRoutes(), FlatNetworkConfigurator::fillRoutingTables(), RoutingTableParser::parseRouting(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
void IPRoute::setSource | ( | RouteSource | source | ) | [inline] |
Referenced by NetworkConfigurator::addDefaultRoutes(), FlatNetworkConfigurator::addDefaultRoutes(), NetworkConfigurator::addPointToPointPeerRoutes(), FlatNetworkConfigurator::fillRoutingTables(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
void IPRoute::setMetric | ( | int | metric | ) | [inline] |
IPAddress IPRoute::getHost | ( | ) | const [inline] |
Destination address prefix to match
Referenced by RoutingTable::addRoute(), NetworkInfo::dumpRoutingInfo(), RoutingTable::findBestMatchingRoute(), LDP::findPeerAddrFromInterface(), RoutingTable::getMulticastRoutesFor(), TED::initialize(), LDP::rebuildFecList(), TED::rebuildRoutingTable(), RoutingTable::routeMatches(), and OSPF::Router::UpdateExternalRoute().
00083 {return host;}
IPAddress IPRoute::getNetmask | ( | ) | const [inline] |
Represents length of prefix to match
Referenced by RoutingTable::addRoute(), NetworkInfo::dumpRoutingInfo(), RoutingTable::findBestMatchingRoute(), RoutingTable::getMulticastRoutesFor(), LDP::rebuildFecList(), RoutingTable::routeMatches(), and OSPF::Router::UpdateExternalRoute().
00086 {return netmask;}
IPAddress IPRoute::getGateway | ( | ) | const [inline] |
Next hop address
Referenced by NetworkInfo::dumpRoutingInfo(), RoutingTable::getMulticastRoutesFor(), TED::initialize(), LDP::rebuildFecList(), TED::rebuildRoutingTable(), RoutingTable::routeMatches(), and IP::routePacket().
00089 {return gateway;}
InterfaceEntry* IPRoute::getInterface | ( | ) | const [inline] |
Next hop interface
Referenced by RoutingTable::addRoute(), RoutingTable::deleteInterfaceRoutes(), NetworkInfo::dumpRoutingInfo(), LDP::findPeerAddrFromInterface(), RoutingTable::getMulticastRoutesFor(), TED::initialize(), and IP::routePacket().
00092 {return interfacePtr;}
const char * IPRoute::getInterfaceName | ( | ) | const |
Convenience method
Referenced by NetworkInfo::dumpRoutingInfo(), TED::rebuildRoutingTable(), and RoutingTable::routeMatches().
00062 { 00063 return interfacePtr ? interfacePtr->getName() : ""; 00064 }
RouteType IPRoute::getType | ( | ) | const [inline] |
Route type: Direct or Remote
Referenced by TED::initialize(), and LDP::rebuildFecList().
00098 {return type;}
RouteSource IPRoute::getSource | ( | ) | const [inline] |
Source of route. MANUAL (read from file), from routing protocol, etc
Referenced by NetworkInfo::dumpRoutingInfo().
00101 {return source;}
int IPRoute::getMetric | ( | ) | const [inline] |
"Cost" to reach the destination
Referenced by NetworkInfo::dumpRoutingInfo(), and RoutingTable::routeMatches().
00104 {return metric;}
IPAddress IPRoute::host [protected] |
IPAddress IPRoute::netmask [protected] |
IPAddress IPRoute::gateway [protected] |
InterfaceEntry* IPRoute::interfacePtr [protected] |
interface
Referenced by OSPF::RoutingTableEntry::AddNextHop(), getInterfaceName(), info(), IPRoute(), and OSPF::RoutingTableEntry::RoutingTableEntry().
RouteType IPRoute::type [protected] |
RouteSource IPRoute::source [protected] |
manual, routing prot, etc.
Referenced by info(), IPRoute(), and OSPF::RoutingTableEntry::RoutingTableEntry().
int IPRoute::metric [protected] |
Metric ("cost" to reach the destination).
Referenced by info(), IPRoute(), OSPF::RoutingTableEntry::RoutingTableEntry(), OSPF::RoutingTableEntry::SetCost(), OSPF::RoutingTableEntry::SetPathType(), and OSPF::RoutingTableEntry::SetType2Cost().