OpenVAS Libraries  9.0.1
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
nasl_grammar.tab.c File Reference
#include <ctype.h>
#include <pcap.h>
#include <string.h>
#include <sys/stat.h>
#include "nasl_tree.h"
#include "nasl_global_ctxt.h"
#include "nasl_func.h"
#include "nasl_var.h"
#include "nasl_lex_ctxt.h"
#include "nasl_debug.h"
#include "nasl_signature.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include "../misc/openvas_logging.h"
#include "../base/openvas_file.h"
#include <gcrypt.h>

Data Structures

union  YYSTYPE
 
struct  YYSTYPE::asciiz
 
union  yyalloc
 

Macros

#define YYBISON   1
 
#define YYBISON_VERSION   "3.0.4"
 
#define YYSKELETON_NAME   "yacc.c"
 
#define YYPURE   1
 
#define YYPUSH   0
 
#define YYPULL   1
 
#define yyparse   naslparse
 
#define yylex   nasllex
 
#define yyerror   naslerror
 
#define yydebug   nasldebug
 
#define yynerrs   naslnerrs
 
#define YYPARSE_PARAM   parm
 
#define YYLEX_PARAM   parm
 
#define LNB   (((naslctxt*)parm)->line_nb)
 
#define YYERROR_VERBOSE
 
#define YY_NULLPTR   0
 
#define YYERROR_VERBOSE   1
 
#define YY_NASL_NASL_GRAMMAR_TAB_H_INCLUDED
 
#define YYDEBUG   1
 
#define YYTOKENTYPE
 
#define YYSTYPE_IS_TRIVIAL   1
 
#define YYSTYPE_IS_DECLARED   1
 
#define YYSIZE_T   size_t
 
#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)
 
#define YY_(Msgid)   Msgid
 
#define YY_ATTRIBUTE(Spec)   /* empty */
 
#define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
 
#define YY_ATTRIBUTE_UNUSED   YY_ATTRIBUTE ((__unused__))
 
#define _Noreturn   YY_ATTRIBUTE ((__noreturn__))
 
#define YYUSE(E)   ((void) (E))
 
#define YY_INITIAL_VALUE(Value)   Value
 
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
 
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
 
#define YYSTACK_ALLOC   YYMALLOC
 
#define YYSTACK_FREE   YYFREE
 
#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM
 
#define YYMALLOC   malloc
 
#define YYFREE   free
 
#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)
 
#define YYSTACK_BYTES(N)
 
#define YYCOPY_NEEDED   1
 
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
 
#define YYCOPY(Dst, Src, Count)
 
#define YYFINAL   78
 
#define YYLAST   1029
 
#define YYNTOKENS   73
 
#define YYNNTS   43
 
#define YYNRULES   126
 
#define YYNSTATES   227
 
#define YYUNDEFTOK   2
 
#define YYMAXUTOK   304
 
#define YYTRANSLATE(YYX)   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
#define YYPACT_NINF   -91
 
#define yypact_value_is_default(Yystate)   (!!((Yystate) == (-91)))
 
#define YYTABLE_NINF   -69
 
#define yytable_value_is_error(Yytable_value)   (!!((Yytable_value) == (-69)))
 
#define yyerrok   (yyerrstatus = 0)
 
#define yyclearin   (yychar = YYEMPTY)
 
#define YYEMPTY   (-2)
 
#define YYEOF   0
 
#define YYACCEPT   goto yyacceptlab
 
#define YYABORT   goto yyabortlab
 
#define YYERROR   goto yyerrorlab
 
#define YYRECOVERING()   (!!yyerrstatus)
 
#define YYBACKUP(Token, Value)
 
#define YYTERROR   1
 
#define YYERRCODE   256
 
#define YYFPRINTF   fprintf
 
#define YYDPRINTF(Args)
 
#define YY_LOCATION_PRINT(File, Loc)   ((void) 0)
 
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
 
#define YY_STACK_PRINT(Bottom, Top)
 
#define YY_REDUCE_PRINT(Rule)
 
#define YYINITDEPTH   200
 
#define YYMAXDEPTH   10000
 
#define YYCASE_(N, S)
 
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
#define YYSYNTAX_ERROR
 

Typedefs

typedef union YYSTYPE YYSTYPE
 
typedef unsigned char yytype_uint8
 
typedef signed char yytype_int8
 
typedef unsigned short int yytype_uint16
 
typedef short int yytype_int16
 

Enumerations

enum  yytokentype {
  IF = 258, ELSE = 259, EQ = 260, NEQ = 261,
  SUPEQ = 262, INFEQ = 263, OR = 264, AND = 265,
  MATCH = 266, NOMATCH = 267, REP = 268, FOR = 269,
  REPEAT = 270, UNTIL = 271, FOREACH = 272, WHILE = 273,
  BREAK = 274, CONTINUE = 275, FUNCTION = 276, RETURN = 277,
  INCLUDE = 278, LOCAL = 279, GLOBAL = 280, PLUS_PLUS = 281,
  MINUS_MINUS = 282, L_SHIFT = 283, R_SHIFT = 284, R_USHIFT = 285,
  EXPO = 286, PLUS_EQ = 287, MINUS_EQ = 288, MULT_EQ = 289,
  DIV_EQ = 290, MODULO_EQ = 291, L_SHIFT_EQ = 292, R_SHIFT_EQ = 293,
  R_USHIFT_EQ = 294, RE_MATCH = 295, RE_NOMATCH = 296, ARROW = 297,
  IDENT = 298, STRING1 = 299, STRING2 = 300, INTEGER = 301,
  NOT = 302, UMINUS = 303, BIT_NOT = 304, IF = 258,
  ELSE = 259, EQ = 260, NEQ = 261, SUPEQ = 262,
  INFEQ = 263, OR = 264, AND = 265, MATCH = 266,
  NOMATCH = 267, REP = 268, FOR = 269, REPEAT = 270,
  UNTIL = 271, FOREACH = 272, WHILE = 273, BREAK = 274,
  CONTINUE = 275, FUNCTION = 276, RETURN = 277, INCLUDE = 278,
  LOCAL = 279, GLOBAL = 280, PLUS_PLUS = 281, MINUS_MINUS = 282,
  L_SHIFT = 283, R_SHIFT = 284, R_USHIFT = 285, EXPO = 286,
  PLUS_EQ = 287, MINUS_EQ = 288, MULT_EQ = 289, DIV_EQ = 290,
  MODULO_EQ = 291, L_SHIFT_EQ = 292, R_SHIFT_EQ = 293, R_USHIFT_EQ = 294,
  RE_MATCH = 295, RE_NOMATCH = 296, ARROW = 297, IDENT = 298,
  STRING1 = 299, STRING2 = 300, INTEGER = 301, NOT = 302,
  UMINUS = 303, BIT_NOT = 304
}
 
enum  lex_state {
  ST_START = 0, ST_SPACE, ST_IDENT, ST_ZERO,
  ST_ZEROX, ST_OCT, ST_DEC, ST_HEX,
  ST_COMMENT, ST_SUP, ST_INF, ST_SUP_EXCL,
  ST_STRING1, ST_STRING1_ESC, ST_STRING2, ST_PLUS,
  ST_MINUS, ST_MULT, ST_DIV, ST_MODULO,
  ST_R_SHIFT, ST_R_USHIFT, ST_L_SHIFT, ST_NOT,
  ST_EQ, ST_AND, ST_OR
}
 

Functions

int naslparse (naslctxt *parm)
 
void * malloc (YYSIZE_T)
 
void free (void *)
 
int yyparse (naslctxt *parm)
 
int add_nasl_inc_dir (const char *dir)
 Adds the given string as directory for searching for includes. More...
 
int init_nasl_ctx (naslctxt *pc, const char *name)
 Initialize a NASL context for a NASL file. More...
 
void nasl_clean_ctx (naslctxt *c)
 

Variables

int nasldebug
 
int yydebug
 

Macro Definition Documentation

◆ _Noreturn

#define _Noreturn   YY_ATTRIBUTE ((__noreturn__))

◆ LNB

#define LNB   (((naslctxt*)parm)->line_nb)

◆ YY_

#define YY_ (   Msgid)    Msgid

◆ YY_ATTRIBUTE

#define YY_ATTRIBUTE (   Spec)    /* empty */

◆ YY_ATTRIBUTE_PURE

#define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))

◆ YY_ATTRIBUTE_UNUSED

#define YY_ATTRIBUTE_UNUSED   YY_ATTRIBUTE ((__unused__))

◆ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN

#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN

◆ YY_IGNORE_MAYBE_UNINITIALIZED_END

#define YY_IGNORE_MAYBE_UNINITIALIZED_END

◆ YY_INITIAL_VALUE

#define YY_INITIAL_VALUE (   Value)    Value

◆ YY_LOCATION_PRINT

#define YY_LOCATION_PRINT (   File,
  Loc 
)    ((void) 0)

◆ YY_NASL_NASL_GRAMMAR_TAB_H_INCLUDED

#define YY_NASL_NASL_GRAMMAR_TAB_H_INCLUDED

◆ YY_NULLPTR

#define YY_NULLPTR   0

◆ YY_REDUCE_PRINT

#define YY_REDUCE_PRINT (   Rule)
Value:
do { \
if (yydebug) \
yy_reduce_print (yyssp, yyvsp, Rule, parm); \
} while (0)
#define yydebug
Definition: nasl_grammar.tab.c:66

◆ YY_STACK_PRINT

#define YY_STACK_PRINT (   Bottom,
  Top 
)
Value:
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (0)
#define yydebug
Definition: nasl_grammar.tab.c:66

◆ YY_SYMBOL_PRINT

#define YY_SYMBOL_PRINT (   Title,
  Type,
  Value,
  Location 
)
Value:
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
Type, Value, parm); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
#define yydebug
Definition: nasl_grammar.tab.c:66

◆ YYABORT

#define YYABORT   goto yyabortlab

◆ YYACCEPT

#define YYACCEPT   goto yyacceptlab

◆ YYBACKUP

#define YYBACKUP (   Token,
  Value 
)
Value:
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (parm, YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
#define YY_(Msgid)
Definition: nasl_grammar.tab.c:284
#define YYEMPTY
Definition: nasl_grammar.tab.c:965

◆ YYBISON

#define YYBISON   1

◆ YYBISON_VERSION

#define YYBISON_VERSION   "3.0.4"

◆ YYCASE_

#define YYCASE_ (   N,
 
)
Value:
case N: \
yyformat = S; \
break

◆ yyclearin

#define yyclearin   (yychar = YYEMPTY)

◆ YYCOPY

#define YYCOPY (   Dst,
  Src,
  Count 
)
Value:
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)

◆ YYCOPY_NEEDED

#define YYCOPY_NEEDED   1

◆ yydebug

#define yydebug   nasldebug

◆ YYDEBUG

#define YYDEBUG   1

◆ YYDPRINTF

#define YYDPRINTF (   Args)
Value:
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
#define yydebug
Definition: nasl_grammar.tab.c:66

◆ YYEMPTY

#define YYEMPTY   (-2)

◆ YYEOF

#define YYEOF   0

◆ YYERRCODE

#define YYERRCODE   256

◆ yyerrok

#define yyerrok   (yyerrstatus = 0)

◆ yyerror

#define yyerror   naslerror

◆ YYERROR

#define YYERROR   goto yyerrorlab

◆ YYERROR_VERBOSE [1/2]

#define YYERROR_VERBOSE

◆ YYERROR_VERBOSE [2/2]

#define YYERROR_VERBOSE   1

◆ YYFINAL

#define YYFINAL   78

◆ YYFPRINTF

#define YYFPRINTF   fprintf

◆ YYFREE

#define YYFREE   free

◆ YYINITDEPTH

#define YYINITDEPTH   200

◆ YYLAST

#define YYLAST   1029

◆ yylex

#define yylex   nasllex

◆ YYLEX_PARAM

#define YYLEX_PARAM   parm

◆ YYMALLOC

#define YYMALLOC   malloc

◆ YYMAXDEPTH

#define YYMAXDEPTH   10000

◆ YYMAXUTOK

#define YYMAXUTOK   304

◆ yynerrs

#define yynerrs   naslnerrs

◆ YYNNTS

#define YYNNTS   43

◆ YYNRULES

#define YYNRULES   126

◆ YYNSTATES

#define YYNSTATES   227

◆ YYNTOKENS

#define YYNTOKENS   73

◆ YYPACT_NINF

#define YYPACT_NINF   -91

◆ yypact_value_is_default

#define yypact_value_is_default (   Yystate)    (!!((Yystate) == (-91)))

◆ yyparse

#define yyparse   naslparse

◆ YYPARSE_PARAM

#define YYPARSE_PARAM   parm

◆ YYPOPSTACK

#define YYPOPSTACK (   N)    (yyvsp -= (N), yyssp -= (N))

◆ YYPULL

#define YYPULL   1

◆ YYPURE

#define YYPURE   1

◆ YYPUSH

#define YYPUSH   0

◆ YYRECOVERING

#define YYRECOVERING ( )    (!!yyerrstatus)

◆ YYSIZE_MAXIMUM

#define YYSIZE_MAXIMUM   ((YYSIZE_T) -1)

◆ YYSIZE_T

#define YYSIZE_T   size_t

◆ YYSKELETON_NAME

#define YYSKELETON_NAME   "yacc.c"

◆ YYSTACK_ALLOC

#define YYSTACK_ALLOC   YYMALLOC

◆ YYSTACK_ALLOC_MAXIMUM

#define YYSTACK_ALLOC_MAXIMUM   YYSIZE_MAXIMUM

◆ YYSTACK_BYTES

#define YYSTACK_BYTES (   N)
Value:
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
short int yytype_int16
Definition: nasl_grammar.tab.c:258
union YYSTYPE YYSTYPE
Definition: nasl_grammar.tab.c:215
#define YYSTACK_GAP_MAXIMUM
Definition: nasl_grammar.tab.c:422

◆ YYSTACK_FREE

#define YYSTACK_FREE   YYFREE

◆ YYSTACK_GAP_MAXIMUM

#define YYSTACK_GAP_MAXIMUM   (sizeof (union yyalloc) - 1)

◆ YYSTACK_RELOCATE

#define YYSTACK_RELOCATE (   Stack_alloc,
  Stack 
)
Value:
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#define YYSTACK_GAP_MAXIMUM
Definition: nasl_grammar.tab.c:422

◆ YYSTYPE_IS_DECLARED

#define YYSTYPE_IS_DECLARED   1

◆ YYSTYPE_IS_TRIVIAL

#define YYSTYPE_IS_TRIVIAL   1

◆ YYSYNTAX_ERROR

#define YYSYNTAX_ERROR
Value:
yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)

◆ YYTABLE_NINF

#define YYTABLE_NINF   -69

◆ yytable_value_is_error

#define yytable_value_is_error (   Yytable_value)    (!!((Yytable_value) == (-69)))

◆ YYTERROR

#define YYTERROR   1

◆ YYTOKENTYPE

#define YYTOKENTYPE

◆ YYTRANSLATE

#define YYTRANSLATE (   YYX)    ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

◆ YYUNDEFTOK

#define YYUNDEFTOK   2

◆ YYUSE

#define YYUSE (   E)    ((void) (E))

Typedef Documentation

◆ YYSTYPE

typedef union YYSTYPE YYSTYPE

◆ yytype_int16

typedef short int yytype_int16

◆ yytype_int8

typedef signed char yytype_int8

◆ yytype_uint16

typedef unsigned short int yytype_uint16

◆ yytype_uint8

typedef unsigned char yytype_uint8

Enumeration Type Documentation

◆ lex_state

enum lex_state
Enumerator
ST_START 
ST_SPACE 
ST_IDENT 
ST_ZERO 
ST_ZEROX 
ST_OCT 
ST_DEC 
ST_HEX 
ST_COMMENT 
ST_SUP 
ST_INF 
ST_SUP_EXCL 
ST_STRING1 
ST_STRING1_ESC 
ST_STRING2 
ST_PLUS 
ST_MINUS 
ST_MULT 
ST_DIV 
ST_MODULO 
ST_R_SHIFT 
ST_R_USHIFT 
ST_L_SHIFT 
ST_NOT 
ST_EQ 
ST_AND 
ST_OR 

◆ yytokentype

Enumerator
IF 
ELSE 
EQ 
NEQ 
SUPEQ 
INFEQ 
OR 
AND 
MATCH 
NOMATCH 
REP 
FOR 
REPEAT 
UNTIL 
FOREACH 
WHILE 
BREAK 
CONTINUE 
FUNCTION 
RETURN 
INCLUDE 
LOCAL 
GLOBAL 
PLUS_PLUS 
MINUS_MINUS 
L_SHIFT 
R_SHIFT 
R_USHIFT 
EXPO 
PLUS_EQ 
MINUS_EQ 
MULT_EQ 
DIV_EQ 
MODULO_EQ 
L_SHIFT_EQ 
R_SHIFT_EQ 
R_USHIFT_EQ 
RE_MATCH 
RE_NOMATCH 
ARROW 
IDENT 
STRING1 
STRING2 
INTEGER 
NOT 
UMINUS 
BIT_NOT 
IF 
ELSE 
EQ 
NEQ 
SUPEQ 
INFEQ 
OR 
AND 
MATCH 
NOMATCH 
REP 
FOR 
REPEAT 
UNTIL 
FOREACH 
WHILE 
BREAK 
CONTINUE 
FUNCTION 
RETURN 
INCLUDE 
LOCAL 
GLOBAL 
PLUS_PLUS 
MINUS_MINUS 
L_SHIFT 
R_SHIFT 
R_USHIFT 
EXPO 
PLUS_EQ 
MINUS_EQ 
MULT_EQ 
DIV_EQ 
MODULO_EQ 
L_SHIFT_EQ 
R_SHIFT_EQ 
R_USHIFT_EQ 
RE_MATCH 
RE_NOMATCH 
ARROW 
IDENT 
STRING1 
STRING2 
INTEGER 
NOT 
UMINUS 
BIT_NOT 

Function Documentation

◆ add_nasl_inc_dir()

int add_nasl_inc_dir ( const char *  dir)

Adds the given string as directory for searching for includes.

Parameters
dirA directory path. This function will add a copy of this parameter to the list of include folders. This means the parameter can be freed elsewhere without affecting the list.
Returns
0 in case of success. -1 if the stat on the given directory path was unsuccessful. -2 if the given directory path was not a directory.

◆ free()

void free ( void *  )

◆ init_nasl_ctx()

int init_nasl_ctx ( naslctxt pc,
const char *  name 
)

Initialize a NASL context for a NASL file.

Parameters
pcThe NASL context handler.
nameThe filename of the NASL script.
Returns
0 in case of success. Then, pc->fp is set with the respective file descriptor -1 if either the filename was not found/accessible or the signature verification failed (provided signature checking is enabled. Also, the pc->fp is set to NULL. In any case, various elements of pc are modified (initialized);

◆ malloc()

void* malloc ( YYSIZE_T  )

◆ nasl_clean_ctx()

void nasl_clean_ctx ( naslctxt c)

◆ naslparse()

int naslparse ( naslctxt parm)

◆ yyparse()

int yyparse ( naslctxt parm)

Variable Documentation

◆ nasldebug

int nasldebug

◆ yydebug

int yydebug