#ifndef cl_inc_bridge_table_h #define cl_inc_bridge_table_h /* Cesar project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file cl/inc/bridge_table.h * \brief Bridge table private header. * \ingroup cl * * Private declarations for the bridge table module. */ #include "cl/mac_lookup_table.h" // mac_lookup_table_t /** * Maximum number of MAC addresses in the temporary bridge table. */ #define BRIDGE_TABLE_MAX_TMP_ENTRY 8 /** * Default timeout for an entry. * Should be at least LBDAT_EXPIRE_TIME (100s). It is expressed in cycle count * (which should correspond to second). */ #define BRIDGE_TABLE_ENTRY_TIMEOUT 100 /** * The bridge table. * It is based on the MAC lookup indexed table. */ typedef mac_lookup_table_t bridge_table_t; /** * Structure used to store the required information of the bridge table * module. * It is stored in the CL context. */ struct bridge_table_context_t { /** Bridge table module cycle counter. */ uint cycle_counter; /** The bridge table. */ bridge_table_t *table; /** The temporary bridge table. */ mac_t table_tmp[BRIDGE_TABLE_MAX_TMP_ENTRY]; /** Current count of entries in the \a bridge_table_temp. */ u8 table_tmp_entry_count; }; typedef struct bridge_table_context_t bridge_table_context_t; BEGIN_DECLS /** * Compute next expiration date/cycle for an entry. * \param current_date the current cycle count of this module. * \return the cycle in which the entry should expire. */ static inline uint bridge_table_next_expiration (uint current_date) { return current_date + BRIDGE_TABLE_ENTRY_TIMEOUT; } END_DECLS #endif /* cl_inc_bridge_table_h */