#ifndef cl_bridge_table_h #define cl_bridge_table_h /* Cesar project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file cl/bridge_table.h * \brief Local Bridge Destination Address Table (LBDAT) public header. * \ingroup cl * * The bridge table module is used by a STA when it is acting as a bridge (if * you need more information on this behavior, have a look at the HomePlug AV * specification, section 5.3). * * Basically, you can: * - initialize the bridge table (required to use this module), * - de-initialize the bridge table (when you have finished using this * module), * - add new source MAC address to the bridge table (when receiving a packet * coming from the bridged networks), * - get the content of the whole bridge table (when you want to transmit it * to other STA), * - update the content of the bridge table (to remove expired entries). * * You must initialize and update this module every one second. */ #include "cl/cl.h" // cl_t BEGIN_DECLS /** * Initialize the local bridge table module. * \param ctx the CL context structure. */ void bridge_table_init (cl_t *ctx); /** * De-initialize the local bridge table module. * \param ctx the CL context structure. */ void bridge_table_deinit (cl_t *ctx); /** * Add a source MAC address to the local bridge table. * \param ctx the CL context structure. * \param src_mac the source MAC address received from the bridged network. */ void bridge_table_add (cl_t *ctx, mac_t src_mac); /** * Update the local bridge table. * \param ctx the CL context structure. * \return * - true if the bridge table has been modified, * - false is the bridge table has not been modified (no expired entry or no * new entry to add). * * \attention You must call this function every one second. * * This function will update the local bridge table by removing entries which * are expired and add the new one (because the add function only copy them to * a temporary table). */ bool bridge_table_update (cl_t *ctx); /** * Get the number of MAC addresses in the local bridge table. * \param ctx the CL context structure. * \return the number of MAC addresses in the local bridge table. */ uint bridge_table_size (cl_t *ctx); /** * Get a MAC address at a specific position in the table. * \param ctx the CL context structure. * \param position the position of the MAC address to get in the table. * \return the MAC address located at the \p position of the \p table. */ mac_t bridge_table_get_entry (cl_t *ctx, uint position); END_DECLS #endif /* cl_bridge_table_h */