forked from yaosj2k/dnsforwarder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpleht.h
32 lines (20 loc) · 772 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;
int HashValue;
} Sht_NodeHead;
typedef struct _SimpleHT {
Array Slots;
Array Nodes;
size_t MaxLoadFactor;
size_t LeftSpace;
int (*HashFunction)(const char *, int);
} SimpleHT;
int SimpleHT_Init(SimpleHT *ht, int DataLength, size_t MaxLoadFactor, int (*HashFunction)(const char *, int));
const char *SimpleHT_Add(SimpleHT *ht, const char *Key, int KeyLength, const char *Data, int *HashValue);
const char *SimpleHT_Find(SimpleHT *ht, const char *Key, int KeyLength, int *HashValue, const char *Start);
const char *SimpleHT_Enum(SimpleHT *ht, int32_t *Start);
void SimpleHT_Free(SimpleHT *ht);
#endif // SIMPLEHT_H_INCLUDED