Coverage Report

Created: 2025-02-15 06:25

/work/build/wiretap/ascend_parser.c
Line
Count
Source (jump to first uncovered line)
1
/* This file is automatically generated by Lemon from input grammar
2
** source file "/src/wireshark/wiretap/ascend_parser.lemon". */
3
/* ascend_parser.lemon
4
 *
5
 * Wiretap Library
6
 * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
7
 *
8
 * SPDX-License-Identifier: GPL-2.0-or-later
9
 */
10
11
/*
12
    Example 'pridisp' output data - one paragraph/frame:
13
14
PRI-XMIT-27: (task "l1Task" at 0x10216fe0, time: 560194.01) 4 octets @ 0x1027c5b0
15
  [0000]: 00 01 01 a9                                         ....
16
PRI-RCV-27: (task "idle task" at 0x10123570, time: 560194.01) 4 octets @ 0x1027fb00
17
  [0000]: 00 01 01 dd
18
19
    Example 'pridisp' output data - two paragraphs/frame for XMIT case only:
20
21
PRI-XMIT-19/1:  (task "l1Task" at 0x10216840, time: 274759.98) 4 octets @ 0x1027f230
22
  [0000]: 00 01 30 d8                                         ..0.
23
PRI-XMIT-19/2 (task "l1Task" at 0x10216840, time: 274759.98) 11 octets @ 0x1027f234
24
  [0000]: 08 02 8c bf 02 18 04 e9  82 83 8f                   ........ ...
25
26
    Example 'ether-disp' output data:
27
28
ETHER3ND RECV: (task "_sarTask" at 0x802c6eb0, time: 259848.03) 775 octets @ 0xa8fb2020
29
  [0000]: 00 d0 52 04 e7 1e 08 00  20 ae 51 b5 08 00 45 00    ..R..... .Q...E.
30
  [0010]: 02 f9 05 e6 40 00 3f 11  6e 39 87 fe c4 95 3c 3c    ....@.?.  n9....<<
31
  [0020]: 3c 05 13 c4 13 c4 02 e5  ef ed 49 4e 56 49 54 45    <.......  ..INVITE
32
  [0030]: 20 73 69 70 3a 35 32 30  37 33 40 36 30 2e 36 30     sip:520 73@60.60
33
  [0040]: 2e 36 30 2e 35 20 53 49  50 2f 32 2e 30 0d 0a 56    .60.5 SI P/2.0..V
34
  [0050]: 69 61 3a 20 53 49 50 2f  32 2e 30 2f 55 44 50 20    ia: SIP/ 2.0/UDP
35
  [0060]: 31 33 35 2e                                         135.
36
37
    Example 'wandsess' output data:
38
39
RECV-iguana:241:(task: B02614C0, time: 1975432.85) 49 octets @ 8003BD94
40
  [0000]: FF 03 00 3D C0 06 CA 22 2F 45 00 00 28 6A 3B 40
41
  [0010]: 00 3F 03 D7 37 CE 41 62 12 CF 00 FB 08 20 27 00
42
  [0020]: 50 E4 08 DD D7 7C 4C 71 92 50 10 7D 78 67 C8 00
43
  [0030]: 00
44
XMIT-iguana:241:(task: B04E12C0, time: 1975432.85) 53 octets @ 8009EB16
45
  [0000]: FF 03 00 3D C0 09 1E 31 21 45 00 00 2C 2D BD 40
46
  [0010]: 00 7A 06 D8 B1 CF 00 FB 08 CE 41 62 12 00 50 20
47
  [0020]: 29 7C 4C 71 9C 9A 6A 93 A4 60 12 22 38 3F 10 00
48
  [0030]: 00 02 04 05 B4
49
50
    Example 'wdd' output data:
51
52
Date: 01/12/1990.  Time: 12:22:33
53
Cause an attempt to place call to 14082750382
54
WD_DIALOUT_DISP: chunk 2515EE type IP.
55
(task: 251790, time: 994953.28) 44 octets @ 2782B8
56
  [0000]: 00 C0 7B 71 45 6C 00 60 08 16 AA 51 08 00 45 00
57
  [0010]: 00 2C 66 1C 40 00 80 06 53 F6 AC 14 00 18 CC 47
58
  [0020]: C8 45 0A 31 00 50 3B D9 5B 75 00 00
59
60
    The following output comes from a MAX with Software 7.2.3:
61
62
RECV-187:(task: B050B480, time: 18042248.03) 100 octets @ 800012C0
63
  [0000]: FF 03 00 21 45 00 00 60 E3 49 00 00 7F 11 FD 7B
64
  [0010]: C0 A8 F7 05 8A C8 18 51 00 89 00 89 00 4C C7 C1
65
  [0020]: CC 8E 40 00 00 01 00 00 00 00 00 01 20 45 4A 45
66
  [0030]: 42 45 43 45 48 43 4E 46 43 46 41 43 41 43 41 43
67
  [0040]: 41 43 41 43 41 43 41 43 41 43 41 42 4E 00 00 20
68
  [0050]: 00 01 C0 0C 00 20 00 01 00 04 93 E0 00 06 60 00
69
  [0060]: C0 A8 F7 05
70
XMIT-187:(task: B0292CA0, time: 18042248.04) 60 octets @ 800AD576
71
  [0000]: FF 03 00 21 45 00 00 38 D7 EE 00 00 0F 01 11 2B
72
  [0010]: 0A FF FF FE C0 A8 F7 05 03 0D 33 D3 00 00 00 00
73
  [0020]: 45 00 00 60 E3 49 00 00 7E 11 FE 7B C0 A8 F7 05
74
  [0030]: 8A C8 18 51 00 89 00 89 00 4C C7 C1
75
RECV-187:(task: B0292CA0, time: 18042251.92) 16 octets @ 800018E8
76
  [0000]: FF 03 C0 21 09 01 00 0C DE 61 96 4B 00 30 94 92
77
78
  In TAOS 8.0, Lucent slightly changed the format as follows:
79
80
    Example 'wandisp' output data (TAOS 8.0.3): (same format is used
81
    for 'wanopen' and 'wannext' command)
82
83
RECV-14: (task "idle task" at 0xb05e6e00, time: 1279.01) 29 octets @ 0x8000e0fc
84
  [0000]: ff 03 c0 21 01 01 00 19  01 04 05 f4 11 04 05 f4    ...!.... ........
85
  [0010]: 13 09 03 00 c0 7b 9a 9f  2d 17 04 10 00             .....{.. -....
86
XMIT-14: (task "idle task" at 0xb05e6e00, time: 1279.02) 38 octets @ 0x8007fd56
87
  [0000]: ff 03 c0 21 01 01 00 22  00 04 00 00 01 04 05 f4    ...!..." ........
88
  [0010]: 03 05 c2 23 05 11 04 05  f4 13 09 03 00 c0 7b 80    ...#.... ......{.
89
  [0020]: 7c ef 17 04 0e 00                                   |.....
90
XMIT-14: (task "idle task" at 0xb05e6e00, time: 1279.02) 29 octets @ 0x8007fa36
91
  [0000]: ff 03 c0 21 02 01 00 19  01 04 05 f4 11 04 05 f4    ...!.... ........
92
  [0010]: 13 09 03 00 c0 7b 9a 9f  2d 17 04 10 00             .....{.. -....
93
94
    Example 'wandsess' output data (TAOS 8.0.3):
95
96
RECV-Max7:20: (task "_brouterControlTask" at 0xb094ac20, time: 1481.50) 20 octets @ 0x8000d198
97
  [0000]: ff 03 00 3d c0 00 00 04  80 fd 02 01 00 0a 11 06    ...=.... ........
98
  [0010]: 00 01 01 03                                         ....
99
XMIT-Max7:20: (task "_brouterControlTask" at 0xb094ac20, time: 1481.51) 26 octets @ 0x800806b6
100
  [0000]: ff 03 00 3d c0 00 00 00  80 21 01 01 00 10 02 06    ...=.... .!......
101
  [0010]: 00 2d 0f 01 03 06 89 64  03 08                      .-.....d ..
102
XMIT-Max7:20: (task "_brouterControlTask" at 0xb094ac20, time: 1481.51) 20 octets @ 0x8007f716
103
  [0000]: ff 03 00 3d c0 00 00 01  80 fd 01 01 00 0a 11 06    ...=.... ........
104
  [0010]: 00 01 01 03                                         ....
105
106
  The changes since TAOS 7.X are:
107
108
    1) White space is added before "(task".
109
    2) Task has a name, indicated by a subsequent string surrounded by a
110
       double-quote.
111
    3) Address expressed in hex number has a preceding "0x".
112
    4) Hex numbers are in lower case.
113
    5) There is a character display corresponding to hex data in each line.
114
115
 */
116
117
#include "config.h"
118
#include <assert.h>
119
#include <stdlib.h>
120
#include <string.h>
121
122
#include "wtap-int.h"
123
#include "ascendtext.h"
124
#include "ascend-int.h"
125
#include "ascend_parser.h"
126
#include "ascend_scanner_lex.h"
127
#include "file_wrappers.h"
128
#include <wsutil/wslog.h>
129
130
#define NO_USER "<none>"
131
132
static void *AscendParserAlloc(void *(*mallocProc)(size_t));
133
static void AscendParser(void *yyp, int yymajor, ascend_token_t yyminor, ascend_state_t *state);
134
static void AscendParserFree(void *p, void (*freeProc)(void*));
135
136
#if 0
137
#define ASCEND_PARSER_DEBUG 1
138
#undef NDEBUG
139
#define ascend_debug(...) ws_warning(__VA_ARGS__)
140
#else
141
#define ascend_debug(...)
142
#endif
143
144
DIAG_OFF_LEMON()
145
#line 171 "./ascend_parser.c"
146
/**************** End of %include directives **********************************/
147
/* These constants specify the various numeric values for terminal symbols.
148
***************** Begin token definitions *************************************/
149
#ifndef STRING
150
#define STRING                          1
151
#define KEYWORD                         2
152
#define WDD_DATE                        3
153
#define WDD_DECNUM                      4
154
#define WDD_TIME                        5
155
#define WDD_CAUSE                       6
156
#define WDD_CALLNUM                     7
157
#define WDD_CHUNK                       8
158
#define COUNTER                         9
159
#define SLASH_SUFFIX                   10
160
#define WDS_PREFIX                     11
161
#define ISDN_PREFIX                    12
162
#define ETHER_PREFIX                   13
163
#define DECNUM                         14
164
#define YEAR                           15
165
#define MONTH                          16
166
#define MDAY                           17
167
#define HEXNUM                         18
168
#define HEXBYTE                        19
169
#endif
170
/**************** End token definitions ***************************************/
171
172
/* The next sections is a series of control #defines.
173
** various aspects of the generated parser.
174
**    YYCODETYPE         is the data type used to store the integer codes
175
**                       that represent terminal and non-terminal symbols.
176
**                       "unsigned char" is used if there are fewer than
177
**                       256 symbols.  Larger types otherwise.
178
**    YYNOCODE           is a number of type YYCODETYPE that is not used for
179
**                       any terminal or nonterminal symbol.
180
**    YYFALLBACK         If defined, this indicates that one or more tokens
181
**                       (also known as: "terminal symbols") have fall-back
182
**                       values which should be used if the original symbol
183
**                       would not parse.  This permits keywords to sometimes
184
**                       be used as identifiers, for example.
185
**    YYACTIONTYPE       is the data type used for "action codes" - numbers
186
**                       that indicate what to do in response to the next
187
**                       token.
188
**    AscendParserTOKENTYPE     is the data type used for minor type for terminal
189
**                       symbols.  Background: A "minor type" is a semantic
190
**                       value associated with a terminal or non-terminal
191
**                       symbols.  For example, for an "ID" terminal symbol,
192
**                       the minor type might be the name of the identifier.
193
**                       Each non-terminal can have a different minor type.
194
**                       Terminal symbols all have the same minor type, though.
195
**                       This macros defines the minor type for terminal
196
**                       symbols.
197
**    YYMINORTYPE        is the data type used for all minor types.
198
**                       This is typically a union of many types, one of
199
**                       which is AscendParserTOKENTYPE.  The entry in the union
200
**                       for terminal symbols is called "yy0".
201
**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If
202
**                       zero the stack is dynamically sized using realloc()
203
**    AscendParserARG_SDECL     A static variable declaration for the %extra_argument
204
**    AscendParserARG_PDECL     A parameter declaration for the %extra_argument
205
**    AscendParserARG_PARAM     Code to pass %extra_argument as a subroutine parameter
206
**    AscendParserARG_STORE     Code to store %extra_argument into yypParser
207
**    AscendParserARG_FETCH     Code to extract %extra_argument from yypParser
208
**    AscendParserCTX_*         As AscendParserARG_ except for %extra_context
209
**    YYERRORSYMBOL      is the code number of the error symbol.  If not
210
**                       defined, then do no error processing.
211
**    YYNSTATE           the combined number of states.
212
**    YYNRULE            the number of rules in the grammar
213
**    YYNTOKEN           Number of terminal symbols
214
**    YY_MAX_SHIFT       Maximum value for shift actions
215
**    YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
216
**    YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
217
**    YY_ERROR_ACTION    The yy_action[] code for syntax error
218
**    YY_ACCEPT_ACTION   The yy_action[] code for accept
219
**    YY_NO_ACTION       The yy_action[] code for no-op
220
**    YY_MIN_REDUCE      Minimum value for reduce actions
221
**    YY_MAX_REDUCE      Maximum value for reduce actions
222
*/
223
#ifndef INTERFACE
224
# define INTERFACE 1
225
#endif
226
/************* Begin control #defines *****************************************/
227
#define YYCODETYPE unsigned char
228
#define YYNOCODE 41
229
0
#define YYACTIONTYPE unsigned short int
230
#define AscendParserTOKENTYPE  ascend_token_t 
231
typedef union {
232
  int yyinit;
233
  AscendParserTOKENTYPE yy0;
234
  uint16_t yy5;
235
  uint32_t yy15;
236
} YYMINORTYPE;
237
#ifndef YYSTACKDEPTH
238
0
#define YYSTACKDEPTH 100
239
#endif
240
#define AscendParserARG_SDECL  ascend_state_t *parser_state ;
241
#define AscendParserARG_PDECL , ascend_state_t *parser_state 
242
#define AscendParserARG_PARAM ,parser_state 
243
0
#define AscendParserARG_FETCH  ascend_state_t *parser_state =yypParser->parser_state ;
244
0
#define AscendParserARG_STORE yypParser->parser_state =parser_state ;
245
#define AscendParserCTX_SDECL
246
#define AscendParserCTX_PDECL
247
#define AscendParserCTX_PARAM
248
#define AscendParserCTX_FETCH
249
#define AscendParserCTX_STORE
250
#define YYNSTATE             132
251
#define YYNRULE              51
252
#define YYNRULE_WITH_ACTION  16
253
#define YYNTOKEN             20
254
0
#define YY_MAX_SHIFT         131
255
0
#define YY_MIN_SHIFTREDUCE   152
256
0
#define YY_MAX_SHIFTREDUCE   202
257
#define YY_ERROR_ACTION      203
258
0
#define YY_ACCEPT_ACTION     204
259
#define YY_NO_ACTION         205
260
0
#define YY_MIN_REDUCE        206
261
#define YY_MAX_REDUCE        256
262
/************* End control #defines *******************************************/
263
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
264
265
/* Define the yytestcase() macro to be a no-op if is not already defined
266
** otherwise.
267
**
268
** Applications can choose to define yytestcase() in the %include section
269
** to a macro that can assist in verifying code coverage.  For production
270
** code the yytestcase() macro should be turned off.  But it is useful
271
** for testing.
272
*/
273
#ifndef yytestcase
274
# define yytestcase(X)
275
#endif
276
277
278
/* Next are the tables used to determine what action to take based on the
279
** current state and lookahead token.  These tables are used to implement
280
** functions that take a state number and lookahead value and return an
281
** action integer.
282
**
283
** Suppose the action integer is N.  Then the action is determined as
284
** follows
285
**
286
**   0 <= N <= YY_MAX_SHIFT             Shift N.  That is, push the lookahead
287
**                                      token onto the stack and goto state N.
288
**
289
**   N between YY_MIN_SHIFTREDUCE       Shift to an arbitrary state then
290
**     and YY_MAX_SHIFTREDUCE           reduce by rule N-YY_MIN_SHIFTREDUCE.
291
**
292
**   N == YY_ERROR_ACTION               A syntax error has occurred.
293
**
294
**   N == YY_ACCEPT_ACTION              The parser accepts its input.
295
**
296
**   N == YY_NO_ACTION                  No such action.  Denotes unused
297
**                                      slots in the yy_action[] table.
298
**
299
**   N between YY_MIN_REDUCE            Reduce by rule N-YY_MIN_REDUCE
300
**     and YY_MAX_REDUCE
301
**
302
** The action table is constructed as a single large table named yy_action[].
303
** Given state S and lookahead X, the action is computed as either:
304
**
305
**    (A)   N = yy_action[ yy_shift_ofst[S] + X ]
306
**    (B)   N = yy_default[S]
307
**
308
** The (A) formula is preferred.  The B formula is used instead if
309
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
310
**
311
** The formulas above are for computing the action when the lookahead is
312
** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
313
** a reduce action) then the yy_reduce_ofst[] array is used in place of
314
** the yy_shift_ofst[] array.
315
**
316
** The following are the tables generated in this section:
317
**
318
**  yy_action[]        A single table containing all actions.
319
**  yy_lookahead[]     A table containing the lookahead for each entry in
320
**                     yy_action.  Used to detect hash collisions.
321
**  yy_shift_ofst[]    For each state, the offset into yy_action for
322
**                     shifting terminals.
323
**  yy_reduce_ofst[]   For each state, the offset into yy_action for
324
**                     shifting non-terminals after a reduce.
325
**  yy_default[]       Default action for each state.
326
**
327
*********** Begin parsing tables **********************************************/
328
#define YY_ACTTAB_COUNT (180)
329
static const YYACTIONTYPE yy_action[] = {
330
 /*     0 */   204,   15,   85,   13,   10,    9,    8,    7,    6,   54,
331
 /*    10 */     4,   48,   42,    3,   21,  177,   90,  177,   93,   53,
332
 /*    20 */    36,   94,  154,  152,  153,   98,  112,  101,  118,  119,
333
 /*    30 */   155,  120,  156,   11,  121,  122,   14,  123,  152,  130,
334
 /*    40 */    12,   60,   47,  167,   67,  131,   67,   67,  157,   67,
335
 /*    50 */   128,  155,   67,   67,  156,   67,   16,   67,   67,   82,
336
 /*    60 */   248,  177,   17,   67,  205,   86,   19,   20,   88,   22,
337
 /*    70 */    23,  249,   61,  230,   89,   97,   92,   26,   27,   53,
338
 /*    80 */    96,   29,   30,  100,   33,   34,  102,  104,   37,   38,
339
 /*    90 */   106,  105,  107,  110,  109,  165,   43,   44,  111,  115,
340
 /*   100 */   205,   83,  114,   49,   50,    5,  117,   87,   24,   25,
341
 /*   110 */   232,  125,   55,   56,  127,  126,  129,   84,   18,   91,
342
 /*   120 */    28,    1,   62,   63,   64,   65,   66,   68,   69,   70,
343
 /*   130 */    71,   72,   73,   74,  164,   75,   76,   77,   78,  162,
344
 /*   140 */    79,   80,   81,  163,   95,   31,   32,  161,   99,   35,
345
 /*   150 */     2,  160,  103,   39,   40,   41,  159,  108,   45,   46,
346
 /*   160 */   113,   51,   52,  166,  116,  229,  228,  227,  226,  225,
347
 /*   170 */   224,  128,  158,  124,  205,   57,   58,  223,   59,  222,
348
};
349
static const YYCODETYPE yy_lookahead[] = {
350
 /*     0 */    20,   21,   37,   23,   24,   25,   26,   27,   28,   29,
351
 /*    10 */    30,   31,   32,   33,    3,    1,   34,    1,   36,    8,
352
 /*    20 */    34,   35,   11,   12,   13,   34,   22,   36,   22,   22,
353
 /*    30 */    14,   22,   18,   23,   22,   22,    9,   22,   12,   22,
354
 /*    40 */    22,   31,    2,   19,   40,   22,   40,   40,    4,   40,
355
 /*    50 */    10,   14,   40,   40,   18,   40,   37,   40,   40,   38,
356
 /*    60 */    39,    1,   37,   40,   41,   37,   37,   37,   35,   35,
357
 /*    70 */    35,   40,   40,    0,   36,   36,   35,   35,   35,    8,
358
 /*    80 */    35,   35,   35,   35,   35,   35,   35,   35,   35,   35,
359
 /*    90 */    34,   36,   34,   36,   35,    7,   35,   35,   34,   36,
360
 /*   100 */    41,   35,   35,   35,   35,   30,   36,    2,    2,    2,
361
 /*   110 */    38,   35,   35,   35,   34,   36,   35,    6,    5,    2,
362
 /*   120 */     2,    2,   40,   40,   40,   40,   40,   38,   38,   38,
363
 /*   130 */    38,   38,   38,   38,   18,   38,   38,   38,   38,   18,
364
 /*   140 */    38,   38,   38,   18,    2,    2,    2,   18,    2,    2,
365
 /*   150 */     2,   18,    2,    2,    2,    2,   18,    2,    2,    2,
366
 /*   160 */     2,    2,    2,   18,    2,    0,    0,    0,    0,    0,
367
 /*   170 */     0,   10,   18,    2,   41,    2,    2,    0,    2,    0,
368
 /*   180 */    41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
369
 /*   190 */    41,   41,   41,   41,   41,   41,   41,   41,   41,   41,
370
};
371
#define YY_SHIFT_COUNT    (131)
372
#define YY_SHIFT_MIN      (0)
373
#define YY_SHIFT_MAX      (179)
374
static const unsigned char yy_shift_ofst[] = {
375
 /*     0 */    11,   14,   14,   16,   27,   27,   27,   27,   27,   27,
376
 /*    10 */    27,   27,   26,   27,   24,   27,   44,   44,   44,   44,
377
 /*    20 */    44,   44,   37,   37,   37,   36,   37,   37,   37,   37,
378
 /*    30 */    37,   37,   36,   37,   37,   37,   37,   37,   37,   37,
379
 /*    40 */    36,   60,   60,   37,   37,   37,   36,   60,   37,   37,
380
 /*    50 */    37,   37,   36,   36,   71,   37,   37,   37,   36,   60,
381
 /*    60 */    37,   27,   27,   27,   27,   27,   27,   27,   24,   24,
382
 /*    70 */    24,   24,   24,   24,   24,   24,   24,   24,   24,   24,
383
 /*    80 */    24,   24,   24,   40,   88,  111,  113,  116,  105,  106,
384
 /*    90 */   107,  125,  117,  118,  119,  121,  142,  143,  144,  129,
385
 /*   100 */   146,  147,  148,  133,  150,  151,  152,  153,  138,  155,
386
 /*   110 */   156,  157,   73,  145,  158,  159,  160,  162,  165,  166,
387
 /*   120 */   167,  168,  169,  170,  154,  171,  173,  174,  176,  161,
388
 /*   130 */   177,  179,
389
};
390
#define YY_REDUCE_COUNT (82)
391
#define YY_REDUCE_MIN   (-35)
392
#define YY_REDUCE_MAX   (104)
393
static const signed char yy_reduce_ofst[] = {
394
 /*     0 */   -20,  -18,   -9,  -14,    4,    6,    7,    9,   12,   13,
395
 /*    10 */    15,   17,   10,   18,   21,   23,  -35,   19,   25,   28,
396
 /*    20 */    29,   30,   33,   34,   35,   38,   41,   42,   43,   45,
397
 /*    30 */    46,   47,   39,   48,   49,   50,   51,   52,   53,   54,
398
 /*    40 */    55,   56,   58,   59,   61,   62,   57,   64,   66,   67,
399
 /*    50 */    68,   69,   63,   70,   75,   76,   77,   78,   79,   80,
400
 /*    60 */    81,   31,   32,   82,   83,   84,   85,   86,   72,   89,
401
 /*    70 */    90,   91,   92,   93,   94,   95,   97,   98,   99,  100,
402
 /*    80 */   102,  103,  104,
403
};
404
static const YYACTIONTYPE yy_default[] = {
405
 /*     0 */   203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
406
 /*    10 */   203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
407
 /*    20 */   203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
408
 /*    30 */   203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
409
 /*    40 */   203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
410
 /*    50 */   203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
411
 /*    60 */   203,  250,  251,  252,  253,  254,  255,  256,  233,  234,
412
 /*    70 */   235,  236,  237,  238,  239,  240,  241,  242,  243,  244,
413
 /*    80 */   245,  246,  247,  203,  203,  203,  203,  203,  203,  203,
414
 /*    90 */   203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
415
 /*   100 */   203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
416
 /*   110 */   203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
417
 /*   120 */   203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
418
 /*   130 */   203,  203,
419
};
420
/********** End of lemon-generated parsing tables *****************************/
421
422
/* The next table maps tokens (terminal symbols) into fallback tokens.
423
** If a construct like the following:
424
**
425
**      %fallback ID X Y Z.
426
**
427
** appears in the grammar, then ID becomes a fallback token for X, Y,
428
** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser
429
** but it does not parse, the type of the token is changed to ID and
430
** the parse is retried before an error is thrown.
431
**
432
** This feature can be used, for example, to cause some keywords in a language
433
** to revert to identifiers if they keyword does not apply in the context where
434
** it appears.
435
*/
436
#ifdef YYFALLBACK
437
static const YYCODETYPE yyFallback[] = {
438
};
439
#endif /* YYFALLBACK */
440
441
/* The following structure represents a single element of the
442
** parser's stack.  Information stored includes:
443
**
444
**   +  The state number for the parser at this level of the stack.
445
**
446
**   +  The value of the token stored at this level of the stack.
447
**      (In other words, the "major" token.)
448
**
449
**   +  The semantic value stored at this level of the stack.  This is
450
**      the information used by the action routines in the grammar.
451
**      It is sometimes called the "minor" token.
452
**
453
** After the "shift" half of a SHIFTREDUCE action, the stateno field
454
** actually contains the reduce action for the second half of the
455
** SHIFTREDUCE.
456
*/
457
struct yyStackEntry {
458
  YYACTIONTYPE stateno;  /* The state-number, or reduce action in SHIFTREDUCE */
459
  YYCODETYPE major;      /* The major token value.  This is the code
460
                         ** number for the token at this stack level */
461
  YYMINORTYPE minor;     /* The user-supplied minor token value.  This
462
                         ** is the value of the token  */
463
};
464
typedef struct yyStackEntry yyStackEntry;
465
466
/* The state of the parser is completely contained in an instance of
467
** the following structure */
468
struct yyParser {
469
  yyStackEntry *yytos;          /* Pointer to top element of the stack */
470
#ifdef YYTRACKMAXSTACKDEPTH
471
  int yyhwm;                    /* High-water mark of the stack */
472
#endif
473
#ifndef YYNOERRORRECOVERY
474
  int yyerrcnt;                 /* Shifts left before out of the error */
475
#endif
476
  AscendParserARG_SDECL                /* A place to hold %extra_argument */
477
  AscendParserCTX_SDECL                /* A place to hold %extra_context */
478
#if YYSTACKDEPTH<=0
479
  int yystksz;                  /* Current side of the stack */
480
  yyStackEntry *yystack;        /* The parser's stack */
481
  yyStackEntry yystk0;          /* First stack entry */
482
#else
483
  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
484
  yyStackEntry *yystackEnd;            /* Last entry in the stack */
485
#endif
486
};
487
typedef struct yyParser yyParser;
488
489
#include <assert.h>
490
#ifndef NDEBUG
491
#include <stdio.h>
492
static FILE *yyTraceFILE = 0;
493
static char *yyTracePrompt = 0;
494
#endif /* NDEBUG */
495
496
#ifndef NDEBUG
497
/*
498
** Turn parser tracing on by giving a stream to which to write the trace
499
** and a prompt to preface each trace message.  Tracing is turned off
500
** by making either argument NULL
501
**
502
** Inputs:
503
** <ul>
504
** <li> A FILE* to which trace output should be written.
505
**      If NULL, then tracing is turned off.
506
** <li> A prefix string written at the beginning of every
507
**      line of trace output.  If NULL, then tracing is
508
**      turned off.
509
** </ul>
510
**
511
** Outputs:
512
** None.
513
*/
514
void AscendParserTrace(FILE *TraceFILE, char *zTracePrompt){
515
  yyTraceFILE = TraceFILE;
516
  yyTracePrompt = zTracePrompt;
517
  if( yyTraceFILE==0 ) yyTracePrompt = 0;
518
  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
519
}
520
#endif /* NDEBUG */
521
522
#if defined(YYCOVERAGE) || !defined(NDEBUG)
523
/* For tracing shifts, the names of all terminals and nonterminals
524
** are required.  The following table supplies these names */
525
static const char *const yyTokenName[] = {
526
  /*    0 */ "$",
527
  /*    1 */ "STRING",
528
  /*    2 */ "KEYWORD",
529
  /*    3 */ "WDD_DATE",
530
  /*    4 */ "WDD_DECNUM",
531
  /*    5 */ "WDD_TIME",
532
  /*    6 */ "WDD_CAUSE",
533
  /*    7 */ "WDD_CALLNUM",
534
  /*    8 */ "WDD_CHUNK",
535
  /*    9 */ "COUNTER",
536
  /*   10 */ "SLASH_SUFFIX",
537
  /*   11 */ "WDS_PREFIX",
538
  /*   12 */ "ISDN_PREFIX",
539
  /*   13 */ "ETHER_PREFIX",
540
  /*   14 */ "DECNUM",
541
  /*   15 */ "YEAR",
542
  /*   16 */ "MONTH",
543
  /*   17 */ "MDAY",
544
  /*   18 */ "HEXNUM",
545
  /*   19 */ "HEXBYTE",
546
  /*   20 */ "data_packet",
547
  /*   21 */ "ether_hdr",
548
  /*   22 */ "datagroup",
549
  /*   23 */ "deferred_isdn_hdr",
550
  /*   24 */ "isdn_hdr",
551
  /*   25 */ "wds_hdr",
552
  /*   26 */ "wds8_hdr",
553
  /*   27 */ "wdp7_hdr",
554
  /*   28 */ "wdp8_hdr",
555
  /*   29 */ "wdd_date",
556
  /*   30 */ "wdd_hdr",
557
  /*   31 */ "isdn_prefix",
558
  /*   32 */ "ether_prefix",
559
  /*   33 */ "wds_prefix",
560
  /*   34 */ "string",
561
  /*   35 */ "decnum",
562
  /*   36 */ "hexnum",
563
  /*   37 */ "wdd_decnum",
564
  /*   38 */ "byte",
565
  /*   39 */ "bytegroup",
566
  /*   40 */ "dataln",
567
};
568
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
569
570
#ifndef NDEBUG
571
/* For tracing reduce actions, the names of all rules are required.
572
*/
573
static const char *const yyRuleName[] = {
574
 /*   0 */ "isdn_prefix ::= ISDN_PREFIX",
575
 /*   1 */ "ether_prefix ::= ETHER_PREFIX",
576
 /*   2 */ "wds_prefix ::= WDS_PREFIX",
577
 /*   3 */ "decnum ::= DECNUM",
578
 /*   4 */ "hexnum ::= HEXNUM",
579
 /*   5 */ "wdd_decnum ::= WDD_DECNUM",
580
 /*   6 */ "deferred_isdn_hdr ::= isdn_prefix decnum SLASH_SUFFIX KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM",
581
 /*   7 */ "isdn_hdr ::= isdn_prefix decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM",
582
 /*   8 */ "ether_hdr ::= ether_prefix string KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM",
583
 /*   9 */ "wds_hdr ::= wds_prefix string decnum KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM",
584
 /*  10 */ "wds8_hdr ::= wds_prefix string decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM",
585
 /*  11 */ "wdp7_hdr ::= wds_prefix decnum KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM",
586
 /*  12 */ "wdp8_hdr ::= wds_prefix decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM",
587
 /*  13 */ "wdd_date ::= WDD_DATE wdd_decnum wdd_decnum wdd_decnum WDD_TIME wdd_decnum wdd_decnum wdd_decnum WDD_CAUSE WDD_CALLNUM",
588
 /*  14 */ "wdd_hdr ::= WDD_CHUNK hexnum KEYWORD KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM",
589
 /*  15 */ "byte ::= HEXBYTE",
590
 /*  16 */ "data_packet ::= ether_hdr datagroup",
591
 /*  17 */ "data_packet ::= deferred_isdn_hdr datagroup deferred_isdn_hdr datagroup",
592
 /*  18 */ "data_packet ::= isdn_hdr datagroup",
593
 /*  19 */ "data_packet ::= wds_hdr datagroup",
594
 /*  20 */ "data_packet ::= wds8_hdr datagroup",
595
 /*  21 */ "data_packet ::= wdp7_hdr datagroup",
596
 /*  22 */ "data_packet ::= wdp8_hdr datagroup",
597
 /*  23 */ "data_packet ::= wdd_date wdd_hdr datagroup",
598
 /*  24 */ "data_packet ::= wdd_hdr datagroup",
599
 /*  25 */ "string ::= STRING",
600
 /*  26 */ "bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte",
601
 /*  27 */ "bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte",
602
 /*  28 */ "bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte",
603
 /*  29 */ "bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte",
604
 /*  30 */ "bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte",
605
 /*  31 */ "bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte",
606
 /*  32 */ "bytegroup ::= byte byte byte byte byte byte byte byte byte byte",
607
 /*  33 */ "bytegroup ::= byte byte byte byte byte byte byte byte byte",
608
 /*  34 */ "bytegroup ::= byte byte byte byte byte byte byte byte",
609
 /*  35 */ "bytegroup ::= byte byte byte byte byte byte byte",
610
 /*  36 */ "bytegroup ::= byte byte byte byte byte byte",
611
 /*  37 */ "bytegroup ::= byte byte byte byte byte",
612
 /*  38 */ "bytegroup ::= byte byte byte byte",
613
 /*  39 */ "bytegroup ::= byte byte byte",
614
 /*  40 */ "bytegroup ::= byte byte",
615
 /*  41 */ "bytegroup ::= byte",
616
 /*  42 */ "dataln ::= COUNTER bytegroup",
617
 /*  43 */ "datagroup ::= dataln dataln dataln dataln dataln dataln dataln dataln",
618
 /*  44 */ "datagroup ::= dataln dataln dataln dataln dataln dataln dataln",
619
 /*  45 */ "datagroup ::= dataln dataln dataln dataln dataln dataln",
620
 /*  46 */ "datagroup ::= dataln dataln dataln dataln dataln",
621
 /*  47 */ "datagroup ::= dataln dataln dataln dataln",
622
 /*  48 */ "datagroup ::= dataln dataln dataln",
623
 /*  49 */ "datagroup ::= dataln dataln",
624
 /*  50 */ "datagroup ::= dataln",
625
};
626
#endif /* NDEBUG */
627
628
629
#if YYSTACKDEPTH<=0
630
/*
631
** Try to increase the size of the parser stack.  Return the number
632
** of errors.  Return 0 on success.
633
*/
634
static int yyGrowStack(yyParser *p){
635
  int newSize;
636
  int idx;
637
  yyStackEntry *pNew;
638
639
  newSize = p->yystksz*2 + 100;
640
  idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
641
  if( p->yystack==&p->yystk0 ){
642
    pNew = malloc(newSize*sizeof(pNew[0]));
643
    if( pNew ) pNew[0] = p->yystk0;
644
  }else{
645
    pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
646
  }
647
  if( pNew ){
648
    p->yystack = pNew;
649
    p->yytos = &p->yystack[idx];
650
#ifndef NDEBUG
651
    if( yyTraceFILE ){
652
      fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
653
              yyTracePrompt, p->yystksz, newSize);
654
    }
655
#endif
656
    p->yystksz = newSize;
657
  }
658
  return pNew==0;
659
}
660
#endif
661
662
/* Datatype of the argument to the memory allocated passed as the
663
** second argument to AscendParserAlloc() below.  This can be changed by
664
** putting an appropriate #define in the %include section of the input
665
** grammar.
666
*/
667
#ifndef YYMALLOCARGTYPE
668
# define YYMALLOCARGTYPE size_t
669
#endif
670
671
/* Initialize a new parser that has already been allocated.
672
*/
673
0
void AscendParserInit(void *yypRawParser AscendParserCTX_PDECL){
674
0
  yyParser *yypParser = (yyParser*)yypRawParser;
675
0
  AscendParserCTX_STORE
676
#ifdef YYTRACKMAXSTACKDEPTH
677
  yypParser->yyhwm = 0;
678
#endif
679
#if YYSTACKDEPTH<=0
680
  yypParser->yytos = NULL;
681
  yypParser->yystack = NULL;
682
  yypParser->yystksz = 0;
683
  if( yyGrowStack(yypParser) ){
684
    yypParser->yystack = &yypParser->yystk0;
685
    yypParser->yystksz = 1;
686
  }
687
#endif
688
0
#ifndef YYNOERRORRECOVERY
689
0
  yypParser->yyerrcnt = -1;
690
0
#endif
691
0
  yypParser->yytos = yypParser->yystack;
692
0
  yypParser->yystack[0].stateno = 0;
693
0
  yypParser->yystack[0].major = 0;
694
0
#if YYSTACKDEPTH>0
695
0
  yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
696
0
#endif
697
0
}
698
699
#ifndef AscendParser_ENGINEALWAYSONSTACK
700
/*
701
** This function allocates a new parser.
702
** The only argument is a pointer to a function which works like
703
** malloc.
704
**
705
** Inputs:
706
** A pointer to the function used to allocate memory.
707
**
708
** Outputs:
709
** A pointer to a parser.  This pointer is used in subsequent calls
710
** to AscendParser and AscendParserFree.
711
*/
712
0
void *AscendParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) AscendParserCTX_PDECL){
713
0
  yyParser *yypParser;
714
0
  yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
715
0
  if( yypParser ){
716
0
    AscendParserCTX_STORE
717
0
    AscendParserInit(yypParser AscendParserCTX_PARAM);
718
0
  }
719
0
  return (void*)yypParser;
720
0
}
721
#endif /* AscendParser_ENGINEALWAYSONSTACK */
722
723
724
/* The following function deletes the "minor type" or semantic value
725
** associated with a symbol.  The symbol can be either a terminal
726
** or nonterminal. "yymajor" is the symbol code, and "yypminor" is
727
** a pointer to the value to be deleted.  The code used to do the
728
** deletions is derived from the %destructor and/or %token_destructor
729
** directives of the input grammar.
730
*/
731
static void yy_destructor(
732
  yyParser *yypParser,    /* The parser */
733
  YYCODETYPE yymajor,     /* Type code for object to destroy */
734
  YYMINORTYPE *yypminor   /* The object to be destroyed */
735
0
){
736
0
  AscendParserARG_FETCH
737
0
  AscendParserCTX_FETCH
738
0
  switch( yymajor ){
739
    /* Here is inserted the actions which take place when a
740
    ** terminal or non-terminal is destroyed.  This can happen
741
    ** when the symbol is popped from the stack during a
742
    ** reduce or during error processing or when a parser is
743
    ** being destroyed before it is finished parsing.
744
    **
745
    ** Note: during a reduce, the only symbols destroyed are those
746
    ** which appear on the RHS of the rule, but which are *not* used
747
    ** inside the C code.
748
    */
749
/********* Begin destructor definitions ***************************************/
750
      /* TERMINAL Destructor */
751
0
    case 1: /* STRING */
752
0
    case 2: /* KEYWORD */
753
0
    case 3: /* WDD_DATE */
754
0
    case 4: /* WDD_DECNUM */
755
0
    case 5: /* WDD_TIME */
756
0
    case 6: /* WDD_CAUSE */
757
0
    case 7: /* WDD_CALLNUM */
758
0
    case 8: /* WDD_CHUNK */
759
0
    case 9: /* COUNTER */
760
0
    case 10: /* SLASH_SUFFIX */
761
0
    case 11: /* WDS_PREFIX */
762
0
    case 12: /* ISDN_PREFIX */
763
0
    case 13: /* ETHER_PREFIX */
764
0
    case 14: /* DECNUM */
765
0
    case 15: /* YEAR */
766
0
    case 16: /* MONTH */
767
0
    case 17: /* MDAY */
768
0
    case 18: /* HEXNUM */
769
0
    case 19: /* HEXBYTE */
770
0
{
771
0
#line 156 "/src/wireshark/wiretap/ascend_parser.lemon"
772
773
0
    (void) parser_state;
774
0
    (void) yypminor;
775
776
0
#line 801 "./ascend_parser.c"
777
0
}
778
0
      break;
779
/********* End destructor definitions *****************************************/
780
0
    default:  break;   /* If no destructor action specified: do nothing */
781
0
  }
782
0
}
783
784
/*
785
** Pop the parser's stack once.
786
**
787
** If there is a destructor routine associated with the token which
788
** is popped from the stack, then call it.
789
*/
790
0
static void yy_pop_parser_stack(yyParser *pParser){
791
0
  yyStackEntry *yytos;
792
0
  assert( pParser->yytos!=0 );
793
0
  assert( pParser->yytos > pParser->yystack );
794
0
  yytos = pParser->yytos--;
795
#ifndef NDEBUG
796
  if( yyTraceFILE ){
797
    fprintf(yyTraceFILE,"%sPopping %s\n",
798
      yyTracePrompt,
799
      yyTokenName[yytos->major]);
800
  }
801
#endif
802
0
  yy_destructor(pParser, yytos->major, &yytos->minor);
803
0
}
804
805
/*
806
** Clear all secondary memory allocations from the parser
807
*/
808
0
void AscendParserFinalize(void *p){
809
0
  yyParser *pParser = (yyParser*)p;
810
0
  while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
811
#if YYSTACKDEPTH<=0
812
  if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
813
#endif
814
0
}
815
816
#ifndef AscendParser_ENGINEALWAYSONSTACK
817
/*
818
** Deallocate and destroy a parser.  Destructors are called for
819
** all stack elements before shutting the parser down.
820
**
821
** If the YYPARSEFREENEVERNULL macro exists (for example because it
822
** is defined in a %include section of the input grammar) then it is
823
** assumed that the input pointer is never NULL.
824
*/
825
void AscendParserFree(
826
  void *p,                    /* The parser to be deleted */
827
  void (*freeProc)(void*)     /* Function used to reclaim memory */
828
0
){
829
0
#ifndef YYPARSEFREENEVERNULL
830
0
  if( p==0 ) return;
831
0
#endif
832
0
  AscendParserFinalize(p);
833
0
  (*freeProc)(p);
834
0
}
835
#endif /* AscendParser_ENGINEALWAYSONSTACK */
836
837
/*
838
** Return the peak depth of the stack for a parser.
839
*/
840
#ifdef YYTRACKMAXSTACKDEPTH
841
int AscendParserStackPeak(void *p){
842
  yyParser *pParser = (yyParser*)p;
843
  return pParser->yyhwm;
844
}
845
#endif
846
847
/* This array of booleans keeps track of the parser statement
848
** coverage.  The element yycoverage[X][Y] is set when the parser
849
** is in state X and has a lookahead token Y.  In a well-tested
850
** systems, every element of this matrix should end up being set.
851
*/
852
#if defined(YYCOVERAGE)
853
static unsigned char yycoverage[YYNSTATE][YYNTOKEN];
854
#endif
855
856
/*
857
** Write into out a description of every state/lookahead combination that
858
**
859
**   (1)  has not been used by the parser, and
860
**   (2)  is not a syntax error.
861
**
862
** Return the number of missed state/lookahead combinations.
863
*/
864
#if defined(YYCOVERAGE)
865
int AscendParserCoverage(FILE *out){
866
  int stateno, iLookAhead, i;
867
  int nMissed = 0;
868
  for(stateno=0; stateno<YYNSTATE; stateno++){
869
    i = yy_shift_ofst[stateno];
870
    for(iLookAhead=0; iLookAhead<YYNTOKEN; iLookAhead++){
871
      if( yy_lookahead[i+iLookAhead]!=iLookAhead ) continue;
872
      if( yycoverage[stateno][iLookAhead]==0 ) nMissed++;
873
      if( out ){
874
        fprintf(out,"State %d lookahead %s %s\n", stateno,
875
                yyTokenName[iLookAhead],
876
                yycoverage[stateno][iLookAhead] ? "ok" : "missed");
877
      }
878
    }
879
  }
880
  return nMissed;
881
}
882
#endif
883
884
/*
885
** Find the appropriate action for a parser given the terminal
886
** look-ahead token iLookAhead.
887
*/
888
static YYACTIONTYPE yy_find_shift_action(
889
  YYCODETYPE iLookAhead,    /* The look-ahead token */
890
  YYACTIONTYPE stateno      /* Current state number */
891
0
){
892
0
  int i;
893
894
0
  if( stateno>YY_MAX_SHIFT ) return stateno;
895
0
  assert( stateno <= YY_SHIFT_COUNT );
896
#if defined(YYCOVERAGE)
897
  yycoverage[stateno][iLookAhead] = 1;
898
#endif
899
0
  do{
900
0
    i = yy_shift_ofst[stateno];
901
0
    assert( i>=0 );
902
0
    assert( i<=YY_ACTTAB_COUNT );
903
0
    assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD );
904
0
    assert( iLookAhead!=YYNOCODE );
905
0
    assert( iLookAhead < YYNTOKEN );
906
0
    i += iLookAhead;
907
0
    assert( i<(int)YY_NLOOKAHEAD );
908
0
    if( yy_lookahead[i]!=iLookAhead ){
909
#ifdef YYFALLBACK
910
      YYCODETYPE iFallback;            /* Fallback token */
911
      assert( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) );
912
      iFallback = yyFallback[iLookAhead];
913
      if( iFallback!=0 ){
914
#ifndef NDEBUG
915
        if( yyTraceFILE ){
916
          fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
917
             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
918
        }
919
#endif
920
        assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
921
        iLookAhead = iFallback;
922
        continue;
923
      }
924
#endif
925
#ifdef YYWILDCARD
926
      {
927
        int j = i - iLookAhead + YYWILDCARD;
928
        assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) );
929
        if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){
930
#ifndef NDEBUG
931
          if( yyTraceFILE ){
932
            fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
933
               yyTracePrompt, yyTokenName[iLookAhead],
934
               yyTokenName[YYWILDCARD]);
935
          }
936
#endif /* NDEBUG */
937
          return yy_action[j];
938
        }
939
      }
940
#endif /* YYWILDCARD */
941
0
      return yy_default[stateno];
942
0
    }else{
943
0
      assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) );
944
0
      return yy_action[i];
945
0
    }
946
0
  }while(1);
947
0
}
948
949
/*
950
** Find the appropriate action for a parser given the non-terminal
951
** look-ahead token iLookAhead.
952
*/
953
static YYACTIONTYPE yy_find_reduce_action(
954
  YYACTIONTYPE stateno,     /* Current state number */
955
  YYCODETYPE iLookAhead     /* The look-ahead token */
956
0
){
957
0
  int i;
958
#ifdef YYERRORSYMBOL
959
  if( stateno>YY_REDUCE_COUNT ){
960
    return yy_default[stateno];
961
  }
962
#else
963
0
  assert( stateno<=YY_REDUCE_COUNT );
964
0
#endif
965
0
  i = yy_reduce_ofst[stateno];
966
0
  assert( iLookAhead!=YYNOCODE );
967
0
  i += iLookAhead;
968
#ifdef YYERRORSYMBOL
969
  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
970
    return yy_default[stateno];
971
  }
972
#else
973
0
  assert( i>=0 && i<YY_ACTTAB_COUNT );
974
0
  assert( yy_lookahead[i]==iLookAhead );
975
0
#endif
976
0
  return yy_action[i];
977
0
}
978
979
/*
980
** The following routine is called if the stack overflows.
981
*/
982
0
static void yyStackOverflow(yyParser *yypParser){
983
0
   AscendParserARG_FETCH
984
0
   AscendParserCTX_FETCH
985
#ifndef NDEBUG
986
   if( yyTraceFILE ){
987
     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
988
   }
989
#endif
990
0
   while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
991
   /* Here code is inserted which will execute if the parser
992
   ** stack every overflows */
993
/******** Begin %stack_overflow code ******************************************/
994
/******** End %stack_overflow code ********************************************/
995
0
   AscendParserARG_STORE /* Suppress warning about unused %extra_argument var */
996
0
   AscendParserCTX_STORE
997
0
}
998
999
/*
1000
** Print tracing information for a SHIFT action
1001
*/
1002
#ifndef NDEBUG
1003
static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
1004
  if( yyTraceFILE ){
1005
    if( yyNewState<YYNSTATE ){
1006
      fprintf(yyTraceFILE,"%s%s '%s', go to state %d\n",
1007
         yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
1008
         yyNewState);
1009
    }else{
1010
      fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n",
1011
         yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
1012
         yyNewState - YY_MIN_REDUCE);
1013
    }
1014
  }
1015
}
1016
#else
1017
# define yyTraceShift(X,Y,Z)
1018
#endif
1019
1020
/*
1021
** Perform a shift action.
1022
*/
1023
static void yy_shift(
1024
  yyParser *yypParser,          /* The parser to be shifted */
1025
  YYACTIONTYPE yyNewState,      /* The new state to shift in */
1026
  YYCODETYPE yyMajor,           /* The major token to shift in */
1027
  AscendParserTOKENTYPE yyMinor        /* The minor token to shift in */
1028
0
){
1029
0
  yyStackEntry *yytos;
1030
0
  yypParser->yytos++;
1031
#ifdef YYTRACKMAXSTACKDEPTH
1032
  if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
1033
    yypParser->yyhwm++;
1034
    assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
1035
  }
1036
#endif
1037
0
#if YYSTACKDEPTH>0
1038
0
  if( yypParser->yytos>yypParser->yystackEnd ){
1039
0
    yypParser->yytos--;
1040
0
    yyStackOverflow(yypParser);
1041
0
    return;
1042
0
  }
1043
#else
1044
  if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
1045
    if( yyGrowStack(yypParser) ){
1046
      yypParser->yytos--;
1047
      yyStackOverflow(yypParser);
1048
      return;
1049
    }
1050
  }
1051
#endif
1052
0
  if( yyNewState > YY_MAX_SHIFT ){
1053
0
    yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
1054
0
  }
1055
0
  yytos = yypParser->yytos;
1056
0
  yytos->stateno = yyNewState;
1057
0
  yytos->major = yyMajor;
1058
0
  yytos->minor.yy0 = yyMinor;
1059
0
  yyTraceShift(yypParser, yyNewState, "Shift");
1060
0
}
1061
1062
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
1063
** of that rule */
1064
static const YYCODETYPE yyRuleInfoLhs[] = {
1065
    31,  /* (0) isdn_prefix ::= ISDN_PREFIX */
1066
    32,  /* (1) ether_prefix ::= ETHER_PREFIX */
1067
    33,  /* (2) wds_prefix ::= WDS_PREFIX */
1068
    35,  /* (3) decnum ::= DECNUM */
1069
    36,  /* (4) hexnum ::= HEXNUM */
1070
    37,  /* (5) wdd_decnum ::= WDD_DECNUM */
1071
    23,  /* (6) deferred_isdn_hdr ::= isdn_prefix decnum SLASH_SUFFIX KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1072
    24,  /* (7) isdn_hdr ::= isdn_prefix decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1073
    21,  /* (8) ether_hdr ::= ether_prefix string KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1074
    25,  /* (9) wds_hdr ::= wds_prefix string decnum KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1075
    26,  /* (10) wds8_hdr ::= wds_prefix string decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1076
    27,  /* (11) wdp7_hdr ::= wds_prefix decnum KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1077
    28,  /* (12) wdp8_hdr ::= wds_prefix decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1078
    29,  /* (13) wdd_date ::= WDD_DATE wdd_decnum wdd_decnum wdd_decnum WDD_TIME wdd_decnum wdd_decnum wdd_decnum WDD_CAUSE WDD_CALLNUM */
1079
    30,  /* (14) wdd_hdr ::= WDD_CHUNK hexnum KEYWORD KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1080
    38,  /* (15) byte ::= HEXBYTE */
1081
    20,  /* (16) data_packet ::= ether_hdr datagroup */
1082
    20,  /* (17) data_packet ::= deferred_isdn_hdr datagroup deferred_isdn_hdr datagroup */
1083
    20,  /* (18) data_packet ::= isdn_hdr datagroup */
1084
    20,  /* (19) data_packet ::= wds_hdr datagroup */
1085
    20,  /* (20) data_packet ::= wds8_hdr datagroup */
1086
    20,  /* (21) data_packet ::= wdp7_hdr datagroup */
1087
    20,  /* (22) data_packet ::= wdp8_hdr datagroup */
1088
    20,  /* (23) data_packet ::= wdd_date wdd_hdr datagroup */
1089
    20,  /* (24) data_packet ::= wdd_hdr datagroup */
1090
    34,  /* (25) string ::= STRING */
1091
    39,  /* (26) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte */
1092
    39,  /* (27) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte */
1093
    39,  /* (28) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte */
1094
    39,  /* (29) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte */
1095
    39,  /* (30) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte */
1096
    39,  /* (31) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte */
1097
    39,  /* (32) bytegroup ::= byte byte byte byte byte byte byte byte byte byte */
1098
    39,  /* (33) bytegroup ::= byte byte byte byte byte byte byte byte byte */
1099
    39,  /* (34) bytegroup ::= byte byte byte byte byte byte byte byte */
1100
    39,  /* (35) bytegroup ::= byte byte byte byte byte byte byte */
1101
    39,  /* (36) bytegroup ::= byte byte byte byte byte byte */
1102
    39,  /* (37) bytegroup ::= byte byte byte byte byte */
1103
    39,  /* (38) bytegroup ::= byte byte byte byte */
1104
    39,  /* (39) bytegroup ::= byte byte byte */
1105
    39,  /* (40) bytegroup ::= byte byte */
1106
    39,  /* (41) bytegroup ::= byte */
1107
    40,  /* (42) dataln ::= COUNTER bytegroup */
1108
    22,  /* (43) datagroup ::= dataln dataln dataln dataln dataln dataln dataln dataln */
1109
    22,  /* (44) datagroup ::= dataln dataln dataln dataln dataln dataln dataln */
1110
    22,  /* (45) datagroup ::= dataln dataln dataln dataln dataln dataln */
1111
    22,  /* (46) datagroup ::= dataln dataln dataln dataln dataln */
1112
    22,  /* (47) datagroup ::= dataln dataln dataln dataln */
1113
    22,  /* (48) datagroup ::= dataln dataln dataln */
1114
    22,  /* (49) datagroup ::= dataln dataln */
1115
    22,  /* (50) datagroup ::= dataln */
1116
};
1117
1118
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
1119
** of symbols on the right-hand side of that rule. */
1120
static const signed char yyRuleInfoNRhs[] = {
1121
   -1,  /* (0) isdn_prefix ::= ISDN_PREFIX */
1122
   -1,  /* (1) ether_prefix ::= ETHER_PREFIX */
1123
   -1,  /* (2) wds_prefix ::= WDS_PREFIX */
1124
   -1,  /* (3) decnum ::= DECNUM */
1125
   -1,  /* (4) hexnum ::= HEXNUM */
1126
   -1,  /* (5) wdd_decnum ::= WDD_DECNUM */
1127
  -13,  /* (6) deferred_isdn_hdr ::= isdn_prefix decnum SLASH_SUFFIX KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1128
  -12,  /* (7) isdn_hdr ::= isdn_prefix decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1129
  -12,  /* (8) ether_hdr ::= ether_prefix string KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1130
  -11,  /* (9) wds_hdr ::= wds_prefix string decnum KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1131
  -13,  /* (10) wds8_hdr ::= wds_prefix string decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1132
  -10,  /* (11) wdp7_hdr ::= wds_prefix decnum KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1133
  -12,  /* (12) wdp8_hdr ::= wds_prefix decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1134
  -10,  /* (13) wdd_date ::= WDD_DATE wdd_decnum wdd_decnum wdd_decnum WDD_TIME wdd_decnum wdd_decnum wdd_decnum WDD_CAUSE WDD_CALLNUM */
1135
  -11,  /* (14) wdd_hdr ::= WDD_CHUNK hexnum KEYWORD KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1136
   -1,  /* (15) byte ::= HEXBYTE */
1137
   -2,  /* (16) data_packet ::= ether_hdr datagroup */
1138
   -4,  /* (17) data_packet ::= deferred_isdn_hdr datagroup deferred_isdn_hdr datagroup */
1139
   -2,  /* (18) data_packet ::= isdn_hdr datagroup */
1140
   -2,  /* (19) data_packet ::= wds_hdr datagroup */
1141
   -2,  /* (20) data_packet ::= wds8_hdr datagroup */
1142
   -2,  /* (21) data_packet ::= wdp7_hdr datagroup */
1143
   -2,  /* (22) data_packet ::= wdp8_hdr datagroup */
1144
   -3,  /* (23) data_packet ::= wdd_date wdd_hdr datagroup */
1145
   -2,  /* (24) data_packet ::= wdd_hdr datagroup */
1146
   -1,  /* (25) string ::= STRING */
1147
  -16,  /* (26) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte */
1148
  -15,  /* (27) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte */
1149
  -14,  /* (28) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte */
1150
  -13,  /* (29) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte */
1151
  -12,  /* (30) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte */
1152
  -11,  /* (31) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte */
1153
  -10,  /* (32) bytegroup ::= byte byte byte byte byte byte byte byte byte byte */
1154
   -9,  /* (33) bytegroup ::= byte byte byte byte byte byte byte byte byte */
1155
   -8,  /* (34) bytegroup ::= byte byte byte byte byte byte byte byte */
1156
   -7,  /* (35) bytegroup ::= byte byte byte byte byte byte byte */
1157
   -6,  /* (36) bytegroup ::= byte byte byte byte byte byte */
1158
   -5,  /* (37) bytegroup ::= byte byte byte byte byte */
1159
   -4,  /* (38) bytegroup ::= byte byte byte byte */
1160
   -3,  /* (39) bytegroup ::= byte byte byte */
1161
   -2,  /* (40) bytegroup ::= byte byte */
1162
   -1,  /* (41) bytegroup ::= byte */
1163
   -2,  /* (42) dataln ::= COUNTER bytegroup */
1164
   -8,  /* (43) datagroup ::= dataln dataln dataln dataln dataln dataln dataln dataln */
1165
   -7,  /* (44) datagroup ::= dataln dataln dataln dataln dataln dataln dataln */
1166
   -6,  /* (45) datagroup ::= dataln dataln dataln dataln dataln dataln */
1167
   -5,  /* (46) datagroup ::= dataln dataln dataln dataln dataln */
1168
   -4,  /* (47) datagroup ::= dataln dataln dataln dataln */
1169
   -3,  /* (48) datagroup ::= dataln dataln dataln */
1170
   -2,  /* (49) datagroup ::= dataln dataln */
1171
   -1,  /* (50) datagroup ::= dataln */
1172
};
1173
1174
static void yy_accept(yyParser*);  /* Forward Declaration */
1175
1176
/*
1177
** Perform a reduce action and the shift that must immediately
1178
** follow the reduce.
1179
**
1180
** The yyLookahead and yyLookaheadToken parameters provide reduce actions
1181
** access to the lookahead token (if any).  The yyLookahead will be YYNOCODE
1182
** if the lookahead token has already been consumed.  As this procedure is
1183
** only called from one place, optimizing compilers will in-line it, which
1184
** means that the extra parameters have no performance impact.
1185
*/
1186
static YYACTIONTYPE yy_reduce(
1187
  yyParser *yypParser,         /* The parser */
1188
  unsigned int yyruleno,       /* Number of the rule by which to reduce */
1189
  int yyLookahead,             /* Lookahead token, or YYNOCODE if none */
1190
  AscendParserTOKENTYPE yyLookaheadToken  /* Value of the lookahead token */
1191
  AscendParserCTX_PDECL                   /* %extra_context */
1192
0
){
1193
0
  int yygoto;                     /* The next state */
1194
0
  YYACTIONTYPE yyact;             /* The next action */
1195
0
  yyStackEntry *yymsp;            /* The top of the parser's stack */
1196
0
  int yysize;                     /* Amount to pop the stack */
1197
0
  AscendParserARG_FETCH
1198
0
  (void)yyLookahead;
1199
0
  (void)yyLookaheadToken;
1200
0
  yymsp = yypParser->yytos;
1201
1202
0
  switch( yyruleno ){
1203
  /* Beginning here are the reduction cases.  A typical example
1204
  ** follows:
1205
  **   case 0:
1206
  **  #line <lineno> <grammarfile>
1207
  **     { ... }           // User supplied code
1208
  **  #line <lineno> <thisfile>
1209
  **     break;
1210
  */
1211
/********** Begin reduce actions **********************************************/
1212
0
        YYMINORTYPE yylhsminor;
1213
0
      case 0: /* isdn_prefix ::= ISDN_PREFIX */
1214
0
      case 1: /* ether_prefix ::= ETHER_PREFIX */ yytestcase(yyruleno==1);
1215
0
      case 2: /* wds_prefix ::= WDS_PREFIX */ yytestcase(yyruleno==2);
1216
0
#line 194 "/src/wireshark/wiretap/ascend_parser.lemon"
1217
0
{ yylhsminor.yy5 = yymsp[0].minor.yy0.u16_val; }
1218
0
#line 1243 "./ascend_parser.c"
1219
0
  yymsp[0].minor.yy5 = yylhsminor.yy5;
1220
0
        break;
1221
0
      case 3: /* decnum ::= DECNUM */
1222
0
      case 4: /* hexnum ::= HEXNUM */ yytestcase(yyruleno==4);
1223
0
      case 5: /* wdd_decnum ::= WDD_DECNUM */ yytestcase(yyruleno==5);
1224
0
#line 205 "/src/wireshark/wiretap/ascend_parser.lemon"
1225
0
{ yylhsminor.yy15 = yymsp[0].minor.yy0.u32_val; }
1226
0
#line 1251 "./ascend_parser.c"
1227
0
  yymsp[0].minor.yy15 = yylhsminor.yy15;
1228
0
        break;
1229
0
      case 6: /* deferred_isdn_hdr ::= isdn_prefix decnum SLASH_SUFFIX KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1230
0
#line 225 "/src/wireshark/wiretap/ascend_parser.lemon"
1231
0
{
1232
0
    parser_state->wirelen += yymsp[-2].minor.yy15;
1233
0
    parser_state->secs = yymsp[-4].minor.yy15;
1234
0
    parser_state->usecs = yymsp[-3].minor.yy15;
1235
0
    if (parser_state->pseudo_header != NULL) {
1236
0
        parser_state->pseudo_header->type = yymsp[-12].minor.yy5;
1237
0
        parser_state->pseudo_header->sess = yymsp[-11].minor.yy15;
1238
0
        parser_state->pseudo_header->call_num[0] = '\0';
1239
0
        parser_state->pseudo_header->chunk = 0;
1240
0
        parser_state->pseudo_header->task = yymsp[-6].minor.yy15;
1241
0
    }
1242
    /* because we have two data groups */
1243
0
    parser_state->first_hexbyte = 0;
1244
0
}
1245
0
#line 1270 "./ascend_parser.c"
1246
0
  yy_destructor(yypParser,10,&yymsp[-10].minor);
1247
0
  yy_destructor(yypParser,2,&yymsp[-9].minor);
1248
0
  yy_destructor(yypParser,2,&yymsp[-7].minor);
1249
0
  yy_destructor(yypParser,2,&yymsp[-5].minor);
1250
0
  yy_destructor(yypParser,2,&yymsp[-1].minor);
1251
0
  yy_destructor(yypParser,18,&yymsp[0].minor);
1252
0
        break;
1253
0
      case 7: /* isdn_hdr ::= isdn_prefix decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1254
0
#line 245 "/src/wireshark/wiretap/ascend_parser.lemon"
1255
0
{
1256
0
    parser_state->wirelen += yymsp[-2].minor.yy15;
1257
0
    parser_state->secs = yymsp[-4].minor.yy15;
1258
0
    parser_state->usecs = yymsp[-3].minor.yy15;
1259
0
    if (parser_state->pseudo_header != NULL) {
1260
0
        parser_state->pseudo_header->type = yymsp[-11].minor.yy5;
1261
0
        parser_state->pseudo_header->sess = yymsp[-10].minor.yy15;
1262
0
        parser_state->pseudo_header->call_num[0] = '\0';
1263
0
        parser_state->pseudo_header->chunk = 0;
1264
0
        parser_state->pseudo_header->task = yymsp[-6].minor.yy15;
1265
0
    }
1266
0
    parser_state->first_hexbyte = 0;
1267
0
}
1268
0
#line 1293 "./ascend_parser.c"
1269
0
  yy_destructor(yypParser,2,&yymsp[-9].minor);
1270
0
  yy_destructor(yypParser,2,&yymsp[-7].minor);
1271
0
  yy_destructor(yypParser,2,&yymsp[-5].minor);
1272
0
  yy_destructor(yypParser,2,&yymsp[-1].minor);
1273
0
  yy_destructor(yypParser,18,&yymsp[0].minor);
1274
0
        break;
1275
0
      case 8: /* ether_hdr ::= ether_prefix string KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1276
0
#line 263 "/src/wireshark/wiretap/ascend_parser.lemon"
1277
0
{
1278
0
    parser_state->wirelen += yymsp[-2].minor.yy15;
1279
0
    parser_state->secs = yymsp[-4].minor.yy15;
1280
0
    parser_state->usecs = yymsp[-3].minor.yy15;
1281
0
    if (parser_state->pseudo_header != NULL) {
1282
0
        parser_state->pseudo_header->type = yymsp[-11].minor.yy5;
1283
0
        parser_state->pseudo_header->call_num[0] = '\0';
1284
0
        parser_state->pseudo_header->chunk = 0;
1285
0
        parser_state->pseudo_header->task = yymsp[-6].minor.yy15;
1286
0
    }
1287
0
}
1288
0
#line 1313 "./ascend_parser.c"
1289
0
  yy_destructor(yypParser,2,&yymsp[-9].minor);
1290
0
  yy_destructor(yypParser,2,&yymsp[-7].minor);
1291
0
  yy_destructor(yypParser,2,&yymsp[-5].minor);
1292
0
  yy_destructor(yypParser,2,&yymsp[-1].minor);
1293
0
  yy_destructor(yypParser,18,&yymsp[0].minor);
1294
0
        break;
1295
0
      case 9: /* wds_hdr ::= wds_prefix string decnum KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1296
0
#line 277 "/src/wireshark/wiretap/ascend_parser.lemon"
1297
0
{
1298
0
    parser_state->wirelen += yymsp[-2].minor.yy15;
1299
0
    parser_state->secs = yymsp[-4].minor.yy15;
1300
0
    parser_state->usecs = yymsp[-3].minor.yy15;
1301
0
    if (parser_state->pseudo_header != NULL) {
1302
        /* parser_state->pseudo_header->user is set in ascend_scanner.l */
1303
0
        parser_state->pseudo_header->type = yymsp[-10].minor.yy5;
1304
0
        parser_state->pseudo_header->sess = yymsp[-8].minor.yy15;
1305
0
        parser_state->pseudo_header->call_num[0] = '\0';
1306
0
        parser_state->pseudo_header->chunk = 0;
1307
0
        parser_state->pseudo_header->task = yymsp[-6].minor.yy15;
1308
0
    }
1309
0
}
1310
0
#line 1335 "./ascend_parser.c"
1311
0
  yy_destructor(yypParser,2,&yymsp[-7].minor);
1312
0
  yy_destructor(yypParser,2,&yymsp[-5].minor);
1313
0
  yy_destructor(yypParser,2,&yymsp[-1].minor);
1314
0
  yy_destructor(yypParser,18,&yymsp[0].minor);
1315
0
        break;
1316
0
      case 10: /* wds8_hdr ::= wds_prefix string decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1317
0
#line 293 "/src/wireshark/wiretap/ascend_parser.lemon"
1318
0
{
1319
0
    parser_state->wirelen += yymsp[-2].minor.yy15;
1320
0
    parser_state->secs = yymsp[-4].minor.yy15;
1321
0
    parser_state->usecs = yymsp[-3].minor.yy15;
1322
0
    if (parser_state->pseudo_header != NULL) {
1323
        /* parser_state->pseudo_header->user is set in ascend_scanner.l */
1324
0
        parser_state->pseudo_header->type = yymsp[-12].minor.yy5;
1325
0
        parser_state->pseudo_header->sess = yymsp[-10].minor.yy15;
1326
0
        parser_state->pseudo_header->call_num[0] = '\0';
1327
0
        parser_state->pseudo_header->chunk = 0;
1328
0
        parser_state->pseudo_header->task = yymsp[-6].minor.yy15;
1329
0
    }
1330
0
}
1331
0
#line 1356 "./ascend_parser.c"
1332
0
  yy_destructor(yypParser,2,&yymsp[-9].minor);
1333
0
  yy_destructor(yypParser,2,&yymsp[-7].minor);
1334
0
  yy_destructor(yypParser,2,&yymsp[-5].minor);
1335
0
  yy_destructor(yypParser,2,&yymsp[-1].minor);
1336
0
  yy_destructor(yypParser,18,&yymsp[0].minor);
1337
0
        break;
1338
0
      case 11: /* wdp7_hdr ::= wds_prefix decnum KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1339
0
#line 309 "/src/wireshark/wiretap/ascend_parser.lemon"
1340
0
{
1341
0
    parser_state->wirelen += yymsp[-2].minor.yy15;
1342
0
    parser_state->secs = yymsp[-4].minor.yy15;
1343
0
    parser_state->usecs = yymsp[-3].minor.yy15;
1344
0
    if (parser_state->pseudo_header != NULL) {
1345
        /* parser_state->pseudo_header->user is set in ascend_scanner.l */
1346
0
        parser_state->pseudo_header->type = yymsp[-9].minor.yy5;
1347
0
        parser_state->pseudo_header->sess = yymsp[-8].minor.yy15;
1348
0
        parser_state->pseudo_header->call_num[0] = '\0';
1349
0
        parser_state->pseudo_header->chunk = 0;
1350
0
        parser_state->pseudo_header->task = yymsp[-6].minor.yy15;
1351
0
    }
1352
0
}
1353
0
#line 1378 "./ascend_parser.c"
1354
0
  yy_destructor(yypParser,2,&yymsp[-7].minor);
1355
0
  yy_destructor(yypParser,2,&yymsp[-5].minor);
1356
0
  yy_destructor(yypParser,2,&yymsp[-1].minor);
1357
0
  yy_destructor(yypParser,18,&yymsp[0].minor);
1358
0
        break;
1359
0
      case 12: /* wdp8_hdr ::= wds_prefix decnum KEYWORD string KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1360
0
#line 325 "/src/wireshark/wiretap/ascend_parser.lemon"
1361
0
{
1362
0
    parser_state->wirelen += yymsp[-2].minor.yy15;
1363
0
    parser_state->secs = yymsp[-4].minor.yy15;
1364
0
    parser_state->usecs = yymsp[-3].minor.yy15;
1365
0
    if (parser_state->pseudo_header != NULL) {
1366
        /* parser_state->pseudo_header->user is set in ascend_scanner.l */
1367
0
        parser_state->pseudo_header->type = yymsp[-11].minor.yy5;
1368
0
        parser_state->pseudo_header->sess = yymsp[-10].minor.yy15;
1369
0
        parser_state->pseudo_header->call_num[0] = '\0';
1370
0
        parser_state->pseudo_header->chunk = 0;
1371
0
        parser_state->pseudo_header->task = yymsp[-6].minor.yy15;
1372
0
    }
1373
0
}
1374
0
#line 1399 "./ascend_parser.c"
1375
0
  yy_destructor(yypParser,2,&yymsp[-9].minor);
1376
0
  yy_destructor(yypParser,2,&yymsp[-7].minor);
1377
0
  yy_destructor(yypParser,2,&yymsp[-5].minor);
1378
0
  yy_destructor(yypParser,2,&yymsp[-1].minor);
1379
0
  yy_destructor(yypParser,18,&yymsp[0].minor);
1380
0
        break;
1381
0
      case 13: /* wdd_date ::= WDD_DATE wdd_decnum wdd_decnum wdd_decnum WDD_TIME wdd_decnum wdd_decnum wdd_decnum WDD_CAUSE WDD_CALLNUM */
1382
0
{  yy_destructor(yypParser,3,&yymsp[-9].minor);
1383
0
#line 344 "/src/wireshark/wiretap/ascend_parser.lemon"
1384
0
{
1385
    /*
1386
    * Supply the date/time value to the code above us; it will use the
1387
    * first date/time value supplied as the capture start date/time.
1388
    */
1389
0
    struct tm wddt;
1390
1391
0
    wddt.tm_sec  = yymsp[-2].minor.yy15;
1392
0
    wddt.tm_min  = yymsp[-3].minor.yy15;
1393
0
    wddt.tm_hour = yymsp[-4].minor.yy15;
1394
0
    wddt.tm_mday = yymsp[-7].minor.yy15;
1395
0
    wddt.tm_mon  = yymsp[-8].minor.yy15 - 1;
1396
0
    wddt.tm_year = (yymsp[-6].minor.yy15 > 1970) ? yymsp[-6].minor.yy15 - 1900 : 70;
1397
0
    wddt.tm_isdst = -1;
1398
1399
0
    parser_state->timestamp = (uint32_t) mktime(&wddt);
1400
0
    parser_state->saw_timestamp = true;
1401
1402
0
    (void) g_strlcpy(parser_state->pseudo_header->call_num, yymsp[0].minor.yy0.str_val, ASCEND_MAX_STR_LEN);
1403
0
}
1404
0
#line 1429 "./ascend_parser.c"
1405
0
  yy_destructor(yypParser,5,&yymsp[-5].minor);
1406
0
  yy_destructor(yypParser,6,&yymsp[-1].minor);
1407
0
}
1408
0
        break;
1409
0
      case 14: /* wdd_hdr ::= WDD_CHUNK hexnum KEYWORD KEYWORD hexnum KEYWORD decnum decnum decnum KEYWORD HEXNUM */
1410
0
{  yy_destructor(yypParser,8,&yymsp[-10].minor);
1411
0
#line 370 "/src/wireshark/wiretap/ascend_parser.lemon"
1412
0
{
1413
0
    parser_state->wirelen = yymsp[-2].minor.yy15;
1414
0
    parser_state->secs = yymsp[-4].minor.yy15;
1415
0
    parser_state->usecs = yymsp[-3].minor.yy15;
1416
0
    if (parser_state->pseudo_header != NULL) {
1417
0
        parser_state->pseudo_header->type = ASCEND_PFX_WDD;
1418
0
        parser_state->pseudo_header->user[0] = '\0';
1419
0
        parser_state->pseudo_header->sess = 0;
1420
0
        parser_state->pseudo_header->chunk = yymsp[-9].minor.yy15;
1421
0
        parser_state->pseudo_header->task = yymsp[-6].minor.yy15;
1422
0
    }
1423
0
}
1424
0
#line 1449 "./ascend_parser.c"
1425
0
  yy_destructor(yypParser,2,&yymsp[-8].minor);
1426
0
  yy_destructor(yypParser,2,&yymsp[-7].minor);
1427
0
  yy_destructor(yypParser,2,&yymsp[-5].minor);
1428
0
  yy_destructor(yypParser,2,&yymsp[-1].minor);
1429
0
  yy_destructor(yypParser,18,&yymsp[0].minor);
1430
0
}
1431
0
        break;
1432
0
      case 15: /* byte ::= HEXBYTE */
1433
0
#line 383 "/src/wireshark/wiretap/ascend_parser.lemon"
1434
0
{
1435
    /* remember the position of the data group in the trace, to tip off
1436
        ascend_find_next_packet() as to where to look for the next header. */
1437
0
    if (parser_state->first_hexbyte == 0) {
1438
0
        parser_state->first_hexbyte = file_tell(parser_state->fh) - yymsp[0].minor.yy0.length;
1439
0
    }
1440
1441
    /* XXX - if this test fails, it means that we parsed more bytes than
1442
        the header claimed there were. */
1443
0
    if (parser_state->caplen < parser_state->wirelen) {
1444
0
        parser_state->pkt_data[parser_state->caplen] = yymsp[0].minor.yy0.u8_val;
1445
0
        parser_state->caplen++;
1446
0
    }
1447
0
}
1448
0
#line 1473 "./ascend_parser.c"
1449
0
        break;
1450
0
      case 25: /* string ::= STRING */
1451
0
{  yy_destructor(yypParser,1,&yymsp[0].minor);
1452
0
#line 202 "/src/wireshark/wiretap/ascend_parser.lemon"
1453
0
{
1454
0
}
1455
0
#line 1480 "./ascend_parser.c"
1456
0
}
1457
0
        break;
1458
0
      case 42: /* dataln ::= COUNTER bytegroup */
1459
0
{  yy_destructor(yypParser,9,&yymsp[-1].minor);
1460
0
#line 416 "/src/wireshark/wiretap/ascend_parser.lemon"
1461
0
{
1462
0
}
1463
0
#line 1488 "./ascend_parser.c"
1464
0
}
1465
0
        break;
1466
0
      default:
1467
0
      /* (16) data_packet ::= ether_hdr datagroup */ yytestcase(yyruleno==16);
1468
0
      /* (17) data_packet ::= deferred_isdn_hdr datagroup deferred_isdn_hdr datagroup */ yytestcase(yyruleno==17);
1469
0
      /* (18) data_packet ::= isdn_hdr datagroup */ yytestcase(yyruleno==18);
1470
0
      /* (19) data_packet ::= wds_hdr datagroup */ yytestcase(yyruleno==19);
1471
0
      /* (20) data_packet ::= wds8_hdr datagroup */ yytestcase(yyruleno==20);
1472
0
      /* (21) data_packet ::= wdp7_hdr datagroup */ yytestcase(yyruleno==21);
1473
0
      /* (22) data_packet ::= wdp8_hdr datagroup */ yytestcase(yyruleno==22);
1474
0
      /* (23) data_packet ::= wdd_date wdd_hdr datagroup */ yytestcase(yyruleno==23);
1475
0
      /* (24) data_packet ::= wdd_hdr datagroup */ yytestcase(yyruleno==24);
1476
0
      /* (26) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte */ yytestcase(yyruleno==26);
1477
0
      /* (27) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte byte */ yytestcase(yyruleno==27);
1478
0
      /* (28) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte byte */ yytestcase(yyruleno==28);
1479
0
      /* (29) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte byte */ yytestcase(yyruleno==29);
1480
0
      /* (30) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte byte */ yytestcase(yyruleno==30);
1481
0
      /* (31) bytegroup ::= byte byte byte byte byte byte byte byte byte byte byte */ yytestcase(yyruleno==31);
1482
0
      /* (32) bytegroup ::= byte byte byte byte byte byte byte byte byte byte */ yytestcase(yyruleno==32);
1483
0
      /* (33) bytegroup ::= byte byte byte byte byte byte byte byte byte */ yytestcase(yyruleno==33);
1484
0
      /* (34) bytegroup ::= byte byte byte byte byte byte byte byte */ yytestcase(yyruleno==34);
1485
0
      /* (35) bytegroup ::= byte byte byte byte byte byte byte */ yytestcase(yyruleno==35);
1486
0
      /* (36) bytegroup ::= byte byte byte byte byte byte */ yytestcase(yyruleno==36);
1487
0
      /* (37) bytegroup ::= byte byte byte byte byte */ yytestcase(yyruleno==37);
1488
0
      /* (38) bytegroup ::= byte byte byte byte */ yytestcase(yyruleno==38);
1489
0
      /* (39) bytegroup ::= byte byte byte */ yytestcase(yyruleno==39);
1490
0
      /* (40) bytegroup ::= byte byte */ yytestcase(yyruleno==40);
1491
0
      /* (41) bytegroup ::= byte */ yytestcase(yyruleno==41);
1492
0
      /* (43) datagroup ::= dataln dataln dataln dataln dataln dataln dataln dataln */ yytestcase(yyruleno==43);
1493
0
      /* (44) datagroup ::= dataln dataln dataln dataln dataln dataln dataln */ yytestcase(yyruleno==44);
1494
0
      /* (45) datagroup ::= dataln dataln dataln dataln dataln dataln */ yytestcase(yyruleno==45);
1495
0
      /* (46) datagroup ::= dataln dataln dataln dataln dataln */ yytestcase(yyruleno==46);
1496
0
      /* (47) datagroup ::= dataln dataln dataln dataln */ yytestcase(yyruleno==47);
1497
0
      /* (48) datagroup ::= dataln dataln dataln */ yytestcase(yyruleno==48);
1498
0
      /* (49) datagroup ::= dataln dataln */ yytestcase(yyruleno==49);
1499
0
      /* (50) datagroup ::= dataln */ yytestcase(yyruleno==50);
1500
0
        break;
1501
/********** End reduce actions ************************************************/
1502
0
  };
1503
0
  assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
1504
0
  yygoto = yyRuleInfoLhs[yyruleno];
1505
0
  yysize = yyRuleInfoNRhs[yyruleno];
1506
0
  yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
1507
1508
  /* There are no SHIFTREDUCE actions on nonterminals because the table
1509
  ** generator has simplified them to pure REDUCE actions. */
1510
0
  assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );
1511
1512
  /* It is not possible for a REDUCE to be followed by an error */
1513
0
  assert( yyact!=YY_ERROR_ACTION );
1514
1515
0
  yymsp += yysize+1;
1516
0
  yypParser->yytos = yymsp;
1517
0
  yymsp->stateno = (YYACTIONTYPE)yyact;
1518
0
  yymsp->major = (YYCODETYPE)yygoto;
1519
0
  yyTraceShift(yypParser, yyact, "... then shift");
1520
0
  return yyact;
1521
0
}
1522
1523
/*
1524
** The following code executes when the parse fails
1525
*/
1526
#ifndef YYNOERRORRECOVERY
1527
static void yy_parse_failed(
1528
  yyParser *yypParser           /* The parser */
1529
0
){
1530
0
  AscendParserARG_FETCH
1531
0
  AscendParserCTX_FETCH
1532
#ifndef NDEBUG
1533
  if( yyTraceFILE ){
1534
    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
1535
  }
1536
#endif
1537
0
  while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
1538
  /* Here code is inserted which will be executed whenever the
1539
  ** parser fails */
1540
/************ Begin %parse_failure code ***************************************/
1541
/************ End %parse_failure code *****************************************/
1542
0
  AscendParserARG_STORE /* Suppress warning about unused %extra_argument variable */
1543
0
  AscendParserCTX_STORE
1544
0
}
1545
#endif /* YYNOERRORRECOVERY */
1546
1547
/*
1548
** The following code executes when a syntax error first occurs.
1549
*/
1550
static void yy_syntax_error(
1551
  yyParser *yypParser,           /* The parser */
1552
  int yymajor,                   /* The major type of the error token */
1553
  AscendParserTOKENTYPE yyminor         /* The minor type of the error token */
1554
0
){
1555
0
  AscendParserARG_FETCH
1556
0
  AscendParserCTX_FETCH
1557
0
#define TOKEN yyminor
1558
/************ Begin %syntax_error code ****************************************/
1559
0
#line 428 "/src/wireshark/wiretap/ascend_parser.lemon"
1560
1561
    /*
1562
    * We might be parsing output that includes console session output along
1563
    * with packet dumps.
1564
    */
1565
0
    (void)yypParser;
1566
0
    (void)yyminor;
1567
0
    static char *err = "non-packet data";
1568
1569
0
    parser_state->ascend_parse_error = err;
1570
0
#line 1595 "./ascend_parser.c"
1571
/************ End %syntax_error code ******************************************/
1572
0
  AscendParserARG_STORE /* Suppress warning about unused %extra_argument variable */
1573
0
  AscendParserCTX_STORE
1574
0
}
1575
1576
/*
1577
** The following is executed when the parser accepts
1578
*/
1579
static void yy_accept(
1580
  yyParser *yypParser           /* The parser */
1581
0
){
1582
0
  AscendParserARG_FETCH
1583
0
  AscendParserCTX_FETCH
1584
#ifndef NDEBUG
1585
  if( yyTraceFILE ){
1586
    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
1587
  }
1588
#endif
1589
0
#ifndef YYNOERRORRECOVERY
1590
0
  yypParser->yyerrcnt = -1;
1591
0
#endif
1592
0
  assert( yypParser->yytos==yypParser->yystack );
1593
  /* Here code is inserted which will be executed whenever the
1594
  ** parser accepts */
1595
/*********** Begin %parse_accept code *****************************************/
1596
/*********** End %parse_accept code *******************************************/
1597
0
  AscendParserARG_STORE /* Suppress warning about unused %extra_argument variable */
1598
0
  AscendParserCTX_STORE
1599
0
}
1600
1601
/* The main parser program.
1602
** The first argument is a pointer to a structure obtained from
1603
** "AscendParserAlloc" which describes the current state of the parser.
1604
** The second argument is the major token number.  The third is
1605
** the minor token.  The fourth optional argument is whatever the
1606
** user wants (and specified in the grammar) and is available for
1607
** use by the action routines.
1608
**
1609
** Inputs:
1610
** <ul>
1611
** <li> A pointer to the parser (an opaque structure.)
1612
** <li> The major token number.
1613
** <li> The minor token number.
1614
** <li> An option argument of a grammar-specified type.
1615
** </ul>
1616
**
1617
** Outputs:
1618
** None.
1619
*/
1620
void AscendParser(
1621
  void *yyp,                   /* The parser */
1622
  int yymajor,                 /* The major token code number */
1623
  AscendParserTOKENTYPE yyminor       /* The value for the token */
1624
  AscendParserARG_PDECL               /* Optional %extra_argument parameter */
1625
0
){
1626
0
  YYMINORTYPE yyminorunion;
1627
0
  YYACTIONTYPE yyact;   /* The parser action. */
1628
0
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
1629
0
  int yyendofinput;     /* True if we are at the end of input */
1630
0
#endif
1631
#ifdef YYERRORSYMBOL
1632
  int yyerrorhit = 0;   /* True if yymajor has invoked an error */
1633
#endif
1634
0
  yyParser *yypParser = (yyParser*)yyp;  /* The parser */
1635
0
  AscendParserCTX_FETCH
1636
0
  AscendParserARG_STORE
1637
1638
0
  assert( yypParser->yytos!=0 );
1639
0
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
1640
0
  yyendofinput = (yymajor==0);
1641
0
#endif
1642
1643
0
  yyact = yypParser->yytos->stateno;
1644
#ifndef NDEBUG
1645
  if( yyTraceFILE ){
1646
    if( yyact < YY_MIN_REDUCE ){
1647
      fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
1648
              yyTracePrompt,yyTokenName[yymajor],yyact);
1649
    }else{
1650
      fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
1651
              yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
1652
    }
1653
  }
1654
#endif
1655
1656
0
  while(1){ /* Exit by "break" */
1657
0
    assert( yypParser->yytos>=yypParser->yystack );
1658
0
    assert( yyact==yypParser->yytos->stateno );
1659
0
    yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
1660
0
    if( yyact >= YY_MIN_REDUCE ){
1661
0
      unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */
1662
#ifndef NDEBUG
1663
      assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
1664
      if( yyTraceFILE ){
1665
        int yysize = yyRuleInfoNRhs[yyruleno];
1666
        if( yysize ){
1667
          fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
1668
            yyTracePrompt,
1669
            yyruleno, yyRuleName[yyruleno],
1670
            yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action",
1671
            yypParser->yytos[yysize].stateno);
1672
        }else{
1673
          fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
1674
            yyTracePrompt, yyruleno, yyRuleName[yyruleno],
1675
            yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action");
1676
        }
1677
      }
1678
#endif /* NDEBUG */
1679
1680
      /* Check that the stack is large enough to grow by a single entry
1681
      ** if the RHS of the rule is empty.  This ensures that there is room
1682
      ** enough on the stack to push the LHS value */
1683
0
      if( yyRuleInfoNRhs[yyruleno]==0 ){
1684
#ifdef YYTRACKMAXSTACKDEPTH
1685
        if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
1686
          yypParser->yyhwm++;
1687
          assert( yypParser->yyhwm ==
1688
                  (int)(yypParser->yytos - yypParser->yystack));
1689
        }
1690
#endif
1691
0
#if YYSTACKDEPTH>0
1692
0
        if( yypParser->yytos>=yypParser->yystackEnd ){
1693
0
          yyStackOverflow(yypParser);
1694
0
          break;
1695
0
        }
1696
#else
1697
        if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
1698
          if( yyGrowStack(yypParser) ){
1699
            yyStackOverflow(yypParser);
1700
            break;
1701
          }
1702
        }
1703
#endif
1704
0
      }
1705
0
      yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor AscendParserCTX_PARAM);
1706
0
    }else if( yyact <= YY_MAX_SHIFTREDUCE ){
1707
0
      yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
1708
0
#ifndef YYNOERRORRECOVERY
1709
0
      yypParser->yyerrcnt--;
1710
0
#endif
1711
0
      break;
1712
0
    }else if( yyact==YY_ACCEPT_ACTION ){
1713
0
      yypParser->yytos--;
1714
0
      yy_accept(yypParser);
1715
0
      return;
1716
0
    }else{
1717
0
      assert( yyact == YY_ERROR_ACTION );
1718
0
      yyminorunion.yy0 = yyminor;
1719
#ifdef YYERRORSYMBOL
1720
      int yymx;
1721
#endif
1722
#ifndef NDEBUG
1723
      if( yyTraceFILE ){
1724
        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
1725
      }
1726
#endif
1727
#ifdef YYERRORSYMBOL
1728
      /* A syntax error has occurred.
1729
      ** The response to an error depends upon whether or not the
1730
      ** grammar defines an error token "ERROR".
1731
      **
1732
      ** This is what we do if the grammar does define ERROR:
1733
      **
1734
      **  * Call the %syntax_error function.
1735
      **
1736
      **  * Begin popping the stack until we enter a state where
1737
      **    it is legal to shift the error symbol, then shift
1738
      **    the error symbol.
1739
      **
1740
      **  * Set the error count to three.
1741
      **
1742
      **  * Begin accepting and shifting new tokens.  No new error
1743
      **    processing will occur until three tokens have been
1744
      **    shifted successfully.
1745
      **
1746
      */
1747
      if( yypParser->yyerrcnt<0 ){
1748
        yy_syntax_error(yypParser,yymajor,yyminor);
1749
      }
1750
      yymx = yypParser->yytos->major;
1751
      if( yymx==YYERRORSYMBOL || yyerrorhit ){
1752
#ifndef NDEBUG
1753
        if( yyTraceFILE ){
1754
          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
1755
             yyTracePrompt,yyTokenName[yymajor]);
1756
        }
1757
#endif
1758
        yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
1759
        yymajor = YYNOCODE;
1760
      }else{
1761
        while( yypParser->yytos > yypParser->yystack ){
1762
          yyact = yy_find_reduce_action(yypParser->yytos->stateno,
1763
                                        YYERRORSYMBOL);
1764
          if( yyact<=YY_MAX_SHIFTREDUCE ) break;
1765
          yy_pop_parser_stack(yypParser);
1766
        }
1767
        if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){
1768
          yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1769
          yy_parse_failed(yypParser);
1770
#ifndef YYNOERRORRECOVERY
1771
          yypParser->yyerrcnt = -1;
1772
#endif
1773
          yymajor = YYNOCODE;
1774
        }else if( yymx!=YYERRORSYMBOL ){
1775
          yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
1776
        }
1777
      }
1778
      yypParser->yyerrcnt = 3;
1779
      yyerrorhit = 1;
1780
      if( yymajor==YYNOCODE ) break;
1781
      yyact = yypParser->yytos->stateno;
1782
#elif defined(YYNOERRORRECOVERY)
1783
      /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
1784
      ** do any kind of error recovery.  Instead, simply invoke the syntax
1785
      ** error routine and continue going as if nothing had happened.
1786
      **
1787
      ** Applications can set this macro (for example inside %include) if
1788
      ** they intend to abandon the parse upon the first syntax error seen.
1789
      */
1790
      yy_syntax_error(yypParser,yymajor, yyminor);
1791
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1792
      break;
1793
#else  /* YYERRORSYMBOL is not defined */
1794
      /* This is what we do if the grammar does not define ERROR:
1795
      **
1796
      **  * Report an error message, and throw away the input token.
1797
      **
1798
      **  * If the input token is $, then fail the parse.
1799
      **
1800
      ** As before, subsequent error messages are suppressed until
1801
      ** three input tokens have been successfully shifted.
1802
      */
1803
0
      if( yypParser->yyerrcnt<=0 ){
1804
0
        yy_syntax_error(yypParser,yymajor, yyminor);
1805
0
      }
1806
0
      yypParser->yyerrcnt = 3;
1807
0
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1808
0
      if( yyendofinput ){
1809
0
        yy_parse_failed(yypParser);
1810
0
#ifndef YYNOERRORRECOVERY
1811
0
        yypParser->yyerrcnt = -1;
1812
0
#endif
1813
0
      }
1814
0
      break;
1815
0
#endif
1816
0
    }
1817
0
  }
1818
#ifndef NDEBUG
1819
  if( yyTraceFILE ){
1820
    yyStackEntry *i;
1821
    char cDiv = '[';
1822
    fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
1823
    for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
1824
      fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
1825
      cDiv = ' ';
1826
    }
1827
    fprintf(yyTraceFILE,"]\n");
1828
  }
1829
#endif
1830
0
  return;
1831
0
}
1832
1833
/*
1834
** Return the fallback token corresponding to canonical token iToken, or
1835
** 0 if iToken has no fallback.
1836
*/
1837
0
int AscendParserFallback(int iToken){
1838
#ifdef YYFALLBACK
1839
  assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) );
1840
  return yyFallback[iToken];
1841
#else
1842
0
  (void)iToken;
1843
0
  return 0;
1844
0
#endif
1845
0
}
1846
#line 146 "/src/wireshark/wiretap/ascend_parser.lemon"
1847
1848
DIAG_ON_LEMON()
1849
#line 440 "/src/wireshark/wiretap/ascend_parser.lemon"
1850
1851
1852
/* Run the parser. */
1853
bool
1854
run_ascend_parser(uint8_t *pd, ascend_state_t *parser_state, int *err, char **err_info)
1855
0
{
1856
0
    yyscan_t scanner = NULL;
1857
0
    void *parser;
1858
1859
0
    if (ascend_lex_init(&scanner) != 0) {
1860
        /* errno is set if this fails */
1861
0
        *err = errno;
1862
0
        *err_info = NULL;
1863
0
        return false;
1864
0
    }
1865
    /* Associate the parser state with the lexical analyzer state */
1866
0
    ascend_set_extra(parser_state, scanner);
1867
0
    parser_state->ascend_parse_error = NULL;
1868
0
    parser_state->err = 0;
1869
0
    parser_state->err_info = NULL;
1870
0
    parser_state->pkt_data = pd;
1871
1872
    /*
1873
    * We haven't seen a time stamp yet.
1874
    */
1875
0
    parser_state->saw_timestamp = false;
1876
0
    parser_state->timestamp = 0;
1877
1878
0
    parser_state->first_hexbyte = 0;
1879
0
    parser_state->caplen = 0;
1880
0
    parser_state->wirelen = 0;
1881
1882
0
    parser_state->secs = 0;
1883
0
    parser_state->usecs = 0;
1884
1885
    /*
1886
    * Not all packets in a "wdd" dump necessarily have a "Cause an
1887
    * attempt to place call to" header (I presume this can happen if
1888
    * there was a call in progress when the packet was sent or
1889
    * received), so we won't necessarily have the phone number for
1890
    * the packet.
1891
    *
1892
    * XXX - we could assume, in the sequential pass, that it's the
1893
    * phone number from the last call, and remember that for use
1894
    * when doing random access.
1895
    */
1896
0
    parser_state->pseudo_header->call_num[0] = '\0';
1897
1898
0
    parser = AscendParserAlloc(g_malloc0);
1899
1900
#ifdef ASCEND_PARSER_DEBUG
1901
    AscendParserTrace(stderr, "=AP ");
1902
#endif
1903
1904
0
    int token_id;
1905
0
    do {
1906
0
        token_id = ascend_lex(scanner);
1907
1908
0
        ascend_debug("Got token %d at %" PRId64, token_id, file_tell(parser_state->fh));
1909
1910
0
        AscendParser(parser, token_id, parser_state->token, parser_state);
1911
0
    } while (token_id && !parser_state->err && !parser_state->ascend_parse_error && parser_state->caplen < ASCEND_MAX_PKT_LEN);
1912
1913
0
    AscendParserFree(parser, g_free);
1914
0
    ascend_lex_destroy(scanner);
1915
1916
0
    if (parser_state->err) {
1917
0
        *err = parser_state->err;
1918
0
        *err_info = parser_state->err_info;
1919
0
        return false;
1920
0
    }
1921
1922
0
    return true;
1923
0
}
1924
1925
#line 1950 "./ascend_parser.c"