#ifndef __Mbrd_HashTable_h__
#define __Mbrd_HashTable_h__ 1
#include <DirectoryServiceCore/DSUtils.h>
#include <pthread.h>
#include <unistd.h>
#include <stdbool.h>
#include <dispatch/dispatch.h>
#include "rb.h"
typedef enum eHashType
{
eIDHash = 1,
eGUIDHash = 2,
eSIDHash = 3,
eNameHash = 4,
eKerberosHash = 5,
eX509DNHash = 6
} eHashType;
typedef struct HashTable
{
volatile int32_t fRefCount;
dispatch_queue_t fQueue;
struct rb_tree fRBtree;
uint32_t fHashType;
long fKeyOffset;
long fNumEntries;
void * fOwner;
const char * fName;
} HashTable;
struct UserGroup;
__BEGIN_DECLS
HashTable* HashTable_Create( const char *name, void *owner, eHashType hashType );
void HashTable_Initialize( HashTable *hash, const char *name, void *owner, eHashType hashType );
void HashTable_FreeContents( HashTable *hash );
void HashTable_Reset( HashTable* hash );
int HashTable_ResetMemberships( HashTable *hash );
#define HashTable_Retain(a) ((HashTable *) dsRetainObject(a, &a->fRefCount))
void HashTable_Release( HashTable* hash );
bool HashTable_Add( HashTable* hash, struct UserGroup* item, bool replaceExisting );
struct UserGroup* HashTable_GetAndRetain( HashTable* hash, const void* data );
void HashTable_Remove( HashTable* hash, struct UserGroup* item );
void HashTable_Merge( HashTable* destination, HashTable* source );
int HashTable_CreateItemArray( HashTable *hash, struct UserGroup*** itemArray );
__END_DECLS
#endif