* 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