class NextHopCache

A cache of next hop information. More...

Definition#include <next_hop_resolver.hh>
Template formNextHopCache<class A>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

A cache of next hop information.

BGP requires information regarding resolvabilty and metrics for next hops. This information is known by the RIB. Questions are asked of the RIB and the results are cached here. The RIB notes that questions have been asked and if the state of a next hop changes then this is reported back to BGP. In order to save space the RIB does not record information about each next hop but returns an address/prefix_len range for which the answer is valid.

Not only can the RIB report changes but can also report that a previous entry is totally invalid. In the case that an entry is invalid all the next hops need to be re-requested.

 ~NextHopCache ()

~NextHopCache

void  add_entry (A addr, A nexthop, int prefix_len, int real_prefix_len, bool resolvable, uint32_t metric = 0)

add_entry

Add an entry to our next hop table.

Parameters:
addrBase address.
nexthopNext hop that is being added to the trie.
prefix_lenThe prefix_len that is masked with the nexhop.
real_prefix_lenThe actual prefix_len that this next hop resolves too. This is only used to match with upcalls from the RIB.
resolvableIs this route resolvable.
metricIf this route is resolvable its metric.

bool  validate_entry (A addr, A nexthop, int prefix_len, int real_prefix_len)

validate_entry

Validate an entry.

add_entry creates an entry with no nexthop references. The assumption is that a register_nexthop will follow shortly after initial creation. It is possible due to a deregister_nexthop coming in while we are waiting for a response from the RIB that the register_nexthop never happens. This method checks that the specified entry is referenced and if it isn't it is deleted.

Parameters:
addrBase address.
nexthopNext hop that is being added to the trie.
prefix_lenThe prefix_len that is masked with the nexhop.
real_prefix_lenThe actual prefix_len that this next hop

Returns: true if the entry is in use.

map <A, int>  change_entry (A addr, int real_prefix_len, uint32_t metric)

change_entry

Change an entry in the next hop table.

Parameters:
addrThe base address.
real_prefix_lenThe actual prefix_len that this next hop resolves too. This is only used to match with upcalls from the RIB.
metricIf this route is resolvable its metric.

Returns: The map of next hops with reference counts that were covered by this entry.

map <A, int>  delete_entry (A addr, int prefix_len)

delete_entry

Delete an entry from the nexthop table.

It is a fatal error to attempt to delete an entry that doesn't exist.

Parameters:
addrBase address that is being removed from the trie.
prefix_lenThe prefix_len.

Returns: The map of next hops with reference counts that were covered by this entry.

bool  lookup_by_addr (A addr, int prefix_len, bool& resolvable, uint32_t& metric)

lookup_by_addr

[const]

Lookup by base address

Parameters:
addrBase address.
prefix_lenPrefix_Len.
resolvableIs this route resolvable.
metricIf this route is resolvable the metric of this route.

Returns: True if this next hop is found.

bool  lookup_by_nexthop (A nexthop, bool& resolvable, uint32_t& metric)

lookup_by_nexthop

[const]

Lookup next hop.

Parameters:
nexthopNext hop.
resolvableIs this route resolvable.
metricIf this route is resolvable the metric of this route.

Returns: True if this next hop is found.

bool  lookup_by_nexthop_without_entry (A nexthop, bool& resolvable, uint32_t& metric)

lookup_by_nexthop_without_entry

[const]

Lookup next hop without entry

This lookup does not require that next hop is already known. That is the next hop is not in _nexthop_references.

Parameters:
nexthopNext hop.
resolvableIs this route resolvable.
metricIf this route is resolvable the metric of this route.

Returns: True if this next hop is found.

bool  register_nexthop (A nexthop, int ref_cnt_incr = 1)

register_nexthop

bool  deregister_nexthop (A nexthop, bool& last, A& addr, uint32_t& prefix_len)

deregister_nexthop


Generated by: pavlin on possum.icir.org on Thu Aug 28 12:52:17 2003, using kdoc 2.0a54+XORP.