Logo Search packages:      
Sourcecode: wflogs version File versions  Download package

ipfilter.cc

#line 2 "ipfilter.cc"

#line 4 "ipfilter.cc"

#define  YY_INT_ALIGNED short int

/* A lexical scanner generated by flex */

#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 31
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif

/* First, we deal with  platform-specific or compiler-specific issues. */

/* begin standard C headers. */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>

/* end standard C headers. */

/* flex integer type definitions */

#ifndef FLEXINT_H
#define FLEXINT_H

/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */

#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t; 
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */

/* Limits of integral types. */
#ifndef INT8_MIN
#define INT8_MIN               (-128)
#endif
#ifndef INT16_MIN
#define INT16_MIN              (-32767-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN              (-2147483647-1)
#endif
#ifndef INT8_MAX
#define INT8_MAX               (127)
#endif
#ifndef INT16_MAX
#define INT16_MAX              (32767)
#endif
#ifndef INT32_MAX
#define INT32_MAX              (2147483647)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX              (255U)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX             (65535U)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX             (4294967295U)
#endif

#endif /* ! FLEXINT_H */

#ifdef __cplusplus

/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST

#else /* ! __cplusplus */

#if __STDC__

#define YY_USE_CONST

#endif      /* __STDC__ */
#endif      /* ! __cplusplus */

#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif

/* Returned upon end-of-file. */
#define YY_NULL 0

/* Promotes a possibly negative, possibly signed char to an unsigned
 * integer for use as an array index.  If the signed char is negative,
 * we want to instead treat it as an 8-bit unsigned char, hence the
 * double cast.
 */
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)

/* Enter a start condition.  This macro really ought to take a parameter,
 * but we do it the disgusting crufty way forced on us by the ()-less
 * definition of BEGIN.
 */
#define BEGIN (yy_start) = 1 + 2 *

/* Translate the current start state into a value that can be later handed
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
 * compatibility.
 */
#define YY_START (((yy_start) - 1) / 2)
#define YYSTATE YY_START

/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)

/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE ipfilterrestart(ipfilterin  )

#define YY_END_OF_BUFFER_CHAR 0

/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#endif

#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif

extern int ipfilterleng;

extern FILE *ipfilterin, *ipfilterout;

#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2

    #define YY_LESS_LINENO(n)
    
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
      do \
            { \
            /* Undo effects of setting up ipfiltertext. */ \
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
            *yy_cp = (yy_hold_char); \
            YY_RESTORE_YY_MORE_OFFSET \
            (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
            YY_DO_BEFORE_ACTION; /* set up ipfiltertext again */ \
            } \
      while ( 0 )

#define unput(c) yyunput( c, (yytext_ptr)  )

/* The following is because we cannot portably get our hands on size_t
 * (without autoconf's help, which isn't available because we want
 * flex-generated scanners to compile on their own).
 */

#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef unsigned int yy_size_t;
#endif

#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
      {
      FILE *yy_input_file;

      char *yy_ch_buf;        /* input buffer */
      char *yy_buf_pos;       /* current position in input buffer */

      /* Size of input buffer in bytes, not including room for EOB
       * characters.
       */
      yy_size_t yy_buf_size;

      /* Number of characters read into yy_ch_buf, not including EOB
       * characters.
       */
      int yy_n_chars;

      /* Whether we "own" the buffer - i.e., we know we created it,
       * and can realloc() it to grow it, and should free() it to
       * delete it.
       */
      int yy_is_our_buffer;

      /* Whether this is an "interactive" input source; if so, and
       * if we're using stdio for input, then we want to use getc()
       * instead of fread(), to make sure we stop fetching input after
       * each newline.
       */
      int yy_is_interactive;

      /* Whether we're considered to be at the beginning of a line.
       * If so, '^' rules will be active on the next match, otherwise
       * not.
       */
      int yy_at_bol;

    int yy_bs_lineno; /**< The line count. */
    int yy_bs_column; /**< The column count. */
    
      /* Whether to try to fill the input buffer when we reach the
       * end of it.
       */
      int yy_fill_buffer;

      int yy_buffer_status;

#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
      /* When an EOF's been seen but there's still some text to process
       * then we mark the buffer as YY_EOF_PENDING, to indicate that we
       * shouldn't try reading from the input source any more.  We might
       * still have a bunch of tokens to match, though, because of
       * possible backing-up.
       *
       * When we actually see the EOF, we change the status to "new"
       * (via ipfilterrestart()), so that the user can continue scanning by
       * just pointing ipfilterin at a new input file.
       */
#define YY_BUFFER_EOF_PENDING 2

      };
#endif /* !YY_STRUCT_YY_BUFFER_STATE */

/* Stack of input buffers. */
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */

/* We provide macros for accessing buffer states in case in the
 * future we want to put the buffer states in a more general
 * "scanner state".
 *
 * Returns the top of the stack, or NULL.
 */
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
                          : NULL)

/* Same as previous macro, but useful when we know that the buffer stack is not
 * NULL or when we need an lvalue. For internal use only.
 */
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]

/* yy_hold_char holds the character lost when ipfiltertext is formed. */
static char yy_hold_char;
static int yy_n_chars;        /* number of characters read into yy_ch_buf */
int ipfilterleng;

/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 1;       /* whether we need to initialize */
static int yy_start = 0;      /* start state number */

/* Flag which is used to allow ipfilterwrap()'s to do buffer switches
 * instead of setting up a fresh ipfilterin.  A bit of a hack ...
 */
static int yy_did_buffer_switch_on_eof;

void ipfilterrestart (FILE *input_file  );
void ipfilter_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
YY_BUFFER_STATE ipfilter_create_buffer (FILE *file,int size  );
void ipfilter_delete_buffer (YY_BUFFER_STATE b  );
void ipfilter_flush_buffer (YY_BUFFER_STATE b  );
void ipfilterpush_buffer_state (YY_BUFFER_STATE new_buffer  );
void ipfilterpop_buffer_state (void );

static void ipfilterensure_buffer_stack (void );
static void ipfilter_load_buffer_state (void );
static void ipfilter_init_buffer (YY_BUFFER_STATE b,FILE *file  );

#define YY_FLUSH_BUFFER ipfilter_flush_buffer(YY_CURRENT_BUFFER )

YY_BUFFER_STATE ipfilter_scan_buffer (char *base,yy_size_t size  );
YY_BUFFER_STATE ipfilter_scan_string (yyconst char *yy_str  );
YY_BUFFER_STATE ipfilter_scan_bytes (yyconst char *bytes,int len  );

void *ipfilteralloc (yy_size_t  );
void *ipfilterrealloc (void *,yy_size_t  );
void ipfilterfree (void *  );

#define yy_new_buffer ipfilter_create_buffer

#define yy_set_interactive(is_interactive) \
      { \
      if ( ! YY_CURRENT_BUFFER ){ \
        ipfilterensure_buffer_stack (); \
            YY_CURRENT_BUFFER_LVALUE =    \
            ipfilter_create_buffer(ipfilterin,YY_BUF_SIZE ); \
      } \
      YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
      }

#define yy_set_bol(at_bol) \
      { \
      if ( ! YY_CURRENT_BUFFER ){\
        ipfilterensure_buffer_stack (); \
            YY_CURRENT_BUFFER_LVALUE =    \
            ipfilter_create_buffer(ipfilterin,YY_BUF_SIZE ); \
      } \
      YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
      }

#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)

/* Begin user sect3 */

#define ipfilterwrap(n) 1
#define YY_SKIP_YYWRAP

typedef unsigned char YY_CHAR;

FILE *ipfilterin = (FILE *) 0, *ipfilterout = (FILE *) 0;

typedef int yy_state_type;

extern int ipfilterlineno;

int ipfilterlineno = 1;

extern char *ipfiltertext;
#define yytext_ptr ipfiltertext

static yy_state_type yy_get_previous_state (void );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
static int yy_get_next_buffer (void );
static void yy_fatal_error (yyconst char msg[]  );

/* Done after the current pattern has been matched and before the
 * corresponding action - sets up ipfiltertext.
 */
#define YY_DO_BEFORE_ACTION \
      (yytext_ptr) = yy_bp; \
      ipfilterleng = (size_t) (yy_cp - yy_bp); \
      (yy_hold_char) = *yy_cp; \
      *yy_cp = '\0'; \
      (yy_c_buf_p) = yy_cp;

#define YY_NUM_RULES 47
#define YY_END_OF_BUFFER 48
/* This struct is not used in this scanner,
   but its presence is necessary. */
struct yy_trans_info
      {
      flex_int32_t yy_verify;
      flex_int32_t yy_nxt;
      };
static yyconst flex_int16_t yy_accept[613] =
    {   0,
        0,    0,   48,   46,   43,   44,   43,   45,   46,   45,
       45,   45,   45,   45,   45,   45,   45,   45,   45,   45,
       45,   45,   46,   45,   45,   45,   43,    0,    0,   45,
       36,    0,    0,    0,    0,    0,    0,   45,   45,   45,
       45,   45,   39,   45,   45,   45,   45,   45,   45,   45,
       45,   45,    0,   45,   45,   45,   45,   45,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
       45,   45,   45,   38,   37,   40,    0,    0,   45,   45,
       45,   45,   45,    0,    0,    0,    0,    0,    0,    0,
       42,   42,   42,   42,    0,    0,    0,   42,    0,   19,

        0,    0,   45,   45,   45,    0,    0,    0,    0,    0,
        0,    0,    0,    0,   42,   42,   42,    0,    0,    0,
        0,   42,    0,    0,    0,    0,    0,    0,    0,   45,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,   42,   42,   42,    0,    0,   42,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    7,
        0,   42,   42,    0,    0,   42,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
       20,    0,    0,    0,    0,    5,    0,    0,   41,    0,

        7,   42,   42,    0,    0,   42,    0,    0,    3,    0,
        0,    0,    0,   21,   22,    0,    0,    0,    0,    0,
        0,   20,    0,    0,    0,    0,    0,    0,   15,    9,
        7,   41,   42,    0,    0,    5,    0,    0,    0,    0,
        0,   22,    0,    0,    0,    0,    0,    2,    0,    0,
        0,    0,    0,   11,   15,    9,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        8,    0,    0,    0,    9,    0,    6,    0,    0,    0,
        0,    0,   23,    0,    0,    0,    0,    0,    0,    8,
       17,   13,    9,    0,    0,    0,    0,    0,    0,    0,

        0,    0,    0,    0,   16,   10,    8,   17,   13,    9,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,   12,   16,   10,   13,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
       10,   13,    4,    1,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,   18,   14,   10,   13,    1,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
       18,   14,   10,    0,    0,    0,    0,    0,    0,    0,
        0,    0,   25,   26,   14,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,   14,    0,    0,    0,    0,

        0,    0,    0,   24,    0,    0,   14,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,   28,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,   27,    0,    0,    0,    0,    0,    0,

        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
        0,    0,    0,    0,    0,   29,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,

        0,   32,   31,   30,   33,    0,    0,    0,    0,   35,
       34,    0
    } ;

static yyconst flex_int32_t yy_ec[256] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    4,    5,    5,    5,    5,    5,    5,    5,    6,
        7,    5,    5,    8,    9,   10,   11,   12,   13,   13,
       13,   13,   13,   13,   13,   13,   13,   14,    5,    5,
        5,   15,    5,   16,   17,   18,   19,   20,   19,   21,
       22,   22,   23,   24,   25,   26,   27,   28,   29,   30,
       22,   31,   32,   33,   34,   22,   22,   22,   22,   22,
       35,    5,   36,    5,   37,    5,   38,   39,   40,   41,

       42,   43,   44,   45,   46,   47,   47,   48,   49,   50,
       51,   52,   53,   54,   55,   56,   57,   58,   47,   59,
       60,   47,    5,    5,    5,    5,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,

        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1
    } ;

static yyconst flex_int32_t yy_meta[61] =
    {   0,
        1,    1,    1,    2,    3,    3,    3,    3,    4,    5,
        3,    6,    6,    7,    3,    8,    9,    9,    9,    9,
        9,   10,   10,   10,   10,   10,   10,   10,   10,   10,
       10,   10,   10,   10,   11,   12,   13,   14,   14,   14,
       14,   14,   14,    4,    4,    4,    4,    4,    4,    4,
        4,    4,    4,    4,    4,    4,    4,    4,   14,    4
    } ;

static yyconst flex_int16_t yy_base[656] =
    {   0,
        0,    0, 1417, 1619,   59, 1619,   60,   61,   62,  118,
       16,   28,   29,   63,   72,   75,   79,   73,   83,   85,
       93,   98, 1393,   52,  111,  108,   97, 1398, 1396,  112,
      148,  114,  129,  132,  177,  158, 1407,  233,  113,  150,
     1368, 1368,  151,  160,  170,  167,  162,  169,  173,  172,
      180,  188, 1386,  189,  194,  199,  207,  209, 1401,  188,
      245,  226,  250,  273,  285,  213,  237,  341, 1397, 1384,
      157,  229,  227,  231,  245,  265, 1381, 1392,  266,  274,
      284,  295,  298,  269,  291,  294,  310,  312,  314,  319,
     1386,    0,  381,  330,  336,  325, 1385,  338,  351, 1370,

      344,  353,  304,  306,  368,  358, 1350,  363,  365,  376,
     1370,  392,  396, 1369,  378,  403, 1374, 1365, 1360, 1356,
     1364,  398,  401,  413,  423, 1332,  418,  421,  426,  317,
      428, 1329,  431,  433,  437,  444,  439,  448, 1340,  441,
      452,  459,  454,    0,  457,  461,  463,  465, 1355,    0,
     1320,  467,  472,  476,  478,  484, 1314, 1300, 1304, 1295,
      480,  492,  489,  496, 1334,  485,  500, 1333, 1312,  506,
     1329, 1314,  516,  509,  513,  519,  521, 1297,  526,  530,
     1322,  532,  534, 1318, 1283, 1266, 1273, 1267,  538,  540,
      542,  544,  548,  550,  554, 1619,  556,  560, 1619,  563,

      569, 1290,  567, 1307,  571,  560, 1301, 1276, 1619,  575,
      581,  583,  588,  590,  592, 1260, 1256, 1248, 1264,  596,
     1290, 1619,  601, 1290,  605, 1289,  607, 1286,    0,  609,
     1287,    0, 1267,  611,  621,    0,  614,  618, 1279,  625,
     1278, 1619, 1274, 1244, 1242, 1239,  629, 1619,  632,  636,
      638,  642,  644, 1266,    0,  646,  648,  644,  651,  654,
      659,  665,  669, 1261, 1226, 1225, 1226,  672,  676, 1253,
      679, 1252, 1225,  685,  687,  689, 1619, 1246,  693, 1246,
      699, 1242, 1619, 1198, 1203, 1196,  697,  703,  705,  711,
        0,  708,  713,  715,  717,  719,  723,  725,  731, 1183,

     1194, 1223,  728, 1223,    0,  733, 1221,    0,  735, 1619,
      737,  739,  741, 1217, 1219,  753, 1214, 1177, 1207,  717,
      746, 1206,    0,  748,  755,  758, 1207,  760,   86, 1201,
     1205, 1197,  771, 1155, 1157, 1159, 1148, 1147, 1161,  766,
      768,  773, 1619,    0, 1160, 1185,  775, 1188, 1185,  785,
     1148, 1137, 1135, 1128, 1128,    0,  778,  780, 1619,    0,
     1177,  790,    0,  787,  797, 1134, 1107, 1116, 1105, 1104,
        0,  792, 1619,    0, 1149,  802, 1119,  806, 1149, 1139,
     1095, 1098, 1619, 1619,  795, 1112, 1141,  808, 1109,  810,
      812,  816, 1129, 1102, 1099,  818, 1097,  820,  822,  832,

      827,  836, 1121, 1619, 1077, 1065, 1619,  840, 1076,  844,
     1086,  829,  848,  850,  854,  998,  982,  856,  860,  980,
      862,  864,  868,  872, 1003,  876,  994, 1619,  948,  880,
      975,  884,  888,  962,  890,  894,  896,  900,  921,  902,
      906,  908,  912,  914,  918,  922,  952,  925,  944,  902,
      929,  934,  933,  930,  937,  926,  939,  943,  945,  951,
      890,  948,  955,  957,  961,  963,  967,  969,  913,  974,
      909,  865,  971,  895,  978,  889,  981,  885,  983,  883,
      857,  988,  827,  985,  875,  990,  996,  998, 1004,  835,
        0,  834, 1010, 1619,  823,  825, 1012,  841,  843, 1014,

      835,  834,  823, 1016,  786, 1018,  805,  781,  791,  746,
     1028,  744,  759,    0,  752,  738,  698, 1021,  691,  683,
     1031,  673,  691,    0,  689, 1033,  686,  671, 1038,  669,
      620,  649,  617,  636,  606, 1043,    0,    0,  625,    0,
      574,  559,  566,  558, 1045,  581,  561,  555,  491,  488,
      512,  503, 1048,  452,  439,  411,  451,  379,    0,    0,
      393,  350,  345,  326, 1026,  343,  331,  324,  267,  237,
      233, 1055, 1050,  219,  217,  257,  217,  215, 1052, 1062,
      170,  154, 1057, 1059, 1064, 1066,  143,   79,   73, 1069,
     1076, 1079, 1072,  101,   80, 1074, 1081, 1083, 1090, 1086,

     1088, 1092, 1094, 1096, 1619, 1106, 1108, 1101, 1103, 1110,
     1112, 1619, 1124, 1137, 1150, 1163, 1176, 1187, 1198, 1211,
     1222, 1233, 1244, 1255, 1266, 1277, 1288, 1299, 1310, 1321,
     1332, 1343, 1356, 1367, 1378, 1389, 1400, 1411, 1422, 1433,
     1444, 1455, 1466, 1477, 1490, 1503, 1514, 1525, 1536, 1549,
     1560, 1571, 1582, 1593, 1604
    } ;

static yyconst flex_int16_t yy_def[656] =
    {   0,
      612,    1,  612,  612,  612,  612,  612,  613,  614,  613,
       10,   10,   10,  613,  613,  613,  613,  613,  613,  613,
      613,  613,  612,   10,  613,  613,  612,  612,  612,  613,
      613,  612,  612,  612,  615,  615,  612,  613,  613,  613,
       38,   38,  613,  613,  613,  613,  613,  613,  613,  613,
      613,  613,  612,  613,  613,  613,  613,  613,  612,  612,
      612,  612,  612,  616,  614,  612,  614,  616,  617,   68,
       10,  613,   10,  613,  613,  613,  618,  612,  613,  613,
      613,  613,  613,  619,  612,  612,  612,  612,  612,  612,
      616,  616,  616,   93,   36,  612,  620,  616,  612,  618,

      612,  621,  613,  613,  613,  612,  622,  612,  612,  612,
      612,  612,  612,  612,  616,   68,   68,   65,  612,  612,
      620,  616,  612,  612,  612,  623,  612,  612,  612,  613,
      612,  622,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  616,   68,   68,  612,  612,  616,  612,  612,  624,
      623,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  616,   93,  612,  612,  616,  612,  625,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  626,

      612,  616,   68,  612,  612,  616,  612,  625,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  627,  612,
      612,  616,   68,  612,  612,  616,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  627,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  628,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  629,  612,
      630,  612,  612,  612,  612,  612,  612,  631,  612,  612,

      612,  612,  612,  612,  632,  612,  612,  630,  612,  612,
      612,  612,  612,  612,  633,  612,  612,  612,  612,  612,
      612,  612,  632,  612,  612,  612,  612,  612,  612,  612,
      633,  612,  612,  612,  612,  612,  612,  612,  612,  634,
      612,  612,  612,  635,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  636,  612,  612,  612,  635,
      612,  612,  637,  612,  612,  612,  612,  612,  612,  612,
      636,  612,  612,  638,  612,  612,  639,  612,  612,  612,
      612,  612,  612,  612,  612,  640,  612,  612,  639,  612,
      612,  612,  612,  612,  612,  612,  640,  612,  641,  612,

      612,  612,  612,  612,  612,  612,  612,  612,  642,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  642,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  643,  612,  612,
      644,  612,  612,  612,  612,  612,  612,  612,  645,  612,

      612,  646,  612,  612,  612,  612,  612,  612,  645,  612,
      612,  612,  646,  647,  612,  612,  612,  648,  612,  612,
      612,  612,  647,  649,  650,  612,  612,  612,  612,  612,
      612,  649,  612,  650,  612,  612,  651,  652,  612,  653,
      612,  612,  612,  612,  612,  651,  652,  653,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  654,  655,
      612,  612,  612,  612,  612,  612,  654,  655,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,

      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,    0,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612
    } ;

static yyconst flex_int16_t yy_nxt[1680] =
    {   0,
        4,    5,    6,    7,    4,    4,    4,    4,    8,    4,
        4,    9,    9,    4,    4,    4,   10,   11,   11,   12,
       13,   14,   15,   16,   17,   14,   18,   19,   20,   21,
       14,   22,   14,   14,   23,    4,    4,   11,   11,   11,
       11,   11,   24,   14,   14,   25,   14,   26,   14,   14,
       14,   14,   14,   14,   14,   14,   14,   14,   14,   14,
       27,   27,   27,   27,   29,   33,   29,   30,   28,   41,
       42,   34,   30,   35,   35,   29,   29,   31,   29,   30,
       30,   31,   29,  601,   30,   30,   29,   46,   29,  346,
       31,   31,   31,  347,   31,   32,   29,   32,   27,   43,

       27,   29,   54,   30,  600,   55,   32,   32,   30,   32,
       47,   29,   44,   32,   29,   29,   29,   32,   49,   32,
       37,   29,  595,   51,   50,   61,   61,   32,  594,   38,
       38,   45,   32,   48,   38,   38,   38,   38,   38,   52,
       62,   62,   32,   63,   63,   32,   32,   32,  593,   58,
       56,   29,   32,   29,   29,   38,   38,   38,   38,   38,
       38,   68,   57,   29,   31,   29,   72,  612,   31,   39,
       29,  612,   29,   29,   40,   29,   29,   31,   31,   31,
       64,   31,   32,   77,   32,   32,   34,   74,   65,   65,
       66,   29,   29,   72,   32,  589,   32,   29,   75,   85,

       85,   32,   29,   32,   32,   76,   32,   32,   30,   72,
       29,  588,   29,   30,   32,   72,  612,   72,  585,   72,
      584,   72,   32,   32,   96,   96,   72,   72,   32,   88,
       99,   80,   99,   32,   29,   37,   70,   62,   62,   72,
      612,   32,   79,   32,   71,   71,  612,   81,   29,   71,
       71,   71,   71,   71,   86,   82,   87,   87,   83,   89,
      583,   90,   90,   32,  582,   32,  581,   32,   29,  102,
       71,   71,   71,   71,   71,   71,   91,   29,   30,   32,
      108,  108,  578,   30,   93,   93,  577,   29,   33,   94,
       94,   94,   94,   94,   34,  612,   95,   95,   29,   32,

       32,  106,   85,   85,  109,  110,  110,  128,   32,  129,
       94,   94,   94,   94,   94,   94,  576,  103,   32,   86,
       29,  111,  111,  112,  112,  113,  113,  575,   89,   32,
      114,  114,   32,   92,  574,  104,  119,  119,   32,   64,
       32,  117,  117,   37,   91,  105,  573,  118,  118,  122,
      122,  161,   94,   94,  123,  125,  125,   94,   94,   94,
       94,   94,  124,  124,  127,  127,   60,  571,   60,  131,
      131,   29,  134,   60,  135,  135,  136,  136,   94,   94,
       94,   94,   94,   94,  115,  137,  570,  138,  138,  142,
      142,  569,  116,  116,   37,  139,  535,  117,  117,  117,

      117,  117,   32,  112,  112,  140,  143,  141,  141,  122,
      122,  147,  124,  124,   93,   93,  148,  130,  117,  117,
      117,  117,  117,  117,  149,  149,  150,  153,  566,  154,
      154,  162,  155,  155,  125,  125,   60,  156,  156,  131,
      131,   60,  163,  163,  164,  164,  134,  166,  165,  165,
      167,  167,  170,  170,  565,  136,  136,  137,  564,  168,
      168,  140,  172,  171,  171,  173,  173,  157,  174,  174,
      142,  142,  175,  175,  176,  176,  177,  177,  179,  179,
      158,  159,  160,  180,  180,  153,  563,  181,  181,  155,
      155,  189,  189,  182,  183,  184,  184,  190,  192,  562,

      193,  193,  196,  191,  191,  194,  560,  195,  195,  197,
      196,  198,  198,  200,  196,  559,  196,  201,  201,  172,
      204,  204,  206,  196,  175,  175,  205,  203,  203,  558,
      176,  176,  207,  207,  196,  210,  196,  211,  211,  212,
      557,  213,  213,  214,  214,  215,  215,   86,  222,  220,
      220,  191,  191,  191,  191,  223,  223,  192,  556,  224,
      224,  225,  225,  194,  555,  226,  226,  227,  227,  197,
      233,  228,  228,  221,  230,  230,  200,  236,  173,  173,
      231,  231,  235,  235,  554,  236,  238,  238,  552,  236,
      210,  236,  239,  239,  240,  240,  551,  212,  236,  241,

      241,  214,  214,  242,  242,   86,  550,  247,  247,  236,
      249,  236,  250,  250,  251,  549,  252,  252,  253,  253,
      256,  256,  257,  257,  258,  259,  259,  260,  510,  261,
      261,  221,  235,  235,  262,  544,  263,  263,   86,  533,
      268,  268,  254,  269,  269,  249,  543,  270,  270,  271,
      271,  251,  542,  272,  272,  273,  273,  275,  275,  276,
      276,  277,  278,  278,  221,  279,  279,  541,  260,  277,
      280,  280,  540,  277,  538,  277,  281,  281,  262,  254,
      282,  282,  277,  268,  268,  287,  289,  288,  288,  537,
      290,  290,  533,  277,  531,  277,  292,  292,  293,  293,

      294,  294,  296,  530,  297,  297,  298,  221,  303,  303,
      299,  299,  287,  528,  304,  304,  306,  306,  289,  309,
      309,  527,  307,  307,  310,  310,  311,  311,  312,  312,
      313,  313,  296,  507,  314,  314,  316,  316,  298,  321,
      321,  524,  317,  317,  324,  324,  325,  325,  326,  326,
      327,  327,  328,  328,  336,  481,  332,  339,  339,  341,
      341,  337,  512,  322,  333,  333,  342,  342,  338,  343,
      343,  345,  345,  522,  332,  520,  329,  357,  357,  358,
      358,  322,  350,  350,  359,  359,  362,  362,  332,  372,
      372,  373,  373,  375,  508,  329,  365,  365,  378,  378,

      332,  376,  376,  385,  385,  375,  396,  396,  379,  379,
      519,  375,  518,  388,  388,  391,  516,  392,  392,  400,
      400,  401,  401,  402,  402,  391,  514,  403,  403,  407,
      407,  408,  408,  410,  410,  375,  412,  512,  413,  413,
      424,  424,  488,  411,  411,  414,  508,  415,  415,  418,
      486,  419,  419,  422,  505,  423,  423,  412,  485,  425,
      425,  426,  426,  414,  503,  427,  427,  430,  430,  418,
      480,  431,  431,  432,  432,  433,  433,  422,  496,  434,
      434,  435,  494,  436,  436,  437,  492,  438,  438,  440,
      491,  441,  441,  442,  466,  443,  443,  444,  464,  445,

      445,  446,  446,  435,  462,  447,  447,  448,  448,  437,
      483,  449,  449,  451,  451,  440,  459,  452,  452,  453,
      453,  442,  457,  454,  454,  455,  455,  444,  472,  456,
      456,  457,  459,  458,  458,  444,  460,  460,  462,  442,
      463,  463,  464,  440,  465,  465,  466,  461,  467,  467,
      468,  468,  457,  437,  469,  469,  470,  470,  459,  473,
      473,  435,  471,  471,  462,  450,  474,  474,  475,  475,
      464,  422,  476,  476,  477,  477,  466,  481,  478,  478,
      479,  479,  484,  484,  418,  482,  482,  486,  488,  487,
      487,  481,  489,  489,  490,  490,  495,  495,  439,  493,

      493,  497,  497,  414,  480,  486,  485,  498,  498,  500,
      500,  488,  412,  481,  421,  501,  501,  510,  480,  481,
      485,  504,  504,  506,  506,  511,  511,  515,  515,  517,
      517,  510,  526,  526,  510,  429,  535,  572,  572,  521,
      521,  510,  529,  529,  536,  536,  535,  507,  535,  539,
      539,  535,  428,  507,  545,  545,  553,  553,  579,  561,
      561,  580,  580,  586,  586,  587,  572,  572,  590,  590,
      591,  591,  596,  580,  580,  592,  592,  586,  586,  597,
      590,  590,  598,  599,  599,  602,  602,  591,  591,  375,
      592,  592,  603,  603,  604,  604,  605,  606,  606,  607,

      607,  599,  599,  602,  602,  603,  603,  604,  604,  608,
      421,  609,  610,  610,  611,  611,  417,  606,  606,  607,
      607,  610,  610,  611,  611,   30,  416,   30,   30,   30,
      391,  398,   30,   30,   30,  406,   30,   30,   36,  405,
      404,   36,   36,  390,  399,   36,  398,  395,  394,  393,
       36,   67,  332,  390,   67,   67,   67,  387,   67,  384,
      383,  382,  381,   67,   92,   92,   92,   92,   92,   92,
       92,   92,   92,   92,   92,   92,   92,   97,  380,   97,
      374,  370,  369,  368,   97,   97,  367,  366,  364,   97,
      100,  363,  100,  361,  100,  329,  322,  355,  354,  353,

      100,  107,  352,  107,  351,  349,  107,  107,  330,  348,
      344,  107,  121,  340,  121,  121,  121,  335,  334,  121,
      121,  298,  330,  121,  121,  126,  296,  126,  289,  126,
      126,  126,  287,  320,  319,  126,  132,  132,  132,  318,
      302,  132,  132,  132,  301,  132,  132,  151,  151,  151,
      300,  262,  151,  151,  151,  260,  151,  151,  178,  295,
      254,  251,  249,  178,  178,  286,  285,  284,  178,  208,
      208,  208,  283,  274,  208,  208,  267,  208,  208,  208,
      229,  266,  229,  265,  264,  229,  229,  212,  210,  202,
      229,  255,  255,  255,  200,  197,  255,  255,  194,  192,

      255,  255,  291,  248,  291,  246,  245,  291,  291,  244,
      243,  209,  291,  305,  237,  305,  234,  232,  305,  305,
      219,  218,  217,  305,  308,  308,  308,  216,  183,  308,
      308,  153,  209,  308,  308,  315,  202,  315,  140,  199,
      315,  315,  137,  134,  188,  315,  323,  323,  323,  187,
      186,  323,  323,  185,  152,  323,  323,  331,  148,  331,
      331,  331,  169,  133,  331,  331,  152,  120,  331,  331,
      356,  146,  356,  145,  612,  356,  356,  144,   89,   86,
      356,  360,  360,  360,  133,  612,  360,  360,  120,   91,
      360,  360,  371,  371,  371,  101,   60,  371,  371,   98,

       69,  371,  371,  377,   84,   78,   73,   73,  377,  377,
       69,   60,   59,  377,  386,   53,  612,  612,  612,  386,
      386,  612,  612,  612,  386,  389,  389,  389,  612,  612,
      389,  389,  389,  612,  389,  389,  397,  397,  397,  612,
      612,  397,  397,  397,  612,  397,  397,  409,  612,  409,
      612,  612,  409,  409,  612,  612,  612,  409,  420,  420,
      420,  612,  612,  420,  420,  420,  612,  420,  420,  499,
      612,  499,  612,  612,  499,  499,  612,  612,  612,  499,
      502,  612,  612,  612,  612,  502,  502,  612,  612,  612,
      502,  509,  612,  509,  509,  509,  612,  612,  509,  509,

      612,  612,  509,  509,  513,  612,  513,  513,  513,  612,
      612,  513,  513,  612,  612,  513,  513,  523,  612,  523,
      612,  612,  612,  612,  612,  612,  612,  523,  525,  612,
      525,  612,  612,  525,  525,  612,  612,  612,  525,  532,
      612,  532,  612,  612,  612,  612,  612,  612,  612,  532,
      534,  612,  534,  534,  534,  612,  612,  534,  534,  612,
      612,  534,  534,  546,  612,  546,  612,  612,  612,  612,
      612,  612,  612,  546,  547,  612,  547,  612,  612,  612,
      612,  612,  612,  612,  547,  548,  612,  548,  612,  612,
      612,  612,  612,  612,  612,  548,  567,  612,  567,  612,

      612,  612,  612,  612,  612,  612,  567,  568,  612,  568,
      612,  612,  612,  612,  612,  612,  612,  568,    3,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612
    } ;

static yyconst flex_int16_t yy_chk[1680] =
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        5,    7,    5,    7,    8,    9,   14,   11,    7,   12,
       13,    9,   11,    9,    9,   15,   18,    8,   16,   12,
       13,    8,   17,  595,   12,   13,   19,   17,   20,  329,
        8,    8,    8,  329,    8,    8,   21,   14,   27,   15,

       27,   22,   24,   24,  594,   24,   15,   18,   24,   16,
       18,   26,   16,   17,   25,   30,   39,   19,   20,   20,
        9,   10,  589,   21,   20,   32,   32,   21,  588,   10,
       10,   16,   22,   19,   10,   10,   10,   10,   10,   22,
       33,   33,   26,   34,   34,   25,   30,   39,  587,   26,
       25,   31,   10,   40,   43,   10,   10,   10,   10,   10,
       10,   36,   25,   44,   31,   47,   39,   36,   31,   10,
       46,   36,   48,   45,   10,   50,   49,   31,   31,   31,
       35,   31,   31,   51,   40,   43,   35,   46,   35,   35,
       35,   52,   54,   40,   44,  582,   47,   55,   46,   60,

       60,   46,   56,   48,   45,   49,   50,   49,   71,   44,
       57,  581,   58,   71,   51,   47,   36,   45,  578,   45,
      577,   47,   52,   54,   66,   66,   48,   50,   55,   62,
       73,   55,   72,   56,   74,   35,   38,   62,   62,   52,
       67,   57,   54,   58,   38,   38,   67,   56,   75,   38,
       38,   38,   38,   38,   61,   57,   61,   61,   58,   63,
      576,   63,   63,   72,  575,   74,  574,   38,   76,   79,
       38,   38,   38,   38,   38,   38,   64,   80,   73,   75,
       84,   84,  571,   73,   64,   64,  570,   81,   65,   64,
       64,   64,   64,   64,   65,   67,   65,   65,   82,   76,

       79,   83,   85,   85,   85,   86,   86,  103,   80,  104,
       64,   64,   64,   64,   64,   64,  569,   80,   81,   87,
      130,   87,   87,   88,   88,   89,   89,  568,   90,   82,
       90,   90,   83,   94,  567,   81,   96,   96,  103,   95,
      104,   94,   94,   65,   68,   82,  566,   95,   95,   98,
       98,  130,   68,   68,   99,  101,  101,   68,   68,   68,
       68,   68,   99,   99,  102,  102,   99,  564,  102,  106,
      106,  105,  108,  106,  108,  108,  109,  109,   68,   68,
       68,   68,   68,   68,   93,  110,  563,  110,  110,  115,
      115,  562,   93,   93,   95,  112,  561,   93,   93,   93,

       93,   93,  105,  112,  112,  113,  116,  113,  113,  122,
      122,  122,  123,  123,  116,  116,  124,  105,   93,   93,
       93,   93,   93,   93,  124,  124,  125,  127,  558,  127,
      127,  131,  128,  128,  125,  125,  128,  129,  129,  131,
      131,  129,  133,  133,  134,  134,  135,  136,  135,  135,
      137,  137,  140,  140,  557,  136,  136,  138,  556,  138,
      138,  141,  142,  141,  141,  143,  143,  129,  145,  145,
      142,  142,  146,  146,  147,  147,  148,  148,  152,  152,
      129,  129,  129,  153,  153,  154,  555,  154,  154,  155,
      155,  161,  161,  155,  156,  156,  156,  162,  163,  554,

      163,  163,  166,  162,  162,  164,  552,  164,  164,  167,
      166,  167,  167,  170,  166,  551,  166,  170,  170,  173,
      174,  174,  176,  166,  175,  175,  175,  173,  173,  550,
      176,  176,  177,  177,  166,  179,  166,  179,  179,  180,
      549,  180,  180,  182,  182,  183,  183,  189,  191,  189,
      189,  190,  190,  191,  191,  192,  192,  193,  548,  193,
      193,  194,  194,  195,  547,  195,  195,  197,  197,  198,
      203,  198,  198,  189,  200,  200,  201,  206,  203,  203,
      201,  201,  205,  205,  546,  206,  210,  210,  544,  206,
      211,  206,  211,  211,  212,  212,  543,  213,  206,  213,

      213,  214,  214,  215,  215,  220,  542,  220,  220,  206,
      223,  206,  223,  223,  225,  541,  225,  225,  227,  227,
      230,  230,  234,  234,  235,  237,  237,  238,  539,  238,
      238,  220,  235,  235,  240,  535,  240,  240,  247,  534,
      247,  247,  227,  249,  249,  250,  533,  250,  250,  251,
      251,  252,  532,  252,  252,  253,  253,  256,  256,  257,
      257,  258,  259,  259,  247,  260,  260,  531,  261,  258,
      261,  261,  530,  258,  528,  258,  262,  262,  263,  253,
      263,  263,  258,  268,  268,  269,  271,  269,  269,  527,
      271,  271,  525,  258,  523,  258,  274,  274,  275,  275,

      276,  276,  279,  522,  279,  279,  281,  268,  287,  287,
      281,  281,  288,  520,  288,  288,  289,  289,  290,  292,
      292,  519,  290,  290,  293,  293,  294,  294,  295,  295,
      296,  296,  297,  517,  297,  297,  298,  298,  299,  303,
      303,  516,  299,  299,  306,  306,  309,  309,  311,  311,
      312,  312,  313,  313,  320,  515,  316,  321,  321,  324,
      324,  320,  513,  303,  316,  316,  325,  325,  320,  326,
      326,  328,  328,  512,  333,  510,  313,  340,  340,  341,
      341,  321,  333,  333,  342,  342,  347,  347,  350,  357,
      357,  358,  358,  362,  509,  328,  350,  350,  364,  364,

      365,  362,  362,  372,  372,  376,  385,  385,  365,  365,
      508,  388,  507,  376,  376,  378,  505,  378,  378,  388,
      388,  390,  390,  391,  391,  392,  503,  392,  392,  396,
      396,  398,  398,  399,  399,  400,  401,  502,  401,  401,
      412,  412,  501,  400,  400,  402,  499,  402,  402,  408,
      498,  408,  408,  410,  496,  410,  410,  413,  495,  413,
      413,  414,  414,  415,  492,  415,  415,  418,  418,  419,
      490,  419,  419,  421,  421,  422,  422,  423,  485,  423,
      423,  424,  483,  424,  424,  426,  481,  426,  426,  430,
      480,  430,  430,  432,  478,  432,  432,  433,  476,  433,

      433,  435,  435,  436,  474,  436,  436,  437,  437,  438,
      472,  438,  438,  440,  440,  441,  471,  441,  441,  442,
      442,  443,  469,  443,  443,  444,  444,  445,  461,  445,
      445,  446,  448,  446,  446,  456,  448,  448,  451,  454,
      451,  451,  453,  452,  453,  453,  455,  450,  455,  455,
      457,  457,  458,  449,  458,  458,  459,  459,  460,  462,
      462,  447,  460,  460,  463,  439,  463,  463,  464,  464,
      465,  434,  465,  465,  466,  466,  467,  470,  467,  467,
      468,  468,  473,  473,  431,  470,  470,  475,  477,  475,
      475,  482,  477,  477,  479,  479,  484,  484,  429,  482,

      482,  486,  486,  427,  468,  487,  473,  487,  487,  488,
      488,  489,  425,  493,  420,  489,  489,  500,  479,  504,
      484,  493,  493,  497,  497,  500,  500,  504,  504,  506,
      506,  511,  518,  518,  521,  417,  526,  565,  565,  511,
      511,  529,  521,  521,  526,  526,  536,  497,  545,  529,
      529,  553,  416,  506,  536,  536,  545,  545,  572,  553,
      553,  573,  573,  579,  579,  580,  572,  572,  583,  583,
      584,  584,  590,  580,  580,  585,  585,  586,  586,  591,
      590,  590,  592,  593,  593,  596,  596,  591,  591,  411,
      592,  592,  597,  597,  598,  598,  599,  600,  600,  601,

      601,  599,  599,  602,  602,  603,  603,  604,  604,  606,
      409,  607,  608,  608,  609,  609,  406,  606,  606,  607,
      607,  610,  610,  611,  611,  613,  405,  613,  613,  613,
      403,  397,  613,  613,  613,  395,  613,  613,  614,  394,
      393,  614,  614,  389,  387,  614,  386,  382,  381,  380,
      614,  615,  379,  377,  615,  615,  615,  375,  615,  370,
      369,  368,  367,  615,  616,  616,  616,  616,  616,  616,
      616,  616,  616,  616,  616,  616,  616,  617,  366,  617,
      361,  355,  354,  353,  617,  617,  352,  351,  349,  617,
      618,  348,  618,  346,  618,  345,  339,  338,  337,  336,

      618,  619,  335,  619,  334,  332,  619,  619,  331,  330,
      327,  619,  620,  322,  620,  620,  620,  319,  318,  620,
      620,  317,  315,  620,  620,  621,  314,  621,  307,  621,
      621,  621,  304,  302,  301,  621,  622,  622,  622,  300,
      286,  622,  622,  622,  285,  622,  622,  623,  623,  623,
      284,  282,  623,  623,  623,  280,  623,  623,  624,  278,
      273,  272,  270,  624,  624,  267,  266,  265,  624,  625,
      625,  625,  264,  254,  625,  625,  246,  625,  625,  625,
      626,  245,  626,  244,  243,  626,  626,  241,  239,  233,
      626,  627,  627,  627,  231,  228,  627,  627,  226,  224,

      627,  627,  628,  221,  628,  219,  218,  628,  628,  217,
      216,  208,  628,  629,  207,  629,  204,  202,  629,  629,
      188,  187,  186,  629,  630,  630,  630,  185,  184,  630,
      630,  181,  178,  630,  630,  631,  172,  631,  171,  169,
      631,  631,  168,  165,  160,  631,  632,  632,  632,  159,
      158,  632,  632,  157,  151,  632,  632,  633,  149,  633,
      633,  633,  139,  132,  633,  633,  126,  121,  633,  633,
      634,  120,  634,  119,  118,  634,  634,  117,  114,  111,
      634,  635,  635,  635,  107,  100,  635,  635,   97,   91,
      635,  635,  636,  636,  636,   78,   77,  636,  636,   70,

       69,  636,  636,  637,   59,   53,   42,   41,  637,  637,
       37,   29,   28,  637,  638,   23,    3,    0,    0,  638,
      638,    0,    0,    0,  638,  639,  639,  639,    0,    0,
      639,  639,  639,    0,  639,  639,  640,  640,  640,    0,
        0,  640,  640,  640,    0,  640,  640,  641,    0,  641,
        0,    0,  641,  641,    0,    0,    0,  641,  642,  642,
      642,    0,    0,  642,  642,  642,    0,  642,  642,  643,
        0,  643,    0,    0,  643,  643,    0,    0,    0,  643,
      644,    0,    0,    0,    0,  644,  644,    0,    0,    0,
      644,  645,    0,  645,  645,  645,    0,    0,  645,  645,

        0,    0,  645,  645,  646,    0,  646,  646,  646,    0,
        0,  646,  646,    0,    0,  646,  646,  647,    0,  647,
        0,    0,    0,    0,    0,    0,    0,  647,  648,    0,
      648,    0,    0,  648,  648,    0,    0,    0,  648,  649,
        0,  649,    0,    0,    0,    0,    0,    0,    0,  649,
      650,    0,  650,  650,  650,    0,    0,  650,  650,    0,
        0,  650,  650,  651,    0,  651,    0,    0,    0,    0,
        0,    0,    0,  651,  652,    0,  652,    0,    0,    0,
        0,    0,    0,    0,  652,  653,    0,  653,    0,    0,
        0,    0,    0,    0,    0,  653,  654,    0,  654,    0,

        0,    0,    0,    0,    0,    0,  654,  655,    0,  655,
        0,    0,    0,    0,    0,    0,    0,  655,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
      612,  612,  612,  612,  612,  612,  612,  612,  612
    } ;

static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;

extern int ipfilter_flex_debug;
int ipfilter_flex_debug = 0;

/* The intent behind this definition is that it'll catch
 * any uses of REJECT which flex missed.
 */
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *ipfiltertext;
#line 1 "ipfilter.ll"
/* -*-c-*- */
/*
 * WallFire -- a comprehensive firewall administration tool.
 * 
 * Copyright (C) 2001 Hervé Eychenne <rv@wallfire.org>
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 * 
 */
#line 28 "ipfilter.ll"
using namespace std;

#define YY_NO_UNPUT

#define IPLEN 16

#include <netdb.h> /* for getprotobyname */

#include "ipfilter.h"
#include "common.h"
#include "defs.h"

#define IPF_OPT_SRC 4
#define IPF_OPT_DST 8
#define IPF_OPT_RES 16
#define IPF_OPT_PORT 32
#define IPF_OPT_RPORT 64

#define SHORTLEN 32
#define SHORTLEN_S "32"

static void ipfilter_parse_data(char* input);
static void ipfilter_parse_data_count(char* input);
static void ipfilter_parse_ips(char* input, unsigned char mode);
static void ipfilter_parse_proto(char *input);
static void ipfilter_parse_tcpflags(char* input);

static bool parseerror = false;
static wf_logentry* logentry;
#line 1076 "ipfilter.cc"

#define INITIAL 0

#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 * down here because we want the user's section 1 to have been scanned first.
 * The user has a chance to override it with an option.
 */
#include <unistd.h>
#endif

#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif

/* Macros after this point can all be overridden by user definitions in
 * section 1.
 */

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int ipfilterwrap (void );
#else
extern int ipfilterwrap (void );
#endif
#endif

    static void yyunput (int c,char *buf_ptr  );
    
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif

#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * );
#endif

#ifndef YY_NO_INPUT

#ifdef __cplusplus
static int yyinput (void );
#else
static int input (void );
#endif

#endif

/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif

/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite().
 */
#define ECHO (void) fwrite( ipfiltertext, ipfilterleng, 1, ipfilterout )
#endif

/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
      if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
            { \
            int c = '*'; \
            size_t n; \
            for ( n = 0; n < max_size && \
                       (c = getc( ipfilterin )) != EOF && c != '\n'; ++n ) \
                  buf[n] = (char) c; \
            if ( c == '\n' ) \
                  buf[n++] = (char) c; \
            if ( c == EOF && ferror( ipfilterin ) ) \
                  YY_FATAL_ERROR( "input in flex scanner failed" ); \
            result = n; \
            } \
      else \
            { \
            errno=0; \
            while ( (result = fread(buf, 1, max_size, ipfilterin))==0 && ferror(ipfilterin)) \
                  { \
                  if( errno != EINTR) \
                        { \
                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
                        break; \
                        } \
                  errno=0; \
                  clearerr(ipfilterin); \
                  } \
            }\
\

#endif

/* No semi-colon after return; correct usage is to write "yyterminate();" -
 * we don't want an extra ';' after the "return" because that will cause
 * some compilers to complain about unreachable statements.
 */
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif

/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif

/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif

/* end tables serialization structures and prototypes */

/* Default declaration of generated scanner - a define so the user can
 * easily add parameters.
 */
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1

extern int ipfilterlex (void);

#define YY_DECL int ipfilterlex (void)
#endif /* !YY_DECL */

/* Code executed at the beginning of each rule, after ipfiltertext and ipfilterleng
 * have been set up.
 */
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif

/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif

#define YY_RULE_SETUP \
      YY_USER_ACTION

/** The main scanner function which does all the work.
 */
YY_DECL
{
      register yy_state_type yy_current_state;
      register char *yy_cp, *yy_bp;
      register int yy_act;
    
#line 74 "ipfilter.ll"


#line 1230 "ipfilter.cc"

      if ( (yy_init) )
            {
            (yy_init) = 0;

#ifdef YY_USER_INIT
            YY_USER_INIT;
#endif

            if ( ! (yy_start) )
                  (yy_start) = 1;   /* first start state */

            if ( ! ipfilterin )
                  ipfilterin = stdin;

            if ( ! ipfilterout )
                  ipfilterout = stdout;

            if ( ! YY_CURRENT_BUFFER ) {
                  ipfilterensure_buffer_stack ();
                  YY_CURRENT_BUFFER_LVALUE =
                        ipfilter_create_buffer(ipfilterin,YY_BUF_SIZE );
            }

            ipfilter_load_buffer_state( );
            }

      while ( 1 )       /* loops until end-of-file is reached */
            {
            yy_cp = (yy_c_buf_p);

            /* Support of ipfiltertext. */
            *yy_cp = (yy_hold_char);

            /* yy_bp points to the position in yy_ch_buf of the start of
             * the current run.
             */
            yy_bp = yy_cp;

            yy_current_state = (yy_start);
yy_match:
            do
                  {
                  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
                  if ( yy_accept[yy_current_state] )
                        {
                        (yy_last_accepting_state) = yy_current_state;
                        (yy_last_accepting_cpos) = yy_cp;
                        }
                  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                        {
                        yy_current_state = (int) yy_def[yy_current_state];
                        if ( yy_current_state >= 613 )
                              yy_c = yy_meta[(unsigned int) yy_c];
                        }
                  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                  ++yy_cp;
                  }
            while ( yy_base[yy_current_state] != 1619 );

yy_find_action:
            yy_act = yy_accept[yy_current_state];
            if ( yy_act == 0 )
                  { /* have to back up */
                  yy_cp = (yy_last_accepting_cpos);
                  yy_current_state = (yy_last_accepting_state);
                  yy_act = yy_accept[yy_current_state];
                  }

            YY_DO_BEFORE_ACTION;

do_action:  /* This label is used only to access EOF actions. */

            switch ( yy_act )
      { /* beginning of action switch */
                  case 0: /* must back up */
                  /* undo the effects of YY_DO_BEFORE_ACTION */
                  *yy_cp = (yy_hold_char);
                  yy_cp = (yy_last_accepting_cpos);
                  yy_current_state = (yy_last_accepting_state);
                  goto yy_find_action;

case 1:
YY_RULE_SETUP
#line 76 "ipfilter.ll"
parse_date(ipfiltertext, logentry);
      YY_BREAK
case 2:
YY_RULE_SETUP
#line 77 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 3:
YY_RULE_SETUP
#line 78 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 4:
YY_RULE_SETUP
#line 79 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 5:
YY_RULE_SETUP
#line 80 "ipfilter.ll"
ipfilter_parse_data(ipfiltertext);
      YY_BREAK
case 6:
YY_RULE_SETUP
#line 81 "ipfilter.ll"
ipfilter_parse_data_count(ipfiltertext);
      YY_BREAK
case 7:
YY_RULE_SETUP
#line 82 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext, IPF_OPT_SRC);
      YY_BREAK
case 8:
YY_RULE_SETUP
#line 83 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext + 4, IPF_OPT_DST);
      YY_BREAK
case 9:
YY_RULE_SETUP
#line 84 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext, IPF_OPT_SRC|IPF_OPT_PORT);
      YY_BREAK
case 10:
YY_RULE_SETUP
#line 85 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext + 4, IPF_OPT_DST|IPF_OPT_PORT);
      YY_BREAK
case 11:
YY_RULE_SETUP
#line 86 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext, IPF_OPT_SRC|IPF_OPT_RES);
      YY_BREAK
case 12:
YY_RULE_SETUP
#line 87 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext + 4, IPF_OPT_DST|IPF_OPT_RES);
      YY_BREAK
case 13:
YY_RULE_SETUP
#line 88 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext, IPF_OPT_SRC|IPF_OPT_RES|IPF_OPT_PORT);
      YY_BREAK
case 14:
YY_RULE_SETUP
#line 89 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext + 4, IPF_OPT_DST|IPF_OPT_RES|IPF_OPT_PORT);
      YY_BREAK
case 15:
YY_RULE_SETUP
#line 90 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext, IPF_OPT_SRC|IPF_OPT_RPORT);
      YY_BREAK
case 16:
YY_RULE_SETUP
#line 91 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext + 4, IPF_OPT_DST|IPF_OPT_RPORT);
      YY_BREAK
case 17:
YY_RULE_SETUP
#line 92 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext, IPF_OPT_SRC|IPF_OPT_RES|IPF_OPT_RPORT);
      YY_BREAK
case 18:
YY_RULE_SETUP
#line 93 "ipfilter.ll"
ipfilter_parse_ips(ipfiltertext + 4, IPF_OPT_DST|IPF_OPT_RES|IPF_OPT_RPORT);
      YY_BREAK
case 19:
YY_RULE_SETUP
#line 94 "ipfilter.ll"
ipfilter_parse_proto(ipfiltertext + 3);
      YY_BREAK
case 20:
YY_RULE_SETUP
#line 95 "ipfilter.ll"
logentry->datalen = atoi(ipfiltertext + 4);
      YY_BREAK
case 21:
YY_RULE_SETUP
#line 96 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 22:
YY_RULE_SETUP
#line 97 "ipfilter.ll"
{
  int sport, dport;
  if (sscanf(ipfiltertext, "icmp %d/%d", &sport, &dport) == 2) {
    logentry->sport = sport;
    logentry->dport = dport;
  }
}
      YY_BREAK
case 23:
YY_RULE_SETUP
#line 104 "ipfilter.ll"
logentry->sport = 8; logentry->dport = 0;
      YY_BREAK
case 24:
YY_RULE_SETUP
#line 105 "ipfilter.ll"
logentry->sport = 4; logentry->dport = 0;
      YY_BREAK
case 25:
YY_RULE_SETUP
#line 106 "ipfilter.ll"
logentry->sport = 3; logentry->dport = 1;
      YY_BREAK
case 26:
YY_RULE_SETUP
#line 107 "ipfilter.ll"
logentry->sport = 3; logentry->dport = 3;
      YY_BREAK
case 27:
YY_RULE_SETUP
#line 108 "ipfilter.ll"
logentry->sport = 3; logentry->dport = 10;
      YY_BREAK
case 28:
YY_RULE_SETUP
#line 109 "ipfilter.ll"
logentry->sport = 11; logentry->dport = 1;
      YY_BREAK
case 29:
YY_RULE_SETUP
#line 110 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 30:
YY_RULE_SETUP
#line 111 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 31:
YY_RULE_SETUP
#line 112 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 32:
YY_RULE_SETUP
#line 113 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 33:
YY_RULE_SETUP
#line 114 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 34:
YY_RULE_SETUP
#line 115 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 35:
YY_RULE_SETUP
#line 116 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 36:
YY_RULE_SETUP
#line 117 "ipfilter.ll"
ipfilter_parse_tcpflags(ipfiltertext + 1);
      YY_BREAK
case 37:
YY_RULE_SETUP
#line 118 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 38:
YY_RULE_SETUP
#line 119 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 39:
YY_RULE_SETUP
#line 120 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 40:
YY_RULE_SETUP
#line 121 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 41:
YY_RULE_SETUP
#line 122 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 42:
YY_RULE_SETUP
#line 123 "ipfilter.ll"
{
  // parseerror = true; ALL@@7 why ?
}
      YY_BREAK
case 43:
YY_RULE_SETUP
#line 126 "ipfilter.ll"
/* ignore whitespace */
      YY_BREAK
case 44:
/* rule 44 can match eol */
YY_RULE_SETUP
#line 127 "ipfilter.ll"
/* ignore */
      YY_BREAK
case 45:
YY_RULE_SETUP
#line 128 "ipfilter.ll"
if (verbose) fprintf(stderr, _("Unrecognized token: `%s'\n"), ipfiltertext);
      YY_BREAK
case 46:
YY_RULE_SETUP
#line 129 "ipfilter.ll"
if (verbose) fprintf(stderr, _("Unrecognized character: `%s'\n"), ipfiltertext);
      YY_BREAK
case 47:
YY_RULE_SETUP
#line 131 "ipfilter.ll"
ECHO;
      YY_BREAK
#line 1557 "ipfilter.cc"
case YY_STATE_EOF(INITIAL):
      yyterminate();

      case YY_END_OF_BUFFER:
            {
            /* Amount of text matched not including the EOB char. */
            int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;

            /* Undo the effects of YY_DO_BEFORE_ACTION. */
            *yy_cp = (yy_hold_char);
            YY_RESTORE_YY_MORE_OFFSET

            if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
                  {
                  /* We're scanning a new file or input source.  It's
                   * possible that this happened because the user
                   * just pointed ipfilterin at a new source and called
                   * ipfilterlex().  If so, then we have to assure
                   * consistency between YY_CURRENT_BUFFER and our
                   * globals.  Here is the right place to do so, because
                   * this is the first action (other than possibly a
                   * back-up) that will match for the new input source.
                   */
                  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
                  YY_CURRENT_BUFFER_LVALUE->yy_input_file = ipfilterin;
                  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
                  }

            /* Note that here we test for yy_c_buf_p "<=" to the position
             * of the first EOB in the buffer, since yy_c_buf_p will
             * already have been incremented past the NUL character
             * (since all states make transitions on EOB to the
             * end-of-buffer state).  Contrast this with the test
             * in input().
             */
            if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
                  { /* This was really a NUL. */
                  yy_state_type yy_next_state;

                  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;

                  yy_current_state = yy_get_previous_state(  );

                  /* Okay, we're now positioned to make the NUL
                   * transition.  We couldn't have
                   * yy_get_previous_state() go ahead and do it
                   * for us because it doesn't know how to deal
                   * with the possibility of jamming (and we don't
                   * want to build jamming into it because then it
                   * will run more slowly).
                   */

                  yy_next_state = yy_try_NUL_trans( yy_current_state );

                  yy_bp = (yytext_ptr) + YY_MORE_ADJ;

                  if ( yy_next_state )
                        {
                        /* Consume the NUL. */
                        yy_cp = ++(yy_c_buf_p);
                        yy_current_state = yy_next_state;
                        goto yy_match;
                        }

                  else
                        {
                        yy_cp = (yy_c_buf_p);
                        goto yy_find_action;
                        }
                  }

            else switch ( yy_get_next_buffer(  ) )
                  {
                  case EOB_ACT_END_OF_FILE:
                        {
                        (yy_did_buffer_switch_on_eof) = 0;

                        if ( ipfilterwrap( ) )
                              {
                              /* Note: because we've taken care in
                               * yy_get_next_buffer() to have set up
                               * ipfiltertext, we can now set up
                               * yy_c_buf_p so that if some total
                               * hoser (like flex itself) wants to
                               * call the scanner after we return the
                               * YY_NULL, it'll still work - another
                               * YY_NULL will get returned.
                               */
                              (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;

                              yy_act = YY_STATE_EOF(YY_START);
                              goto do_action;
                              }

                        else
                              {
                              if ( ! (yy_did_buffer_switch_on_eof) )
                                    YY_NEW_FILE;
                              }
                        break;
                        }

                  case EOB_ACT_CONTINUE_SCAN:
                        (yy_c_buf_p) =
                              (yytext_ptr) + yy_amount_of_matched_text;

                        yy_current_state = yy_get_previous_state(  );

                        yy_cp = (yy_c_buf_p);
                        yy_bp = (yytext_ptr) + YY_MORE_ADJ;
                        goto yy_match;

                  case EOB_ACT_LAST_MATCH:
                        (yy_c_buf_p) =
                        &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];

                        yy_current_state = yy_get_previous_state(  );

                        yy_cp = (yy_c_buf_p);
                        yy_bp = (yytext_ptr) + YY_MORE_ADJ;
                        goto yy_find_action;
                  }
            break;
            }

      default:
            YY_FATAL_ERROR(
                  "fatal flex scanner internal error--no action found" );
      } /* end of action switch */
            } /* end of scanning one token */
} /* end of ipfilterlex */

/* yy_get_next_buffer - try to read in a new buffer
 *
 * Returns a code representing an action:
 *    EOB_ACT_LAST_MATCH -
 *    EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 *    EOB_ACT_END_OF_FILE - end of file
 */
static int yy_get_next_buffer (void)
{
      register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
      register char *source = (yytext_ptr);
      register int number_to_move, i;
      int ret_val;

      if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
            YY_FATAL_ERROR(
            "fatal flex scanner internal error--end of buffer missed" );

      if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
            { /* Don't try to fill the buffer, so this is an EOF. */
            if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
                  {
                  /* We matched a single character, the EOB, so
                   * treat this as a final EOF.
                   */
                  return EOB_ACT_END_OF_FILE;
                  }

            else
                  {
                  /* We matched some text prior to the EOB, first
                   * process it.
                   */
                  return EOB_ACT_LAST_MATCH;
                  }
            }

      /* Try to read more data. */

      /* First move last chars to start of buffer. */
      number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;

      for ( i = 0; i < number_to_move; ++i )
            *(dest++) = *(source++);

      if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
            /* don't do the read, it's not guaranteed to return an EOF,
             * just force an EOF
             */
            YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;

      else
            {
                  size_t num_to_read =
                  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;

            while ( num_to_read <= 0 )
                  { /* Not enough room in the buffer - grow it. */

                  /* just a shorter name for the current buffer */
                  YY_BUFFER_STATE b = YY_CURRENT_BUFFER;

                  int yy_c_buf_p_offset =
                        (int) ((yy_c_buf_p) - b->yy_ch_buf);

                  if ( b->yy_is_our_buffer )
                        {
                        int new_size = b->yy_buf_size * 2;

                        if ( new_size <= 0 )
                              b->yy_buf_size += b->yy_buf_size / 8;
                        else
                              b->yy_buf_size *= 2;

                        b->yy_ch_buf = (char *)
                              /* Include room in for 2 EOB chars. */
                              ipfilterrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
                        }
                  else
                        /* Can't grow it, we don't own it. */
                        b->yy_ch_buf = 0;

                  if ( ! b->yy_ch_buf )
                        YY_FATAL_ERROR(
                        "fatal error - scanner input buffer overflow" );

                  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];

                  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
                                    number_to_move - 1;

                  }

            if ( num_to_read > YY_READ_BUF_SIZE )
                  num_to_read = YY_READ_BUF_SIZE;

            /* Read in more data. */
            YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
                  (yy_n_chars), num_to_read );

            YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
            }

      if ( (yy_n_chars) == 0 )
            {
            if ( number_to_move == YY_MORE_ADJ )
                  {
                  ret_val = EOB_ACT_END_OF_FILE;
                  ipfilterrestart(ipfilterin  );
                  }

            else
                  {
                  ret_val = EOB_ACT_LAST_MATCH;
                  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
                        YY_BUFFER_EOF_PENDING;
                  }
            }

      else
            ret_val = EOB_ACT_CONTINUE_SCAN;

      (yy_n_chars) += number_to_move;
      YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
      YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;

      (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];

      return ret_val;
}

/* yy_get_previous_state - get the state just before the EOB char was reached */

    static yy_state_type yy_get_previous_state (void)
{
      register yy_state_type yy_current_state;
      register char *yy_cp;
    
      yy_current_state = (yy_start);

      for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
            {
            register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
            if ( yy_accept[yy_current_state] )
                  {
                  (yy_last_accepting_state) = yy_current_state;
                  (yy_last_accepting_cpos) = yy_cp;
                  }
            while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                  {
                  yy_current_state = (int) yy_def[yy_current_state];
                  if ( yy_current_state >= 613 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                  }
            yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
            }

      return yy_current_state;
}

/* yy_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
 *    next_state = yy_try_NUL_trans( current_state );
 */
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
{
      register int yy_is_jam;
      register char *yy_cp = (yy_c_buf_p);

      register YY_CHAR yy_c = 1;
      if ( yy_accept[yy_current_state] )
            {
            (yy_last_accepting_state) = yy_current_state;
            (yy_last_accepting_cpos) = yy_cp;
            }
      while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
            {
            yy_current_state = (int) yy_def[yy_current_state];
            if ( yy_current_state >= 613 )
                  yy_c = yy_meta[(unsigned int) yy_c];
            }
      yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
      yy_is_jam = (yy_current_state == 612);

      return yy_is_jam ? 0 : yy_current_state;
}

    static void yyunput (int c, register char * yy_bp )
{
      register char *yy_cp;
    
    yy_cp = (yy_c_buf_p);

      /* undo effects of setting up ipfiltertext */
      *yy_cp = (yy_hold_char);

      if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
            { /* need to shift things up to make room */
            /* +2 for EOB chars. */
            register int number_to_move = (yy_n_chars) + 2;
            register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
                              YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
            register char *source =
                        &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];

            while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
                  *--dest = *--source;

            yy_cp += (int) (dest - source);
            yy_bp += (int) (dest - source);
            YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
                  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;

            if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
                  YY_FATAL_ERROR( "flex scanner push-back overflow" );
            }

      *--yy_cp = (char) c;

      (yytext_ptr) = yy_bp;
      (yy_hold_char) = *yy_cp;
      (yy_c_buf_p) = yy_cp;
}

#ifndef YY_NO_INPUT
#ifdef __cplusplus
    static int yyinput (void)
#else
    static int input  (void)
#endif

{
      int c;
    
      *(yy_c_buf_p) = (yy_hold_char);

      if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
            {
            /* yy_c_buf_p now points to the character we want to return.
             * If this occurs *before* the EOB characters, then it's a
             * valid NUL; if not, then we've hit the end of the buffer.
             */
            if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
                  /* This was really a NUL. */
                  *(yy_c_buf_p) = '\0';

            else
                  { /* need more input */
                  int offset = (yy_c_buf_p) - (yytext_ptr);
                  ++(yy_c_buf_p);

                  switch ( yy_get_next_buffer(  ) )
                        {
                        case EOB_ACT_LAST_MATCH:
                              /* This happens because yy_g_n_b()
                               * sees that we've accumulated a
                               * token and flags that we need to
                               * try matching the token before
                               * proceeding.  But for input(),
                               * there's no matching to consider.
                               * So convert the EOB_ACT_LAST_MATCH
                               * to EOB_ACT_END_OF_FILE.
                               */

                              /* Reset buffer status. */
                              ipfilterrestart(ipfilterin );

                              /*FALLTHROUGH*/

                        case EOB_ACT_END_OF_FILE:
                              {
                              if ( ipfilterwrap( ) )
                                    return EOF;

                              if ( ! (yy_did_buffer_switch_on_eof) )
                                    YY_NEW_FILE;
#ifdef __cplusplus
                              return yyinput();
#else
                              return input();
#endif
                              }

                        case EOB_ACT_CONTINUE_SCAN:
                              (yy_c_buf_p) = (yytext_ptr) + offset;
                              break;
                        }
                  }
            }

      c = *(unsigned char *) (yy_c_buf_p);      /* cast for 8-bit char's */
      *(yy_c_buf_p) = '\0';   /* preserve ipfiltertext */
      (yy_hold_char) = *++(yy_c_buf_p);

      return c;
}
#endif      /* ifndef YY_NO_INPUT */

/** Immediately switch to a different input stream.
 * @param input_file A readable stream.
 * 
 * @note This function does not reset the start condition to @c INITIAL .
 */
    void ipfilterrestart  (FILE * input_file )
{
    
      if ( ! YY_CURRENT_BUFFER ){
        ipfilterensure_buffer_stack ();
            YY_CURRENT_BUFFER_LVALUE =
            ipfilter_create_buffer(ipfilterin,YY_BUF_SIZE );
      }

      ipfilter_init_buffer(YY_CURRENT_BUFFER,input_file );
      ipfilter_load_buffer_state( );
}

/** Switch to a different input buffer.
 * @param new_buffer The new input buffer.
 * 
 */
    void ipfilter_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
{
    
      /* TODO. We should be able to replace this entire function body
       * with
       *          ipfilterpop_buffer_state();
       *          ipfilterpush_buffer_state(new_buffer);
     */
      ipfilterensure_buffer_stack ();
      if ( YY_CURRENT_BUFFER == new_buffer )
            return;

      if ( YY_CURRENT_BUFFER )
            {
            /* Flush out information for old buffer. */
            *(yy_c_buf_p) = (yy_hold_char);
            YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
            YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
            }

      YY_CURRENT_BUFFER_LVALUE = new_buffer;
      ipfilter_load_buffer_state( );

      /* We don't actually know whether we did this switch during
       * EOF (ipfilterwrap()) processing, but the only time this flag
       * is looked at is after ipfilterwrap() is called, so it's safe
       * to go ahead and always set it.
       */
      (yy_did_buffer_switch_on_eof) = 1;
}

static void ipfilter_load_buffer_state  (void)
{
      (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
      (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
      ipfilterin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
      (yy_hold_char) = *(yy_c_buf_p);
}

/** Allocate and initialize an input buffer state.
 * @param file A readable stream.
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 * 
 * @return the allocated buffer state.
 */
    YY_BUFFER_STATE ipfilter_create_buffer  (FILE * file, int  size )
{
      YY_BUFFER_STATE b;
    
      b = (YY_BUFFER_STATE) ipfilteralloc(sizeof( struct yy_buffer_state )  );
      if ( ! b )
            YY_FATAL_ERROR( "out of dynamic memory in ipfilter_create_buffer()" );

      b->yy_buf_size = size;

      /* yy_ch_buf has to be 2 characters longer than the size given because
       * we need to put in 2 end-of-buffer characters.
       */
      b->yy_ch_buf = (char *) ipfilteralloc(b->yy_buf_size + 2  );
      if ( ! b->yy_ch_buf )
            YY_FATAL_ERROR( "out of dynamic memory in ipfilter_create_buffer()" );

      b->yy_is_our_buffer = 1;

      ipfilter_init_buffer(b,file );

      return b;
}

/** Destroy the buffer.
 * @param b a buffer created with ipfilter_create_buffer()
 * 
 */
    void ipfilter_delete_buffer (YY_BUFFER_STATE  b )
{
    
      if ( ! b )
            return;

      if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
            YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;

      if ( b->yy_is_our_buffer )
            ipfilterfree((void *) b->yy_ch_buf  );

      ipfilterfree((void *) b  );
}

#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
    
/* Initializes or reinitializes a buffer.
 * This function is sometimes called more than once on the same buffer,
 * such as during a ipfilterrestart() or at EOF.
 */
    static void ipfilter_init_buffer  (YY_BUFFER_STATE  b, FILE * file )

{
      int oerrno = errno;
    
      ipfilter_flush_buffer(b );

      b->yy_input_file = file;
      b->yy_fill_buffer = 1;

    /* If b is the current buffer, then ipfilter_init_buffer was _probably_
     * called from ipfilterrestart() or through yy_get_next_buffer.
     * In that case, we don't want to reset the lineno or column.
     */
    if (b != YY_CURRENT_BUFFER){
        b->yy_bs_lineno = 1;
        b->yy_bs_column = 0;
    }

        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
    
      errno = oerrno;
}

/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
 * 
 */
    void ipfilter_flush_buffer (YY_BUFFER_STATE  b )
{
      if ( ! b )
            return;

      b->yy_n_chars = 0;

      /* We always need two end-of-buffer characters.  The first causes
       * a transition to the end-of-buffer state.  The second causes
       * a jam in that state.
       */
      b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
      b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;

      b->yy_buf_pos = &b->yy_ch_buf[0];

      b->yy_at_bol = 1;
      b->yy_buffer_status = YY_BUFFER_NEW;

      if ( b == YY_CURRENT_BUFFER )
            ipfilter_load_buffer_state( );
}

/** Pushes the new state onto the stack. The new state becomes
 *  the current state. This function will allocate the stack
 *  if necessary.
 *  @param new_buffer The new state.
 *  
 */
void ipfilterpush_buffer_state (YY_BUFFER_STATE new_buffer )
{
      if (new_buffer == NULL)
            return;

      ipfilterensure_buffer_stack();

      /* This block is copied from ipfilter_switch_to_buffer. */
      if ( YY_CURRENT_BUFFER )
            {
            /* Flush out information for old buffer. */
            *(yy_c_buf_p) = (yy_hold_char);
            YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
            YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
            }

      /* Only push if top exists. Otherwise, replace top. */
      if (YY_CURRENT_BUFFER)
            (yy_buffer_stack_top)++;
      YY_CURRENT_BUFFER_LVALUE = new_buffer;

      /* copied from ipfilter_switch_to_buffer. */
      ipfilter_load_buffer_state( );
      (yy_did_buffer_switch_on_eof) = 1;
}

/** Removes and deletes the top of the stack, if present.
 *  The next element becomes the new top.
 *  
 */
void ipfilterpop_buffer_state (void)
{
      if (!YY_CURRENT_BUFFER)
            return;

      ipfilter_delete_buffer(YY_CURRENT_BUFFER );
      YY_CURRENT_BUFFER_LVALUE = NULL;
      if ((yy_buffer_stack_top) > 0)
            --(yy_buffer_stack_top);

      if (YY_CURRENT_BUFFER) {
            ipfilter_load_buffer_state( );
            (yy_did_buffer_switch_on_eof) = 1;
      }
}

/* Allocates the stack if it does not exist.
 *  Guarantees space for at least one push.
 */
static void ipfilterensure_buffer_stack (void)
{
      int num_to_alloc;
    
      if (!(yy_buffer_stack)) {

            /* First allocation is just for 2 elements, since we don't know if this
             * scanner will even need a stack. We use 2 instead of 1 to avoid an
             * immediate realloc on the next call.
         */
            num_to_alloc = 1;
            (yy_buffer_stack) = (struct yy_buffer_state**)ipfilteralloc
                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
                                                );
            
            memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
                        
            (yy_buffer_stack_max) = num_to_alloc;
            (yy_buffer_stack_top) = 0;
            return;
      }

      if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){

            /* Increase the buffer to prepare for a possible push. */
            int grow_size = 8 /* arbitrary grow size */;

            num_to_alloc = (yy_buffer_stack_max) + grow_size;
            (yy_buffer_stack) = (struct yy_buffer_state**)ipfilterrealloc
                                                ((yy_buffer_stack),
                                                num_to_alloc * sizeof(struct yy_buffer_state*)
                                                );

            /* zero only the new slots.*/
            memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
            (yy_buffer_stack_max) = num_to_alloc;
      }
}

/** Setup the input buffer state to scan directly from a user-specified character buffer.
 * @param base the character buffer
 * @param size the size in bytes of the character buffer
 * 
 * @return the newly allocated buffer state object. 
 */
YY_BUFFER_STATE ipfilter_scan_buffer  (char * base, yy_size_t  size )
{
      YY_BUFFER_STATE b;
    
      if ( size < 2 ||
           base[size-2] != YY_END_OF_BUFFER_CHAR ||
           base[size-1] != YY_END_OF_BUFFER_CHAR )
            /* They forgot to leave room for the EOB's. */
            return 0;

      b = (YY_BUFFER_STATE) ipfilteralloc(sizeof( struct yy_buffer_state )  );
      if ( ! b )
            YY_FATAL_ERROR( "out of dynamic memory in ipfilter_scan_buffer()" );

      b->yy_buf_size = size - 2;    /* "- 2" to take care of EOB's */
      b->yy_buf_pos = b->yy_ch_buf = base;
      b->yy_is_our_buffer = 0;
      b->yy_input_file = 0;
      b->yy_n_chars = b->yy_buf_size;
      b->yy_is_interactive = 0;
      b->yy_at_bol = 1;
      b->yy_fill_buffer = 0;
      b->yy_buffer_status = YY_BUFFER_NEW;

      ipfilter_switch_to_buffer(b  );

      return b;
}

/** Setup the input buffer state to scan a string. The next call to ipfilterlex() will
 * scan from a @e copy of @a str.
 * @param str a NUL-terminated string to scan
 * 
 * @return the newly allocated buffer state object.
 * @note If you want to scan bytes that may contain NUL values, then use
 *       ipfilter_scan_bytes() instead.
 */
YY_BUFFER_STATE ipfilter_scan_string (yyconst char * yy_str )
{
    
      return ipfilter_scan_bytes(yy_str,strlen(yy_str) );
}

/** Setup the input buffer state to scan the given bytes. The next call to ipfilterlex() will
 * scan from a @e copy of @a bytes.
 * @param bytes the byte buffer to scan
 * @param len the number of bytes in the buffer pointed to by @a bytes.
 * 
 * @return the newly allocated buffer state object.
 */
YY_BUFFER_STATE ipfilter_scan_bytes  (yyconst char * bytes, int  len )
{
      YY_BUFFER_STATE b;
      char *buf;
      yy_size_t n;
      int i;
    
      /* Get memory for full buffer, including space for trailing EOB's. */
      n = len + 2;
      buf = (char *) ipfilteralloc(n  );
      if ( ! buf )
            YY_FATAL_ERROR( "out of dynamic memory in ipfilter_scan_bytes()" );

      for ( i = 0; i < len; ++i )
            buf[i] = bytes[i];

      buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;

      b = ipfilter_scan_buffer(buf,n );
      if ( ! b )
            YY_FATAL_ERROR( "bad buffer in ipfilter_scan_bytes()" );

      /* It's okay to grow etc. this buffer, and we should throw it
       * away when we're done.
       */
      b->yy_is_our_buffer = 1;

      return b;
}

#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif

static void yy_fatal_error (yyconst char* msg )
{
      (void) fprintf( stderr, "%s\n", msg );
      exit( YY_EXIT_FAILURE );
}

/* Redefine yyless() so it works in section 3 code. */

#undef yyless
#define yyless(n) \
      do \
            { \
            /* Undo effects of setting up ipfiltertext. */ \
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
            ipfiltertext[ipfilterleng] = (yy_hold_char); \
            (yy_c_buf_p) = ipfiltertext + yyless_macro_arg; \
            (yy_hold_char) = *(yy_c_buf_p); \
            *(yy_c_buf_p) = '\0'; \
            ipfilterleng = yyless_macro_arg; \
            } \
      while ( 0 )

/* Accessor  methods (get/set functions) to struct members. */

/** Get the current line number.
 * 
 */
int ipfilterget_lineno  (void)
{
        
    return ipfilterlineno;
}

/** Get the input stream.
 * 
 */
FILE *ipfilterget_in  (void)
{
        return ipfilterin;
}

/** Get the output stream.
 * 
 */
FILE *ipfilterget_out  (void)
{
        return ipfilterout;
}

/** Get the length of the current token.
 * 
 */
int ipfilterget_leng  (void)
{
        return ipfilterleng;
}

/** Get the current token.
 * 
 */

char *ipfilterget_text  (void)
{
        return ipfiltertext;
}

/** Set the current line number.
 * @param line_number
 * 
 */
void ipfilterset_lineno (int  line_number )
{
    
    ipfilterlineno = line_number;
}

/** Set the input stream. This does not discard the current
 * input buffer.
 * @param in_str A readable stream.
 * 
 * @see ipfilter_switch_to_buffer
 */
void ipfilterset_in (FILE *  in_str )
{
        ipfilterin = in_str ;
}

void ipfilterset_out (FILE *  out_str )
{
        ipfilterout = out_str ;
}

int ipfilterget_debug  (void)
{
        return ipfilter_flex_debug;
}

void ipfilterset_debug (int  bdebug )
{
        ipfilter_flex_debug = bdebug ;
}

/* ipfilterlex_destroy is for both reentrant and non-reentrant scanners. */
int ipfilterlex_destroy  (void)
{
    
    /* Pop the buffer stack, destroying each element. */
      while(YY_CURRENT_BUFFER){
            ipfilter_delete_buffer(YY_CURRENT_BUFFER  );
            YY_CURRENT_BUFFER_LVALUE = NULL;
            ipfilterpop_buffer_state();
      }

      /* Destroy the stack itself. */
      ipfilterfree((yy_buffer_stack) );
      (yy_buffer_stack) = NULL;

    return 0;
}

/*
 * Internal utility routines.
 */

#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
      register int i;
      for ( i = 0; i < n; ++i )
            s1[i] = s2[i];
}
#endif

#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
      register int n;
      for ( n = 0; s[n]; ++n )
            ;

      return n;
}
#endif

void *ipfilteralloc (yy_size_t  size )
{
      return (void *) malloc( size );
}

void *ipfilterrealloc  (void * ptr, yy_size_t  size )
{
      /* The cast to (char *) in the following accommodates both
       * implementations that use char* generic pointers, and those
       * that use void* generic pointers.  It works with the latter
       * because both ANSI C and C++ allow castless assignment from
       * any pointer type to void*, and deal with argument conversions
       * as though doing an assignment.
       */
      return (void *) realloc( (char *) ptr, size );
}

void ipfilterfree (void * ptr )
{
      free( (char *) ptr );   /* see ipfilterrealloc() for (char *) cast */
}

#define YYTABLES_NAME "yytables"

#undef YY_NEW_FILE
#undef YY_FLUSH_BUFFER
#undef yy_set_bol
#undef yy_new_buffer
#undef yy_set_interactive
#undef yytext_ptr
#undef YY_DO_BEFORE_ACTION

#ifdef YY_DECL_IS_OURS
#undef YY_DECL_IS_OURS
#undef YY_DECL
#endif
#line 131 "ipfilter.ll"



static void
ipfilter_parse_data(char* input) {
  char chainlabel[SHORTLEN + 1], branchname[SHORTLEN + 1], iface[SHORTLEN + 1];

  if (sscanf(input, "%" SHORTLEN_S "s @%" SHORTLEN_S "s %" SHORTLEN_S "s",
           iface, chainlabel, branchname) != 3)
    return;
  logentry->count = 1;
  logentry->input_iface = iface;
  logentry->chainlabel = chainlabel;
  logentry->branchname = branchname;
}

static void
ipfilter_parse_data_count(char* input) {
  int count;
  char chainlabel[SHORTLEN + 1], branchname[SHORTLEN + 1], iface[SHORTLEN + 1];

  if (sscanf(input, "%dx %" SHORTLEN_S "s @%" SHORTLEN_S "s %" SHORTLEN_S "s",
           &count, iface, chainlabel, branchname) != 4)
    return;
  logentry->count = count;
  logentry->input_iface = iface;
  logentry->chainlabel = chainlabel;
  logentry->branchname = branchname;
}

static void
ipfilter_parse_ips(char* input, unsigned char mode) {
  int host1, host2, host3, host4, port;
  char ip[IPLEN];

  if (mode == (IPF_OPT_SRC|IPF_OPT_RES|IPF_OPT_RPORT) ||
      mode == (IPF_OPT_DST|IPF_OPT_RES|IPF_OPT_RPORT)) {
    char name[256], *ptr, portname[32];
    ptr = strchr(input, '[');
    *ptr = ' ';
    if (sscanf(input, "%255s %3d.%3d.%3d.%3d],%31s",
             name, &host1, &host2, &host3, &host4, portname) != 6)
      return;
  }
  else if (mode == (IPF_OPT_SRC|IPF_OPT_RES|IPF_OPT_PORT) ||
         mode == (IPF_OPT_DST|IPF_OPT_RES|IPF_OPT_PORT)) {
    char name[256], *ptr;
    ptr = strchr(input, '['); *ptr = ' ';
    if (sscanf(input, "%255s %3d.%3d.%3d.%3d],%5d",
             name, &host1, &host2, &host3, &host4, &port) != 6)
      return;
  }
  else if (mode == (IPF_OPT_SRC|IPF_OPT_RES) ||
         mode == (IPF_OPT_DST|IPF_OPT_RES)) {
    char name[256], *ptr;
    ptr = strchr(input, '['); *ptr = ' ';
    if (sscanf(input, "%255s %3d.%3d.%3d.%3d]",
             name, &host1, &host2, &host3, &host4) != 5)
      return;
  }
  else if (mode == (IPF_OPT_SRC|IPF_OPT_RPORT) ||
         mode == (IPF_OPT_DST|IPF_OPT_RPORT)) {
    char portname[32];
    if (sscanf(input, "%3d.%3d.%3d.%3d,%31s",
             &host1, &host2, &host3, &host4, portname) != 5)
      return;
  }
  else if (mode == (IPF_OPT_SRC|IPF_OPT_PORT) ||
         mode == (IPF_OPT_DST|IPF_OPT_PORT)) {
    if (sscanf(input, "%3d.%3d.%3d.%3d,%5d",
             &host1, &host2, &host3, &host4, &port) != 5)
      return;
  }
  else if (mode == IPF_OPT_SRC || mode == IPF_OPT_DST) {
    if (sscanf(input, "%3d.%3d.%3d.%3d",
             &host1, &host2, &host3, &host4) != 4)
      return;
  }
  else
    return;

  snprintf(ip, IPLEN, "%d.%d.%d.%d", host1, host2, host3, host4);
  if (mode & IPF_OPT_SRC) {
    /*
    if (convert_ip(ip, &logentry->shost) == false)
      return;
    */
    if (logentry->sipaddr.set(ip) == false)
      return;
    if (mode & IPF_OPT_PORT)
      logentry->sport = port;
  }
  else {
    /*
    if (convert_ip(ip, &logentry->dhost) == false)
      return;
    */
    if (logentry->dipaddr.set(ip) == false)
      return;
    if (mode & IPF_OPT_PORT)
      logentry->dport = port;
  }
}

static void
ipfilter_parse_proto(char* input) {
  if (isdigit(input[0]))
    logentry->protocol = atoi(input);
  else {
    struct protoent* proto = getprotobyname(input);
    if (proto == NULL) {
      parseerror = true;
      fprintf(stderr, _("Unknown protocol, ignoring `%s'\n"), input);
      return;
    }
    logentry->protocol = proto->p_proto;
  }
}

static void
ipfilter_parse_tcpflags(char* input) {
  while (*input != '\0') {
    switch (*input) {
    case 'S':
      logentry->tcpflags |= TCP_SYN;
      break;
    case 'A':
      logentry->tcpflags |= TCP_ACK;
      break;
    case 'F':
      logentry->tcpflags |= TCP_FIN;
      break;
    case 'R':
      logentry->tcpflags |= TCP_RST;
      break;
    case 'P':
      logentry->tcpflags |= TCP_PSH;
      break;
    case 'U':
      logentry->tcpflags |= TCP_URG;
      break;
    }
    input++;
  }
}


wf_inmodule_ipfilter::wf_inmodule_ipfilter() {
}

bool
wf_inmodule_ipfilter::match(const string& line) const {
  return (line.find(" ipmon[") != string::npos);
}

enum wf_logentry_parsing_result
wf_inmodule_ipfilter::parse(wf_logentry** retlogentry,
  const string& line, int linenum) {
  logentry = new wf_logentry();
  if (logentry == NULL)
    return WF_LOGENTRY_PARSING_ERROR;

  ipfilter_scan_string(line.c_str());
  ipfilterlex();

  logentry->format = "ipfilter";

  /*
  if (parser == (IPFILTER_DATE|IPFILTER_DATA|IPFILTER_IPS))
  */
  if (parseerror == false) {
    *retlogentry = logentry;
    return WF_LOGENTRY_PARSING_OK;
  }

  if (verbose)
    fprintf(stderr, _("ipfilter parse error in line %d, ignoring.\n"),
          linenum);

  delete logentry;
  return WF_LOGENTRY_PARSING_ERROR;
}

extern "C" wf_inmodule*
wf_inmodule_ipfilter_init() {
  return new wf_inmodule_ipfilter();
}


Generated by  Doxygen 1.6.0   Back to index