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
116 /* Copy the first part of user declarations. */
117 #line 39 "./config_parser.y"
125 #include <sys/socket.h>
126 #include <netinet/in.h>
127 #include <arpa/inet.h>
129 #define YYERROR_VERBOSE 1
131 extern int yyerror(char *msg);
132 extern int yylex(void);
133 static int parse_err = 0;
135 struct use_family_rule *__sdp_clients_family_rules_head = NULL;
136 struct use_family_rule *__sdp_clients_family_rules_tail = NULL;
137 struct use_family_rule *__sdp_servers_family_rules_head = NULL;
138 struct use_family_rule *__sdp_servers_family_rules_tail = NULL;
140 /* some globals to store intermidiate parser state */
141 static struct use_family_rule __sdp_rule;
142 static int current_role = 0;
144 int __sdp_config_empty(
148 return ( (__sdp_clients_family_rules_head == NULL) &&
149 (__sdp_servers_family_rules_head == NULL) );
152 static void __sdp_set_ip_addr(char *addr)
156 struct sockaddr_in *addr4 = (struct sockaddr_in *)(&__sdp_rule.ip);
157 struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)(&__sdp_rule.ip);
160 addrlen = strrchr(addr, '/');
162 prefixlen = atoi(addrlen + 1);
166 rc = inet_pton(AF_INET, addr, &addr4->sin_addr);
168 addr4->sin_family = AF_INET;
169 __sdp_rule.prefixlen = prefixlen ?: 32;
173 rc = inet_pton(AF_INET6, addr, &addr6->sin6_addr);
175 addr6->sin6_family = AF_INET6;
176 __sdp_rule.prefixlen = prefixlen ?: 128;
181 yyerror("provided address is not legal");
184 static const char *addr2str(struct sockaddr_storage *src)
186 static char dst[INET6_ADDRSTRLEN];
187 int af = src->ss_family;
188 const struct sockaddr_in *addr4 = (const struct sockaddr_in *)src;
189 const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)src;
192 return inet_ntop(af, &addr6->sin6_addr, dst, INET6_ADDRSTRLEN);
194 return inet_ntop(af, &addr4->sin_addr, dst, INET6_ADDRSTRLEN);
197 static void __sdp_set_prog_name_expr(char *prog_name_expr)
199 __sdp_rule.prog_name_expr = strdup(prog_name_expr);
200 if (!__sdp_rule.prog_name_expr) {
201 yyerror("fail to allocate program name expression");
205 static char *__sdp_get_role_str(int role)
207 if (role == 1) return("server");
208 if (role == 2) return("client");
209 return("unknown role");
212 extern int __sdp_min_level;
214 /* dump the current state in readable format */
215 static void __sdp_dump_config_state() {
217 sprintf(buf, "CONFIG: use %s %s %s",
218 __sdp_get_family_str(__sdp_rule.target_family),
219 __sdp_get_role_str( current_role ),
220 __sdp_rule.prog_name_expr);
221 if (__sdp_rule.match_by_addr) {
222 sprintf(buf+strlen(buf), " %s/%d",
223 addr2str(&__sdp_rule.ip), __sdp_rule.prefixlen);
225 sprintf(buf+strlen(buf), " *");
227 if (__sdp_rule.match_by_port) {
228 sprintf(buf+strlen(buf), ":%d",__sdp_rule.sport);
229 if (__sdp_rule.eport > __sdp_rule.sport)
230 sprintf(buf+strlen(buf), "-%d",__sdp_rule.eport);
233 sprintf(buf+strlen(buf), ":*");
234 sprintf(buf+strlen(buf), "\n");
238 /* use the above state for making a new rule */
239 static void __sdp_add_rule() {
240 struct use_family_rule **p_tail, **p_head, *rule;
242 if (__sdp_min_level <= 1) __sdp_dump_config_state();
243 if ( current_role == 1 ) {
244 p_tail = &__sdp_servers_family_rules_tail;
245 p_head = &__sdp_servers_family_rules_head;
246 } else if ( current_role == 2 ) {
247 p_tail = &__sdp_clients_family_rules_tail;
248 p_head = &__sdp_clients_family_rules_head;
250 yyerror("ignoring unknown role");
255 rule = (struct use_family_rule *)malloc(sizeof(*rule));
257 yyerror("fail to allocate new rule");
262 memset(rule, 0, sizeof(*rule));
264 rule->prev = *p_tail;
268 (*p_tail)->next = rule;
275 /* Enabling traces. */
280 /* Enabling verbose error messages. */
281 #ifdef YYERROR_VERBOSE
282 # undef YYERROR_VERBOSE
283 # define YYERROR_VERBOSE 1
285 # define YYERROR_VERBOSE 1
288 /* Enabling the token table. */
289 #ifndef YYTOKEN_TABLE
290 # define YYTOKEN_TABLE 0
293 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
294 typedef union YYSTYPE
295 #line 197 "./config_parser.y"
300 /* Line 193 of yacc.c. */
303 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
304 # define YYSTYPE_IS_DECLARED 1
305 # define YYSTYPE_IS_TRIVIAL 1
310 /* Copy the second part of user declarations. */
311 #line 223 "./config_parser.y"
313 long __sdp_config_line_num;
316 /* Line 216 of yacc.c. */
324 typedef YYTYPE_UINT8 yytype_uint8;
326 typedef unsigned char yytype_uint8;
330 typedef YYTYPE_INT8 yytype_int8;
331 #elif (defined __STDC__ || defined __C99__FUNC__ \
332 || defined __cplusplus || defined _MSC_VER)
333 typedef signed char yytype_int8;
335 typedef short int yytype_int8;
339 typedef YYTYPE_UINT16 yytype_uint16;
341 typedef unsigned short int yytype_uint16;
345 typedef YYTYPE_INT16 yytype_int16;
347 typedef short int yytype_int16;
351 # ifdef __SIZE_TYPE__
352 # define YYSIZE_T __SIZE_TYPE__
353 # elif defined size_t
354 # define YYSIZE_T size_t
355 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
356 || defined __cplusplus || defined _MSC_VER)
357 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
358 # define YYSIZE_T size_t
360 # define YYSIZE_T unsigned int
364 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
369 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
370 # define YY_(msgid) dgettext ("bison-runtime", msgid)
374 # define YY_(msgid) msgid
378 /* Suppress unused-variable warnings by "using" E. */
379 #if ! defined lint || defined __GNUC__
380 # define YYUSE(e) ((void) (e))
382 # define YYUSE(e) /* empty */
385 /* Identity function, used to suppress warnings about constant conditions. */
389 #if (defined __STDC__ || defined __C99__FUNC__ \
390 || defined __cplusplus || defined _MSC_VER)
403 #if ! defined yyoverflow || YYERROR_VERBOSE
405 /* The parser invokes alloca or malloc; define the necessary symbols. */
407 # ifdef YYSTACK_USE_ALLOCA
408 # if YYSTACK_USE_ALLOCA
410 # define YYSTACK_ALLOC __builtin_alloca
411 # elif defined __BUILTIN_VA_ARG_INCR
412 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
414 # define YYSTACK_ALLOC __alloca
415 # elif defined _MSC_VER
416 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
417 # define alloca _alloca
419 # define YYSTACK_ALLOC alloca
420 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
421 || defined __cplusplus || defined _MSC_VER)
422 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
431 # ifdef YYSTACK_ALLOC
432 /* Pacify GCC's `empty if-body' warning. */
433 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
434 # ifndef YYSTACK_ALLOC_MAXIMUM
435 /* The OS might guarantee only one guard page at the bottom of the stack,
436 and a page size can be as small as 4096 bytes. So we cannot safely
437 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
438 to allow for a few compiler-allocated temporary stack slots. */
439 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
442 # define YYSTACK_ALLOC YYMALLOC
443 # define YYSTACK_FREE YYFREE
444 # ifndef YYSTACK_ALLOC_MAXIMUM
445 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
447 # if (defined __cplusplus && ! defined _STDLIB_H \
448 && ! ((defined YYMALLOC || defined malloc) \
449 && (defined YYFREE || defined free)))
450 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
456 # define YYMALLOC malloc
457 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
458 || defined __cplusplus || defined _MSC_VER)
459 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
464 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
465 || defined __cplusplus || defined _MSC_VER)
466 void free (void *); /* INFRINGES ON USER NAME SPACE */
470 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
473 #if (! defined yyoverflow \
474 && (! defined __cplusplus \
475 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
477 /* A type that is properly aligned for any stack member. */
484 /* The size of the maximum gap between one aligned stack and the next. */
485 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
487 /* The size of an array large to enough to hold all stacks, each with
489 # define YYSTACK_BYTES(N) \
490 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
491 + YYSTACK_GAP_MAXIMUM)
493 /* Copy COUNT objects from FROM to TO. The source and destination do
496 # if defined __GNUC__ && 1 < __GNUC__
497 # define YYCOPY(To, From, Count) \
498 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
500 # define YYCOPY(To, From, Count) \
504 for (yyi = 0; yyi < (Count); yyi++) \
505 (To)[yyi] = (From)[yyi]; \
511 /* Relocate STACK from its old location to the new one. The
512 local variables YYSIZE and YYSTACKSIZE give the old and new number of
513 elements in the stack, and YYPTR gives the new location of the
514 stack. Advance YYPTR to a properly aligned location for the next
516 # define YYSTACK_RELOCATE(Stack) \
519 YYSIZE_T yynewbytes; \
520 YYCOPY (&yyptr->Stack, Stack, yysize); \
521 Stack = &yyptr->Stack; \
522 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
523 yyptr += yynewbytes / sizeof (*yyptr); \
529 /* YYFINAL -- State number of the termination state. */
531 /* YYLAST -- Last index in YYTABLE. */
534 /* YYNTOKENS -- Number of terminals. */
536 /* YYNNTS -- Number of nonterminals. */
538 /* YYNRULES -- Number of rules. */
540 /* YYNRULES -- Number of states. */
543 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
545 #define YYMAXUTOK 273
547 #define YYTRANSLATE(YYX) \
548 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
550 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
551 static const yytype_uint8 yytranslate[] =
553 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 20, 2, 2, 21, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 19, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
579 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
584 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
586 static const yytype_uint8 yyprhs[] =
588 0, 0, 3, 5, 8, 9, 11, 14, 15, 18,
589 20, 22, 26, 27, 30, 33, 36, 39, 43, 46,
590 55, 57, 59, 61, 63, 65, 67, 69, 71, 73,
594 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
595 static const yytype_int8 yyrhs[] =
597 25, 0, -1, 17, -1, 23, 17, -1, -1, 23,
598 -1, 24, 26, -1, -1, 26, 27, -1, 28, -1,
599 32, -1, 10, 29, 23, -1, -1, 29, 30, -1,
600 29, 31, -1, 11, 12, -1, 11, 13, -1, 11,
601 14, 15, -1, 16, 9, -1, 3, 33, 34, 35,
602 36, 19, 37, 23, -1, 6, -1, 7, -1, 8,
603 -1, 5, -1, 4, -1, 15, -1, 20, -1, 18,
604 -1, 20, -1, 9, -1, 9, 21, 9, -1, 20,
608 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
609 static const yytype_uint16 yyrline[] =
611 0, 229, 229, 230, 232, 233, 236, 239, 240, 244,
612 245, 249, 252, 253, 254, 258, 259, 260, 264, 268,
613 272, 273, 274, 278, 279, 283, 284, 288, 289, 293,
618 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
619 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
620 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
621 static const char *const yytname[] =
623 "$end", "error", "$undefined", "\"use\"", "\"client or connect\"",
624 "\"server or listen\"", "\"tcp\"", "\"sdp\"", "\"both\"",
625 "\"integer value\"", "\"log statement\"", "\"destination\"",
626 "\"stderr\"", "\"syslog\"", "\"file\"", "\"a name\"", "\"min-level\"",
627 "\"new line\"", "\"ip address\"", "':'", "'*'", "'-'", "$accept", "NL",
628 "ONL", "config", "statements", "statement", "log_statement", "log_opts",
629 "log_dest", "verbosity", "socket_statement", "family", "role", "program",
630 "address", "ports", 0
635 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
637 static const yytype_uint16 yytoknum[] =
639 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
640 265, 266, 267, 268, 269, 270, 271, 272, 273, 58,
645 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
646 static const yytype_uint8 yyr1[] =
648 0, 22, 23, 23, 24, 24, 25, 26, 26, 27,
649 27, 28, 29, 29, 29, 30, 30, 30, 31, 32,
650 33, 33, 33, 34, 34, 35, 35, 36, 36, 37,
654 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
655 static const yytype_uint8 yyr2[] =
657 0, 2, 1, 2, 0, 1, 2, 0, 2, 1,
658 1, 3, 0, 2, 2, 2, 2, 3, 2, 8,
659 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
663 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
664 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
665 means the default is an error. */
666 static const yytype_uint8 yydefact[] =
668 4, 2, 5, 7, 0, 3, 6, 1, 0, 12,
669 8, 9, 10, 20, 21, 22, 0, 0, 24, 23,
670 0, 0, 0, 11, 13, 14, 25, 26, 0, 15,
671 16, 0, 18, 27, 28, 0, 17, 0, 29, 31,
675 /* YYDEFGOTO[NTERM-NUM]. */
676 static const yytype_int8 yydefgoto[] =
678 -1, 2, 3, 4, 6, 10, 11, 17, 24, 25,
679 12, 16, 20, 28, 35, 40
682 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
684 #define YYPACT_NINF -18
685 static const yytype_int8 yypact[] =
687 -10, -18, 5, -18, 21, -18, -1, -18, 7, -18,
688 -18, -18, -18, -18, -18, -18, 15, -6, -18, -18,
689 -12, 4, 16, 5, -18, -18, -18, -18, -14, -18,
690 -18, 9, -18, -18, -18, 8, -18, -8, 10, -18,
694 /* YYPGOTO[NTERM-NUM]. */
695 static const yytype_int8 yypgoto[] =
697 -18, -17, -18, -18, -18, -18, -18, -18, -18, -18,
698 -18, -18, -18, -18, -18, -18
701 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
702 positive, shift that token. If negative, reduce the rule which
703 number is the opposite. If zero, do what YYDEFACT says.
704 If YYTABLE_NINF, syntax error. */
705 #define YYTABLE_NINF -1
706 static const yytype_uint8 yytable[] =
708 23, 38, 8, 26, 33, 21, 34, 1, 27, 9,
709 22, 1, 39, 13, 14, 15, 29, 30, 31, 18,
710 19, 7, 5, 42, 36, 32, 43, 37, 0, 0,
714 static const yytype_int8 yycheck[] =
716 17, 9, 3, 15, 18, 11, 20, 17, 20, 10,
717 16, 17, 20, 6, 7, 8, 12, 13, 14, 4,
718 5, 0, 17, 40, 15, 9, 9, 19, -1, -1,
722 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
723 symbol of state STATE-NUM. */
724 static const yytype_uint8 yystos[] =
726 0, 17, 23, 24, 25, 17, 26, 0, 3, 10,
727 27, 28, 32, 6, 7, 8, 33, 29, 4, 5,
728 34, 11, 16, 23, 30, 31, 15, 20, 35, 12,
729 13, 14, 9, 18, 20, 36, 15, 19, 9, 20,
733 #define yyerrok (yyerrstatus = 0)
734 #define yyclearin (yychar = YYEMPTY)
738 #define YYACCEPT goto yyacceptlab
739 #define YYABORT goto yyabortlab
740 #define YYERROR goto yyerrorlab
743 /* Like YYERROR except do call yyerror. This remains here temporarily
744 to ease the transition to the new meaning of YYERROR, for GCC.
745 Once GCC version 2 has supplanted version 1, this can go. */
747 #define YYFAIL goto yyerrlab
749 #define YYRECOVERING() (!!yyerrstatus)
751 #define YYBACKUP(Token, Value) \
753 if (yychar == YYEMPTY && yylen == 1) \
757 yytoken = YYTRANSLATE (yychar); \
763 yyerror (YY_("syntax error: cannot back up")); \
770 #define YYERRCODE 256
773 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
774 If N is 0, then set CURRENT to the empty location which ends
775 the previous symbol: RHS[0] (always defined). */
777 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
778 #ifndef YYLLOC_DEFAULT
779 # define YYLLOC_DEFAULT(Current, Rhs, N) \
783 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
784 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
785 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
786 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
790 (Current).first_line = (Current).last_line = \
791 YYRHSLOC (Rhs, 0).last_line; \
792 (Current).first_column = (Current).last_column = \
793 YYRHSLOC (Rhs, 0).last_column; \
799 /* YY_LOCATION_PRINT -- Print the location on the stream.
800 This macro was not mandated originally: define only if we know
801 we won't break user code: when these are the locations we know. */
803 #ifndef YY_LOCATION_PRINT
804 # if YYLTYPE_IS_TRIVIAL
805 # define YY_LOCATION_PRINT(File, Loc) \
806 fprintf (File, "%d.%d-%d.%d", \
807 (Loc).first_line, (Loc).first_column, \
808 (Loc).last_line, (Loc).last_column)
810 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
815 /* YYLEX -- calling `yylex' with the right arguments. */
818 # define YYLEX yylex (YYLEX_PARAM)
820 # define YYLEX yylex ()
823 /* Enable debugging if requested. */
827 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
828 # define YYFPRINTF fprintf
831 # define YYDPRINTF(Args) \
837 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
841 YYFPRINTF (stderr, "%s ", Title); \
842 yy_symbol_print (stderr, \
844 YYFPRINTF (stderr, "\n"); \
849 /*--------------------------------.
850 | Print this symbol on YYOUTPUT. |
851 `--------------------------------*/
854 #if (defined __STDC__ || defined __C99__FUNC__ \
855 || defined __cplusplus || defined _MSC_VER)
857 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
860 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
863 YYSTYPE const * const yyvaluep;
869 if (yytype < YYNTOKENS)
870 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
882 /*--------------------------------.
883 | Print this symbol on YYOUTPUT. |
884 `--------------------------------*/
886 #if (defined __STDC__ || defined __C99__FUNC__ \
887 || defined __cplusplus || defined _MSC_VER)
889 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
892 yy_symbol_print (yyoutput, yytype, yyvaluep)
895 YYSTYPE const * const yyvaluep;
898 if (yytype < YYNTOKENS)
899 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
901 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
903 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
904 YYFPRINTF (yyoutput, ")");
907 /*------------------------------------------------------------------.
908 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
910 `------------------------------------------------------------------*/
912 #if (defined __STDC__ || defined __C99__FUNC__ \
913 || defined __cplusplus || defined _MSC_VER)
915 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
918 yy_stack_print (bottom, top)
919 yytype_int16 *bottom;
923 YYFPRINTF (stderr, "Stack now");
924 for (; bottom <= top; ++bottom)
925 YYFPRINTF (stderr, " %d", *bottom);
926 YYFPRINTF (stderr, "\n");
929 # define YY_STACK_PRINT(Bottom, Top) \
932 yy_stack_print ((Bottom), (Top)); \
936 /*------------------------------------------------.
937 | Report that the YYRULE is going to be reduced. |
938 `------------------------------------------------*/
940 #if (defined __STDC__ || defined __C99__FUNC__ \
941 || defined __cplusplus || defined _MSC_VER)
943 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
946 yy_reduce_print (yyvsp, yyrule)
951 int yynrhs = yyr2[yyrule];
953 unsigned long int yylno = yyrline[yyrule];
954 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
956 /* The symbols being reduced. */
957 for (yyi = 0; yyi < yynrhs; yyi++)
959 fprintf (stderr, " $%d = ", yyi + 1);
960 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
961 &(yyvsp[(yyi + 1) - (yynrhs)])
963 fprintf (stderr, "\n");
967 # define YY_REDUCE_PRINT(Rule) \
970 yy_reduce_print (yyvsp, Rule); \
973 /* Nonzero means print parse trace. It is left uninitialized so that
974 multiple parsers can coexist. */
977 # define YYDPRINTF(Args)
978 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
979 # define YY_STACK_PRINT(Bottom, Top)
980 # define YY_REDUCE_PRINT(Rule)
981 #endif /* !YYDEBUG */
984 /* YYINITDEPTH -- initial size of the parser's stacks. */
986 # define YYINITDEPTH 200
989 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
990 if the built-in stack extension method is used).
992 Do not make this value too large; the results are undefined if
993 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
994 evaluated with infinite-precision integer arithmetic. */
997 # define YYMAXDEPTH 10000
1005 # if defined __GLIBC__ && defined _STRING_H
1006 # define yystrlen strlen
1008 /* Return the length of YYSTR. */
1009 #if (defined __STDC__ || defined __C99__FUNC__ \
1010 || defined __cplusplus || defined _MSC_VER)
1012 yystrlen (const char *yystr)
1020 for (yylen = 0; yystr[yylen]; yylen++)
1028 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1029 # define yystpcpy stpcpy
1031 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1033 #if (defined __STDC__ || defined __C99__FUNC__ \
1034 || defined __cplusplus || defined _MSC_VER)
1036 yystpcpy (char *yydest, const char *yysrc)
1039 yystpcpy (yydest, yysrc)
1045 const char *yys = yysrc;
1047 while ((*yyd++ = *yys++) != '\0')
1056 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1057 quotes and backslashes, so that it's suitable for yyerror. The
1058 heuristic is that double-quoting is unnecessary unless the string
1059 contains an apostrophe, a comma, or backslash (other than
1060 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1061 null, do not copy; instead, return the length of what the result
1064 yytnamerr (char *yyres, const char *yystr)
1069 char const *yyp = yystr;
1076 goto do_not_strip_quotes;
1080 goto do_not_strip_quotes;
1093 do_not_strip_quotes: ;
1097 return yystrlen (yystr);
1099 return yystpcpy (yyres, yystr) - yyres;
1103 /* Copy into YYRESULT an error message about the unexpected token
1104 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1105 including the terminating null byte. If YYRESULT is null, do not
1106 copy anything; just return the number of bytes that would be
1107 copied. As a special case, return 0 if an ordinary "syntax error"
1108 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1109 size calculation. */
1111 yysyntax_error (char *yyresult, int yystate, int yychar)
1113 int yyn = yypact[yystate];
1115 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1119 int yytype = YYTRANSLATE (yychar);
1120 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1121 YYSIZE_T yysize = yysize0;
1123 int yysize_overflow = 0;
1124 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1125 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1129 /* This is so xgettext sees the translatable formats that are
1130 constructed on the fly. */
1131 YY_("syntax error, unexpected %s");
1132 YY_("syntax error, unexpected %s, expecting %s");
1133 YY_("syntax error, unexpected %s, expecting %s or %s");
1134 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1135 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1139 static char const yyunexpected[] = "syntax error, unexpected %s";
1140 static char const yyexpecting[] = ", expecting %s";
1141 static char const yyor[] = " or %s";
1142 char yyformat[sizeof yyunexpected
1143 + sizeof yyexpecting - 1
1144 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1145 * (sizeof yyor - 1))];
1146 char const *yyprefix = yyexpecting;
1148 /* Start YYX at -YYN if negative to avoid negative indexes in
1150 int yyxbegin = yyn < 0 ? -yyn : 0;
1152 /* Stay within bounds of both yycheck and yytname. */
1153 int yychecklim = YYLAST - yyn + 1;
1154 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1157 yyarg[0] = yytname[yytype];
1158 yyfmt = yystpcpy (yyformat, yyunexpected);
1160 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1161 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1163 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1167 yyformat[sizeof yyunexpected - 1] = '\0';
1170 yyarg[yycount++] = yytname[yyx];
1171 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1172 yysize_overflow |= (yysize1 < yysize);
1174 yyfmt = yystpcpy (yyfmt, yyprefix);
1178 yyf = YY_(yyformat);
1179 yysize1 = yysize + yystrlen (yyf);
1180 yysize_overflow |= (yysize1 < yysize);
1183 if (yysize_overflow)
1184 return YYSIZE_MAXIMUM;
1188 /* Avoid sprintf, as that infringes on the user's name space.
1189 Don't have undefined behavior even if the translation
1190 produced a string with the wrong number of "%s"s. */
1191 char *yyp = yyresult;
1193 while ((*yyp = *yyf) != '\0')
1195 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1197 yyp += yytnamerr (yyp, yyarg[yyi++]);
1210 #endif /* YYERROR_VERBOSE */
1213 /*-----------------------------------------------.
1214 | Release the memory associated to this symbol. |
1215 `-----------------------------------------------*/
1218 #if (defined __STDC__ || defined __C99__FUNC__ \
1219 || defined __cplusplus || defined _MSC_VER)
1221 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1224 yydestruct (yymsg, yytype, yyvaluep)
1234 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1245 /* Prevent warnings from -Wmissing-prototypes. */
1247 #ifdef YYPARSE_PARAM
1248 #if defined __STDC__ || defined __cplusplus
1249 int yyparse (void *YYPARSE_PARAM);
1253 #else /* ! YYPARSE_PARAM */
1254 #if defined __STDC__ || defined __cplusplus
1259 #endif /* ! YYPARSE_PARAM */
1263 /* The look-ahead symbol. */
1266 /* The semantic value of the look-ahead symbol. */
1269 /* Number of syntax errors so far. */
1278 #ifdef YYPARSE_PARAM
1279 #if (defined __STDC__ || defined __C99__FUNC__ \
1280 || defined __cplusplus || defined _MSC_VER)
1282 yyparse (void *YYPARSE_PARAM)
1285 yyparse (YYPARSE_PARAM)
1286 void *YYPARSE_PARAM;
1288 #else /* ! YYPARSE_PARAM */
1289 #if (defined __STDC__ || defined __C99__FUNC__ \
1290 || defined __cplusplus || defined _MSC_VER)
1304 /* Number of tokens to shift before error messages enabled. */
1306 /* Look-ahead token as an internal (translated) token number. */
1309 /* Buffer for error messages, and its allocated size. */
1311 char *yymsg = yymsgbuf;
1312 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1315 /* Three stacks and their tools:
1316 `yyss': related to states,
1317 `yyvs': related to semantic values,
1318 `yyls': related to locations.
1320 Refer to the stacks thru separate pointers, to allow yyoverflow
1321 to reallocate them elsewhere. */
1323 /* The state stack. */
1324 yytype_int16 yyssa[YYINITDEPTH];
1325 yytype_int16 *yyss = yyssa;
1326 yytype_int16 *yyssp;
1328 /* The semantic value stack. */
1329 YYSTYPE yyvsa[YYINITDEPTH];
1330 YYSTYPE *yyvs = yyvsa;
1335 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1337 YYSIZE_T yystacksize = YYINITDEPTH;
1339 /* The variables used to return semantic value and location from the
1344 /* The number of symbols on the RHS of the reduced rule.
1345 Keep to zero when no symbol should be popped. */
1348 YYDPRINTF ((stderr, "Starting parse\n"));
1353 yychar = YYEMPTY; /* Cause a token to be read. */
1355 /* Initialize stack pointers.
1356 Waste one element of value and location stack
1357 so that they stay on the same level as the state stack.
1358 The wasted elements are never initialized. */
1365 /*------------------------------------------------------------.
1366 | yynewstate -- Push a new state, which is found in yystate. |
1367 `------------------------------------------------------------*/
1369 /* In all cases, when you get here, the value and location stacks
1370 have just been pushed. So pushing a state here evens the stacks. */
1376 if (yyss + yystacksize - 1 <= yyssp)
1378 /* Get the current used size of the three stacks, in elements. */
1379 YYSIZE_T yysize = yyssp - yyss + 1;
1383 /* Give user a chance to reallocate the stack. Use copies of
1384 these so that the &'s don't force the real ones into
1386 YYSTYPE *yyvs1 = yyvs;
1387 yytype_int16 *yyss1 = yyss;
1390 /* Each stack pointer address is followed by the size of the
1391 data in use in that stack, in bytes. This used to be a
1392 conditional around just the two extra args, but that might
1393 be undefined if yyoverflow is a macro. */
1394 yyoverflow (YY_("memory exhausted"),
1395 &yyss1, yysize * sizeof (*yyssp),
1396 &yyvs1, yysize * sizeof (*yyvsp),
1403 #else /* no yyoverflow */
1404 # ifndef YYSTACK_RELOCATE
1405 goto yyexhaustedlab;
1407 /* Extend the stack our own way. */
1408 if (YYMAXDEPTH <= yystacksize)
1409 goto yyexhaustedlab;
1411 if (YYMAXDEPTH < yystacksize)
1412 yystacksize = YYMAXDEPTH;
1415 yytype_int16 *yyss1 = yyss;
1416 union yyalloc *yyptr =
1417 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1419 goto yyexhaustedlab;
1420 YYSTACK_RELOCATE (yyss);
1421 YYSTACK_RELOCATE (yyvs);
1423 # undef YYSTACK_RELOCATE
1425 YYSTACK_FREE (yyss1);
1428 #endif /* no yyoverflow */
1430 yyssp = yyss + yysize - 1;
1431 yyvsp = yyvs + yysize - 1;
1434 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1435 (unsigned long int) yystacksize));
1437 if (yyss + yystacksize - 1 <= yyssp)
1441 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1450 /* Do appropriate processing given the current state. Read a
1451 look-ahead token if we need one and don't already have one. */
1453 /* First try to decide what to do without reference to look-ahead token. */
1454 yyn = yypact[yystate];
1455 if (yyn == YYPACT_NINF)
1458 /* Not known => get a look-ahead token if don't already have one. */
1460 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1461 if (yychar == YYEMPTY)
1463 YYDPRINTF ((stderr, "Reading a token: "));
1467 if (yychar <= YYEOF)
1469 yychar = yytoken = YYEOF;
1470 YYDPRINTF ((stderr, "Now at end of input.\n"));
1474 yytoken = YYTRANSLATE (yychar);
1475 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1478 /* If the proper action on seeing token YYTOKEN is to reduce or to
1479 detect an error, take that action. */
1481 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1486 if (yyn == 0 || yyn == YYTABLE_NINF)
1495 /* Count tokens shifted since error; after three, turn off error
1500 /* Shift the look-ahead token. */
1501 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1503 /* Discard the shifted token unless it is eof. */
1504 if (yychar != YYEOF)
1513 /*-----------------------------------------------------------.
1514 | yydefault -- do the default action for the current state. |
1515 `-----------------------------------------------------------*/
1517 yyn = yydefact[yystate];
1523 /*-----------------------------.
1524 | yyreduce -- Do a reduction. |
1525 `-----------------------------*/
1527 /* yyn is the number of a rule to reduce with. */
1530 /* If YYLEN is nonzero, implement the default value of the action:
1533 Otherwise, the following line sets YYVAL to garbage.
1534 This behavior is undocumented and Bison
1535 users should not rely upon it. Assigning to YYVAL
1536 unconditionally makes the parser a bit smaller, and it avoids a
1537 GCC warning that YYVAL may be used uninitialized. */
1538 yyval = yyvsp[1-yylen];
1541 YY_REDUCE_PRINT (yyn);
1545 #line 258 "./config_parser.y"
1546 { __sdp_log_set_log_stderr(); }
1550 #line 259 "./config_parser.y"
1551 { __sdp_log_set_log_syslog(); }
1555 #line 260 "./config_parser.y"
1556 { __sdp_log_set_log_file((yyvsp[(3) - (3)].sval)); }
1560 #line 264 "./config_parser.y"
1561 { __sdp_log_set_min_level((yyvsp[(2) - (2)].ival)); }
1565 #line 268 "./config_parser.y"
1566 { __sdp_add_rule(); }
1570 #line 272 "./config_parser.y"
1571 { __sdp_rule.target_family = USE_TCP; }
1575 #line 273 "./config_parser.y"
1576 { __sdp_rule.target_family = USE_SDP; }
1580 #line 274 "./config_parser.y"
1581 { __sdp_rule.target_family = USE_BOTH; }
1585 #line 278 "./config_parser.y"
1586 { current_role = 1; }
1590 #line 279 "./config_parser.y"
1591 { current_role = 2; }
1595 #line 283 "./config_parser.y"
1596 { __sdp_set_prog_name_expr((yyvsp[(1) - (1)].sval)); }
1600 #line 284 "./config_parser.y"
1601 { __sdp_set_prog_name_expr("*"); }
1605 #line 288 "./config_parser.y"
1606 { __sdp_rule.match_by_addr = 1; __sdp_set_ip_addr((yyvsp[(1) - (1)].sval)); }
1610 #line 289 "./config_parser.y"
1611 { __sdp_rule.match_by_addr = 0; __sdp_rule.prefixlen = 32; }
1615 #line 293 "./config_parser.y"
1616 { __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (1)].ival); __sdp_rule.eport= (yyvsp[(1) - (1)].ival); }
1620 #line 294 "./config_parser.y"
1621 { __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (3)].ival); __sdp_rule.eport= (yyvsp[(3) - (3)].ival); }
1625 #line 295 "./config_parser.y"
1626 { __sdp_rule.match_by_port = 0; __sdp_rule.sport= 0 ; __sdp_rule.eport= 0; }
1630 /* Line 1267 of yacc.c. */
1631 #line 1632 "y.tab.c"
1634 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1638 YY_STACK_PRINT (yyss, yyssp);
1643 /* Now `shift' the result of the reduction. Determine what state
1644 that goes to, based on the state we popped back to and the rule
1645 number reduced by. */
1649 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1650 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1651 yystate = yytable[yystate];
1653 yystate = yydefgoto[yyn - YYNTOKENS];
1658 /*------------------------------------.
1659 | yyerrlab -- here on detecting error |
1660 `------------------------------------*/
1662 /* If not already recovering from an error, report this error. */
1666 #if ! YYERROR_VERBOSE
1667 yyerror (YY_("syntax error"));
1670 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1671 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1673 YYSIZE_T yyalloc = 2 * yysize;
1674 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1675 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1676 if (yymsg != yymsgbuf)
1677 YYSTACK_FREE (yymsg);
1678 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1680 yymsg_alloc = yyalloc;
1684 yymsg_alloc = sizeof yymsgbuf;
1688 if (0 < yysize && yysize <= yymsg_alloc)
1690 (void) yysyntax_error (yymsg, yystate, yychar);
1695 yyerror (YY_("syntax error"));
1697 goto yyexhaustedlab;
1705 if (yyerrstatus == 3)
1707 /* If just tried and failed to reuse look-ahead token after an
1708 error, discard it. */
1710 if (yychar <= YYEOF)
1712 /* Return failure if at end of input. */
1713 if (yychar == YYEOF)
1718 yydestruct ("Error: discarding",
1724 /* Else will try to reuse look-ahead token after shifting the error
1729 /*---------------------------------------------------.
1730 | yyerrorlab -- error raised explicitly by YYERROR. |
1731 `---------------------------------------------------*/
1734 /* Pacify compilers like GCC when the user code never invokes
1735 YYERROR and the label yyerrorlab therefore never appears in user
1737 if (/*CONSTCOND*/ 0)
1740 /* Do not reclaim the symbols of the rule which action triggered
1744 YY_STACK_PRINT (yyss, yyssp);
1749 /*-------------------------------------------------------------.
1750 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1751 `-------------------------------------------------------------*/
1753 yyerrstatus = 3; /* Each real token shifted decrements this. */
1757 yyn = yypact[yystate];
1758 if (yyn != YYPACT_NINF)
1761 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1769 /* Pop the current state because it cannot handle the error token. */
1774 yydestruct ("Error: popping",
1775 yystos[yystate], yyvsp);
1778 YY_STACK_PRINT (yyss, yyssp);
1787 /* Shift the error token. */
1788 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1794 /*-------------------------------------.
1795 | yyacceptlab -- YYACCEPT comes here. |
1796 `-------------------------------------*/
1801 /*-----------------------------------.
1802 | yyabortlab -- YYABORT comes here. |
1803 `-----------------------------------*/
1809 /*-------------------------------------------------.
1810 | yyexhaustedlab -- memory exhaustion comes here. |
1811 `-------------------------------------------------*/
1813 yyerror (YY_("memory exhausted"));
1819 if (yychar != YYEOF && yychar != YYEMPTY)
1820 yydestruct ("Cleanup: discarding lookahead",
1822 /* Do not reclaim the symbols of the rule which action triggered
1823 this YYABORT or YYACCEPT. */
1825 YY_STACK_PRINT (yyss, yyssp);
1826 while (yyssp != yyss)
1828 yydestruct ("Cleanup: popping",
1829 yystos[*yyssp], yyvsp);
1834 YYSTACK_FREE (yyss);
1837 if (yymsg != yymsgbuf)
1838 YYSTACK_FREE (yymsg);
1840 /* Make sure YYID is used. */
1841 return YYID (yyresult);
1845 #line 298 "./config_parser.y"
1848 int yyerror(char *msg)
1850 /* replace the $undefined and $end if exists */
1851 char *orig_msg = (char*)malloc(strlen(msg)+25);
1852 char *final_msg = (char*)malloc(strlen(msg)+25);
1854 strcpy(orig_msg, msg);
1856 char *word = strtok(orig_msg, " ");
1857 final_msg[0] = '\0';
1858 while (word != NULL) {
1859 if (!strncmp(word, "$undefined", 10)) {
1860 strcat(final_msg, "unrecognized-token ");
1861 } else if (!strncmp(word, "$end",4)) {
1862 strcat(final_msg, "end-of-file ");
1864 strcat(final_msg, word);
1865 strcat(final_msg, " ");
1867 word = strtok(NULL, " ");
1870 __sdp_log(9, "Error (line:%ld) : %s\n", __sdp_config_line_num, final_msg);
1881 /* parse apollo route dump file */
1882 int __sdp_parse_config (const char *fileName) {
1883 extern FILE * libsdp_yyin;
1886 if (access(fileName, R_OK)) {
1887 printf("libsdp Error: No access to open File:%s %s\n",
1888 fileName, strerror(errno));
1892 libsdp_yyin = fopen(fileName,"r");
1894 printf("libsdp Error: Fail to open File:%s\n", fileName);
1898 __sdp_config_line_num = 1;
1903 fclose(libsdp_yyin);