xorp

RouteDB< A > Class Template Reference

Class that manages routes. More...

#include <route_db.hh>

Inheritance diagram for RouteDB< A >:
NONCOPYABLE

List of all members.

Public Types

typedef A Addr
typedef IPNet< A > Net
typedef RouteEntry< A > Route
typedef RouteEntryOrigin< A > RouteOrigin
typedef RouteEntryRef< A > DBRouteEntry
typedef RouteEntryRef< A > ConstDBRouteEntry
typedef PacketRouteEntry< A > PacketizedRoute
typedef map< Net, DBRouteEntry,
NetCmp< A > > 
RouteContainer
typedef map< Net, Route
*, NetCmp< A > > 
RouteContainerNoRef

Public Member Functions

 RouteDB (EventLoop &e, PolicyFilters &pfs)
bool insert_peer (Peer< A > *peer)
 Insert a peer to the database.
bool erase_peer (Peer< A > *peer)
 Erase a peer from the database.
bool update_route (const Net &net, const Addr &nexthop, const string &ifname, const string &vifname, uint32_t cost, uint32_t tag, RouteOrigin *origin, const PolicyTags &policytags, bool is_policy_push)
 Update Route Entry in database for specified route.
void add_rib_route (const Net &net, const Addr &nexthop, const string &ifname, const string &vifname, uint32_t cost, uint32_t tag, RouteOrigin *origin, const PolicyTags &policytags)
 A copy of RIB routes need to be kept, as they are not advertised periodically.
void delete_rib_route (const Net &net)
 Permanently delete a RIB route.
void dump_routes (vector< ConstDBRouteEntry > &routes)
 Flatten route entry collection into a Vector.
void flush_routes ()
 Flush routes.
uint32_t route_count () const
const Routefind_route (const Net &n) const
UpdateQueue< A > & update_queue ()
 Accessor.
const UpdateQueue< A > & update_queue () const
 Accessor.
EventLoopeventloop ()
void push_routes ()
 Push routes through policy filters for re-filtering.
bool do_filtering (Route *r)
 Do policy filtering.
Tracetrace ()

Protected Member Functions

void expire_route (Route *r)
void set_expiry_timer (Route *r)
void delete_route (Route *r)
void set_deletion_timer (Route *r)
RouteContainer & routes ()

Protected Attributes

EventLoop_eventloop
RouteContainer _routes
UpdateQueue< A > * _uq
PolicyFilters_policy_filters
set< Peer< A > * > _peers
RouteContainerNoRef _rib_routes
RouteOrigin_rib_origin

Private Attributes

Trace _trace

Friends

class RouteWalker< A >

Detailed Description

template<typename A>
class RouteDB< A >

Class that manages routes.

The RouteDB class holds routes and manages their updates. Successful updates are placed in the update queue contained within the RouteDB instance. The UpdateQueue is used for generating triggered update messages.

The RouteWalker class provides a way to walk the routes held.


Member Function Documentation

template<typename A >
void RouteDB< A >::add_rib_route ( const Net net,
const Addr &  nexthop,
const string &  ifname,
const string &  vifname,
uint32_t  cost,
uint32_t  tag,
RouteOrigin origin,
const PolicyTags policytags 
)

A copy of RIB routes need to be kept, as they are not advertised periodically.

If a RIB route gets replaced with a better route from another peer, it will be lost. By storing RIB routes, it is possible to re-advertise RIB routes which have lost, but are now optimal.

Parameters:
netnetwork of the route being added.
nexthopthe corresponding nexthop address.
ifnamethe corresponding interface name toward the destination.
vifnamethe corresponding vif name toward the destination.
costthe corresponding metric value.
thecorresponding route tag.
originthe route originator [RIB in this case].
policytagsthe policytags of this route.
template<typename A >
void RouteDB< A >::delete_rib_route ( const Net net)

Permanently delete a RIB route.

This occurs if redistribution of this route ceased.

Parameters:
netnetwork of the route being deleted.
template<typename A >
bool RouteDB< A >::do_filtering ( Route r)

Do policy filtering.

Parameters:
rroute to filter.
Returns:
true if route was accepted, false otherwise.
template<typename A >
void RouteDB< A >::dump_routes ( vector< ConstDBRouteEntry > &  routes)

Flatten route entry collection into a Vector.

Parameters:
routesvector where routes are to be appended.
template<typename A>
bool RouteDB< A >::erase_peer ( Peer< A > *  peer)

Erase a peer from the database.

Parameters:
peerthe peer to erase.
Returns:
true if this is an existing peer that was erased, otherwise false.
template<typename A>
const Route* RouteDB< A >::find_route ( const Net n) const
Returns:
pointer to route entry if it exists, 0 otherwise.
template<typename A>
bool RouteDB< A >::insert_peer ( Peer< A > *  peer)

Insert a peer to the database.

Parameters:
peerthe peer to insert.
Returns:
true if this is a new peer, otherwise false.
template<typename A >
uint32_t RouteDB< A >::route_count ( ) const
Returns:
count of routes in database.
template<typename A >
const UpdateQueue< A > & RouteDB< A >::update_queue ( ) const

Accessor.

Returns:
const reference to UpdateQueue.
template<typename A >
UpdateQueue< A > & RouteDB< A >::update_queue ( )

Accessor.

Returns:
reference to UpdateQueue.
template<typename A >
bool RouteDB< A >::update_route ( const Net net,
const Addr &  nexthop,
const string &  ifname,
const string &  vifname,
uint32_t  cost,
uint32_t  tag,
RouteOrigin origin,
const PolicyTags policytags,
bool  is_policy_push 
)

Update Route Entry in database for specified route.

If the route does not exist or the values provided differ from the existing route, then an update is placed in the update queue.

Parameters:
netthe network route being updated.
nexthopthe corresponding nexthop address.
ifnamethe corresponding interface name toward the destination.
vifnamethe corresponding vif name toward the destination.
costthe corresponding metric value as received from the route originator.
tagthe corresponding route tag.
originthe route originator proposing update.
policytagsthe policytags of this route.
is_policy_pushif true, this route update is triggered by policy reconfiguration.
Returns:
true if an update occurs, false otherwise.

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