nexmon – Blame information for rev 1

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