-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDQMSvc.h
57 lines (43 loc) · 983 Bytes
/
DQMSvc.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
#define EM_MAX_TARGET_IP 8
#define EM_LOGDIR "@em_log"
#define EM_LOGPREFIX "em"
#define EM_CONFIG_FN "@DNSQueryMirror.config"
#define EM_MAX_QUEUE_SIZE 10000
// Types
struct EM_CONFIG
{
char InputIf[MAX_PATH];
char OutputIf[MAX_PATH];
char OutputMac[6];
UCHAR Padding[2];
IP OutputArpSrc;
IP OutputGwIp;
UINT OutputUdpSrcPort;
UINT NumTargetIp;
IP TargetIpList[EM_MAX_TARGET_IP];
UCHAR OutputGwMac[6];
UINT64 OutputGwMacLastSeen;
UINT ArpInterval;
UINT ArpTimeout;
};
struct EM
{
LOG *Log;
EM_CONFIG *Config;
THREAD *RecvThread;
THREAD *SendThread;
bool Halt;
QUEUE *SendQueue;
LOCK *Lock;
CANCEL *SendCancel;
UINT64 next_arp_send_tick;
};
// Functions
EM *NewEm();
void FreeEm(EM *m);
void EmLog(EM *m, char *name, ...);
EM_CONFIG *EmLoadConfig(char *fn);
void EmFreeConfig(EM_CONFIG *c);
void EmRecvThread(THREAD *thread, void *param);
void EmSendThread(THREAD *thread, void *param);
PKT *EmParsePacket(EM *m, UCHAR *data, UINT size);