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