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.
typedef A Addr | Addr |
typedef IPNet<A> Net | Net |
typedef RouteEntry<A> Route | Route |
typedef RouteEntryOrigin<A> RouteOrigin | RouteOrigin |
typedef RouteEntryRef<A> DBRouteEntry | DBRouteEntry |
typedef RouteEntryRef<A> ConstDBRouteEntry | ConstDBRouteEntry |
typedef PacketRouteEntry<A> PacketizedRoute | PacketizedRoute |
typedef map<Net, DBRouteEntry, NetCmp<A> > RouteContainer | RouteContainer |
typedef map<Net, Route*, NetCmp<A> > RouteContainerNoRef | RouteContainerNoRef |
RouteDB (EventLoop& e, PolicyFilters& pfs)
| RouteDB |
~RouteDB ()
| ~RouteDB |
bool insert_peer (Peer<A>* peer)
| insert_peer |
Insert a peer to the database.
Parameters:
peer | the peer to insert. |
Returns: true if this is a new peer, otherwise false.
bool erase_peer (Peer<A>* peer)
| erase_peer |
Erase a peer from the database.
Parameters:
peer | the peer to erase. |
Returns: true if this is an existing peer that was erased, otherwise false.
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 |
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:
net | the network route being updated. |
nexthop | the corresponding nexthop address. |
ifname | the corresponding interface name toward the destination. |
vifname | the corresponding vif name toward the destination. |
cost | the corresponding metric value as received from the route originator. |
tag | the corresponding route tag. |
origin | the route originator proposing update. |
policytags | the policytags of this route. |
is_policy_push | if true, this route update is triggered by policy reconfiguration. |
Returns: true if an update occurs, false otherwise.
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)
| add_rib_route |
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:
net | network of the route being added. |
nexthop | the corresponding nexthop address. |
ifname | the corresponding interface name toward the destination. |
vifname | the corresponding vif name toward the destination. |
cost | the corresponding metric value. |
the | corresponding route tag. |
origin | the route originator [RIB in this case]. |
policytags | the policytags of this route. |
void delete_rib_route (const Net& net)
| delete_rib_route |
Permanently delete a RIB route. This occurs if redistribution of this route ceased.
Parameters:
net | network of the route being deleted. |
void dump_routes (vector<ConstDBRouteEntry>& routes)
| dump_routes |
Flatten route entry collection into a Vector.
Parameters:
routes | vector where routes are to be appended. |
void flush_routes ()
| flush_routes |
uint32_t route_count ()
| route_count |
[const]
Returns: count of routes in database.
const Route* find_route (const Net& n)
| find_route |
[const]
Returns: pointer to route entry if it exists, 0 otherwise.
UpdateQueue<A>& update_queue ()
| update_queue |
Accessor.
Returns: reference to UpdateQueue.
const UpdateQueue<A>& update_queue ()
| update_queue |
[const]
Accessor.
Returns: const reference to UpdateQueue.
EventLoop& eventloop ()
| eventloop |
void push_routes ()
| push_routes |
Push routes through policy filters for re-filtering.
bool do_filtering (Route* r)
| do_filtering |
Do policy filtering.
Parameters:
r | route to filter. |
Returns: true if route was accepted, false otherwise.
Trace& trace ()
| trace |
RouteDB (const RouteDB&)
| RouteDB |
[protected]
RouteDB& operator= (const RouteDB&)
| operator= |
[protected]
void expire_route (Route* r)
| expire_route |
[protected]
void set_expiry_timer (Route* r)
| set_expiry_timer |
[protected]
void delete_route (Route* r)
| delete_route |
[protected]
void set_deletion_timer (Route* r)
| set_deletion_timer |
[protected]
RouteContainer& routes ()
| routes |
[protected]
EventLoop& _eventloop | _eventloop |
[protected]
RouteContainer _routes | _routes |
[protected]
UpdateQueue<A>* _uq | _uq |
[protected]
PolicyFilters& _policy_filters | _policy_filters |
[protected]
set<Peer<A>* > _peers | _peers |
[protected]
RouteContainerNoRef _rib_routes | _rib_routes |
[protected]
RouteOrigin* _rib_origin | _rib_origin |
[protected]
friend class RouteWalker | RouteWalker |
[protected]