libTFO
Public Types | Public Member Functions
TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn > Class Template Reference

The core of libTFO, start here. More...

#include <tfo.hh>

List of all members.

Public Types

typedef O owner_type
typedef M match_type
typedef A action_type
typedef U user_type
typedef void(* fib_modify_func )(O owner, FibEntry< M, A, U > *e)
typedef void(* walk_const_callback_func )(O owner, const FibEntry< M, A, U > *e, void *user_data)
typedef void(* walk_callback_func )(O owner, FibEntry< M, A, U > *e, void *user_data)

Public Member Functions

 TFO (O owner, const uint32_t fib_capacity, const fib_modify_func fib_modify, const uint32_t size_b2, const uint32_t size_b3)
 ~TFO (void)
int update_entry (const M &m, const A &a, const enum FibEntryUpdateType type)
FibEntry< M, A, U > * get_entry (const M &m)
int update_hits (const M &m, const uint64_t &hits, const enum FibEntryHitsUpdateType type=FIB_ENTRY_HITS_ADD)
void bin_complete (void)
void walk_entries (walk_const_callback_func f, void *user_data=NULL)
void walk_entries (walk_callback_func f, void *user_data=NULL)

Detailed Description

template<typename O, typename M, typename A, typename U, typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
class TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >

The core of libTFO, start here.

Template Parameters:
OType of the owner, use void* if not needed.
MType of flow match, e.g., destination IP prefix.
AType of flow action, e.g., output interface.
UType of additional information attached to FIB entries.
MHashFcnHash function for const M*, defaults to hash<const M*>.
MEqualFcnEquality function for const M*, defaults to equal_to<const M*>.
AEqualFcnEquality function for const A, defaults to equal_to<const A>.

Member Typedef Documentation

template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef A TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::action_type
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef void(* TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::fib_modify_func)(O owner, FibEntry< M, A, U > *e)
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef M TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::match_type
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef O TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::owner_type
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef U TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::user_type
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef void(* TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::walk_callback_func)(O owner, FibEntry< M, A, U > *e, void *user_data)
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef void(* TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::walk_const_callback_func)(O owner, const FibEntry< M, A, U > *e, void *user_data)

Constructor & Destructor Documentation

template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::TFO ( owner,
const uint32_t  fib_capacity,
const fib_modify_func  fib_modify,
const uint32_t  size_b2,
const uint32_t  size_b3 
) [inline]

Creates a new instance of TFO.

Parameters:
[in]ownerReference to the owner of this TFO instance.
[in]fib_capacityNumber of entries available on the fast-path FIB.
[in]fib_modifyCallback function that is called on all FIB changes.
[in]size_b2Number of b1 time bins that make a b2 time bin.
[in]size_b3Number of b1 time bins that make a b3 time bin.
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::~TFO ( void  ) [inline]

Deletes a TFO.


Member Function Documentation

template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
void TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::bin_complete ( void  ) [inline]

The controller is supposed to call bin_complete() whenever a shortest time bin (b1) has elapsed. FibEntry takes care of updating the hit counters of all time scales (b1, b2, b3). Finally, the FIB entry selection strategy is applied. The callback function fib_modify() is called to notify the controller about any changes.

template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
FibEntry<M, A, U>* TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::get_entry ( const M &  m) [inline]

Finds and returns the FIB entry which corresponds to a given match.

Parameters:
[in]mMatch.
Returns:
Returns NULL if there is no matching FIB entry.
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
int TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::update_entry ( const M &  m,
const A &  a,
const enum FibEntryUpdateType  type 
) [inline]

The controller calls update_entry() on all changes to the FIB. If TFO decides to propagate corresponding changes to either slow path or fast path, TFO calls the fib_modify() callback function.

Parameters:
[in]mMatch.
[in]aAction.
[in]typeType of update.
Returns:
Returns non-zero on error.
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
int TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::update_hits ( const M &  m,
const uint64_t &  hits,
const enum FibEntryHitsUpdateType  type = FIB_ENTRY_HITS_ADD 
) [inline]

The controller calls update_hits() whenever new FIB entry statistics are available.

Parameters:
[in]mMatch.
[in]hitsNumber of hits.
[in]typeType of update.
Returns:
Returns non-zero on error.
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
void TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::walk_entries ( walk_const_callback_func  f,
void *  user_data = NULL 
) [inline]

Allows the controller to perform a read-only walk through all FIB entries.

Parameters:
[in]fCallback function to be invoked for each FibEntry.
[in]user_dataOptional argument that gets passed on to f.
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
void TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::walk_entries ( walk_callback_func  f,
void *  user_data = NULL 
) [inline]

Allows the controller to perform a walk through all FIB entries.

Parameters:
[in]fCallback function to be invoked for each FibEntry.
[in]user_dataOptional argument that gets passed on to f.

The documentation for this class was generated from the following file:
 All Classes Files Functions Typedefs Enumerations Enumerator