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