Re-import of fprobe-ulog
[fprobe-ulog.git] / src / fprobe-ulog.h.old
1 /*
2         Copyright (C) Slava Astashonok <sla@0n.ru>
3
4         This program is free software; you can redistribute it and/or
5         modify it under the terms of the GNU General Public License.
6
7         $Id: fprobe-ulog.h,v 1.1.2.3 2005/01/29 19:30:41 sla Exp $
8 */
9
10 #ifndef _FPROBE_ULOG_H_
11 #define _FPROBE_ULOG_H_
12
13 #include <my_inttypes.h>
14
15 #ifndef IP_OFFMASK
16 #define IP_OFFMASK 0x1fff
17 #endif
18
19 #define SCHED SCHED_FIFO
20 #define EMIT_TIMEOUT 5
21 #define UNPENDING_TIMEOUT 5
22 #define CAPTURE_SIZE 131072
23 #define THREADS 5
24 #define COPY_INTO 0
25 #define MOVE_INTO 1
26
27 struct Time {
28         time_t sec;
29         long usec;
30 };
31
32 struct Flow {
33         /* input interface */
34         uint16_t iif;
35         /* output interface */
36         uint16_t oif;
37         /* ip src address */
38         struct in_addr sip;
39         /* ip dst address */
40         struct in_addr dip;
41         /* ip protocol */
42         uint8_t proto;
43         /* ip fragment id */
44         uint16_t id;
45         /* tcp/udp src port or icmp message type */
46         uint16_t sp;
47         /* tcp/udp dst port or icmp type sub-code */
48         uint16_t dp;
49         /* ip ToS */
50         uint8_t tos;
51         /* tcp flags */
52         uint8_t tcp_flags;
53         /* number of packets */
54         unsigned long pkts;
55         /* sum of packets sizes */
56         unsigned long size;
57         /* fragment data size (for fragmented packets) */
58         unsigned long sizeF;
59         /* whole packet data size (for fragmented packets) */
60         unsigned long sizeP;
61         /* time of creation/flushing this flow */
62         struct Time ctime;
63         /* time of last modification this flow */
64         struct Time mtime;
65 #define FLOW_FRAG       0x0001
66 #define FLOW_FRAGMASK   0x0003
67 #define FLOW_TL         0x0004
68 #define FLOW_LASTFRAG   0x0008
69 #define FLOW_PENDING    0x8000
70         int flags;
71         struct Flow *next;
72 };
73
74 struct Flow_F {
75         /* input interface */
76         uint16_t iif;
77         /* output interface */
78         uint16_t oif;
79         /* ip src address */
80         struct in_addr sip;
81         /* ip dst address */
82         struct in_addr dip;
83         /* ip protocol */
84         uint8_t proto;
85         /* ip fragment id */
86         uint16_t id;
87 };
88
89 struct Flow_TL {
90         /* input interface */
91         uint16_t iif;
92         /* output interface */
93         uint16_t oif;
94         /* ip src address */
95         struct in_addr sip;
96         /* ip dst address */
97         struct in_addr dip;
98         /* ip protocol */
99         uint8_t proto;
100         /* ip fragment id */
101         uint16_t id;
102         /* tcp/udp src port or icmp message type */
103         uint16_t sp;
104         /* tcp/udp dst port or icmp type sub-code */
105         uint16_t dp;
106 };
107
108 #define SIGALRM_MASK 1
109 #define SIGTERM_MASK 2
110 #define SIGUSR1_MASK 4
111
112 struct peer {
113         int sock;
114         struct sockaddr_in addr;
115         struct sockaddr_in laddr;
116         int type;
117         uint32_t seq;
118         int fd;
119 };
120
121 struct snmp_rule {
122         char basename[IFNAMSIZ];
123         int len;
124         int base;
125 } snmp_rule_t;
126
127 #define PEER_MIRROR 0
128 #define PEER_ROTATE 1
129
130 #endif