forked from yaosj2k/dnsforwarder
-
Notifications
You must be signed in to change notification settings - Fork 10
/
simpleht.h
executable file
·32 lines (20 loc) · 879 Bytes
/
simpleht.h
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
#ifndef SIMPLEHT_H_INCLUDED
#define SIMPLEHT_H_INCLUDED
#include "array.h"
typedef struct _Sht_NodeHead{
int32_t Next;
uint32_t HashValue;
} Sht_NodeHead;
typedef struct _SimpleHT {
Array Slots;
Array Nodes;
size_t MaxLoadFactor;
size_t LeftSpace;
uint32_t (*HashFunction)(const char *, uint32_t);
} SimpleHT;
int SimpleHT_Init(SimpleHT *ht, int DataLength, size_t MaxLoadFactor, uint32_t (*HashFunction)(const char *, uint32_t));
const char *SimpleHT_Add(SimpleHT *ht, const char *Key, int KeyLength, const char *Data, const uint32_t *HashValue);
const char *SimpleHT_Find(SimpleHT *ht, const char *Key, int KeyLength, const uint32_t *HashValue, const char *Start);
const char *SimpleHT_Enum(SimpleHT *ht, int32_t *Start);
void SimpleHT_Free(SimpleHT *ht);
#endif /* SIMPLEHT_H_INCLUDED */