-PcktSieve special return functionality added -ARP multicast learning bug fixed -include guards have been refactored -Doxygen style tweaked
62 lines
1.4 KiB
C
62 lines
1.4 KiB
C
#ifndef ETHERLIB_CBD_TABLE_H
|
|
#define ETHERLIB_CBD_TABLE_H
|
|
|
|
#include <stdint.h>
|
|
#include "connection_block.h"
|
|
|
|
#define CBD_LOWEST_DESCRIPTOR (4)
|
|
|
|
/**
|
|
* Custom type for connection block descriptor.
|
|
*/
|
|
typedef uint8_t cbd;
|
|
|
|
#define CBDT_ERR ((cbd)(~0))
|
|
|
|
/**
|
|
* Connection block descriptor table
|
|
*/
|
|
typedef struct {
|
|
cbd maxEntries; ///< Maximum number of entries
|
|
cbd level; ///< Fill level
|
|
ConnBlock cbs[]; ///< Array of connection blocks
|
|
} CbdTable;
|
|
|
|
/**
|
|
* Create new connecion block table.
|
|
* @param size number of maximum entries
|
|
* @return pointer to newly created connection block descriptor table
|
|
*/
|
|
CbdTable * cbdt_new(uint8_t size);
|
|
|
|
/**
|
|
* Allocate new connection block
|
|
* @param cbdt pointer to CBDT
|
|
* @return connection block descriptor OR CBDT_ERR
|
|
*/
|
|
cbd cbdt_alloc_new(CbdTable * cbdt, const ConnBlock * connBlock);
|
|
|
|
/**
|
|
* Release connection block.
|
|
* @param cbdt pointer to CBDT
|
|
* @param d CBD value
|
|
*/
|
|
void cbdt_release(CbdTable * cbdt, cbd d);
|
|
|
|
/**
|
|
* Get connection block
|
|
* @param cbdt pointer to CBDT
|
|
* @param d CBD value
|
|
* @param connBlock pointer to connection block where the results will be written
|
|
* @return indicates that fetch was successful or not
|
|
*/
|
|
bool cbdt_get_connection_block(CbdTable * cbdt, cbd d, ConnBlock * connBlock);
|
|
|
|
/**
|
|
* Print report on connection block descriptors.
|
|
* @param cbdt pointer to CBD table
|
|
*/
|
|
void cbdt_report(const CbdTable * cbdt);
|
|
|
|
#endif //ETHERLIB_CBD_TABLE_H
|