andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public
andre@0:  * License, v. 2.0. If a copy of the MPL was not distributed with this
andre@0:  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
andre@0: /*
andre@0:  * pkix_pl_primhash.h
andre@0:  *
andre@0:  * Primitive Hashtable Definition
andre@0:  *
andre@0:  */
andre@0: 
andre@0: #ifndef _PKIX_PL_PRIMHASH_H
andre@0: #define _PKIX_PL_PRIMHASH_H
andre@0: 
andre@0: #include "pkix_pl_common.h"
andre@0: 
andre@0: #ifdef __cplusplus
andre@0: extern "C" {
andre@0: #endif
andre@0: 
andre@0: typedef struct pkix_pl_HT_Elem pkix_pl_HT_Elem;
andre@0: 
andre@0: typedef struct pkix_pl_PrimHashTable pkix_pl_PrimHashTable;
andre@0: 
andre@0: typedef struct pkix_pl_Integer pkix_pl_Integer;
andre@0: 
andre@0: struct pkix_pl_Integer{
andre@0:         PKIX_UInt32 ht_int;
andre@0: };
andre@0: 
andre@0: struct pkix_pl_HT_Elem {
andre@0:         void *key;
andre@0:         void *value;
andre@0:         PKIX_UInt32 hashCode;
andre@0:         pkix_pl_HT_Elem *next;
andre@0: };
andre@0: 
andre@0: struct pkix_pl_PrimHashTable {
andre@0:         pkix_pl_HT_Elem **buckets;
andre@0:         PKIX_UInt32 size;
andre@0: };
andre@0: 
andre@0: /* see source file for function documentation */
andre@0: 
andre@0: PKIX_Error *
andre@0: pkix_pl_PrimHashTable_Create(
andre@0:         PKIX_UInt32 numBuckets,
andre@0:         pkix_pl_PrimHashTable **pResult,
andre@0:         void *plContext);
andre@0: 
andre@0: PKIX_Error *
andre@0: pkix_pl_PrimHashTable_Add(
andre@0:         pkix_pl_PrimHashTable *ht,
andre@0:         void *key,
andre@0:         void *value,
andre@0:         PKIX_UInt32 hashCode,
andre@0:         PKIX_PL_EqualsCallback keyComp,
andre@0:         void *plContext);
andre@0: 
andre@0: PKIX_Error *
andre@0: pkix_pl_PrimHashTable_Remove(
andre@0:         pkix_pl_PrimHashTable *ht,
andre@0:         void *key,
andre@0:         PKIX_UInt32 hashCode,
andre@0:         PKIX_PL_EqualsCallback keyComp,
andre@0:         void **pKey,
andre@0:         void **pValue,
andre@0:         void *plContext);
andre@0: 
andre@0: PKIX_Error *
andre@0: pkix_pl_PrimHashTable_Lookup(
andre@0:         pkix_pl_PrimHashTable *ht,
andre@0:         void *key,
andre@0:         PKIX_UInt32 hashCode,
andre@0:         PKIX_PL_EqualsCallback keyComp,
andre@0:         void **pResult,
andre@0:         void *plContext);
andre@0: 
andre@0: PKIX_Error*
andre@0: pkix_pl_PrimHashTable_Destroy(
andre@0:         pkix_pl_PrimHashTable *ht,
andre@0:         void *plContext);
andre@0: 
andre@0: PKIX_Error *
andre@0: pkix_pl_PrimHashTable_GetBucketSize(
andre@0:         pkix_pl_PrimHashTable *ht,
andre@0:         PKIX_UInt32 hashCode,
andre@0:         PKIX_UInt32 *pBucketSize,
andre@0:         void *plContext);
andre@0: 
andre@0: PKIX_Error *
andre@0: pkix_pl_PrimHashTable_RemoveFIFO(
andre@0:         pkix_pl_PrimHashTable *ht,
andre@0:         PKIX_UInt32 hashCode,
andre@0:         void **pKey,
andre@0:         void **pValue,
andre@0:         void *plContext);
andre@0: 
andre@0: #ifdef __cplusplus
andre@0: }
andre@0: #endif
andre@0: 
andre@0: #endif /* _PKIX_PL_PRIMHASH_H */