X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=dummynet%2Fhashtable.h;h=4fcba228ce8f89a9284b3de8f6e1a85f157172c2;hb=31b969263c34f46f398eec33c0b0e95947842cda;hp=a20b7b4441c111e035c113148dfa3fd81455ae23;hpb=f1a44f1ebacf274e0f35970bfc8ee5aa07aa9aca;p=ipfw.git diff --git a/dummynet/hashtable.h b/dummynet/hashtable.h index a20b7b4..4fcba22 100644 --- a/dummynet/hashtable.h +++ b/dummynet/hashtable.h @@ -11,34 +11,34 @@ * objects are the same (XXX we could spare this if we also * pass a key_size and use a bcmp for comparisons) * Not extensible at the moment. - * max_el and max_ratio currently unused. */ struct malloc_type; -struct new_hash_table * new_table_init (int size, int obj_size, +struct ipfw_ht; +struct ipfw_ht* ipfw_ht_new(int size, int obj_size, uint32_t (hash_fn)(const void *, uint32_t size), - int (cmp_fn)(const void*, const void*), + int (cmp_fn)(const void*, const void*, int sz), struct malloc_type *mtype); +void *ipfw_ht_destroy(struct ipfw_ht *h); /* add a new object to the table, return success/failure */ -int new_table_insert_obj (struct new_hash_table *h, const void *obj); +int ipfw_ht_insert(struct ipfw_ht *h, const void *obj); /* * returns a pointer to the matching object or NULL if not found. * No refcounts. */ -const void *new_table_extract_obj(struct new_hash_table *h, const void *key); +const void *ipfw_ht_extract(struct ipfw_ht *h, const void *key); /* remove an object from the table */ -int new_table_delete_obj(struct new_hash_table *h, const void *key); -void *new_table_destroy(struct new_hash_table *h); +int ipfw_ht_remove(struct ipfw_ht *h, const void *key); /* return the number of elements in the table */ -int new_table_get_element(const struct new_hash_table *h); +int ipfw_ht_count(const struct ipfw_ht *h); /* returns the first or next element. Works by hashing the * current object and then finds the next one. * If obj == NULL returns the first object in the table */ -const void *table_next(struct new_hash_table *h, const void *obj); +const void *ipfw_ht_next(struct ipfw_ht *h, const void *obj); #endif