1 /* See the DRL-LICENSE file for this file's software license. */
4 * Defines the simplest flow accouting table. It only keeps track of
5 * aggregate rate information in the common table. It does no
6 * individual flow accounting.
10 #ifndef _SIMPLE_ACCOUNTING_H_
11 #define _SIMPLE_ACCOUNTING_H_
15 /** The "table" that stores the aggregate information. It's constructed of two
18 struct sim_flow_table {
20 /* Pointer to the common flow information for the identity that owns this
21 * sampled flow table. This is updated with aggregate information. */
22 common_accounting_t *common;
24 uint32_t (*hash_function)(const key_flow *key);
28 typedef struct sim_flow_table *simple_flow_table;
31 * Creates a new table. Note that the hash function is never used by this type
34 * Returns the new table or NULL on failure.
36 simple_flow_table simple_table_create(common_accounting_t *common);
39 * Destroys the specified table.
41 void simple_table_destroy(simple_flow_table table);
44 * Updates the state of the table given a newly acquired packet.
46 * This function will always return zero because this type of table stores no
49 int simple_table_sample(simple_flow_table table, const key_flow *key);
51 /** Cleans the table. This is a no-op for this type of table. */
52 int simple_table_cleanup(simple_flow_table table);
54 /** Updates the aggregate rate information. */
55 void simple_table_update_flows(simple_flow_table table, struct timeval now,
58 #endif /* _SIMPLE_ACCOUNTING_H_ */