linux 2.6 conntrack stats
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
713B

  1. #ifndef _HASHTABLE_H_
  2. #define _HASHTABLE_H_
  3. #include <inttypes.h>
  4. #include <pthread.h>
  5. struct hash_entry {
  6. struct hash_entry *next;
  7. uint32_t src_ip;
  8. uint16_t dst_port;
  9. uint8_t protonum;
  10. uint8_t flags;
  11. uint64_t src_bytes;
  12. uint64_t dst_bytes;
  13. uint32_t count;
  14. };
  15. struct hash_table {
  16. uint32_t buckets;
  17. uint32_t hash_rnd;
  18. pthread_mutex_t mutex;
  19. struct hash_entry *bucket[0];
  20. };
  21. struct hash_table * create_hash(uint32_t buckets);
  22. void purge_hash(struct hash_table *table,
  23. void (*callback)(const struct hash_entry *entry, void *privdata),
  24. void *privdata);
  25. void destroy_hash(struct hash_table *table);
  26. void hash_add(struct hash_table *table, struct hash_entry *entry);
  27. #endif /* _HASHTABLE_H_ */