source: rtems-libbsd/ipsec-tools/src/libipsec/policy_token.c

6-freebsd-12
Last change on this file was b376ae1, checked in by Christian Mauderer <christian.mauderer@…>, on 05/03/18 at 12:15:11

ipsec-tools: Port libipsec, setkey and racoon.

Note that this replaces the libipsec from FreeBSD with the one provided
by ipsec-tools.

  • Property mode set to 100644
File size: 57.3 KB
Line 
1
2#line 3 "<stdout>"
3
4#define  YY_INT_ALIGNED short int
5
6/* A lexical scanner generated by flex */
7
8#define yy_create_buffer __libipsec_create_buffer
9#define yy_delete_buffer __libipsec_delete_buffer
10#define yy_flex_debug __libipsec_flex_debug
11#define yy_init_buffer __libipsec_init_buffer
12#define yy_flush_buffer __libipsec_flush_buffer
13#define yy_load_buffer_state __libipsec_load_buffer_state
14#define yy_switch_to_buffer __libipsec_switch_to_buffer
15#define yyin __libipsecin
16#define yyleng __libipsecleng
17#define yylex __libipseclex
18#define yylineno __libipseclineno
19#define yyout __libipsecout
20#define yyrestart __libipsecrestart
21#define yytext __libipsectext
22#define yywrap __libipsecwrap
23#define yyalloc __libipsecalloc
24#define yyrealloc __libipsecrealloc
25#define yyfree __libipsecfree
26
27#define FLEX_SCANNER
28#define YY_FLEX_MAJOR_VERSION 2
29#define YY_FLEX_MINOR_VERSION 5
30#define YY_FLEX_SUBMINOR_VERSION 37
31#if YY_FLEX_SUBMINOR_VERSION > 0
32#define FLEX_BETA
33#endif
34
35/* First, we deal with  platform-specific or compiler-specific issues. */
36
37#if defined(__FreeBSD__)
38#ifndef __STDC_LIMIT_MACROS
39#define __STDC_LIMIT_MACROS
40#endif
41#include <sys/cdefs.h>
42#include <stdint.h>
43#else
44#define __dead2
45#endif
46
47/* begin standard C headers. */
48#include <stdio.h>
49#include <string.h>
50#include <errno.h>
51#include <stdlib.h>
52
53/* end standard C headers. */
54
55/* flex integer type definitions */
56
57#ifndef FLEXINT_H
58#define FLEXINT_H
59
60/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
61
62#if defined(__FreeBSD__) || \
63    (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
64
65/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
66 * if you want the limit (max/min) macros for int types.
67 */
68#ifndef __STDC_LIMIT_MACROS
69#define __STDC_LIMIT_MACROS 1
70#endif
71
72#include <inttypes.h>
73typedef int8_t flex_int8_t;
74typedef uint8_t flex_uint8_t;
75typedef int16_t flex_int16_t;
76typedef uint16_t flex_uint16_t;
77typedef int32_t flex_int32_t;
78typedef uint32_t flex_uint32_t;
79#else
80typedef signed char flex_int8_t;
81typedef short int flex_int16_t;
82typedef int flex_int32_t;
83typedef unsigned char flex_uint8_t;
84typedef unsigned short int flex_uint16_t;
85typedef unsigned int flex_uint32_t;
86
87/* Limits of integral types. */
88#ifndef INT8_MIN
89#define INT8_MIN               (-128)
90#endif
91#ifndef INT16_MIN
92#define INT16_MIN              (-32767-1)
93#endif
94#ifndef INT32_MIN
95#define INT32_MIN              (-2147483647-1)
96#endif
97#ifndef INT8_MAX
98#define INT8_MAX               (127)
99#endif
100#ifndef INT16_MAX
101#define INT16_MAX              (32767)
102#endif
103#ifndef INT32_MAX
104#define INT32_MAX              (2147483647)
105#endif
106#ifndef UINT8_MAX
107#define UINT8_MAX              (255U)
108#endif
109#ifndef UINT16_MAX
110#define UINT16_MAX             (65535U)
111#endif
112#ifndef UINT32_MAX
113#define UINT32_MAX             (4294967295U)
114#endif
115
116#endif /* ! C99 */
117
118#endif /* ! FLEXINT_H */
119
120#ifdef __cplusplus
121
122/* The "const" storage-class-modifier is valid. */
123#define YY_USE_CONST
124
125#else   /* ! __cplusplus */
126
127/* C99 requires __STDC__ to be defined as 1. */
128#if defined (__STDC__)
129
130#define YY_USE_CONST
131
132#endif  /* defined (__STDC__) */
133#endif  /* ! __cplusplus */
134
135#ifdef YY_USE_CONST
136#define yyconst const
137#else
138#define yyconst
139#endif
140
141/* Returned upon end-of-file. */
142#define YY_NULL 0
143
144/* Promotes a possibly negative, possibly signed char to an unsigned
145 * integer for use as an array index.  If the signed char is negative,
146 * we want to instead treat it as an 8-bit unsigned char, hence the
147 * double cast.
148 */
149#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
150
151/* Enter a start condition.  This macro really ought to take a parameter,
152 * but we do it the disgusting crufty way forced on us by the ()-less
153 * definition of BEGIN.
154 */
155#define BEGIN (yy_start) = 1 + 2 *
156
157/* Translate the current start state into a value that can be later handed
158 * to BEGIN to return to the state.  The YYSTATE alias is for lex
159 * compatibility.
160 */
161#define YY_START (((yy_start) - 1) / 2)
162#define YYSTATE YY_START
163
164/* Action number for EOF rule of a given start state. */
165#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
166
167/* Special action meaning "start processing a new file". */
168#define YY_NEW_FILE __libipsecrestart(__libipsecin  )
169
170#define YY_END_OF_BUFFER_CHAR 0
171
172/* Size of default input buffer. */
173#ifndef YY_BUF_SIZE
174#define YY_BUF_SIZE 1024
175#endif
176
177/* The state buf must be large enough to hold one state per character in the main buffer.
178 */
179#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
180
181#ifndef YY_TYPEDEF_YY_BUFFER_STATE
182#define YY_TYPEDEF_YY_BUFFER_STATE
183typedef struct yy_buffer_state *YY_BUFFER_STATE;
184#endif
185
186#ifndef YY_TYPEDEF_YY_SIZE_T
187#define YY_TYPEDEF_YY_SIZE_T
188typedef size_t yy_size_t;
189#endif
190
191extern yy_size_t __libipsecleng;
192
193extern FILE *__libipsecin, *__libipsecout;
194
195#define EOB_ACT_CONTINUE_SCAN 0
196#define EOB_ACT_END_OF_FILE 1
197#define EOB_ACT_LAST_MATCH 2
198
199    #define YY_LESS_LINENO(n)
200   
201/* Return all but the first "n" matched characters back to the input stream. */
202#define yyless(n) \
203        do \
204                { \
205                /* Undo effects of setting up __libipsectext. */ \
206        int yyless_macro_arg = (n); \
207        YY_LESS_LINENO(yyless_macro_arg);\
208                *yy_cp = (yy_hold_char); \
209                YY_RESTORE_YY_MORE_OFFSET \
210                (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
211                YY_DO_BEFORE_ACTION; /* set up __libipsectext again */ \
212                } \
213        while ( 0 )
214
215#define unput(c) yyunput( c, (yytext_ptr)  )
216
217#ifndef YY_STRUCT_YY_BUFFER_STATE
218#define YY_STRUCT_YY_BUFFER_STATE
219struct yy_buffer_state
220        {
221        FILE *yy_input_file;
222
223        char *yy_ch_buf;                /* input buffer */
224        char *yy_buf_pos;               /* current position in input buffer */
225
226        /* Size of input buffer in bytes, not including room for EOB
227         * characters.
228         */
229        yy_size_t yy_buf_size;
230
231        /* Number of characters read into yy_ch_buf, not including EOB
232         * characters.
233         */
234        yy_size_t yy_n_chars;
235
236        /* Whether we "own" the buffer - i.e., we know we created it,
237         * and can realloc() it to grow it, and should free() it to
238         * delete it.
239         */
240        int yy_is_our_buffer;
241
242        /* Whether this is an "interactive" input source; if so, and
243         * if we're using stdio for input, then we want to use getc()
244         * instead of fread(), to make sure we stop fetching input after
245         * each newline.
246         */
247        int yy_is_interactive;
248
249        /* Whether we're considered to be at the beginning of a line.
250         * If so, '^' rules will be active on the next match, otherwise
251         * not.
252         */
253        int yy_at_bol;
254
255    int yy_bs_lineno; /**< The line count. */
256    int yy_bs_column; /**< The column count. */
257   
258        /* Whether to try to fill the input buffer when we reach the
259         * end of it.
260         */
261        int yy_fill_buffer;
262
263        int yy_buffer_status;
264
265#define YY_BUFFER_NEW 0
266#define YY_BUFFER_NORMAL 1
267        /* When an EOF's been seen but there's still some text to process
268         * then we mark the buffer as YY_EOF_PENDING, to indicate that we
269         * shouldn't try reading from the input source any more.  We might
270         * still have a bunch of tokens to match, though, because of
271         * possible backing-up.
272         *
273         * When we actually see the EOF, we change the status to "new"
274         * (via __libipsecrestart()), so that the user can continue scanning by
275         * just pointing __libipsecin at a new input file.
276         */
277#define YY_BUFFER_EOF_PENDING 2
278
279        };
280#endif /* !YY_STRUCT_YY_BUFFER_STATE */
281
282/* Stack of input buffers. */
283static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
284static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
285static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
286
287/* We provide macros for accessing buffer states in case in the
288 * future we want to put the buffer states in a more general
289 * "scanner state".
290 *
291 * Returns the top of the stack, or NULL.
292 */
293#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
294                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
295                          : NULL)
296#define yy_current_buffer YY_CURRENT_BUFFER
297
298/* Same as previous macro, but useful when we know that the buffer stack is not
299 * NULL or when we need an lvalue. For internal use only.
300 */
301#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
302
303/* yy_hold_char holds the character lost when __libipsectext is formed. */
304static char yy_hold_char;
305static yy_size_t yy_n_chars;            /* number of characters read into yy_ch_buf */
306yy_size_t __libipsecleng;
307
308/* Points to current character in buffer. */
309static char *yy_c_buf_p = (char *) 0;
310static int yy_init = 0;         /* whether we need to initialize */
311static int yy_start = 0;        /* start state number */
312
313/* Flag which is used to allow __libipsecwrap()'s to do buffer switches
314 * instead of setting up a fresh __libipsecin.  A bit of a hack ...
315 */
316static int yy_did_buffer_switch_on_eof;
317
318void __libipsecrestart (FILE *input_file  );
319void __libipsec_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
320YY_BUFFER_STATE __libipsec_create_buffer (FILE *file,int size  );
321void __libipsec_delete_buffer (YY_BUFFER_STATE b  );
322void __libipsec_flush_buffer (YY_BUFFER_STATE b  );
323void __libipsecpush_buffer_state (YY_BUFFER_STATE new_buffer  );
324void __libipsecpop_buffer_state (void );
325
326static void __libipsecensure_buffer_stack (void );
327static void __libipsec_load_buffer_state (void );
328static void __libipsec_init_buffer (YY_BUFFER_STATE b,FILE *file  );
329
330#define YY_FLUSH_BUFFER __libipsec_flush_buffer(YY_CURRENT_BUFFER )
331
332YY_BUFFER_STATE __libipsec_scan_buffer (char *base,yy_size_t size  );
333YY_BUFFER_STATE __libipsec_scan_string (yyconst char *yy_str  );
334YY_BUFFER_STATE __libipsec_scan_bytes (yyconst char *bytes,yy_size_t len  );
335
336void *__libipsecalloc (yy_size_t  );
337void *__libipsecrealloc (void *,yy_size_t  );
338void __libipsecfree (void *  );
339
340#define yy_new_buffer __libipsec_create_buffer
341
342#define yy_set_interactive(is_interactive) \
343        { \
344        if ( ! YY_CURRENT_BUFFER ){ \
345        __libipsecensure_buffer_stack (); \
346                YY_CURRENT_BUFFER_LVALUE =    \
347            __libipsec_create_buffer(__libipsecin,YY_BUF_SIZE ); \
348        } \
349        YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
350        }
351
352#define yy_set_bol(at_bol) \
353        { \
354        if ( ! YY_CURRENT_BUFFER ){\
355        __libipsecensure_buffer_stack (); \
356                YY_CURRENT_BUFFER_LVALUE =    \
357            __libipsec_create_buffer(__libipsecin,YY_BUF_SIZE ); \
358        } \
359        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
360        }
361
362#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
363
364/* Begin user sect3 */
365
366#define __libipsecwrap() 1
367#define YY_SKIP_YYWRAP
368
369typedef unsigned char YY_CHAR;
370
371FILE *__libipsecin = (FILE *) 0, *__libipsecout = (FILE *) 0;
372
373typedef int yy_state_type;
374
375extern int __libipseclineno;
376
377int __libipseclineno = 1;
378
379extern char *__libipsectext;
380#define yytext_ptr __libipsectext
381
382static yy_state_type yy_get_previous_state (void );
383static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
384static int yy_get_next_buffer (void );
385static void yy_fatal_error (yyconst char msg[]  ) __dead2;
386
387/* Done after the current pattern has been matched and before the
388 * corresponding action - sets up __libipsectext.
389 */
390#define YY_DO_BEFORE_ACTION \
391        (yytext_ptr) = yy_bp; \
392        __libipsecleng = (size_t) (yy_cp - yy_bp); \
393        (yy_hold_char) = *yy_cp; \
394        *yy_cp = '\0'; \
395        (yy_c_buf_p) = yy_cp;
396
397#define YY_NUM_RULES 34
398#define YY_END_OF_BUFFER 35
399/* This struct is not used in this scanner,
400   but its presence is necessary. */
401struct yy_trans_info
402        {
403        flex_int32_t yy_verify;
404        flex_int32_t yy_nxt;
405        };
406static yyconst flex_int16_t yy_accept[121] =
407    {   0,
408        0,    0,   35,   34,   32,   33,    9,   30,   29,   28,
409       10,   34,   29,   29,   29,   29,   29,   29,   29,   29,
410       29,   29,   29,   29,   29,   29,   29,   32,    0,   29,
411       10,    0,   17,   29,   29,   29,   29,   29,   29,   29,
412       29,    1,   29,   29,   21,   29,   29,   29,   29,   29,
413       29,   29,   29,   29,   31,   22,   29,    7,   29,   29,
414       16,    3,   29,   29,   29,    6,   29,    2,   29,   29,
415       29,   29,   29,   24,   29,   29,   29,   29,    8,   29,
416       29,   12,    5,   29,   29,   29,   29,   29,   29,   29,
417       29,   29,   13,   29,   29,   29,   29,   29,   14,   29,
418
419       29,   29,   18,   29,   29,   29,   20,   27,   23,   11,
420       15,   29,   25,   29,   29,    4,   29,   26,   19,    0
421    } ;
422
423static yyconst flex_int32_t yy_ec[256] =
424    {   0,
425        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
426        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
427        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
428        1,    2,    1,    1,    1,    1,    4,    1,    1,    1,
429        1,    1,    5,    1,    6,    7,    8,    9,    9,    9,
430        9,    9,    9,    9,    9,    9,    9,   10,    1,    1,
431        1,    1,    1,    1,   11,   11,   11,   11,   11,   11,
432       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
433       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
434       12,    1,   13,    1,    7,    1,   14,   15,   16,   17,
435
436       18,   19,   20,   21,   22,   11,   11,   23,   24,   25,
437       26,   27,   28,   29,   30,   31,   32,   11,   33,   11,
438       34,   11,    1,    1,    1,    1,    1,    1,    1,    1,
439        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
440        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
441        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
442        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
443        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
444        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
445        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
446
447        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
448        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
449        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
450        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
451        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
452        1,    1,    1,    1,    1
453    } ;
454
455static yyconst flex_int32_t yy_meta[35] =
456    {   0,
457        1,    1,    1,    2,    1,    1,    2,    1,    3,    2,
458        3,    1,    1,    3,    3,    3,    3,    3,    3,    3,
459        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
460        3,    3,    3,    3
461    } ;
462
463static yyconst flex_int16_t yy_base[123] =
464    {   0,
465        0,    0,  235,  236,  232,  236,  236,  236,  229,  236,
466       31,  223,   32,   33,   34,   35,   37,   39,   41,   38,
467       40,   43,   42,   44,   45,   46,   47,  229,    0,  226,
468       50,   67,  225,   51,   67,   77,   58,   75,   78,   80,
469       79,  224,   82,   83,  223,   85,   86,   87,   91,   88,
470       89,   96,   97,    0,  236,  222,   99,  107,  104,  100,
471      221,  220,  103,  118,  119,  219,  121,  218,  122,  123,
472      124,  126,  128,  217,  127,  129,  131,  130,  216,  134,
473      136,  215,  137,  132,  138,  142,  139,  143,  146,  149,
474      155,  159,  214,  160,  161,  166,  168,  163,  213,  170,
475
476      171,  172,  212,  173,  176,  179,  211,  185,  206,  204,
477      202,  175,  196,  183,  188,  195,  180,  198,  194,  236,
478      211,  193
479    } ;
480
481static yyconst flex_int16_t yy_def[123] =
482    {   0,
483      120,    1,  120,  120,  120,  120,  120,  120,  121,  120,
484      121,  120,  121,  121,  121,  121,  121,  121,  121,  121,
485      121,  121,  121,  121,  121,  121,  121,  120,  122,  121,
486      121,  120,  121,  121,  121,  121,  121,  121,  121,  121,
487      121,  121,  121,  121,  121,  121,  121,  121,  121,  121,
488      121,  121,  121,  122,  120,  121,  121,  121,  121,  121,
489      121,  121,  121,  121,  121,  121,  121,  121,  121,  121,
490      121,  121,  121,  121,  121,  121,  121,  121,  121,  121,
491      121,  121,  121,  121,  121,  121,  121,  121,  121,  121,
492      121,  121,  121,  121,  121,  121,  121,  121,  121,  121,
493
494      121,  121,  121,  121,  121,  121,  121,  121,  121,  121,
495      121,  121,  121,  121,  121,  121,  121,  121,  121,    0,
496      120,  120
497    } ;
498
499static yyconst flex_int16_t yy_nxt[271] =
500    {   0,
501        4,    5,    6,    4,    7,    8,    9,   10,   11,    9,
502        9,   12,    4,   13,   14,    9,   15,   16,   17,    9,
503       18,   19,   20,   21,   22,   23,   24,    9,   25,    9,
504       26,   27,    9,    9,   29,   29,   29,   29,   29,   31,
505       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
506       29,   36,   33,   29,   29,   37,   34,   45,   31,   38,
507       41,   29,   49,   44,   39,   42,   35,   43,   46,   40,
508       29,   52,   48,   47,   50,   32,   53,   51,   29,   55,
509       29,   29,   29,   29,   56,   29,   29,   59,   29,   29,
510       29,   29,   29,   57,   29,   58,   62,   64,   63,   29,
511
512       29,   71,   29,   29,   61,   60,   29,   29,   69,   67,
513       29,   65,   75,   72,   74,   66,   68,   73,   70,   77,
514       76,   29,   29,   79,   29,   29,   29,   29,   78,   29,
515       29,   29,   29,   29,   29,   29,   81,   29,   82,   29,
516       29,   29,   29,   80,   90,   29,   29,   83,   85,   29,
517       86,   93,   29,   95,   84,   87,   88,   92,   29,   97,
518       89,   91,   29,   29,   29,   94,   29,   96,  100,   29,
519       98,   29,   99,   29,   29,   29,   29,  101,   29,   29,
520      108,  104,   29,   29,  102,  103,   29,  110,   29,  105,
521      107,   29,  106,  113,  115,   54,  118,   29,   29,   29,
522
523      109,   29,  111,  112,  114,   29,  118,   29,  116,   29,
524      119,  117,   30,   30,   29,   29,   29,   29,   29,   29,
525       29,   29,   29,   29,   29,   29,   29,   29,   29,   29,
526       28,   32,   29,   28,  120,    3,  120,  120,  120,  120,
527      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
528      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
529      120,  120,  120,  120,  120,  120,  120,  120,  120,  120
530    } ;
531
532static yyconst flex_int16_t yy_chk[271] =
533    {   0,
534        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
535        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
536        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
537        1,    1,    1,    1,   11,   13,   14,   15,   16,   11,
538       17,   20,   18,   21,   19,   23,   22,   24,   25,   26,
539       27,   15,   13,   31,   34,   15,   13,   21,   31,   16,
540       18,   37,   25,   20,   16,   19,   14,   19,   22,   17,
541       35,   27,   24,   23,   26,   32,   27,   26,   38,   32,
542       36,   39,   41,   40,   34,   43,   44,   37,   46,   47,
543       48,   50,   51,   35,   49,   36,   40,   43,   41,   52,
544
545       53,   50,   57,   60,   39,   38,   63,   59,   48,   46,
546       58,   43,   57,   51,   53,   44,   47,   52,   49,   59,
547       58,   64,   65,   63,   67,   69,   70,   71,   60,   72,
548       75,   73,   76,   78,   77,   84,   65,   80,   67,   81,
549       83,   85,   87,   64,   77,   86,   88,   69,   71,   89,
550       72,   81,   90,   84,   70,   73,   75,   80,   91,   86,
551       76,   78,   92,   94,   95,   83,   98,   85,   89,   96,
552       87,   97,   88,  100,  101,  102,  104,   90,  112,  105,
553       98,   94,  106,  117,   91,   92,  114,  101,  108,   95,
554       97,  115,   96,  105,  108,  122,  115,  119,  116,  113,
555
556      100,  118,  102,  104,  106,  111,  118,  110,  112,  109,
557      117,  114,  121,  121,  107,  103,   99,   93,   82,   79,
558       74,   68,   66,   62,   61,   56,   45,   42,   33,   30,
559       28,   12,    9,    5,    3,  120,  120,  120,  120,  120,
560      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
561      120,  120,  120,  120,  120,  120,  120,  120,  120,  120,
562      120,  120,  120,  120,  120,  120,  120,  120,  120,  120
563    } ;
564
565static yy_state_type yy_last_accepting_state;
566static char *yy_last_accepting_cpos;
567
568extern int __libipsec_flex_debug;
569int __libipsec_flex_debug = 0;
570
571/* The intent behind this definition is that it'll catch
572 * any uses of REJECT which flex missed.
573 */
574#define REJECT reject_used_but_not_detected
575#define yymore() yymore_used_but_not_detected
576#define YY_MORE_ADJ 0
577#define YY_RESTORE_YY_MORE_OFFSET
578char *__libipsectext;
579#line 1 "../../ipsec-tools/src/libipsec/policy_token.l"
580/*      $NetBSD: policy_token.l,v 1.7 2007/07/18 12:07:50 vanhu Exp $   */
581/* Id: policy_token.l,v 1.12 2005/05/05 12:32:18 manubsd Exp */
582/*
583 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
584 * All rights reserved.
585 *
586 * Redistribution and use in source and binary forms, with or without
587 * modification, are permitted provided that the following conditions
588 * are met:
589 * 1. Redistributions of source code must retain the above copyright
590 *    notice, this list of conditions and the following disclaimer.
591 * 2. Redistributions in binary form must reproduce the above copyright
592 *    notice, this list of conditions and the following disclaimer in the
593 *    documentation and/or other materials provided with the distribution.
594 * 3. Neither the name of the project nor the names of its contributors
595 *    may be used to endorse or promote products derived from this software
596 *    without specific prior written permission.
597 *
598 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
599 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
600 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
601 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
602 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
603 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
604 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
605 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
606 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
607 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
608 * SUCH DAMAGE.
609 */
610#line 35 "../../ipsec-tools/src/libipsec/policy_token.l"
611#ifdef __rtems__
612#include <machine/rtems-bsd-user-space.h>
613#endif /* __rtems__ */
614#ifdef HAVE_CONFIG_H
615#include "config.h"
616#endif
617
618#include <sys/types.h>
619#include <sys/param.h>
620#include <sys/socket.h>
621#include <net/pfkeyv2.h>
622#include <netinet/in.h>
623#include PATH_IPSEC_H
624
625#include <stdlib.h>
626#include <limits.h>
627#include <string.h>
628#include <unistd.h>
629#include <errno.h>
630
631#include "libpfkey.h"
632
633#if !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__linux__)  && \
634!defined(__APPLE__) && !defined(__MACH__)
635#include "y.tab.h"
636#else
637#include "policy_parse.h"
638#endif
639#define yylval __libipseclval   /* XXX */
640
641int __libipseclex __P((void));
642/* common section */
643#line 644 "<stdout>"
644
645#define INITIAL 0
646
647#ifndef YY_NO_UNISTD_H
648/* Special case for "unistd.h", since it is non-ANSI. We include it way
649 * down here because we want the user's section 1 to have been scanned first.
650 * The user has a chance to override it with an option.
651 */
652#include <unistd.h>
653#endif
654
655#ifndef YY_EXTRA_TYPE
656#define YY_EXTRA_TYPE void *
657#endif
658
659static int yy_init_globals (void );
660
661/* Accessor methods to globals.
662   These are made visible to non-reentrant scanners for convenience. */
663
664int __libipseclex_destroy (void );
665
666int __libipsecget_debug (void );
667
668void __libipsecset_debug (int debug_flag  );
669
670YY_EXTRA_TYPE __libipsecget_extra (void );
671
672void __libipsecset_extra (YY_EXTRA_TYPE user_defined  );
673
674FILE *__libipsecget_in (void );
675
676void __libipsecset_in  (FILE * in_str  );
677
678FILE *__libipsecget_out (void );
679
680void __libipsecset_out  (FILE * out_str  );
681
682yy_size_t __libipsecget_leng (void );
683
684char *__libipsecget_text (void );
685
686int __libipsecget_lineno (void );
687
688void __libipsecset_lineno (int line_number  );
689
690/* Macros after this point can all be overridden by user definitions in
691 * section 1.
692 */
693
694#ifndef YY_SKIP_YYWRAP
695#ifdef __cplusplus
696extern "C" int __libipsecwrap (void );
697#else
698extern int __libipsecwrap (void );
699#endif
700#endif
701
702#ifndef yytext_ptr
703static void yy_flex_strncpy (char *,yyconst char *,int );
704#endif
705
706#ifdef YY_NEED_STRLEN
707static int yy_flex_strlen (yyconst char * );
708#endif
709
710#ifndef YY_NO_INPUT
711
712#ifdef __cplusplus
713static int yyinput (void );
714#else
715static int input (void );
716#endif
717
718#endif
719
720/* Amount of stuff to slurp up with each read. */
721#ifndef YY_READ_BUF_SIZE
722#define YY_READ_BUF_SIZE 8192
723#endif
724
725/* Copy whatever the last rule matched to the standard output. */
726#ifndef ECHO
727/* This used to be an fputs(), but since the string might contain NUL's,
728 * we now use fwrite().
729 */
730#define ECHO do { if (fwrite( __libipsectext, __libipsecleng, 1, __libipsecout )) {} } while (0)
731#endif
732
733/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
734 * is returned in "result".
735 */
736#ifndef YY_INPUT
737#define YY_INPUT(buf,result,max_size) \
738        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
739                { \
740                int c = '*'; \
741                size_t n; \
742                for ( n = 0; n < max_size && \
743                             (c = getc( __libipsecin )) != EOF && c != '\n'; ++n ) \
744                        buf[n] = (char) c; \
745                if ( c == '\n' ) \
746                        buf[n++] = (char) c; \
747                if ( c == EOF && ferror( __libipsecin ) ) \
748                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
749                result = n; \
750                } \
751        else \
752                { \
753                errno=0; \
754                while ( (result = fread(buf, 1, max_size, __libipsecin))==0 && ferror(__libipsecin)) \
755                        { \
756                        if( errno != EINTR) \
757                                { \
758                                YY_FATAL_ERROR( "input in flex scanner failed" ); \
759                                break; \
760                                } \
761                        errno=0; \
762                        clearerr(__libipsecin); \
763                        } \
764                }\
765\
766
767#endif
768
769/* No semi-colon after return; correct usage is to write "yyterminate();" -
770 * we don't want an extra ';' after the "return" because that will cause
771 * some compilers to complain about unreachable statements.
772 */
773#ifndef yyterminate
774#define yyterminate() return YY_NULL
775#endif
776
777/* Number of entries by which start-condition stack grows. */
778#ifndef YY_START_STACK_INCR
779#define YY_START_STACK_INCR 25
780#endif
781
782/* Report a fatal error. */
783#ifndef YY_FATAL_ERROR
784#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
785#endif
786
787/* end tables serialization structures and prototypes */
788
789/* Default declaration of generated scanner - a define so the user can
790 * easily add parameters.
791 */
792#ifndef YY_DECL
793#define YY_DECL_IS_OURS 1
794
795extern int __libipseclex (void);
796
797#define YY_DECL int __libipseclex (void)
798#endif /* !YY_DECL */
799
800/* Code executed at the beginning of each rule, after __libipsectext and __libipsecleng
801 * have been set up.
802 */
803#ifndef YY_USER_ACTION
804#define YY_USER_ACTION
805#endif
806
807/* Code executed at the end of each rule. */
808#ifndef YY_BREAK
809#define YY_BREAK break;
810#endif
811
812#define YY_RULE_SETUP \
813        YY_USER_ACTION
814
815/** The main scanner function which does all the work.
816 */
817YY_DECL
818{
819        yy_state_type yy_current_state;
820        char *yy_cp, *yy_bp;
821        int yy_act;
822   
823#line 100 "../../ipsec-tools/src/libipsec/policy_token.l"
824
825
826#line 827 "<stdout>"
827
828        if ( !(yy_init) )
829                {
830                (yy_init) = 1;
831
832#ifdef YY_USER_INIT
833                YY_USER_INIT;
834#endif
835
836                if ( ! (yy_start) )
837                        (yy_start) = 1; /* first start state */
838
839                if ( ! __libipsecin )
840                        __libipsecin = stdin;
841
842                if ( ! __libipsecout )
843                        __libipsecout = stdout;
844
845                if ( ! YY_CURRENT_BUFFER ) {
846                        __libipsecensure_buffer_stack ();
847                        YY_CURRENT_BUFFER_LVALUE =
848                                __libipsec_create_buffer(__libipsecin,YY_BUF_SIZE );
849                }
850
851                __libipsec_load_buffer_state( );
852                }
853
854        while ( 1 )             /* loops until end-of-file is reached */
855                {
856                yy_cp = (yy_c_buf_p);
857
858                /* Support of __libipsectext. */
859                *yy_cp = (yy_hold_char);
860
861                /* yy_bp points to the position in yy_ch_buf of the start of
862                 * the current run.
863                 */
864                yy_bp = yy_cp;
865
866                yy_current_state = (yy_start);
867yy_match:
868                do
869                        {
870                        YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
871                        if ( yy_accept[yy_current_state] )
872                                {
873                                (yy_last_accepting_state) = yy_current_state;
874                                (yy_last_accepting_cpos) = yy_cp;
875                                }
876                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
877                                {
878                                yy_current_state = (int) yy_def[yy_current_state];
879                                if ( yy_current_state >= 121 )
880                                        yy_c = yy_meta[(unsigned int) yy_c];
881                                }
882                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
883                        ++yy_cp;
884                        }
885                while ( yy_base[yy_current_state] != 236 );
886
887yy_find_action:
888                yy_act = yy_accept[yy_current_state];
889                if ( yy_act == 0 )
890                        { /* have to back up */
891                        yy_cp = (yy_last_accepting_cpos);
892                        yy_current_state = (yy_last_accepting_state);
893                        yy_act = yy_accept[yy_current_state];
894                        }
895
896                YY_DO_BEFORE_ACTION;
897
898do_action:      /* This label is used only to access EOF actions. */
899
900                switch ( yy_act )
901        { /* beginning of action switch */
902                        case 0: /* must back up */
903                        /* undo the effects of YY_DO_BEFORE_ACTION */
904                        *yy_cp = (yy_hold_char);
905                        yy_cp = (yy_last_accepting_cpos);
906                        yy_current_state = (yy_last_accepting_state);
907                        goto yy_find_action;
908
909case 1:
910YY_RULE_SETUP
911#line 102 "../../ipsec-tools/src/libipsec/policy_token.l"
912{ yylval.num = IPSEC_DIR_INBOUND; return(DIR); }
913        YY_BREAK
914case 2:
915YY_RULE_SETUP
916#line 103 "../../ipsec-tools/src/libipsec/policy_token.l"
917{ yylval.num = IPSEC_DIR_OUTBOUND; return(DIR); }
918        YY_BREAK
919case 3:
920YY_RULE_SETUP
921#line 104 "../../ipsec-tools/src/libipsec/policy_token.l"
922{
923#ifdef HAVE_POLICY_FWD
924                  yylval.num = IPSEC_DIR_FWD; return(DIR);
925#else
926                  yylval.num = IPSEC_DIR_INBOUND; return(DIR);
927#endif
928                }
929        YY_BREAK
930case 4:
931YY_RULE_SETUP
932#line 112 "../../ipsec-tools/src/libipsec/policy_token.l"
933{ return(PRIORITY); }
934        YY_BREAK
935case 5:
936YY_RULE_SETUP
937#line 113 "../../ipsec-tools/src/libipsec/policy_token.l"
938{ return(PRIORITY); }
939        YY_BREAK
940case 6:
941YY_RULE_SETUP
942#line 114 "../../ipsec-tools/src/libipsec/policy_token.l"
943{ yylval.num32 = PRIORITY_LOW; return(PRIO_BASE); }
944        YY_BREAK
945case 7:
946YY_RULE_SETUP
947#line 115 "../../ipsec-tools/src/libipsec/policy_token.l"
948{ yylval.num32 = PRIORITY_DEFAULT; return(PRIO_BASE); }
949        YY_BREAK
950case 8:
951YY_RULE_SETUP
952#line 116 "../../ipsec-tools/src/libipsec/policy_token.l"
953{ yylval.num32 = PRIORITY_HIGH; return(PRIO_BASE); }
954        YY_BREAK
955case 9:
956YY_RULE_SETUP
957#line 117 "../../ipsec-tools/src/libipsec/policy_token.l"
958{ return(PLUS); }
959        YY_BREAK
960case 10:
961YY_RULE_SETUP
962#line 118 "../../ipsec-tools/src/libipsec/policy_token.l"
963{
964                        yylval.val.len = strlen(__libipsectext);
965                        yylval.val.buf = __libipsectext;
966                        return(PRIO_OFFSET);
967}
968        YY_BREAK
969case 11:
970YY_RULE_SETUP
971#line 124 "../../ipsec-tools/src/libipsec/policy_token.l"
972{ yylval.num = IPSEC_POLICY_DISCARD; return(ACTION); }
973        YY_BREAK
974case 12:
975YY_RULE_SETUP
976#line 125 "../../ipsec-tools/src/libipsec/policy_token.l"
977{ yylval.num = IPSEC_POLICY_NONE; return(ACTION); }
978        YY_BREAK
979case 13:
980YY_RULE_SETUP
981#line 126 "../../ipsec-tools/src/libipsec/policy_token.l"
982{ yylval.num = IPSEC_POLICY_IPSEC; return(ACTION); }
983        YY_BREAK
984case 14:
985YY_RULE_SETUP
986#line 127 "../../ipsec-tools/src/libipsec/policy_token.l"
987{ yylval.num = IPSEC_POLICY_BYPASS; return(ACTION); }
988        YY_BREAK
989case 15:
990YY_RULE_SETUP
991#line 128 "../../ipsec-tools/src/libipsec/policy_token.l"
992{ yylval.num = IPSEC_POLICY_ENTRUST; return(ACTION); }
993        YY_BREAK
994case 16:
995YY_RULE_SETUP
996#line 130 "../../ipsec-tools/src/libipsec/policy_token.l"
997{ yylval.num = IPPROTO_ESP; return(PROTOCOL); }
998        YY_BREAK
999case 17:
1000YY_RULE_SETUP
1001#line 131 "../../ipsec-tools/src/libipsec/policy_token.l"
1002{ yylval.num = IPPROTO_AH; return(PROTOCOL); }
1003        YY_BREAK
1004case 18:
1005YY_RULE_SETUP
1006#line 132 "../../ipsec-tools/src/libipsec/policy_token.l"
1007{ yylval.num = IPPROTO_IPCOMP; return(PROTOCOL); }
1008        YY_BREAK
1009case 19:
1010YY_RULE_SETUP
1011#line 134 "../../ipsec-tools/src/libipsec/policy_token.l"
1012{ yylval.num = IPSEC_MODE_TRANSPORT; return(MODE); }
1013        YY_BREAK
1014case 20:
1015YY_RULE_SETUP
1016#line 135 "../../ipsec-tools/src/libipsec/policy_token.l"
1017{ yylval.num = IPSEC_MODE_TUNNEL; return(MODE); }
1018        YY_BREAK
1019case 21:
1020YY_RULE_SETUP
1021#line 137 "../../ipsec-tools/src/libipsec/policy_token.l"
1022{ return(ME); }
1023        YY_BREAK
1024case 22:
1025YY_RULE_SETUP
1026#line 138 "../../ipsec-tools/src/libipsec/policy_token.l"
1027{ return(ANY); }
1028        YY_BREAK
1029case 23:
1030YY_RULE_SETUP
1031#line 140 "../../ipsec-tools/src/libipsec/policy_token.l"
1032{ yylval.num = IPSEC_LEVEL_DEFAULT; return(LEVEL); }
1033        YY_BREAK
1034case 24:
1035YY_RULE_SETUP
1036#line 141 "../../ipsec-tools/src/libipsec/policy_token.l"
1037{ yylval.num = IPSEC_LEVEL_USE; return(LEVEL); }
1038        YY_BREAK
1039case 25:
1040YY_RULE_SETUP
1041#line 142 "../../ipsec-tools/src/libipsec/policy_token.l"
1042{ yylval.num = IPSEC_LEVEL_REQUIRE; return(LEVEL); }
1043        YY_BREAK
1044case 26:
1045YY_RULE_SETUP
1046#line 143 "../../ipsec-tools/src/libipsec/policy_token.l"
1047{
1048                        yylval.val.len = strlen(__libipsectext + 7);
1049                        yylval.val.buf = __libipsectext + 7;
1050                        return(LEVEL_SPECIFY);
1051                }
1052        YY_BREAK
1053case 27:
1054YY_RULE_SETUP
1055#line 148 "../../ipsec-tools/src/libipsec/policy_token.l"
1056{ yylval.num = IPSEC_LEVEL_UNIQUE; return(LEVEL); }
1057        YY_BREAK
1058case 28:
1059YY_RULE_SETUP
1060#line 149 "../../ipsec-tools/src/libipsec/policy_token.l"
1061{ return(SLASH); }
1062        YY_BREAK
1063case 29:
1064YY_RULE_SETUP
1065#line 151 "../../ipsec-tools/src/libipsec/policy_token.l"
1066{
1067                        yylval.val.len = strlen(__libipsectext);
1068                        yylval.val.buf = __libipsectext;
1069                        return(IPADDRESS);
1070                }
1071        YY_BREAK
1072case 30:
1073YY_RULE_SETUP
1074#line 157 "../../ipsec-tools/src/libipsec/policy_token.l"
1075{ return(HYPHEN); }
1076        YY_BREAK
1077case 31:
1078YY_RULE_SETUP
1079#line 159 "../../ipsec-tools/src/libipsec/policy_token.l"
1080{
1081                        /* Remove leading '[' and trailing ']' */
1082                        yylval.val.buf = __libipsectext + 1;
1083                        yylval.val.len = strlen(__libipsectext) - 2;
1084
1085                        return(PORT);
1086                }
1087        YY_BREAK
1088case 32:
1089YY_RULE_SETUP
1090#line 167 "../../ipsec-tools/src/libipsec/policy_token.l"
1091{ ; }
1092        YY_BREAK
1093case 33:
1094/* rule 33 can match eol */
1095YY_RULE_SETUP
1096#line 168 "../../ipsec-tools/src/libipsec/policy_token.l"
1097{ ; }
1098        YY_BREAK
1099case 34:
1100YY_RULE_SETUP
1101#line 170 "../../ipsec-tools/src/libipsec/policy_token.l"
1102ECHO;
1103        YY_BREAK
1104#line 1105 "<stdout>"
1105case YY_STATE_EOF(INITIAL):
1106        yyterminate();
1107
1108        case YY_END_OF_BUFFER:
1109                {
1110                /* Amount of text matched not including the EOB char. */
1111                int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1112
1113                /* Undo the effects of YY_DO_BEFORE_ACTION. */
1114                *yy_cp = (yy_hold_char);
1115                YY_RESTORE_YY_MORE_OFFSET
1116
1117                if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1118                        {
1119                        /* We're scanning a new file or input source.  It's
1120                         * possible that this happened because the user
1121                         * just pointed __libipsecin at a new source and called
1122                         * __libipseclex().  If so, then we have to assure
1123                         * consistency between YY_CURRENT_BUFFER and our
1124                         * globals.  Here is the right place to do so, because
1125                         * this is the first action (other than possibly a
1126                         * back-up) that will match for the new input source.
1127                         */
1128                        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1129                        YY_CURRENT_BUFFER_LVALUE->yy_input_file = __libipsecin;
1130                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1131                        }
1132
1133                /* Note that here we test for yy_c_buf_p "<=" to the position
1134                 * of the first EOB in the buffer, since yy_c_buf_p will
1135                 * already have been incremented past the NUL character
1136                 * (since all states make transitions on EOB to the
1137                 * end-of-buffer state).  Contrast this with the test
1138                 * in input().
1139                 */
1140                if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1141                        { /* This was really a NUL. */
1142                        yy_state_type yy_next_state;
1143
1144                        (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1145
1146                        yy_current_state = yy_get_previous_state(  );
1147
1148                        /* Okay, we're now positioned to make the NUL
1149                         * transition.  We couldn't have
1150                         * yy_get_previous_state() go ahead and do it
1151                         * for us because it doesn't know how to deal
1152                         * with the possibility of jamming (and we don't
1153                         * want to build jamming into it because then it
1154                         * will run more slowly).
1155                         */
1156
1157                        yy_next_state = yy_try_NUL_trans( yy_current_state );
1158
1159                        yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1160
1161                        if ( yy_next_state )
1162                                {
1163                                /* Consume the NUL. */
1164                                yy_cp = ++(yy_c_buf_p);
1165                                yy_current_state = yy_next_state;
1166                                goto yy_match;
1167                                }
1168
1169                        else
1170                                {
1171                                yy_cp = (yy_c_buf_p);
1172                                goto yy_find_action;
1173                                }
1174                        }
1175
1176                else switch ( yy_get_next_buffer(  ) )
1177                        {
1178                        case EOB_ACT_END_OF_FILE:
1179                                {
1180                                (yy_did_buffer_switch_on_eof) = 0;
1181
1182                                if ( __libipsecwrap( ) )
1183                                        {
1184                                        /* Note: because we've taken care in
1185                                         * yy_get_next_buffer() to have set up
1186                                         * __libipsectext, we can now set up
1187                                         * yy_c_buf_p so that if some total
1188                                         * hoser (like flex itself) wants to
1189                                         * call the scanner after we return the
1190                                         * YY_NULL, it'll still work - another
1191                                         * YY_NULL will get returned.
1192                                         */
1193                                        (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1194
1195                                        yy_act = YY_STATE_EOF(YY_START);
1196                                        goto do_action;
1197                                        }
1198
1199                                else
1200                                        {
1201                                        if ( ! (yy_did_buffer_switch_on_eof) )
1202                                                YY_NEW_FILE;
1203                                        }
1204                                break;
1205                                }
1206
1207                        case EOB_ACT_CONTINUE_SCAN:
1208                                (yy_c_buf_p) =
1209                                        (yytext_ptr) + yy_amount_of_matched_text;
1210
1211                                yy_current_state = yy_get_previous_state(  );
1212
1213                                yy_cp = (yy_c_buf_p);
1214                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1215                                goto yy_match;
1216
1217                        case EOB_ACT_LAST_MATCH:
1218                                (yy_c_buf_p) =
1219                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1220
1221                                yy_current_state = yy_get_previous_state(  );
1222
1223                                yy_cp = (yy_c_buf_p);
1224                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1225                                goto yy_find_action;
1226                        }
1227                break;
1228                }
1229
1230        default:
1231                YY_FATAL_ERROR(
1232                        "fatal flex scanner internal error--no action found" );
1233        } /* end of action switch */
1234                } /* end of scanning one token */
1235} /* end of __libipseclex */
1236
1237/* yy_get_next_buffer - try to read in a new buffer
1238 *
1239 * Returns a code representing an action:
1240 *      EOB_ACT_LAST_MATCH -
1241 *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1242 *      EOB_ACT_END_OF_FILE - end of file
1243 */
1244static int yy_get_next_buffer (void)
1245{
1246        char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1247        char *source = (yytext_ptr);
1248        int number_to_move, i;
1249        int ret_val;
1250
1251        if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1252                YY_FATAL_ERROR(
1253                "fatal flex scanner internal error--end of buffer missed" );
1254
1255        if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1256                { /* Don't try to fill the buffer, so this is an EOF. */
1257                if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1258                        {
1259                        /* We matched a single character, the EOB, so
1260                         * treat this as a final EOF.
1261                         */
1262                        return EOB_ACT_END_OF_FILE;
1263                        }
1264
1265                else
1266                        {
1267                        /* We matched some text prior to the EOB, first
1268                         * process it.
1269                         */
1270                        return EOB_ACT_LAST_MATCH;
1271                        }
1272                }
1273
1274        /* Try to read more data. */
1275
1276        /* First move last chars to start of buffer. */
1277        number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1278
1279        for ( i = 0; i < number_to_move; ++i )
1280                *(dest++) = *(source++);
1281
1282        if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1283                /* don't do the read, it's not guaranteed to return an EOF,
1284                 * just force an EOF
1285                 */
1286                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1287
1288        else
1289                {
1290                        yy_size_t num_to_read =
1291                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1292
1293                while ( num_to_read <= 0 )
1294                        { /* Not enough room in the buffer - grow it. */
1295
1296                        /* just a shorter name for the current buffer */
1297                        YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1298
1299                        int yy_c_buf_p_offset =
1300                                (int) ((yy_c_buf_p) - b->yy_ch_buf);
1301
1302                        if ( b->yy_is_our_buffer )
1303                                {
1304                                yy_size_t new_size = b->yy_buf_size * 2;
1305
1306                                if ( new_size <= 0 )
1307                                        b->yy_buf_size += b->yy_buf_size / 8;
1308                                else
1309                                        b->yy_buf_size *= 2;
1310
1311                                b->yy_ch_buf = (char *)
1312                                        /* Include room in for 2 EOB chars. */
1313                                        __libipsecrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
1314                                }
1315                        else
1316                                /* Can't grow it, we don't own it. */
1317                                b->yy_ch_buf = 0;
1318
1319                        if ( ! b->yy_ch_buf )
1320                                YY_FATAL_ERROR(
1321                                "fatal error - scanner input buffer overflow" );
1322
1323                        (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1324
1325                        num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1326                                                number_to_move - 1;
1327
1328                        }
1329
1330                if ( num_to_read > YY_READ_BUF_SIZE )
1331                        num_to_read = YY_READ_BUF_SIZE;
1332
1333                /* Read in more data. */
1334                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1335                        (yy_n_chars), num_to_read );
1336
1337                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1338                }
1339
1340        if ( (yy_n_chars) == 0 )
1341                {
1342                if ( number_to_move == YY_MORE_ADJ )
1343                        {
1344                        ret_val = EOB_ACT_END_OF_FILE;
1345                        __libipsecrestart(__libipsecin  );
1346                        }
1347
1348                else
1349                        {
1350                        ret_val = EOB_ACT_LAST_MATCH;
1351                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1352                                YY_BUFFER_EOF_PENDING;
1353                        }
1354                }
1355
1356        else
1357                ret_val = EOB_ACT_CONTINUE_SCAN;
1358
1359        if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1360                /* Extend the array by 50%, plus the number we really need. */
1361                yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1362                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) __libipsecrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
1363                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1364                        YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1365        }
1366
1367        (yy_n_chars) += number_to_move;
1368        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1369        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1370
1371        (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1372
1373        return ret_val;
1374}
1375
1376/* yy_get_previous_state - get the state just before the EOB char was reached */
1377
1378    static yy_state_type yy_get_previous_state (void)
1379{
1380        yy_state_type yy_current_state;
1381        char *yy_cp;
1382   
1383        yy_current_state = (yy_start);
1384
1385        for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1386                {
1387                YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1388                if ( yy_accept[yy_current_state] )
1389                        {
1390                        (yy_last_accepting_state) = yy_current_state;
1391                        (yy_last_accepting_cpos) = yy_cp;
1392                        }
1393                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1394                        {
1395                        yy_current_state = (int) yy_def[yy_current_state];
1396                        if ( yy_current_state >= 121 )
1397                                yy_c = yy_meta[(unsigned int) yy_c];
1398                        }
1399                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1400                }
1401
1402        return yy_current_state;
1403}
1404
1405/* yy_try_NUL_trans - try to make a transition on the NUL character
1406 *
1407 * synopsis
1408 *      next_state = yy_try_NUL_trans( current_state );
1409 */
1410    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
1411{
1412        int yy_is_jam;
1413        char *yy_cp = (yy_c_buf_p);
1414
1415        YY_CHAR yy_c = 1;
1416        if ( yy_accept[yy_current_state] )
1417                {
1418                (yy_last_accepting_state) = yy_current_state;
1419                (yy_last_accepting_cpos) = yy_cp;
1420                }
1421        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1422                {
1423                yy_current_state = (int) yy_def[yy_current_state];
1424                if ( yy_current_state >= 121 )
1425                        yy_c = yy_meta[(unsigned int) yy_c];
1426                }
1427        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1428        yy_is_jam = (yy_current_state == 120);
1429
1430                return yy_is_jam ? 0 : yy_current_state;
1431}
1432
1433#ifndef YY_NO_INPUT
1434#ifdef __cplusplus
1435    static int yyinput (void)
1436#else
1437    static int input  (void)
1438#endif
1439
1440{
1441        int c;
1442   
1443        *(yy_c_buf_p) = (yy_hold_char);
1444
1445        if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1446                {
1447                /* yy_c_buf_p now points to the character we want to return.
1448                 * If this occurs *before* the EOB characters, then it's a
1449                 * valid NUL; if not, then we've hit the end of the buffer.
1450                 */
1451                if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1452                        /* This was really a NUL. */
1453                        *(yy_c_buf_p) = '\0';
1454
1455                else
1456                        { /* need more input */
1457                        yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1458                        ++(yy_c_buf_p);
1459
1460                        switch ( yy_get_next_buffer(  ) )
1461                                {
1462                                case EOB_ACT_LAST_MATCH:
1463                                        /* This happens because yy_g_n_b()
1464                                         * sees that we've accumulated a
1465                                         * token and flags that we need to
1466                                         * try matching the token before
1467                                         * proceeding.  But for input(),
1468                                         * there's no matching to consider.
1469                                         * So convert the EOB_ACT_LAST_MATCH
1470                                         * to EOB_ACT_END_OF_FILE.
1471                                         */
1472
1473                                        /* Reset buffer status. */
1474                                        __libipsecrestart(__libipsecin );
1475
1476                                        /*FALLTHROUGH*/
1477
1478                                case EOB_ACT_END_OF_FILE:
1479                                        {
1480                                        if ( __libipsecwrap( ) )
1481                                                return EOF;
1482
1483                                        if ( ! (yy_did_buffer_switch_on_eof) )
1484                                                YY_NEW_FILE;
1485#ifdef __cplusplus
1486                                        return yyinput();
1487#else
1488                                        return input();
1489#endif
1490                                        }
1491
1492                                case EOB_ACT_CONTINUE_SCAN:
1493                                        (yy_c_buf_p) = (yytext_ptr) + offset;
1494                                        break;
1495                                }
1496                        }
1497                }
1498
1499        c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
1500        *(yy_c_buf_p) = '\0';   /* preserve __libipsectext */
1501        (yy_hold_char) = *++(yy_c_buf_p);
1502
1503        return c;
1504}
1505#endif  /* ifndef YY_NO_INPUT */
1506
1507/** Immediately switch to a different input stream.
1508 * @param input_file A readable stream.
1509 *
1510 * @note This function does not reset the start condition to @c INITIAL .
1511 */
1512    void __libipsecrestart  (FILE * input_file )
1513{
1514   
1515        if ( ! YY_CURRENT_BUFFER ){
1516        __libipsecensure_buffer_stack ();
1517                YY_CURRENT_BUFFER_LVALUE =
1518            __libipsec_create_buffer(__libipsecin,YY_BUF_SIZE );
1519        }
1520
1521        __libipsec_init_buffer(YY_CURRENT_BUFFER,input_file );
1522        __libipsec_load_buffer_state( );
1523}
1524
1525/** Switch to a different input buffer.
1526 * @param new_buffer The new input buffer.
1527 *
1528 */
1529    void __libipsec_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
1530{
1531   
1532        /* TODO. We should be able to replace this entire function body
1533         * with
1534         *              __libipsecpop_buffer_state();
1535         *              __libipsecpush_buffer_state(new_buffer);
1536     */
1537        __libipsecensure_buffer_stack ();
1538        if ( YY_CURRENT_BUFFER == new_buffer )
1539                return;
1540
1541        if ( YY_CURRENT_BUFFER )
1542                {
1543                /* Flush out information for old buffer. */
1544                *(yy_c_buf_p) = (yy_hold_char);
1545                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1546                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1547                }
1548
1549        YY_CURRENT_BUFFER_LVALUE = new_buffer;
1550        __libipsec_load_buffer_state( );
1551
1552        /* We don't actually know whether we did this switch during
1553         * EOF (__libipsecwrap()) processing, but the only time this flag
1554         * is looked at is after __libipsecwrap() is called, so it's safe
1555         * to go ahead and always set it.
1556         */
1557        (yy_did_buffer_switch_on_eof) = 1;
1558}
1559
1560static void __libipsec_load_buffer_state  (void)
1561{
1562        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1563        (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1564        __libipsecin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1565        (yy_hold_char) = *(yy_c_buf_p);
1566}
1567
1568/** Allocate and initialize an input buffer state.
1569 * @param file A readable stream.
1570 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1571 *
1572 * @return the allocated buffer state.
1573 */
1574    YY_BUFFER_STATE __libipsec_create_buffer  (FILE * file, int  size )
1575{
1576        YY_BUFFER_STATE b;
1577   
1578        b = (YY_BUFFER_STATE) __libipsecalloc(sizeof( struct yy_buffer_state )  );
1579        if ( ! b )
1580                YY_FATAL_ERROR( "out of dynamic memory in __libipsec_create_buffer()" );
1581
1582        b->yy_buf_size = size;
1583
1584        /* yy_ch_buf has to be 2 characters longer than the size given because
1585         * we need to put in 2 end-of-buffer characters.
1586         */
1587        b->yy_ch_buf = (char *) __libipsecalloc(b->yy_buf_size + 2  );
1588        if ( ! b->yy_ch_buf )
1589                YY_FATAL_ERROR( "out of dynamic memory in __libipsec_create_buffer()" );
1590
1591        b->yy_is_our_buffer = 1;
1592
1593        __libipsec_init_buffer(b,file );
1594
1595        return b;
1596}
1597
1598/** Destroy the buffer.
1599 * @param b a buffer created with __libipsec_create_buffer()
1600 *
1601 */
1602    void __libipsec_delete_buffer (YY_BUFFER_STATE  b )
1603{
1604   
1605        if ( ! b )
1606                return;
1607
1608        if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1609                YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1610
1611        if ( b->yy_is_our_buffer )
1612                __libipsecfree((void *) b->yy_ch_buf  );
1613
1614        __libipsecfree((void *) b  );
1615}
1616
1617/* Initializes or reinitializes a buffer.
1618 * This function is sometimes called more than once on the same buffer,
1619 * such as during a __libipsecrestart() or at EOF.
1620 */
1621    static void __libipsec_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
1622
1623{
1624        int oerrno = errno;
1625   
1626        __libipsec_flush_buffer(b );
1627
1628        b->yy_input_file = file;
1629        b->yy_fill_buffer = 1;
1630
1631    /* If b is the current buffer, then __libipsec_init_buffer was _probably_
1632     * called from __libipsecrestart() or through yy_get_next_buffer.
1633     * In that case, we don't want to reset the lineno or column.
1634     */
1635    if (b != YY_CURRENT_BUFFER){
1636        b->yy_bs_lineno = 1;
1637        b->yy_bs_column = 0;
1638    }
1639
1640        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1641   
1642        errno = oerrno;
1643}
1644
1645/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1646 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1647 *
1648 */
1649    void __libipsec_flush_buffer (YY_BUFFER_STATE  b )
1650{
1651        if ( ! b )
1652                return;
1653
1654        b->yy_n_chars = 0;
1655
1656        /* We always need two end-of-buffer characters.  The first causes
1657         * a transition to the end-of-buffer state.  The second causes
1658         * a jam in that state.
1659         */
1660        b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1661        b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1662
1663        b->yy_buf_pos = &b->yy_ch_buf[0];
1664
1665        b->yy_at_bol = 1;
1666        b->yy_buffer_status = YY_BUFFER_NEW;
1667
1668        if ( b == YY_CURRENT_BUFFER )
1669                __libipsec_load_buffer_state( );
1670}
1671
1672/** Pushes the new state onto the stack. The new state becomes
1673 *  the current state. This function will allocate the stack
1674 *  if necessary.
1675 *  @param new_buffer The new state.
1676 * 
1677 */
1678void __libipsecpush_buffer_state (YY_BUFFER_STATE new_buffer )
1679{
1680        if (new_buffer == NULL)
1681                return;
1682
1683        __libipsecensure_buffer_stack();
1684
1685        /* This block is copied from __libipsec_switch_to_buffer. */
1686        if ( YY_CURRENT_BUFFER )
1687                {
1688                /* Flush out information for old buffer. */
1689                *(yy_c_buf_p) = (yy_hold_char);
1690                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1691                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1692                }
1693
1694        /* Only push if top exists. Otherwise, replace top. */
1695        if (YY_CURRENT_BUFFER)
1696                (yy_buffer_stack_top)++;
1697        YY_CURRENT_BUFFER_LVALUE = new_buffer;
1698
1699        /* copied from __libipsec_switch_to_buffer. */
1700        __libipsec_load_buffer_state( );
1701        (yy_did_buffer_switch_on_eof) = 1;
1702}
1703
1704/** Removes and deletes the top of the stack, if present.
1705 *  The next element becomes the new top.
1706 * 
1707 */
1708void __libipsecpop_buffer_state (void)
1709{
1710        if (!YY_CURRENT_BUFFER)
1711                return;
1712
1713        __libipsec_delete_buffer(YY_CURRENT_BUFFER );
1714        YY_CURRENT_BUFFER_LVALUE = NULL;
1715        if ((yy_buffer_stack_top) > 0)
1716                --(yy_buffer_stack_top);
1717
1718        if (YY_CURRENT_BUFFER) {
1719                __libipsec_load_buffer_state( );
1720                (yy_did_buffer_switch_on_eof) = 1;
1721        }
1722}
1723
1724/* Allocates the stack if it does not exist.
1725 *  Guarantees space for at least one push.
1726 */
1727static void __libipsecensure_buffer_stack (void)
1728{
1729        yy_size_t num_to_alloc;
1730   
1731        if (!(yy_buffer_stack)) {
1732
1733                /* First allocation is just for 2 elements, since we don't know if this
1734                 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1735                 * immediate realloc on the next call.
1736         */
1737                num_to_alloc = 1;
1738                (yy_buffer_stack) = (struct yy_buffer_state**)__libipsecalloc
1739                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
1740                                                                );
1741                if ( ! (yy_buffer_stack) )
1742                        YY_FATAL_ERROR( "out of dynamic memory in __libipsecensure_buffer_stack()" );
1743                                                                 
1744                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1745                               
1746                (yy_buffer_stack_max) = num_to_alloc;
1747                (yy_buffer_stack_top) = 0;
1748                return;
1749        }
1750
1751        if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1752
1753                /* Increase the buffer to prepare for a possible push. */
1754                int grow_size = 8 /* arbitrary grow size */;
1755
1756                num_to_alloc = (yy_buffer_stack_max) + grow_size;
1757                (yy_buffer_stack) = (struct yy_buffer_state**)__libipsecrealloc
1758                                                                ((yy_buffer_stack),
1759                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
1760                                                                );
1761                if ( ! (yy_buffer_stack) )
1762                        YY_FATAL_ERROR( "out of dynamic memory in __libipsecensure_buffer_stack()" );
1763
1764                /* zero only the new slots.*/
1765                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1766                (yy_buffer_stack_max) = num_to_alloc;
1767        }
1768}
1769
1770/** Setup the input buffer state to scan directly from a user-specified character buffer.
1771 * @param base the character buffer
1772 * @param size the size in bytes of the character buffer
1773 *
1774 * @return the newly allocated buffer state object.
1775 */
1776YY_BUFFER_STATE __libipsec_scan_buffer  (char * base, yy_size_t  size )
1777{
1778        YY_BUFFER_STATE b;
1779   
1780        if ( size < 2 ||
1781             base[size-2] != YY_END_OF_BUFFER_CHAR ||
1782             base[size-1] != YY_END_OF_BUFFER_CHAR )
1783                /* They forgot to leave room for the EOB's. */
1784                return 0;
1785
1786        b = (YY_BUFFER_STATE) __libipsecalloc(sizeof( struct yy_buffer_state )  );
1787        if ( ! b )
1788                YY_FATAL_ERROR( "out of dynamic memory in __libipsec_scan_buffer()" );
1789
1790        b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
1791        b->yy_buf_pos = b->yy_ch_buf = base;
1792        b->yy_is_our_buffer = 0;
1793        b->yy_input_file = 0;
1794        b->yy_n_chars = b->yy_buf_size;
1795        b->yy_is_interactive = 0;
1796        b->yy_at_bol = 1;
1797        b->yy_fill_buffer = 0;
1798        b->yy_buffer_status = YY_BUFFER_NEW;
1799
1800        __libipsec_switch_to_buffer(b  );
1801
1802        return b;
1803}
1804
1805/** Setup the input buffer state to scan a string. The next call to __libipseclex() will
1806 * scan from a @e copy of @a str.
1807 * @param yystr a NUL-terminated string to scan
1808 *
1809 * @return the newly allocated buffer state object.
1810 * @note If you want to scan bytes that may contain NUL values, then use
1811 *       __libipsec_scan_bytes() instead.
1812 */
1813YY_BUFFER_STATE __libipsec_scan_string (yyconst char * yystr )
1814{
1815   
1816        return __libipsec_scan_bytes(yystr,strlen(yystr) );
1817}
1818
1819/** Setup the input buffer state to scan the given bytes. The next call to __libipseclex() will
1820 * scan from a @e copy of @a bytes.
1821 * @param yybytes the byte buffer to scan
1822 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1823 *
1824 * @return the newly allocated buffer state object.
1825 */
1826YY_BUFFER_STATE __libipsec_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
1827{
1828        YY_BUFFER_STATE b;
1829        char *buf;
1830        yy_size_t n;
1831        yy_size_t i;
1832   
1833        /* Get memory for full buffer, including space for trailing EOB's. */
1834        n = _yybytes_len + 2;
1835        buf = (char *) __libipsecalloc(n  );
1836        if ( ! buf )
1837                YY_FATAL_ERROR( "out of dynamic memory in __libipsec_scan_bytes()" );
1838
1839        for ( i = 0; i < _yybytes_len; ++i )
1840                buf[i] = yybytes[i];
1841
1842        buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1843
1844        b = __libipsec_scan_buffer(buf,n );
1845        if ( ! b )
1846                YY_FATAL_ERROR( "bad buffer in __libipsec_scan_bytes()" );
1847
1848        /* It's okay to grow etc. this buffer, and we should throw it
1849         * away when we're done.
1850         */
1851        b->yy_is_our_buffer = 1;
1852
1853        return b;
1854}
1855
1856#ifndef YY_EXIT_FAILURE
1857#define YY_EXIT_FAILURE 2
1858#endif
1859
1860static void yy_fatal_error (yyconst char* msg )
1861{
1862        (void) fprintf( stderr, "%s\n", msg );
1863        exit( YY_EXIT_FAILURE );
1864}
1865
1866/* Redefine yyless() so it works in section 3 code. */
1867
1868#undef yyless
1869#define yyless(n) \
1870        do \
1871                { \
1872                /* Undo effects of setting up __libipsectext. */ \
1873        int yyless_macro_arg = (n); \
1874        YY_LESS_LINENO(yyless_macro_arg);\
1875                __libipsectext[__libipsecleng] = (yy_hold_char); \
1876                (yy_c_buf_p) = __libipsectext + yyless_macro_arg; \
1877                (yy_hold_char) = *(yy_c_buf_p); \
1878                *(yy_c_buf_p) = '\0'; \
1879                __libipsecleng = yyless_macro_arg; \
1880                } \
1881        while ( 0 )
1882
1883/* Accessor  methods (get/set functions) to struct members. */
1884
1885/** Get the current line number.
1886 *
1887 */
1888int __libipsecget_lineno  (void)
1889{
1890       
1891    return __libipseclineno;
1892}
1893
1894/** Get the input stream.
1895 *
1896 */
1897FILE *__libipsecget_in  (void)
1898{
1899        return __libipsecin;
1900}
1901
1902/** Get the output stream.
1903 *
1904 */
1905FILE *__libipsecget_out  (void)
1906{
1907        return __libipsecout;
1908}
1909
1910/** Get the length of the current token.
1911 *
1912 */
1913yy_size_t __libipsecget_leng  (void)
1914{
1915        return __libipsecleng;
1916}
1917
1918/** Get the current token.
1919 *
1920 */
1921
1922char *__libipsecget_text  (void)
1923{
1924        return __libipsectext;
1925}
1926
1927/** Set the current line number.
1928 * @param line_number
1929 *
1930 */
1931void __libipsecset_lineno (int  line_number )
1932{
1933   
1934    __libipseclineno = line_number;
1935}
1936
1937/** Set the input stream. This does not discard the current
1938 * input buffer.
1939 * @param in_str A readable stream.
1940 *
1941 * @see __libipsec_switch_to_buffer
1942 */
1943void __libipsecset_in (FILE *  in_str )
1944{
1945        __libipsecin = in_str ;
1946}
1947
1948void __libipsecset_out (FILE *  out_str )
1949{
1950        __libipsecout = out_str ;
1951}
1952
1953int __libipsecget_debug  (void)
1954{
1955        return __libipsec_flex_debug;
1956}
1957
1958void __libipsecset_debug (int  bdebug )
1959{
1960        __libipsec_flex_debug = bdebug ;
1961}
1962
1963static int yy_init_globals (void)
1964{
1965        /* Initialization is the same as for the non-reentrant scanner.
1966     * This function is called from __libipseclex_destroy(), so don't allocate here.
1967     */
1968
1969    (yy_buffer_stack) = 0;
1970    (yy_buffer_stack_top) = 0;
1971    (yy_buffer_stack_max) = 0;
1972    (yy_c_buf_p) = (char *) 0;
1973    (yy_init) = 0;
1974    (yy_start) = 0;
1975
1976/* Defined in main.c */
1977#ifdef YY_STDINIT
1978    __libipsecin = stdin;
1979    __libipsecout = stdout;
1980#else
1981    __libipsecin = (FILE *) 0;
1982    __libipsecout = (FILE *) 0;
1983#endif
1984
1985    /* For future reference: Set errno on error, since we are called by
1986     * __libipseclex_init()
1987     */
1988    return 0;
1989}
1990
1991/* __libipseclex_destroy is for both reentrant and non-reentrant scanners. */
1992int __libipseclex_destroy  (void)
1993{
1994   
1995    /* Pop the buffer stack, destroying each element. */
1996        while(YY_CURRENT_BUFFER){
1997                __libipsec_delete_buffer(YY_CURRENT_BUFFER  );
1998                YY_CURRENT_BUFFER_LVALUE = NULL;
1999                __libipsecpop_buffer_state();
2000        }
2001
2002        /* Destroy the stack itself. */
2003        __libipsecfree((yy_buffer_stack) );
2004        (yy_buffer_stack) = NULL;
2005
2006    /* Reset the globals. This is important in a non-reentrant scanner so the next time
2007     * __libipseclex() is called, initialization will occur. */
2008    yy_init_globals( );
2009
2010    return 0;
2011}
2012
2013/*
2014 * Internal utility routines.
2015 */
2016
2017#ifndef yytext_ptr
2018static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2019{
2020        int i;
2021        for ( i = 0; i < n; ++i )
2022                s1[i] = s2[i];
2023}
2024#endif
2025
2026#ifdef YY_NEED_STRLEN
2027static int yy_flex_strlen (yyconst char * s )
2028{
2029        int n;
2030        for ( n = 0; s[n]; ++n )
2031                ;
2032
2033        return n;
2034}
2035#endif
2036
2037void *__libipsecalloc (yy_size_t  size )
2038{
2039        return (void *) malloc( size );
2040}
2041
2042void *__libipsecrealloc  (void * ptr, yy_size_t  size )
2043{
2044        /* The cast to (char *) in the following accommodates both
2045         * implementations that use char* generic pointers, and those
2046         * that use void* generic pointers.  It works with the latter
2047         * because both ANSI C and C++ allow castless assignment from
2048         * any pointer type to void*, and deal with argument conversions
2049         * as though doing an assignment.
2050         */
2051        return (void *) realloc( (char *) ptr, size );
2052}
2053
2054void __libipsecfree (void * ptr )
2055{
2056        free( (char *) ptr );   /* see __libipsecrealloc() for (char *) cast */
2057}
2058
2059#define YYTABLES_NAME "yytables"
2060
2061#line 170 "../../ipsec-tools/src/libipsec/policy_token.l"
2062
2063
2064
2065void __policy__strbuffer__init__ __P((char *));
2066void __policy__strbuffer__free__ __P((void));
2067
2068static YY_BUFFER_STATE strbuffer;
2069
2070void
2071__policy__strbuffer__init__(msg)
2072        char *msg;
2073{
2074        if (YY_CURRENT_BUFFER)
2075                __libipsec_delete_buffer(YY_CURRENT_BUFFER);
2076        strbuffer = (YY_BUFFER_STATE)__libipsec_scan_string(msg);
2077        __libipsec_switch_to_buffer(strbuffer);
2078
2079        return;
2080}
2081
2082void
2083__policy__strbuffer__free__()
2084{
2085        __libipsec_delete_buffer(strbuffer);
2086
2087        return;
2088}
2089
Note: See TracBrowser for help on using the repository browser.