OpenVAS Libraries
4.0+rc3.SVN
Main Page
Related Pages
Data Structures
Files
File List
Globals
nasl
nasl_tree.h
1
/* Nessus Attack Scripting Language
2
*
3
* Copyright (C) 2002 - 2003 Michel Arboi and Renaud Deraison
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2,
7
* as published by the Free Software Foundation
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
*/
18
19
#ifndef NASLTREE_H_INCLUDED
20
#define NASLTREE_H_INCLUDED
21
22
23
enum
node_type
24
{
25
NODE_EMPTY = 0,
26
NODE_IF_ELSE,
/* [0] = cond, [1] = if_block, [2] = else_block */
27
NODE_INSTR_L,
/* Block. [0] = first instr, [1] = tail */
28
NODE_FOR,
/* [0] = start expr, [1] = cond, [2] = end_expr, [3] = block */
29
NODE_WHILE,
/* [0] = cond, [1] = block */
30
NODE_FOREACH,
31
NODE_REPEAT_UNTIL,
32
NODE_REPEATED,
/* [0] = func call, [1] = repeat nb */
33
NODE_FUN_DEF,
/* [0] = argdecl, [1] = block */
34
NODE_FUN_CALL,
/* [0] = arglist */
35
NODE_DECL,
/* [0] = next arg in list */
36
NODE_ARG,
/* val = name can be NULL, [0] = val, [1] = next arg */
37
NODE_RETURN,
/* ret val */
38
NODE_BREAK,
39
NODE_CONTINUE,
40
41
NODE_ARRAY_EL,
/* val = array name, [0] = index */
42
NODE_AFF,
/* [0] = lvalue, [1] = rvalue */
43
NODE_VAR,
/* val = variable name */
44
NODE_LOCAL,
/* [0] = argdecl */
45
NODE_GLOBAL,
46
47
NODE_PLUS_EQ,
48
NODE_MINUS_EQ,
49
NODE_MULT_EQ,
50
NODE_DIV_EQ,
51
NODE_MODULO_EQ,
52
53
NODE_L_SHIFT_EQ,
54
NODE_R_SHIFT_EQ,
55
NODE_R_USHIFT_EQ,
56
57
EXPR_AND,
58
EXPR_OR,
59
EXPR_NOT,
60
61
EXPR_PLUS,
62
EXPR_MINUS,
63
EXPR_U_MINUS,
64
EXPR_MULT,
65
EXPR_DIV,
66
EXPR_MODULO,
67
EXPR_EXPO,
68
69
EXPR_BIT_AND,
70
EXPR_BIT_OR,
71
EXPR_BIT_XOR,
72
EXPR_BIT_NOT,
73
EXPR_INCR,
74
EXPR_DECR,
75
EXPR_L_SHIFT,
76
EXPR_R_SHIFT,
77
EXPR_R_USHIFT,
78
79
COMP_MATCH,
80
COMP_NOMATCH,
81
COMP_RE_MATCH,
82
COMP_RE_NOMATCH,
83
84
COMP_LT,
85
COMP_LE,
86
COMP_EQ,
87
COMP_NE,
88
COMP_GT,
89
COMP_GE,
90
91
CONST_INT,
92
CONST_STR,
/* "impure" string */
93
94
CONST_DATA,
/* binary data / "pure" string */
95
CONST_REGEX,
/* Compiled regex */
96
97
ARRAY_ELEM,
/* val = char index or NULL if integer,
98
* [0] = value, [1] = next element */
99
/* For exec only */
100
REF_VAR,
101
REF_ARRAY,
102
DYN_ARRAY
103
};
104
105
typedef
struct
TC
106
{
107
short
type;
108
short
line_nb;
109
short
ref_count;
/* Cell is freed when count reaches zero */
110
int
size;
111
union
112
{
113
char
*str_val;
114
int
i_val;
115
void
*ref_val;
/* internal reference */
116
} x;
117
struct
TC
*link[4];
118
}
tree_cell
;
119
120
#define FAKE_CELL ((void*)1)
121
#define EXIT_CELL ((void*)2)
122
123
tree_cell
*alloc_tree_cell (
int
,
char
*);
124
tree_cell
*alloc_expr_cell (
int
,
int
,
tree_cell
*,
tree_cell
*);
125
tree_cell
*alloc_RE_cell (
int
,
int
,
tree_cell
*,
char
*);
126
tree_cell
*alloc_typed_cell (
int
);
127
int
nasl_is_leaf (
const
tree_cell
*);
128
char
*get_line_nb (
const
tree_cell
*);
129
tree_cell
*dup_cell (
const
tree_cell
*);
130
void
nasl_dump_tree (
const
tree_cell
*);
131
void
ref_cell (
tree_cell
*);
132
void
deref_cell (
tree_cell
*);
133
const
char
*nasl_type_name (
int
);
134
int
cell_type (
const
tree_cell
*);
135
136
char
*dump_cell_val (
const
tree_cell
*);
137
138
139
#endif
Generated by
1.8.1.1