File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / iftop / hash.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 16:57:34 2012 UTC (12 years, 3 months ago) by misho
Branches: iftop, MAIN
CVS tags: v1_0rc4, v0_17p0, v0_17, HEAD
iftop

    1: /*
    2:  * addr_hash.h:
    3:  *
    4:  */
    5: 
    6: #ifndef __HASH_H_ /* include guard */
    7: #define __HASH_H_
    8: 
    9: /* implementation independent declarations */
   10: typedef enum {
   11:     HASH_STATUS_OK,
   12:     HASH_STATUS_MEM_EXHAUSTED,
   13:     HASH_STATUS_KEY_NOT_FOUND
   14: } hash_status_enum;
   15: 
   16: typedef struct node_tag {
   17:     struct node_tag *next;       /* next node */
   18:     void* key;                /* key */
   19:     void* rec;                /* user data */
   20: } hash_node_type;
   21: 
   22: typedef struct {
   23:     int (*compare) (void*, void*);
   24:     int (*hash) (void*);
   25:     void* (*copy_key) (void*);
   26:     void (*delete_key) (void*);
   27:     hash_node_type** table;
   28:     int size;
   29: } hash_type;
   30: 
   31: 
   32: hash_status_enum hash_initialise(hash_type*);
   33: hash_status_enum hash_destroy(hash_type*);
   34: hash_status_enum hash_insert(hash_type*, void* key, void *rec);
   35: hash_status_enum hash_delete(hash_type* hash_table, void* key);
   36: hash_status_enum hash_find(hash_type* hash_table, void* key, void** rec);
   37: hash_status_enum hash_next_item(hash_type* hash_table, hash_node_type** ppnode);
   38: void hash_delete_all(hash_type* hash_table);
   39: 
   40: #endif /* __HASH_H_ */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>