Basic services of a forwarding table. More...
#include <forwarding.h>
Public Member Functions | |
virtual | ~FIB () |
Destroys the forwarding including all its internal data structures. | |
virtual void | consolidate () |
Prepares the forwarding table for matching. More... | |
virtual void | clear ()=0 |
Clears the forwarding table. More... | |
virtual void | clear_recycle ()=0 |
Clears the forwarding table. More... | |
virtual size_t | allocated_bytesize () const =0 |
Memory allocated by the forwarding table. More... | |
virtual size_t | bytesize () const =0 |
Memory used by the forwarding table. More... | |
Basic services of a forwarding table.
A forwarding table implements the forwarding function of a specific routing scheme. This class abstracts the essential services of a forwarding table that do not depend on the routing scheme. These amount to little more than memory management.
Depending on the implementation, a forwarding table is typically a dictionary data structure, meaning that it is compiled once and then used for matching repeatedly. The table can be compiled by adding associations between predicates and interfaces (or whatever is specific of the addressing and routing scheme) but can not be modified by removing or modifying individual associations. In order to modify individual associations, the forwarding table must be completely cleared, using the clear or clear_recycle methods, and built over again.
More specifically, the forwarding table operates in two modes. Initially the forwarding table is in configuration mode. While in configuration mode, the forwarding table can be configured by associating predicates to interfaces (e.g., using the ifconfig method). Once all the interfaces have been associated with their predicate, the forwarding table must be prepared for matching by calling the consolidate method. The consolidate method switches the forwarding table to matching mode, which means that the forwarding table can be used to match messages. The forwarding table, can then be cleared and restored to configuration mode with the clear or clear_recycle methods.
Once in matching mode, the forwarding table can match incoming messages with the match method. The forwarding table delegates the processing of matched notifications to a given handler. The MatchHandler class defines the interface of a handler.
The forwarding table manages its memory allocation through a dedicated block-allocator. When cleared with clear(), the forwarding table releases all the previously allocated memory. clear_recycle() can be used to clear the forwarding table and recycle previously allocated memory. In this latter case, previously allocated memory is saved for future use.
|
pure virtual |
Memory allocated by the forwarding table.
returns the number of bytes of memory allocated by the forwarding table. This value is always greater than or equal to the value returned by bytesize().
|
pure virtual |
Memory used by the forwarding table.
returns the number of bytes of memory used by the forwarding table. This value is always less than or equal to the value returned by allocated_bytesize().
|
pure virtual |
Clears the forwarding table.
This method removes all the associations from the forwarding table and releases allocated memory. After a call to this method, the forwarding table is ready to be configured with siena::AttributesFIB::ifconfig().
|
pure virtual |
Clears the forwarding table.
This method removes all the associations from the forwarding table recycling the allocated memory. After a call to this method, the forwarding table is ready to be configured with siena::AttributesFIB::ifconfig().
|
inlinevirtual |
Prepares the forwarding table for matching.
This function processes the forwarding table, packing some of its internal data structures and preparing them to be used to match events. This function must therefore be called after all the necessary calls to ifconfig and before matching messages with match().
The forwarding table can be reset by calling clear or clear_recycle.