"Fossies" - the Fresh Open Source Software Archive 
Member "portfwd-0.29/src/yconf.c" (28 Jan 2004, 45385 Bytes) of package /linux/privat/old/portfwd-0.29.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /* A Bison parser, made by GNU Bison 1.875a. */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
25
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
28
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
35
36 /* Identify Bison output. */
37 #define YYBISON 1
38
39 /* Skeleton name. */
40 #define YYSKELETON_NAME "yacc.c"
41
42 /* Pure parsers. */
43 #define YYPURE 0
44
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
47
48
49
50 /* Tokens. */
51 #ifndef YYTOKENTYPE
52 # define YYTOKENTYPE
53 /* Put the tokens into the symbol table, so that GDB and other debuggers
54 know about them. */
55 enum yytokentype {
56 TK_NAME = 258,
57 TK_TCP = 259,
58 TK_UDP = 260,
59 TK_COLON = 261,
60 TK_SCOLON = 262,
61 TK_COMMA = 263,
62 TK_SLASH = 264,
63 TK_RANGE = 265,
64 TK_LBRACE = 266,
65 TK_RBRACE = 267,
66 TK_ARROW = 268,
67 TK_ACTV = 269,
68 TK_PASV = 270,
69 TK_USER = 271,
70 TK_GROUP = 272,
71 TK_BIND = 273,
72 TK_LISTEN = 274,
73 TK_SOURCE = 275,
74 TK_STRING = 276,
75 TK_FRAGILE = 277,
76 TK_ILLEGAL = 278
77 };
78 #endif
79 #define TK_NAME 258
80 #define TK_TCP 259
81 #define TK_UDP 260
82 #define TK_COLON 261
83 #define TK_SCOLON 262
84 #define TK_COMMA 263
85 #define TK_SLASH 264
86 #define TK_RANGE 265
87 #define TK_LBRACE 266
88 #define TK_RBRACE 267
89 #define TK_ARROW 268
90 #define TK_ACTV 269
91 #define TK_PASV 270
92 #define TK_USER 271
93 #define TK_GROUP 272
94 #define TK_BIND 273
95 #define TK_LISTEN 274
96 #define TK_SOURCE 275
97 #define TK_STRING 276
98 #define TK_FRAGILE 277
99 #define TK_ILLEGAL 278
100
101
102
103
104 /* Copy the first part of user declarations. */
105 #line 7 "conf.y"
106
107
108 #include <stdio.h>
109 #include <stdlib.h>
110 #include <syslog.h>
111
112 #include "util.h"
113 #include "solve.h"
114 #include "port_pair.h"
115 #include "proto_map.hpp"
116 #include "entry.hpp"
117 #include "dst_addr.hpp"
118 #include "director.hpp"
119 #include "portfwd.h"
120
121 /*
122 * These are from the lexical analyzer defined in conf.lex
123 */
124 extern int yylex();
125 extern char yytext[];
126 extern void show_last_token();
127 extern int conf_line_number;
128 extern char conf_ident[];
129 extern char conf_lex_str_buf[];
130
131 /*
132 * Some useful constants
133 */
134 const char *const ANY_ADDR = "0.0.0.0";
135 const int MIN_MASK_LEN = 0;
136 const int MAX_MASK_LEN = 32;
137
138 /*
139 * We store the number of syntax errors here
140 */
141 int conf_syntax_errors = 0;
142
143 void yyerror(const char *msg)
144 {
145 ++conf_syntax_errors;
146 syslog(LOG_ERR, "Syntax error: %s\n", msg);
147 show_last_token();
148 }
149
150 /* Variaveis Auxiliares */
151
152 proto_t curr_proto;
153 vector<from_addr*> *from_vector;
154 vector<to_addr*> *dst_vector;
155 vector<host_map*> *host_vector;
156 vector<int> *port_vector;
157 vector<proto_map*> *map_vector;
158 vector<entry*> *entry_vector = new vector<entry*>();
159
160 int conf_user = -1;
161 int conf_group = -1;
162
163 const struct ip_addr conf_any_addr = solve_hostname(ANY_ADDR);
164 struct ip_addr conf_listen = conf_any_addr;
165 struct ip_addr conf_source = conf_any_addr;
166 struct ip_addr *conf_src = 0;
167
168 /* Funcoes Auxiliares */
169
170 int mask_len_value(const char *len)
171 {
172 return atoi(len);
173 }
174
175 void set_protoname(proto_t proto)
176 {
177 curr_proto = proto;
178 ONVERBOSE(syslog(LOG_DEBUG, "Protocol: %s\n", get_protoname(curr_proto)))
179 }
180
181 int use_port(char *portname)
182 {
183 int port = solve_port(portname, get_protoname(curr_proto));
184 free(portname);
185 return port;
186 }
187
188 struct ip_addr use_hostname(char *hostname)
189 {
190 struct ip_addr ip = solve_hostname(hostname);
191 free(hostname);
192 return ip;
193 }
194
195 net_portion *use_hostprefix(char *hostname, int prefix_len)
196 {
197 return new net_portion(use_hostname(hostname), prefix_len);
198 }
199
200 to_addr *use_dstaddr(char *hostname, int port)
201 {
202 return new dst_addr(on_the_fly_dns ? safe_strdup(hostname) : 0,
203 use_hostname(hostname),
204 port);
205 }
206
207
208
209 /* Enabling traces. */
210 #ifndef YYDEBUG
211 # define YYDEBUG 0
212 #endif
213
214 /* Enabling verbose error messages. */
215 #ifdef YYERROR_VERBOSE
216 # undef YYERROR_VERBOSE
217 # define YYERROR_VERBOSE 1
218 #else
219 # define YYERROR_VERBOSE 0
220 #endif
221
222 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
223 #line 135 "conf.y"
224 typedef union YYSTYPE {
225 int int_type;
226 bool bool_type;
227 char *str_type;
228 port_pair *port_type;
229 net_portion *net_type;
230 from_addr *from_type;
231 vector<from_addr*> *from_list_type;
232 to_addr *dst_type;
233 vector<to_addr*> *dst_list_type;
234 host_map *host_map_type;
235 vector<host_map*> *host_list_type;
236 vector<int> *port_list_type;
237 proto_map *map_type;
238 vector<proto_map*> *map_list_type;
239 entry *entry_type;
240 } YYSTYPE;
241 /* Line 191 of yacc.c. */
242 #line 243 "yconf.c"
243 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
244 # define YYSTYPE_IS_DECLARED 1
245 # define YYSTYPE_IS_TRIVIAL 1
246 #endif
247
248
249
250 /* Copy the second part of user declarations. */
251 #line 170 "conf.y"
252
253 /* Simbolo nao-terminal inicial */
254
255
256 /* Line 214 of yacc.c. */
257 #line 258 "yconf.c"
258
259 #if ! defined (yyoverflow) || YYERROR_VERBOSE
260
261 /* The parser invokes alloca or malloc; define the necessary symbols. */
262
263 # if YYSTACK_USE_ALLOCA
264 # define YYSTACK_ALLOC alloca
265 # else
266 # ifndef YYSTACK_USE_ALLOCA
267 # if defined (alloca) || defined (_ALLOCA_H)
268 # define YYSTACK_ALLOC alloca
269 # else
270 # ifdef __GNUC__
271 # define YYSTACK_ALLOC __builtin_alloca
272 # endif
273 # endif
274 # endif
275 # endif
276
277 # ifdef YYSTACK_ALLOC
278 /* Pacify GCC's `empty if-body' warning. */
279 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
280 # else
281 # if defined (__STDC__) || defined (__cplusplus)
282 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
283 # define YYSIZE_T size_t
284 # endif
285 # define YYSTACK_ALLOC malloc
286 # define YYSTACK_FREE free
287 # endif
288 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
289
290
291 #if (! defined (yyoverflow) \
292 && (! defined (__cplusplus) \
293 || (YYSTYPE_IS_TRIVIAL)))
294
295 /* A type that is properly aligned for any stack member. */
296 union yyalloc
297 {
298 short yyss;
299 YYSTYPE yyvs;
300 };
301
302 /* The size of the maximum gap between one aligned stack and the next. */
303 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
304
305 /* The size of an array large to enough to hold all stacks, each with
306 N elements. */
307 # define YYSTACK_BYTES(N) \
308 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
309 + YYSTACK_GAP_MAXIMUM)
310
311 /* Copy COUNT objects from FROM to TO. The source and destination do
312 not overlap. */
313 # ifndef YYCOPY
314 # if 1 < __GNUC__
315 # define YYCOPY(To, From, Count) \
316 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
317 # else
318 # define YYCOPY(To, From, Count) \
319 do \
320 { \
321 register YYSIZE_T yyi; \
322 for (yyi = 0; yyi < (Count); yyi++) \
323 (To)[yyi] = (From)[yyi]; \
324 } \
325 while (0)
326 # endif
327 # endif
328
329 /* Relocate STACK from its old location to the new one. The
330 local variables YYSIZE and YYSTACKSIZE give the old and new number of
331 elements in the stack, and YYPTR gives the new location of the
332 stack. Advance YYPTR to a properly aligned location for the next
333 stack. */
334 # define YYSTACK_RELOCATE(Stack) \
335 do \
336 { \
337 YYSIZE_T yynewbytes; \
338 YYCOPY (&yyptr->Stack, Stack, yysize); \
339 Stack = &yyptr->Stack; \
340 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
341 yyptr += yynewbytes / sizeof (*yyptr); \
342 } \
343 while (0)
344
345 #endif
346
347 #if defined (__STDC__) || defined (__cplusplus)
348 typedef signed char yysigned_char;
349 #else
350 typedef short yysigned_char;
351 #endif
352
353 /* YYFINAL -- State number of the termination state. */
354 #define YYFINAL 20
355 /* YYLAST -- Last index in YYTABLE. */
356 #define YYLAST 77
357
358 /* YYNTOKENS -- Number of terminals. */
359 #define YYNTOKENS 24
360 /* YYNNTS -- Number of nonterminals. */
361 #define YYNNTS 23
362 /* YYNRULES -- Number of rules. */
363 #define YYNRULES 49
364 /* YYNRULES -- Number of states. */
365 #define YYNSTATES 90
366
367 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
368 #define YYUNDEFTOK 2
369 #define YYMAXUTOK 278
370
371 #define YYTRANSLATE(YYX) \
372 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
373
374 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
375 static const unsigned char yytranslate[] =
376 {
377 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
378 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
403 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
404 15, 16, 17, 18, 19, 20, 21, 22, 23
405 };
406
407 #if YYDEBUG
408 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
409 YYRHS. */
410 static const unsigned char yyprhs[] =
411 {
412 0, 0, 3, 4, 6, 8, 11, 13, 15, 18,
413 21, 24, 27, 30, 35, 39, 40, 42, 43, 44,
414 48, 50, 54, 59, 66, 73, 82, 91, 93, 95,
415 99, 101, 105, 109, 111, 115, 119, 121, 123, 127,
416 128, 130, 133, 137, 140, 141, 144, 146, 149, 152
417 };
418
419 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
420 static const yysigned_char yyrhs[] =
421 {
422 25, 0, -1, -1, 26, -1, 27, -1, 26, 27,
423 -1, 29, -1, 28, -1, 16, 3, -1, 17, 3,
424 -1, 19, 3, -1, 20, 3, -1, 18, 3, -1,
425 30, 4, 31, 33, -1, 5, 32, 33, -1, -1,
426 22, -1, -1, -1, 11, 34, 12, -1, 35, -1,
427 34, 7, 35, -1, 37, 11, 38, 12, -1, 37,
428 14, 36, 11, 38, 12, -1, 37, 15, 36, 11,
429 38, 12, -1, 37, 14, 36, 15, 36, 11, 38,
430 12, -1, 37, 15, 36, 14, 36, 11, 38, 12,
431 -1, 3, -1, 36, -1, 37, 8, 36, -1, 39,
432 -1, 38, 7, 39, -1, 42, 13, 40, -1, 41,
433 -1, 40, 8, 41, -1, 36, 6, 36, -1, 21,
434 -1, 43, -1, 42, 8, 43, -1, -1, 44, -1,
435 6, 46, -1, 44, 6, 46, -1, 36, 45, -1,
436 -1, 9, 3, -1, 36, -1, 36, 10, -1, 10,
437 36, -1, 36, 10, 36, -1
438 };
439
440 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
441 static const unsigned short yyrline[] =
442 {
443 0, 178, 178, 179, 181, 182, 184, 185, 187, 188,
444 189, 190, 194, 196, 197, 199, 200, 202, 203, 205,
445 207, 212, 217, 220, 224, 228, 233, 239, 241, 246,
446 251, 256, 261, 265, 270, 275, 279, 283, 288, 293,
447 296, 299, 302, 306, 311, 312, 314, 318, 322, 326
448 };
449 #endif
450
451 #if YYDEBUG || YYERROR_VERBOSE
452 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
453 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
454 static const char *const yytname[] =
455 {
456 "$end", "error", "$undefined", "TK_NAME", "TK_TCP", "TK_UDP", "TK_COLON",
457 "TK_SCOLON", "TK_COMMA", "TK_SLASH", "TK_RANGE", "TK_LBRACE",
458 "TK_RBRACE", "TK_ARROW", "TK_ACTV", "TK_PASV", "TK_USER", "TK_GROUP",
459 "TK_BIND", "TK_LISTEN", "TK_SOURCE", "TK_STRING", "TK_FRAGILE",
460 "TK_ILLEGAL", "$accept", "conf", "stmt_list", "stmt", "global_option",
461 "entry", "fragile", "set_proto_tcp", "set_proto_udp", "section",
462 "map_list", "map", "name", "port_list", "host_list", "host_map",
463 "dst_list", "dst", "from_list", "from", "host_prefix", "prefix_length",
464 "port_range", 0
465 };
466 #endif
467
468 # ifdef YYPRINT
469 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
470 token YYLEX-NUM. */
471 static const unsigned short yytoknum[] =
472 {
473 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
474 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
475 275, 276, 277, 278
476 };
477 # endif
478
479 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
480 static const unsigned char yyr1[] =
481 {
482 0, 24, 25, 25, 26, 26, 27, 27, 28, 28,
483 28, 28, 28, 29, 29, 30, 30, 31, 32, 33,
484 34, 34, 35, 35, 35, 35, 35, 36, 37, 37,
485 38, 38, 39, 40, 40, 41, 41, 42, 42, 43,
486 43, 43, 43, 44, 45, 45, 46, 46, 46, 46
487 };
488
489 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
490 static const unsigned char yyr2[] =
491 {
492 0, 2, 0, 1, 1, 2, 1, 1, 2, 2,
493 2, 2, 2, 4, 3, 0, 1, 0, 0, 3,
494 1, 3, 4, 6, 6, 8, 8, 1, 1, 3,
495 1, 3, 3, 1, 3, 3, 1, 1, 3, 0,
496 1, 2, 3, 2, 0, 2, 1, 2, 2, 3
497 };
498
499 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
500 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
501 means the default is an error. */
502 static const unsigned char yydefact[] =
503 {
504 2, 18, 0, 0, 0, 0, 0, 16, 0, 3,
505 4, 7, 6, 0, 0, 8, 9, 12, 10, 11,
506 1, 5, 17, 0, 14, 0, 27, 0, 20, 28,
507 0, 13, 0, 19, 0, 39, 0, 0, 21, 29,
508 0, 44, 0, 30, 0, 37, 40, 0, 0, 0,
509 46, 41, 0, 43, 39, 22, 39, 0, 0, 39,
510 0, 39, 0, 48, 47, 45, 31, 38, 36, 0,
511 32, 33, 42, 0, 0, 0, 0, 49, 0, 0,
512 23, 39, 24, 39, 35, 34, 0, 0, 25, 26
513 };
514
515 /* YYDEFGOTO[NTERM-NUM]. */
516 static const yysigned_char yydefgoto[] =
517 {
518 -1, 8, 9, 10, 11, 12, 13, 25, 14, 24,
519 27, 28, 41, 30, 42, 43, 70, 71, 44, 45,
520 46, 53, 51
521 };
522
523 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
524 STATE-NUM. */
525 #define YYPACT_NINF -59
526 static const yysigned_char yypact[] =
527 {
528 2, -59, 26, 27, 39, 55, 56, -59, 4, 2,
529 -59, -59, -59, 57, 49, -59, -59, -59, -59, -59,
530 -59, -59, -59, 59, -59, 49, -59, 20, -59, -59,
531 32, -59, 59, -59, 59, -1, 59, 59, -59, -59,
532 5, 54, 24, -59, 25, -59, 58, 1, 40, 59,
533 60, -59, 62, -59, -1, -59, -1, 7, 5, -1,
534 59, -1, 59, -59, 59, -59, -59, -59, -59, 61,
535 63, -59, -59, 37, 64, 38, 65, -59, 59, 7,
536 -59, -1, -59, -1, -59, -59, 41, 45, -59, -59
537 };
538
539 /* YYPGOTO[NTERM-NUM]. */
540 static const yysigned_char yypgoto[] =
541 {
542 -59, -59, -59, 68, -59, -59, -59, -59, -59, 43,
543 -59, 34, -23, -59, -58, 15, -59, -7, -59, 17,
544 -59, -59, 16
545 };
546
547 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
548 positive, shift that token. If negative, reduce the rule which
549 number is the opposite. If zero, do what YYDEFACT says.
550 If YYTABLE_NINF, syntax error. */
551 #define YYTABLE_NINF -16
552 static const yysigned_char yytable[] =
553 {
554 29, 73, 26, 75, 20, 40, -15, 1, 26, 29,
555 26, 39, 59, 47, 48, 49, 60, 50, 2, 3,
556 4, 5, 6, 86, 7, 87, 63, 32, 68, 15,
557 16, 54, 33, 56, 69, 50, 55, 74, 57, 76,
558 34, 77, 17, 35, 54, 54, 36, 37, 54, 80,
559 82, 61, 54, 88, 62, 84, 69, 89, 18, 19,
560 23, 22, 26, 52, 58, 65, 38, 78, 31, 66,
561 64, 79, 85, 67, 72, 81, 83, 21
562 };
563
564 static const unsigned char yycheck[] =
565 {
566 23, 59, 3, 61, 0, 6, 4, 5, 3, 32,
567 3, 34, 11, 36, 37, 10, 15, 40, 16, 17,
568 18, 19, 20, 81, 22, 83, 49, 7, 21, 3,
569 3, 7, 12, 8, 57, 58, 12, 60, 13, 62,
570 8, 64, 3, 11, 7, 7, 14, 15, 7, 12,
571 12, 11, 7, 12, 14, 78, 79, 12, 3, 3,
572 11, 4, 3, 9, 6, 3, 32, 6, 25, 54,
573 10, 8, 79, 56, 58, 11, 11, 9
574 };
575
576 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
577 symbol of state STATE-NUM. */
578 static const unsigned char yystos[] =
579 {
580 0, 5, 16, 17, 18, 19, 20, 22, 25, 26,
581 27, 28, 29, 30, 32, 3, 3, 3, 3, 3,
582 0, 27, 4, 11, 33, 31, 3, 34, 35, 36,
583 37, 33, 7, 12, 8, 11, 14, 15, 35, 36,
584 6, 36, 38, 39, 42, 43, 44, 36, 36, 10,
585 36, 46, 9, 45, 7, 12, 8, 13, 6, 11,
586 15, 11, 14, 36, 10, 3, 39, 43, 21, 36,
587 40, 41, 46, 38, 36, 38, 36, 36, 6, 8,
588 12, 11, 12, 11, 36, 41, 38, 38, 12, 12
589 };
590
591 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
592 # define YYSIZE_T __SIZE_TYPE__
593 #endif
594 #if ! defined (YYSIZE_T) && defined (size_t)
595 # define YYSIZE_T size_t
596 #endif
597 #if ! defined (YYSIZE_T)
598 # if defined (__STDC__) || defined (__cplusplus)
599 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
600 # define YYSIZE_T size_t
601 # endif
602 #endif
603 #if ! defined (YYSIZE_T)
604 # define YYSIZE_T unsigned int
605 #endif
606
607 #define yyerrok (yyerrstatus = 0)
608 #define yyclearin (yychar = YYEMPTY)
609 #define YYEMPTY (-2)
610 #define YYEOF 0
611
612 #define YYACCEPT goto yyacceptlab
613 #define YYABORT goto yyabortlab
614 #define YYERROR goto yyerrlab1
615
616
617 /* Like YYERROR except do call yyerror. This remains here temporarily
618 to ease the transition to the new meaning of YYERROR, for GCC.
619 Once GCC version 2 has supplanted version 1, this can go. */
620
621 #define YYFAIL goto yyerrlab
622
623 #define YYRECOVERING() (!!yyerrstatus)
624
625 #define YYBACKUP(Token, Value) \
626 do \
627 if (yychar == YYEMPTY && yylen == 1) \
628 { \
629 yychar = (Token); \
630 yylval = (Value); \
631 yytoken = YYTRANSLATE (yychar); \
632 YYPOPSTACK; \
633 goto yybackup; \
634 } \
635 else \
636 { \
637 yyerror ("syntax error: cannot back up");\
638 YYERROR; \
639 } \
640 while (0)
641
642 #define YYTERROR 1
643 #define YYERRCODE 256
644
645 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
646 are run). */
647
648 #ifndef YYLLOC_DEFAULT
649 # define YYLLOC_DEFAULT(Current, Rhs, N) \
650 Current.first_line = Rhs[1].first_line; \
651 Current.first_column = Rhs[1].first_column; \
652 Current.last_line = Rhs[N].last_line; \
653 Current.last_column = Rhs[N].last_column;
654 #endif
655
656 /* YYLEX -- calling `yylex' with the right arguments. */
657
658 #ifdef YYLEX_PARAM
659 # define YYLEX yylex (YYLEX_PARAM)
660 #else
661 # define YYLEX yylex ()
662 #endif
663
664 /* Enable debugging if requested. */
665 #if YYDEBUG
666
667 # ifndef YYFPRINTF
668 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
669 # define YYFPRINTF fprintf
670 # endif
671
672 # define YYDPRINTF(Args) \
673 do { \
674 if (yydebug) \
675 YYFPRINTF Args; \
676 } while (0)
677
678 # define YYDSYMPRINT(Args) \
679 do { \
680 if (yydebug) \
681 yysymprint Args; \
682 } while (0)
683
684 # define YYDSYMPRINTF(Title, Token, Value, Location) \
685 do { \
686 if (yydebug) \
687 { \
688 YYFPRINTF (stderr, "%s ", Title); \
689 yysymprint (stderr, \
690 Token, Value); \
691 YYFPRINTF (stderr, "\n"); \
692 } \
693 } while (0)
694
695 /*------------------------------------------------------------------.
696 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
697 | TOP (cinluded). |
698 `------------------------------------------------------------------*/
699
700 #if defined (__STDC__) || defined (__cplusplus)
701 static void
702 yy_stack_print (short *bottom, short *top)
703 #else
704 static void
705 yy_stack_print (bottom, top)
706 short *bottom;
707 short *top;
708 #endif
709 {
710 YYFPRINTF (stderr, "Stack now");
711 for (/* Nothing. */; bottom <= top; ++bottom)
712 YYFPRINTF (stderr, " %d", *bottom);
713 YYFPRINTF (stderr, "\n");
714 }
715
716 # define YY_STACK_PRINT(Bottom, Top) \
717 do { \
718 if (yydebug) \
719 yy_stack_print ((Bottom), (Top)); \
720 } while (0)
721
722
723 /*------------------------------------------------.
724 | Report that the YYRULE is going to be reduced. |
725 `------------------------------------------------*/
726
727 #if defined (__STDC__) || defined (__cplusplus)
728 static void
729 yy_reduce_print (int yyrule)
730 #else
731 static void
732 yy_reduce_print (yyrule)
733 int yyrule;
734 #endif
735 {
736 int yyi;
737 unsigned int yylineno = yyrline[yyrule];
738 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
739 yyrule - 1, yylineno);
740 /* Print the symbols being reduced, and their result. */
741 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
742 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
743 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
744 }
745
746 # define YY_REDUCE_PRINT(Rule) \
747 do { \
748 if (yydebug) \
749 yy_reduce_print (Rule); \
750 } while (0)
751
752 /* Nonzero means print parse trace. It is left uninitialized so that
753 multiple parsers can coexist. */
754 int yydebug;
755 #else /* !YYDEBUG */
756 # define YYDPRINTF(Args)
757 # define YYDSYMPRINT(Args)
758 # define YYDSYMPRINTF(Title, Token, Value, Location)
759 # define YY_STACK_PRINT(Bottom, Top)
760 # define YY_REDUCE_PRINT(Rule)
761 #endif /* !YYDEBUG */
762
763
764 /* YYINITDEPTH -- initial size of the parser's stacks. */
765 #ifndef YYINITDEPTH
766 # define YYINITDEPTH 200
767 #endif
768
769 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
770 if the built-in stack extension method is used).
771
772 Do not make this value too large; the results are undefined if
773 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
774 evaluated with infinite-precision integer arithmetic. */
775
776 #if YYMAXDEPTH == 0
777 # undef YYMAXDEPTH
778 #endif
779
780 #ifndef YYMAXDEPTH
781 # define YYMAXDEPTH 10000
782 #endif
783
784
785
786 #if YYERROR_VERBOSE
787
788 # ifndef yystrlen
789 # if defined (__GLIBC__) && defined (_STRING_H)
790 # define yystrlen strlen
791 # else
792 /* Return the length of YYSTR. */
793 static YYSIZE_T
794 # if defined (__STDC__) || defined (__cplusplus)
795 yystrlen (const char *yystr)
796 # else
797 yystrlen (yystr)
798 const char *yystr;
799 # endif
800 {
801 register const char *yys = yystr;
802
803 while (*yys++ != '\0')
804 continue;
805
806 return yys - yystr - 1;
807 }
808 # endif
809 # endif
810
811 # ifndef yystpcpy
812 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
813 # define yystpcpy stpcpy
814 # else
815 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
816 YYDEST. */
817 static char *
818 # if defined (__STDC__) || defined (__cplusplus)
819 yystpcpy (char *yydest, const char *yysrc)
820 # else
821 yystpcpy (yydest, yysrc)
822 char *yydest;
823 const char *yysrc;
824 # endif
825 {
826 register char *yyd = yydest;
827 register const char *yys = yysrc;
828
829 while ((*yyd++ = *yys++) != '\0')
830 continue;
831
832 return yyd - 1;
833 }
834 # endif
835 # endif
836
837 #endif /* !YYERROR_VERBOSE */
838
839
840
841 #if YYDEBUG
842 /*--------------------------------.
843 | Print this symbol on YYOUTPUT. |
844 `--------------------------------*/
845
846 #if defined (__STDC__) || defined (__cplusplus)
847 static void
848 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
849 #else
850 static void
851 yysymprint (yyoutput, yytype, yyvaluep)
852 FILE *yyoutput;
853 int yytype;
854 YYSTYPE *yyvaluep;
855 #endif
856 {
857 /* Pacify ``unused variable'' warnings. */
858 (void) yyvaluep;
859
860 if (yytype < YYNTOKENS)
861 {
862 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
863 # ifdef YYPRINT
864 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
865 # endif
866 }
867 else
868 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
869
870 switch (yytype)
871 {
872 default:
873 break;
874 }
875 YYFPRINTF (yyoutput, ")");
876 }
877
878 #endif /* ! YYDEBUG */
879 /*-----------------------------------------------.
880 | Release the memory associated to this symbol. |
881 `-----------------------------------------------*/
882
883 #if defined (__STDC__) || defined (__cplusplus)
884 static void
885 yydestruct (int yytype, YYSTYPE *yyvaluep)
886 #else
887 static void
888 yydestruct (yytype, yyvaluep)
889 int yytype;
890 YYSTYPE *yyvaluep;
891 #endif
892 {
893 /* Pacify ``unused variable'' warnings. */
894 (void) yyvaluep;
895
896 switch (yytype)
897 {
898
899 default:
900 break;
901 }
902 }
903
904
905 /* Prevent warnings from -Wmissing-prototypes. */
906
907 #ifdef YYPARSE_PARAM
908 # if defined (__STDC__) || defined (__cplusplus)
909 int yyparse (void *YYPARSE_PARAM);
910 # else
911 int yyparse ();
912 # endif
913 #else /* ! YYPARSE_PARAM */
914 #if defined (__STDC__) || defined (__cplusplus)
915 int yyparse (void);
916 #else
917 int yyparse ();
918 #endif
919 #endif /* ! YYPARSE_PARAM */
920
921
922
923 /* The lookahead symbol. */
924 int yychar;
925
926 /* The semantic value of the lookahead symbol. */
927 YYSTYPE yylval;
928
929 /* Number of syntax errors so far. */
930 int yynerrs;
931
932
933
934 /*----------.
935 | yyparse. |
936 `----------*/
937
938 #ifdef YYPARSE_PARAM
939 # if defined (__STDC__) || defined (__cplusplus)
940 int yyparse (void *YYPARSE_PARAM)
941 # else
942 int yyparse (YYPARSE_PARAM)
943 void *YYPARSE_PARAM;
944 # endif
945 #else /* ! YYPARSE_PARAM */
946 #if defined (__STDC__) || defined (__cplusplus)
947 int
948 yyparse (void)
949 #else
950 int
951 yyparse ()
952
953 #endif
954 #endif
955 {
956
957 register int yystate;
958 register int yyn;
959 int yyresult;
960 /* Number of tokens to shift before error messages enabled. */
961 int yyerrstatus;
962 /* Lookahead token as an internal (translated) token number. */
963 int yytoken = 0;
964
965 /* Three stacks and their tools:
966 `yyss': related to states,
967 `yyvs': related to semantic values,
968 `yyls': related to locations.
969
970 Refer to the stacks thru separate pointers, to allow yyoverflow
971 to reallocate them elsewhere. */
972
973 /* The state stack. */
974 short yyssa[YYINITDEPTH];
975 short *yyss = yyssa;
976 register short *yyssp;
977
978 /* The semantic value stack. */
979 YYSTYPE yyvsa[YYINITDEPTH];
980 YYSTYPE *yyvs = yyvsa;
981 register YYSTYPE *yyvsp;
982
983
984
985 #define YYPOPSTACK (yyvsp--, yyssp--)
986
987 YYSIZE_T yystacksize = YYINITDEPTH;
988
989 /* The variables used to return semantic value and location from the
990 action routines. */
991 YYSTYPE yyval;
992
993
994 /* When reducing, the number of symbols on the RHS of the reduced
995 rule. */
996 int yylen;
997
998 YYDPRINTF ((stderr, "Starting parse\n"));
999
1000 yystate = 0;
1001 yyerrstatus = 0;
1002 yynerrs = 0;
1003 yychar = YYEMPTY; /* Cause a token to be read. */
1004
1005 /* Initialize stack pointers.
1006 Waste one element of value and location stack
1007 so that they stay on the same level as the state stack.
1008 The wasted elements are never initialized. */
1009
1010 yyssp = yyss;
1011 yyvsp = yyvs;
1012
1013 goto yysetstate;
1014
1015 /*------------------------------------------------------------.
1016 | yynewstate -- Push a new state, which is found in yystate. |
1017 `------------------------------------------------------------*/
1018 yynewstate:
1019 /* In all cases, when you get here, the value and location stacks
1020 have just been pushed. so pushing a state here evens the stacks.
1021 */
1022 yyssp++;
1023
1024 yysetstate:
1025 *yyssp = yystate;
1026
1027 if (yyss + yystacksize - 1 <= yyssp)
1028 {
1029 /* Get the current used size of the three stacks, in elements. */
1030 YYSIZE_T yysize = yyssp - yyss + 1;
1031
1032 #ifdef yyoverflow
1033 {
1034 /* Give user a chance to reallocate the stack. Use copies of
1035 these so that the &'s don't force the real ones into
1036 memory. */
1037 YYSTYPE *yyvs1 = yyvs;
1038 short *yyss1 = yyss;
1039
1040
1041 /* Each stack pointer address is followed by the size of the
1042 data in use in that stack, in bytes. This used to be a
1043 conditional around just the two extra args, but that might
1044 be undefined if yyoverflow is a macro. */
1045 yyoverflow ("parser stack overflow",
1046 &yyss1, yysize * sizeof (*yyssp),
1047 &yyvs1, yysize * sizeof (*yyvsp),
1048
1049 &yystacksize);
1050
1051 yyss = yyss1;
1052 yyvs = yyvs1;
1053 }
1054 #else /* no yyoverflow */
1055 # ifndef YYSTACK_RELOCATE
1056 goto yyoverflowlab;
1057 # else
1058 /* Extend the stack our own way. */
1059 if (YYMAXDEPTH <= yystacksize)
1060 goto yyoverflowlab;
1061 yystacksize *= 2;
1062 if (YYMAXDEPTH < yystacksize)
1063 yystacksize = YYMAXDEPTH;
1064
1065 {
1066 short *yyss1 = yyss;
1067 union yyalloc *yyptr =
1068 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1069 if (! yyptr)
1070 goto yyoverflowlab;
1071 YYSTACK_RELOCATE (yyss);
1072 YYSTACK_RELOCATE (yyvs);
1073
1074 # undef YYSTACK_RELOCATE
1075 if (yyss1 != yyssa)
1076 YYSTACK_FREE (yyss1);
1077 }
1078 # endif
1079 #endif /* no yyoverflow */
1080
1081 yyssp = yyss + yysize - 1;
1082 yyvsp = yyvs + yysize - 1;
1083
1084
1085 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1086 (unsigned long int) yystacksize));
1087
1088 if (yyss + yystacksize - 1 <= yyssp)
1089 YYABORT;
1090 }
1091
1092 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1093
1094 goto yybackup;
1095
1096 /*-----------.
1097 | yybackup. |
1098 `-----------*/
1099 yybackup:
1100
1101 /* Do appropriate processing given the current state. */
1102 /* Read a lookahead token if we need one and don't already have one. */
1103 /* yyresume: */
1104
1105 /* First try to decide what to do without reference to lookahead token. */
1106
1107 yyn = yypact[yystate];
1108 if (yyn == YYPACT_NINF)
1109 goto yydefault;
1110
1111 /* Not known => get a lookahead token if don't already have one. */
1112
1113 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1114 if (yychar == YYEMPTY)
1115 {
1116 YYDPRINTF ((stderr, "Reading a token: "));
1117 yychar = YYLEX;
1118 }
1119
1120 if (yychar <= YYEOF)
1121 {
1122 yychar = yytoken = YYEOF;
1123 YYDPRINTF ((stderr, "Now at end of input.\n"));
1124 }
1125 else
1126 {
1127 yytoken = YYTRANSLATE (yychar);
1128 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1129 }
1130
1131 /* If the proper action on seeing token YYTOKEN is to reduce or to
1132 detect an error, take that action. */
1133 yyn += yytoken;
1134 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1135 goto yydefault;
1136 yyn = yytable[yyn];
1137 if (yyn <= 0)
1138 {
1139 if (yyn == 0 || yyn == YYTABLE_NINF)
1140 goto yyerrlab;
1141 yyn = -yyn;
1142 goto yyreduce;
1143 }
1144
1145 if (yyn == YYFINAL)
1146 YYACCEPT;
1147
1148 /* Shift the lookahead token. */
1149 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1150
1151 /* Discard the token being shifted unless it is eof. */
1152 if (yychar != YYEOF)
1153 yychar = YYEMPTY;
1154
1155 *++yyvsp = yylval;
1156
1157
1158 /* Count tokens shifted since error; after three, turn off error
1159 status. */
1160 if (yyerrstatus)
1161 yyerrstatus--;
1162
1163 yystate = yyn;
1164 goto yynewstate;
1165
1166
1167 /*-----------------------------------------------------------.
1168 | yydefault -- do the default action for the current state. |
1169 `-----------------------------------------------------------*/
1170 yydefault:
1171 yyn = yydefact[yystate];
1172 if (yyn == 0)
1173 goto yyerrlab;
1174 goto yyreduce;
1175
1176
1177 /*-----------------------------.
1178 | yyreduce -- Do a reduction. |
1179 `-----------------------------*/
1180 yyreduce:
1181 /* yyn is the number of a rule to reduce with. */
1182 yylen = yyr2[yyn];
1183
1184 /* If YYLEN is nonzero, implement the default value of the action:
1185 `$$ = $1'.
1186
1187 Otherwise, the following line sets YYVAL to garbage.
1188 This behavior is undocumented and Bison
1189 users should not rely upon it. Assigning to YYVAL
1190 unconditionally makes the parser a bit smaller, and it avoids a
1191 GCC warning that YYVAL may be used uninitialized. */
1192 yyval = yyvsp[1-yylen];
1193
1194
1195 YY_REDUCE_PRINT (yyn);
1196 switch (yyn)
1197 {
1198 case 6:
1199 #line 184 "conf.y"
1200 { entry_vector-> push(yyvsp[0].entry_type); }
1201 break;
1202
1203 case 8:
1204 #line 187 "conf.y"
1205 { conf_user = solve_user(conf_ident); }
1206 break;
1207
1208 case 9:
1209 #line 188 "conf.y"
1210 { conf_group = solve_group(conf_ident); }
1211 break;
1212
1213 case 10:
1214 #line 189 "conf.y"
1215 { conf_listen = solve_hostname(conf_ident); }
1216 break;
1217
1218 case 11:
1219 #line 190 "conf.y"
1220 {
1221 conf_source = solve_hostname(conf_ident);
1222 conf_src = &conf_source;
1223 }
1224 break;
1225
1226 case 12:
1227 #line 194 "conf.y"
1228 { conf_listen = solve_hostname(conf_ident); }
1229 break;
1230
1231 case 13:
1232 #line 196 "conf.y"
1233 { yyval.entry_type = new entry(P_TCP, yyvsp[0].map_list_type, yyvsp[-3].bool_type); }
1234 break;
1235
1236 case 14:
1237 #line 197 "conf.y"
1238 { yyval.entry_type = new entry(P_UDP, yyvsp[0].map_list_type, 0 /* false */); }
1239 break;
1240
1241 case 15:
1242 #line 199 "conf.y"
1243 { yyval.bool_type = 0; /* false */ }
1244 break;
1245
1246 case 16:
1247 #line 200 "conf.y"
1248 { yyval.bool_type = 1; /* true */ }
1249 break;
1250
1251 case 17:
1252 #line 202 "conf.y"
1253 { set_protoname(P_TCP); }
1254 break;
1255
1256 case 18:
1257 #line 203 "conf.y"
1258 { set_protoname(P_UDP); }
1259 break;
1260
1261 case 19:
1262 #line 205 "conf.y"
1263 { yyval.map_list_type = yyvsp[-1].map_list_type; }
1264 break;
1265
1266 case 20:
1267 #line 207 "conf.y"
1268 {
1269 map_vector = new vector<proto_map*>();
1270 map_vector->push(yyvsp[0].map_type);
1271 yyval.map_list_type = map_vector;
1272 }
1273 break;
1274
1275 case 21:
1276 #line 212 "conf.y"
1277 {
1278 map_vector->push(yyvsp[0].map_type);
1279 yyval.map_list_type = map_vector;
1280 }
1281 break;
1282
1283 case 22:
1284 #line 217 "conf.y"
1285 {
1286 yyval.map_type = new proto_map(yyvsp[-3].port_list_type, yyvsp[-1].host_list_type, 0, 0, conf_user, conf_group, conf_listen, conf_src);
1287 }
1288 break;
1289
1290 case 23:
1291 #line 220 "conf.y"
1292 {
1293 struct ip_addr ip = use_hostname(yyvsp[-3].str_type);
1294 yyval.map_type = new proto_map(yyvsp[-5].port_list_type, yyvsp[-1].host_list_type, &ip, 0, conf_user, conf_group, conf_listen, conf_src);
1295 }
1296 break;
1297
1298 case 24:
1299 #line 224 "conf.y"
1300 {
1301 struct ip_addr ip = use_hostname(yyvsp[-3].str_type);
1302 yyval.map_type = new proto_map(yyvsp[-5].port_list_type, yyvsp[-1].host_list_type, 0, &ip, conf_user, conf_group, conf_listen, conf_src);
1303 }
1304 break;
1305
1306 case 25:
1307 #line 228 "conf.y"
1308 {
1309 struct ip_addr ip1 = use_hostname(yyvsp[-5].str_type);
1310 struct ip_addr ip2 = use_hostname(yyvsp[-3].str_type);
1311 yyval.map_type = new proto_map(yyvsp[-7].port_list_type, yyvsp[-1].host_list_type, &ip1, &ip2, conf_user, conf_group, conf_listen, conf_src);
1312 }
1313 break;
1314
1315 case 26:
1316 #line 233 "conf.y"
1317 {
1318 struct ip_addr ip1 = use_hostname(yyvsp[-5].str_type);
1319 struct ip_addr ip2 = use_hostname(yyvsp[-3].str_type);
1320 yyval.map_type = new proto_map(yyvsp[-7].port_list_type, yyvsp[-1].host_list_type, &ip2, &ip1, conf_user, conf_group, conf_listen, conf_src);
1321 }
1322 break;
1323
1324 case 27:
1325 #line 239 "conf.y"
1326 { yyval.str_type = safe_strdup(conf_ident); }
1327 break;
1328
1329 case 28:
1330 #line 241 "conf.y"
1331 {
1332 port_vector = new vector<int>();
1333 port_vector->push(use_port(yyvsp[0].str_type));
1334 yyval.port_list_type = port_vector;
1335 }
1336 break;
1337
1338 case 29:
1339 #line 246 "conf.y"
1340 {
1341 port_vector->push(use_port(yyvsp[0].str_type));
1342 yyval.port_list_type = port_vector;
1343 }
1344 break;
1345
1346 case 30:
1347 #line 251 "conf.y"
1348 {
1349 host_vector = new vector<host_map*>();
1350 host_vector->push(yyvsp[0].host_map_type);
1351 yyval.host_list_type = host_vector;
1352 }
1353 break;
1354
1355 case 31:
1356 #line 256 "conf.y"
1357 {
1358 host_vector->push(yyvsp[0].host_map_type);
1359 yyval.host_list_type = host_vector;
1360 }
1361 break;
1362
1363 case 32:
1364 #line 261 "conf.y"
1365 {
1366 yyval.host_map_type = new host_map(yyvsp[-2].from_list_type, yyvsp[0].dst_list_type);
1367 }
1368 break;
1369
1370 case 33:
1371 #line 265 "conf.y"
1372 {
1373 dst_vector = new vector<to_addr*>();
1374 dst_vector->push(yyvsp[0].dst_type);
1375 yyval.dst_list_type = dst_vector;
1376 }
1377 break;
1378
1379 case 34:
1380 #line 270 "conf.y"
1381 {
1382 dst_vector->push(yyvsp[0].dst_type);
1383 yyval.dst_list_type = dst_vector;
1384 }
1385 break;
1386
1387 case 35:
1388 #line 275 "conf.y"
1389 {
1390 int port = use_port(yyvsp[0].str_type); /* solve portname */
1391 yyval.dst_type = use_dstaddr(yyvsp[-2].str_type, port); /* new dst_addr() */
1392 }
1393 break;
1394
1395 case 36:
1396 #line 279 "conf.y"
1397 {
1398 yyval.dst_type = new director(conf_lex_str_buf);
1399 }
1400 break;
1401
1402 case 37:
1403 #line 283 "conf.y"
1404 {
1405 from_vector = new vector<from_addr*>();
1406 from_vector->push(yyvsp[0].from_type);
1407 yyval.from_list_type = from_vector;
1408 }
1409 break;
1410
1411 case 38:
1412 #line 288 "conf.y"
1413 {
1414 from_vector->push(yyvsp[0].from_type);
1415 yyval.from_list_type = from_vector;
1416 }
1417 break;
1418
1419 case 39:
1420 #line 293 "conf.y"
1421 {
1422 yyval.from_type = new from_addr(new net_portion(solve_hostname(ANY_ADDR), MIN_MASK_LEN), new port_pair(FIRST_PORT, LAST_PORT));
1423 }
1424 break;
1425
1426 case 40:
1427 #line 296 "conf.y"
1428 {
1429 yyval.from_type = new from_addr(yyvsp[0].net_type, new port_pair(FIRST_PORT, LAST_PORT));
1430 }
1431 break;
1432
1433 case 41:
1434 #line 299 "conf.y"
1435 {
1436 yyval.from_type = new from_addr(new net_portion(solve_hostname(ANY_ADDR), MIN_MASK_LEN), yyvsp[0].port_type);
1437 }
1438 break;
1439
1440 case 42:
1441 #line 302 "conf.y"
1442 {
1443 yyval.from_type = new from_addr(yyvsp[-2].net_type, yyvsp[0].port_type);
1444 }
1445 break;
1446
1447 case 43:
1448 #line 306 "conf.y"
1449 {
1450 /* use_hostprefix(): new net_portion() */
1451 yyval.net_type = use_hostprefix(yyvsp[-1].str_type, yyvsp[0].int_type);
1452 }
1453 break;
1454
1455 case 44:
1456 #line 311 "conf.y"
1457 { yyval.int_type = MAX_MASK_LEN; }
1458 break;
1459
1460 case 45:
1461 #line 312 "conf.y"
1462 { yyval.int_type = mask_len_value(conf_ident); }
1463 break;
1464
1465 case 46:
1466 #line 314 "conf.y"
1467 {
1468 int port = use_port(yyvsp[0].str_type);
1469 yyval.port_type = new port_pair(port, port);
1470 }
1471 break;
1472
1473 case 47:
1474 #line 318 "conf.y"
1475 {
1476 yyval.port_type = new port_pair(use_port(yyvsp[-1].str_type),
1477 LAST_PORT);
1478 }
1479 break;
1480
1481 case 48:
1482 #line 322 "conf.y"
1483 {
1484 yyval.port_type = new port_pair(FIRST_PORT,
1485 use_port(yyvsp[0].str_type));
1486 }
1487 break;
1488
1489 case 49:
1490 #line 326 "conf.y"
1491 {
1492 yyval.port_type = new port_pair(use_port(yyvsp[-2].str_type),
1493 use_port(yyvsp[0].str_type));
1494 }
1495 break;
1496
1497
1498 }
1499
1500 /* Line 999 of yacc.c. */
1501 #line 1502 "yconf.c"
1502
1503 yyvsp -= yylen;
1504 yyssp -= yylen;
1505
1506
1507 YY_STACK_PRINT (yyss, yyssp);
1508
1509 *++yyvsp = yyval;
1510
1511
1512 /* Now `shift' the result of the reduction. Determine what state
1513 that goes to, based on the state we popped back to and the rule
1514 number reduced by. */
1515
1516 yyn = yyr1[yyn];
1517
1518 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1519 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1520 yystate = yytable[yystate];
1521 else
1522 yystate = yydefgoto[yyn - YYNTOKENS];
1523
1524 goto yynewstate;
1525
1526
1527 /*------------------------------------.
1528 | yyerrlab -- here on detecting error |
1529 `------------------------------------*/
1530 yyerrlab:
1531 /* If not already recovering from an error, report this error. */
1532 if (!yyerrstatus)
1533 {
1534 ++yynerrs;
1535 #if YYERROR_VERBOSE
1536 yyn = yypact[yystate];
1537
1538 if (YYPACT_NINF < yyn && yyn < YYLAST)
1539 {
1540 YYSIZE_T yysize = 0;
1541 int yytype = YYTRANSLATE (yychar);
1542 char *yymsg;
1543 int yyx, yycount;
1544
1545 yycount = 0;
1546 /* Start YYX at -YYN if negative to avoid negative indexes in
1547 YYCHECK. */
1548 for (yyx = yyn < 0 ? -yyn : 0;
1549 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1550 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1551 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1552 yysize += yystrlen ("syntax error, unexpected ") + 1;
1553 yysize += yystrlen (yytname[yytype]);
1554 yymsg = (char *) YYSTACK_ALLOC (yysize);
1555 if (yymsg != 0)
1556 {
1557 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1558 yyp = yystpcpy (yyp, yytname[yytype]);
1559
1560 if (yycount < 5)
1561 {
1562 yycount = 0;
1563 for (yyx = yyn < 0 ? -yyn : 0;
1564 yyx < (int) (sizeof (yytname) / sizeof (char *));
1565 yyx++)
1566 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1567 {
1568 const char *yyq = ! yycount ? ", expecting " : " or ";
1569 yyp = yystpcpy (yyp, yyq);
1570 yyp = yystpcpy (yyp, yytname[yyx]);
1571 yycount++;
1572 }
1573 }
1574 yyerror (yymsg);
1575 YYSTACK_FREE (yymsg);
1576 }
1577 else
1578 yyerror ("syntax error; also virtual memory exhausted");
1579 }
1580 else
1581 #endif /* YYERROR_VERBOSE */
1582 yyerror ("syntax error");
1583 }
1584
1585
1586
1587 if (yyerrstatus == 3)
1588 {
1589 /* If just tried and failed to reuse lookahead token after an
1590 error, discard it. */
1591
1592 /* Return failure if at end of input. */
1593 if (yychar == YYEOF)
1594 {
1595 /* Pop the error token. */
1596 YYPOPSTACK;
1597 /* Pop the rest of the stack. */
1598 while (yyss < yyssp)
1599 {
1600 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1601 yydestruct (yystos[*yyssp], yyvsp);
1602 YYPOPSTACK;
1603 }
1604 YYABORT;
1605 }
1606
1607 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1608 yydestruct (yytoken, &yylval);
1609 yychar = YYEMPTY;
1610
1611 }
1612
1613 /* Else will try to reuse lookahead token after shifting the error
1614 token. */
1615 goto yyerrlab1;
1616
1617
1618 /*----------------------------------------------------.
1619 | yyerrlab1 -- error raised explicitly by an action. |
1620 `----------------------------------------------------*/
1621 yyerrlab1:
1622 yyerrstatus = 3; /* Each real token shifted decrements this. */
1623
1624 for (;;)
1625 {
1626 yyn = yypact[yystate];
1627 if (yyn != YYPACT_NINF)
1628 {
1629 yyn += YYTERROR;
1630 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1631 {
1632 yyn = yytable[yyn];
1633 if (0 < yyn)
1634 break;
1635 }
1636 }
1637
1638 /* Pop the current state because it cannot handle the error token. */
1639 if (yyssp == yyss)
1640 YYABORT;
1641
1642 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1643 yydestruct (yystos[yystate], yyvsp);
1644 yyvsp--;
1645 yystate = *--yyssp;
1646
1647 YY_STACK_PRINT (yyss, yyssp);
1648 }
1649
1650 if (yyn == YYFINAL)
1651 YYACCEPT;
1652
1653 YYDPRINTF ((stderr, "Shifting error token, "));
1654
1655 *++yyvsp = yylval;
1656
1657
1658 yystate = yyn;
1659 goto yynewstate;
1660
1661
1662 /*-------------------------------------.
1663 | yyacceptlab -- YYACCEPT comes here. |
1664 `-------------------------------------*/
1665 yyacceptlab:
1666 yyresult = 0;
1667 goto yyreturn;
1668
1669 /*-----------------------------------.
1670 | yyabortlab -- YYABORT comes here. |
1671 `-----------------------------------*/
1672 yyabortlab:
1673 yyresult = 1;
1674 goto yyreturn;
1675
1676 #ifndef yyoverflow
1677 /*----------------------------------------------.
1678 | yyoverflowlab -- parser overflow comes here. |
1679 `----------------------------------------------*/
1680 yyoverflowlab:
1681 yyerror ("parser stack overflow");
1682 yyresult = 2;
1683 /* Fall through. */
1684 #endif
1685
1686 yyreturn:
1687 #ifndef yyoverflow
1688 if (yyss != yyssa)
1689 YYSTACK_FREE (yyss);
1690 #endif
1691 return yyresult;
1692 }
1693
1694
1695 #line 332 "conf.y"
1696
1697
1698 /* C code */
1699
1700 /* eof: conf.y */
1701
1702