OLD | NEW |
| (Empty) |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
4 /* | |
5 * pkix_pl_primhash.h | |
6 * | |
7 * Primitive Hashtable Definition | |
8 * | |
9 */ | |
10 | |
11 #ifndef _PKIX_PL_PRIMHASH_H | |
12 #define _PKIX_PL_PRIMHASH_H | |
13 | |
14 #include "pkix_pl_common.h" | |
15 | |
16 #ifdef __cplusplus | |
17 extern "C" { | |
18 #endif | |
19 | |
20 typedef struct pkix_pl_HT_Elem pkix_pl_HT_Elem; | |
21 | |
22 typedef struct pkix_pl_PrimHashTable pkix_pl_PrimHashTable; | |
23 | |
24 typedef struct pkix_pl_Integer pkix_pl_Integer; | |
25 | |
26 struct pkix_pl_Integer{ | |
27 PKIX_UInt32 ht_int; | |
28 }; | |
29 | |
30 struct pkix_pl_HT_Elem { | |
31 void *key; | |
32 void *value; | |
33 PKIX_UInt32 hashCode; | |
34 pkix_pl_HT_Elem *next; | |
35 }; | |
36 | |
37 struct pkix_pl_PrimHashTable { | |
38 pkix_pl_HT_Elem **buckets; | |
39 PKIX_UInt32 size; | |
40 }; | |
41 | |
42 /* see source file for function documentation */ | |
43 | |
44 PKIX_Error * | |
45 pkix_pl_PrimHashTable_Create( | |
46 PKIX_UInt32 numBuckets, | |
47 pkix_pl_PrimHashTable **pResult, | |
48 void *plContext); | |
49 | |
50 PKIX_Error * | |
51 pkix_pl_PrimHashTable_Add( | |
52 pkix_pl_PrimHashTable *ht, | |
53 void *key, | |
54 void *value, | |
55 PKIX_UInt32 hashCode, | |
56 PKIX_PL_EqualsCallback keyComp, | |
57 void *plContext); | |
58 | |
59 PKIX_Error * | |
60 pkix_pl_PrimHashTable_Remove( | |
61 pkix_pl_PrimHashTable *ht, | |
62 void *key, | |
63 PKIX_UInt32 hashCode, | |
64 PKIX_PL_EqualsCallback keyComp, | |
65 void **pKey, | |
66 void **pValue, | |
67 void *plContext); | |
68 | |
69 PKIX_Error * | |
70 pkix_pl_PrimHashTable_Lookup( | |
71 pkix_pl_PrimHashTable *ht, | |
72 void *key, | |
73 PKIX_UInt32 hashCode, | |
74 PKIX_PL_EqualsCallback keyComp, | |
75 void **pResult, | |
76 void *plContext); | |
77 | |
78 PKIX_Error* | |
79 pkix_pl_PrimHashTable_Destroy( | |
80 pkix_pl_PrimHashTable *ht, | |
81 void *plContext); | |
82 | |
83 PKIX_Error * | |
84 pkix_pl_PrimHashTable_GetBucketSize( | |
85 pkix_pl_PrimHashTable *ht, | |
86 PKIX_UInt32 hashCode, | |
87 PKIX_UInt32 *pBucketSize, | |
88 void *plContext); | |
89 | |
90 PKIX_Error * | |
91 pkix_pl_PrimHashTable_RemoveFIFO( | |
92 pkix_pl_PrimHashTable *ht, | |
93 PKIX_UInt32 hashCode, | |
94 void **pKey, | |
95 void **pValue, | |
96 void *plContext); | |
97 | |
98 #ifdef __cplusplus | |
99 } | |
100 #endif | |
101 | |
102 #endif /* _PKIX_PL_PRIMHASH_H */ | |
OLD | NEW |