4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
11 #define YY_FLEX_SUBMINOR_VERSION 33
12 #if YY_FLEX_SUBMINOR_VERSION > 0
16 /* First, we deal with platform-specific or compiler-specific issues. */
18 /* begin standard C headers. */
24 /* end standard C headers. */
26 /* flex integer type definitions */
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 #if __STDC_VERSION__ >= 199901L
35 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36 * if you want the limit (max/min) macros for int types.
38 #ifndef __STDC_LIMIT_MACROS
39 #define __STDC_LIMIT_MACROS 1
43 typedef int8_t flex_int8_t
;
44 typedef uint8_t flex_uint8_t
;
45 typedef int16_t flex_int16_t
;
46 typedef uint16_t flex_uint16_t
;
47 typedef int32_t flex_int32_t
;
48 typedef uint32_t flex_uint32_t
;
50 typedef signed char flex_int8_t
;
51 typedef short int flex_int16_t
;
52 typedef int flex_int32_t
;
53 typedef unsigned char flex_uint8_t
;
54 typedef unsigned short int flex_uint16_t
;
55 typedef unsigned int flex_uint32_t
;
58 /* Limits of integral types. */
60 #define INT8_MIN (-128)
63 #define INT16_MIN (-32767-1)
66 #define INT32_MIN (-2147483647-1)
69 #define INT8_MAX (127)
72 #define INT16_MAX (32767)
75 #define INT32_MAX (2147483647)
78 #define UINT8_MAX (255U)
81 #define UINT16_MAX (65535U)
84 #define UINT32_MAX (4294967295U)
87 #endif /* ! FLEXINT_H */
91 /* The "const" storage-class-modifier is valid. */
94 #else /* ! __cplusplus */
100 #endif /* __STDC__ */
101 #endif /* ! __cplusplus */
104 #define yyconst const
109 /* Returned upon end-of-file. */
112 /* Promotes a possibly negative, possibly signed char to an unsigned
113 * integer for use as an array index. If the signed char is negative,
114 * we want to instead treat it as an 8-bit unsigned char, hence the
117 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
119 /* Enter a start condition. This macro really ought to take a parameter,
120 * but we do it the disgusting crufty way forced on us by the ()-less
121 * definition of BEGIN.
123 #define BEGIN (yy_start) = 1 + 2 *
125 /* Translate the current start state into a value that can be later handed
126 * to BEGIN to return to the state. The YYSTATE alias is for lex
129 #define YY_START (((yy_start) - 1) / 2)
130 #define YYSTATE YY_START
132 /* Action number for EOF rule of a given start state. */
133 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
135 /* Special action meaning "start processing a new file". */
136 #define YY_NEW_FILE pcap_restart(pcap_in )
138 #define YY_END_OF_BUFFER_CHAR 0
140 /* Size of default input buffer. */
142 #define YY_BUF_SIZE 16384
145 /* The state buf must be large enough to hold one state per character in the main buffer.
147 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
149 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
150 #define YY_TYPEDEF_YY_BUFFER_STATE
151 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
154 extern int pcap_leng
;
156 extern FILE *pcap_in
, *pcap_out
;
158 #define EOB_ACT_CONTINUE_SCAN 0
159 #define EOB_ACT_END_OF_FILE 1
160 #define EOB_ACT_LAST_MATCH 2
162 #define YY_LESS_LINENO(n)
164 /* Return all but the first "n" matched characters back to the input stream. */
168 /* Undo effects of setting up pcap_text. */ \
169 int yyless_macro_arg = (n); \
170 YY_LESS_LINENO(yyless_macro_arg);\
171 *yy_cp = (yy_hold_char); \
172 YY_RESTORE_YY_MORE_OFFSET \
173 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
174 YY_DO_BEFORE_ACTION; /* set up pcap_text again */ \
178 #define unput(c) yyunput( c, (yytext_ptr) )
180 /* The following is because we cannot portably get our hands on size_t
181 * (without autoconf's help, which isn't available because we want
182 * flex-generated scanners to compile on their own).
185 #ifndef YY_TYPEDEF_YY_SIZE_T
186 #define YY_TYPEDEF_YY_SIZE_T
187 typedef unsigned int yy_size_t
;
190 #ifndef YY_STRUCT_YY_BUFFER_STATE
191 #define YY_STRUCT_YY_BUFFER_STATE
192 struct yy_buffer_state
196 char *yy_ch_buf
; /* input buffer */
197 char *yy_buf_pos
; /* current position in input buffer */
199 /* Size of input buffer in bytes, not including room for EOB
202 yy_size_t yy_buf_size
;
204 /* Number of characters read into yy_ch_buf, not including EOB
209 /* Whether we "own" the buffer - i.e., we know we created it,
210 * and can realloc() it to grow it, and should free() it to
213 int yy_is_our_buffer
;
215 /* Whether this is an "interactive" input source; if so, and
216 * if we're using stdio for input, then we want to use getc()
217 * instead of fread(), to make sure we stop fetching input after
220 int yy_is_interactive
;
222 /* Whether we're considered to be at the beginning of a line.
223 * If so, '^' rules will be active on the next match, otherwise
228 int yy_bs_lineno
; /**< The line count. */
229 int yy_bs_column
; /**< The column count. */
231 /* Whether to try to fill the input buffer when we reach the
236 int yy_buffer_status
;
238 #define YY_BUFFER_NEW 0
239 #define YY_BUFFER_NORMAL 1
240 /* When an EOF's been seen but there's still some text to process
241 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
242 * shouldn't try reading from the input source any more. We might
243 * still have a bunch of tokens to match, though, because of
244 * possible backing-up.
246 * When we actually see the EOF, we change the status to "new"
247 * (via pcap_restart()), so that the user can continue scanning by
248 * just pointing pcap_in at a new input file.
250 #define YY_BUFFER_EOF_PENDING 2
253 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
255 /* Stack of input buffers. */
256 static size_t yy_buffer_stack_top
= 0; /**< index of top of stack. */
257 static size_t yy_buffer_stack_max
= 0; /**< capacity of stack. */
258 static YY_BUFFER_STATE
* yy_buffer_stack
= 0; /**< Stack as an array. */
260 /* We provide macros for accessing buffer states in case in the
261 * future we want to put the buffer states in a more general
264 * Returns the top of the stack, or NULL.
266 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
267 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
270 /* Same as previous macro, but useful when we know that the buffer stack is not
271 * NULL or when we need an lvalue. For internal use only.
273 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
275 /* yy_hold_char holds the character lost when pcap_text is formed. */
276 static char yy_hold_char
;
277 static int yy_n_chars
; /* number of characters read into yy_ch_buf */
280 /* Points to current character in buffer. */
281 static char *yy_c_buf_p
= (char *) 0;
282 static int yy_init
= 0; /* whether we need to initialize */
283 static int yy_start
= 0; /* start state number */
285 /* Flag which is used to allow pcap_wrap()'s to do buffer switches
286 * instead of setting up a fresh pcap_in. A bit of a hack ...
288 static int yy_did_buffer_switch_on_eof
;
290 void pcap_restart (FILE *input_file
);
291 void pcap__switch_to_buffer (YY_BUFFER_STATE new_buffer
);
292 YY_BUFFER_STATE
pcap__create_buffer (FILE *file
,int size
);
293 void pcap__delete_buffer (YY_BUFFER_STATE b
);
294 void pcap__flush_buffer (YY_BUFFER_STATE b
);
295 void pcap_push_buffer_state (YY_BUFFER_STATE new_buffer
);
296 void pcap_pop_buffer_state (void );
298 static void pcap_ensure_buffer_stack (void );
299 static void pcap__load_buffer_state (void );
300 static void pcap__init_buffer (YY_BUFFER_STATE b
,FILE *file
);
302 #define YY_FLUSH_BUFFER pcap__flush_buffer(YY_CURRENT_BUFFER )
304 YY_BUFFER_STATE
pcap__scan_buffer (char *base
,yy_size_t size
);
305 YY_BUFFER_STATE
pcap__scan_string (yyconst
char *yy_str
);
306 YY_BUFFER_STATE
pcap__scan_bytes (yyconst
char *bytes
,int len
);
308 void *pcap_alloc (yy_size_t
);
309 void *pcap_realloc (void *,yy_size_t
);
310 void pcap_free (void * );
312 #define yy_new_buffer pcap__create_buffer
314 #define yy_set_interactive(is_interactive) \
316 if ( ! YY_CURRENT_BUFFER ){ \
317 pcap_ensure_buffer_stack (); \
318 YY_CURRENT_BUFFER_LVALUE = \
319 pcap__create_buffer(pcap_in,YY_BUF_SIZE ); \
321 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
324 #define yy_set_bol(at_bol) \
326 if ( ! YY_CURRENT_BUFFER ){\
327 pcap_ensure_buffer_stack (); \
328 YY_CURRENT_BUFFER_LVALUE = \
329 pcap__create_buffer(pcap_in,YY_BUF_SIZE ); \
331 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
334 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
336 /* Begin user sect3 */
338 typedef unsigned char YY_CHAR
;
340 FILE *pcap_in
= (FILE *) 0, *pcap_out
= (FILE *) 0;
342 typedef int yy_state_type
;
344 extern int pcap_lineno
;
348 extern char *pcap_text
;
349 #define yytext_ptr pcap_text
351 static yy_state_type
yy_get_previous_state (void );
352 static yy_state_type
yy_try_NUL_trans (yy_state_type current_state
);
353 static int yy_get_next_buffer (void );
354 static void yy_fatal_error (yyconst
char msg
[] );
356 /* Done after the current pattern has been matched and before the
357 * corresponding action - sets up pcap_text.
359 #define YY_DO_BEFORE_ACTION \
360 (yytext_ptr) = yy_bp; \
361 pcap_leng = (size_t) (yy_cp - yy_bp); \
362 (yy_hold_char) = *yy_cp; \
364 (yy_c_buf_p) = yy_cp;
366 #define YY_NUM_RULES 52
367 #define YY_END_OF_BUFFER 53
368 /* This struct is not used in this scanner,
369 but its presence is necessary. */
372 flex_int32_t yy_verify
;
375 static yyconst flex_int16_t yy_accept
[217] =
377 0, 0, 53, 51, 36, 36, 37, 37, 37, 37,
378 51, 44, 44, 37, 37, 37, 51, 51, 51, 51,
379 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
380 51, 51, 51, 51, 51, 51, 37, 0, 50, 40,
381 30, 0, 48, 44, 0, 48, 48, 48, 42, 39,
382 41, 38, 43, 49, 49, 49, 48, 48, 48, 48,
383 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
384 48, 7, 48, 48, 48, 48, 48, 48, 48, 48,
385 31, 48, 48, 48, 48, 48, 48, 48, 48, 48,
386 48, 31, 45, 45, 44, 0, 0, 44, 30, 5,
388 48, 48, 48, 48, 1, 48, 48, 48, 48, 48,
389 48, 48, 48, 48, 15, 33, 48, 48, 48, 48,
390 48, 20, 32, 48, 48, 3, 48, 48, 16, 48,
391 2, 8, 9, 48, 48, 0, 47, 0, 48, 48,
392 27, 48, 48, 4, 48, 48, 19, 10, 11, 12,
393 48, 48, 25, 21, 48, 48, 48, 48, 22, 48,
394 6, 45, 45, 45, 0, 47, 0, 13, 48, 48,
395 48, 48, 48, 48, 18, 17, 48, 48, 23, 48,
396 48, 0, 47, 48, 14, 48, 48, 48, 33, 48,
397 48, 45, 45, 45, 0, 48, 24, 26, 34, 48,
399 48, 48, 0, 47, 48, 48, 35, 45, 0, 28,
403 static yyconst flex_int32_t yy_ec
[256] =
405 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 2, 4, 1, 1, 1, 1, 5, 1, 6,
409 6, 7, 7, 1, 8, 9, 7, 10, 11, 11,
410 11, 11, 11, 11, 11, 11, 11, 12, 1, 13,
411 14, 15, 1, 1, 16, 16, 16, 16, 16, 16,
412 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
413 17, 17, 17, 17, 17, 17, 17, 18, 17, 17,
414 19, 20, 19, 1, 21, 1, 22, 23, 24, 25,
416 26, 27, 28, 29, 30, 17, 31, 32, 33, 34,
417 35, 36, 17, 37, 38, 39, 40, 17, 41, 42,
418 43, 17, 1, 44, 1, 1, 1, 1, 1, 1,
419 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435 static yyconst flex_int32_t yy_meta
[45] =
437 1, 2, 2, 2, 1, 2, 1, 1, 1, 3,
438 3, 3, 1, 1, 1, 3, 1, 1, 1, 1,
439 1, 3, 3, 3, 3, 3, 3, 1, 1, 1,
440 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
444 static yyconst flex_int16_t yy_base
[230] =
446 0, 0, 381, 44, 382, 382, 366, 374, 382, 45,
447 382, 68, 29, 35, 364, 39, 103, 137, 121, 171,
448 24, 92, 86, 131, 33, 342, 108, 113, 47, 24,
449 79, 136, 354, 36, 351, 349, 329, 176, 382, 382,
450 382, 0, 127, 175, 360, 359, 0, 204, 382, 382,
451 382, 382, 382, 191, 0, 0, 345, 333, 346, 332,
452 327, 103, 326, 335, 142, 324, 336, 323, 327, 29,
453 336, 0, 319, 140, 323, 318, 319, 322, 314, 313,
454 0, 312, 313, 313, 313, 310, 324, 315, 320, 307,
455 306, 382, 191, 184, 207, 329, 328, 330, 0, 0,
457 306, 315, 310, 301, 0, 308, 303, 306, 309, 291,
458 293, 292, 291, 291, 0, 297, 286, 292, 291, 115,
459 282, 0, 0, 297, 280, 0, 279, 281, 0, 280,
460 0, 0, 0, 147, 224, 303, 302, 301, 281, 286,
461 0, 284, 272, 0, 267, 268, 0, 0, 0, 0,
462 266, 266, 0, 0, 272, 279, 272, 266, 0, 265,
463 0, 214, 227, 290, 286, 284, 276, 0, 263, 247,
464 263, 258, 248, 252, 0, 0, 256, 239, 0, 165,
465 247, 263, 256, 245, 0, 223, 228, 239, 0, 240,
466 227, 234, 180, 251, 247, 217, 0, 0, 0, 216,
468 228, 267, 231, 230, 202, 200, 0, 0, 210, 0,
469 0, 207, 200, 195, 192, 382, 294, 196, 194, 166,
470 163, 147, 131, 121, 114, 85, 80, 78, 69
473 static yyconst flex_int16_t yy_def
[230] =
475 216, 1, 216, 216, 216, 216, 216, 216, 216, 216,
476 216, 216, 12, 216, 216, 216, 12, 12, 217, 12,
477 20, 20, 20, 20, 18, 18, 18, 18, 18, 18,
478 18, 18, 18, 18, 18, 18, 216, 216, 216, 216,
479 216, 18, 18, 18, 218, 18, 18, 18, 216, 216,
480 216, 216, 216, 217, 217, 217, 18, 18, 18, 18,
481 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
482 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
483 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
484 18, 216, 18, 18, 18, 219, 220, 48, 18, 18,
486 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
487 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
488 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
489 18, 18, 18, 18, 18, 216, 221, 222, 18, 18,
490 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
491 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
492 18, 18, 18, 135, 223, 220, 216, 18, 18, 18,
493 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
494 18, 216, 224, 18, 18, 18, 18, 18, 18, 18,
495 18, 18, 18, 181, 225, 18, 18, 18, 18, 18,
497 18, 18, 216, 226, 18, 18, 18, 202, 227, 18,
498 18, 216, 228, 229, 216, 0, 216, 216, 216, 216,
499 216, 216, 216, 216, 216, 216, 216, 216, 216
502 static yyconst flex_int16_t yy_nxt
[427] =
504 4, 5, 6, 7, 8, 9, 10, 9, 11, 12,
505 13, 10, 14, 15, 16, 17, 18, 18, 9, 19,
506 11, 20, 21, 17, 22, 23, 24, 25, 26, 27,
507 18, 28, 29, 30, 31, 32, 33, 34, 35, 36,
508 18, 18, 18, 37, 38, 38, 47, 49, 50, 79,
509 38, 38, 52, 53, 66, 38, 38, 47, 80, 87,
510 60, 112, 47, 38, 38, 113, 61, 88, 76, 67,
511 47, 215, 89, 39, 39, 42, 43, 44, 44, 45,
512 214, 77, 212, 46, 47, 48, 78, 209, 42, 46,
513 46, 46, 46, 46, 46, 47, 47, 47, 47, 47,
515 47, 47, 47, 47, 47, 47, 47, 47, 47, 48,
516 47, 47, 46, 46, 45, 81, 203, 62, 82, 47,
517 47, 54, 47, 195, 64, 47, 104, 54, 47, 63,
518 47, 69, 54, 182, 73, 70, 93, 94, 74, 155,
519 54, 71, 75, 72, 47, 47, 47, 47, 216, 167,
520 56, 156, 47, 45, 47, 65, 162, 163, 47, 47,
521 47, 47, 47, 47, 47, 165, 107, 47, 138, 47,
522 83, 84, 85, 116, 192, 193, 38, 117, 47, 47,
523 46, 46, 38, 43, 95, 95, 45, 38, 47, 193,
524 193, 54, 134, 94, 94, 38, 136, 54, 96, 134,
526 94, 94, 54, 166, 57, 39, 166, 58, 135, 59,
527 54, 166, 47, 98, 98, 43, 95, 95, 213, 98,
528 56, 213, 180, 163, 163, 98, 98, 98, 98, 98,
529 98, 181, 135, 164, 164, 180, 163, 163, 211, 164,
530 210, 166, 204, 193, 193, 164, 164, 164, 164, 164,
531 164, 202, 207, 206, 205, 181, 194, 194, 204, 180,
532 201, 200, 194, 199, 198, 197, 196, 166, 194, 194,
533 194, 194, 194, 194, 183, 202, 208, 208, 191, 190,
534 189, 188, 208, 187, 186, 185, 184, 166, 208, 208,
535 208, 208, 208, 208, 55, 166, 55, 183, 134, 179,
537 178, 177, 176, 175, 174, 173, 172, 171, 126, 170,
538 169, 168, 166, 166, 137, 126, 161, 160, 159, 158,
539 157, 154, 126, 153, 152, 151, 150, 149, 148, 147,
540 146, 145, 144, 143, 142, 141, 140, 139, 43, 97,
541 137, 133, 132, 131, 130, 129, 128, 127, 126, 125,
542 124, 123, 122, 121, 120, 119, 118, 115, 114, 111,
543 110, 109, 108, 106, 105, 103, 102, 101, 100, 99,
544 45, 97, 92, 91, 90, 86, 68, 51, 41, 40,
545 216, 3, 216, 216, 216, 216, 216, 216, 216, 216,
546 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
548 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
549 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
550 216, 216, 216, 216, 216, 216
553 static yyconst flex_int16_t yy_chk
[427] =
555 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
556 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
557 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
558 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
559 1, 1, 1, 1, 4, 10, 13, 14, 14, 30,
560 4, 10, 16, 16, 25, 4, 10, 21, 30, 34,
561 21, 70, 21, 4, 10, 70, 21, 34, 29, 25,
562 13, 229, 34, 4, 10, 12, 12, 12, 12, 12,
563 228, 29, 227, 12, 12, 12, 29, 226, 12, 12,
564 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
566 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
567 12, 17, 17, 17, 62, 31, 225, 22, 31, 23,
568 17, 19, 23, 224, 23, 22, 62, 19, 22, 22,
569 22, 27, 19, 223, 28, 27, 43, 43, 28, 120,
570 19, 27, 28, 27, 17, 18, 18, 18, 18, 222,
571 19, 120, 18, 65, 18, 24, 134, 134, 18, 18,
572 18, 18, 18, 18, 24, 221, 65, 24, 220, 24,
573 32, 32, 32, 74, 180, 180, 38, 74, 18, 20,
574 20, 20, 38, 44, 44, 44, 44, 38, 20, 193,
575 193, 54, 94, 94, 94, 38, 219, 54, 218, 93,
577 93, 93, 54, 215, 20, 38, 214, 20, 93, 20,
578 54, 213, 20, 48, 48, 95, 95, 95, 212, 48,
579 54, 209, 162, 162, 162, 48, 48, 48, 48, 48,
580 48, 162, 93, 135, 135, 163, 163, 163, 206, 135,
581 205, 204, 203, 192, 192, 135, 135, 135, 135, 135,
582 135, 192, 201, 200, 196, 162, 181, 181, 195, 194,
583 191, 190, 181, 188, 187, 186, 184, 183, 181, 181,
584 181, 181, 181, 181, 182, 192, 202, 202, 178, 177,
585 174, 173, 202, 172, 171, 170, 169, 167, 202, 202,
586 202, 202, 202, 202, 217, 166, 217, 165, 164, 160,
588 158, 157, 156, 155, 152, 151, 146, 145, 143, 142,
589 140, 139, 138, 137, 136, 130, 128, 127, 125, 124,
590 121, 119, 118, 117, 116, 114, 113, 112, 111, 110,
591 109, 108, 107, 106, 104, 103, 102, 101, 98, 97,
592 96, 91, 90, 89, 88, 87, 86, 85, 84, 83,
593 82, 80, 79, 78, 77, 76, 75, 73, 71, 69,
594 68, 67, 66, 64, 63, 61, 60, 59, 58, 57,
595 46, 45, 37, 36, 35, 33, 26, 15, 8, 7,
596 3, 216, 216, 216, 216, 216, 216, 216, 216, 216,
597 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
599 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
600 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
601 216, 216, 216, 216, 216, 216
604 static yy_state_type yy_last_accepting_state
;
605 static char *yy_last_accepting_cpos
;
607 extern int pcap__flex_debug
;
608 int pcap__flex_debug
= 0;
610 /* The intent behind this definition is that it'll catch
611 * any uses of REJECT which flex missed.
613 #define REJECT reject_used_but_not_detected
614 #define yymore() yymore_used_but_not_detected
615 #define YY_MORE_ADJ 0
616 #define YY_RESTORE_YY_MORE_OFFSET
621 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
622 * The Regents of the University of California. All rights reserved.
624 * Redistribution and use in source and binary forms, with or without
625 * modification, are permitted provided that: (1) source code distributions
626 * retain the above copyright notice and this paragraph in its entirety, (2)
627 * distributions including binary code include the above copyright notice and
628 * this paragraph in its entirety in the documentation or other materials
629 * provided with the distribution, and (3) all advertising materials mentioning
630 * features or use of this software display the following acknowledgement:
631 * ``This product includes software developed by the University of California,
632 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
633 * the University nor the names of its contributors may be used to endorse
634 * or promote products derived from this software without specific prior
635 * written permission.
636 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
637 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
638 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
642 static const char rcsid
[] =
643 "@(#) $Header: /usr/local/cvs/linux/tools/build/e100boot/libpcap-0.4/scanner.l,v 1.1 1999/08/26 10:05:27 johana Exp $ (LBL)";
646 #include <sys/types.h>
647 #include <sys/time.h>
652 #include "pcap-int.h"
655 #include <pcap-namedb.h>
659 #ifdef HAVE_OS_PROTO_H
660 #include "os-proto.h"
663 static int stoi(char *);
664 static inline int xdtoi(int);
669 #define YY_INPUT(buf, result, max)\
671 char *src = in_buffer;\
677 for (i = 0; *src && i < max; ++i)\
685 #define getc(fp) (*in_buffer == 0 ? EOF : *in_buffer++)
688 #define yylval pcap_lval
689 extern YYSTYPE yylval
;
691 static char *in_buffer
;
697 #ifndef YY_NO_UNISTD_H
698 /* Special case for "unistd.h", since it is non-ANSI. We include it way
699 * down here because we want the user's section 1 to have been scanned first.
700 * The user has a chance to override it with an option.
705 #ifndef YY_EXTRA_TYPE
706 #define YY_EXTRA_TYPE void *
709 static int yy_init_globals (void );
711 /* Macros after this point can all be overridden by user definitions in
715 #ifndef YY_SKIP_YYWRAP
717 extern "C" int pcap_wrap (void );
719 extern int pcap_wrap (void );
723 static void yyunput (int c
,char *buf_ptr
);
726 static void yy_flex_strncpy (char *,yyconst
char *,int );
729 #ifdef YY_NEED_STRLEN
730 static int yy_flex_strlen (yyconst
char * );
736 static int yyinput (void );
738 static int input (void );
743 /* Amount of stuff to slurp up with each read. */
744 #ifndef YY_READ_BUF_SIZE
745 #define YY_READ_BUF_SIZE 8192
748 /* Copy whatever the last rule matched to the standard output. */
750 /* This used to be an fputs(), but since the string might contain NUL's,
751 * we now use fwrite().
753 #define ECHO (void) fwrite( pcap_text, pcap_leng, 1, pcap_out )
756 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
757 * is returned in "result".
760 #define YY_INPUT(buf,result,max_size) \
761 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
765 for ( n = 0; n < max_size && \
766 (c = getc( pcap_in )) != EOF && c != '\n'; ++n ) \
769 buf[n++] = (char) c; \
770 if ( c == EOF && ferror( pcap_in ) ) \
771 YY_FATAL_ERROR( "input in flex scanner failed" ); \
777 while ( (result = fread(buf, 1, max_size, pcap_in))==0 && ferror(pcap_in)) \
779 if( errno != EINTR) \
781 YY_FATAL_ERROR( "input in flex scanner failed" ); \
792 /* No semi-colon after return; correct usage is to write "yyterminate();" -
793 * we don't want an extra ';' after the "return" because that will cause
794 * some compilers to complain about unreachable statements.
797 #define yyterminate() return YY_NULL
800 /* Number of entries by which start-condition stack grows. */
801 #ifndef YY_START_STACK_INCR
802 #define YY_START_STACK_INCR 25
805 /* Report a fatal error. */
806 #ifndef YY_FATAL_ERROR
807 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
810 /* end tables serialization structures and prototypes */
812 /* Default declaration of generated scanner - a define so the user can
813 * easily add parameters.
816 #define YY_DECL_IS_OURS 1
818 extern int pcap_lex (void);
820 #define YY_DECL int pcap_lex (void)
821 #endif /* !YY_DECL */
823 /* Code executed at the beginning of each rule, after pcap_text and pcap_leng
826 #ifndef YY_USER_ACTION
827 #define YY_USER_ACTION
830 /* Code executed at the end of each rule. */
832 #define YY_BREAK break;
835 #define YY_RULE_SETUP \
838 /** The main scanner function which does all the work.
842 register yy_state_type yy_current_state
;
843 register char *yy_cp
, *yy_bp
;
859 (yy_start
) = 1; /* first start state */
867 if ( ! YY_CURRENT_BUFFER
) {
868 pcap_ensure_buffer_stack ();
869 YY_CURRENT_BUFFER_LVALUE
=
870 pcap__create_buffer(pcap_in
,YY_BUF_SIZE
);
873 pcap__load_buffer_state( );
876 while ( 1 ) /* loops until end-of-file is reached */
878 yy_cp
= (yy_c_buf_p
);
880 /* Support of pcap_text. */
881 *yy_cp
= (yy_hold_char
);
883 /* yy_bp points to the position in yy_ch_buf of the start of
888 yy_current_state
= (yy_start
);
892 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
893 if ( yy_accept
[yy_current_state
] )
895 (yy_last_accepting_state
) = yy_current_state
;
896 (yy_last_accepting_cpos
) = yy_cp
;
898 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
900 yy_current_state
= (int) yy_def
[yy_current_state
];
901 if ( yy_current_state
>= 217 )
902 yy_c
= yy_meta
[(unsigned int) yy_c
];
904 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
907 while ( yy_base
[yy_current_state
] != 382 );
910 yy_act
= yy_accept
[yy_current_state
];
912 { /* have to back up */
913 yy_cp
= (yy_last_accepting_cpos
);
914 yy_current_state
= (yy_last_accepting_state
);
915 yy_act
= yy_accept
[yy_current_state
];
920 do_action
: /* This label is used only to access EOF actions. */
923 { /* beginning of action switch */
924 case 0: /* must back up */
925 /* undo the effects of YY_DO_BEFORE_ACTION */
926 *yy_cp
= (yy_hold_char
);
927 yy_cp
= (yy_last_accepting_cpos
);
928 yy_current_state
= (yy_last_accepting_state
);
1003 #line 99 "scanner.l"
1008 #line 100 "scanner.l"
1013 #line 101 "scanner.l"
1018 #line 102 "scanner.l"
1023 #line 104 "scanner.l"
1028 #line 105 "scanner.l"
1033 #line 106 "scanner.l"
1038 #line 107 "scanner.l"
1043 #line 108 "scanner.l"
1048 #line 110 "scanner.l"
1053 #line 112 "scanner.l"
1058 #line 113 "scanner.l"
1063 #line 114 "scanner.l"
1068 #line 115 "scanner.l"
1069 return TK_BROADCAST
;
1073 #line 116 "scanner.l"
1074 return TK_MULTICAST
;
1078 #line 118 "scanner.l"
1083 #line 119 "scanner.l"
1088 #line 120 "scanner.l"
1093 #line 122 "scanner.l"
1098 #line 123 "scanner.l"
1103 #line 124 "scanner.l"
1107 /* rule 36 can match eol */
1109 #line 126 "scanner.l"
1114 #line 127 "scanner.l"
1115 return pcap_text
[0];
1119 #line 128 "scanner.l"
1124 #line 129 "scanner.l"
1129 #line 130 "scanner.l"
1134 #line 131 "scanner.l"
1139 #line 132 "scanner.l"
1144 #line 133 "scanner.l"
1149 #line 134 "scanner.l"
1150 { yylval
.i
= stoi((char *)pcap_text
); return NUM
; }
1154 #line 135 "scanner.l"
1156 yylval
.s
= sdup((char *)pcap_text
); return HID
; }
1160 #line 137 "scanner.l"
1161 { yylval
.e
= pcap_ether_aton((char *)pcap_text
);
1166 #line 139 "scanner.l"
1167 { bpf_error("bogus ethernet address %s", pcap_text
); }
1171 #line 140 "scanner.l"
1173 yylval
.s
= sdup((char *)pcap_text
); return ID
; }
1177 #line 142 "scanner.l"
1178 { yylval
.s
= sdup((char *)pcap_text
+ 1); return ID
; }
1182 #line 143 "scanner.l"
1184 bpf_error("illegal token: %s\n", pcap_text
); }
1188 #line 145 "scanner.l"
1189 { bpf_error("illegal char '%c'", *pcap_text
); }
1193 #line 146 "scanner.l"
1196 #line 1197 "<stdout>"
1197 case YY_STATE_EOF(INITIAL
):
1200 case YY_END_OF_BUFFER
:
1202 /* Amount of text matched not including the EOB char. */
1203 int yy_amount_of_matched_text
= (int) (yy_cp
- (yytext_ptr
)) - 1;
1205 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1206 *yy_cp
= (yy_hold_char
);
1207 YY_RESTORE_YY_MORE_OFFSET
1209 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
1211 /* We're scanning a new file or input source. It's
1212 * possible that this happened because the user
1213 * just pointed pcap_in at a new source and called
1214 * pcap_lex(). If so, then we have to assure
1215 * consistency between YY_CURRENT_BUFFER and our
1216 * globals. Here is the right place to do so, because
1217 * this is the first action (other than possibly a
1218 * back-up) that will match for the new input source.
1220 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1221 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= pcap_in
;
1222 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
1225 /* Note that here we test for yy_c_buf_p "<=" to the position
1226 * of the first EOB in the buffer, since yy_c_buf_p will
1227 * already have been incremented past the NUL character
1228 * (since all states make transitions on EOB to the
1229 * end-of-buffer state). Contrast this with the test
1232 if ( (yy_c_buf_p
) <= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
1233 { /* This was really a NUL. */
1234 yy_state_type yy_next_state
;
1236 (yy_c_buf_p
) = (yytext_ptr
) + yy_amount_of_matched_text
;
1238 yy_current_state
= yy_get_previous_state( );
1240 /* Okay, we're now positioned to make the NUL
1241 * transition. We couldn't have
1242 * yy_get_previous_state() go ahead and do it
1243 * for us because it doesn't know how to deal
1244 * with the possibility of jamming (and we don't
1245 * want to build jamming into it because then it
1246 * will run more slowly).
1249 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
1251 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1253 if ( yy_next_state
)
1255 /* Consume the NUL. */
1256 yy_cp
= ++(yy_c_buf_p
);
1257 yy_current_state
= yy_next_state
;
1263 yy_cp
= (yy_c_buf_p
);
1264 goto yy_find_action
;
1268 else switch ( yy_get_next_buffer( ) )
1270 case EOB_ACT_END_OF_FILE
:
1272 (yy_did_buffer_switch_on_eof
) = 0;
1276 /* Note: because we've taken care in
1277 * yy_get_next_buffer() to have set up
1278 * pcap_text, we can now set up
1279 * yy_c_buf_p so that if some total
1280 * hoser (like flex itself) wants to
1281 * call the scanner after we return the
1282 * YY_NULL, it'll still work - another
1283 * YY_NULL will get returned.
1285 (yy_c_buf_p
) = (yytext_ptr
) + YY_MORE_ADJ
;
1287 yy_act
= YY_STATE_EOF(YY_START
);
1293 if ( ! (yy_did_buffer_switch_on_eof
) )
1299 case EOB_ACT_CONTINUE_SCAN
:
1301 (yytext_ptr
) + yy_amount_of_matched_text
;
1303 yy_current_state
= yy_get_previous_state( );
1305 yy_cp
= (yy_c_buf_p
);
1306 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1309 case EOB_ACT_LAST_MATCH
:
1311 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)];
1313 yy_current_state
= yy_get_previous_state( );
1315 yy_cp
= (yy_c_buf_p
);
1316 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1317 goto yy_find_action
;
1324 "fatal flex scanner internal error--no action found" );
1325 } /* end of action switch */
1326 } /* end of scanning one token */
1327 } /* end of pcap_lex */
1329 /* yy_get_next_buffer - try to read in a new buffer
1331 * Returns a code representing an action:
1332 * EOB_ACT_LAST_MATCH -
1333 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1334 * EOB_ACT_END_OF_FILE - end of file
1336 static int yy_get_next_buffer (void)
1338 register char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1339 register char *source
= (yytext_ptr
);
1340 register int number_to_move
, i
;
1343 if ( (yy_c_buf_p
) > &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] )
1345 "fatal flex scanner internal error--end of buffer missed" );
1347 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
1348 { /* Don't try to fill the buffer, so this is an EOF. */
1349 if ( (yy_c_buf_p
) - (yytext_ptr
) - YY_MORE_ADJ
== 1 )
1351 /* We matched a single character, the EOB, so
1352 * treat this as a final EOF.
1354 return EOB_ACT_END_OF_FILE
;
1359 /* We matched some text prior to the EOB, first
1362 return EOB_ACT_LAST_MATCH
;
1366 /* Try to read more data. */
1368 /* First move last chars to start of buffer. */
1369 number_to_move
= (int) ((yy_c_buf_p
) - (yytext_ptr
)) - 1;
1371 for ( i
= 0; i
< number_to_move
; ++i
)
1372 *(dest
++) = *(source
++);
1374 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1375 /* don't do the read, it's not guaranteed to return an EOF,
1378 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
) = 0;
1383 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
1385 while ( num_to_read
<= 0 )
1386 { /* Not enough room in the buffer - grow it. */
1388 /* just a shorter name for the current buffer */
1389 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER
;
1391 int yy_c_buf_p_offset
=
1392 (int) ((yy_c_buf_p
) - b
->yy_ch_buf
);
1394 if ( b
->yy_is_our_buffer
)
1396 int new_size
= b
->yy_buf_size
* 2;
1398 if ( new_size
<= 0 )
1399 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1401 b
->yy_buf_size
*= 2;
1403 b
->yy_ch_buf
= (char *)
1404 /* Include room in for 2 EOB chars. */
1405 pcap_realloc((void *) b
->yy_ch_buf
,b
->yy_buf_size
+ 2 );
1408 /* Can't grow it, we don't own it. */
1411 if ( ! b
->yy_ch_buf
)
1413 "fatal error - scanner input buffer overflow" );
1415 (yy_c_buf_p
) = &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1417 num_to_read
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
-
1422 if ( num_to_read
> YY_READ_BUF_SIZE
)
1423 num_to_read
= YY_READ_BUF_SIZE
;
1425 /* Read in more data. */
1426 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
1427 (yy_n_chars
), (size_t) num_to_read
);
1429 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1432 if ( (yy_n_chars
) == 0 )
1434 if ( number_to_move
== YY_MORE_ADJ
)
1436 ret_val
= EOB_ACT_END_OF_FILE
;
1437 pcap_restart(pcap_in
);
1442 ret_val
= EOB_ACT_LAST_MATCH
;
1443 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
1444 YY_BUFFER_EOF_PENDING
;
1449 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1451 (yy_n_chars
) += number_to_move
;
1452 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] = YY_END_OF_BUFFER_CHAR
;
1453 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] = YY_END_OF_BUFFER_CHAR
;
1455 (yytext_ptr
) = &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
1460 /* yy_get_previous_state - get the state just before the EOB char was reached */
1462 static yy_state_type
yy_get_previous_state (void)
1464 register yy_state_type yy_current_state
;
1465 register char *yy_cp
;
1467 yy_current_state
= (yy_start
);
1469 for ( yy_cp
= (yytext_ptr
) + YY_MORE_ADJ
; yy_cp
< (yy_c_buf_p
); ++yy_cp
)
1471 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1472 if ( yy_accept
[yy_current_state
] )
1474 (yy_last_accepting_state
) = yy_current_state
;
1475 (yy_last_accepting_cpos
) = yy_cp
;
1477 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1479 yy_current_state
= (int) yy_def
[yy_current_state
];
1480 if ( yy_current_state
>= 217 )
1481 yy_c
= yy_meta
[(unsigned int) yy_c
];
1483 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1486 return yy_current_state
;
1489 /* yy_try_NUL_trans - try to make a transition on the NUL character
1492 * next_state = yy_try_NUL_trans( current_state );
1494 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
)
1496 register int yy_is_jam
;
1497 register char *yy_cp
= (yy_c_buf_p
);
1499 register YY_CHAR yy_c
= 1;
1500 if ( yy_accept
[yy_current_state
] )
1502 (yy_last_accepting_state
) = yy_current_state
;
1503 (yy_last_accepting_cpos
) = yy_cp
;
1505 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1507 yy_current_state
= (int) yy_def
[yy_current_state
];
1508 if ( yy_current_state
>= 217 )
1509 yy_c
= yy_meta
[(unsigned int) yy_c
];
1511 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1512 yy_is_jam
= (yy_current_state
== 216);
1514 return yy_is_jam
? 0 : yy_current_state
;
1517 static void yyunput (int c
, register char * yy_bp
)
1519 register char *yy_cp
;
1521 yy_cp
= (yy_c_buf_p
);
1523 /* undo effects of setting up pcap_text */
1524 *yy_cp
= (yy_hold_char
);
1526 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1527 { /* need to shift things up to make room */
1528 /* +2 for EOB chars. */
1529 register int number_to_move
= (yy_n_chars
) + 2;
1530 register char *dest
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[
1531 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
+ 2];
1532 register char *source
=
1533 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
];
1535 while ( source
> YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1536 *--dest
= *--source
;
1538 yy_cp
+= (int) (dest
- source
);
1539 yy_bp
+= (int) (dest
- source
);
1540 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
=
1541 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
;
1543 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1544 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1547 *--yy_cp
= (char) c
;
1549 (yytext_ptr
) = yy_bp
;
1550 (yy_hold_char
) = *yy_cp
;
1551 (yy_c_buf_p
) = yy_cp
;
1556 static int yyinput (void)
1558 static int input (void)
1564 *(yy_c_buf_p
) = (yy_hold_char
);
1566 if ( *(yy_c_buf_p
) == YY_END_OF_BUFFER_CHAR
)
1568 /* yy_c_buf_p now points to the character we want to return.
1569 * If this occurs *before* the EOB characters, then it's a
1570 * valid NUL; if not, then we've hit the end of the buffer.
1572 if ( (yy_c_buf_p
) < &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
1573 /* This was really a NUL. */
1574 *(yy_c_buf_p
) = '\0';
1577 { /* need more input */
1578 int offset
= (yy_c_buf_p
) - (yytext_ptr
);
1581 switch ( yy_get_next_buffer( ) )
1583 case EOB_ACT_LAST_MATCH
:
1584 /* This happens because yy_g_n_b()
1585 * sees that we've accumulated a
1586 * token and flags that we need to
1587 * try matching the token before
1588 * proceeding. But for input(),
1589 * there's no matching to consider.
1590 * So convert the EOB_ACT_LAST_MATCH
1591 * to EOB_ACT_END_OF_FILE.
1594 /* Reset buffer status. */
1595 pcap_restart(pcap_in
);
1599 case EOB_ACT_END_OF_FILE
:
1604 if ( ! (yy_did_buffer_switch_on_eof
) )
1613 case EOB_ACT_CONTINUE_SCAN
:
1614 (yy_c_buf_p
) = (yytext_ptr
) + offset
;
1620 c
= *(unsigned char *) (yy_c_buf_p
); /* cast for 8-bit char's */
1621 *(yy_c_buf_p
) = '\0'; /* preserve pcap_text */
1622 (yy_hold_char
) = *++(yy_c_buf_p
);
1626 #endif /* ifndef YY_NO_INPUT */
1628 /** Immediately switch to a different input stream.
1629 * @param input_file A readable stream.
1631 * @note This function does not reset the start condition to @c INITIAL .
1633 void pcap_restart (FILE * input_file
)
1636 if ( ! YY_CURRENT_BUFFER
){
1637 pcap_ensure_buffer_stack ();
1638 YY_CURRENT_BUFFER_LVALUE
=
1639 pcap__create_buffer(pcap_in
,YY_BUF_SIZE
);
1642 pcap__init_buffer(YY_CURRENT_BUFFER
,input_file
);
1643 pcap__load_buffer_state( );
1646 /** Switch to a different input buffer.
1647 * @param new_buffer The new input buffer.
1650 void pcap__switch_to_buffer (YY_BUFFER_STATE new_buffer
)
1653 /* TODO. We should be able to replace this entire function body
1655 * pcap_pop_buffer_state();
1656 * pcap_push_buffer_state(new_buffer);
1658 pcap_ensure_buffer_stack ();
1659 if ( YY_CURRENT_BUFFER
== new_buffer
)
1662 if ( YY_CURRENT_BUFFER
)
1664 /* Flush out information for old buffer. */
1665 *(yy_c_buf_p
) = (yy_hold_char
);
1666 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
1667 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1670 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1671 pcap__load_buffer_state( );
1673 /* We don't actually know whether we did this switch during
1674 * EOF (pcap_wrap()) processing, but the only time this flag
1675 * is looked at is after pcap_wrap() is called, so it's safe
1676 * to go ahead and always set it.
1678 (yy_did_buffer_switch_on_eof
) = 1;
1681 static void pcap__load_buffer_state (void)
1683 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1684 (yytext_ptr
) = (yy_c_buf_p
) = YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
1685 pcap_in
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
1686 (yy_hold_char
) = *(yy_c_buf_p
);
1689 /** Allocate and initialize an input buffer state.
1690 * @param file A readable stream.
1691 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1693 * @return the allocated buffer state.
1695 YY_BUFFER_STATE
pcap__create_buffer (FILE * file
, int size
)
1699 b
= (YY_BUFFER_STATE
) pcap_alloc(sizeof( struct yy_buffer_state
) );
1701 YY_FATAL_ERROR( "out of dynamic memory in pcap__create_buffer()" );
1703 b
->yy_buf_size
= size
;
1705 /* yy_ch_buf has to be 2 characters longer than the size given because
1706 * we need to put in 2 end-of-buffer characters.
1708 b
->yy_ch_buf
= (char *) pcap_alloc(b
->yy_buf_size
+ 2 );
1709 if ( ! b
->yy_ch_buf
)
1710 YY_FATAL_ERROR( "out of dynamic memory in pcap__create_buffer()" );
1712 b
->yy_is_our_buffer
= 1;
1714 pcap__init_buffer(b
,file
);
1719 /** Destroy the buffer.
1720 * @param b a buffer created with pcap__create_buffer()
1723 void pcap__delete_buffer (YY_BUFFER_STATE b
)
1729 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
1730 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
1732 if ( b
->yy_is_our_buffer
)
1733 pcap_free((void *) b
->yy_ch_buf
);
1735 pcap_free((void *) b
);
1739 extern int isatty (int );
1740 #endif /* __cplusplus */
1742 /* Initializes or reinitializes a buffer.
1743 * This function is sometimes called more than once on the same buffer,
1744 * such as during a pcap_restart() or at EOF.
1746 static void pcap__init_buffer (YY_BUFFER_STATE b
, FILE * file
)
1751 pcap__flush_buffer(b
);
1753 b
->yy_input_file
= file
;
1754 b
->yy_fill_buffer
= 1;
1756 /* If b is the current buffer, then pcap__init_buffer was _probably_
1757 * called from pcap_restart() or through yy_get_next_buffer.
1758 * In that case, we don't want to reset the lineno or column.
1760 if (b
!= YY_CURRENT_BUFFER
){
1761 b
->yy_bs_lineno
= 1;
1762 b
->yy_bs_column
= 0;
1765 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
1770 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1771 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1774 void pcap__flush_buffer (YY_BUFFER_STATE b
)
1781 /* We always need two end-of-buffer characters. The first causes
1782 * a transition to the end-of-buffer state. The second causes
1783 * a jam in that state.
1785 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1786 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1788 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1791 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1793 if ( b
== YY_CURRENT_BUFFER
)
1794 pcap__load_buffer_state( );
1797 /** Pushes the new state onto the stack. The new state becomes
1798 * the current state. This function will allocate the stack
1800 * @param new_buffer The new state.
1803 void pcap_push_buffer_state (YY_BUFFER_STATE new_buffer
)
1805 if (new_buffer
== NULL
)
1808 pcap_ensure_buffer_stack();
1810 /* This block is copied from pcap__switch_to_buffer. */
1811 if ( YY_CURRENT_BUFFER
)
1813 /* Flush out information for old buffer. */
1814 *(yy_c_buf_p
) = (yy_hold_char
);
1815 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
1816 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1819 /* Only push if top exists. Otherwise, replace top. */
1820 if (YY_CURRENT_BUFFER
)
1821 (yy_buffer_stack_top
)++;
1822 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1824 /* copied from pcap__switch_to_buffer. */
1825 pcap__load_buffer_state( );
1826 (yy_did_buffer_switch_on_eof
) = 1;
1829 /** Removes and deletes the top of the stack, if present.
1830 * The next element becomes the new top.
1833 void pcap_pop_buffer_state (void)
1835 if (!YY_CURRENT_BUFFER
)
1838 pcap__delete_buffer(YY_CURRENT_BUFFER
);
1839 YY_CURRENT_BUFFER_LVALUE
= NULL
;
1840 if ((yy_buffer_stack_top
) > 0)
1841 --(yy_buffer_stack_top
);
1843 if (YY_CURRENT_BUFFER
) {
1844 pcap__load_buffer_state( );
1845 (yy_did_buffer_switch_on_eof
) = 1;
1849 /* Allocates the stack if it does not exist.
1850 * Guarantees space for at least one push.
1852 static void pcap_ensure_buffer_stack (void)
1856 if (!(yy_buffer_stack
)) {
1858 /* First allocation is just for 2 elements, since we don't know if this
1859 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1860 * immediate realloc on the next call.
1863 (yy_buffer_stack
) = (struct yy_buffer_state
**)pcap_alloc
1864 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
1867 memset((yy_buffer_stack
), 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
1869 (yy_buffer_stack_max
) = num_to_alloc
;
1870 (yy_buffer_stack_top
) = 0;
1874 if ((yy_buffer_stack_top
) >= ((yy_buffer_stack_max
)) - 1){
1876 /* Increase the buffer to prepare for a possible push. */
1877 int grow_size
= 8 /* arbitrary grow size */;
1879 num_to_alloc
= (yy_buffer_stack_max
) + grow_size
;
1880 (yy_buffer_stack
) = (struct yy_buffer_state
**)pcap_realloc
1882 num_to_alloc
* sizeof(struct yy_buffer_state
*)
1885 /* zero only the new slots.*/
1886 memset((yy_buffer_stack
) + (yy_buffer_stack_max
), 0, grow_size
* sizeof(struct yy_buffer_state
*));
1887 (yy_buffer_stack_max
) = num_to_alloc
;
1891 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1892 * @param base the character buffer
1893 * @param size the size in bytes of the character buffer
1895 * @return the newly allocated buffer state object.
1897 YY_BUFFER_STATE
pcap__scan_buffer (char * base
, yy_size_t size
)
1902 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
1903 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
1904 /* They forgot to leave room for the EOB's. */
1907 b
= (YY_BUFFER_STATE
) pcap_alloc(sizeof( struct yy_buffer_state
) );
1909 YY_FATAL_ERROR( "out of dynamic memory in pcap__scan_buffer()" );
1911 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
1912 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
1913 b
->yy_is_our_buffer
= 0;
1914 b
->yy_input_file
= 0;
1915 b
->yy_n_chars
= b
->yy_buf_size
;
1916 b
->yy_is_interactive
= 0;
1918 b
->yy_fill_buffer
= 0;
1919 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1921 pcap__switch_to_buffer(b
);
1926 /** Setup the input buffer state to scan a string. The next call to pcap_lex() will
1927 * scan from a @e copy of @a str.
1928 * @param yystr a NUL-terminated string to scan
1930 * @return the newly allocated buffer state object.
1931 * @note If you want to scan bytes that may contain NUL values, then use
1932 * pcap__scan_bytes() instead.
1934 YY_BUFFER_STATE
pcap__scan_string (yyconst
char * yystr
)
1937 return pcap__scan_bytes(yystr
,strlen(yystr
) );
1940 /** Setup the input buffer state to scan the given bytes. The next call to pcap_lex() will
1941 * scan from a @e copy of @a bytes.
1942 * @param bytes the byte buffer to scan
1943 * @param len the number of bytes in the buffer pointed to by @a bytes.
1945 * @return the newly allocated buffer state object.
1947 YY_BUFFER_STATE
pcap__scan_bytes (yyconst
char * yybytes
, int _yybytes_len
)
1954 /* Get memory for full buffer, including space for trailing EOB's. */
1955 n
= _yybytes_len
+ 2;
1956 buf
= (char *) pcap_alloc(n
);
1958 YY_FATAL_ERROR( "out of dynamic memory in pcap__scan_bytes()" );
1960 for ( i
= 0; i
< _yybytes_len
; ++i
)
1961 buf
[i
] = yybytes
[i
];
1963 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
1965 b
= pcap__scan_buffer(buf
,n
);
1967 YY_FATAL_ERROR( "bad buffer in pcap__scan_bytes()" );
1969 /* It's okay to grow etc. this buffer, and we should throw it
1970 * away when we're done.
1972 b
->yy_is_our_buffer
= 1;
1977 #ifndef YY_EXIT_FAILURE
1978 #define YY_EXIT_FAILURE 2
1981 static void yy_fatal_error (yyconst
char* msg
)
1983 (void) fprintf( stderr
, "%s\n", msg
);
1984 exit( YY_EXIT_FAILURE
);
1987 /* Redefine yyless() so it works in section 3 code. */
1993 /* Undo effects of setting up pcap_text. */ \
1994 int yyless_macro_arg = (n); \
1995 YY_LESS_LINENO(yyless_macro_arg);\
1996 pcap_text[pcap_leng] = (yy_hold_char); \
1997 (yy_c_buf_p) = pcap_text + yyless_macro_arg; \
1998 (yy_hold_char) = *(yy_c_buf_p); \
1999 *(yy_c_buf_p) = '\0'; \
2000 pcap_leng = yyless_macro_arg; \
2004 /* Accessor methods (get/set functions) to struct members. */
2006 /** Get the current line number.
2009 int pcap_get_lineno (void)
2015 /** Get the input stream.
2018 FILE *pcap_get_in (void)
2023 /** Get the output stream.
2026 FILE *pcap_get_out (void)
2031 /** Get the length of the current token.
2034 int pcap_get_leng (void)
2039 /** Get the current token.
2043 char *pcap_get_text (void)
2048 /** Set the current line number.
2049 * @param line_number
2052 void pcap_set_lineno (int line_number
)
2055 pcap_lineno
= line_number
;
2058 /** Set the input stream. This does not discard the current
2060 * @param in_str A readable stream.
2062 * @see pcap__switch_to_buffer
2064 void pcap_set_in (FILE * in_str
)
2069 void pcap_set_out (FILE * out_str
)
2071 pcap_out
= out_str
;
2074 int pcap_get_debug (void)
2076 return pcap__flex_debug
;
2079 void pcap_set_debug (int bdebug
)
2081 pcap__flex_debug
= bdebug
;
2084 static int yy_init_globals (void)
2086 /* Initialization is the same as for the non-reentrant scanner.
2087 * This function is called from pcap_lex_destroy(), so don't allocate here.
2090 (yy_buffer_stack
) = 0;
2091 (yy_buffer_stack_top
) = 0;
2092 (yy_buffer_stack_max
) = 0;
2093 (yy_c_buf_p
) = (char *) 0;
2097 /* Defined in main.c */
2102 pcap_in
= (FILE *) 0;
2103 pcap_out
= (FILE *) 0;
2106 /* For future reference: Set errno on error, since we are called by
2112 /* pcap_lex_destroy is for both reentrant and non-reentrant scanners. */
2113 int pcap_lex_destroy (void)
2116 /* Pop the buffer stack, destroying each element. */
2117 while(YY_CURRENT_BUFFER
){
2118 pcap__delete_buffer(YY_CURRENT_BUFFER
);
2119 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2120 pcap_pop_buffer_state();
2123 /* Destroy the stack itself. */
2124 pcap_free((yy_buffer_stack
) );
2125 (yy_buffer_stack
) = NULL
;
2127 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2128 * pcap_lex() is called, initialization will occur. */
2135 * Internal utility routines.
2139 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
)
2142 for ( i
= 0; i
< n
; ++i
)
2147 #ifdef YY_NEED_STRLEN
2148 static int yy_flex_strlen (yyconst
char * s
)
2151 for ( n
= 0; s
[n
]; ++n
)
2158 void *pcap_alloc (yy_size_t size
)
2160 return (void *) malloc( size
);
2163 void *pcap_realloc (void * ptr
, yy_size_t size
)
2165 /* The cast to (char *) in the following accommodates both
2166 * implementations that use char* generic pointers, and those
2167 * that use void* generic pointers. It works with the latter
2168 * because both ANSI C and C++ allow castless assignment from
2169 * any pointer type to void*, and deal with argument conversions
2170 * as though doing an assignment.
2172 return (void *) realloc( (char *) ptr
, size
);
2175 void pcap_free (void * ptr
)
2177 free( (char *) ptr
); /* see pcap_realloc() for (char *) cast */
2180 #define YYTABLES_NAME "yytables"
2182 #line 146 "scanner.l"
2193 * Also define a pcap_wrap. Note that if we're using flex, it will
2194 * define a macro to map this identifier to pcap_wrap.
2202 /* Hex digit to integer. */
2209 else if (islower(c
))
2210 return c
- 'a' + 10;
2212 return c
- 'A' + 10;
2216 * Convert string to integer. Just like atoi(), but checks for
2217 * preceding 0x or 0 and uses hex or octal instead of decimal.
2227 if (s
[1] == 'x' || s
[1] == 'X') {
2237 n
= n
* base
+ xdtoi(*s
++);