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