forked from yaosj2k/dnsforwarder
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathipchunk.h
executable file
·60 lines (47 loc) · 1.54 KB
/
ipchunk.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
50
51
52
53
54
55
56
57
58
59
60
#ifndef IPCHUNK_H_INCLUDED
#define IPCHUNK_H_INCLUDED
#include "bst.h"
#include "stablebuffer.h"
#include "common.h"
typedef struct _IpElement {
int IpLength;
union {
uint32_t Ipv4;
char Ipv6[16];
} Ip;
int Type;
void *Data;
} IpElement;
typedef struct _IpChunk{
Bst Chunk;
StableBuffer Datas;
} IpChunk;
int IpChunk_Init(IpChunk *ic);
int IpChunk_Add(IpChunk *ic,
uint32_t Ip,
int Type,
const void *Data,
uint32_t DataLength
);
int IpChunk_AddFromString(IpChunk *ic,
const char *Ip,
int Type,
const char *Data,
uint32_t DataLength
);
int IpChunk_Add6(IpChunk *ic, const char *Ipv6, int Type, const char *Data, uint32_t DataLength);
int IpChunk_Add6FromString(IpChunk *ic,
const char *Ip,
int Type,
const char *Data,
uint32_t DataLength
);
int IpChunk_AddAnyFromString(IpChunk *ic,
const char *Ip,
int Type,
const char *Data,
uint32_t DataLength
);
BOOL IpChunk_Find(IpChunk *ic, uint32_t Ip, int *Type, const char **Data);
BOOL IpChunk_Find6(IpChunk *ic, const char *Ipv6, int *Type, const char **Data);
#endif // IPCHUNK_H_INCLUDED