Siena Fast Forwarding Documentation (v. 1.13.0)
Public Member Functions | Protected Attributes | List of all members
siena::BTable Class Reference

implementation of the forwarding table based on Bloom filters. More...

#include <btable.h>

Inheritance diagram for siena::BTable:
Inheritance graph
[legend]
Collaboration diagram for siena::BTable:
Collaboration graph
[legend]

Public Member Functions

virtual void ifconfig (if_t, const predicate &)
 Associates a predicate to an interface. More...
 
virtual void match (const message &, MatchHandler &) const
 Processes a message, calling the output() function on the given MatchHandler object for each matching interface. More...
 
virtual void match (const message &, MatchMessageHandler &) const
 Processes a message, calling the output() function on the given MatchMessageHandler object for each matching interface. More...
 
virtual void clear ()
 Clears the forwarding table. More...
 
virtual void clear_recycle ()
 Clears the forwarding table. More...
 
virtual size_t allocated_bytesize () const
 Memory allocated by the forwarding table. More...
 
virtual size_t bytesize () const
 Memory used by the forwarding table. More...
 
- Public Member Functions inherited from siena::ForwardingTable
virtual ~ForwardingTable ()
 Destroys the forwarding including all its internal data structures.
 
virtual void consolidate ()
 Prepares the forwarding table for matching. More...
 

Protected Attributes

FTAllocator memory
 Protected allocator of the forwarding table. More...
 
BPredicate * plist
 list of predicates. More...
 

Detailed Description

implementation of the forwarding table based on Bloom filters.

This implementation is based on an encoding of messages and filters that transforms a message m in a set Sm and a filter f in set Sf such that if m matches f then Sm contains Sf. Sets are then represented with Bloom filters that admit a compact representation and a fast matching operation. The matching algorithm is then based on a simple linear scan of the encoded filters.

This implementation is provided primarily for experimental purposes. Because of the nature of both the encoding of messages and filters into sets, and the representation of sets with Bloom filters, this implementation can not provide an exact match. In fact, this implementation produces false positives, which means that a message might be forwarded to more interfaces than the ones it actually matches. However, this implementation does not produce false negatives. This means that a message will always go to all the interfaces whose predicate match the message.

Member Function Documentation

virtual size_t siena::BTable::allocated_bytesize ( ) const
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().

Implements siena::ForwardingTable.

virtual size_t siena::BTable::bytesize ( ) const
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().

Implements siena::ForwardingTable.

virtual void siena::BTable::clear ( )
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().

See Also
ifconfig()
consolidate()

Implements siena::ForwardingTable.

virtual void siena::BTable::clear_recycle ( )
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().

See Also
ifconfig()
consolidate()

Implements siena::ForwardingTable.

virtual void siena::BTable::ifconfig ( if_t  ,
const predicate  
)
virtual

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.

See Also
consolidate()

Implements siena::ForwardingTable.

virtual void siena::BTable::match ( const message ,
MatchHandler  
) const
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.

See Also
consolidate()

Implements siena::ForwardingTable.

Reimplemented in siena::BCTable.

virtual void siena::BTable::match ( const message ,
MatchMessageHandler  
) const
virtual

Processes a message, calling the output() function on the given MatchMessageHandler object for each matching interface.

See Also
consolidate()
ifconfig()

Implements siena::ForwardingTable.

Member Data Documentation

FTAllocator siena::BTable::memory
protected

Protected allocator of the forwarding table.

All the data structure forming the forwarding table are allocated through this memory management system.

BPredicate* siena::BTable::plist
protected

list of predicates.

each link in this linked list is a pair <predicate,interface-id>