Performs incremental and/or deferred update of the OLSR routing table for the domain which this routing process interacts with.
Whilst incremental updates are possible, the code does not currently do this because the incremental shortest-path-tree code does not yet support incremental updates. The interface is however written with this in mind as it may turn out to offer faster convergence for link-state MANET protocols like OLSR.
Classes which produce artifacts for RouteManager to turn into routes therefore call schedule_route_update() whenever their state changes. RouteManager will call them back. We do not use polymorphism for this as the relationships do not significantly change.
RouteManager (Olsr& olsr, EventLoop& eventloop,
FaceManager* fm, Neighborhood* nh,
TopologyManager* tm, ExternalRoutes* er)
| RouteManager |
~RouteManager ()
| ~RouteManager |
void schedule_route_update ()
| schedule_route_update |
Schedule a recalculation of the entire routing table.
void schedule_external_route_update ()
| schedule_external_route_update |
Schedule a recalculation of external routes.
bool add_onehop_link (const LogicalLink* l, const Neighbor* n)
| add_onehop_link |
Add a link to a one-hop neighbor to the SPT.
Given a link at radius 1 in the routing graph from this node, add its endpoint node and the edge to the SPT graph.
TODO: Bias for MPRs and willingness correctly.
Parameters:
l | pointer to a link between the origin and the Neighbor n. |
n | pointer to the Neighbor n. |
Returns: true if the link was added OK.
bool add_twohop_link (const Neighbor* n, const TwoHopLink* l2,
const TwoHopNeighbor* n2)
| add_twohop_link |
Add a two-hop link and neighbor to the SPT.
Given a link at radius 2 in the routing graph from the origin, add its endpoint nodes and the edge to the SPT graph.
In the absence of ETX measurements, the only possible cost for a 2-hop link which we can infer from link state is 1 (just the hop), and this is what we get from Neighborhood.
Parameters:
n | pointer to the Neighbor n, which must already have been added to the SPT graph. |
l2 | pointer to a link between Neighbor n and TwoHopNeighbor n2. |
n2 | pointer to a TwoHopNeighbor. |
Returns: true if the two-hop link was added OK.
bool add_tc_link (const TopologyEntry* tc)
| add_tc_link |
Add a TC-derived link and neighbor to the SPT.
Given a link at radius > 2 in the routing graph from the origin, add its far endpoint nodes and the edge to the SPT graph. In the absence of ETX measurements, the only possible cost for a TC link which we can infer from link state is 1 (just the hop), and this is what we get from TopologyManager.
Parameters:
tc | The topology entry being considered for SPT add. |
Returns: true if a link and vertex for the far endpoint was added to the SPT, otherwise false.
bool add_hna_route (const IPv4Net& dest,
const IPv4& lasthop,
const uint16_t distance)
| add_hna_route |
Add an external route, possibly HNA derived, to the current trie.
Section 12: Non-OLSR Interfaces. The metric of an HNA route in RFC-compliant OLSR is identical to that of its last-hop. If the origin of the HNA route is not reachable in the OLSR SPT, the HNA route will be rejected; see NOTES.
Parameters:
dest | the destination prefix. |
lasthop | the last hop advertising @param dest Note: This is a main address, not an interface address. |
distance | the number of OLSR hops to @param lasthop |
Returns: true if the route was added OK.
void push_routes ()
| push_routes |
Backend method to: push all the routes through the policy filters whenever they are updated.
void recompute_all_routes ()
| recompute_all_routes |
[protected]
Recompute the OLSR domain portion of the routing table.
Until incremental computation is implemented, we perform the SPT computation fully every time a recomputation is triggered. Producers of routes call us back to populate the graph.
inline Vertex make_origin_vertex ()
| make_origin_vertex |
[protected]
void begin ()
| begin |
[protected]
Begin the route computation transaction.
This must be called before any routes are recomputed, to take snapshots of the state which is present in the RIB.
void end ()
| end |
[protected]
End the route computation transaction.
This must be called after all routes are recomputed in order for them to propagate to the RIB.
bool add_entry (const IPv4Net& net, const RouteEntry& rt)
| add_entry |
[protected]
Internal method to: Add a route entry to the current internal trie.
Parameters:
net | the destination prefix. |
rt | the entry to add. |
Returns: true if the entry was added OK.
bool delete_entry (const IPv4Net& net, const RouteEntry& rt)
| delete_entry |
[protected]
Internal method to: Delete a route entry from the current internal trie.
Parameters:
net | the destination prefix. |
rt | the entry to delete. |
Returns: true if the entry was deleted OK.
bool replace_entry (const IPv4Net& net, const RouteEntry& rt,
const RouteEntry& previous_rt)
| replace_entry |
[protected]
Internal method to: Replace a route entry in the current internal trie.
Parameters:
net | the destination prefix. |
rt | the new route entry which replaces @param previous_rt |
previous_rt | the entry to replace. |
Returns: true if the entry was replaced OK.
bool add_route (IPv4Net net, IPv4 nexthop,
uint32_t metric, RouteEntry& rt)
| add_route |
[protected]
Backend method to: add a route to the RIB with policy filtering.
Parameters:
net | the destination prefix. |
nexthop | the next-hop. |
metric | the computed metric of the route. |
rt | the route entry to add, containing all other fields. |
Returns: true if the route was added to the RIB OK, otherwise false.
bool delete_route (const IPv4Net& net, const RouteEntry& rt)
| delete_route |
[protected]
Backend method to: withdraw a route from the RIB.
Parameters:
net | the destination prefix. |
rt | the route entry to delete, containing all other fields. |
Returns: true if the route was withdrawn from the RIB OK, otherwise false.
bool replace_route (IPv4Net net, IPv4 nexthop,
uint32_t metric,
RouteEntry& rt,
RouteEntry& previous_rt)
| replace_route |
[protected]
Backend method to: replace a route that has been sent to the RIB.
Parameters:
net | the destination prefix. |
nexthop | the new next-hop. |
metric | the new computed metric of the route. |
rt | the route entry to add, containing all other fields. |
previous_rt | the route entry to replace. |
Returns: true if the route was replaced in the RIB OK, otherwise false.
bool do_filtering (IPv4Net& net, IPv4& nexthop,
uint32_t& metric, RouteEntry& rt,
PolicyTags& policytags)
| do_filtering |
[protected]
Backend method to: perform policy filtering when a route may be plumbed to the RIB. May not be declared const; policy may modify fields.
Parameters:
net | the destination prefix. |
nexthop | the next-hop. |
metric | the metric. |
rt | the route entry to filter, containing all other fields. |
policytags | the tags presented to us by the policy engine. |
Returns: true if the route was accepted by the policy engine, otherwise false if any error occurred.