File: hash.h

package info (click to toggle)
ipband 0.8.1-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 236 kB
  • ctags: 179
  • sloc: ansic: 1,679; sh: 117; makefile: 103
file content (48 lines) | stat: -rwxr-xr-x 1,228 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef HASH_H__
#define HASH_H__

/*
------------------------------------------------------------------------
Defines
------------------------------------------------------------------------
*/
#define N_HASH_SLOTS 10000 


/*
------------------------------------------------------------------------
Type Definitions
------------------------------------------------------------------------
*/
/* Table node structure */
typedef struct hlist_s {
	struct hlist_s *next;
	u_char *key;
	int    nkey;
	u_char *data;
	int    ndata;
	}
	hlist_t;

/* Table iterator structure */
typedef struct hiter_s {
	int index;
	hlist_t *ptr;
	}
	hiter_t;

/*
------------------------------------------------------------------------
Function Prototypes
------------------------------------------------------------------------
*/
hlist_t **hash_init () ;
int       hash_finddata (hlist_t **, u_char *, int, u_char **, int *);
int 	  hash_delnode  (hlist_t **, u_char *, int);
int       hash_addnode  (hlist_t **, u_char *, int, u_char *, int) ;
int       hash_getcount	(hlist_t **);
hlist_t **hash_getlist	(hlist_t **, int *);
hlist_t  *hash_getnext  (hlist_t **, hiter_t *);
hlist_t  *hash_getfirst (hlist_t **, hiter_t *);

#endif	/* HASH_H__ */