1/* $Id: defines.h.in,v 1.17 2005/07/18 11:08:24 mederchik Exp $ */
2/*
3** Copyright (C) 2001 Fyodor Yarochkin <fygrave@tigerteam.net>,
4**                    Ofir Arkin       <ofir@sys-security.com>
5**
6** This program is free software; you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation; either version 2 of the License, or
9** (at your option) any later version.
10**
11**
12** This program is distributed in the hope that it will be useful,
13** but WITHOUT ANY WARRANTY; without even the implied warranty of
14** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15** GNU General Public License for more details.
16**
17** You should have received a copy of the GNU General Public License
18** along with this program; if not, write to the Free Software
19** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20*/
21
22#ifndef DEFINES_H
23#define DEFINES_H
24
25#define VERSION "@VERSION@"
26#define BANNER \
27"\nXprobe2 v." VERSION \
28" Copyright (c) 2002-2005 fyodor@o0o.nu, ofir@sys-security.com, meder@o0o.nu"\
29"\n"
30
31#define DATA_SIZE 20
32#define DEF_TIMEOUT 10
33#define DEF_SEND_DELAY 0.01
34#define PACKBUF_SIZ 1024
35#define DEFAULT_CONFIG "@CFGDIR@/xprobe2.conf"
36#define DEFAULT_MATCHES 10
37
38#define UDP_PORT 32132
39#define UDP_DATA_SIZE 70
40#define UDP_LEN_ALL (sizeof(struct ip) + sizeof(struct udphdr) + UDP_DATA_SIZE)
41
42#define PING_PAYLOAD_SIZE 56
43
44#define TEST_RESULT_BROKEN -1
45#define TEST_RESULT_ZERO    0
46#define TEST_RESULT_GOOD    1
47#define TEST_RESULT_BAD     2
48
49#define UDP_CKSUM_BADDGRAM TEST_RESULT_BROKEN
50#define UDP_CKSUM_ZERO      TEST_RESULT_ZERO
51#define UDP_CKSUM_BAD       TEST_RESULT_BAD
52#define UDP_CKSUM_GOOD      TEST_RESULT_GOOD
53
54#define IP_CKSUM_ZERO      TEST_RESULT_ZERO
55#define IP_CKSUM_BAD       TEST_RESULT_BAD
56#define IP_CKSUM_GOOD      TEST_RESULT_GOOD
57
58#define IP_ID_ZERO          TEST_RESULT_ZERO
59#define IP_ID_BAD           TEST_RESULT_BAD
60#define IP_ID_GOOD          TEST_RESULT_GOOD
61#define IP_ID_FLIPPED       (TEST_RESULT_BAD + 1)
62
63/* we don't expect packets bigger than 1500 */
64#define LPCAP_SNAPLEN       1500
65#define LPCAP_TIMEOUT       2000
66
67/* return values for ICMP_UNREACH length check */
68
69#define ICMPUNREACH_LEN_OK  1
70#define ICMPUNREACH_LEN_GT  2
71#define ICMPUNREACH_LEN_LS  3
72
73/* return values for frag bits test */
74
75#define FRAG_BITS_OK        0
76#define FRAG_BITS_FLIPPED   1
77#define FRAG_BITS_ZERO      2
78
79/* TTL_DELTA for fuzzy TTL matching */
80
81#define TTL_DELTA			25
82
83/* defines for tcp_ports, udp_ports and protocols maps */
84
85#define XPROBE_TARGETP_OPEN 1
86#define XPROBE_TARGETP_CLOSED 2
87#define XPROBE_TARGETP_FILTERED 3
88
89
90#define MAXIFNUM 64
91
92/* DSO modules stuff */
93
94#if defined(LINUX) || defined(__FreeBSD__)
95#define DLOPENFLAGS     RTLD_LAZY | RTLD_GLOBAL
96#define DLSYMPREFIX    ""
97#else
98#define DLOPENFLAGS     RTLD_LAZY
99#define DLSYMPREFIX    "_"
100#endif
101
102#define N_TESTNAME "test_name"
103#define N_TESTTYPE "test_type"
104#define N_TEST_INIT "test_init"
105#define N_TEST_RUN "test_run"
106#define N_TEST_FINI "test_fini"
107
108#define XPROBE_MODULE_ENABLED 0
109#define XPROBE_MODULE_DISABLED 1
110
111/* some misc stuff */
112
113#define FAIL		-1
114#define OK			0
115#define RETRY		-2
116#define TRUE		1
117#define FALSE		0
118
119#define XPROBE_DEBUG_ALL          0xffffffff
120#define XPROBE_DEBUG_SIGNATURES   1
121#define XPROBE_DEBUG_DSOTESTS     2
122#define XPROBE_DEBUG_INIT         4
123#define XPROBE_DEBUG_MODULES      8
124#define XPROBE_DEBUG_OSMATRIX    16
125#define XPROBE_DEBUG_CONFIG      32
126#define XPROBE_DEBUG_TARGET      64
127
128#define XPROBELOG_XP_SESS_START     1
129#define XPROBELOG_MSG_RUN           2
130#define XPROBELOG_MOD_SESS_START    3
131#define XPROBELOG_MSG_MODULE        4
132#define XPROBELOG_MOD_SESS_END      5
133#define XPROBELOG_TG_SESS_START     6
134#define XPROBELOG_REACH_SESS_START  7
135#define XPROBELOG_MSG_STATE         8
136#define XPROBELOG_MSG_RTT           9
137#define XPROBELOG_REACH_SESS_END    10
138#define XPROBELOG_INFO_SESS_START   11
139#define XPROBELOG_PS_SESS_START     12
140#define XPROBELOG_STATS_SESS_START  13
141#define XPROBELOG_MSG_PS_TCPST      14
142#define XPROBELOG_MSG_PS_UDPST      15
143#define XPROBELOG_STATS_SESS_END    16
144#define XPROBELOG_PSDET_SESS_START  17
145#define XPROBELOG_MSG_PORT          18
146#define XPROBELOG_PSDET_SESS_END    19
147#define XPROBELOG_PS_SESS_END       20
148#define XPROBELOG_INFO_SESS_END     21
149#define XPROBELOG_GUESS_SESS_START  22
150#define XPROBELOG_MSG_PRIMARY       23
151#define XPROBELOG_MSG_SECONDARY     24
152#define XPROBELOG_GUESS_SESS_END    25
153#define XPROBELOG_TG_SESS_END       26
154#define XPROBELOG_XP_SESS_END       27
155#define XPROBELOG_OTHER_TCPP		28
156#define XPROBELOG_OTHER_UDPP		29
157
158#ifndef DEFAULT_DEBUG_LEVEL
159#define DEFAULT_DEBUG_LEVEL 0
160#endif
161
162#define xprobe_debug(level, fmt, args...) ui->debug(level,\
163__FILE__, __LINE__, fmt, args)
164
165#define xprobe_mdebug(level, str) ui->debug(level,\
166__FILE__, __LINE__, str)
167
168#endif /* DEFINES_H */
169