class MergedTable

Make two route RouteTables behave like one. More...

Definition#include <rt_tab_merged.hh>
Template formMergedTable<class A>
InheritsRouteTable [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

MergedTable takes two routing tables and combines them together to form a single table, where routes for the same subnet with a lower admin distance override those with a higher admin distance

The two parent tables are not actually merged.

An add_route request from a parent tables causes a lookup on the other parent table. If the route is better than the one from the other table, or no route exists in the other table, then the new route is passed downstream.

An delete_route request from a parent table also causes a lookup on the other parent table. The delete_route is propagated downstream. If an alternative route is found, then that is then propagated downsteam as an add_route to replace the deleted route.

Lookups from downsteam cause lookups on both parent tables. The better response is given.

 MergedTable (const string& tablename, RouteTable<A>* table_a, RouteTable<A>* table_b)

MergedTable

MergedTable Constructor.

Parameters:
tablenamehuman-readable tablename to aid debugging
table_aone of two parent RouteTables
table_bone of two parent RouteTables

int  add_route (const IPRouteEntry<A> &route, RouteTable<A> *caller)

add_route

An add_route request from a parent table causes a lookup on the other parent table. If the route is better than the one from the other table, or no route exists in the other table then it is passed downstream.

Parameters:
routethe new route
callerthe parent table sending the new route

Reimplemented from RouteTable.

int  delete_route (const IPRouteEntry<A> *, RouteTable<A> *caller)

delete_route

An delete_route request from a parent table also causes a lookup on the other parent table. The delete_route is propagated downstream. If an alternative route is found, then that is then propagated downsteam as an add_route to replace the deleted route.

Parameters:
routethe route to be deleted.
callerthe parent table sending the delete_route.

Reimplemented from RouteTable.

const IPRouteEntry<A> * lookup_route (const IPNet<A> &net)

lookup_route

[const]

Lookup a specific subnet. The lookup will be sent to both parent tables. If both give an answer, then the route with the better admin_distance is returned.

Parameters:
netthe subnet to look up.

Returns: a pointer to the route entry if it exists, NULL otherwise.

Reimplemented from RouteTable.

const IPRouteEntry<A> * lookup_route (const A &addr)

lookup_route

[const]

Lookup an IP address to get the most specific (longest prefix length) route that matches this address. The lookup will be sent to both parent tables. If both give an answer, then the more specific route is returned. If both routes have the same prefix length, then the route with the better admin_distance is returned.

Parameters:
addrthe IP address to look up.

Returns: a pointer to the best most specific route entry if any entry matches, NULL otherwise.

Reimplemented from RouteTable.

RouteRange<A> * lookup_route_range (const A &addr)

lookup_route_range

[const]

Lookup an IP address to get the most specific (longest prefix length) route that matches this address, along with the RouteRange information for this address and route. As with lookup_route, this involves querying both parent tables. The best, most specific route is returned, and the tightest bounds on the answer are returned.

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.

See also: RouteRange

Reimplemented from RouteTable.

int  type ()

type

[const]

Returns: MERGED_TABLE

Reimplemented from RouteTable.

void  replumb (RouteTable<A> *old_parent, RouteTable<A> *new_parent)

replumb

replumb the parent tables, so that new_parent replaces old_parent

Parameters:
new_parent

Reimplemented from RouteTable.

string  str ()

str

[const]

Render this MergedTable as a string for debugging purposes

Reimplemented from RouteTable.


Generated by: pavlin on possum.icir.org on Mon Mar 10 19:35:00 2003, using kdoc 2.0a54+XORP.