OpenVAS Scanner  7.0.0~git
nasl_lex_ctxt.h File Reference
#include <glib.h>
#include "nasl_tree.h"
#include "nasl_var.h"
#include "nasl_func.h"
Include dependency graph for nasl_lex_ctxt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  struct_lex_ctxt
 

Macros

#define NASL_COMPAT_LEX_CTXT   "NASL compat lex context"
 

Typedefs

typedef struct struct_lex_ctxt lex_ctxt
 

Functions

lex_ctxtinit_empty_lex_ctxt (void)
 
void free_lex_ctxt (lex_ctxt *)
 
void dump_ctxt (lex_ctxt *)
 
nasl_funcget_func_ref_by_name (lex_ctxt *, const char *)
 
tree_celldecl_nasl_func (lex_ctxt *, tree_cell *, int)
 
nasl_funcinsert_nasl_func (lex_ctxt *, const char *, tree_cell *, int)
 
tree_cellnasl_func_call (lex_ctxt *, const nasl_func *, tree_cell *)
 
tree_cellget_variable_by_name (lex_ctxt *, const char *)
 
tree_cellget_array_elem (lex_ctxt *, const char *, tree_cell *)
 
anon_nasl_varadd_numbered_var_to_ctxt (lex_ctxt *, int, tree_cell *)
 
named_nasl_varadd_named_var_to_ctxt (lex_ctxt *, const char *, tree_cell *)
 
tree_cellnasl_read_var_ref (lex_ctxt *, tree_cell *)
 
tree_cellnasl_incr_variable (lex_ctxt *, tree_cell *, int, int)
 
tree_cellnasl_return (lex_ctxt *, tree_cell *)
 
tree_celldecl_local_variables (lex_ctxt *, tree_cell *)
 
tree_celldecl_global_variables (lex_ctxt *, tree_cell *)
 
tree_cellcell2atom (lex_ctxt *, tree_cell *)
 
long int get_int_var_by_num (lex_ctxt *, int, int)
 
char * get_str_var_by_num (lex_ctxt *, int)
 
long int get_int_var_by_name (lex_ctxt *, const char *, int)
 
char * get_str_var_by_name (lex_ctxt *, const char *)
 
int get_var_size_by_name (lex_ctxt *, const char *)
 
int get_var_type_by_name (lex_ctxt *, const char *)
 
int get_var_size_by_num (lex_ctxt *, int)
 
int get_var_type_by_num (lex_ctxt *, int)
 Returns NASL variable/cell type, VAR2_UNDEF if value is NULL. More...
 

Macro Definition Documentation

◆ NASL_COMPAT_LEX_CTXT

#define NASL_COMPAT_LEX_CTXT   "NASL compat lex context"

Definition at line 51 of file nasl_lex_ctxt.h.

Typedef Documentation

◆ lex_ctxt

typedef struct struct_lex_ctxt lex_ctxt

Function Documentation

◆ add_named_var_to_ctxt()

named_nasl_var* add_named_var_to_ctxt ( lex_ctxt ,
const char *  ,
tree_cell  
)

Definition at line 825 of file nasl_var.c.

826  {
827  int h = hash_str (name);
828  named_nasl_var *v;
829 
830  /* Duplicated code ? */
831  for (v = lexic->ctx_vars.hash_elt[h]; v != NULL; v = v->next_var)
832  if (v->var_name != NULL && strcmp (name, v->var_name) == 0)
833  {
834  if (val != NULL)
835  nasl_perror (lexic, "Cannot add existing variable %s\n", name);
836  return NULL;
837  }
838  v = create_named_var (name, val);
839  if (v == NULL)
840  return NULL;
841  v->next_var = lexic->ctx_vars.hash_elt[h];
842  lexic->ctx_vars.hash_elt[h] = v;
843  return v;
844  }

References create_named_var(), struct_lex_ctxt::ctx_vars, st_nasl_array::hash_elt, hash_str(), name, nasl_perror(), st_n_nasl_var::next_var, val, and st_n_nasl_var::var_name.

Referenced by decl_local_variables(), exec_nasl_script(), init_nasl_library(), and nasl_func_call().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_numbered_var_to_ctxt()

anon_nasl_var* add_numbered_var_to_ctxt ( lex_ctxt ,
int  ,
tree_cell  
)

Definition at line 796 of file nasl_var.c.

797  {
798  anon_nasl_var *v;
799  nasl_array *a = &lexic->ctx_vars;
800 
801  if (a->max_idx > num)
802  {
803  v = a->num_elt[num];
804  if (v != NULL && v->var_type != VAR2_UNDEF)
805  {
806  if (val != NULL)
807  nasl_perror (lexic, "Cannot add existing variable %d\n", num);
808  return NULL;
809  }
810  free_anon_var (a->num_elt[num]);
811  }
812  else
813  {
814  a->num_elt =
815  g_realloc (a->num_elt, (num + 1) * sizeof (anon_nasl_var *));
816  bzero (a->num_elt + a->max_idx,
817  sizeof (anon_nasl_var *) * (num + 1 - a->max_idx));
818  a->max_idx = num + 1;
819  }
820  a->num_elt[num] = v = create_anon_var (val);
821  return v;
822  }

References create_anon_var(), struct_lex_ctxt::ctx_vars, free_anon_var(), st_nasl_array::max_idx, nasl_perror(), st_nasl_array::num_elt, val, VAR2_UNDEF, and st_a_nasl_var::var_type.

Referenced by nasl_func_call().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cell2atom()

tree_cell* cell2atom ( lex_ctxt lexic,
tree_cell c1 
)
Returns
A 'referenced' cell.

Definition at line 205 of file exec.c.

206 {
207  tree_cell *c2 = NULL, *ret = NULL;
208  if (c1 == NULL || c1 == FAKE_CELL)
209  return c1;
210 
211  switch (c1->type)
212  {
213  case CONST_INT:
214  case CONST_STR:
215  case CONST_DATA:
216  case REF_ARRAY:
217  case DYN_ARRAY:
218  ref_cell (c1);
219  return c1;
220  default:
221  c2 = nasl_exec (lexic, c1);
222  ret = cell2atom (lexic, c2);
223  deref_cell (c2);
224  return ret;
225  }
226 }

References cell2atom(), CONST_DATA, CONST_INT, CONST_STR, deref_cell(), DYN_ARRAY, FAKE_CELL, nasl_exec(), REF_ARRAY, ref_cell(), and TC::type.

Referenced by cell2atom(), cell_cmp(), nasl_exec(), nasl_func_call(), and nasl_return().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decl_global_variables()

tree_cell* decl_global_variables ( lex_ctxt ,
tree_cell  
)

Definition at line 786 of file nasl_var.c.

787  {
788  lex_ctxt *c = lexic;
789 
790  while (c->up_ctxt != NULL)
791  c = c->up_ctxt;
792  return decl_local_variables (c, vars);
793  }

References decl_local_variables(), and struct_lex_ctxt::up_ctxt.

Referenced by nasl_exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decl_local_variables()

tree_cell* decl_local_variables ( lex_ctxt ,
tree_cell  
)

Definition at line 773 of file nasl_var.c.

774  {
775  tree_cell *t;
776 
777  for (t = vars; t != NULL; t = t->link[0])
778  if (t->x.str_val == NULL)
779  nasl_perror (lexic, "decl_local_variables: null name!\n");
780  else
781  add_named_var_to_ctxt (lexic, t->x.str_val, NULL);
782  return FAKE_CELL;
783  }

References add_named_var_to_ctxt(), FAKE_CELL, TC::link, nasl_perror(), TC::str_val, and TC::x.

Referenced by decl_global_variables(), and nasl_exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ decl_nasl_func()

tree_cell* decl_nasl_func ( lex_ctxt ,
tree_cell ,
int   
)

Definition at line 78 of file nasl_func.c.

79 {
80  if (decl_node == NULL || decl_node == FAKE_CELL)
81  {
82  nasl_perror (lexic, "Cannot insert NULL or FAKE cell as function\n");
83  return NULL;
84  }
85 
86  if (insert_nasl_func (lexic, decl_node->x.str_val, decl_node, lint_mode)
87  == NULL)
88  return NULL;
89  else
90  return FAKE_CELL;
91 }

References FAKE_CELL, insert_nasl_func(), nasl_perror(), TC::str_val, and TC::x.

Referenced by nasl_exec(), nasl_lint_call(), and nasl_lint_def().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_ctxt()

void dump_ctxt ( lex_ctxt )

Definition at line 64 of file nasl_lex_ctxt.c.

65 {
66  int i;
67  named_nasl_var *v;
68 
69  printf ("--------<CTXT>--------\n");
70  if (c->fct_ctxt)
71  printf ("Is a function context\n");
72  if (c->up_ctxt == NULL)
73  printf ("Is the top level context\n");
74  if (c->ret_val)
75  {
76  printf ("Return value\n");
77  nasl_dump_tree (c->ret_val);
78  }
79 
80  printf ("Variables:\n");
81  for (i = 0; i < VAR_NAME_HASH; i++)
82  for (v = c->ctx_vars.hash_elt[i]; v != NULL; v = v->next_var)
83  printf ("%s\t", v->var_name);
84  putchar ('\n');
85 
86  printf ("----------------------\n");
87 }

References struct_lex_ctxt::ctx_vars, struct_lex_ctxt::fct_ctxt, st_nasl_array::hash_elt, nasl_dump_tree(), st_n_nasl_var::next_var, struct_lex_ctxt::ret_val, struct_lex_ctxt::up_ctxt, st_n_nasl_var::var_name, and VAR_NAME_HASH.

Referenced by nasl_dump_ctxt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_lex_ctxt()

void free_lex_ctxt ( lex_ctxt )

Definition at line 55 of file nasl_lex_ctxt.c.

56 {
57  deref_cell (c->ret_val);
58  free_array (&c->ctx_vars);
59  g_hash_table_destroy (c->functions);
60  g_free (c);
61 }

References struct_lex_ctxt::ctx_vars, deref_cell(), free_array(), struct_lex_ctxt::functions, and struct_lex_ctxt::ret_val.

Referenced by exec_nasl_script(), nasl_func_call(), and nasl_lint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_array_elem()

tree_cell* get_array_elem ( lex_ctxt ,
const char *  ,
tree_cell  
)

Definition at line 223 of file nasl_var.c.

224  {
225  named_nasl_var *nv;
226  anon_nasl_var *u, *av, fake_var;
227  tree_cell *tc, idx0;
228 
229  /* Fake variable */
230  if (strcmp (name, "_FCT_ANON_ARGS") == 0)
231  {
232  lex_ctxt *c;
233  for (c = ctxt; c != NULL && !c->fct_ctxt; c = c->up_ctxt)
234  ;
235  if (c == NULL)
236  return NULL;
237  fake_var.var_type = VAR2_ARRAY;
238  fake_var.v.v_arr = c->ctx_vars;
239  fake_var.v.v_arr.hash_elt = NULL; /* mask named elements */
240  u = &fake_var;
241  }
242  else
243  {
244  named_nasl_var *v = get_var_ref_by_name (ctxt, name, 1);
245  u = &v->u;
246  }
247 
248  if (idx == NULL)
249  {
250  /* Treat it as zero */
251  memset (&idx0, '\0', sizeof (idx0));
252  idx = &idx0;
253  idx->type = CONST_INT;
254  }
255 
256  switch (u->var_type)
257  {
258  case VAR2_UNDEF:
259  /* We define the array here */
260  u->var_type = VAR2_ARRAY;
261  /* fallthrough */
262  case VAR2_ARRAY:
263  switch (idx->type)
264  {
265  case CONST_INT:
266  av = nasl_get_var_by_num (ctxt, &u->v.v_arr, idx->x.i_val,
267  /* avoid dangling pointers */
268  strcmp (name, "_FCT_ANON_ARGS"));
269  return var2cell (av);
270 
271  case CONST_STR:
272  case CONST_DATA:
273  nv = get_var_by_name (&u->v.v_arr, idx->x.str_val);
274  return var2cell (nv != NULL ? &nv->u : NULL);
275 
276  default:
277  nasl_perror (ctxt,
278  "get_array_elem: unhandled index type 0x%x for "
279  "variable %s\n",
280  idx->type, name);
281  return NULL;
282  }
283  /*NOTREACHED*/ break;
284 
285  case VAR2_INT:
286  nasl_perror (ctxt, "get_array_elem: variable %s is an integer\n", name);
287  return NULL;
288 
289  case VAR2_STRING:
290  case VAR2_DATA:
291  if (idx->type == CONST_INT)
292  {
293  int l = u->v.v_str.s_siz;
294 
295  if (idx->x.i_val >= l)
296  {
297  nasl_perror (ctxt,
298  "get_array_elem: requesting character after end "
299  "of string %s (%d >= %d)\n",
300  name, idx->x.i_val, l);
301  tc = alloc_expr_cell (idx->line_nb, CONST_DATA /*CONST_STR */,
302  NULL, NULL);
303  tc->x.str_val = g_strdup ("");
304  tc->size = 0;
305  return tc;
306  }
307  else
308  {
309  if (idx->x.i_val < 0)
310  {
311  nasl_perror (ctxt,
312  "get_array_elem: Negative index (%d) passed to "
313  "\"%s\"!\n",
314  idx->x.i_val, name);
315  return NULL;
316  }
317  tc = alloc_expr_cell (idx->line_nb, CONST_DATA /*CONST_STR */,
318  NULL, NULL);
319  tc->x.str_val = g_malloc0 (2);
320  tc->x.str_val[0] = u->v.v_str.s_val[idx->x.i_val];
321  tc->x.str_val[1] = '\0';
322  tc->size = 1;
323  return tc;
324  }
325  }
326  else
327  {
328  nasl_perror (ctxt,
329  "get_array_elem: Cannot use a non integer index"
330  " (type 0x%x) in string. Variable: %s\n",
331  idx->type, name);
332  return NULL;
333  }
334  /*NOTREACHED*/ break;
335 
336  default:
337  nasl_perror (ctxt, "Severe bug: unknown variable type 0x%x %s\n",
338  u->var_type, get_line_nb (idx));
339  return NULL;
340  }
341  /*NOTREACHED*/ return NULL;
342  }

References alloc_expr_cell(), CONST_DATA, CONST_INT, CONST_STR, struct_lex_ctxt::ctx_vars, struct_lex_ctxt::fct_ctxt, get_line_nb(), get_var_by_name(), get_var_ref_by_name(), st_nasl_array::hash_elt, TC::i_val, TC::line_nb, name, nasl_get_var_by_num(), nasl_perror(), st_nasl_string::s_siz, st_nasl_string::s_val, TC::size, TC::str_val, TC::type, st_n_nasl_var::u, struct_lex_ctxt::up_ctxt, st_a_nasl_var::v, st_a_nasl_var::v_arr, st_a_nasl_var::v_str, VAR2_ARRAY, VAR2_DATA, VAR2_INT, VAR2_STRING, VAR2_UNDEF, var2cell(), st_a_nasl_var::var_type, and TC::x.

Referenced by nasl_exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_func_ref_by_name()

nasl_func* get_func_ref_by_name ( lex_ctxt ,
const char *   
)

Definition at line 94 of file nasl_func.c.

95 {
96  nasl_func *f;
97 
98  if ((f = get_func (ctxt, name)))
99  return f;
100  else
101  return NULL;
102 }

References get_func(), and name.

Referenced by exec_nasl_script(), make_call_func_list(), nasl_defined_func(), nasl_exec(), nasl_lint_call(), and nasl_lint_def().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_int_var_by_name()

long int get_int_var_by_name ( lex_ctxt ,
const char *  ,
int   
)

Definition at line 1113 of file nasl_var.c.

1114  {
1115  named_nasl_var *v = get_var_ref_by_name (lexic, name, 0);
1116  return var2int (&v->u, defval);
1117  }

References get_var_ref_by_name(), name, st_n_nasl_var::u, and var2int().

Referenced by _http_req(), encrypt_stream_data(), forge_icmp_packet(), forge_icmp_v6_packet(), forge_igmp_packet(), forge_igmp_v6_packet(), forge_ip_packet(), forge_ipv6_packet(), forge_tcp_packet(), forge_tcp_v6_packet(), forge_udp_packet(), forge_udp_v6_packet(), get_port_transport(), insert_ip_options(), insert_ipv6_options(), nasl_bn_random(), nasl_close_stream_cipher(), nasl_crap(), nasl_dec2str(), nasl_egrep(), nasl_ereg(), nasl_ereg_replace(), nasl_eregmatch(), nasl_file_read(), nasl_file_seek(), nasl_file_write(), nasl_ftp_get_pasv_address(), nasl_ftp_log_in(), nasl_get_sign(), nasl_get_sock_info(), nasl_isotime_add(), nasl_localtime(), nasl_match(), nasl_mktime(), nasl_ntlm_response(), nasl_ntlmv2_hash(), nasl_ntlmv2_response(), nasl_open_privileged_socket(), nasl_open_sock_tcp_bufsz(), nasl_pcap_next(), nasl_pread(), nasl_prf(), nasl_rc4_encrypt(), nasl_recv(), nasl_recv_line(), nasl_rsa_private_decrypt(), nasl_rsa_public_encrypt(), nasl_same_host(), nasl_scanner_add_port(), nasl_send(), nasl_send_capture(), nasl_send_packet(), nasl_send_v6packet(), nasl_smb_close(), nasl_smb_file_group_sid(), nasl_smb_file_owner_sid(), nasl_smb_file_SDDL(), nasl_smb_file_trustee_rights(), nasl_socket_cert_verify(), nasl_socket_get_cert(), nasl_socket_get_ssl_ciphersuite(), nasl_socket_get_ssl_session_id(), nasl_socket_get_ssl_version(), nasl_socket_negotiate_ssl(), nasl_split(), nasl_ssh_connect(), nasl_ssh_request_exec(), nasl_str_replace(), nasl_tcp_ping(), nasl_tcp_v6_ping(), nasl_wmi_close(), nasl_wmi_query(), nasl_wmi_query_rsop(), nasl_wmi_reg_create_key(), nasl_wmi_reg_delete_key(), nasl_wmi_reg_enum_key(), nasl_wmi_reg_enum_value(), nasl_wmi_reg_get_bin_val(), nasl_wmi_reg_get_dword_val(), nasl_wmi_reg_get_ex_string_val(), nasl_wmi_reg_get_mul_string_val(), nasl_wmi_reg_get_qword_val(), nasl_wmi_reg_get_sz(), nasl_wmi_reg_set_dword_val(), nasl_wmi_reg_set_ex_string_val(), nasl_wmi_reg_set_qword_val(), nasl_wmi_reg_set_string_val(), replace_kb_item(), script_add_preference(), security_something(), set_ip_elements(), set_ipv6_elements(), set_kb_item(), set_tcp_elements(), set_tcp_v6_elements(), set_udp_elements(), and set_udp_v6_elements().

Here is the call graph for this function:

◆ get_int_var_by_num()

◆ get_str_var_by_name()

char* get_str_var_by_name ( lex_ctxt ,
const char *   
)

Definition at line 1127 of file nasl_var.c.

1128  {
1129  named_nasl_var *v = get_var_ref_by_name (lexic, name, 0);
1130  return (char *) var2str (&v->u);
1131  }

References get_var_ref_by_name(), name, st_n_nasl_var::u, and var2str().

Referenced by _http_req(), add_hostname(), encrypt_data(), encrypt_stream_data(), forge_icmp_packet(), forge_icmp_v6_packet(), forge_igmp_packet(), forge_igmp_v6_packet(), forge_ip_packet(), forge_ipv6_packet(), forge_tcp_packet(), forge_tcp_v6_packet(), forge_udp_packet(), forge_udp_v6_packet(), get_hostname_source(), get_icmp_element(), get_icmp_v6_element(), get_ip_element(), get_ipv6_element(), get_tcp_element(), get_tcp_v6_element(), get_udp_element(), get_udp_v6_element(), insert_ip_options(), insert_ipv6_options(), mpi_from_named_parameter(), nasl_bf_cbc(), nasl_crap(), nasl_egrep(), nasl_ereg(), nasl_ereg_replace(), nasl_eregmatch(), nasl_file_open(), nasl_file_write(), nasl_ftp_log_in(), nasl_fwrite(), nasl_get_sign(), nasl_get_smb2_sign(), nasl_gunzip(), nasl_gzip(), nasl_hmac(), nasl_hmac_sha256(), nasl_insert_hexzeros(), nasl_keyexchg(), nasl_load_privkey_param(), nasl_match(), nasl_ntlm2_response(), nasl_ntlm_response(), nasl_ntlmv1_hash(), nasl_ntlmv2_hash(), nasl_ntlmv2_response(), nasl_ntv2_owf_gen(), nasl_open_sock_tcp_bufsz(), nasl_open_stream_cipher(), nasl_pcap_next(), nasl_pread(), nasl_prf(), nasl_rsa_private_decrypt(), nasl_rsa_public_encrypt(), nasl_rsa_sign(), nasl_scanner_add_port(), nasl_send(), nasl_send_capture(), nasl_send_packet(), nasl_send_v6packet(), nasl_smb_connect(), nasl_smb_file_group_sid(), nasl_smb_file_owner_sid(), nasl_smb_file_SDDL(), nasl_smb_file_trustee_rights(), nasl_split(), nasl_ssh_connect(), nasl_ssh_login_interactive_pass(), nasl_ssh_request_exec(), nasl_ssh_set_login(), nasl_ssh_shell_write(), nasl_ssh_userauth(), nasl_str_replace(), nasl_wmi_query(), nasl_wmi_query_rsop(), nasl_wmi_reg_create_key(), nasl_wmi_reg_delete_key(), nasl_wmi_reg_enum_key(), nasl_wmi_reg_enum_value(), nasl_wmi_reg_get_bin_val(), nasl_wmi_reg_get_dword_val(), nasl_wmi_reg_get_ex_string_val(), nasl_wmi_reg_get_mul_string_val(), nasl_wmi_reg_get_qword_val(), nasl_wmi_reg_get_sz(), nasl_wmi_reg_set_dword_val(), nasl_wmi_reg_set_ex_string_val(), nasl_wmi_reg_set_qword_val(), nasl_wmi_reg_set_string_val(), replace_kb_item(), resolve_hostname(), script_add_preference(), script_mandatory_keys(), script_tag(), script_xref(), security_something(), set_ip_elements(), set_ipv6_elements(), set_kb_item(), set_tcp_elements(), set_tcp_v6_elements(), set_udp_elements(), and set_udp_v6_elements().

Here is the call graph for this function:

◆ get_str_var_by_num()

◆ get_var_size_by_name()

◆ get_var_size_by_num()

◆ get_var_type_by_name()

int get_var_type_by_name ( lex_ctxt ,
const char *   
)

Definition at line 1171 of file nasl_var.c.

1172  {
1173  named_nasl_var *v = get_var_ref_by_name (lexic, name, 0);
1174  return v == NULL ? VAR2_UNDEF : v->u.var_type;
1175  }

References get_var_ref_by_name(), name, st_n_nasl_var::u, VAR2_UNDEF, and st_a_nasl_var::var_type.

Referenced by nasl_open_sock_tcp_bufsz(), nasl_rsa_private_decrypt(), nasl_rsa_public_encrypt(), replace_kb_item(), and set_kb_item().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_var_type_by_num()

int get_var_type_by_num ( lex_ctxt ,
int   
)

Returns NASL variable/cell type, VAR2_UNDEF if value is NULL.

Definition at line 1164 of file nasl_var.c.

1165  {
1166  anon_nasl_var *v = get_var_ref_by_num (lexic, num);
1167  return v == NULL ? VAR2_UNDEF : v->var_type;
1168  }

References get_var_ref_by_num(), VAR2_UNDEF, and st_a_nasl_var::var_type.

Referenced by nasl_get_sock_info(), nasl_isnull(), nasl_isotime_is_valid(), nasl_isotime_scan(), nasl_rawstring(), nasl_string(), and nasl_substr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_variable_by_name()

tree_cell* get_variable_by_name ( lex_ctxt ,
const char *   
)

Definition at line 191 of file nasl_var.c.

192 {
193  if (name == NULL)
194  return NULL;
195  /* Broken: Need also code in get_array_elem */
196  if (strcmp (name, "_FCT_ANON_ARGS") == 0)
197  {
199  nasl_array *a = retc->x.ref_val = g_malloc0 (sizeof (nasl_array));
200  copy_array (a, &ctxt->ctx_vars, 0);
201  return retc;
202  }
203  else
204  {
205  named_nasl_var *v = get_var_ref_by_name (ctxt, name, 1);
206  return var2cell (&v->u);
207  }
208  /*NOTREACHED*/}

References alloc_typed_cell(), copy_array(), struct_lex_ctxt::ctx_vars, DYN_ARRAY, get_var_ref_by_name(), name, TC::ref_val, st_n_nasl_var::u, var2cell(), and TC::x.

Referenced by nasl_exec(), and nasl_pread().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_empty_lex_ctxt()

lex_ctxt* init_empty_lex_ctxt ( void  )
Todo:
Initialization of the library seems intuitively be necessary only once (involves "linking" the nasl functions to c code). Consider a "prototype" context that has to be created only once and of which copies are made when needed.

Definition at line 32 of file nasl_lex_ctxt.c.

33 {
34  lex_ctxt *c = g_malloc0 (sizeof (lex_ctxt));
35 
36  c->ctx_vars.hash_elt = g_malloc0 (sizeof (named_nasl_var *) * VAR_NAME_HASH);
37  c->ctx_vars.num_elt = NULL;
38  c->ctx_vars.max_idx = 0;
39  c->functions = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
40  (GDestroyNotify) free_func);
41  c->oid = NULL;
42  c->ret_val = NULL;
43  c->fct_ctxt = 0;
44 
50 
51  return c;
52 }

References struct_lex_ctxt::ctx_vars, struct_lex_ctxt::fct_ctxt, free_func(), struct_lex_ctxt::functions, st_nasl_array::hash_elt, init_nasl_library(), st_nasl_array::max_idx, st_nasl_array::num_elt, struct_lex_ctxt::oid, struct_lex_ctxt::ret_val, and VAR_NAME_HASH.

Referenced by exec_nasl_script(), nasl_func_call(), and nasl_lint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert_nasl_func()

nasl_func* insert_nasl_func ( lex_ctxt ,
const char *  ,
tree_cell ,
int   
)

Definition at line 53 of file nasl_func.c.

55 {
56  nasl_func *pf;
57 
58  if (get_func (lexic, fname))
59  {
60  if (lint_mode == 0)
61  nasl_perror (
62  lexic, "insert_nasl_func: function '%s' is already defined\n", fname);
63  return NULL;
64  }
65  pf = g_malloc0 (sizeof (nasl_func));
66  pf->func_name = g_strdup (fname);
67 
68  if (decl_node != NULL && decl_node != FAKE_CELL)
69  {
70  pf->block = decl_node->link[1];
71  ref_cell (pf->block);
72  }
73  g_hash_table_insert (lexic->functions, pf->func_name, pf);
74  return pf;
75 }

References st_nasl_func::block, FAKE_CELL, st_nasl_func::func_name, struct_lex_ctxt::functions, get_func(), TC::link, nasl_perror(), and ref_cell().

Referenced by decl_nasl_func().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nasl_func_call()

tree_cell* nasl_func_call ( lex_ctxt ,
const nasl_func ,
tree_cell  
)

Definition at line 107 of file nasl_func.c.

108 {
109  int nb_u = 0, nb_a = 0;
110  tree_cell *pc = NULL, *pc2 = NULL, *retc = NULL;
111  lex_ctxt *lexic2 = NULL;
112  char *trace_buf = NULL;
113  char *temp_funname = NULL, *tmp_filename = NULL;
114  int trace_buf_len = 0, tn;
115 #define TRACE_BUF_SZ 255
116 
117  /* 1. Create a new context */
118  lexic2 = init_empty_lex_ctxt ();
119  lexic2->script_infos = lexic->script_infos;
120  lexic2->oid = lexic->oid;
121  lexic2->recv_timeout = lexic->recv_timeout;
122  lexic2->fct_ctxt = 1;
123 
124  if (nasl_trace_fp != NULL)
125  {
126  trace_buf = g_malloc0 (TRACE_BUF_SZ);
127  tn = snprintf (trace_buf, TRACE_BUF_SZ, "Call %s(", f->func_name);
128  if (tn > 0)
129  trace_buf_len += tn;
130  }
131 
132  for (pc = arg_list; pc != NULL; pc = pc->link[1])
133  if (pc->x.str_val == NULL)
134  nb_u++;
135 
136  /*
137  * I should look exactly how unnamed arguments works...
138  * Or maybe I should remove this feature?
139  */
140 
141  for (nb_u = 0, pc = arg_list; pc != NULL; pc = pc->link[1])
142  {
143  pc2 = cell2atom (lexic, pc->link[0]);
144  if (pc->x.str_val == NULL)
145  {
146  /* 2. Add unnamed (numbered) variables for unnamed args */
147  if (add_numbered_var_to_ctxt (lexic2, nb_u, pc2) == NULL)
148  goto error;
149  nb_u++;
150  if (nasl_trace_fp != NULL && trace_buf_len < TRACE_BUF_SZ)
151  {
152  tn = snprintf (trace_buf + trace_buf_len,
153  TRACE_BUF_SZ - trace_buf_len, "%s%d: %s",
154  nb_a > 0 ? ", " : "", nb_u, dump_cell_val (pc2));
155  if (tn > 0)
156  trace_buf_len += tn;
157  }
158  nb_a++;
159  }
160  else
161  {
162  /* 3. and add named variables for named args */
163  if (add_named_var_to_ctxt (lexic2, pc->x.str_val, pc2) == NULL)
164  goto error;
165  if (nasl_trace_fp != NULL && trace_buf_len < TRACE_BUF_SZ)
166  {
167  tn = snprintf (trace_buf + trace_buf_len,
168  TRACE_BUF_SZ - trace_buf_len, "%s%s: %s",
169  nb_a > 0 ? ", " : "", pc->x.str_val,
170  dump_cell_val (pc2));
171  if (tn > 0)
172  trace_buf_len += tn;
173  }
174  nb_a++;
175  }
176  deref_cell (pc2);
177  }
178 
179  if (nasl_trace_fp != NULL)
180  {
181  if (trace_buf_len < TRACE_BUF_SZ)
182  nasl_trace (lexic, "NASL> %s)\n", trace_buf);
183  else
184  nasl_trace (lexic, "NASL> %s ...)\n", trace_buf);
185  g_free (trace_buf);
186  }
187 
188  /* 4. Chain new context to old (lexic) */
189  lexic2->up_ctxt = lexic;
190  /* 5. Execute */
191  tmp_filename = g_strdup (nasl_get_filename (NULL));
192  nasl_set_filename (nasl_get_filename (f->func_name));
193  if (func_is_internal (f->func_name))
194  {
195  tree_cell *(*pf2) (lex_ctxt *) = f->block;
196  retc = pf2 (lexic2);
197  }
198  else
199  {
200  temp_funname = g_strdup (nasl_get_function_name ());
201  nasl_set_function_name (f->func_name);
202  retc = nasl_exec (lexic2, f->block);
203  deref_cell (retc);
204  retc = FAKE_CELL;
205  nasl_set_function_name (temp_funname);
206  g_free (temp_funname);
207  }
208  nasl_set_filename (tmp_filename);
209  g_free (tmp_filename);
210 
211  if ((retc == NULL || retc == FAKE_CELL)
212  && (lexic2->ret_val != NULL && lexic2->ret_val != FAKE_CELL))
213  {
214  retc = lexic2->ret_val;
215  ref_cell (retc);
216  }
217 
218  if (nasl_trace_enabled ())
219  nasl_trace (lexic, "NASL> Return %s: %s\n", f->func_name,
220  dump_cell_val (retc));
221  if (!nasl_is_leaf (retc))
222  {
223  nasl_perror (lexic,
224  "nasl_func_call: return value from %s is not atomic!\n",
225  f->func_name);
226  nasl_dump_tree (retc);
227  }
228 
229  free_lex_ctxt (lexic2);
230  lexic2 = NULL;
231  return retc;
232 
233 error:
234  free_lex_ctxt (lexic2);
235  return NULL;
236 }

References add_named_var_to_ctxt(), add_numbered_var_to_ctxt(), st_nasl_func::block, cell2atom(), deref_cell(), dump_cell_val(), FAKE_CELL, struct_lex_ctxt::fct_ctxt, free_lex_ctxt(), func_is_internal(), st_nasl_func::func_name, init_empty_lex_ctxt(), TC::link, nasl_dump_tree(), nasl_exec(), nasl_get_filename(), nasl_get_function_name(), nasl_is_leaf(), nasl_perror(), nasl_set_filename(), nasl_set_function_name(), nasl_trace(), nasl_trace_enabled(), nasl_trace_fp, struct_lex_ctxt::oid, struct_lex_ctxt::recv_timeout, ref_cell(), struct_lex_ctxt::ret_val, struct_lex_ctxt::script_infos, TC::str_val, TRACE_BUF_SZ, struct_lex_ctxt::up_ctxt, and TC::x.

Referenced by exec_nasl_script(), and nasl_exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nasl_incr_variable()

tree_cell* nasl_incr_variable ( lex_ctxt ,
tree_cell ,
int  ,
int   
)

Definition at line 933 of file nasl_var.c.

934  {
935  anon_nasl_var *v;
936  int old_val = 0, new_val;
937  tree_cell *retc;
938 
939  if (tc->type != REF_VAR)
940  {
941  nasl_perror (
942  lexic, "nasl_incr_variable: argument (type=%d) is not REF_VAR %s\n",
943  tc->type, get_line_nb (tc));
944  return NULL;
945  }
946 
947  v = tc->x.ref_val;
948 
949  switch (v->var_type)
950  {
951  case VAR2_INT:
952  old_val = v->v.v_int;
953  break;
954  case VAR2_STRING:
955  case VAR2_DATA:
956  old_val =
957  v->v.v_str.s_val == NULL ? 0 : atoi ((char *) v->v.v_str.s_val);
958  break;
959  case VAR2_UNDEF:
960  old_val = 0;
961  break;
962 
963  default:
964  nasl_perror (lexic,
965  "nasl_incr_variable: variable %s has bad type %d %s\n",
966  /*get_var_name(v) */ "", get_line_nb (tc));
967  return NULL;
968  }
969  new_val = old_val + val;
970 
971  clear_anon_var (v);
972  v->var_type = VAR2_INT;
973  v->v.v_int = new_val;
974 
975  retc = alloc_typed_cell (CONST_INT);
976  retc->x.i_val = pre ? new_val : old_val;
977 
978  return retc;
979  }

References alloc_typed_cell(), clear_anon_var(), CONST_INT, get_line_nb(), TC::i_val, nasl_perror(), TC::ref_val, REF_VAR, st_nasl_string::s_val, TC::type, st_a_nasl_var::v, st_a_nasl_var::v_int, st_a_nasl_var::v_str, val, VAR2_DATA, VAR2_INT, VAR2_STRING, VAR2_UNDEF, st_a_nasl_var::var_type, and TC::x.

Referenced by nasl_exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nasl_read_var_ref()

tree_cell* nasl_read_var_ref ( lex_ctxt ,
tree_cell  
)

Definition at line 847 of file nasl_var.c.

848  {
849  tree_cell *ret;
850  anon_nasl_var *v;
851 
852  if (tc == NULL || tc == FAKE_CELL)
853  {
854  nasl_perror (lexic,
855  "nasl_read_var_ref: cannot read NULL or FAKE cell\n");
856  return NULL;
857  }
858  if (tc->type != REF_VAR)
859  {
860  nasl_perror (lexic,
861  "nasl_read_var_ref: argument (type=%d) is not REF_VAR %s\n",
862  tc->type, get_line_nb (tc));
863  return NULL;
864  }
865 
866  v = tc->x.ref_val;
867  if (v == NULL)
868  return NULL;
869 
871  ret->line_nb = tc->line_nb;
872 
873  switch (v->var_type)
874  {
875  case VAR2_INT:
876  ret->type = CONST_INT;
877  ret->x.i_val = v->v.v_int;
878  if (nasl_trace_enabled ())
879  nasl_trace (lexic, "NASL> %s -> %d\n", get_var_name (v), ret->x.i_val);
880  return ret;
881 
882  case VAR2_STRING:
883  ret->type = CONST_STR;
884  /* Fix bad string length */
885  if (v->v.v_str.s_siz <= 0 && v->v.v_str.s_val[0] != '\0')
886  {
887  v->v.v_str.s_siz = strlen ((char *) v->v.v_str.s_val);
888  nasl_perror (lexic, "nasl_read_var_ref: Bad string length fixed\n");
889  }
890  /* fallthrough */
891  case VAR2_DATA:
892  ret->type = v->var_type == VAR2_STRING ? CONST_STR : CONST_DATA;
893  if (v->v.v_str.s_val == NULL)
894  {
895  ret->x.str_val = NULL;
896  ret->size = 0;
897  }
898  else
899  {
900  ret->x.str_val = g_malloc0 (v->v.v_str.s_siz + 1);
901  memcpy (ret->x.str_val, v->v.v_str.s_val, v->v.v_str.s_siz);
902  ret->size = v->v.v_str.s_siz;
903  }
904  if (nasl_trace_enabled ())
905  nasl_trace (lexic, "NASL> %s -> \"%s\"\n", get_var_name (v),
906  ret->x.str_val);
907  return ret;
908 
909  case VAR2_ARRAY:
910  ret->type = REF_ARRAY;
911  ret->x.ref_val = &v->v.v_arr;
912  return ret;
913 
914  case VAR2_UNDEF:
915  if (nasl_trace_enabled ())
916  nasl_trace (lexic, "NASL> %s -> undef\n", get_var_name (v),
917  v->var_type);
918  break;
919 
920  default:
921  nasl_perror (lexic, "nasl_read_var_ref: unhandled variable type %d\n",
922  v->var_type);
923  if (nasl_trace_enabled ())
924  nasl_trace (lexic, "NASL> %s -> ???? (Var type %d)\n",
925  get_var_name (v), v->var_type);
926  break;
927  }
928  deref_cell (ret);
929  return NULL;
930  }

References alloc_typed_cell(), CONST_DATA, CONST_INT, CONST_STR, deref_cell(), FAKE_CELL, get_line_nb(), get_var_name(), TC::i_val, TC::line_nb, nasl_perror(), nasl_trace(), nasl_trace_enabled(), NODE_EMPTY, REF_ARRAY, TC::ref_val, REF_VAR, st_nasl_string::s_siz, st_nasl_string::s_val, TC::size, TC::str_val, TC::type, st_a_nasl_var::v, st_a_nasl_var::v_arr, st_a_nasl_var::v_int, st_a_nasl_var::v_str, VAR2_ARRAY, VAR2_DATA, VAR2_INT, VAR2_STRING, VAR2_UNDEF, st_a_nasl_var::var_type, and TC::x.

Referenced by nasl_exec().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nasl_return()

tree_cell* nasl_return ( lex_ctxt ,
tree_cell  
)

Definition at line 239 of file nasl_func.c.

240 {
241  tree_cell *c;
242 
243  retv = cell2atom (ctxt, retv);
244  if (retv == NULL)
245  retv = FAKE_CELL;
246 
247  if (retv != FAKE_CELL && retv->type == REF_ARRAY)
248  /* We have to "copy" it as the referenced array will be freed */
249  {
250  c = copy_ref_array (retv);
251  deref_cell (retv);
252  retv = c;
253  }
254 
255  while (ctxt != NULL)
256  {
257  ctxt->ret_val = retv;
258  ref_cell (retv);
259  if (ctxt->fct_ctxt)
260  break;
261  ctxt = ctxt->up_ctxt;
262  }
263  /* Bug? Do not return NULL, as we may test it to break the control flow */
264  deref_cell (retv);
265  return FAKE_CELL;
266 }

References cell2atom(), copy_ref_array(), deref_cell(), FAKE_CELL, struct_lex_ctxt::fct_ctxt, REF_ARRAY, ref_cell(), struct_lex_ctxt::ret_val, TC::type, and struct_lex_ctxt::up_ctxt.

Referenced by nasl_exec().

Here is the call graph for this function:
Here is the caller graph for this function:
st_a_nasl_var
Definition: nasl_var.h:50
get_var_name
static const char * get_var_name(anon_nasl_var *v)
Definition: nasl_var.c:211
free_array
void free_array(nasl_array *a)
Definition: nasl_var.c:354
VAR2_ARRAY
@ VAR2_ARRAY
Definition: nasl_var.h:30
struct_lex_ctxt::ctx_vars
nasl_array ctx_vars
Definition: nasl_lex_ctxt.h:46
CONST_DATA
@ CONST_DATA
Definition: nasl_tree.h:93
nasl_trace
void nasl_trace(lex_ctxt *lexic, char *msg,...)
Prints debug message in printf fashion to nasl_trace_fp if it exists.
Definition: nasl_debug.c:184
add_named_var_to_ctxt
named_nasl_var * add_named_var_to_ctxt(lex_ctxt *, const char *, tree_cell *)
Definition: nasl_var.c:825
get_func
static nasl_func * get_func(lex_ctxt *ctxt, const char *name)
This function climbs up in the context list and searches for a given.
Definition: nasl_func.c:37
add_numbered_var_to_ctxt
anon_nasl_var * add_numbered_var_to_ctxt(lex_ctxt *, int, tree_cell *)
Definition: nasl_var.c:796
TC::str_val
char * str_val
Definition: nasl_tree.h:112
create_named_var
static named_nasl_var * create_named_var(const char *name, tree_cell *val)
Definition: nasl_var.c:734
get_var_ref_by_num
static anon_nasl_var * get_var_ref_by_num(lex_ctxt *ctxt, int num)
Definition: nasl_var.c:153
nasl_get_function_name
const char * nasl_get_function_name()
Definition: nasl_debug.c:91
copy_array
static void copy_array(nasl_array *, const nasl_array *, int)
Definition: nasl_var.c:508
CONST_STR
@ CONST_STR
Definition: nasl_tree.h:91
st_n_nasl_var
Definition: nasl_var.h:65
var2str
const char * var2str(anon_nasl_var *v)
Definition: nasl_var.c:1076
nasl_dump_tree
void nasl_dump_tree(const tree_cell *c)
Definition: nasl_tree.c:377
st_nasl_array::max_idx
int max_idx
Definition: nasl_var.h:45
st_a_nasl_var::v_arr
nasl_array v_arr
Definition: nasl_var.h:60
st_nasl_array::hash_elt
struct st_n_nasl_var ** hash_elt
Definition: nasl_var.h:47
struct_lex_ctxt::functions
GHashTable * functions
Definition: nasl_lex_ctxt.h:48
DYN_ARRAY
@ DYN_ARRAY
Definition: nasl_tree.h:101
nasl_exec
tree_cell * nasl_exec(lex_ctxt *lexic, tree_cell *st)
Execute a parse tree.
Definition: exec.c:781
st_nasl_func
Definition: nasl_func.h:25
FAKE_CELL
#define FAKE_CELL
Definition: nasl_tree.h:119
TC::x
union TC::@2 x
st_n_nasl_var::var_name
char * var_name
Definition: nasl_var.h:69
create_anon_var
static anon_nasl_var * create_anon_var(tree_cell *val)
Definition: nasl_var.c:755
nasl_set_function_name
void nasl_set_function_name(const char *funname)
Definition: nasl_debug.c:82
st_a_nasl_var::v_str
nasl_string_t v_str
Definition: nasl_var.h:58
clear_anon_var
void clear_anon_var(anon_nasl_var *v)
Definition: nasl_var.c:418
st_nasl_string::s_siz
int s_siz
Definition: nasl_var.h:38
name
const char * name
Definition: nasl_init.c:377
st_nasl_array
Definition: nasl_var.h:43
TRACE_BUF_SZ
#define TRACE_BUF_SZ
struct_lex_ctxt::up_ctxt
struct struct_lex_ctxt * up_ctxt
Definition: nasl_lex_ctxt.h:35
cell2atom
tree_cell * cell2atom(lex_ctxt *lexic, tree_cell *c1)
Definition: exec.c:205
get_var_by_name
static named_nasl_var * get_var_by_name(nasl_array *a, const char *s)
Definition: nasl_var.c:90
st_n_nasl_var::next_var
struct st_n_nasl_var * next_var
Definition: nasl_var.h:73
nasl_perror
void nasl_perror(lex_ctxt *lexic, char *msg,...)
Definition: nasl_debug.c:120
nasl_trace_enabled
int nasl_trace_enabled(void)
Checks if the nasl_trace_fp is set.
Definition: nasl_debug.c:170
insert_nasl_func
nasl_func * insert_nasl_func(lex_ctxt *lexic, const char *fname, tree_cell *decl_node, int lint_mode)
Definition: nasl_func.c:53
func_is_internal
nasl_func * func_is_internal(const char *)
Definition: nasl_init.c:486
dump_cell_val
char * dump_cell_val(const tree_cell *c)
Definition: nasl_tree.c:245
get_var_size
static int get_var_size(const anon_nasl_var *v)
Definition: nasl_var.c:1133
VAR2_UNDEF
@ VAR2_UNDEF
Definition: nasl_var.h:26
TC::size
int size
Definition: nasl_tree.h:109
var2cell
tree_cell * var2cell(anon_nasl_var *v)
Definition: nasl_var.c:183
TC::line_nb
short line_nb
Definition: nasl_tree.h:107
struct_lex_ctxt::oid
const char * oid
Definition: nasl_lex_ctxt.h:42
free_lex_ctxt
void free_lex_ctxt(lex_ctxt *c)
Definition: nasl_lex_ctxt.c:55
VAR2_DATA
@ VAR2_DATA
Definition: nasl_var.h:29
struct_lex_ctxt::fct_ctxt
unsigned fct_ctxt
Definition: nasl_lex_ctxt.h:37
TC::ref_val
void * ref_val
Definition: nasl_tree.h:114
st_a_nasl_var::var_type
int var_type
Definition: nasl_var.h:52
st_nasl_func::block
void * block
Definition: nasl_func.h:28
free_func
void free_func(nasl_func *f)
Definition: nasl_func.c:269
get_line_nb
char * get_line_nb(const tree_cell *c)
Definition: nasl_tree.c:390
init_nasl_library
void init_nasl_library(lex_ctxt *)
Adds "built-in" variable and function definitions to a context.
Definition: nasl_init.c:446
struct_lex_ctxt::script_infos
struct script_infos * script_infos
Definition: nasl_lex_ctxt.h:41
alloc_expr_cell
tree_cell * alloc_expr_cell(int lnb, int t, tree_cell *l, tree_cell *r)
Definition: nasl_tree.c:74
st_nasl_func::func_name
char * func_name
Definition: nasl_func.h:27
TC
Definition: nasl_tree.h:104
struct_lex_ctxt
Definition: nasl_lex_ctxt.h:33
TC::type
short type
Definition: nasl_tree.h:106
TC::link
struct TC * link[4]
Definition: nasl_tree.h:116
decl_local_variables
tree_cell * decl_local_variables(lex_ctxt *lexic, tree_cell *vars)
Definition: nasl_var.c:773
ref_cell
void ref_cell(tree_cell *c)
Definition: nasl_tree.c:178
REF_VAR
@ REF_VAR
Definition: nasl_tree.h:99
CONST_INT
@ CONST_INT
Definition: nasl_tree.h:90
nasl_is_leaf
int nasl_is_leaf(const tree_cell *pc)
Definition: nasl_tree.c:400
val
const char * val
Definition: nasl_init.c:378
var2int
static long int var2int(anon_nasl_var *v, int defval)
Definition: nasl_var.c:982
add_named_var_to_ctxt
named_nasl_var * add_named_var_to_ctxt(lex_ctxt *lexic, const char *name, tree_cell *val)
Definition: nasl_var.c:825
struct_lex_ctxt::recv_timeout
int recv_timeout
Definition: nasl_lex_ctxt.h:43
hash_str
static int hash_str(const char *s)
Definition: nasl_var.c:52
nasl_trace_fp
FILE * nasl_trace_fp
Definition: exec.c:368
copy_ref_array
tree_cell * copy_ref_array(const tree_cell *c1)
Definition: nasl_var.c:549
st_a_nasl_var::v
union st_a_nasl_var::@4 v
VAR2_STRING
@ VAR2_STRING
Definition: nasl_var.h:28
nasl_get_filename
const char * nasl_get_filename(const char *function)
Definition: nasl_debug.c:69
get_var_ref_by_name
static named_nasl_var * get_var_ref_by_name(lex_ctxt *ctxt, const char *name, int climb)
This function climbs up in the context list.
Definition: nasl_var.c:115
st_a_nasl_var::v_int
long int v_int
Definition: nasl_var.h:59
REF_ARRAY
@ REF_ARRAY
Definition: nasl_tree.h:100
nasl_set_filename
void nasl_set_filename(const char *filename)
Definition: nasl_debug.c:97
free_anon_var
static void free_anon_var(anon_nasl_var *)
Definition: nasl_var.c:399
deref_cell
void deref_cell(tree_cell *c)
Definition: nasl_tree.c:192
alloc_typed_cell
tree_cell * alloc_typed_cell(int typ)
Definition: nasl_tree.c:40
st_n_nasl_var::u
struct st_a_nasl_var u
Definition: nasl_var.h:67
VAR2_INT
@ VAR2_INT
Definition: nasl_var.h:27
init_empty_lex_ctxt
lex_ctxt * init_empty_lex_ctxt()
Definition: nasl_lex_ctxt.c:32
NODE_EMPTY
@ NODE_EMPTY
Definition: nasl_tree.h:24
VAR_NAME_HASH
#define VAR_NAME_HASH
Definition: nasl_var.h:33
nasl_get_var_by_num
anon_nasl_var * nasl_get_var_by_num(void *ctxt, nasl_array *a, int num, int create)
Definition: nasl_var.c:58
st_nasl_string::s_val
unsigned char * s_val
Definition: nasl_var.h:37
struct_lex_ctxt::ret_val
tree_cell * ret_val
Definition: nasl_lex_ctxt.h:36
TC::i_val
long int i_val
Definition: nasl_tree.h:113
st_nasl_array::num_elt
struct st_a_nasl_var ** num_elt
Definition: nasl_var.h:46