libnl  3.2.13
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 int pktloc_get_column (yyscan_t yyscanner );
571 
572 void pktloc_set_column (int column_no ,yyscan_t yyscanner );
573 
574 YYSTYPE * pktloc_get_lval (yyscan_t yyscanner );
575 
576 void pktloc_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
577 
578  YYLTYPE *pktloc_get_lloc (yyscan_t yyscanner );
579 
580  void pktloc_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
581 
582 /* Macros after this point can all be overridden by user definitions in
583  * section 1.
584  */
585 
586 #ifndef YY_SKIP_YYWRAP
587 #ifdef __cplusplus
588 extern "C" int pktloc_wrap (yyscan_t yyscanner );
589 #else
590 extern int pktloc_wrap (yyscan_t yyscanner );
591 #endif
592 #endif
593 
594 #ifndef yytext_ptr
595 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
596 #endif
597 
598 #ifdef YY_NEED_STRLEN
599 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
600 #endif
601 
602 #ifndef YY_NO_INPUT
603 
604 #ifdef __cplusplus
605 static int yyinput (yyscan_t yyscanner );
606 #else
607 static int input (yyscan_t yyscanner );
608 #endif
609 
610 #endif
611 
612 /* Amount of stuff to slurp up with each read. */
613 #ifndef YY_READ_BUF_SIZE
614 #define YY_READ_BUF_SIZE 8192
615 #endif
616 
617 /* Copy whatever the last rule matched to the standard output. */
618 #ifndef ECHO
619 /* This used to be an fputs(), but since the string might contain NUL's,
620  * we now use fwrite().
621  */
622 #define ECHO fwrite( yytext, yyleng, 1, yyout )
623 #endif
624 
625 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
626  * is returned in "result".
627  */
628 #ifndef YY_INPUT
629 #define YY_INPUT(buf,result,max_size) \
630  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
631  { \
632  int c = '*'; \
633  unsigned n; \
634  for ( n = 0; n < max_size && \
635  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
636  buf[n] = (char) c; \
637  if ( c == '\n' ) \
638  buf[n++] = (char) c; \
639  if ( c == EOF && ferror( yyin ) ) \
640  YY_FATAL_ERROR( "input in flex scanner failed" ); \
641  result = n; \
642  } \
643  else \
644  { \
645  errno=0; \
646  while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
647  { \
648  if( errno != EINTR) \
649  { \
650  YY_FATAL_ERROR( "input in flex scanner failed" ); \
651  break; \
652  } \
653  errno=0; \
654  clearerr(yyin); \
655  } \
656  }\
657 \
658 
659 #endif
660 
661 /* No semi-colon after return; correct usage is to write "yyterminate();" -
662  * we don't want an extra ';' after the "return" because that will cause
663  * some compilers to complain about unreachable statements.
664  */
665 #ifndef yyterminate
666 #define yyterminate() return YY_NULL
667 #endif
668 
669 /* Number of entries by which start-condition stack grows. */
670 #ifndef YY_START_STACK_INCR
671 #define YY_START_STACK_INCR 25
672 #endif
673 
674 /* Report a fatal error. */
675 #ifndef YY_FATAL_ERROR
676 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
677 #endif
678 
679 /* end tables serialization structures and prototypes */
680 
681 /* Default declaration of generated scanner - a define so the user can
682  * easily add parameters.
683  */
684 #ifndef YY_DECL
685 #define YY_DECL_IS_OURS 1
686 
687 extern int pktloc_lex \
688  (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
689 
690 #define YY_DECL int pktloc_lex \
691  (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
692 #endif /* !YY_DECL */
693 
694 /* Code executed at the beginning of each rule, after yytext and yyleng
695  * have been set up.
696  */
697 #ifndef YY_USER_ACTION
698 #define YY_USER_ACTION
699 #endif
700 
701 /* Code executed at the end of each rule. */
702 #ifndef YY_BREAK
703 #define YY_BREAK break;
704 #endif
705 
706 #define YY_RULE_SETUP \
707  YY_USER_ACTION
708 
709 /** The main scanner function which does all the work.
710  */
711 YY_DECL
712 {
713  register yy_state_type yy_current_state;
714  register char *yy_cp, *yy_bp;
715  register int yy_act;
716  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
717 
718 #line 20 "route/pktloc_grammar.l"
719 
720 
721 #line 722 "route/pktloc_grammar.c"
722 
723  yylval = yylval_param;
724 
725  yylloc = yylloc_param;
726 
727  if ( !yyg->yy_init )
728  {
729  yyg->yy_init = 1;
730 
731 #ifdef YY_USER_INIT
732  YY_USER_INIT;
733 #endif
734 
735  if ( ! yyg->yy_start )
736  yyg->yy_start = 1; /* first start state */
737 
738  if ( ! yyin )
739  yyin = stdin;
740 
741  if ( ! yyout )
742  yyout = stdout;
743 
744  if ( ! YY_CURRENT_BUFFER ) {
745  pktloc_ensure_buffer_stack (yyscanner);
746  YY_CURRENT_BUFFER_LVALUE =
747  pktloc__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
748  }
749 
750  pktloc__load_buffer_state(yyscanner );
751  }
752 
753  while ( 1 ) /* loops until end-of-file is reached */
754  {
755  yy_cp = yyg->yy_c_buf_p;
756 
757  /* Support of yytext. */
758  *yy_cp = yyg->yy_hold_char;
759 
760  /* yy_bp points to the position in yy_ch_buf of the start of
761  * the current run.
762  */
763  yy_bp = yy_cp;
764 
765  yy_current_state = yyg->yy_start;
766 yy_match:
767  do
768  {
769  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
770  if ( yy_accept[yy_current_state] )
771  {
772  yyg->yy_last_accepting_state = yy_current_state;
773  yyg->yy_last_accepting_cpos = yy_cp;
774  }
775  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
776  {
777  yy_current_state = (int) yy_def[yy_current_state];
778  if ( yy_current_state >= 47 )
779  yy_c = yy_meta[(unsigned int) yy_c];
780  }
781  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
782  ++yy_cp;
783  }
784  while ( yy_base[yy_current_state] != 87 );
785 
786 yy_find_action:
787  yy_act = yy_accept[yy_current_state];
788  if ( yy_act == 0 )
789  { /* have to back up */
790  yy_cp = yyg->yy_last_accepting_cpos;
791  yy_current_state = yyg->yy_last_accepting_state;
792  yy_act = yy_accept[yy_current_state];
793  }
794 
795  YY_DO_BEFORE_ACTION;
796 
797 do_action: /* This label is used only to access EOF actions. */
798 
799  switch ( yy_act )
800  { /* beginning of action switch */
801  case 0: /* must back up */
802  /* undo the effects of YY_DO_BEFORE_ACTION */
803  *yy_cp = yyg->yy_hold_char;
804  yy_cp = yyg->yy_last_accepting_cpos;
805  yy_current_state = yyg->yy_last_accepting_state;
806  goto yy_find_action;
807 
808 case 1:
809 /* rule 1 can match eol */
810 YY_RULE_SETUP
811 #line 22 "route/pktloc_grammar.l"
812 
813  YY_BREAK
814 case 2:
815 YY_RULE_SETUP
816 #line 24 "route/pktloc_grammar.l"
817 
818  YY_BREAK
819 case 3:
820 #line 27 "route/pktloc_grammar.l"
821 case 4:
822 YY_RULE_SETUP
823 #line 27 "route/pktloc_grammar.l"
824 {
825  yylval->i = strtoul(yytext, NULL, 0);
826  return NUMBER;
827  }
828  YY_BREAK
829 case 5:
830 YY_RULE_SETUP
831 #line 32 "route/pktloc_grammar.l"
832 { return yylval->i = yytext[0]; }
833  YY_BREAK
834 case 6:
835 YY_RULE_SETUP
836 #line 34 "route/pktloc_grammar.l"
837 { yylval->i = TCF_EM_ALIGN_U8; return ALIGN; }
838  YY_BREAK
839 case 7:
840 YY_RULE_SETUP
841 #line 35 "route/pktloc_grammar.l"
842 { yylval->i = TCF_EM_ALIGN_U16; return ALIGN; }
843  YY_BREAK
844 case 8:
845 YY_RULE_SETUP
846 #line 36 "route/pktloc_grammar.l"
847 { yylval->i = TCF_EM_ALIGN_U32; return ALIGN; }
848  YY_BREAK
849 case 9:
850 #line 39 "route/pktloc_grammar.l"
851 case 10:
852 YY_RULE_SETUP
853 #line 39 "route/pktloc_grammar.l"
854 { yylval->i = TCF_LAYER_LINK; return LAYER; }
855  YY_BREAK
856 case 11:
857 #line 41 "route/pktloc_grammar.l"
858 case 12:
859 YY_RULE_SETUP
860 #line 41 "route/pktloc_grammar.l"
861 { yylval->i = TCF_LAYER_NETWORK; return LAYER; }
862  YY_BREAK
863 case 13:
864 #line 43 "route/pktloc_grammar.l"
865 case 14:
866 YY_RULE_SETUP
867 #line 43 "route/pktloc_grammar.l"
868 { yylval->i = TCF_LAYER_TRANSPORT; return LAYER; }
869  YY_BREAK
870 case 15:
871 YY_RULE_SETUP
872 #line 46 "route/pktloc_grammar.l"
873 {
874  yylval->s = strdup(yytext);
875  if (yylval->s == NULL)
876  return ERROR;
877  return NAME;
878  }
879  YY_BREAK
880 case 16:
881 YY_RULE_SETUP
882 #line 52 "route/pktloc_grammar.l"
883 ECHO;
884  YY_BREAK
885 #line 886 "route/pktloc_grammar.c"
886 case YY_STATE_EOF(INITIAL):
887  yyterminate();
888 
889  case YY_END_OF_BUFFER:
890  {
891  /* Amount of text matched not including the EOB char. */
892  int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
893 
894  /* Undo the effects of YY_DO_BEFORE_ACTION. */
895  *yy_cp = yyg->yy_hold_char;
896  YY_RESTORE_YY_MORE_OFFSET
897 
898  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
899  {
900  /* We're scanning a new file or input source. It's
901  * possible that this happened because the user
902  * just pointed yyin at a new source and called
903  * pktloc_lex(). If so, then we have to assure
904  * consistency between YY_CURRENT_BUFFER and our
905  * globals. Here is the right place to do so, because
906  * this is the first action (other than possibly a
907  * back-up) that will match for the new input source.
908  */
909  yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
910  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
911  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
912  }
913 
914  /* Note that here we test for yy_c_buf_p "<=" to the position
915  * of the first EOB in the buffer, since yy_c_buf_p will
916  * already have been incremented past the NUL character
917  * (since all states make transitions on EOB to the
918  * end-of-buffer state). Contrast this with the test
919  * in input().
920  */
921  if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
922  { /* This was really a NUL. */
923  yy_state_type yy_next_state;
924 
925  yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
926 
927  yy_current_state = yy_get_previous_state( yyscanner );
928 
929  /* Okay, we're now positioned to make the NUL
930  * transition. We couldn't have
931  * yy_get_previous_state() go ahead and do it
932  * for us because it doesn't know how to deal
933  * with the possibility of jamming (and we don't
934  * want to build jamming into it because then it
935  * will run more slowly).
936  */
937 
938  yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
939 
940  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
941 
942  if ( yy_next_state )
943  {
944  /* Consume the NUL. */
945  yy_cp = ++yyg->yy_c_buf_p;
946  yy_current_state = yy_next_state;
947  goto yy_match;
948  }
949 
950  else
951  {
952  yy_cp = yyg->yy_c_buf_p;
953  goto yy_find_action;
954  }
955  }
956 
957  else switch ( yy_get_next_buffer( yyscanner ) )
958  {
959  case EOB_ACT_END_OF_FILE:
960  {
961  yyg->yy_did_buffer_switch_on_eof = 0;
962 
963  if ( pktloc_wrap(yyscanner ) )
964  {
965  /* Note: because we've taken care in
966  * yy_get_next_buffer() to have set up
967  * yytext, we can now set up
968  * yy_c_buf_p so that if some total
969  * hoser (like flex itself) wants to
970  * call the scanner after we return the
971  * YY_NULL, it'll still work - another
972  * YY_NULL will get returned.
973  */
974  yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
975 
976  yy_act = YY_STATE_EOF(YY_START);
977  goto do_action;
978  }
979 
980  else
981  {
982  if ( ! yyg->yy_did_buffer_switch_on_eof )
983  YY_NEW_FILE;
984  }
985  break;
986  }
987 
988  case EOB_ACT_CONTINUE_SCAN:
989  yyg->yy_c_buf_p =
990  yyg->yytext_ptr + yy_amount_of_matched_text;
991 
992  yy_current_state = yy_get_previous_state( yyscanner );
993 
994  yy_cp = yyg->yy_c_buf_p;
995  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
996  goto yy_match;
997 
998  case EOB_ACT_LAST_MATCH:
999  yyg->yy_c_buf_p =
1000  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1001 
1002  yy_current_state = yy_get_previous_state( yyscanner );
1003 
1004  yy_cp = yyg->yy_c_buf_p;
1005  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1006  goto yy_find_action;
1007  }
1008  break;
1009  }
1010 
1011  default:
1012  YY_FATAL_ERROR(
1013  "fatal flex scanner internal error--no action found" );
1014  } /* end of action switch */
1015  } /* end of scanning one token */
1016 } /* end of pktloc_lex */
1017 
1018 /* yy_get_next_buffer - try to read in a new buffer
1019  *
1020  * Returns a code representing an action:
1021  * EOB_ACT_LAST_MATCH -
1022  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1023  * EOB_ACT_END_OF_FILE - end of file
1024  */
1025 static int yy_get_next_buffer (yyscan_t yyscanner)
1026 {
1027  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1028  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1029  register char *source = yyg->yytext_ptr;
1030  register int number_to_move, i;
1031  int ret_val;
1032 
1033  if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1034  YY_FATAL_ERROR(
1035  "fatal flex scanner internal error--end of buffer missed" );
1036 
1037  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1038  { /* Don't try to fill the buffer, so this is an EOF. */
1039  if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1040  {
1041  /* We matched a single character, the EOB, so
1042  * treat this as a final EOF.
1043  */
1044  return EOB_ACT_END_OF_FILE;
1045  }
1046 
1047  else
1048  {
1049  /* We matched some text prior to the EOB, first
1050  * process it.
1051  */
1052  return EOB_ACT_LAST_MATCH;
1053  }
1054  }
1055 
1056  /* Try to read more data. */
1057 
1058  /* First move last chars to start of buffer. */
1059  number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1060 
1061  for ( i = 0; i < number_to_move; ++i )
1062  *(dest++) = *(source++);
1063 
1064  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1065  /* don't do the read, it's not guaranteed to return an EOF,
1066  * just force an EOF
1067  */
1068  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1069 
1070  else
1071  {
1072  int num_to_read =
1073  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1074 
1075  while ( num_to_read <= 0 )
1076  { /* Not enough room in the buffer - grow it. */
1077 
1078  /* just a shorter name for the current buffer */
1079  YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1080 
1081  int yy_c_buf_p_offset =
1082  (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1083 
1084  if ( b->yy_is_our_buffer )
1085  {
1086  int new_size = b->yy_buf_size * 2;
1087 
1088  if ( new_size <= 0 )
1089  b->yy_buf_size += b->yy_buf_size / 8;
1090  else
1091  b->yy_buf_size *= 2;
1092 
1093  b->yy_ch_buf = (char *)
1094  /* Include room in for 2 EOB chars. */
1095  pktloc_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1096  }
1097  else
1098  /* Can't grow it, we don't own it. */
1099  b->yy_ch_buf = 0;
1100 
1101  if ( ! b->yy_ch_buf )
1102  YY_FATAL_ERROR(
1103  "fatal error - scanner input buffer overflow" );
1104 
1105  yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1106 
1107  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1108  number_to_move - 1;
1109 
1110  }
1111 
1112  if ( num_to_read > YY_READ_BUF_SIZE )
1113  num_to_read = YY_READ_BUF_SIZE;
1114 
1115  /* Read in more data. */
1116  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1117  yyg->yy_n_chars, (size_t) num_to_read );
1118 
1119  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1120  }
1121 
1122  if ( yyg->yy_n_chars == 0 )
1123  {
1124  if ( number_to_move == YY_MORE_ADJ )
1125  {
1126  ret_val = EOB_ACT_END_OF_FILE;
1127  pktloc_restart(yyin ,yyscanner);
1128  }
1129 
1130  else
1131  {
1132  ret_val = EOB_ACT_LAST_MATCH;
1133  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1134  YY_BUFFER_EOF_PENDING;
1135  }
1136  }
1137 
1138  else
1139  ret_val = EOB_ACT_CONTINUE_SCAN;
1140 
1141  if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1142  /* Extend the array by 50%, plus the number we really need. */
1143  yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1144  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) pktloc_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1145  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1146  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1147  }
1148 
1149  yyg->yy_n_chars += number_to_move;
1150  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1151  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1152 
1153  yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1154 
1155  return ret_val;
1156 }
1157 
1158 /* yy_get_previous_state - get the state just before the EOB char was reached */
1159 
1160  static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1161 {
1162  register yy_state_type yy_current_state;
1163  register char *yy_cp;
1164  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1165 
1166  yy_current_state = yyg->yy_start;
1167 
1168  for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1169  {
1170  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1171  if ( yy_accept[yy_current_state] )
1172  {
1173  yyg->yy_last_accepting_state = yy_current_state;
1174  yyg->yy_last_accepting_cpos = yy_cp;
1175  }
1176  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1177  {
1178  yy_current_state = (int) yy_def[yy_current_state];
1179  if ( yy_current_state >= 47 )
1180  yy_c = yy_meta[(unsigned int) yy_c];
1181  }
1182  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1183  }
1184 
1185  return yy_current_state;
1186 }
1187 
1188 /* yy_try_NUL_trans - try to make a transition on the NUL character
1189  *
1190  * synopsis
1191  * next_state = yy_try_NUL_trans( current_state );
1192  */
1193  static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1194 {
1195  register int yy_is_jam;
1196  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1197  register char *yy_cp = yyg->yy_c_buf_p;
1198 
1199  register YY_CHAR yy_c = 1;
1200  if ( yy_accept[yy_current_state] )
1201  {
1202  yyg->yy_last_accepting_state = yy_current_state;
1203  yyg->yy_last_accepting_cpos = yy_cp;
1204  }
1205  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1206  {
1207  yy_current_state = (int) yy_def[yy_current_state];
1208  if ( yy_current_state >= 47 )
1209  yy_c = yy_meta[(unsigned int) yy_c];
1210  }
1211  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1212  yy_is_jam = (yy_current_state == 46);
1213 
1214  return yy_is_jam ? 0 : yy_current_state;
1215 }
1216 
1217 #ifndef YY_NO_INPUT
1218 #ifdef __cplusplus
1219  static int yyinput (yyscan_t yyscanner)
1220 #else
1221  static int input (yyscan_t yyscanner)
1222 #endif
1223 
1224 {
1225  int c;
1226  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1227 
1228  *yyg->yy_c_buf_p = yyg->yy_hold_char;
1229 
1230  if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1231  {
1232  /* yy_c_buf_p now points to the character we want to return.
1233  * If this occurs *before* the EOB characters, then it's a
1234  * valid NUL; if not, then we've hit the end of the buffer.
1235  */
1236  if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1237  /* This was really a NUL. */
1238  *yyg->yy_c_buf_p = '\0';
1239 
1240  else
1241  { /* need more input */
1242  int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1243  ++yyg->yy_c_buf_p;
1244 
1245  switch ( yy_get_next_buffer( yyscanner ) )
1246  {
1247  case EOB_ACT_LAST_MATCH:
1248  /* This happens because yy_g_n_b()
1249  * sees that we've accumulated a
1250  * token and flags that we need to
1251  * try matching the token before
1252  * proceeding. But for input(),
1253  * there's no matching to consider.
1254  * So convert the EOB_ACT_LAST_MATCH
1255  * to EOB_ACT_END_OF_FILE.
1256  */
1257 
1258  /* Reset buffer status. */
1259  pktloc_restart(yyin ,yyscanner);
1260 
1261  /*FALLTHROUGH*/
1262 
1263  case EOB_ACT_END_OF_FILE:
1264  {
1265  if ( pktloc_wrap(yyscanner ) )
1266  return EOF;
1267 
1268  if ( ! yyg->yy_did_buffer_switch_on_eof )
1269  YY_NEW_FILE;
1270 #ifdef __cplusplus
1271  return yyinput(yyscanner);
1272 #else
1273  return input(yyscanner);
1274 #endif
1275  }
1276 
1277  case EOB_ACT_CONTINUE_SCAN:
1278  yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1279  break;
1280  }
1281  }
1282  }
1283 
1284  c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1285  *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1286  yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1287 
1288  return c;
1289 }
1290 #endif /* ifndef YY_NO_INPUT */
1291 
1292 /** Immediately switch to a different input stream.
1293  * @param input_file A readable stream.
1294  * @param yyscanner The scanner object.
1295  * @note This function does not reset the start condition to @c INITIAL .
1296  */
1297  void pktloc_restart (FILE * input_file , yyscan_t yyscanner)
1298 {
1299  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1300 
1301  if ( ! YY_CURRENT_BUFFER ){
1302  pktloc_ensure_buffer_stack (yyscanner);
1303  YY_CURRENT_BUFFER_LVALUE =
1304  pktloc__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1305  }
1306 
1307  pktloc__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1308  pktloc__load_buffer_state(yyscanner );
1309 }
1310 
1311 /** Switch to a different input buffer.
1312  * @param new_buffer The new input buffer.
1313  * @param yyscanner The scanner object.
1314  */
1315  void pktloc__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1316 {
1317  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1318 
1319  /* TODO. We should be able to replace this entire function body
1320  * with
1321  * pktloc_pop_buffer_state();
1322  * pktloc_push_buffer_state(new_buffer);
1323  */
1324  pktloc_ensure_buffer_stack (yyscanner);
1325  if ( YY_CURRENT_BUFFER == new_buffer )
1326  return;
1327 
1328  if ( YY_CURRENT_BUFFER )
1329  {
1330  /* Flush out information for old buffer. */
1331  *yyg->yy_c_buf_p = yyg->yy_hold_char;
1332  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1333  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1334  }
1335 
1336  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1337  pktloc__load_buffer_state(yyscanner );
1338 
1339  /* We don't actually know whether we did this switch during
1340  * EOF (pktloc_wrap()) processing, but the only time this flag
1341  * is looked at is after pktloc_wrap() is called, so it's safe
1342  * to go ahead and always set it.
1343  */
1344  yyg->yy_did_buffer_switch_on_eof = 1;
1345 }
1346 
1347 static void pktloc__load_buffer_state (yyscan_t yyscanner)
1348 {
1349  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1350  yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1351  yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1352  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1353  yyg->yy_hold_char = *yyg->yy_c_buf_p;
1354 }
1355 
1356 /** Allocate and initialize an input buffer state.
1357  * @param file A readable stream.
1358  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1359  * @param yyscanner The scanner object.
1360  * @return the allocated buffer state.
1361  */
1362  YY_BUFFER_STATE pktloc__create_buffer (FILE * file, int size , yyscan_t yyscanner)
1363 {
1364  YY_BUFFER_STATE b;
1365 
1366  b = (YY_BUFFER_STATE) pktloc_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1367  if ( ! b )
1368  YY_FATAL_ERROR( "out of dynamic memory in pktloc__create_buffer()" );
1369 
1370  b->yy_buf_size = size;
1371 
1372  /* yy_ch_buf has to be 2 characters longer than the size given because
1373  * we need to put in 2 end-of-buffer characters.
1374  */
1375  b->yy_ch_buf = (char *) pktloc_alloc(b->yy_buf_size + 2 ,yyscanner );
1376  if ( ! b->yy_ch_buf )
1377  YY_FATAL_ERROR( "out of dynamic memory in pktloc__create_buffer()" );
1378 
1379  b->yy_is_our_buffer = 1;
1380 
1381  pktloc__init_buffer(b,file ,yyscanner);
1382 
1383  return b;
1384 }
1385 
1386 /** Destroy the buffer.
1387  * @param b a buffer created with pktloc__create_buffer()
1388  * @param yyscanner The scanner object.
1389  */
1390  void pktloc__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1391 {
1392  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1393 
1394  if ( ! b )
1395  return;
1396 
1397  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1398  YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1399 
1400  if ( b->yy_is_our_buffer )
1401  pktloc_free((void *) b->yy_ch_buf ,yyscanner );
1402 
1403  pktloc_free((void *) b ,yyscanner );
1404 }
1405 
1406 #ifndef __cplusplus
1407 extern int isatty (int );
1408 #endif /* __cplusplus */
1409 
1410 /* Initializes or reinitializes a buffer.
1411  * This function is sometimes called more than once on the same buffer,
1412  * such as during a pktloc_restart() or at EOF.
1413  */
1414  static void pktloc__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1415 
1416 {
1417  int oerrno = errno;
1418  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1419 
1420  pktloc__flush_buffer(b ,yyscanner);
1421 
1422  b->yy_input_file = file;
1423  b->yy_fill_buffer = 1;
1424 
1425  /* If b is the current buffer, then pktloc__init_buffer was _probably_
1426  * called from pktloc_restart() or through yy_get_next_buffer.
1427  * In that case, we don't want to reset the lineno or column.
1428  */
1429  if (b != YY_CURRENT_BUFFER){
1430  b->yy_bs_lineno = 1;
1431  b->yy_bs_column = 0;
1432  }
1433 
1434  b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1435 
1436  errno = oerrno;
1437 }
1438 
1439 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1440  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1441  * @param yyscanner The scanner object.
1442  */
1443  void pktloc__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1444 {
1445  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1446  if ( ! b )
1447  return;
1448 
1449  b->yy_n_chars = 0;
1450 
1451  /* We always need two end-of-buffer characters. The first causes
1452  * a transition to the end-of-buffer state. The second causes
1453  * a jam in that state.
1454  */
1455  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1456  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1457 
1458  b->yy_buf_pos = &b->yy_ch_buf[0];
1459 
1460  b->yy_at_bol = 1;
1461  b->yy_buffer_status = YY_BUFFER_NEW;
1462 
1463  if ( b == YY_CURRENT_BUFFER )
1464  pktloc__load_buffer_state(yyscanner );
1465 }
1466 
1467 /** Pushes the new state onto the stack. The new state becomes
1468  * the current state. This function will allocate the stack
1469  * if necessary.
1470  * @param new_buffer The new state.
1471  * @param yyscanner The scanner object.
1472  */
1473 void pktloc_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1474 {
1475  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1476  if (new_buffer == NULL)
1477  return;
1478 
1479  pktloc_ensure_buffer_stack(yyscanner);
1480 
1481  /* This block is copied from pktloc__switch_to_buffer. */
1482  if ( YY_CURRENT_BUFFER )
1483  {
1484  /* Flush out information for old buffer. */
1485  *yyg->yy_c_buf_p = yyg->yy_hold_char;
1486  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1487  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1488  }
1489 
1490  /* Only push if top exists. Otherwise, replace top. */
1491  if (YY_CURRENT_BUFFER)
1492  yyg->yy_buffer_stack_top++;
1493  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1494 
1495  /* copied from pktloc__switch_to_buffer. */
1496  pktloc__load_buffer_state(yyscanner );
1497  yyg->yy_did_buffer_switch_on_eof = 1;
1498 }
1499 
1500 /** Removes and deletes the top of the stack, if present.
1501  * The next element becomes the new top.
1502  * @param yyscanner The scanner object.
1503  */
1504 void pktloc_pop_buffer_state (yyscan_t yyscanner)
1505 {
1506  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1507  if (!YY_CURRENT_BUFFER)
1508  return;
1509 
1510  pktloc__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
1511  YY_CURRENT_BUFFER_LVALUE = NULL;
1512  if (yyg->yy_buffer_stack_top > 0)
1513  --yyg->yy_buffer_stack_top;
1514 
1515  if (YY_CURRENT_BUFFER) {
1516  pktloc__load_buffer_state(yyscanner );
1517  yyg->yy_did_buffer_switch_on_eof = 1;
1518  }
1519 }
1520 
1521 /* Allocates the stack if it does not exist.
1522  * Guarantees space for at least one push.
1523  */
1524 static void pktloc_ensure_buffer_stack (yyscan_t yyscanner)
1525 {
1526  int num_to_alloc;
1527  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1528 
1529  if (!yyg->yy_buffer_stack) {
1530 
1531  /* First allocation is just for 2 elements, since we don't know if this
1532  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1533  * immediate realloc on the next call.
1534  */
1535  num_to_alloc = 1;
1536  yyg->yy_buffer_stack = (struct yy_buffer_state**)pktloc_alloc
1537  (num_to_alloc * sizeof(struct yy_buffer_state*)
1538  , yyscanner);
1539  if ( ! yyg->yy_buffer_stack )
1540  YY_FATAL_ERROR( "out of dynamic memory in pktloc_ensure_buffer_stack()" );
1541 
1542  memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1543 
1544  yyg->yy_buffer_stack_max = num_to_alloc;
1545  yyg->yy_buffer_stack_top = 0;
1546  return;
1547  }
1548 
1549  if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1550 
1551  /* Increase the buffer to prepare for a possible push. */
1552  int grow_size = 8 /* arbitrary grow size */;
1553 
1554  num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1555  yyg->yy_buffer_stack = (struct yy_buffer_state**)pktloc_realloc
1556  (yyg->yy_buffer_stack,
1557  num_to_alloc * sizeof(struct yy_buffer_state*)
1558  , yyscanner);
1559  if ( ! yyg->yy_buffer_stack )
1560  YY_FATAL_ERROR( "out of dynamic memory in pktloc_ensure_buffer_stack()" );
1561 
1562  /* zero only the new slots.*/
1563  memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1564  yyg->yy_buffer_stack_max = num_to_alloc;
1565  }
1566 }
1567 
1568 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1569  * @param base the character buffer
1570  * @param size the size in bytes of the character buffer
1571  * @param yyscanner The scanner object.
1572  * @return the newly allocated buffer state object.
1573  */
1574 YY_BUFFER_STATE pktloc__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
1575 {
1576  YY_BUFFER_STATE b;
1577 
1578  if ( size < 2 ||
1579  base[size-2] != YY_END_OF_BUFFER_CHAR ||
1580  base[size-1] != YY_END_OF_BUFFER_CHAR )
1581  /* They forgot to leave room for the EOB's. */
1582  return 0;
1583 
1584  b = (YY_BUFFER_STATE) pktloc_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1585  if ( ! b )
1586  YY_FATAL_ERROR( "out of dynamic memory in pktloc__scan_buffer()" );
1587 
1588  b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1589  b->yy_buf_pos = b->yy_ch_buf = base;
1590  b->yy_is_our_buffer = 0;
1591  b->yy_input_file = 0;
1592  b->yy_n_chars = b->yy_buf_size;
1593  b->yy_is_interactive = 0;
1594  b->yy_at_bol = 1;
1595  b->yy_fill_buffer = 0;
1596  b->yy_buffer_status = YY_BUFFER_NEW;
1597 
1598  pktloc__switch_to_buffer(b ,yyscanner );
1599 
1600  return b;
1601 }
1602 
1603 /** Setup the input buffer state to scan a string. The next call to pktloc_lex() will
1604  * scan from a @e copy of @a str.
1605  * @param yystr a NUL-terminated string to scan
1606  * @param yyscanner The scanner object.
1607  * @return the newly allocated buffer state object.
1608  * @note If you want to scan bytes that may contain NUL values, then use
1609  * pktloc__scan_bytes() instead.
1610  */
1611 YY_BUFFER_STATE pktloc__scan_string (yyconst char * yystr , yyscan_t yyscanner)
1612 {
1613 
1614  return pktloc__scan_bytes(yystr,strlen(yystr) ,yyscanner);
1615 }
1616 
1617 /** Setup the input buffer state to scan the given bytes. The next call to pktloc_lex() will
1618  * scan from a @e copy of @a bytes.
1619  * @param bytes the byte buffer to scan
1620  * @param len the number of bytes in the buffer pointed to by @a bytes.
1621  * @param yyscanner The scanner object.
1622  * @return the newly allocated buffer state object.
1623  */
1624 YY_BUFFER_STATE pktloc__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
1625 {
1626  YY_BUFFER_STATE b;
1627  char *buf;
1628  yy_size_t n;
1629  int i;
1630 
1631  /* Get memory for full buffer, including space for trailing EOB's. */
1632  n = _yybytes_len + 2;
1633  buf = (char *) pktloc_alloc(n ,yyscanner );
1634  if ( ! buf )
1635  YY_FATAL_ERROR( "out of dynamic memory in pktloc__scan_bytes()" );
1636 
1637  for ( i = 0; i < _yybytes_len; ++i )
1638  buf[i] = yybytes[i];
1639 
1640  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1641 
1642  b = pktloc__scan_buffer(buf,n ,yyscanner);
1643  if ( ! b )
1644  YY_FATAL_ERROR( "bad buffer in pktloc__scan_bytes()" );
1645 
1646  /* It's okay to grow etc. this buffer, and we should throw it
1647  * away when we're done.
1648  */
1649  b->yy_is_our_buffer = 1;
1650 
1651  return b;
1652 }
1653 
1654 #ifndef YY_EXIT_FAILURE
1655 #define YY_EXIT_FAILURE 2
1656 #endif
1657 
1658 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
1659 {
1660  (void) fprintf( stderr, "%s\n", msg );
1661  exit( YY_EXIT_FAILURE );
1662 }
1663 
1664 /* Redefine yyless() so it works in section 3 code. */
1665 
1666 #undef yyless
1667 #define yyless(n) \
1668  do \
1669  { \
1670  /* Undo effects of setting up yytext. */ \
1671  int yyless_macro_arg = (n); \
1672  YY_LESS_LINENO(yyless_macro_arg);\
1673  yytext[yyleng] = yyg->yy_hold_char; \
1674  yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
1675  yyg->yy_hold_char = *yyg->yy_c_buf_p; \
1676  *yyg->yy_c_buf_p = '\0'; \
1677  yyleng = yyless_macro_arg; \
1678  } \
1679  while ( 0 )
1680 
1681 /* Accessor methods (get/set functions) to struct members. */
1682 
1683 /** Get the user-defined data for this scanner.
1684  * @param yyscanner The scanner object.
1685  */
1686 YY_EXTRA_TYPE pktloc_get_extra (yyscan_t yyscanner)
1687 {
1688  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1689  return yyextra;
1690 }
1691 
1692 /** Get the current line number.
1693  * @param yyscanner The scanner object.
1694  */
1695 int pktloc_get_lineno (yyscan_t yyscanner)
1696 {
1697  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1698 
1699  if (! YY_CURRENT_BUFFER)
1700  return 0;
1701 
1702  return yylineno;
1703 }
1704 
1705 /** Get the current column number.
1706  * @param yyscanner The scanner object.
1707  */
1708 int pktloc_get_column (yyscan_t yyscanner)
1709 {
1710  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1711 
1712  if (! YY_CURRENT_BUFFER)
1713  return 0;
1714 
1715  return yycolumn;
1716 }
1717 
1718 /** Get the input stream.
1719  * @param yyscanner The scanner object.
1720  */
1721 FILE *pktloc_get_in (yyscan_t yyscanner)
1722 {
1723  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1724  return yyin;
1725 }
1726 
1727 /** Get the output stream.
1728  * @param yyscanner The scanner object.
1729  */
1730 FILE *pktloc_get_out (yyscan_t yyscanner)
1731 {
1732  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1733  return yyout;
1734 }
1735 
1736 /** Get the length of the current token.
1737  * @param yyscanner The scanner object.
1738  */
1739 int pktloc_get_leng (yyscan_t yyscanner)
1740 {
1741  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1742  return yyleng;
1743 }
1744 
1745 /** Get the current token.
1746  * @param yyscanner The scanner object.
1747  */
1748 
1749 char *pktloc_get_text (yyscan_t yyscanner)
1750 {
1751  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1752  return yytext;
1753 }
1754 
1755 /** Set the user-defined data. This data is never touched by the scanner.
1756  * @param user_defined The data to be associated with this scanner.
1757  * @param yyscanner The scanner object.
1758  */
1759 void pktloc_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
1760 {
1761  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1762  yyextra = user_defined ;
1763 }
1764 
1765 /** Set the current line number.
1766  * @param line_number
1767  * @param yyscanner The scanner object.
1768  */
1769 void pktloc_set_lineno (int line_number , yyscan_t yyscanner)
1770 {
1771  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1772 
1773  /* lineno is only valid if an input buffer exists. */
1774  if (! YY_CURRENT_BUFFER )
1775  yy_fatal_error( "pktloc_set_lineno called with no buffer" , yyscanner);
1776 
1777  yylineno = line_number;
1778 }
1779 
1780 /** Set the current column.
1781  * @param line_number
1782  * @param yyscanner The scanner object.
1783  */
1784 void pktloc_set_column (int column_no , yyscan_t yyscanner)
1785 {
1786  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1787 
1788  /* column is only valid if an input buffer exists. */
1789  if (! YY_CURRENT_BUFFER )
1790  yy_fatal_error( "pktloc_set_column called with no buffer" , yyscanner);
1791 
1792  yycolumn = column_no;
1793 }
1794 
1795 /** Set the input stream. This does not discard the current
1796  * input buffer.
1797  * @param in_str A readable stream.
1798  * @param yyscanner The scanner object.
1799  * @see pktloc__switch_to_buffer
1800  */
1801 void pktloc_set_in (FILE * in_str , yyscan_t yyscanner)
1802 {
1803  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1804  yyin = in_str ;
1805 }
1806 
1807 void pktloc_set_out (FILE * out_str , yyscan_t yyscanner)
1808 {
1809  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1810  yyout = out_str ;
1811 }
1812 
1813 int pktloc_get_debug (yyscan_t yyscanner)
1814 {
1815  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1816  return yy_flex_debug;
1817 }
1818 
1819 void pktloc_set_debug (int bdebug , yyscan_t yyscanner)
1820 {
1821  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1822  yy_flex_debug = bdebug ;
1823 }
1824 
1825 /* Accessor methods for yylval and yylloc */
1826 
1827 YYSTYPE * pktloc_get_lval (yyscan_t yyscanner)
1828 {
1829  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1830  return yylval;
1831 }
1832 
1833 void pktloc_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
1834 {
1835  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1836  yylval = yylval_param;
1837 }
1838 
1839 YYLTYPE *pktloc_get_lloc (yyscan_t yyscanner)
1840 {
1841  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1842  return yylloc;
1843 }
1844 
1845 void pktloc_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
1846 {
1847  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1848  yylloc = yylloc_param;
1849 }
1850 
1851 /* User-visible API */
1852 
1853 /* pktloc_lex_init is special because it creates the scanner itself, so it is
1854  * the ONLY reentrant function that doesn't take the scanner as the last argument.
1855  * That's why we explicitly handle the declaration, instead of using our macros.
1856  */
1857 
1858 int pktloc_lex_init(yyscan_t* ptr_yy_globals)
1859 
1860 {
1861  if (ptr_yy_globals == NULL){
1862  errno = EINVAL;
1863  return 1;
1864  }
1865 
1866  *ptr_yy_globals = (yyscan_t) pktloc_alloc ( sizeof( struct yyguts_t ), NULL );
1867 
1868  if (*ptr_yy_globals == NULL){
1869  errno = ENOMEM;
1870  return 1;
1871  }
1872 
1873  /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
1874  memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
1875 
1876  return yy_init_globals ( *ptr_yy_globals );
1877 }
1878 
1879 /* pktloc_lex_init_extra has the same functionality as pktloc_lex_init, but follows the
1880  * convention of taking the scanner as the last argument. Note however, that
1881  * this is a *pointer* to a scanner, as it will be allocated by this call (and
1882  * is the reason, too, why this function also must handle its own declaration).
1883  * The user defined value in the first argument will be available to pktloc_alloc in
1884  * the yyextra field.
1885  */
1886 
1887 int pktloc_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
1888 
1889 {
1890  struct yyguts_t dummy_yyguts;
1891 
1892  pktloc_set_extra (yy_user_defined, &dummy_yyguts);
1893 
1894  if (ptr_yy_globals == NULL){
1895  errno = EINVAL;
1896  return 1;
1897  }
1898 
1899  *ptr_yy_globals = (yyscan_t) pktloc_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
1900 
1901  if (*ptr_yy_globals == NULL){
1902  errno = ENOMEM;
1903  return 1;
1904  }
1905 
1906  /* By setting to 0xAA, we expose bugs in
1907  yy_init_globals. Leave at 0x00 for releases. */
1908  memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
1909 
1910  pktloc_set_extra (yy_user_defined, *ptr_yy_globals);
1911 
1912  return yy_init_globals ( *ptr_yy_globals );
1913 }
1914 
1915 static int yy_init_globals (yyscan_t yyscanner)
1916 {
1917  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1918  /* Initialization is the same as for the non-reentrant scanner.
1919  * This function is called from pktloc_lex_destroy(), so don't allocate here.
1920  */
1921 
1922  yyg->yy_buffer_stack = 0;
1923  yyg->yy_buffer_stack_top = 0;
1924  yyg->yy_buffer_stack_max = 0;
1925  yyg->yy_c_buf_p = (char *) 0;
1926  yyg->yy_init = 0;
1927  yyg->yy_start = 0;
1928 
1929  yyg->yy_start_stack_ptr = 0;
1930  yyg->yy_start_stack_depth = 0;
1931  yyg->yy_start_stack = NULL;
1932 
1933 /* Defined in main.c */
1934 #ifdef YY_STDINIT
1935  yyin = stdin;
1936  yyout = stdout;
1937 #else
1938  yyin = (FILE *) 0;
1939  yyout = (FILE *) 0;
1940 #endif
1941 
1942  /* For future reference: Set errno on error, since we are called by
1943  * pktloc_lex_init()
1944  */
1945  return 0;
1946 }
1947 
1948 /* pktloc_lex_destroy is for both reentrant and non-reentrant scanners. */
1949 int pktloc_lex_destroy (yyscan_t yyscanner)
1950 {
1951  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1952 
1953  /* Pop the buffer stack, destroying each element. */
1954  while(YY_CURRENT_BUFFER){
1955  pktloc__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
1956  YY_CURRENT_BUFFER_LVALUE = NULL;
1957  pktloc_pop_buffer_state(yyscanner);
1958  }
1959 
1960  /* Destroy the stack itself. */
1961  pktloc_free(yyg->yy_buffer_stack ,yyscanner);
1962  yyg->yy_buffer_stack = NULL;
1963 
1964  /* Destroy the start condition stack. */
1965  pktloc_free(yyg->yy_start_stack ,yyscanner );
1966  yyg->yy_start_stack = NULL;
1967 
1968  /* Reset the globals. This is important in a non-reentrant scanner so the next time
1969  * pktloc_lex() is called, initialization will occur. */
1970  yy_init_globals( yyscanner);
1971 
1972  /* Destroy the main struct (reentrant only). */
1973  pktloc_free ( yyscanner , yyscanner );
1974  yyscanner = NULL;
1975  return 0;
1976 }
1977 
1978 /*
1979  * Internal utility routines.
1980  */
1981 
1982 #ifndef yytext_ptr
1983 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
1984 {
1985  register int i;
1986  for ( i = 0; i < n; ++i )
1987  s1[i] = s2[i];
1988 }
1989 #endif
1990 
1991 #ifdef YY_NEED_STRLEN
1992 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
1993 {
1994  register int n;
1995  for ( n = 0; s[n]; ++n )
1996  ;
1997 
1998  return n;
1999 }
2000 #endif
2001 
2002 void *pktloc_alloc (yy_size_t size , yyscan_t yyscanner)
2003 {
2004  return (void *) malloc( size );
2005 }
2006 
2007 void *pktloc_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2008 {
2009  /* The cast to (char *) in the following accommodates both
2010  * implementations that use char* generic pointers, and those
2011  * that use void* generic pointers. It works with the latter
2012  * because both ANSI C and C++ allow castless assignment from
2013  * any pointer type to void*, and deal with argument conversions
2014  * as though doing an assignment.
2015  */
2016  return (void *) realloc( (char *) ptr, size );
2017 }
2018 
2019 void pktloc_free (void * ptr , yyscan_t yyscanner)
2020 {
2021  free( (char *) ptr ); /* see pktloc_realloc() for (char *) cast */
2022 }
2023 
2024 #define YYTABLES_NAME "yytables"
2025 
2026 #line 52 "route/pktloc_grammar.l"