summaryrefslogtreecommitdiff
path: root/hash.h
diff options
context:
space:
mode:
authorpdw <>2002-03-24 16:22:26 +0000
committerpdw <>2002-03-24 16:22:26 +0000
commit3004ea063cbb186a63af99a2e13d7cb09f23360d (patch)
treed617af0ad0619334f899d3405350edb9b1b2407b /hash.h
downloadiftop-3004ea063cbb186a63af99a2e13d7cb09f23360d.zip
iftop
Diffstat (limited to 'hash.h')
-rw-r--r--hash.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/hash.h b/hash.h
new file mode 100644
index 0000000..b8f0d7b
--- /dev/null
+++ b/hash.h
@@ -0,0 +1,39 @@
+/*
+ * addr_hash.h:
+ *
+ */
+
+#ifndef __HASH_H_ /* include guard */
+#define __HASH_H_
+
+/* implementation independent declarations */
+typedef enum {
+ HASH_STATUS_OK,
+ HASH_STATUS_MEM_EXHAUSTED,
+ HASH_STATUS_KEY_NOT_FOUND
+} hash_status_enum;
+
+typedef struct node_tag {
+ struct node_tag *next; /* next node */
+ void* key; /* key */
+ void* rec; /* user data */
+} hash_node_type;
+
+typedef struct {
+ int (*compare) (void*, void*);
+ int (*hash) (void*);
+ void* (*copy_key) (void*);
+ void (*delete_key) (void*);
+ hash_node_type** table;
+ int size;
+} hash_type;
+
+
+hash_status_enum hash_initialise(hash_type*);
+hash_status_enum hash_destroy(hash_type*);
+hash_status_enum hash_insert(hash_type*, void* key, void *rec);
+hash_status_enum hash_delete(hash_type* hash_table, void* key);
+hash_status_enum hash_find(hash_type* hash_table, void* key, void** rec);
+hash_status_enum hash_next_item(hash_type* hash_table, hash_node_type** ppnode);
+
+#endif /* __HASH_H_ */