#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) |
IPv4 route in IRoutingTable.
Definition at line 33 of file IPRoute.h.
enum IPRoute::RouteSource |
Specifies where the route comes from
Definition at line 44 of file IPRoute.h.
{ MANUAL, IFACENETMASK, RIP, OSPF, BGP, ZEBRA, };
enum IPRoute::RouteType |
IPRoute::IPRoute | ( | const IPRoute & | obj | ) | [private] |
IPRoute::IPRoute | ( | ) |
Definition at line 25 of file IPRoute.cc.
{ interfacePtr = NULL; metric = 0; type = DIRECT; source = MANUAL; }
std::string IPRoute::detailedInfo | ( | ) | const [virtual] |
Definition at line 56 of file IPRoute.cc.
Referenced by RoutingTable::printRoutingTable().
{
return std::string();
}
IPAddress IPRoute::getGateway | ( | ) | const [inline] |
Next hop address
Definition at line 89 of file IPRoute.h.
Referenced by NetworkInfo::dumpRoutingInfo(), RoutingTable::getMulticastRoutesFor(), TED::initialize(), LDP::rebuildFecList(), TED::rebuildRoutingTable(), RoutingTable::routeMatches(), and IP::routePacket().
{return gateway;}
IPAddress IPRoute::getHost | ( | ) | const [inline] |
Destination address prefix to match
Definition at line 83 of file IPRoute.h.
Referenced by RoutingTable::addRoute(), NetworkInfo::dumpRoutingInfo(), RoutingTable::findBestMatchingRoute(), LDP::findPeerAddrFromInterface(), RoutingTable::getMulticastRoutesFor(), TED::initialize(), LDP::rebuildFecList(), TED::rebuildRoutingTable(), RoutingTable::routeMatches(), and OSPF::Router::UpdateExternalRoute().
{return host;}
InterfaceEntry* IPRoute::getInterface | ( | ) | const [inline] |
Next hop interface
Definition at line 92 of file IPRoute.h.
Referenced by RoutingTable::addRoute(), RoutingTable::deleteInterfaceRoutes(), NetworkInfo::dumpRoutingInfo(), LDP::findPeerAddrFromInterface(), RoutingTable::getMulticastRoutesFor(), TED::initialize(), and IP::routePacket().
{return interfacePtr;}
const char * IPRoute::getInterfaceName | ( | ) | const |
Convenience method
Definition at line 61 of file IPRoute.cc.
Referenced by NetworkInfo::dumpRoutingInfo(), TED::rebuildRoutingTable(), and RoutingTable::routeMatches().
{ return interfacePtr ? interfacePtr->getName() : ""; }
int IPRoute::getMetric | ( | ) | const [inline] |
"Cost" to reach the destination
Definition at line 104 of file IPRoute.h.
Referenced by NetworkInfo::dumpRoutingInfo(), and RoutingTable::routeMatches().
{return metric;}
IPAddress IPRoute::getNetmask | ( | ) | const [inline] |
Represents length of prefix to match
Definition at line 86 of file IPRoute.h.
Referenced by RoutingTable::addRoute(), NetworkInfo::dumpRoutingInfo(), RoutingTable::findBestMatchingRoute(), RoutingTable::getMulticastRoutesFor(), LDP::rebuildFecList(), RoutingTable::routeMatches(), and OSPF::Router::UpdateExternalRoute().
{return netmask;}
RouteSource IPRoute::getSource | ( | ) | const [inline] |
Source of route. MANUAL (read from file), from routing protocol, etc
Definition at line 101 of file IPRoute.h.
Referenced by NetworkInfo::dumpRoutingInfo().
{return source;}
RouteType IPRoute::getType | ( | ) | const [inline] |
Route type: Direct or Remote
Definition at line 98 of file IPRoute.h.
Referenced by TED::initialize(), and LDP::rebuildFecList().
{return type;}
std::string IPRoute::info | ( | ) | const [virtual] |
Definition at line 34 of file IPRoute.cc.
Referenced by operator<<().
{ std::stringstream out; out << "dest:"; if (host.isUnspecified()) out << "* "; else out << host << " "; out << "gw:"; if (gateway.isUnspecified()) out << "* "; else out << gateway << " "; out << "mask:"; if (netmask.isUnspecified()) out << "* "; else out << netmask << " "; out << "metric:" << metric << " "; out << "if:"; if (!interfacePtr) out << "* "; else out << interfacePtr->getName() << " "; out << (type==DIRECT ? "DIRECT" : "REMOTE"); switch (source) { case MANUAL: out << " MANUAL"; break; case IFACENETMASK: out << " IFACENETMASK"; break; case RIP: out << " RIP"; break; case OSPF: out << " OSPF"; break; case BGP: out << " BGP"; break; case ZEBRA: out << " ZEBRA"; break; default: out << " ???"; break; } return out.str(); }
void IPRoute::setGateway | ( | IPAddress | gateway | ) | [inline] |
Definition at line 76 of file IPRoute.h.
Referenced by NetworkConfigurator::addPointToPointPeerRoutes(), RoutingTableParser::parseRouting(), TED::rebuildRoutingTable(), and RoutingTable::updateNetmaskRoutes().
{this->gateway = gateway;}
void IPRoute::setHost | ( | IPAddress | host | ) | [inline] |
Definition at line 74 of file IPRoute.h.
Referenced by NetworkConfigurator::addDefaultRoutes(), FlatNetworkConfigurator::addDefaultRoutes(), NetworkConfigurator::addPointToPointPeerRoutes(), FlatNetworkConfigurator::fillRoutingTables(), RoutingTableParser::parseRouting(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
{this->host = host;}
void IPRoute::setInterface | ( | InterfaceEntry * | interfacePtr | ) | [inline] |
Definition at line 77 of file IPRoute.h.
Referenced by NetworkConfigurator::addDefaultRoutes(), FlatNetworkConfigurator::addDefaultRoutes(), NetworkConfigurator::addPointToPointPeerRoutes(), FlatNetworkConfigurator::fillRoutingTables(), RoutingTableParser::parseRouting(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
{this->interfacePtr = interfacePtr;}
void IPRoute::setMetric | ( | int | metric | ) | [inline] |
Definition at line 80 of file IPRoute.h.
Referenced by RoutingTableParser::parseRouting(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
void IPRoute::setNetmask | ( | IPAddress | netmask | ) | [inline] |
Definition at line 75 of file IPRoute.h.
Referenced by NetworkConfigurator::addDefaultRoutes(), FlatNetworkConfigurator::addDefaultRoutes(), NetworkConfigurator::addPointToPointPeerRoutes(), FlatNetworkConfigurator::fillRoutingTables(), RoutingTableParser::parseRouting(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
{this->netmask = netmask;}
void IPRoute::setSource | ( | RouteSource | source | ) | [inline] |
Definition at line 79 of file IPRoute.h.
Referenced by NetworkConfigurator::addDefaultRoutes(), FlatNetworkConfigurator::addDefaultRoutes(), NetworkConfigurator::addPointToPointPeerRoutes(), FlatNetworkConfigurator::fillRoutingTables(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
void IPRoute::setType | ( | RouteType | type | ) | [inline] |
Definition at line 78 of file IPRoute.h.
Referenced by NetworkConfigurator::addDefaultRoutes(), FlatNetworkConfigurator::addDefaultRoutes(), NetworkConfigurator::addPointToPointPeerRoutes(), FlatNetworkConfigurator::fillRoutingTables(), RoutingTableParser::parseRouting(), TED::rebuildRoutingTable(), OSPF::Router::UpdateExternalRoute(), and RoutingTable::updateNetmaskRoutes().
IPAddress IPRoute::gateway [protected] |
Next hop.
Definition at line 57 of file IPRoute.h.
Referenced by info(), and OSPF::RoutingTableEntry::RoutingTableEntry().
IPAddress IPRoute::host [protected] |
Destination.
Definition at line 55 of file IPRoute.h.
Referenced by OSPF::RoutingTableEntry::GetDestinationID(), info(), OSPF::RoutingTableEntry::operator==(), OSPF::RoutingTableEntry::RoutingTableEntry(), and OSPF::RoutingTableEntry::SetDestinationID().
InterfaceEntry* IPRoute::interfacePtr [protected] |
interface
Definition at line 58 of file IPRoute.h.
Referenced by OSPF::RoutingTableEntry::AddNextHop(), getInterfaceName(), info(), IPRoute(), and OSPF::RoutingTableEntry::RoutingTableEntry().
int IPRoute::metric [protected] |
Metric ("cost" to reach the destination).
Definition at line 61 of file IPRoute.h.
Referenced by info(), IPRoute(), OSPF::RoutingTableEntry::RoutingTableEntry(), OSPF::RoutingTableEntry::SetCost(), OSPF::RoutingTableEntry::SetPathType(), and OSPF::RoutingTableEntry::SetType2Cost().
IPAddress IPRoute::netmask [protected] |
Route mask.
Definition at line 56 of file IPRoute.h.
Referenced by OSPF::RoutingTableEntry::GetAddressMask(), info(), OSPF::RoutingTableEntry::operator==(), OSPF::RoutingTableEntry::RoutingTableEntry(), and OSPF::RoutingTableEntry::SetAddressMask().
RouteSource IPRoute::source [protected] |
manual, routing prot, etc.
Definition at line 60 of file IPRoute.h.
Referenced by info(), IPRoute(), and OSPF::RoutingTableEntry::RoutingTableEntry().
RouteType IPRoute::type [protected] |
direct or remote
Definition at line 59 of file IPRoute.h.
Referenced by info(), IPRoute(), and OSPF::RoutingTableEntry::RoutingTableEntry().