OpenVAS Scanner  7.0.1~git
nasl_tree.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TC
 

Macros

#define FAKE_CELL   ((void *) 1)
 
#define EXIT_CELL   ((void *) 2)
 

Typedefs

typedef struct TC tree_cell
 

Enumerations

enum  node_type {
  NODE_EMPTY = 0, NODE_IF_ELSE, NODE_INSTR_L, NODE_FOR,
  NODE_WHILE, NODE_FOREACH, NODE_REPEAT_UNTIL, NODE_REPEATED,
  NODE_FUN_DEF, NODE_FUN_CALL, NODE_DECL, NODE_ARG,
  NODE_RETURN, NODE_BREAK, NODE_CONTINUE, NODE_ARRAY_EL,
  NODE_AFF, NODE_VAR, NODE_LOCAL, NODE_GLOBAL,
  NODE_PLUS_EQ, NODE_MINUS_EQ, NODE_MULT_EQ, NODE_DIV_EQ,
  NODE_MODULO_EQ, NODE_L_SHIFT_EQ, NODE_R_SHIFT_EQ, NODE_R_USHIFT_EQ,
  EXPR_AND, EXPR_OR, EXPR_NOT, EXPR_PLUS,
  EXPR_MINUS, EXPR_U_MINUS, EXPR_MULT, EXPR_DIV,
  EXPR_MODULO, EXPR_EXPO, EXPR_BIT_AND, EXPR_BIT_OR,
  EXPR_BIT_XOR, EXPR_BIT_NOT, EXPR_INCR, EXPR_DECR,
  EXPR_L_SHIFT, EXPR_R_SHIFT, EXPR_R_USHIFT, COMP_MATCH,
  COMP_NOMATCH, COMP_RE_MATCH, COMP_RE_NOMATCH, COMP_LT,
  COMP_LE, COMP_EQ, COMP_NE, COMP_GT,
  COMP_GE, CONST_INT, CONST_STR, CONST_DATA,
  CONST_REGEX, ARRAY_ELEM, REF_VAR, REF_ARRAY,
  DYN_ARRAY
}
 

Functions

tree_cellalloc_expr_cell (int, int, tree_cell *, tree_cell *)
 
tree_cellalloc_RE_cell (int, int, tree_cell *, char *)
 
tree_cellalloc_typed_cell (int)
 
int nasl_is_leaf (const tree_cell *)
 
char * get_line_nb (const tree_cell *)
 
tree_celldup_cell (const tree_cell *)
 
void nasl_dump_tree (const tree_cell *)
 
void ref_cell (tree_cell *)
 
void deref_cell (tree_cell *)
 
const char * nasl_type_name (int)
 
int cell_type (const tree_cell *)
 
char * dump_cell_val (const tree_cell *)
 

Macro Definition Documentation

◆ EXIT_CELL

#define EXIT_CELL   ((void *) 2)

Definition at line 120 of file nasl_tree.h.

◆ FAKE_CELL

#define FAKE_CELL   ((void *) 1)

Definition at line 119 of file nasl_tree.h.

Referenced by affect_to_anon_var(), alloc_RE_cell(), cell2atom(), cell2bool(), cell2int3(), cell2str(), cell_cmp(), cell_type(), copy_ref_array(), create_anon_var(), create_named_var(), decl_local_variables(), decl_nasl_func(), deref_cell(), dump_cell_val(), dump_ip_packet(), dump_ipv6_packet(), dump_tree(), dup_cell(), free_tree(), get_host_ip(), get_kb_list(), get_line_nb(), get_port_state(), get_udp_port_state(), insert_nasl_func(), make_array_from_elems(), make_call_func_list(), nasl_array_iterator(), nasl_close_socket(), nasl_crap(), nasl_dump_ctxt(), nasl_dump_expr(), nasl_dump_tree(), nasl_egrep(), nasl_ereg_replace(), nasl_exec(), nasl_func_call(), nasl_get_sock_info(), nasl_is_leaf(), nasl_leave_multicast_group(), nasl_lint(), nasl_lint_call(), nasl_lint_def(), nasl_lint_defvar(), nasl_open_privileged_socket(), nasl_read_var_ref(), nasl_return(), nasl_scanner_add_port(), nasl_scanner_status(), nasl_send_packet(), nasl_send_v6packet(), nasl_short_dump(), nasl_sleep(), nasl_ssh_disconnect(), nasl_ssh_set_login(), nasl_start_denial(), nasl_strstr(), nasl_unlink(), nasl_usleep(), plugin_run_nmap(), ref_cell(), replace_kb_item(), script_add_preference(), script_bugtraq_id(), script_category(), script_copyright(), script_cve_id(), script_dependencies(), script_exclude_keys(), script_family(), script_get_preference(), script_get_preference_file_content(), script_mandatory_keys(), script_name(), script_oid(), script_require_keys(), script_require_ports(), script_require_udp_ports(), script_tag(), script_timeout(), script_version(), script_xref(), security_something(), and set_kb_item().

Typedef Documentation

◆ tree_cell

typedef struct TC tree_cell

Enumeration Type Documentation

◆ node_type

enum node_type
Enumerator
NODE_EMPTY 
NODE_IF_ELSE 
NODE_INSTR_L 
NODE_FOR 
NODE_WHILE 
NODE_FOREACH 
NODE_REPEAT_UNTIL 
NODE_REPEATED 
NODE_FUN_DEF 
NODE_FUN_CALL 
NODE_DECL 
NODE_ARG 
NODE_RETURN 
NODE_BREAK 
NODE_CONTINUE 
NODE_ARRAY_EL 
NODE_AFF 
NODE_VAR 
NODE_LOCAL 
NODE_GLOBAL 
NODE_PLUS_EQ 
NODE_MINUS_EQ 
NODE_MULT_EQ 
NODE_DIV_EQ 
NODE_MODULO_EQ 
NODE_L_SHIFT_EQ 
NODE_R_SHIFT_EQ 
NODE_R_USHIFT_EQ 
EXPR_AND 
EXPR_OR 
EXPR_NOT 
EXPR_PLUS 
EXPR_MINUS 
EXPR_U_MINUS 
EXPR_MULT 
EXPR_DIV 
EXPR_MODULO 
EXPR_EXPO 
EXPR_BIT_AND 
EXPR_BIT_OR 
EXPR_BIT_XOR 
EXPR_BIT_NOT 
EXPR_INCR 
EXPR_DECR 
EXPR_L_SHIFT 
EXPR_R_SHIFT 
EXPR_R_USHIFT 
COMP_MATCH 
COMP_NOMATCH 
COMP_RE_MATCH 
COMP_RE_NOMATCH 
COMP_LT 
COMP_LE 
COMP_EQ 
COMP_NE 
COMP_GT 
COMP_GE 
CONST_INT 
CONST_STR 
CONST_DATA 
CONST_REGEX 
ARRAY_ELEM 
REF_VAR 
REF_ARRAY 
DYN_ARRAY 

Definition at line 22 of file nasl_tree.h.

23 {
24  NODE_EMPTY = 0,
25  NODE_IF_ELSE, /* [0] = cond, [1] = if_block, [2] = else_block */
26  NODE_INSTR_L, /* Block. [0] = first instr, [1] = tail */
27  NODE_FOR, /* [0] = start expr, [1] = cond, [2] = end_expr, [3] = block */
28  NODE_WHILE, /* [0] = cond, [1] = block */
31  NODE_REPEATED, /* [0] = func call, [1] = repeat nb */
32  NODE_FUN_DEF, /* [0] = argdecl, [1] = block */
33  NODE_FUN_CALL, /* [0] = script_infos */
34  NODE_DECL, /* [0] = next arg in list */
35  NODE_ARG, /* val = name can be NULL, [0] = val, [1] = next arg */
36  NODE_RETURN, /* ret val */
37  NODE_BREAK,
39 
40  NODE_ARRAY_EL, /* val = array name, [0] = index */
41  NODE_AFF, /* [0] = lvalue, [1] = rvalue */
42  NODE_VAR, /* val = variable name */
43  NODE_LOCAL, /* [0] = argdecl */
45 
51 
55 
56  EXPR_AND,
57  EXPR_OR,
58  EXPR_NOT,
59 
60  EXPR_PLUS,
61  EXPR_MINUS,
63  EXPR_MULT,
64  EXPR_DIV,
66  EXPR_EXPO,
67 
72  EXPR_INCR,
73  EXPR_DECR,
77 
78  COMP_MATCH,
82 
83  COMP_LT,
84  COMP_LE,
85  COMP_EQ,
86  COMP_NE,
87  COMP_GT,
88  COMP_GE,
89 
90  CONST_INT,
91  CONST_STR, /* "impure" string */
92 
93  CONST_DATA, /* binary data / "pure" string */
94  CONST_REGEX, /* Compiled regex */
95 
96  ARRAY_ELEM, /* val = char index or NULL if integer,
97  * [0] = value, [1] = next element */
98  /* For exec only */
99  REF_VAR,
100  REF_ARRAY,
101  DYN_ARRAY
102 };

Function Documentation

◆ alloc_expr_cell()

tree_cell* alloc_expr_cell ( int  ,
int  ,
tree_cell ,
tree_cell  
)

Definition at line 74 of file nasl_tree.c.

References alloc_tree_cell(), TC::line_nb, TC::link, and TC::type.

Referenced by get_array_elem(), int2cell(), nasl_exec(), and yyparse().

75 {
76  tree_cell *c = alloc_tree_cell ();
77  c->line_nb = lnb;
78  c->type = t;
79  c->link[0] = l;
80  c->link[1] = r;
81 
82  return c;
83 }
struct TC * link[4]
Definition: nasl_tree.h:116
short type
Definition: nasl_tree.h:106
short line_nb
Definition: nasl_tree.h:107
Definition: nasl_tree.h:104
tree_cell * alloc_tree_cell()
Definition: nasl_tree.c:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ alloc_RE_cell()

tree_cell* alloc_RE_cell ( int  ,
int  ,
tree_cell ,
char *   
)

Definition at line 48 of file nasl_tree.c.

References alloc_tree_cell(), FAKE_CELL, TC::line_nb, TC::link, nasl_perror(), TC::ref_val, TC::type, and TC::x.

Referenced by yyparse().

49 {
50  regex_t *re = g_malloc0 (sizeof (regex_t));
51  int e;
52 
53  tree_cell *c = alloc_tree_cell ();
54  c->line_nb = lnb;
55  c->type = t; /* We could check the type... */
56  c->link[0] = l;
57  c->link[1] = FAKE_CELL;
58  e = regcomp (re, re_str, REG_EXTENDED | REG_NOSUB | REG_ICASE);
59  if (!e)
60  c->x.ref_val = re;
61  else
62  {
63  char errbuf[100];
64  regerror (e, re, errbuf, sizeof (errbuf));
65  nasl_perror (NULL, "Line %d: Cannot compile regex: %s (error %d: %s)\n",
66  lnb, re_str, e, errbuf);
67  g_free (re);
68  }
69  g_free (re_str);
70  return c;
71 }
#define FAKE_CELL
Definition: nasl_tree.h:119
struct TC * link[4]
Definition: nasl_tree.h:116
short type
Definition: nasl_tree.h:106
short line_nb
Definition: nasl_tree.h:107
void * ref_val
Definition: nasl_tree.h:114
Definition: nasl_tree.h:104
union TC::@2 x
void nasl_perror(lex_ctxt *lexic, char *msg,...)
Definition: nasl_debug.c:120
tree_cell * alloc_tree_cell()
Definition: nasl_tree.c:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ alloc_typed_cell()

tree_cell* alloc_typed_cell ( int  )

Definition at line 40 of file nasl_tree.c.

References alloc_tree_cell(), and TC::type.

Referenced by _http_req(), cgibin(), copy_ref_array(), 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_host_ip(), get_host_open_port(), get_hostname(), get_hostname_source(), get_hostnames(), get_icmp_element(), get_icmp_v6_element(), get_ip_element(), get_ipv6_element(), get_kb_item(), get_kb_list(), get_port_state(), get_port_transport(), get_script_oid(), get_tcp_element(), get_tcp_v6_element(), get_udp_element(), get_udp_port_state(), get_udp_v6_element(), get_variable_by_name(), insert_ip_options(), insert_ipv6_options(), make_array_from_elems(), nasl_bf_cbc(), nasl_bn_random(), nasl_chomp(), nasl_cipher(), nasl_close_stream_cipher(), nasl_crap(), nasl_dec2str(), nasl_defined_func(), nasl_dh_compute_key(), nasl_dh_generate_key(), nasl_display(), nasl_do_exit(), nasl_egrep(), nasl_end_denial(), nasl_ereg(), nasl_ereg_replace(), nasl_eregmatch(), nasl_exec(), nasl_file_close(), nasl_file_open(), nasl_file_read(), nasl_file_seek(), nasl_file_stat(), nasl_file_write(), nasl_find_in_path(), nasl_fread(), nasl_ftp_get_pasv_address(), nasl_ftp_log_in(), nasl_fwrite(), nasl_gcrypt_hash(), nasl_get_byte_order(), nasl_get_preference(), nasl_get_sign(), nasl_get_smb2_sign(), nasl_get_sock_info(), nasl_get_source_port(), nasl_get_tmp_dir(), nasl_gettimeofday(), nasl_gunzip(), nasl_gzip(), nasl_hex(), nasl_hexstr(), nasl_hmac_sha256(), nasl_incr_variable(), nasl_insert_hexzeros(), nasl_insstr(), nasl_int(), nasl_islocalhost(), nasl_islocalnet(), nasl_isnull(), nasl_isotime_add(), nasl_isotime_is_valid(), nasl_isotime_now(), nasl_isotime_print(), nasl_isotime_scan(), nasl_join_multicast_group(), nasl_keyexchg(), nasl_keys(), nasl_lm_owf_gen(), nasl_localtime(), nasl_make_array(), nasl_make_list(), nasl_match(), nasl_max_index(), nasl_mktime(), nasl_ntlm2_response(), nasl_ntlm_response(), nasl_ntlmv1_hash(), nasl_ntlmv2_hash(), nasl_ntlmv2_response(), nasl_ntv2_owf_gen(), nasl_open_privileged_socket(), nasl_open_sock_kdc(), nasl_open_sock_tcp_bufsz(), nasl_open_sock_udp(), nasl_open_stream_cipher(), nasl_ord(), nasl_pcap_next(), nasl_pem_to(), nasl_pread(), nasl_prf(), nasl_rand(), nasl_rawstring(), nasl_read_var_ref(), nasl_recv(), nasl_recv_line(), nasl_rsa_private_decrypt(), nasl_rsa_public_decrypt(), nasl_rsa_public_encrypt(), nasl_rsa_sign(), nasl_same_host(), nasl_scanner_get_port(), nasl_send(), nasl_send_capture(), nasl_send_packet(), nasl_send_v6packet(), nasl_smb_close(), nasl_smb_connect(), nasl_smb_file_group_sid(), nasl_smb_file_owner_sid(), nasl_smb_file_SDDL(), nasl_smb_file_trustee_rights(), nasl_smb_versioninfo(), nasl_socket_cert_verify(), nasl_socket_get_cert(), nasl_socket_get_error(), 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_get_auth_methods(), nasl_ssh_get_host_key(), nasl_ssh_get_issue_banner(), nasl_ssh_get_server_banner(), nasl_ssh_get_sock(), nasl_ssh_login_interactive(), nasl_ssh_login_interactive_pass(), nasl_ssh_request_exec(), nasl_ssh_session_id_from_sock(), nasl_ssh_shell_open(), nasl_ssh_shell_read(), nasl_ssh_shell_write(), nasl_ssh_userauth(), nasl_str_replace(), nasl_strcat(), nasl_stridx(), nasl_string(), nasl_strlen(), nasl_strstr(), nasl_substr(), nasl_target_is_ipv6(), nasl_tcp_ping(), nasl_tcp_v6_ping(), nasl_telnet_init(), nasl_this_host(), nasl_this_host_name(), nasl_tolower(), nasl_toupper(), nasl_typeof(), nasl_unixtime(), nasl_vendor_version(), nasl_win_cmd_exec(), nasl_wmi_close(), nasl_wmi_connect(), nasl_wmi_connect_reg(), nasl_wmi_connect_rsop(), 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(), nasl_wmi_versioninfo(), network_targets(), resolve_hostname(), safe_checks(), scan_phase(), script_get_preference(), script_get_preference_file_content(), script_get_preference_file_location(), set_ip_elements(), set_ipv6_elements(), set_tcp_elements(), set_tcp_v6_elements(), set_udp_elements(), set_udp_v6_elements(), var2cell(), and yyparse().

41 {
42  tree_cell *c = alloc_tree_cell ();
43  c->type = typ;
44  return c;
45 }
short type
Definition: nasl_tree.h:106
Definition: nasl_tree.h:104
tree_cell * alloc_tree_cell()
Definition: nasl_tree.c:34
Here is the call graph for this function:

◆ cell_type()

int cell_type ( const tree_cell )

Definition at line 418 of file nasl_tree.c.

References FAKE_CELL, and TC::type.

Referenced by cell_cmp().

419  {
420  if (c == NULL || c == FAKE_CELL)
421  return 0;
422  else
423  return c->type;
424  }
#define FAKE_CELL
Definition: nasl_tree.h:119
Here is the caller graph for this function:

◆ deref_cell()

void deref_cell ( tree_cell )

Definition at line 192 of file nasl_tree.c.

References FAKE_CELL, free_tree(), and TC::ref_count.

Referenced by cell2atom(), cell2bool(), cell2int3(), cell2str(), cell_cmp(), create_anon_var(), create_named_var(), exec_nasl_script(), free_lex_ctxt(), free_tree(), get_kb_list(), get_tcp_v6_element(), make_array_from_elems(), nasl_clean_ctx(), nasl_display(), nasl_exec(), nasl_func_call(), nasl_pread(), nasl_read_var_ref(), nasl_return(), nasl_start_denial(), var_cmp(), and yyparse().

193 {
194  if (c == NULL || c == FAKE_CELL)
195  return;
196  if (--c->ref_count < 0)
197  free_tree (c);
198 }
#define FAKE_CELL
Definition: nasl_tree.h:119
static void free_tree(tree_cell *c)
Definition: nasl_tree.c:119
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_cell_val()

char* dump_cell_val ( const tree_cell )

Definition at line 245 of file nasl_tree.c.

References CONST_DATA, CONST_INT, CONST_STR, FAKE_CELL, TC::i_val, nasl_type_name(), TC::size, TC::str_val, TC::type, and TC::x.

Referenced by nasl_func_call().

246 {
247  static char txt[80];
248 
249  if (c == NULL)
250  return "NULL";
251  else if (c == FAKE_CELL)
252  return "FAKE";
253  else
254  switch (c->type)
255  {
256  case CONST_INT:
257  snprintf (txt, sizeof (txt), "%ld", c->x.i_val);
258  break;
259  case CONST_STR:
260  case CONST_DATA: /* Beurk (English: Yuck) */
261  if ((unsigned int) c->size >= sizeof (txt) + 2)
262  {
263  snprintf (txt, sizeof (txt), "\"%s", c->x.str_val);
264  strcpy (txt + (sizeof (txt) - 5), "...\"");
265  }
266  else
267  snprintf (txt, sizeof (txt), "\"%s\"", c->x.str_val);
268  break;
269  default:
270  snprintf (txt, sizeof (txt), "???? (%s)", nasl_type_name (c->type));
271  break;
272  }
273  return txt;
274 }
#define FAKE_CELL
Definition: nasl_tree.h:119
const char * nasl_type_name(int t)
Definition: nasl_tree.c:357
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dup_cell()

tree_cell* dup_cell ( const tree_cell )

Definition at line 86 of file nasl_tree.c.

References alloc_tree_cell(), CONST_DATA, CONST_STR, dup_cell(), FAKE_CELL, TC::line_nb, TC::link, TC::size, TC::str_val, TC::type, and TC::x.

Referenced by dup_cell().

87 {
88  tree_cell *r;
89  int i;
90 
91  if (tc == NULL)
92  return NULL;
93  else if (tc == FAKE_CELL)
94  return FAKE_CELL;
95 
96  r = alloc_tree_cell ();
97  r->line_nb = tc->line_nb;
98  r->type = tc->type;
99  r->size = tc->size;
100 
101  switch (tc->type)
102  {
103  case CONST_STR:
104  case CONST_DATA:
105  r->x.str_val = g_malloc0 (tc->size + 1);
106  memcpy (r->x.str_val, tc->x.str_val, tc->size);
107  break;
108  default:
109  r->x = tc->x;
110  break;
111  }
112 
113  for (i = 0; i < 4; i++)
114  r->link[i] = dup_cell (tc->link[i]);
115  return r;
116 }
#define FAKE_CELL
Definition: nasl_tree.h:119
struct TC * link[4]
Definition: nasl_tree.h:116
short type
Definition: nasl_tree.h:106
char * str_val
Definition: nasl_tree.h:112
short line_nb
Definition: nasl_tree.h:107
Definition: nasl_tree.h:104
union TC::@2 x
tree_cell * dup_cell(const tree_cell *tc)
Definition: nasl_tree.c:86
tree_cell * alloc_tree_cell()
Definition: nasl_tree.c:34
int size
Definition: nasl_tree.h:109
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_line_nb()

char* get_line_nb ( const tree_cell )

Definition at line 390 of file nasl_tree.c.

References FAKE_CELL, and TC::line_nb.

Referenced by get_array_elem(), nasl_incr_variable(), and nasl_read_var_ref().

391 {
392  static char txt[32];
393  if (c == NULL || c == FAKE_CELL || c->line_nb <= 0)
394  return "";
395  snprintf (txt, sizeof (txt), " at or near line %d ", c->line_nb);
396  return txt;
397 }
#define FAKE_CELL
Definition: nasl_tree.h:119
Here is the caller graph for this function:

◆ nasl_dump_tree()

void nasl_dump_tree ( const tree_cell )

Definition at line 377 of file nasl_tree.c.

References dump_tree(), and FAKE_CELL.

Referenced by dump_ctxt(), nasl_func_call(), and ref_cell().

378 {
379  printf ("^^^^ %p ^^^^^\n", c);
380  if (c == NULL)
381  puts ("NULL CELL");
382  else if (c == FAKE_CELL)
383  puts ("FAKE CELL");
384  else
385  dump_tree (c, 0, 0);
386  printf ("vvvvvvvvvvvvvvvvvv\n");
387 }
#define FAKE_CELL
Definition: nasl_tree.h:119
static void dump_tree(const tree_cell *c, int n, int idx)
Definition: nasl_tree.c:277
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nasl_is_leaf()

int nasl_is_leaf ( const tree_cell )

Definition at line 400 of file nasl_tree.c.

References CONST_DATA, CONST_INT, CONST_STR, DYN_ARRAY, FAKE_CELL, REF_ARRAY, and TC::type.

Referenced by nasl_func_call().

401 {
402  if (pc == NULL || pc == FAKE_CELL)
403  return 1;
404  switch (pc->type)
405  {
406  case CONST_INT:
407  case CONST_STR:
408  case CONST_DATA:
409  case REF_ARRAY:
410  case DYN_ARRAY:
411  return 1;
412  default:
413  return 0;
414  }
415  /*NOTREACHED*/}
#define FAKE_CELL
Definition: nasl_tree.h:119
Here is the caller graph for this function:

◆ nasl_type_name()

const char* nasl_type_name ( int  )

Definition at line 357 of file nasl_tree.c.

References node_names.

Referenced by cell_cmp(), dump_cell_val(), make_array_from_elems(), and nasl_affect().

358 {
359  static char txt4[4][32]; /* This function may be called 4 times in the same
360  expression */
361  static int i = 0;
362  char *txt;
363 
364  if (i >= 4)
365  i = 0;
366  txt = txt4[i];
367 
368  if (t >= 0 && (unsigned int) t < sizeof (node_names) / sizeof (node_names[0]))
369  snprintf (txt, 32, "%s (%d)", node_names[t], t);
370  else
371  snprintf (txt, 32, "*UNKNOWN* (%d)", t);
372  i++;
373  return txt;
374 }
static char * node_names[]
Definition: nasl_tree.c:202
Here is the caller graph for this function:

◆ ref_cell()

void ref_cell ( tree_cell )

Definition at line 178 of file nasl_tree.c.

References FAKE_CELL, nasl_dump_tree(), nasl_perror(), and TC::ref_count.

Referenced by cell2atom(), insert_nasl_func(), nasl_do_exit(), nasl_exec(), nasl_func_call(), nasl_return(), and yyparse().

179 {
180  if (c == NULL || c == FAKE_CELL)
181  return;
182  c->ref_count++;
183  if (c->ref_count < 0)
184  {
185  nasl_perror (NULL, "ref_cell: ref count is negative!\n");
186  nasl_dump_tree (c);
187  abort ();
188  }
189 }
#define FAKE_CELL
Definition: nasl_tree.h:119
void nasl_dump_tree(const tree_cell *c)
Definition: nasl_tree.c:377
void nasl_perror(lex_ctxt *lexic, char *msg,...)
Definition: nasl_debug.c:120
Here is the call graph for this function:
Here is the caller graph for this function: