00001 00054 #ifndef _HASHTABLE_H_ 00055 #define _HASHTABLE_H_ 00056 00057 #include "common.h" 00058 00059 #define MINSIZE 11 00060 #define HTSIZE 1279 // a large prime number, has to be greater than MINSIZE 00061 00063 typedef enum { 00064 VALID = 1, 00065 INVALID = 2, 00066 DELETED = 3, 00067 LATE = 4 00068 } ht_state; 00069 00071 typedef struct { 00072 00074 u_char *packet; 00075 00077 ht_state state; 00078 00080 time_t timestamp; 00081 00082 } ht_bucket; 00083 00085 typedef struct { 00086 00088 ht_bucket *table; 00089 00091 unsigned int size; 00092 00094 unsigned int count; 00095 00096 } hashtable; 00097 00098 00100 00103 hashtable* createHashtable(unsigned int size); 00104 00106 00116 int makeEntry(hashtable* ht, u_char* raw, clock_t time); 00117 00119 00126 int performID(hashtable* ht, u_char* raw, clock_t time); 00127 00129 00132 void print(hashtable* ht); 00133 00135 00137 void dump_packet(u_char* packet); 00138 00140 00142 void hex_dump_packet(u_char* packet); 00143 00144 #endif