Annotation of embedaddon/ipsec-tools/src/libipsec/policy_token.c, revision 1.1.1.2

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>