Public Types | Public Member Functions | Protected Attributes | Private Member Functions

IPRoute Class Reference

#include <IPRoute.h>

Inheritance diagram for IPRoute:
OSPF::RoutingTableEntry

List of all members.

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
InterfaceEntrygetInterface () 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.
InterfaceEntryinterfacePtr
 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)
IPRouteoperator= (const IPRoute &obj)

Detailed Description

IPv4 route in IRoutingTable.

See also:
IRoutingTable, IRoutingTable

Definition at line 33 of file IPRoute.h.


Member Enumeration Documentation

Specifies where the route comes from

Enumerator:
MANUAL 

manually added static route

IFACENETMASK 

comes from an interface's netmask

RIP 

managed by the given routing protocol

OSPF 

managed by the given routing protocol

BGP 

managed by the given routing protocol

ZEBRA 

managed by the Quagga/Zebra based model

Definition at line 44 of file IPRoute.h.

    {
        MANUAL,       
        IFACENETMASK, 
        RIP,          
        OSPF,         
        BGP,          
        ZEBRA,        
    };

Route type

Enumerator:
DIRECT 

Directly attached to the router.

REMOTE 

Reached through another router.

Definition at line 37 of file IPRoute.h.

    {
        DIRECT,  
        REMOTE   
    };


Constructor & Destructor Documentation

IPRoute::IPRoute ( const IPRoute obj  )  [private]
IPRoute::IPRoute (  ) 

Definition at line 25 of file IPRoute.cc.

{
    interfacePtr = NULL;

    metric = 0;
    type = DIRECT;
    source = MANUAL;
}

virtual IPRoute::~IPRoute (  )  [inline, virtual]

Definition at line 70 of file IPRoute.h.

{}


Member Function Documentation

std::string IPRoute::detailedInfo (  )  const [virtual]

Definition at line 56 of file IPRoute.cc.

Referenced by RoutingTable::printRoutingTable().

{
    return std::string();
}

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;}

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();
}

IPRoute& IPRoute::operator= ( const IPRoute obj  )  [private]
void IPRoute::setGateway ( IPAddress  gateway  )  [inline]
void IPRoute::setMetric ( int  metric  )  [inline]

Member Data Documentation

Next hop.

Definition at line 57 of file IPRoute.h.

Referenced by info(), and OSPF::RoutingTableEntry::RoutingTableEntry().

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().


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