OpenVAS Libraries  6.0+beta5
nasl_lex_ctxt.h
Go to the documentation of this file.
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 _NASL_LEX_CTXT_H
20 #define _NASL_LEX_CTXT_H
21 
22 /* for tree_cell */
23 #include "nasl_tree.h"
24 
25 /* for nasl_array */
26 #include "nasl_var.h"
27 
28 /* for nasl_func */
29 #include "nasl_func.h"
30 
31 typedef struct struct_lex_ctxt
32 {
34  tree_cell *ret_val; /* return value or exit flag */
35  unsigned fct_ctxt:1; /* This is a function context */
36  unsigned break_flag:1; /* Break from loop */
37  unsigned cont_flag:1; /* Next iteration in loop */
41  /* Named variables hash set + anonymous variables array */
43  /* Functions hash set */
45 } lex_ctxt;
46 
47 #define NASL_COMPAT_LEX_CTXT "NASL compat lex context"
48 
50 void free_lex_ctxt (lex_ctxt *);
52 
53 void dump_ctxt (lex_ctxt *);
54 
55 nasl_func *get_func_ref_by_name (lex_ctxt *, const char *);
57 nasl_func *insert_nasl_func (lex_ctxt *, const char *, tree_cell *);
59 
60 tree_cell *get_variable_by_name (lex_ctxt *, const char *);
61 tree_cell *get_array_elem (lex_ctxt *, const char * /*array name */ ,
62  tree_cell *);
68 
71 
73 
74 
75 int get_int_var_by_num (lex_ctxt *, int, int);
76 char *get_str_var_by_num (lex_ctxt *, int);
77 int get_int_var_by_name (lex_ctxt *, const char *, int);
78 int get_int_local_var_by_name (lex_ctxt *, const char *, int);
79 char *get_str_var_by_name (lex_ctxt *, const char *);
80 char *get_str_local_var_by_name (lex_ctxt *, const char *);
81 
82 int get_var_size_by_name (lex_ctxt *, const char *);
83 int get_local_var_size_by_name (lex_ctxt *, const char *);
84 int get_local_var_type_by_name (lex_ctxt *, const char *);
85 
86 
87 int get_var_size_by_num (lex_ctxt *, int);
88 int get_var_type_by_num (lex_ctxt *, int);
89 #endif