forked from hoterran/tcpcollect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysqlpcap.h
56 lines (45 loc) · 1.45 KB
/
mysqlpcap.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
#ifndef _MYSQLPCAP_
#define _MYSQLPCAP_
struct _MysqlPcap;
typedef struct _MysqlPcap MysqlPcap;
typedef int (*initFp) (MysqlPcap *);
typedef int (*addFp) (MysqlPcap *, const char *fmt, ...);
typedef int (*flushFp) (MysqlPcap *, int force);
#include <pcap.h>
#include <sys/time.h>
#define HOST_NAME_LEN 64
struct _MysqlPcap {
void *pd;
char hostname[HOST_NAME_LEN];
int mysqlPort;
char filter[10240]; /* 15(ip) * 100 */
char netDev[10];
bpf_u_int32 netmask;
bpf_u_int32 localnet;
char keyWord[256];
void *hash;
pthread_mutex_t aux_mutex;
pthread_t aux_thread_id;
char *address; /* user input */
void *al; /* address list */
void *new_al; /* new list, lock then switch*/
int isShowSrcIp;
void *focusUser;
void *filterUser;
time_t fakeNow;
time_t lastReloadAddressTime;
long packetSeq; /* packet sequence */
/* for debug */
ulong datalen;
char is_in;
uint32 tcp_seq;
/* cache */
initFp initCache;
addFp addCache;
flushFp flushCache;
char cacheFileName[256]; /* only use file cache */
char cacheConfigFileName[256]; /* redis config, mysql config */
void *config; /* fd, redisContext, MYSQL */
time_t cacheFlushTime;
};
#endif