forked from Angelic47/aids-dpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aids.h
67 lines (57 loc) · 1.35 KB
/
aids.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
61
62
63
64
65
66
67
#ifndef AIDS_H
#define AIDS_H
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <net/netfilter/nf_conntrack.h>
#include <linux/jiffies.h>
#define NIPQUAD(addr) \
((unsigned char *)&(addr))[0], \
((unsigned char *)&(addr))[1], \
((unsigned char *)&(addr))[2], \
((unsigned char *)&(addr))[3]
#define AIDS_CONNECTION_TIMEOUT_MS (1000 * 180)
#define AIDS_CONNECTION_TIMEOUT (jiffies_64 + msecs_to_jiffies(AIDS_CONNECTION_TIMEOUT_MS))
#define AIDS_CONNECTION_TIMEOUT_IMM (jiffies_64 - 1)
enum aids_connection_direct
{
AIDS_IN = 0,
AIDS_OUT = 1
};
enum aids_skb_direct
{
AIDS_SKB_PREROUTE = 0,
AIDS_SKB_POSTROUTE = 1
};
enum aids_connection_status
{
AIDS_CONNECTION_UNTRACK = 0,
AIDS_CONNECTION_SYN_SENT = 1,
AIDS_CONNECTION_SYN_RECV = 2,
AIDS_CONNECTION_ESTABLISHED = 3,
AIDS_CONNECTION_FIN_1 = 4,
AIDS_CONNECTION_FIN_2 = 5,
AIDS_CONNECTION_FIN_3 = 6,
AIDS_CONNECTION_CLOSED = 7,
};
struct aids_connection_info
{
ktime_t begintime;
u64 timeout;
u32 saddr;
u32 daddr;
u16 sport;
u16 dport;
enum ip_conntrack_info ctinfo;
u8 protocol;
u32 appid;
enum aids_connection_direct direct;
u8 pkt_count;
enum aids_connection_status conn_status;
u32 tcp_seq;
u32 tcp_ack_seq;
u8 is_http;
};
char* aids_get_connection_status_message(enum aids_connection_status conn_status);
char* aids_get_proto_message(u8 proto);
#endif