/* See the DRL-LICENSE file for this file's software license. */ /** * Defines the simplest flow accouting table. It only keeps track of * aggregate rate information in the common table. It does no * individual flow accounting. * */ #ifndef _SIMPLE_ACCOUNTING_H_ #define _SIMPLE_ACCOUNTING_H_ #include /** The "table" that stores the aggregate information. It's constructed of two * main pieces. */ struct sim_flow_table { /* Pointer to the common flow information for the identity that owns this * sampled flow table. This is updated with aggregate information. */ common_accounting_t *common; uint32_t (*hash_function)(const key_flow *key); }; typedef struct sim_flow_table *simple_flow_table; /** * Creates a new table. Note that the hash function is never used by this type * of table. * * Returns the new table or NULL on failure. */ simple_flow_table simple_table_create(common_accounting_t *common); /** * Destroys the specified table. */ void simple_table_destroy(simple_flow_table table); /** * Updates the state of the table given a newly acquired packet. * * This function will always return zero because this type of table stores no * flow information. */ int simple_table_sample(simple_flow_table table, const key_flow *key); /** Cleans the table. This is a no-op for this type of table. */ int simple_table_cleanup(simple_flow_table table); /** Updates the aggregate rate information. */ void simple_table_update_flows(simple_flow_table table, struct timeval now, double ewma_weight); #endif /* _SIMPLE_ACCOUNTING_H_ */