Decrease granularity to reduce the size of the dataset
[fprobe-ulog.git] / src / fprobe-ulog.h
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 MAX_PATH_LEN 255
20 #define MAX_DIGIT 5
21
22 #define SCHED SCHED_FIFO
23 #define EMIT_TIMEOUT 600
24 #define UNPENDING_TIMEOUT 5
25 #define CAPTURE_SIZE 131072
26 #define THREADS 5
27 #define COPY_INTO 0
28 #define MOVE_INTO 1
29 #define NETFLOW_PDU_SIZE 1464 
30
31 struct Time {
32         time_t sec;
33         long usec;
34 };
35
36 struct Flow {
37         /* input interface */
38         uint16_t iif;
39         /* output interface */
40         uint16_t oif;
41         /* ip src address */
42         struct in_addr sip;
43         /* ip dst address */
44         struct in_addr dip;
45         /* ip protocol */
46         uint8_t proto;
47         /* ip fragment id */
48         uint16_t id;
49         /* tcp/udp src port or icmp message type */
50         uint16_t sp;
51         /* tcp/udp dst port or icmp type sub-code */
52         uint16_t dp;
53         /* ip ToS */
54         uint16_t tos;
55         /* tcp flags */
56         uint8_t tcp_flags;
57         /* number of packets */
58         unsigned long pkts;
59         /* sum of packets sizes */
60         unsigned long size;
61         /* fragment data size (for fragmented packets) */
62         unsigned long sizeF;
63         /* whole packet data size (for fragmented packets) */
64         unsigned long sizeP;
65         /* time of creation/flushing this flow */
66         struct Time ctime;
67         /* time of last modification this flow */
68         struct Time mtime;
69 #define FLOW_FRAG       0x0001
70 #define FLOW_FRAGMASK   0x0003
71 #define FLOW_TL         0x0004
72 #define FLOW_LASTFRAG   0x0008
73 #define FLOW_PENDING    0x8000
74         int flags;
75         struct Flow *next;
76 };
77
78 struct Flow_F {
79         /* input interface */
80         uint16_t iif;
81         /* output interface */
82         uint16_t oif;
83         /* ip src address */
84         struct in_addr sip;
85         /* ip dst address */
86         struct in_addr dip;
87         /* ip protocol */
88         uint8_t proto;
89         /* ip fragment id */
90         uint16_t id;
91 };
92
93 struct Flow_TL {
94         /* input interface */
95         uint16_t iif;
96         /* output interface */
97         uint16_t oif;
98         /* ip src address */
99         struct in_addr sip;
100         /* ip dst address */
101         struct in_addr dip;
102         /* ip protocol */
103         uint8_t proto;
104         /* ip fragment id */
105         uint16_t id;
106         /* tcp/udp src port or icmp message type */
107         uint16_t sp;
108         /* tcp/udp dst port or icmp type sub-code */
109         uint16_t dp;
110 };
111
112 #define SIGALRM_MASK 1
113 #define SIGTERM_MASK 2
114 #define SIGUSR1_MASK 4
115
116 struct peer {
117         int write_fd;
118         char *fname;
119         struct sockaddr_in addr;
120         struct sockaddr_in laddr;
121         int type;
122         uint32_t seq;
123         int fd;
124 };
125
126 struct snmp_rule {
127         char basename[IFNAMSIZ];
128         int len;
129         int base;
130 } snmp_rule_t;
131
132 #define PEER_MIRROR 0
133 #define PEER_ROTATE 1
134 #define PEER_FILE 2
135
136 #endif