|
xorp
|
Make two route RouteTables behave like one. More...
#include <rt_tab_merged.hh>
Public Member Functions | |
| MergedTable (RouteTable< A > *table_a, RouteTable< A > *table_b) | |
| MergedTable Constructor. | |
| int | add_route (const IPRouteEntry< A > &route, RouteTable< A > *caller) |
| An add_route request from a parent table causes a lookup on the other parent table. | |
| int | delete_route (const IPRouteEntry< A > *route, RouteTable< A > *caller) |
| An delete_route request from a parent table also causes a lookup on the other parent table. | |
| const IPRouteEntry< A > * | lookup_route (const IPNet< A > &net) const |
| Lookup a specific subnet. | |
| const IPRouteEntry< A > * | lookup_route (const A &addr) const |
| Lookup an IP address to get the most specific (longest prefix length) route that matches this address. | |
| RouteRange< A > * | lookup_route_range (const A &addr) 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. | |
| TableType | type () const |
| void | replumb (RouteTable< A > *old_parent, RouteTable< A > *new_parent) |
| replumb the parent tables, so that new_parent replaces old_parent. | |
| string | str () const |
| Render this MergedTable as a string for debugging purposes. | |
Private Attributes | |
| RouteTable< A > * | _table_a |
| RouteTable< A > * | _table_b |
Make two route RouteTables behave like one.
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< A >::MergedTable | ( | RouteTable< A > * | table_a, |
| RouteTable< A > * | table_b | ||
| ) |
MergedTable Constructor.
| table_a | one of two parent RouteTables. |
| table_b | one of two parent RouteTables. |
| int MergedTable< A >::add_route | ( | const IPRouteEntry< A > & | route, |
| RouteTable< A > * | caller | ||
| ) | [virtual] |
| int MergedTable< A >::delete_route | ( | const IPRouteEntry< A > * | route, |
| RouteTable< A > * | caller | ||
| ) | [virtual] |
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.
Implements RouteTable< A >.
| const IPRouteEntry< A > * MergedTable< A >::lookup_route | ( | const A & | addr | ) | const [virtual] |
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.
| addr | the IP address to look up. |
Implements RouteTable< A >.
| const IPRouteEntry< A > * MergedTable< A >::lookup_route | ( | const IPNet< A > & | net | ) | const [virtual] |
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.
| net | the subnet to look up. |
Implements RouteTable< A >.
| RouteRange< A > * MergedTable< A >::lookup_route_range | ( | const A & | addr | ) | const [virtual] |
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.
| addr | the IP address to look up. |
Implements RouteTable< A >.
| void MergedTable< A >::replumb | ( | RouteTable< A > * | old_parent, |
| RouteTable< A > * | new_parent | ||
| ) | [virtual] |
replumb the parent tables, so that new_parent replaces old_parent.
Implements RouteTable< A >.
| TableType MergedTable< A >::type | ( | ) | const [inline, virtual] |
Implements RouteTable< A >.