OpenVAS Scanner 21.4.1
nasl_lex_ctxt.h
Go to the documentation of this file.
1/* Based on work Copyright (C) 2002 - 2003 Michel Arboi and Renaud Deraison
2 *
3 * SPDX-License-Identifier: GPL-2.0-only
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef _NASL_LEX_CTXT_H
20#define _NASL_LEX_CTXT_H
21
22#include <glib.h>
23
24/* for tree_cell */
25#include "nasl_tree.h"
26
27/* for nasl_array */
28#include "nasl_var.h"
29
30/* for nasl_func */
31#include "nasl_func.h"
32
33typedef struct struct_lex_ctxt
34{
36 tree_cell *ret_val; /* return value or exit flag */
37 unsigned fct_ctxt : 1; /* This is a function context */
38 unsigned break_flag : 1; /* Break from loop */
39 unsigned cont_flag : 1; /* Next iteration in loop */
40 unsigned always_signed : 1;
42 const char *oid;
45 /* Named variables hash set + anonymous variables array */
47 /* Functions hash table */
48 GHashTable *functions;
50
51#define NASL_COMPAT_LEX_CTXT "NASL compat lex context"
52
55
56void
58
59void
61
63get_func_ref_by_name (lex_ctxt *, const char *);
64
67
69insert_nasl_func (lex_ctxt *, const char *, tree_cell *, int);
70
73
75get_variable_by_name (lex_ctxt *, const char *);
76
78get_array_elem (lex_ctxt *, const char * /*array name */, tree_cell *);
79
82
84add_named_var_to_ctxt (lex_ctxt *, const char *, tree_cell *);
85
88
91
94
97
100
101tree_cell *
103
104long int
105get_int_var_by_num (lex_ctxt *, int, int);
106
107char *
109
110long int
111get_int_var_by_name (lex_ctxt *, const char *, int);
112
113char *
114get_str_var_by_name (lex_ctxt *, const char *);
115
116int
117get_var_size_by_name (lex_ctxt *, const char *);
118
119int
120get_var_type_by_name (lex_ctxt *, const char *);
121
122int
124
125int
127
128#endif
nasl_func * insert_nasl_func(lex_ctxt *, const char *, tree_cell *, int)
Definition: nasl_func.c:53
named_nasl_var * add_named_var_to_ctxt(lex_ctxt *, const char *, tree_cell *)
Definition: nasl_var.c:825
tree_cell * nasl_incr_variable(lex_ctxt *, tree_cell *, int, int)
Definition: nasl_var.c:933
int get_var_type_by_num(lex_ctxt *, int)
Returns NASL variable/cell type, VAR2_UNDEF if value is NULL.
Definition: nasl_var.c:1164
struct struct_lex_ctxt lex_ctxt
nasl_func * get_func_ref_by_name(lex_ctxt *, const char *)
Definition: nasl_func.c:94
int get_var_size_by_name(lex_ctxt *, const char *)
Definition: nasl_var.c:1147
tree_cell * get_array_elem(lex_ctxt *, const char *, tree_cell *)
Definition: nasl_var.c:223
void free_lex_ctxt(lex_ctxt *)
Definition: nasl_lex_ctxt.c:55
int get_var_size_by_num(lex_ctxt *, int)
Definition: nasl_var.c:1154
tree_cell * nasl_read_var_ref(lex_ctxt *, tree_cell *)
Definition: nasl_var.c:847
anon_nasl_var * add_numbered_var_to_ctxt(lex_ctxt *, int, tree_cell *)
Definition: nasl_var.c:796
tree_cell * nasl_return(lex_ctxt *, tree_cell *)
Definition: nasl_func.c:239
void dump_ctxt(lex_ctxt *)
Definition: nasl_lex_ctxt.c:64
tree_cell * decl_global_variables(lex_ctxt *, tree_cell *)
Definition: nasl_var.c:786
tree_cell * nasl_func_call(lex_ctxt *, const nasl_func *, tree_cell *)
Definition: nasl_func.c:107
tree_cell * cell2atom(lex_ctxt *, tree_cell *)
Definition: exec.c:205
tree_cell * decl_local_variables(lex_ctxt *, tree_cell *)
Definition: nasl_var.c:773
char * get_str_var_by_name(lex_ctxt *, const char *)
Definition: nasl_var.c:1127
tree_cell * decl_nasl_func(lex_ctxt *, tree_cell *, int)
Definition: nasl_func.c:78
lex_ctxt * init_empty_lex_ctxt(void)
Definition: nasl_lex_ctxt.c:32
char * get_str_var_by_num(lex_ctxt *, int)
Definition: nasl_var.c:1120
long int get_int_var_by_num(lex_ctxt *, int, int)
Definition: nasl_var.c:1106
long int get_int_var_by_name(lex_ctxt *, const char *, int)
Definition: nasl_var.c:1113
int get_var_type_by_name(lex_ctxt *, const char *)
Definition: nasl_var.c:1171
tree_cell * get_variable_by_name(lex_ctxt *, const char *)
Definition: nasl_var.c:191
Definition: nasl_tree.h:105
Definition: scanneraux.h:42
Definition: nasl_var.h:51
Definition: nasl_var.h:66
Definition: nasl_var.h:44
Definition: nasl_func.h:26
Definition: nasl_lex_ctxt.h:34
GHashTable * functions
Definition: nasl_lex_ctxt.h:48
nasl_array ctx_vars
Definition: nasl_lex_ctxt.h:46
struct script_infos * script_infos
Definition: nasl_lex_ctxt.h:41
unsigned always_signed
Definition: nasl_lex_ctxt.h:40
unsigned cont_flag
Definition: nasl_lex_ctxt.h:39
int line_nb
Definition: nasl_lex_ctxt.h:44
tree_cell * ret_val
Definition: nasl_lex_ctxt.h:36
const char * oid
Definition: nasl_lex_ctxt.h:42
int recv_timeout
Definition: nasl_lex_ctxt.h:43
unsigned break_flag
Definition: nasl_lex_ctxt.h:38
struct struct_lex_ctxt * up_ctxt
Definition: nasl_lex_ctxt.h:35
unsigned fct_ctxt
Definition: nasl_lex_ctxt.h:37