xorp

OriginTable< A > Class Template Reference

RouteTable that receives and stores raw routes sent by routing protocols. More...

#include <rt_tab_origin.hh>

Inheritance diagram for OriginTable< A >:
RouteTable< A >

List of all members.

Public Types

typedef Trie< A, const
IPRouteEntry< A > * > 
RouteContainer

Public Member Functions

 OriginTable (const string &tablename, uint32_t admin_distance, ProtocolType protocol_type, EventLoop &eventloop)
 OriginTable constructor.
 ~OriginTable ()
 OriginTable destructor.
int add_route (const IPRouteEntry< A > &route)
 Add a route to the OriginTable.
int add_route (const IPRouteEntry< A > &, RouteTable< A > *)
 Generic RouteTable method that is not used on OriginTable.
int delete_route (const IPNet< A > &net)
 Delete a route from the OriginTable.
int delete_route (const IPRouteEntry< A > *, RouteTable< A > *)
 Generic RouteTable method that is not used on OriginTable.
void delete_all_routes ()
 Delete all the routes that are in this OriginTable.
void routing_protocol_shutdown ()
 Delete all the routes that are in this OriginTable, and propagate the deletions downstream.
const IPRouteEntry< A > * lookup_route (const IPNet< A > &net) const
 Lookup a specific subnet to see if it is in this OriginTable.
const IPRouteEntry< A > * lookup_route (const A &addr) const
 Lookup an IP address to get the most specific (longest prefix length) route in the OriginTable that matches this address.
RouteRange< A > * lookup_route_range (const A &addr) const
 Lookup an IP addressto get the most specific (longest prefix length) route in the OriginTable that matches this address, along with the RouteRange information for this address and route.
uint32_t admin_distance () const
int protocol_type () const
TableType type () const
void replumb (RouteTable< A > *, RouteTable< A > *)
 Generic RouteTable method that is not used on OriginTable.
string str () const
 Render the OriginTable as a string for debugging purposes.
uint32_t generation () const
 Get the number of times routing protocol has been shutdown and restarted.
uint32_t route_count () const
 Get the number of routes held internally.
const RouteContainerroute_container () const
 Get the trie.

Private Attributes

uint32_t _admin_distance
ProtocolType _protocol_type
EventLoop_eventloop
RouteContainer_ip_route_table
uint32_t _gen

Detailed Description

template<class A>
class OriginTable< A >

RouteTable that receives and stores raw routes sent by routing protocols.

OriginTable is a RouteTable that accepts route_add requests from a single routing protocol, stores the route, and propagates it downstream. It also answers lookup_route and lookup_route_range requests from downstream using the routes it has stored.

Its template class, A, must be either the IPv4 class of the IPv6 class.


Constructor & Destructor Documentation

template<class A >
OriginTable< A >::OriginTable ( const string &  tablename,
uint32_t  admin_distance,
ProtocolType  protocol_type,
EventLoop eventloop 
)

OriginTable constructor.

Parameters:
tablenametypically the name of the routing protocol that supplies routes to this origin table, or "connected" for the OriginTable that holds directly connected routes, or "static" for the OriginTable that holds locally configured static routes.
admin_distancethe default administrative distance for routes in this table.
protocol_typethe routing protocol type (ProtocolType).
eventloopthe main event loop.

Member Function Documentation

template<class A >
int OriginTable< A >::add_route ( const IPRouteEntry< A > &  route)

Add a route to the OriginTable.

The route must not already be in the OriginTable.

Parameters:
routethe route entry to be added.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
template<class A >
int OriginTable< A >::add_route ( const IPRouteEntry< A > &  ,
RouteTable< A > *   
) [virtual]

Generic RouteTable method that is not used on OriginTable.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements RouteTable< A >.

template<class A>
uint32_t OriginTable< A >::admin_distance ( ) const [inline]
Returns:
the default administrative distance for this OriginTable
template<class A >
void OriginTable< A >::delete_all_routes ( )

Delete all the routes that are in this OriginTable.

The deletion is not propagated downstream, so this is only useful when shutting down the RIB.

template<class A >
int OriginTable< A >::delete_route ( const IPRouteEntry< A > *  ,
RouteTable< A > *   
) [virtual]

Generic RouteTable method that is not used on OriginTable.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements RouteTable< A >.

template<class A >
int OriginTable< A >::delete_route ( const IPNet< A > &  net)

Delete a route from the OriginTable.

Parameters:
netthe subnet of the route entry to be deleted.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
template<class A >
const IPRouteEntry< A > * OriginTable< A >::lookup_route ( const IPNet< A > &  net) const [virtual]

Lookup a specific subnet to see if it is in this OriginTable.

Parameters:
netthe subnet to look up.
Returns:
a pointer to the route entry if it exists, NULL otherwise.

Implements RouteTable< A >.

template<class A >
const IPRouteEntry< A > * OriginTable< A >::lookup_route ( const A &  addr) const [virtual]

Lookup an IP address to get the most specific (longest prefix length) route in the OriginTable that matches this address.

Parameters:
addrthe IP address to look up.
Returns:
a pointer to the most specific route entry if any entry matches, NULL otherwise.

Implements RouteTable< A >.

template<class A >
RouteRange< A > * OriginTable< A >::lookup_route_range ( const A &  addr) const [virtual]

Lookup an IP addressto get the most specific (longest prefix length) route in the OriginTable that matches this address, along with the RouteRange information for this address and route.

See also:
RouteRange
Parameters:
addrthe IP address to look up.
Returns:
a pointer to a RouteRange class instance containing the relevant answer. It is up to the recipient of this pointer to free the associated memory.

Implements RouteTable< A >.

template<class A>
int OriginTable< A >::protocol_type ( ) const [inline]
Returns:
the routing protocol type (ProtocolType).
template<class A>
TableType OriginTable< A >::type ( ) const [inline, virtual]
Returns:
the table type (TableType).

Implements RouteTable< A >.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations