forked from yaosj2k/dnsforwarder
-
Notifications
You must be signed in to change notification settings - Fork 10
/
cachettlcrtl.h
executable file
·37 lines (25 loc) · 1.09 KB
/
cachettlcrtl.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
#ifndef CACHETTLCRTL_H_INCLUDED
#define CACHETTLCRTL_H_INCLUDED
#include "stringchunk.h"
#define TTL_STATE_NO_CACHE 0
#define TTL_STATE_ORIGINAL (-1)
#define TTL_STATE_FIXED (1)
#define TTL_STATE_VARIABLE (2)
#define TTL_CTRL_INFECTION_AGGRESSIVLY 0
#define TTL_CTRL_INFECTION_PASSIVLY (1)
#define TTL_CTRL_INFECTION_NONE (2)
typedef struct _CtrlContent {
int State;
uint32_t Coefficient;
uint32_t Increment;
int Infection;
} CtrlContent;
/* Final TTL = Coefficient * State + Increment, if State is positive. */
typedef StringChunk CacheTtlCtrl;
void CacheTtlCrtl_Free(CacheTtlCtrl *c);
int CacheTtlCrtl_Init(CacheTtlCtrl *c);
int CacheTtlCrtl_Add(CacheTtlCtrl *c, const char *Domain, int State, uint32_t Coefficient, uint32_t Increment, int Infection);
int CacheTtlCrtl_Add_From_String(CacheTtlCtrl *c, const char *Rule);
int CacheTtlCrtl_Add_From_StringList(CacheTtlCtrl *c, StringList *sl);
const CtrlContent *CacheTtlCrtl_Get(CacheTtlCtrl *c, const char *Domain);
#endif /* CACHETTLCRTL_H_INCLUDED */