-
Notifications
You must be signed in to change notification settings - Fork 494
/
ec_conntrack.h
96 lines (73 loc) · 2.54 KB
/
ec_conntrack.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef ETTERCAP_CONNTRACK_H
#define ETTERCAP_CONNTRACK_H
#include <ec_profiles.h>
#include <ec_connbuf.h>
/* conntrack hook definition */
struct ct_hook_list {
void (*func)(struct packet_object *po);
SLIST_ENTRY (ct_hook_list) next;
};
/* conntrack object */
struct conn_object {
/* last updated (for connection timeout) */
struct timeval ts;
/* mac addresses */
u_int8 L2_addr1[MEDIA_ADDR_LEN];
u_int8 L2_addr2[MEDIA_ADDR_LEN];
/* ip addresses */
struct ip_addr L3_addr1;
struct ip_addr L3_addr2;
/* port numbers */
u_int16 L4_addr1;
u_int16 L4_addr2;
u_int8 L4_proto;
/* buffered data */
struct conn_buf data;
/* byte count since the creation */
u_int32 xferred; /* XXX: remove it some day */
u_int32 tx; /* from 1 to 2 */
u_int32 rx; /* from 2 to 1 */
/* connection status */
int status;
/* flags for injection/modifications */
int flags;
/* username and password */
struct dissector_info DISSECTOR;
/* hookpoint to receive only packet of this connection */
SLIST_HEAD(, ct_hook_list) hook_head;
};
struct conn_tail {
struct conn_object *co;
struct conn_hash_search *cs;
TAILQ_ENTRY(conn_tail) next;
};
enum {
CONN_IDLE = 0,
CONN_OPENING = 1,
CONN_OPEN = 2,
CONN_ACTIVE = 3,
CONN_CLOSING = 4,
CONN_CLOSED = 5,
CONN_KILLED = 6,
};
enum {
CONN_INJECTED = 1,
CONN_MODIFIED = 2,
CONN_VIEWING = 4,
};
/* exported functions */
EC_API_EXTERN void * conntrack_print(int mode, void *list, char **desc, size_t len);
EC_API_EXTERN void * conntrack_get(int mode, void *list, struct conn_object **conn);
EC_API_EXTERN int conntrack_protostr(struct conn_object *conn, char *pstr, int len);
EC_API_EXTERN int conntrack_flagstr(struct conn_object *conn, char *pstr, int len);
EC_API_EXTERN int conntrack_statusstr(struct conn_object *conn, char *pstr, int len);
EC_API_EXTERN int conntrack_countrystr(struct conn_object *conn, char *pstr, int len);
EC_API_EXTERN EC_THREAD_FUNC(conntrack_timeouter);
EC_API_EXTERN void conntrack_purge(void);
EC_API_EXTERN int conntrack_hook_packet_add(struct packet_object *po, void (*func)(struct packet_object *po));
EC_API_EXTERN int conntrack_hook_packet_del(struct packet_object *po, void (*func)(struct packet_object *po));
EC_API_EXTERN int conntrack_hook_conn_add(struct conn_object *co, void (*func)(struct packet_object *po));
EC_API_EXTERN int conntrack_hook_conn_del(struct conn_object *co, void (*func)(struct packet_object *po));
#endif
/* EOF */
// vim:ts=3:expandtab