1
/* $Id: xprobe_module_param.h,v 1.10 2005/02/08 20:00:36 mederchik Exp $ */
3
** Copyright (C) 2001 Fyodor Yarochkin <fygrave@tigerteam.net>,
4
** Ofir Arkin <ofir@sys-security.com>
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.
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.
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.
24
* - Feb 12 14:34:04 2003 meder - added type XPROBE_MODULE_PARAM_ZNZORIG,
25
* that required addition of an extra argument to the add_param() and
26
* check_param() methods;
28
#ifndef XPROBE_MODULE_PARAM_H
29
#define XPROBE_MODULE_PARAM_H
32
#include "usi++/usi++.h"
34
#include "os_matrix.h"
39
#define XPROBE_MODULE_PARAM_BOOL 1 /* y/n */
40
#define XPROBE_MODULE_PARAM_ZNZ 2 /* zero, not zero -- !0, 0 */
41
#define XPROBE_MODULE_PARAM_INT 3 /* int - 1234 */
42
#define XPROBE_MODULE_PARAM_RANGE 4 /* range - <1, >2, 20-40 */
43
#define XPROBE_MODULE_PARAM_ZNZORIG 5 /* zero, not zero, original value(SENT) */
44
#define XPROBE_MODULE_PARAM_ZNZVAL 6 /* zero, value, not zero */
45
#define XPROBE_MODULE_PARAM_INTLIST 7 /* list of integers (1,2,3,4,...) */
46
#define XPROBE_MODULE_PARAM_STRATEGY 8 /* (R)andom, (I)ncremental, 0 */
48
#define XPROBE_MODULE_PARAM_FUZZY_DELTA 31
51
#define XMP_STRATEGY_RANDOM 2
52
#define XMP_STRATEGY_INCREMENTAL 1
53
#define XMP_STRATEGY_ZERO 0
54
#define XMP_STRATEGY_THRESHOLD 256
56
typedef struct xprobe_module_param_val {
59
vector <int> val_list;
60
} xprobe_module_param_t;
64
class Xprobe_Module_Param {
68
map <int, xprobe_module_param_t> osid_sig;
69
int sig_insert(int os_id, xprobe_module_param_t p);
71
Xprobe_Module_Param(int t) { type = t; }
72
virtual ~Xprobe_Module_Param(void) { return; }
73
// virtual int check_param(ICMP *ip_pkt, ICMP *orig_pkt, OS_Matrix *os) =0;
74
int parse_param(int os_id, const char *param);
75
int add_param(int param, int orig, OS_Matrix *os);
76
void set_id(int i) { id = i; }
77
int get_id(void) { return id; }
78
int gen_match(int cnt, OS_Matrix *os);
81
class Xprobe_Module_Param_TCP: public Xprobe_Module_Param {
83
Xprobe_Module_Param_TCP(int t): Xprobe_Module_Param(t) { return; }
84
virtual ~Xprobe_Module_Param_TCP(void) { return; }
85
virtual int check_param(TCP *ip_pkt, TCP *orig_pkt, OS_Matrix *os) =0;
87
class Xprobe_Module_Param_ICMP: public Xprobe_Module_Param {
89
Xprobe_Module_Param_ICMP(int t): Xprobe_Module_Param(t) {return; }
90
virtual ~Xprobe_Module_Param_ICMP(void) { return; }
91
virtual int check_param(ICMP *ip_pkt, ICMP *orig_pkt, OS_Matrix *os) =0;
95
#endif /* XPROBE_MODULE_PARAM */