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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
* \file
* PTRHASH (PH) - A simple hash table
*/
;
void ; /* IN: secondary initval, OUT: secondary hash */
/**
* Add an element to hash table, using a field as a key.
* @param table: hash table pointer.
* @param eptr: pointer to the element (struct) to add.
* @param keyfield: name of the field containing the key (size is computed
* automatically)
* @return 0: if element was added, 1: if already present, -1: if table is full.
*/
/**
* Get an element from the hash table.
* @param table: hash table pointer.
* @param key: pointer to key bytes
* @param keyfield: name of the field containing the key (size is computed
* automatically)
* @param out: pointer to the found element
*/
/**
* Remove an element from the hash table.
* @param table: hash table pointer.
* @param key: pointer to key bytes
* @param keyfield: name of the field containing the key (size is computed
* automatically)
* @param out: pointer to the removed element
*/
struct ph_table *;
/**
* Add an element to hash table, using key embedded in 'value' structure.
* @param h: hash table pointer.
* @param value: pointer to the element (struct) to add.
* @param keyoff: offset in bytes of the key to use, in the *value structure.
* @param keylen: length in bytes of the key.
* @return 0 if element was added, 1 if already present, -1 if table is full.
*/
int ;
/**
* Get an element from hash table, using the specified key.
* @param h: hash table pointer.
* @param key: pointer to the key bytes.
* @param keyoff: offset in bytes of the key to use, in the *ptr structure.
* @param keylen: length in bytes of the key.
* @return element pointer or NULL if not found.
*/
void *;
/**
* Remove an element from hash table, using the specified key.
* @param h: hash table pointer.
* @param key: pointer to the key bytes.
* @param keyoff: offset in bytes of the key in the value structure.
* @param keylen: length in bytes of the key.
* @return element pointer or NULL if not found.
*/
void *;
/**
* Returns the number of elements of the hash table.
* @param h: hash table pointer.
* @return number of elements currently stored
*/
static inline size_t