The heart of the forwarding table. More...
#include <forwarding.h>
Public Member Functions | |
virtual | ~ForwardingTable () |
Destroys the forwarding including all its internal data structures. | |
virtual void | ifconfig (if_t, const predicate &)=0 |
Associates a predicate to an interface. More... | |
virtual void | consolidate () |
Prepares the forwarding table for matching. More... | |
virtual void | match (const message &, MatchHandler &) const =0 |
Processes a message, calling the output() function on the given MatchHandler object for each matching interface. More... | |
virtual void | match (const message &, MatchMessageHandler &) const =0 |
Processes a message, calling the output() function on the given MatchMessageHandler object for each matching interface. 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... | |
The heart of the forwarding table.
A ForwardingTable
associates predicates to interfaces. A Predicate is a disjunction of conjunctions of elementary constraints. An interface is simply an identifier, corresponding to the link-level address of a neighbor.
The forwarding table is a dictionary data structure, meaning that the set of associations that it represents can constructed by adding associations, 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 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. Two classes of handlers are supported: MatchMessageHandler, which uses an output function that takes an interface identifier and a message, and MatchHandler, which uses an output function that takes an interface identifier only.
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().
Implemented in siena::FwdTable, siena::BTrieTable, siena::BTable, siena::BXTable, and siena::BDDBTableBase.
|
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().
Implemented in siena::FwdTable, siena::BTrieTable, siena::BTable, siena::BXTable, and siena::BDDBTableBase.
|
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 ifconfig().
Implemented in siena::ZDDBTable, siena::BDDBTable, siena::FwdTable, siena::BTrieTable, siena::BTable, siena::BXTable, and siena::BDDBTableBase.
|
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 ifconfig().
Implemented in siena::ZDDBTable, siena::BDDBTable, siena::FwdTable, siena::BTrieTable, siena::BTable, siena::BXTable, and siena::BDDBTableBase.
|
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.
Reimplemented in siena::SortedBTable, siena::FwdTable, siena::BCTable, siena::BXTable, and siena::BDDBTableBase.
Associates a predicate to an interface.
This is the method that constructs the forwarding table. This method must be called once for each interface, after the forwarding table is constructed or after it has been cleared. Using this method twice on the same interface without clearing the forwarding table has undefined effects.
Implemented in siena::ZDDBTable, siena::BDDBTable, siena::FwdTable, siena::BTrieTable, siena::BTable, siena::BXTable, and siena::BDDBTableBase.
|
pure virtual |
Processes a message, calling the output() function on the given MatchHandler object for each matching interface.
Matches a message against the predicates stored in the forwarding table. The result is processed through the MatchHandler passed as a parameter to this function.
Notice that the forwarding table must be consolidated by calling siena::ForwardingTable::consolidate() before this function is called.
Implemented in siena::ZDDBTable, siena::BDDBTable, siena::FwdTable, siena::BTrieTable, siena::BTable, siena::BCTable, siena::BXTable, and siena::BDDBTableBase.
|
pure virtual |
Processes a message, calling the output() function on the given MatchMessageHandler object for each matching interface.
Implemented in siena::FwdTable, siena::BTrieTable, siena::BTable, siena::BXTable, and siena::BDDBTableBase.