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