forked from yaosj2k/dnsforwarder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stringchunk.h
executable file
·49 lines (35 loc) · 1.22 KB
/
stringchunk.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef STRINGCHUNK_H_INCLUDED
#define STRINGCHUNK_H_INCLUDED
#include "simpleht.h"
#include "stringlist.h"
#include "array.h"
#include "extendablebuffer.h"
typedef struct _StringChunk{
StringList *List;
/* Positions of every domain in `List', offsets */
SimpleHT List_Pos;
/* Positions of every domain in `List_W', offsets */
Array List_W_Pos;
/* Chunk of all additional datas */
ExtendableBuffer AdditionalDataChunk;
} StringChunk;
int StringChunk_Init(StringChunk *dl, StringList *List);
int StringChunk_Add(StringChunk *dl,
const char *Str,
const char *AdditionalData,
int LengthOfAdditionalData
);
/* NOTICE : Data address always return, not offset. */
BOOL StringChunk_Match_NoWildCard(StringChunk *dl,
const char *Str,
int *HashValue,
char **Data
);
BOOL StringChunk_Match_OnlyWildCard(StringChunk *dl,
const char *Str,
char **Data
);
BOOL StringChunk_Match(StringChunk *dl, const char *Str, int *HashValue, char **Data);
const char *StringChunk_Enum_NoWildCard(StringChunk *dl, int32_t *Start, char **Data);
void StringChunk_Free(StringChunk *dl, BOOL FreeStringList);
#endif // STRINGCHUNK_H_INCLUDED