1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse libsdp_yyparse
63 #define yylex libsdp_yylex
64 #define yyerror libsdp_yyerror
65 #define yylval libsdp_yylval
66 #define yychar libsdp_yychar
67 #define yydebug libsdp_yydebug
68 #define yynerrs libsdp_yynerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
114 /* Copy the first part of user declarations. */
115 #line 39 "./config_parser.y"
123 #include <sys/socket.h>
124 #include <netinet/in.h>
125 #include <arpa/inet.h>
127 #define YYERROR_VERBOSE 1
129 extern int yyerror(char *msg);
130 extern int yylex(void);
131 static int parse_err = 0;
133 struct use_family_rule *__sdp_clients_family_rules_head = NULL;
134 struct use_family_rule *__sdp_clients_family_rules_tail = NULL;
135 struct use_family_rule *__sdp_servers_family_rules_head = NULL;
136 struct use_family_rule *__sdp_servers_family_rules_tail = NULL;
138 /* some globals to store intermidiate parser state */
139 static struct use_family_rule __sdp_rule;
140 static int current_role = 0;
142 int __sdp_config_empty(
146 return ( (__sdp_clients_family_rules_head == NULL) &&
147 (__sdp_servers_family_rules_head == NULL) );
150 /* define the address by 4 integers */
151 static void __sdp_set_ipv4_addr(short a0, short a1, short a2, short a3)
154 sprintf(buf,"%d.%d.%d.%d", a0, a1, a2, a3);
155 if (!inet_aton(buf, &( __sdp_rule.ipv4 )))
158 yyerror("provided address is not legal");
162 static void __sdp_set_prog_name_expr(char *prog_name_expr)
164 __sdp_rule.prog_name_expr = strdup(prog_name_expr);
165 if (!__sdp_rule.prog_name_expr) {
166 yyerror("fail to allocate program name expression");
170 static char *__sdp_get_role_str(int role)
172 if (role == 1) return("server");
173 if (role == 2) return("client");
174 return("unknown role");
177 extern int __sdp_min_level;
179 /* dump the current state in readable format */
180 static void __sdp_dump_config_state() {
182 sprintf(buf, "CONFIG: use %s %s %s",
183 __sdp_get_family_str(__sdp_rule.target_family),
184 __sdp_get_role_str( current_role ),
185 __sdp_rule.prog_name_expr);
186 if (__sdp_rule.match_by_addr) {
187 if ( __sdp_rule.prefixlen != 32 )
188 sprintf(buf+strlen(buf), " %s/%d",
189 inet_ntoa( __sdp_rule.ipv4 ), __sdp_rule.prefixlen);
191 sprintf(buf+strlen(buf), " %s", inet_ntoa( __sdp_rule.ipv4 ));
193 sprintf(buf+strlen(buf), " *");
195 if (__sdp_rule.match_by_port) {
196 sprintf(buf+strlen(buf), ":%d",__sdp_rule.sport);
197 if (__sdp_rule.eport > __sdp_rule.sport)
198 sprintf(buf+strlen(buf), "-%d",__sdp_rule.eport);
201 sprintf(buf+strlen(buf), ":*");
202 sprintf(buf+strlen(buf), "\n");
206 /* use the above state for making a new rule */
207 static void __sdp_add_rule() {
208 struct use_family_rule **p_tail, **p_head, *rule;
210 if (__sdp_min_level <= 1) __sdp_dump_config_state();
211 if ( current_role == 1 ) {
212 p_tail = &__sdp_servers_family_rules_tail;
213 p_head = &__sdp_servers_family_rules_head;
214 } else if ( current_role == 2 ) {
215 p_tail = &__sdp_clients_family_rules_tail;
216 p_head = &__sdp_clients_family_rules_head;
218 yyerror("ignoring unknown role");
223 rule = (struct use_family_rule *)malloc(sizeof(*rule));
225 yyerror("fail to allocate new rule");
230 memset(rule, 0, sizeof(*rule));
232 rule->prev = *p_tail;
236 (*p_tail)->next = rule;
243 /* Enabling traces. */
248 /* Enabling verbose error messages. */
249 #ifdef YYERROR_VERBOSE
250 # undef YYERROR_VERBOSE
251 # define YYERROR_VERBOSE 1
253 # define YYERROR_VERBOSE 1
256 /* Enabling the token table. */
257 #ifndef YYTOKEN_TABLE
258 # define YYTOKEN_TABLE 0
261 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
262 typedef union YYSTYPE
263 #line 167 "./config_parser.y"
268 /* Line 193 of yacc.c. */
271 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
272 # define YYSTYPE_IS_DECLARED 1
273 # define YYSTYPE_IS_TRIVIAL 1
278 /* Copy the second part of user declarations. */
279 #line 192 "./config_parser.y"
281 long __sdp_config_line_num;
284 /* Line 216 of yacc.c. */
292 typedef YYTYPE_UINT8 yytype_uint8;
294 typedef unsigned char yytype_uint8;
298 typedef YYTYPE_INT8 yytype_int8;
299 #elif (defined __STDC__ || defined __C99__FUNC__ \
300 || defined __cplusplus || defined _MSC_VER)
301 typedef signed char yytype_int8;
303 typedef short int yytype_int8;
307 typedef YYTYPE_UINT16 yytype_uint16;
309 typedef unsigned short int yytype_uint16;
313 typedef YYTYPE_INT16 yytype_int16;
315 typedef short int yytype_int16;
319 # ifdef __SIZE_TYPE__
320 # define YYSIZE_T __SIZE_TYPE__
321 # elif defined size_t
322 # define YYSIZE_T size_t
323 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
324 || defined __cplusplus || defined _MSC_VER)
325 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
326 # define YYSIZE_T size_t
328 # define YYSIZE_T unsigned int
332 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
337 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
338 # define YY_(msgid) dgettext ("bison-runtime", msgid)
342 # define YY_(msgid) msgid
346 /* Suppress unused-variable warnings by "using" E. */
347 #if ! defined lint || defined __GNUC__
348 # define YYUSE(e) ((void) (e))
350 # define YYUSE(e) /* empty */
353 /* Identity function, used to suppress warnings about constant conditions. */
357 #if (defined __STDC__ || defined __C99__FUNC__ \
358 || defined __cplusplus || defined _MSC_VER)
371 #if ! defined yyoverflow || YYERROR_VERBOSE
373 /* The parser invokes alloca or malloc; define the necessary symbols. */
375 # ifdef YYSTACK_USE_ALLOCA
376 # if YYSTACK_USE_ALLOCA
378 # define YYSTACK_ALLOC __builtin_alloca
379 # elif defined __BUILTIN_VA_ARG_INCR
380 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
382 # define YYSTACK_ALLOC __alloca
383 # elif defined _MSC_VER
384 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
385 # define alloca _alloca
387 # define YYSTACK_ALLOC alloca
388 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
389 || defined __cplusplus || defined _MSC_VER)
390 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
399 # ifdef YYSTACK_ALLOC
400 /* Pacify GCC's `empty if-body' warning. */
401 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
402 # ifndef YYSTACK_ALLOC_MAXIMUM
403 /* The OS might guarantee only one guard page at the bottom of the stack,
404 and a page size can be as small as 4096 bytes. So we cannot safely
405 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
406 to allow for a few compiler-allocated temporary stack slots. */
407 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
410 # define YYSTACK_ALLOC YYMALLOC
411 # define YYSTACK_FREE YYFREE
412 # ifndef YYSTACK_ALLOC_MAXIMUM
413 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
415 # if (defined __cplusplus && ! defined _STDLIB_H \
416 && ! ((defined YYMALLOC || defined malloc) \
417 && (defined YYFREE || defined free)))
418 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
424 # define YYMALLOC malloc
425 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
426 || defined __cplusplus || defined _MSC_VER)
427 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
432 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
433 || defined __cplusplus || defined _MSC_VER)
434 void free (void *); /* INFRINGES ON USER NAME SPACE */
438 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
441 #if (! defined yyoverflow \
442 && (! defined __cplusplus \
443 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
445 /* A type that is properly aligned for any stack member. */
452 /* The size of the maximum gap between one aligned stack and the next. */
453 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
455 /* The size of an array large to enough to hold all stacks, each with
457 # define YYSTACK_BYTES(N) \
458 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
459 + YYSTACK_GAP_MAXIMUM)
461 /* Copy COUNT objects from FROM to TO. The source and destination do
464 # if defined __GNUC__ && 1 < __GNUC__
465 # define YYCOPY(To, From, Count) \
466 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
468 # define YYCOPY(To, From, Count) \
472 for (yyi = 0; yyi < (Count); yyi++) \
473 (To)[yyi] = (From)[yyi]; \
479 /* Relocate STACK from its old location to the new one. The
480 local variables YYSIZE and YYSTACKSIZE give the old and new number of
481 elements in the stack, and YYPTR gives the new location of the
482 stack. Advance YYPTR to a properly aligned location for the next
484 # define YYSTACK_RELOCATE(Stack) \
487 YYSIZE_T yynewbytes; \
488 YYCOPY (&yyptr->Stack, Stack, yysize); \
489 Stack = &yyptr->Stack; \
490 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
491 yyptr += yynewbytes / sizeof (*yyptr); \
497 /* YYFINAL -- State number of the termination state. */
499 /* YYLAST -- Last index in YYTABLE. */
502 /* YYNTOKENS -- Number of terminals. */
504 /* YYNNTS -- Number of nonterminals. */
506 /* YYNRULES -- Number of rules. */
508 /* YYNRULES -- Number of states. */
511 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
513 #define YYMAXUTOK 272
515 #define YYTRANSLATE(YYX) \
516 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
518 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
519 static const yytype_uint8 yytranslate[] =
521 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 19, 2, 2, 22, 21, 20, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 18, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
547 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
552 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
554 static const yytype_uint8 yyprhs[] =
556 0, 0, 3, 5, 8, 9, 11, 14, 15, 18,
557 20, 22, 26, 27, 30, 33, 36, 39, 43, 46,
558 55, 57, 59, 61, 63, 65, 67, 69, 71, 75,
562 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
563 static const yytype_int8 yyrhs[] =
565 26, 0, -1, 17, -1, 24, 17, -1, -1, 24,
566 -1, 25, 27, -1, -1, 27, 28, -1, 29, -1,
567 33, -1, 10, 30, 24, -1, -1, 30, 31, -1,
568 30, 32, -1, 11, 12, -1, 11, 13, -1, 11,
569 14, 15, -1, 16, 9, -1, 3, 34, 35, 36,
570 37, 18, 39, 24, -1, 6, -1, 7, -1, 8,
571 -1, 5, -1, 4, -1, 15, -1, 19, -1, 38,
572 -1, 38, 20, 9, -1, 19, -1, 9, 21, 9,
573 21, 9, 21, 9, -1, 9, -1, 9, 22, 9,
577 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
578 static const yytype_uint16 yyrline[] =
580 0, 198, 198, 199, 201, 202, 205, 208, 209, 213,
581 214, 218, 221, 222, 223, 227, 228, 229, 233, 237,
582 241, 242, 243, 247, 248, 252, 253, 257, 258, 259,
587 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
588 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
589 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
590 static const char *const yytname[] =
592 "$end", "error", "$undefined", "\"use\"", "\"client or connect\"",
593 "\"server or listen\"", "\"tcp\"", "\"sdp\"", "\"both\"",
594 "\"integer value\"", "\"log statement\"", "\"destination\"",
595 "\"stderr\"", "\"syslog\"", "\"file\"", "\"a name\"", "\"min-level\"",
596 "\"new line\"", "':'", "'*'", "'/'", "'.'", "'-'", "$accept", "NL",
597 "ONL", "config", "statements", "statement", "log_statement", "log_opts",
598 "log_dest", "verbosity", "socket_statement", "family", "role", "program",
599 "address", "ipv4", "ports", 0
604 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
606 static const yytype_uint16 yytoknum[] =
608 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
609 265, 266, 267, 268, 269, 270, 271, 272, 58, 42,
614 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
615 static const yytype_uint8 yyr1[] =
617 0, 23, 24, 24, 25, 25, 26, 27, 27, 28,
618 28, 29, 30, 30, 30, 31, 31, 31, 32, 33,
619 34, 34, 34, 35, 35, 36, 36, 37, 37, 37,
623 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
624 static const yytype_uint8 yyr2[] =
626 0, 2, 1, 2, 0, 1, 2, 0, 2, 1,
627 1, 3, 0, 2, 2, 2, 2, 3, 2, 8,
628 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
632 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
633 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
634 means the default is an error. */
635 static const yytype_uint8 yydefact[] =
637 4, 2, 5, 7, 0, 3, 6, 1, 0, 12,
638 8, 9, 10, 20, 21, 22, 0, 0, 24, 23,
639 0, 0, 0, 11, 13, 14, 25, 26, 0, 15,
640 16, 0, 18, 0, 29, 0, 27, 17, 0, 0,
641 0, 0, 31, 33, 0, 28, 0, 0, 19, 0,
645 /* YYDEFGOTO[NTERM-NUM]. */
646 static const yytype_int8 yydefgoto[] =
648 -1, 2, 3, 4, 6, 10, 11, 17, 24, 25,
649 12, 16, 20, 28, 35, 36, 44
652 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
654 #define YYPACT_NINF -18
655 static const yytype_int8 yypact[] =
657 -13, -18, 4, -18, 22, -18, 0, -18, 9, -18,
658 -18, -18, -18, -18, -18, -18, 2, -3, -18, -18,
659 -10, 6, 14, 4, -18, -18, -18, -18, -8, -18,
660 -18, 10, -18, 3, -18, 8, 11, -18, 19, -7,
661 20, 12, 13, -18, -13, -18, 21, 23, 4, 15,
665 /* YYPGOTO[NTERM-NUM]. */
666 static const yytype_int8 yypgoto[] =
668 -18, -17, -18, -18, -18, -18, -18, -18, -18, -18,
669 -18, -18, -18, -18, -18, -18, -18
672 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
673 positive, shift that token. If negative, reduce the rule which
674 number is the opposite. If zero, do what YYDEFACT says.
675 If YYTABLE_NINF, syntax error. */
676 #define YYTABLE_NINF -1
677 static const yytype_uint8 yytable[] =
679 23, 33, 42, 8, 1, 26, 18, 19, 21, 27,
680 9, 34, 43, 22, 1, 13, 14, 15, 29, 30,
681 31, 5, 7, 32, 38, 37, 39, 48, 41, 45,
682 49, 40, 50, 46, 52, 47, 51
685 static const yytype_uint8 yycheck[] =
687 17, 9, 9, 3, 17, 15, 4, 5, 11, 19,
688 10, 19, 19, 16, 17, 6, 7, 8, 12, 13,
689 14, 17, 0, 9, 21, 15, 18, 44, 9, 9,
690 9, 20, 9, 21, 9, 22, 21
693 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
694 symbol of state STATE-NUM. */
695 static const yytype_uint8 yystos[] =
697 0, 17, 24, 25, 26, 17, 27, 0, 3, 10,
698 28, 29, 33, 6, 7, 8, 34, 30, 4, 5,
699 35, 11, 16, 24, 31, 32, 15, 19, 36, 12,
700 13, 14, 9, 9, 19, 37, 38, 15, 21, 18,
701 20, 9, 9, 19, 39, 9, 21, 22, 24, 9,
705 #define yyerrok (yyerrstatus = 0)
706 #define yyclearin (yychar = YYEMPTY)
710 #define YYACCEPT goto yyacceptlab
711 #define YYABORT goto yyabortlab
712 #define YYERROR goto yyerrorlab
715 /* Like YYERROR except do call yyerror. This remains here temporarily
716 to ease the transition to the new meaning of YYERROR, for GCC.
717 Once GCC version 2 has supplanted version 1, this can go. */
719 #define YYFAIL goto yyerrlab
721 #define YYRECOVERING() (!!yyerrstatus)
723 #define YYBACKUP(Token, Value) \
725 if (yychar == YYEMPTY && yylen == 1) \
729 yytoken = YYTRANSLATE (yychar); \
735 yyerror (YY_("syntax error: cannot back up")); \
742 #define YYERRCODE 256
745 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
746 If N is 0, then set CURRENT to the empty location which ends
747 the previous symbol: RHS[0] (always defined). */
749 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
750 #ifndef YYLLOC_DEFAULT
751 # define YYLLOC_DEFAULT(Current, Rhs, N) \
755 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
756 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
757 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
758 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
762 (Current).first_line = (Current).last_line = \
763 YYRHSLOC (Rhs, 0).last_line; \
764 (Current).first_column = (Current).last_column = \
765 YYRHSLOC (Rhs, 0).last_column; \
771 /* YY_LOCATION_PRINT -- Print the location on the stream.
772 This macro was not mandated originally: define only if we know
773 we won't break user code: when these are the locations we know. */
775 #ifndef YY_LOCATION_PRINT
776 # if YYLTYPE_IS_TRIVIAL
777 # define YY_LOCATION_PRINT(File, Loc) \
778 fprintf (File, "%d.%d-%d.%d", \
779 (Loc).first_line, (Loc).first_column, \
780 (Loc).last_line, (Loc).last_column)
782 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
787 /* YYLEX -- calling `yylex' with the right arguments. */
790 # define YYLEX yylex (YYLEX_PARAM)
792 # define YYLEX yylex ()
795 /* Enable debugging if requested. */
799 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
800 # define YYFPRINTF fprintf
803 # define YYDPRINTF(Args) \
809 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
813 YYFPRINTF (stderr, "%s ", Title); \
814 yy_symbol_print (stderr, \
816 YYFPRINTF (stderr, "\n"); \
821 /*--------------------------------.
822 | Print this symbol on YYOUTPUT. |
823 `--------------------------------*/
826 #if (defined __STDC__ || defined __C99__FUNC__ \
827 || defined __cplusplus || defined _MSC_VER)
829 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
832 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
835 YYSTYPE const * const yyvaluep;
841 if (yytype < YYNTOKENS)
842 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
854 /*--------------------------------.
855 | Print this symbol on YYOUTPUT. |
856 `--------------------------------*/
858 #if (defined __STDC__ || defined __C99__FUNC__ \
859 || defined __cplusplus || defined _MSC_VER)
861 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
864 yy_symbol_print (yyoutput, yytype, yyvaluep)
867 YYSTYPE const * const yyvaluep;
870 if (yytype < YYNTOKENS)
871 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
873 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
875 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
876 YYFPRINTF (yyoutput, ")");
879 /*------------------------------------------------------------------.
880 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
882 `------------------------------------------------------------------*/
884 #if (defined __STDC__ || defined __C99__FUNC__ \
885 || defined __cplusplus || defined _MSC_VER)
887 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
890 yy_stack_print (bottom, top)
891 yytype_int16 *bottom;
895 YYFPRINTF (stderr, "Stack now");
896 for (; bottom <= top; ++bottom)
897 YYFPRINTF (stderr, " %d", *bottom);
898 YYFPRINTF (stderr, "\n");
901 # define YY_STACK_PRINT(Bottom, Top) \
904 yy_stack_print ((Bottom), (Top)); \
908 /*------------------------------------------------.
909 | Report that the YYRULE is going to be reduced. |
910 `------------------------------------------------*/
912 #if (defined __STDC__ || defined __C99__FUNC__ \
913 || defined __cplusplus || defined _MSC_VER)
915 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
918 yy_reduce_print (yyvsp, yyrule)
923 int yynrhs = yyr2[yyrule];
925 unsigned long int yylno = yyrline[yyrule];
926 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
928 /* The symbols being reduced. */
929 for (yyi = 0; yyi < yynrhs; yyi++)
931 fprintf (stderr, " $%d = ", yyi + 1);
932 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
933 &(yyvsp[(yyi + 1) - (yynrhs)])
935 fprintf (stderr, "\n");
939 # define YY_REDUCE_PRINT(Rule) \
942 yy_reduce_print (yyvsp, Rule); \
945 /* Nonzero means print parse trace. It is left uninitialized so that
946 multiple parsers can coexist. */
949 # define YYDPRINTF(Args)
950 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
951 # define YY_STACK_PRINT(Bottom, Top)
952 # define YY_REDUCE_PRINT(Rule)
953 #endif /* !YYDEBUG */
956 /* YYINITDEPTH -- initial size of the parser's stacks. */
958 # define YYINITDEPTH 200
961 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
962 if the built-in stack extension method is used).
964 Do not make this value too large; the results are undefined if
965 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
966 evaluated with infinite-precision integer arithmetic. */
969 # define YYMAXDEPTH 10000
977 # if defined __GLIBC__ && defined _STRING_H
978 # define yystrlen strlen
980 /* Return the length of YYSTR. */
981 #if (defined __STDC__ || defined __C99__FUNC__ \
982 || defined __cplusplus || defined _MSC_VER)
984 yystrlen (const char *yystr)
992 for (yylen = 0; yystr[yylen]; yylen++)
1000 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1001 # define yystpcpy stpcpy
1003 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1005 #if (defined __STDC__ || defined __C99__FUNC__ \
1006 || defined __cplusplus || defined _MSC_VER)
1008 yystpcpy (char *yydest, const char *yysrc)
1011 yystpcpy (yydest, yysrc)
1017 const char *yys = yysrc;
1019 while ((*yyd++ = *yys++) != '\0')
1028 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1029 quotes and backslashes, so that it's suitable for yyerror. The
1030 heuristic is that double-quoting is unnecessary unless the string
1031 contains an apostrophe, a comma, or backslash (other than
1032 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1033 null, do not copy; instead, return the length of what the result
1036 yytnamerr (char *yyres, const char *yystr)
1041 char const *yyp = yystr;
1048 goto do_not_strip_quotes;
1052 goto do_not_strip_quotes;
1065 do_not_strip_quotes: ;
1069 return yystrlen (yystr);
1071 return yystpcpy (yyres, yystr) - yyres;
1075 /* Copy into YYRESULT an error message about the unexpected token
1076 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1077 including the terminating null byte. If YYRESULT is null, do not
1078 copy anything; just return the number of bytes that would be
1079 copied. As a special case, return 0 if an ordinary "syntax error"
1080 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1081 size calculation. */
1083 yysyntax_error (char *yyresult, int yystate, int yychar)
1085 int yyn = yypact[yystate];
1087 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1091 int yytype = YYTRANSLATE (yychar);
1092 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1093 YYSIZE_T yysize = yysize0;
1095 int yysize_overflow = 0;
1096 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1097 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1101 /* This is so xgettext sees the translatable formats that are
1102 constructed on the fly. */
1103 YY_("syntax error, unexpected %s");
1104 YY_("syntax error, unexpected %s, expecting %s");
1105 YY_("syntax error, unexpected %s, expecting %s or %s");
1106 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1107 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1111 static char const yyunexpected[] = "syntax error, unexpected %s";
1112 static char const yyexpecting[] = ", expecting %s";
1113 static char const yyor[] = " or %s";
1114 char yyformat[sizeof yyunexpected
1115 + sizeof yyexpecting - 1
1116 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1117 * (sizeof yyor - 1))];
1118 char const *yyprefix = yyexpecting;
1120 /* Start YYX at -YYN if negative to avoid negative indexes in
1122 int yyxbegin = yyn < 0 ? -yyn : 0;
1124 /* Stay within bounds of both yycheck and yytname. */
1125 int yychecklim = YYLAST - yyn + 1;
1126 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1129 yyarg[0] = yytname[yytype];
1130 yyfmt = yystpcpy (yyformat, yyunexpected);
1132 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1133 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1135 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1139 yyformat[sizeof yyunexpected - 1] = '\0';
1142 yyarg[yycount++] = yytname[yyx];
1143 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1144 yysize_overflow |= (yysize1 < yysize);
1146 yyfmt = yystpcpy (yyfmt, yyprefix);
1150 yyf = YY_(yyformat);
1151 yysize1 = yysize + yystrlen (yyf);
1152 yysize_overflow |= (yysize1 < yysize);
1155 if (yysize_overflow)
1156 return YYSIZE_MAXIMUM;
1160 /* Avoid sprintf, as that infringes on the user's name space.
1161 Don't have undefined behavior even if the translation
1162 produced a string with the wrong number of "%s"s. */
1163 char *yyp = yyresult;
1165 while ((*yyp = *yyf) != '\0')
1167 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1169 yyp += yytnamerr (yyp, yyarg[yyi++]);
1182 #endif /* YYERROR_VERBOSE */
1185 /*-----------------------------------------------.
1186 | Release the memory associated to this symbol. |
1187 `-----------------------------------------------*/
1190 #if (defined __STDC__ || defined __C99__FUNC__ \
1191 || defined __cplusplus || defined _MSC_VER)
1193 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1196 yydestruct (yymsg, yytype, yyvaluep)
1206 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1217 /* Prevent warnings from -Wmissing-prototypes. */
1219 #ifdef YYPARSE_PARAM
1220 #if defined __STDC__ || defined __cplusplus
1221 int yyparse (void *YYPARSE_PARAM);
1225 #else /* ! YYPARSE_PARAM */
1226 #if defined __STDC__ || defined __cplusplus
1231 #endif /* ! YYPARSE_PARAM */
1235 /* The look-ahead symbol. */
1238 /* The semantic value of the look-ahead symbol. */
1241 /* Number of syntax errors so far. */
1250 #ifdef YYPARSE_PARAM
1251 #if (defined __STDC__ || defined __C99__FUNC__ \
1252 || defined __cplusplus || defined _MSC_VER)
1254 yyparse (void *YYPARSE_PARAM)
1257 yyparse (YYPARSE_PARAM)
1258 void *YYPARSE_PARAM;
1260 #else /* ! YYPARSE_PARAM */
1261 #if (defined __STDC__ || defined __C99__FUNC__ \
1262 || defined __cplusplus || defined _MSC_VER)
1276 /* Number of tokens to shift before error messages enabled. */
1278 /* Look-ahead token as an internal (translated) token number. */
1281 /* Buffer for error messages, and its allocated size. */
1283 char *yymsg = yymsgbuf;
1284 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1287 /* Three stacks and their tools:
1288 `yyss': related to states,
1289 `yyvs': related to semantic values,
1290 `yyls': related to locations.
1292 Refer to the stacks thru separate pointers, to allow yyoverflow
1293 to reallocate them elsewhere. */
1295 /* The state stack. */
1296 yytype_int16 yyssa[YYINITDEPTH];
1297 yytype_int16 *yyss = yyssa;
1298 yytype_int16 *yyssp;
1300 /* The semantic value stack. */
1301 YYSTYPE yyvsa[YYINITDEPTH];
1302 YYSTYPE *yyvs = yyvsa;
1307 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1309 YYSIZE_T yystacksize = YYINITDEPTH;
1311 /* The variables used to return semantic value and location from the
1316 /* The number of symbols on the RHS of the reduced rule.
1317 Keep to zero when no symbol should be popped. */
1320 YYDPRINTF ((stderr, "Starting parse\n"));
1325 yychar = YYEMPTY; /* Cause a token to be read. */
1327 /* Initialize stack pointers.
1328 Waste one element of value and location stack
1329 so that they stay on the same level as the state stack.
1330 The wasted elements are never initialized. */
1337 /*------------------------------------------------------------.
1338 | yynewstate -- Push a new state, which is found in yystate. |
1339 `------------------------------------------------------------*/
1341 /* In all cases, when you get here, the value and location stacks
1342 have just been pushed. So pushing a state here evens the stacks. */
1348 if (yyss + yystacksize - 1 <= yyssp)
1350 /* Get the current used size of the three stacks, in elements. */
1351 YYSIZE_T yysize = yyssp - yyss + 1;
1355 /* Give user a chance to reallocate the stack. Use copies of
1356 these so that the &'s don't force the real ones into
1358 YYSTYPE *yyvs1 = yyvs;
1359 yytype_int16 *yyss1 = yyss;
1362 /* Each stack pointer address is followed by the size of the
1363 data in use in that stack, in bytes. This used to be a
1364 conditional around just the two extra args, but that might
1365 be undefined if yyoverflow is a macro. */
1366 yyoverflow (YY_("memory exhausted"),
1367 &yyss1, yysize * sizeof (*yyssp),
1368 &yyvs1, yysize * sizeof (*yyvsp),
1375 #else /* no yyoverflow */
1376 # ifndef YYSTACK_RELOCATE
1377 goto yyexhaustedlab;
1379 /* Extend the stack our own way. */
1380 if (YYMAXDEPTH <= yystacksize)
1381 goto yyexhaustedlab;
1383 if (YYMAXDEPTH < yystacksize)
1384 yystacksize = YYMAXDEPTH;
1387 yytype_int16 *yyss1 = yyss;
1388 union yyalloc *yyptr =
1389 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1391 goto yyexhaustedlab;
1392 YYSTACK_RELOCATE (yyss);
1393 YYSTACK_RELOCATE (yyvs);
1395 # undef YYSTACK_RELOCATE
1397 YYSTACK_FREE (yyss1);
1400 #endif /* no yyoverflow */
1402 yyssp = yyss + yysize - 1;
1403 yyvsp = yyvs + yysize - 1;
1406 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1407 (unsigned long int) yystacksize));
1409 if (yyss + yystacksize - 1 <= yyssp)
1413 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1422 /* Do appropriate processing given the current state. Read a
1423 look-ahead token if we need one and don't already have one. */
1425 /* First try to decide what to do without reference to look-ahead token. */
1426 yyn = yypact[yystate];
1427 if (yyn == YYPACT_NINF)
1430 /* Not known => get a look-ahead token if don't already have one. */
1432 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1433 if (yychar == YYEMPTY)
1435 YYDPRINTF ((stderr, "Reading a token: "));
1439 if (yychar <= YYEOF)
1441 yychar = yytoken = YYEOF;
1442 YYDPRINTF ((stderr, "Now at end of input.\n"));
1446 yytoken = YYTRANSLATE (yychar);
1447 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1450 /* If the proper action on seeing token YYTOKEN is to reduce or to
1451 detect an error, take that action. */
1453 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1458 if (yyn == 0 || yyn == YYTABLE_NINF)
1467 /* Count tokens shifted since error; after three, turn off error
1472 /* Shift the look-ahead token. */
1473 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1475 /* Discard the shifted token unless it is eof. */
1476 if (yychar != YYEOF)
1485 /*-----------------------------------------------------------.
1486 | yydefault -- do the default action for the current state. |
1487 `-----------------------------------------------------------*/
1489 yyn = yydefact[yystate];
1495 /*-----------------------------.
1496 | yyreduce -- Do a reduction. |
1497 `-----------------------------*/
1499 /* yyn is the number of a rule to reduce with. */
1502 /* If YYLEN is nonzero, implement the default value of the action:
1505 Otherwise, the following line sets YYVAL to garbage.
1506 This behavior is undocumented and Bison
1507 users should not rely upon it. Assigning to YYVAL
1508 unconditionally makes the parser a bit smaller, and it avoids a
1509 GCC warning that YYVAL may be used uninitialized. */
1510 yyval = yyvsp[1-yylen];
1513 YY_REDUCE_PRINT (yyn);
1517 #line 227 "./config_parser.y"
1518 { __sdp_log_set_log_stderr(); }
1522 #line 228 "./config_parser.y"
1523 { __sdp_log_set_log_syslog(); }
1527 #line 229 "./config_parser.y"
1528 { __sdp_log_set_log_file((yyvsp[(3) - (3)].sval)); }
1532 #line 233 "./config_parser.y"
1533 { __sdp_log_set_min_level((yyvsp[(2) - (2)].ival)); }
1537 #line 237 "./config_parser.y"
1538 { __sdp_add_rule(); }
1542 #line 241 "./config_parser.y"
1543 { __sdp_rule.target_family = USE_TCP; }
1547 #line 242 "./config_parser.y"
1548 { __sdp_rule.target_family = USE_SDP; }
1552 #line 243 "./config_parser.y"
1553 { __sdp_rule.target_family = USE_BOTH; }
1557 #line 247 "./config_parser.y"
1558 { current_role = 1; }
1562 #line 248 "./config_parser.y"
1563 { current_role = 2; }
1567 #line 252 "./config_parser.y"
1568 { __sdp_set_prog_name_expr((yyvsp[(1) - (1)].sval)); }
1572 #line 253 "./config_parser.y"
1573 { __sdp_set_prog_name_expr("*"); }
1577 #line 257 "./config_parser.y"
1578 { __sdp_rule.match_by_addr = 1; __sdp_rule.prefixlen = 32; }
1582 #line 258 "./config_parser.y"
1583 { __sdp_rule.match_by_addr = 1; __sdp_rule.prefixlen = (yyvsp[(3) - (3)].ival); }
1587 #line 259 "./config_parser.y"
1588 { __sdp_rule.match_by_addr = 0; __sdp_rule.prefixlen = 32; }
1592 #line 263 "./config_parser.y"
1593 { __sdp_set_ipv4_addr((yyvsp[(1) - (7)].ival),(yyvsp[(3) - (7)].ival),(yyvsp[(5) - (7)].ival),(yyvsp[(7) - (7)].ival)); }
1597 #line 267 "./config_parser.y"
1598 { __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (1)].ival); __sdp_rule.eport= (yyvsp[(1) - (1)].ival); }
1602 #line 268 "./config_parser.y"
1603 { __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (3)].ival); __sdp_rule.eport= (yyvsp[(3) - (3)].ival); }
1607 #line 269 "./config_parser.y"
1608 { __sdp_rule.match_by_port = 0; __sdp_rule.sport= 0 ; __sdp_rule.eport= 0; }
1612 /* Line 1267 of yacc.c. */
1613 #line 1614 "y.tab.c"
1616 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1620 YY_STACK_PRINT (yyss, yyssp);
1625 /* Now `shift' the result of the reduction. Determine what state
1626 that goes to, based on the state we popped back to and the rule
1627 number reduced by. */
1631 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1632 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1633 yystate = yytable[yystate];
1635 yystate = yydefgoto[yyn - YYNTOKENS];
1640 /*------------------------------------.
1641 | yyerrlab -- here on detecting error |
1642 `------------------------------------*/
1644 /* If not already recovering from an error, report this error. */
1648 #if ! YYERROR_VERBOSE
1649 yyerror (YY_("syntax error"));
1652 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1653 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1655 YYSIZE_T yyalloc = 2 * yysize;
1656 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1657 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1658 if (yymsg != yymsgbuf)
1659 YYSTACK_FREE (yymsg);
1660 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1662 yymsg_alloc = yyalloc;
1666 yymsg_alloc = sizeof yymsgbuf;
1670 if (0 < yysize && yysize <= yymsg_alloc)
1672 (void) yysyntax_error (yymsg, yystate, yychar);
1677 yyerror (YY_("syntax error"));
1679 goto yyexhaustedlab;
1687 if (yyerrstatus == 3)
1689 /* If just tried and failed to reuse look-ahead token after an
1690 error, discard it. */
1692 if (yychar <= YYEOF)
1694 /* Return failure if at end of input. */
1695 if (yychar == YYEOF)
1700 yydestruct ("Error: discarding",
1706 /* Else will try to reuse look-ahead token after shifting the error
1711 /*---------------------------------------------------.
1712 | yyerrorlab -- error raised explicitly by YYERROR. |
1713 `---------------------------------------------------*/
1716 /* Pacify compilers like GCC when the user code never invokes
1717 YYERROR and the label yyerrorlab therefore never appears in user
1719 if (/*CONSTCOND*/ 0)
1722 /* Do not reclaim the symbols of the rule which action triggered
1726 YY_STACK_PRINT (yyss, yyssp);
1731 /*-------------------------------------------------------------.
1732 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1733 `-------------------------------------------------------------*/
1735 yyerrstatus = 3; /* Each real token shifted decrements this. */
1739 yyn = yypact[yystate];
1740 if (yyn != YYPACT_NINF)
1743 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1751 /* Pop the current state because it cannot handle the error token. */
1756 yydestruct ("Error: popping",
1757 yystos[yystate], yyvsp);
1760 YY_STACK_PRINT (yyss, yyssp);
1769 /* Shift the error token. */
1770 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1776 /*-------------------------------------.
1777 | yyacceptlab -- YYACCEPT comes here. |
1778 `-------------------------------------*/
1783 /*-----------------------------------.
1784 | yyabortlab -- YYABORT comes here. |
1785 `-----------------------------------*/
1791 /*-------------------------------------------------.
1792 | yyexhaustedlab -- memory exhaustion comes here. |
1793 `-------------------------------------------------*/
1795 yyerror (YY_("memory exhausted"));
1801 if (yychar != YYEOF && yychar != YYEMPTY)
1802 yydestruct ("Cleanup: discarding lookahead",
1804 /* Do not reclaim the symbols of the rule which action triggered
1805 this YYABORT or YYACCEPT. */
1807 YY_STACK_PRINT (yyss, yyssp);
1808 while (yyssp != yyss)
1810 yydestruct ("Cleanup: popping",
1811 yystos[*yyssp], yyvsp);
1816 YYSTACK_FREE (yyss);
1819 if (yymsg != yymsgbuf)
1820 YYSTACK_FREE (yymsg);
1822 /* Make sure YYID is used. */
1823 return YYID (yyresult);
1827 #line 272 "./config_parser.y"
1830 int yyerror(char *msg)
1832 /* replace the $undefined and $end if exists */
1833 char *orig_msg = (char*)malloc(strlen(msg)+25);
1834 char *final_msg = (char*)malloc(strlen(msg)+25);
1836 strcpy(orig_msg, msg);
1838 char *word = strtok(orig_msg, " ");
1839 final_msg[0] = '\0';
1840 while (word != NULL) {
1841 if (!strncmp(word, "$undefined", 10)) {
1842 strcat(final_msg, "unrecognized-token ");
1843 } else if (!strncmp(word, "$end",4)) {
1844 strcat(final_msg, "end-of-file ");
1846 strcat(final_msg, word);
1847 strcat(final_msg, " ");
1849 word = strtok(NULL, " ");
1852 __sdp_log(9, "Error (line:%ld) : %s\n", __sdp_config_line_num, final_msg);
1863 /* parse apollo route dump file */
1864 int __sdp_parse_config (const char *fileName) {
1865 extern FILE * libsdp_yyin;
1868 if (access(fileName, R_OK)) {
1869 printf("libsdp Error: No access to open File:%s %s\n",
1870 fileName, strerror(errno));
1874 libsdp_yyin = fopen(fileName,"r");
1876 printf("libsdp Error: Fail to open File:%s\n", fileName);
1880 __sdp_config_line_num = 1;
1885 fclose(libsdp_yyin);