parser.c (69841B)
1 /************************************************************************* 2 * This file is part of Crosroads 1.23, a load balancer and fail over 3 * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. 4 * Visit http://crossroads.e-tunity.com for information. 5 *************************************************************************/ 6 /* A Bison parser, made from parser.y 7 by GNU bison 1.35. */ 8 9 #define YYBISON 1 /* Identify Bison output. */ 10 11 # define SERVICE 257 12 # define IDENTIFIER 258 13 # define PORT 259 14 # define NUMBER 260 15 # define BACKEND 261 16 # define VERBOSITY 262 17 # define SERVER 263 18 # define ON 264 19 # define OFF 265 20 # define DISPATCHMODE 266 21 # define ROUNDROBIN 267 22 # define REVIVINGINTERVAL 268 23 # define SHMKEY 269 24 # define WEIGHT 270 25 # define ONSTART 271 26 # define ONFAIL 272 27 # define STRING 273 28 # define BACKLOG 274 29 # define RANDOM 275 30 # define BYDURATION 276 31 # define BYSIZE 277 32 # define BYCONNECTIONS 278 33 # define CONNECTIONTIMEOUT 279 34 # define MAXCONNECTIONS 280 35 # define BYORDER 281 36 # define TRAFFICLOG 282 37 # define OVER 283 38 # define DECAY 284 39 # define BINDTO 285 40 # define THROUGHPUTLOG 286 41 # define TYPE 287 42 # define ANY 288 43 # define HTTP 289 44 # define STICKYCOOKIE 290 45 # define ADDCLIENTHEADER 291 46 # define SETCLIENTHEADER 292 47 # define APPENDCLIENTHEADER 293 48 # define ADDSERVERHEADER 294 49 # define SETSERVERHEADER 295 50 # define APPENDSERVERHEADER 296 51 # define ALLOWFROM 297 52 # define DENYFROM 298 53 # define ALLOWFILE 299 54 # define DENYFILE 300 55 # define EXTERNALHANDLER 301 56 # define ONEND 302 57 # define USERACCOUNT 303 58 59 #line 3 "parser.y" 60 61 /* Prologue */ 62 #include "crossroads.h" 63 64 #define YYSTYPE Confsets 65 66 /* Static parser vars */ 67 static int i; /* Loop counter */ 68 static Backend cur_backend; /* Storage for a handled backend */ 69 static Service cur_service; /* Storage for a handled service */ 70 71 /* Parser debugging related */ 72 // #define PARSER_DEBUG 73 #ifdef PARSER_DEBUG 74 static void pmsg (char const *x) { 75 printf ("P: %s\n", x); 76 } 77 static void psmsg (char const *x, char const *y) { 78 printf ("P: %s %s\n", x, y); 79 } 80 static void pimsg(char const *x, int y) { 81 printf ("P: %s %d\n", x, y); 82 } 83 #else 84 # define pmsg(x) 85 # define psmsg(x,y) 86 # define pimsg(x,y) 87 #endif 88 89 /* Error handler for yyparse() */ 90 static int yyerror (char *msg) { 91 error ("Parse error at line %d, '%s': %s", 92 yylineno + 1, yytext, yyerrmsg); 93 } 94 95 /* Store an encountered string */ 96 static char *laststr; 97 static void setlaststr (char const *what) { 98 free (laststr); 99 laststr = xstrdup (what); 100 } 101 102 /* Store an encountered number */ 103 static int lastnr; 104 static void setlastnr (char const *what) { 105 lastnr = atoi (what); 106 } 107 108 /* Store an encountered 'over' number */ 109 static int lastovernr; 110 static void setlastovernr (char const *what) { 111 lastovernr = atoi(what); 112 } 113 114 /* Store an encountered 'externalhandler' */ 115 static char *lastext; 116 static void setlastext (char const *what) { 117 free (lastext); 118 lastext = xstrdup (what); 119 } 120 121 /* Get the server part from HOSTNAME:PORT in allocated memory */ 122 static char *serverpart (char const *what) { 123 char *ret = xstrdup (what); 124 char *cp; 125 126 if ( (cp = strchr (ret, ':')) ) 127 *cp = 0; 128 return (ret); 129 } 130 131 /* Get the port part from HOSTNAME:PORT */ 132 static int portpart (char const *what) { 133 char *cp; 134 135 if ( (cp = strchr (what, ':')) ) 136 return (atoi (cp + 1)); 137 return (0); 138 } 139 140 /* Add a list of IP filters to the allowlist or the denylist */ 141 static void add_any (char *what, int chain) { 142 char *item; 143 int result; 144 for (item = strtok (what, " "); item; item = strtok (0, " ")) { 145 if (chain) 146 result = ipf_add_allow (&cur_service, item); 147 else 148 result = ipf_add_deny (&cur_service, item); 149 if (result) 150 error ("Bad IP filter specifier '%s' at line %d", 151 item, yylineno + 1); 152 } 153 } 154 static void add_allowfrom (char *what) { 155 add_any (what, 1); 156 } 157 static void add_denyfrom (char *what) { 158 add_any (what, 0); 159 } 160 161 /* Set uid/gid for external commands. */ 162 static void setuseraccount (char *username) { 163 struct passwd *pw; 164 165 if (! (pw = getpwnam (username)) ) 166 error ("Invalid username '%s' at line %d", username, yylineno + 1); 167 cur_service.uid = pw->pw_uid; 168 cur_service.gid = pw->pw_gid; 169 } 170 171 #ifndef YYSTYPE 172 # define YYSTYPE int 173 # define YYSTYPE_IS_TRIVIAL 1 174 #endif 175 #ifndef YYDEBUG 176 # define YYDEBUG 0 177 #endif 178 179 180 181 #define YYFINAL 197 182 #define YYFLAG -32768 183 #define YYNTBASE 53 184 185 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ 186 #define YYTRANSLATE(x) ((unsigned)(x) <= 303 ? yytranslate[x] : 132) 187 188 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ 189 static const char yytranslate[] = 190 { 191 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 196 2, 2, 2, 2, 2, 2, 2, 2, 2, 52, 197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 203 2, 2, 2, 50, 2, 51, 2, 2, 2, 2, 204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 208 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 211 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 212 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 214 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 215 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 216 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 217 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 218 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 219 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 220 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 221 46, 47, 48, 49 222 }; 223 224 #if YYDEBUG 225 static const short yyprhs[] = 226 { 227 0, 0, 3, 5, 11, 14, 17, 20, 22, 25, 228 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 229 47, 49, 51, 53, 55, 57, 61, 65, 68, 71, 230 74, 79, 81, 83, 88, 90, 92, 93, 96, 99, 231 101, 104, 106, 108, 110, 112, 114, 116, 118, 122, 232 125, 129, 133, 137, 141, 145, 149, 152, 154, 156, 233 160, 164, 168, 172, 175, 181, 184, 187, 189, 192, 234 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 235 214, 216, 218, 220, 222, 224, 226, 228, 233, 237, 236 241, 243, 247, 251, 255, 259, 263, 266, 269, 273, 237 276, 280, 284, 288, 292, 296, 300, 303, 304, 305, 238 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 239 316, 317, 318, 319, 320 240 }; 241 static const short yyrhs[] = 242 { 243 54, 53, 0, 54, 0, 55, 56, 50, 57, 51, 244 0, 118, 3, 0, 126, 4, 0, 57, 58, 0, 245 58, 0, 120, 59, 0, 60, 0, 61, 0, 65, 246 0, 67, 0, 76, 0, 77, 0, 78, 0, 79, 247 0, 80, 0, 81, 0, 84, 0, 86, 0, 85, 248 0, 87, 0, 74, 0, 89, 0, 5, 63, 64, 249 0, 31, 62, 64, 0, 128, 19, 0, 116, 6, 250 0, 121, 52, 0, 8, 122, 66, 64, 0, 10, 251 0, 11, 0, 12, 72, 68, 64, 0, 69, 0, 252 71, 0, 0, 29, 70, 0, 116, 6, 0, 103, 253 0, 123, 73, 0, 13, 0, 21, 0, 22, 0, 254 23, 0, 27, 0, 24, 0, 47, 0, 49, 75, 255 64, 0, 131, 19, 0, 14, 63, 64, 0, 20, 256 63, 64, 0, 15, 63, 64, 0, 25, 63, 64, 257 0, 26, 63, 64, 0, 33, 82, 64, 0, 129, 258 83, 0, 34, 0, 35, 0, 43, 88, 64, 0, 259 44, 88, 64, 0, 45, 104, 64, 0, 46, 104, 260 64, 0, 130, 19, 0, 7, 90, 50, 91, 51, 261 0, 127, 4, 0, 91, 92, 0, 92, 0, 119, 262 93, 0, 94, 0, 60, 0, 65, 0, 98, 0, 263 100, 0, 99, 0, 101, 0, 102, 0, 95, 0, 264 96, 0, 80, 0, 105, 0, 107, 0, 108, 0, 265 109, 0, 110, 0, 111, 0, 112, 0, 9, 117, 266 97, 64, 0, 16, 63, 64, 0, 30, 63, 64, 267 0, 19, 0, 17, 103, 64, 0, 18, 103, 64, 268 0, 48, 103, 64, 0, 28, 104, 64, 0, 32, 269 104, 64, 0, 124, 19, 0, 125, 19, 0, 36, 270 106, 64, 0, 115, 19, 0, 37, 113, 64, 0, 271 38, 113, 64, 0, 39, 113, 64, 0, 40, 113, 272 64, 0, 41, 113, 64, 0, 42, 113, 64, 0, 273 114, 19, 0, 0, 0, 0, 0, 0, 0, 0, 274 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 275 0 276 }; 277 278 #endif 279 280 #if YYDEBUG 281 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 282 static const short yyrline[] = 283 { 284 0, 130, 133, 137, 166, 171, 179, 182, 186, 191, 285 197, 203, 209, 219, 225, 231, 237, 243, 249, 255, 286 261, 267, 273, 279, 286, 439, 451, 463, 472, 479, 287 484, 497, 501, 507, 516, 518, 520, 524, 541, 548, 288 558, 567, 571, 575, 579, 583, 587, 591, 597, 609, 289 618, 630, 642, 654, 666, 678, 690, 695, 699, 705, 290 717, 729, 741, 753, 762, 772, 780, 788, 794, 801, 291 806, 811, 816, 821, 826, 831, 836, 841, 846, 851, 292 856, 861, 866, 871, 876, 881, 886, 893, 906, 918, 293 930, 936, 948, 960, 972, 984, 996, 1005, 1014, 1026, 294 1035, 1047, 1059, 1071, 1083, 1095, 1107, 1116, 1121, 1126, 295 1131, 1136, 1141, 1146, 1151, 1156, 1161, 1166, 1171, 1176, 296 1181, 1186, 1191, 1196, 1201 297 }; 298 #endif 299 300 301 #if (YYDEBUG) || defined YYERROR_VERBOSE 302 303 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ 304 static const char *const yytname[] = 305 { 306 "$", "error", "$undefined.", "SERVICE", "IDENTIFIER", "PORT", "NUMBER", 307 "BACKEND", "VERBOSITY", "SERVER", "ON", "OFF", "DISPATCHMODE", 308 "ROUNDROBIN", "REVIVINGINTERVAL", "SHMKEY", "WEIGHT", "ONSTART", 309 "ONFAIL", "STRING", "BACKLOG", "RANDOM", "BYDURATION", "BYSIZE", 310 "BYCONNECTIONS", "CONNECTIONTIMEOUT", "MAXCONNECTIONS", "BYORDER", 311 "TRAFFICLOG", "OVER", "DECAY", "BINDTO", "THROUGHPUTLOG", "TYPE", "ANY", 312 "HTTP", "STICKYCOOKIE", "ADDCLIENTHEADER", "SETCLIENTHEADER", 313 "APPENDCLIENTHEADER", "ADDSERVERHEADER", "SETSERVERHEADER", 314 "APPENDSERVERHEADER", "ALLOWFROM", "DENYFROM", "ALLOWFILE", "DENYFILE", 315 "EXTERNALHANDLER", "ONEND", "USERACCOUNT", "'{'", "'}'", "';'", "input", 316 "element", "service", "servicename", "servicestatements", 317 "servicestatement", "servicebody", "portstatement", "bindstatement", 318 "ipaddress", "number", "semicol", "verbositystatement", "onoff", 319 "dispatchmodestatement", "dispatchtail", "dispatchover", "overnumber", 320 "dispatchext", "dispatchmethod", "dispatchmethodspec", 321 "useraccountstatement", "useraccount", "revivingintervalstatement", 322 "backlogstatement", "shmkeystatement", "connectiontimeoutstatement", 323 "maxconnectionsstatement", "typestatement", "typespec", "typespecifier", 324 "allowfromstatement", "denyfromstatement", "allowfilestatement", 325 "denyfilestatement", "ipfilters", "backendblock", "backendname", 326 "backenddefinitions", "backenddefinition", "backendstatement", 327 "serverstatement", "weightstatement", "decaystatement", "serveraddress", 328 "onstartstatement", "onfailstatement", "onendstatement", 329 "dumptrafficstatement", "throughputstatement", "commandline", 330 "filename", "stickycookiestatement", "cookiespecifier", 331 "addclientheaderstatement", "setclientheaderstatement", 332 "appendclientheaderstatement", "addserverheaderstatement", 333 "setserverheaderstatement", "appendserverheaderstatement", 334 "headerstring", "headerstring_expected", "cookie_expected", 335 "number_expected", "serveraddress_expected", "service_expected", 336 "backendstatement_expected", "servicebody_expected", "semicol_expected", 337 "onoff_expected", "dispatchmethod_expected", "commandline_expected", 338 "filename_expected", "servicename_expected", "backendname_expected", 339 "ipaddress_expected", "type_expected", "ipfilters_expected", 340 "useraccount_expected", 0 341 }; 342 #endif 343 344 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 345 static const short yyr1[] = 346 { 347 0, 53, 53, 54, 55, 56, 57, 57, 58, 59, 348 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 349 59, 59, 59, 59, 59, 60, 61, 62, 63, 64, 350 65, 66, 66, 67, 68, 68, 68, 69, 70, 71, 351 72, 73, 73, 73, 73, 73, 73, 73, 74, 75, 352 76, 77, 78, 79, 80, 81, 82, 83, 83, 84, 353 85, 86, 87, 88, 89, 90, 91, 91, 92, 93, 354 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 355 93, 93, 93, 93, 93, 93, 93, 94, 95, 96, 356 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 357 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 358 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 359 127, 128, 129, 130, 131 360 }; 361 362 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 363 static const short yyr2[] = 364 { 365 0, 2, 1, 5, 2, 2, 2, 1, 2, 1, 366 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 367 1, 1, 1, 1, 1, 3, 3, 2, 2, 2, 368 4, 1, 1, 4, 1, 1, 0, 2, 2, 1, 369 2, 1, 1, 1, 1, 1, 1, 1, 3, 2, 370 3, 3, 3, 3, 3, 3, 2, 1, 1, 3, 371 3, 3, 3, 2, 5, 2, 2, 1, 2, 1, 372 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 373 1, 1, 1, 1, 1, 1, 1, 4, 3, 3, 374 1, 3, 3, 3, 3, 3, 2, 2, 3, 2, 375 3, 3, 3, 3, 3, 3, 2, 0, 0, 0, 376 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 377 0, 0, 0, 0, 0 378 }; 379 380 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE 381 doesn't specify something else to do. Zero means the default is an 382 error. */ 383 static const short yydefact[] = 384 { 385 111, 2, 119, 0, 1, 0, 0, 4, 113, 5, 386 113, 7, 0, 3, 6, 109, 120, 115, 116, 109, 387 109, 109, 109, 109, 121, 122, 123, 123, 118, 118, 388 124, 8, 9, 10, 11, 12, 23, 13, 14, 15, 389 16, 17, 18, 19, 21, 20, 22, 24, 114, 0, 390 0, 0, 0, 36, 0, 114, 114, 114, 114, 114, 391 114, 0, 114, 0, 114, 0, 114, 114, 0, 114, 392 114, 0, 25, 0, 28, 112, 65, 31, 32, 114, 393 109, 114, 34, 35, 39, 0, 41, 42, 43, 44, 394 46, 45, 47, 40, 50, 52, 51, 53, 54, 26, 395 27, 55, 57, 58, 56, 59, 63, 60, 61, 97, 396 62, 48, 49, 29, 112, 67, 0, 30, 37, 0, 397 33, 96, 64, 66, 110, 109, 117, 117, 118, 109, 398 118, 108, 107, 107, 107, 107, 107, 107, 117, 70, 399 71, 79, 68, 69, 77, 78, 72, 74, 73, 75, 400 76, 80, 81, 82, 83, 84, 85, 86, 38, 0, 401 114, 114, 114, 114, 114, 114, 114, 0, 114, 0, 402 114, 114, 114, 114, 114, 114, 90, 114, 88, 91, 403 92, 94, 89, 95, 98, 99, 100, 106, 101, 102, 404 103, 104, 105, 93, 87, 0, 0, 0 405 }; 406 407 static const short yydefgoto[] = 408 { 409 4, 1, 2, 5, 10, 11, 31, 32, 33, 60, 410 48, 72, 34, 79, 35, 81, 82, 118, 83, 53, 411 93, 36, 70, 37, 38, 39, 40, 41, 42, 62, 412 104, 43, 44, 45, 46, 64, 47, 50, 114, 115, 413 142, 143, 144, 145, 177, 146, 147, 148, 149, 150, 414 84, 67, 151, 166, 152, 153, 154, 155, 156, 157, 415 168, 169, 167, 49, 159, 3, 116, 12, 73, 52, 416 54, 85, 68, 6, 51, 61, 63, 65, 71 417 }; 418 419 static const short yypact[] = 420 { 421 -32768, 5,-32768, 7,-32768, -19, 29,-32768,-32768,-32768, 422 -12,-32768, 20,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 423 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 424 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 425 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 32, 426 -8, 39, 12, -13, 34,-32768,-32768,-32768,-32768,-32768, 427 -32768, 25,-32768, 2,-32768, 30,-32768,-32768, 31,-32768, 428 -32768, 33,-32768, -4,-32768,-32768,-32768,-32768,-32768,-32768, 429 -32768,-32768,-32768,-32768,-32768, 35,-32768,-32768,-32768,-32768, 430 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 431 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 432 -32768,-32768,-32768,-32768, 8,-32768, 116,-32768,-32768, 54, 433 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 434 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 435 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 436 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 43, 437 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 48,-32768, 49, 438 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 439 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 440 -32768,-32768,-32768,-32768,-32768, 75, 76,-32768 441 }; 442 443 static const short yypgoto[] = 444 { 445 77,-32768,-32768,-32768,-32768, 68,-32768, -37,-32768,-32768, 446 -2, -55, -36,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 447 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -34,-32768,-32768, 448 -32768,-32768,-32768,-32768,-32768, 56,-32768,-32768,-32768, -30, 449 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 450 -97, -16,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 451 -63,-32768,-32768, 6,-32768,-32768,-32768,-32768,-32768,-32768, 452 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768 453 }; 454 455 456 #define YYLAST 164 457 458 459 static const short yytable[] = 460 { 461 94, 95, 96, 97, 98, 99, -117, 101, -111, 105, 462 7, 107, 108, 69, 110, 111, 80, 55, 56, 57, 463 58, 59, 77, 78, 117, 15, 120, 16, 17, 161, 464 162, 8, 18, 9, 19, 20, 102, 103, 74, 13, 465 21, 175, 75, 76, 100, 22, 23, 86, 113, 106, 466 109, 24, 112, 25, 121, 87, 88, 89, 90, 122, 467 158, 91, 176, 26, 27, 28, 29, 185, 187, 30, 468 170, 171, 172, 173, 174, 196, 197, 195, 14, 139, 469 140, 92, 141, 66, 123, 0, 119, 0, 0, 0, 470 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 471 0, 0, 0, 0, 0, 178, 179, 180, 181, 182, 472 183, 184, 163, 186, 165, 188, 189, 190, 191, 192, 473 193, 15, 194, 160, 17, 124, 0, 164, 0, 0, 474 0, 0, 125, 126, 127, 0, 0, 0, 0, 0, 475 0, 0, 23, 0, 128, 0, 129, 0, 130, 0, 476 0, 0, 131, 132, 133, 134, 135, 136, 137, 0, 477 0, 0, 0, 0, 138 478 }; 479 480 static const short yycheck[] = 481 { 482 55, 56, 57, 58, 59, 60, 19, 62, 3, 64, 483 3, 66, 67, 29, 69, 70, 29, 19, 20, 21, 484 22, 23, 10, 11, 79, 5, 81, 7, 8, 126, 485 127, 50, 12, 4, 14, 15, 34, 35, 6, 51, 486 20, 138, 50, 4, 19, 25, 26, 13, 52, 19, 487 19, 31, 19, 33, 19, 21, 22, 23, 24, 51, 488 6, 27, 19, 43, 44, 45, 46, 19, 19, 49, 489 133, 134, 135, 136, 137, 0, 0, 0, 10, 116, 490 116, 47, 116, 27, 114, -1, 80, -1, -1, -1, 491 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 492 -1, -1, -1, -1, -1, 160, 161, 162, 163, 164, 493 165, 166, 128, 168, 130, 170, 171, 172, 173, 174, 494 175, 5, 177, 125, 8, 9, -1, 129, -1, -1, 495 -1, -1, 16, 17, 18, -1, -1, -1, -1, -1, 496 -1, -1, 26, -1, 28, -1, 30, -1, 32, -1, 497 -1, -1, 36, 37, 38, 39, 40, 41, 42, -1, 498 -1, -1, -1, -1, 48 499 }; 500 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 501 #line 3 "/sw/share/bison/bison.simple" 502 503 /* Skeleton output parser for bison, 504 505 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software 506 Foundation, Inc. 507 508 This program is free software; you can redistribute it and/or modify 509 it under the terms of the GNU General Public License as published by 510 the Free Software Foundation; either version 2, or (at your option) 511 any later version. 512 513 This program is distributed in the hope that it will be useful, 514 but WITHOUT ANY WARRANTY; without even the implied warranty of 515 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 516 GNU General Public License for more details. 517 518 You should have received a copy of the GNU General Public License 519 along with this program; if not, write to the Free Software 520 Foundation, Inc., 59 Temple Place - Suite 330, 521 Boston, MA 02111-1307, USA. */ 522 523 /* As a special exception, when this file is copied by Bison into a 524 Bison output file, you may use that output file without restriction. 525 This special exception was added by the Free Software Foundation 526 in version 1.24 of Bison. */ 527 528 /* This is the parser code that is written into each bison parser when 529 the %semantic_parser declaration is not specified in the grammar. 530 It was written by Richard Stallman by simplifying the hairy parser 531 used when %semantic_parser is specified. */ 532 533 /* All symbols defined below should begin with yy or YY, to avoid 534 infringing on user name space. This should be done even for local 535 variables, as they might otherwise be expanded by user macros. 536 There are some unavoidable exceptions within include files to 537 define necessary library symbols; they are noted "INFRINGES ON 538 USER NAME SPACE" below. */ 539 540 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) 541 542 /* The parser invokes alloca or malloc; define the necessary symbols. */ 543 544 # if YYSTACK_USE_ALLOCA 545 # define YYSTACK_ALLOC alloca 546 # else 547 # ifndef YYSTACK_USE_ALLOCA 548 # if defined (alloca) || defined (_ALLOCA_H) 549 # define YYSTACK_ALLOC alloca 550 # else 551 # ifdef __GNUC__ 552 # define YYSTACK_ALLOC __builtin_alloca 553 # endif 554 # endif 555 # endif 556 # endif 557 558 # ifdef YYSTACK_ALLOC 559 /* Pacify GCC's `empty if-body' warning. */ 560 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 561 # else 562 # if defined (__STDC__) || defined (__cplusplus) 563 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 564 # define YYSIZE_T size_t 565 # endif 566 # define YYSTACK_ALLOC malloc 567 # define YYSTACK_FREE free 568 # endif 569 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ 570 571 572 #if (! defined (yyoverflow) \ 573 && (! defined (__cplusplus) \ 574 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 575 576 /* A type that is properly aligned for any stack member. */ 577 union yyalloc 578 { 579 short yyss; 580 YYSTYPE yyvs; 581 # if YYLSP_NEEDED 582 YYLTYPE yyls; 583 # endif 584 }; 585 586 /* The size of the maximum gap between one aligned stack and the next. */ 587 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) 588 589 /* The size of an array large to enough to hold all stacks, each with 590 N elements. */ 591 # if YYLSP_NEEDED 592 # define YYSTACK_BYTES(N) \ 593 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ 594 + 2 * YYSTACK_GAP_MAX) 595 # else 596 # define YYSTACK_BYTES(N) \ 597 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ 598 + YYSTACK_GAP_MAX) 599 # endif 600 601 /* Copy COUNT objects from FROM to TO. The source and destination do 602 not overlap. */ 603 # ifndef YYCOPY 604 # if 1 < __GNUC__ 605 # define YYCOPY(To, From, Count) \ 606 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 607 # else 608 # define YYCOPY(To, From, Count) \ 609 do \ 610 { \ 611 register YYSIZE_T yyi; \ 612 for (yyi = 0; yyi < (Count); yyi++) \ 613 (To)[yyi] = (From)[yyi]; \ 614 } \ 615 while (0) 616 # endif 617 # endif 618 619 /* Relocate STACK from its old location to the new one. The 620 local variables YYSIZE and YYSTACKSIZE give the old and new number of 621 elements in the stack, and YYPTR gives the new location of the 622 stack. Advance YYPTR to a properly aligned location for the next 623 stack. */ 624 # define YYSTACK_RELOCATE(Stack) \ 625 do \ 626 { \ 627 YYSIZE_T yynewbytes; \ 628 YYCOPY (&yyptr->Stack, Stack, yysize); \ 629 Stack = &yyptr->Stack; \ 630 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ 631 yyptr += yynewbytes / sizeof (*yyptr); \ 632 } \ 633 while (0) 634 635 #endif 636 637 638 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) 639 # define YYSIZE_T __SIZE_TYPE__ 640 #endif 641 #if ! defined (YYSIZE_T) && defined (size_t) 642 # define YYSIZE_T size_t 643 #endif 644 #if ! defined (YYSIZE_T) 645 # if defined (__STDC__) || defined (__cplusplus) 646 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 647 # define YYSIZE_T size_t 648 # endif 649 #endif 650 #if ! defined (YYSIZE_T) 651 # define YYSIZE_T unsigned int 652 #endif 653 654 #define yyerrok (yyerrstatus = 0) 655 #define yyclearin (yychar = YYEMPTY) 656 #define YYEMPTY -2 657 #define YYEOF 0 658 #define YYACCEPT goto yyacceptlab 659 #define YYABORT goto yyabortlab 660 #define YYERROR goto yyerrlab1 661 /* Like YYERROR except do call yyerror. This remains here temporarily 662 to ease the transition to the new meaning of YYERROR, for GCC. 663 Once GCC version 2 has supplanted version 1, this can go. */ 664 #define YYFAIL goto yyerrlab 665 #define YYRECOVERING() (!!yyerrstatus) 666 #define YYBACKUP(Token, Value) \ 667 do \ 668 if (yychar == YYEMPTY && yylen == 1) \ 669 { \ 670 yychar = (Token); \ 671 yylval = (Value); \ 672 yychar1 = YYTRANSLATE (yychar); \ 673 YYPOPSTACK; \ 674 goto yybackup; \ 675 } \ 676 else \ 677 { \ 678 yyerror ("syntax error: cannot back up"); \ 679 YYERROR; \ 680 } \ 681 while (0) 682 683 #define YYTERROR 1 684 #define YYERRCODE 256 685 686 687 /* YYLLOC_DEFAULT -- Compute the default location (before the actions 688 are run). 689 690 When YYLLOC_DEFAULT is run, CURRENT is set the location of the 691 first token. By default, to implement support for ranges, extend 692 its range to the last symbol. */ 693 694 #ifndef YYLLOC_DEFAULT 695 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 696 Current.last_line = Rhs[N].last_line; \ 697 Current.last_column = Rhs[N].last_column; 698 #endif 699 700 701 /* YYLEX -- calling `yylex' with the right arguments. */ 702 703 #if YYPURE 704 # if YYLSP_NEEDED 705 # ifdef YYLEX_PARAM 706 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) 707 # else 708 # define YYLEX yylex (&yylval, &yylloc) 709 # endif 710 # else /* !YYLSP_NEEDED */ 711 # ifdef YYLEX_PARAM 712 # define YYLEX yylex (&yylval, YYLEX_PARAM) 713 # else 714 # define YYLEX yylex (&yylval) 715 # endif 716 # endif /* !YYLSP_NEEDED */ 717 #else /* !YYPURE */ 718 # define YYLEX yylex () 719 #endif /* !YYPURE */ 720 721 722 /* Enable debugging if requested. */ 723 #if YYDEBUG 724 725 # ifndef YYFPRINTF 726 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 727 # define YYFPRINTF fprintf 728 # endif 729 730 # define YYDPRINTF(Args) \ 731 do { \ 732 if (yydebug) \ 733 YYFPRINTF Args; \ 734 } while (0) 735 /* Nonzero means print parse trace. It is left uninitialized so that 736 multiple parsers can coexist. */ 737 int yydebug; 738 #else /* !YYDEBUG */ 739 # define YYDPRINTF(Args) 740 #endif /* !YYDEBUG */ 741 742 /* YYINITDEPTH -- initial size of the parser's stacks. */ 743 #ifndef YYINITDEPTH 744 # define YYINITDEPTH 200 745 #endif 746 747 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 748 if the built-in stack extension method is used). 749 750 Do not make this value too large; the results are undefined if 751 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) 752 evaluated with infinite-precision integer arithmetic. */ 753 754 #if YYMAXDEPTH == 0 755 # undef YYMAXDEPTH 756 #endif 757 758 #ifndef YYMAXDEPTH 759 # define YYMAXDEPTH 10000 760 #endif 761 762 #ifdef YYERROR_VERBOSE 763 764 # ifndef yystrlen 765 # if defined (__GLIBC__) && defined (_STRING_H) 766 # define yystrlen strlen 767 # else 768 /* Return the length of YYSTR. */ 769 static YYSIZE_T 770 # if defined (__STDC__) || defined (__cplusplus) 771 yystrlen (const char *yystr) 772 # else 773 yystrlen (yystr) 774 const char *yystr; 775 # endif 776 { 777 register const char *yys = yystr; 778 779 while (*yys++ != '\0') 780 continue; 781 782 return yys - yystr - 1; 783 } 784 # endif 785 # endif 786 787 # ifndef yystpcpy 788 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) 789 # define yystpcpy stpcpy 790 # else 791 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 792 YYDEST. */ 793 static char * 794 # if defined (__STDC__) || defined (__cplusplus) 795 yystpcpy (char *yydest, const char *yysrc) 796 # else 797 yystpcpy (yydest, yysrc) 798 char *yydest; 799 const char *yysrc; 800 # endif 801 { 802 register char *yyd = yydest; 803 register const char *yys = yysrc; 804 805 while ((*yyd++ = *yys++) != '\0') 806 continue; 807 808 return yyd - 1; 809 } 810 # endif 811 # endif 812 #endif 813 814 #line 315 "/sw/share/bison/bison.simple" 815 816 817 /* The user can define YYPARSE_PARAM as the name of an argument to be passed 818 into yyparse. The argument should have type void *. 819 It should actually point to an object. 820 Grammar actions can access the variable by casting it 821 to the proper pointer type. */ 822 823 #ifdef YYPARSE_PARAM 824 # if defined (__STDC__) || defined (__cplusplus) 825 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 826 # define YYPARSE_PARAM_DECL 827 # else 828 # define YYPARSE_PARAM_ARG YYPARSE_PARAM 829 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 830 # endif 831 #else /* !YYPARSE_PARAM */ 832 # define YYPARSE_PARAM_ARG 833 # define YYPARSE_PARAM_DECL 834 #endif /* !YYPARSE_PARAM */ 835 836 /* Prevent warning if -Wstrict-prototypes. */ 837 #ifdef __GNUC__ 838 # ifdef YYPARSE_PARAM 839 int yyparse (void *); 840 # else 841 int yyparse (void); 842 # endif 843 #endif 844 845 /* YY_DECL_VARIABLES -- depending whether we use a pure parser, 846 variables are global, or local to YYPARSE. */ 847 848 #define YY_DECL_NON_LSP_VARIABLES \ 849 /* The lookahead symbol. */ \ 850 int yychar; \ 851 \ 852 /* The semantic value of the lookahead symbol. */ \ 853 YYSTYPE yylval; \ 854 \ 855 /* Number of parse errors so far. */ \ 856 int yynerrs; 857 858 #if YYLSP_NEEDED 859 # define YY_DECL_VARIABLES \ 860 YY_DECL_NON_LSP_VARIABLES \ 861 \ 862 /* Location data for the lookahead symbol. */ \ 863 YYLTYPE yylloc; 864 #else 865 # define YY_DECL_VARIABLES \ 866 YY_DECL_NON_LSP_VARIABLES 867 #endif 868 869 870 /* If nonreentrant, generate the variables here. */ 871 872 #if !YYPURE 873 YY_DECL_VARIABLES 874 #endif /* !YYPURE */ 875 876 int 877 yyparse (YYPARSE_PARAM_ARG) 878 YYPARSE_PARAM_DECL 879 { 880 /* If reentrant, generate the variables here. */ 881 #if YYPURE 882 YY_DECL_VARIABLES 883 #endif /* !YYPURE */ 884 885 register int yystate; 886 register int yyn; 887 int yyresult; 888 /* Number of tokens to shift before error messages enabled. */ 889 int yyerrstatus; 890 /* Lookahead token as an internal (translated) token number. */ 891 int yychar1 = 0; 892 893 /* Three stacks and their tools: 894 `yyss': related to states, 895 `yyvs': related to semantic values, 896 `yyls': related to locations. 897 898 Refer to the stacks thru separate pointers, to allow yyoverflow 899 to reallocate them elsewhere. */ 900 901 /* The state stack. */ 902 short yyssa[YYINITDEPTH]; 903 short *yyss = yyssa; 904 register short *yyssp; 905 906 /* The semantic value stack. */ 907 YYSTYPE yyvsa[YYINITDEPTH]; 908 YYSTYPE *yyvs = yyvsa; 909 register YYSTYPE *yyvsp; 910 911 #if YYLSP_NEEDED 912 /* The location stack. */ 913 YYLTYPE yylsa[YYINITDEPTH]; 914 YYLTYPE *yyls = yylsa; 915 YYLTYPE *yylsp; 916 #endif 917 918 #if YYLSP_NEEDED 919 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 920 #else 921 # define YYPOPSTACK (yyvsp--, yyssp--) 922 #endif 923 924 YYSIZE_T yystacksize = YYINITDEPTH; 925 926 927 /* The variables used to return semantic value and location from the 928 action routines. */ 929 YYSTYPE yyval; 930 #if YYLSP_NEEDED 931 YYLTYPE yyloc; 932 #endif 933 934 /* When reducing, the number of symbols on the RHS of the reduced 935 rule. */ 936 int yylen; 937 938 YYDPRINTF ((stderr, "Starting parse\n")); 939 940 yystate = 0; 941 yyerrstatus = 0; 942 yynerrs = 0; 943 yychar = YYEMPTY; /* Cause a token to be read. */ 944 945 /* Initialize stack pointers. 946 Waste one element of value and location stack 947 so that they stay on the same level as the state stack. 948 The wasted elements are never initialized. */ 949 950 yyssp = yyss; 951 yyvsp = yyvs; 952 #if YYLSP_NEEDED 953 yylsp = yyls; 954 #endif 955 goto yysetstate; 956 957 /*------------------------------------------------------------. 958 | yynewstate -- Push a new state, which is found in yystate. | 959 `------------------------------------------------------------*/ 960 yynewstate: 961 /* In all cases, when you get here, the value and location stacks 962 have just been pushed. so pushing a state here evens the stacks. 963 */ 964 yyssp++; 965 966 yysetstate: 967 *yyssp = yystate; 968 969 if (yyssp >= yyss + yystacksize - 1) 970 { 971 /* Get the current used size of the three stacks, in elements. */ 972 YYSIZE_T yysize = yyssp - yyss + 1; 973 974 #ifdef yyoverflow 975 { 976 /* Give user a chance to reallocate the stack. Use copies of 977 these so that the &'s don't force the real ones into 978 memory. */ 979 YYSTYPE *yyvs1 = yyvs; 980 short *yyss1 = yyss; 981 982 /* Each stack pointer address is followed by the size of the 983 data in use in that stack, in bytes. */ 984 # if YYLSP_NEEDED 985 YYLTYPE *yyls1 = yyls; 986 /* This used to be a conditional around just the two extra args, 987 but that might be undefined if yyoverflow is a macro. */ 988 yyoverflow ("parser stack overflow", 989 &yyss1, yysize * sizeof (*yyssp), 990 &yyvs1, yysize * sizeof (*yyvsp), 991 &yyls1, yysize * sizeof (*yylsp), 992 &yystacksize); 993 yyls = yyls1; 994 # else 995 yyoverflow ("parser stack overflow", 996 &yyss1, yysize * sizeof (*yyssp), 997 &yyvs1, yysize * sizeof (*yyvsp), 998 &yystacksize); 999 # endif 1000 yyss = yyss1; 1001 yyvs = yyvs1; 1002 } 1003 #else /* no yyoverflow */ 1004 # ifndef YYSTACK_RELOCATE 1005 goto yyoverflowlab; 1006 # else 1007 /* Extend the stack our own way. */ 1008 if (yystacksize >= YYMAXDEPTH) 1009 goto yyoverflowlab; 1010 yystacksize *= 2; 1011 if (yystacksize > YYMAXDEPTH) 1012 yystacksize = YYMAXDEPTH; 1013 1014 { 1015 short *yyss1 = yyss; 1016 union yyalloc *yyptr = 1017 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1018 if (! yyptr) 1019 goto yyoverflowlab; 1020 YYSTACK_RELOCATE (yyss); 1021 YYSTACK_RELOCATE (yyvs); 1022 # if YYLSP_NEEDED 1023 YYSTACK_RELOCATE (yyls); 1024 # endif 1025 # undef YYSTACK_RELOCATE 1026 if (yyss1 != yyssa) 1027 YYSTACK_FREE (yyss1); 1028 } 1029 # endif 1030 #endif /* no yyoverflow */ 1031 1032 yyssp = yyss + yysize - 1; 1033 yyvsp = yyvs + yysize - 1; 1034 #if YYLSP_NEEDED 1035 yylsp = yyls + yysize - 1; 1036 #endif 1037 1038 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1039 (unsigned long int) yystacksize)); 1040 1041 if (yyssp >= yyss + yystacksize - 1) 1042 YYABORT; 1043 } 1044 1045 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1046 1047 goto yybackup; 1048 1049 1050 /*-----------. 1051 | yybackup. | 1052 `-----------*/ 1053 yybackup: 1054 1055 /* Do appropriate processing given the current state. */ 1056 /* Read a lookahead token if we need one and don't already have one. */ 1057 /* yyresume: */ 1058 1059 /* First try to decide what to do without reference to lookahead token. */ 1060 1061 yyn = yypact[yystate]; 1062 if (yyn == YYFLAG) 1063 goto yydefault; 1064 1065 /* Not known => get a lookahead token if don't already have one. */ 1066 1067 /* yychar is either YYEMPTY or YYEOF 1068 or a valid token in external form. */ 1069 1070 if (yychar == YYEMPTY) 1071 { 1072 YYDPRINTF ((stderr, "Reading a token: ")); 1073 yychar = YYLEX; 1074 } 1075 1076 /* Convert token to internal form (in yychar1) for indexing tables with */ 1077 1078 if (yychar <= 0) /* This means end of input. */ 1079 { 1080 yychar1 = 0; 1081 yychar = YYEOF; /* Don't call YYLEX any more */ 1082 1083 YYDPRINTF ((stderr, "Now at end of input.\n")); 1084 } 1085 else 1086 { 1087 yychar1 = YYTRANSLATE (yychar); 1088 1089 #if YYDEBUG 1090 /* We have to keep this `#if YYDEBUG', since we use variables 1091 which are defined only if `YYDEBUG' is set. */ 1092 if (yydebug) 1093 { 1094 YYFPRINTF (stderr, "Next token is %d (%s", 1095 yychar, yytname[yychar1]); 1096 /* Give the individual parser a way to print the precise 1097 meaning of a token, for further debugging info. */ 1098 # ifdef YYPRINT 1099 YYPRINT (stderr, yychar, yylval); 1100 # endif 1101 YYFPRINTF (stderr, ")\n"); 1102 } 1103 #endif 1104 } 1105 1106 yyn += yychar1; 1107 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) 1108 goto yydefault; 1109 1110 yyn = yytable[yyn]; 1111 1112 /* yyn is what to do for this token type in this state. 1113 Negative => reduce, -yyn is rule number. 1114 Positive => shift, yyn is new state. 1115 New state is final state => don't bother to shift, 1116 just return success. 1117 0, or most negative number => error. */ 1118 1119 if (yyn < 0) 1120 { 1121 if (yyn == YYFLAG) 1122 goto yyerrlab; 1123 yyn = -yyn; 1124 goto yyreduce; 1125 } 1126 else if (yyn == 0) 1127 goto yyerrlab; 1128 1129 if (yyn == YYFINAL) 1130 YYACCEPT; 1131 1132 /* Shift the lookahead token. */ 1133 YYDPRINTF ((stderr, "Shifting token %d (%s), ", 1134 yychar, yytname[yychar1])); 1135 1136 /* Discard the token being shifted unless it is eof. */ 1137 if (yychar != YYEOF) 1138 yychar = YYEMPTY; 1139 1140 *++yyvsp = yylval; 1141 #if YYLSP_NEEDED 1142 *++yylsp = yylloc; 1143 #endif 1144 1145 /* Count tokens shifted since error; after three, turn off error 1146 status. */ 1147 if (yyerrstatus) 1148 yyerrstatus--; 1149 1150 yystate = yyn; 1151 goto yynewstate; 1152 1153 1154 /*-----------------------------------------------------------. 1155 | yydefault -- do the default action for the current state. | 1156 `-----------------------------------------------------------*/ 1157 yydefault: 1158 yyn = yydefact[yystate]; 1159 if (yyn == 0) 1160 goto yyerrlab; 1161 goto yyreduce; 1162 1163 1164 /*-----------------------------. 1165 | yyreduce -- Do a reduction. | 1166 `-----------------------------*/ 1167 yyreduce: 1168 /* yyn is the number of a rule to reduce with. */ 1169 yylen = yyr2[yyn]; 1170 1171 /* If YYLEN is nonzero, implement the default value of the action: 1172 `$$ = $1'. 1173 1174 Otherwise, the following line sets YYVAL to the semantic value of 1175 the lookahead token. This behavior is undocumented and Bison 1176 users should not rely upon it. Assigning to YYVAL 1177 unconditionally makes the parser a bit smaller, and it avoids a 1178 GCC warning that YYVAL may be used uninitialized. */ 1179 yyval = yyvsp[1-yylen]; 1180 1181 #if YYLSP_NEEDED 1182 /* Similarly for the default location. Let the user run additional 1183 commands if for instance locations are ranges. */ 1184 yyloc = yylsp[1-yylen]; 1185 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); 1186 #endif 1187 1188 #if YYDEBUG 1189 /* We have to keep this `#if YYDEBUG', since we use variables which 1190 are defined only if `YYDEBUG' is set. */ 1191 if (yydebug) 1192 { 1193 int yyi; 1194 1195 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", 1196 yyn, yyrline[yyn]); 1197 1198 /* Print the symbols being reduced, and their result. */ 1199 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) 1200 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); 1201 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); 1202 } 1203 #endif 1204 1205 switch (yyn) { 1206 1207 case 3: 1208 #line 142 "parser.y" 1209 { 1210 /* Verify the service description, supply defaults 1211 * and so on. 1212 */ 1213 if (!cur_service.port) 1214 error ("Service %s lacks a port", 1215 cur_service.name); 1216 if (!cur_service.nbackend) 1217 error ("Service %s lacks back ends", 1218 cur_service.name); 1219 1220 if (!cur_service.shmkey) 1221 cur_service.shmkey = cur_service.port | SHM_MASK; 1222 1223 if (!cur_service.bind) 1224 cur_service.bind = "any"; 1225 1226 /* Add to the list. */ 1227 service = xrealloc (service, ++nservice * sizeof(Service)); 1228 service[nservice - 1] = cur_service; 1229 memset (&cur_service, 0, sizeof(Service)); 1230 ; 1231 break;} 1232 case 5: 1233 #line 173 "parser.y" 1234 { 1235 psmsg ("service:", yytext); 1236 cur_service.name = xstrdup(yytext); 1237 ; 1238 break;} 1239 case 9: 1240 #line 192 "parser.y" 1241 { 1242 pimsg ("sevice port:", yyvsp[0].set[0].v.ival); 1243 cur_service.port = yyvsp[0].set[0].v.ival; 1244 free (yyvsp[0].set); 1245 ; 1246 break;} 1247 case 10: 1248 #line 198 "parser.y" 1249 { 1250 psmsg ("service binding:", yyvsp[0].set[0].v.sval); 1251 cur_service.bind = yyvsp[0].set[0].v.sval; 1252 free (yyvsp[0].set); 1253 ; 1254 break;} 1255 case 11: 1256 #line 204 "parser.y" 1257 { 1258 pimsg ("service verbosity:", yyvsp[0].set[0].v.ival); 1259 cur_service.verbosity = yyvsp[0].set[0].v.ival; 1260 free (yyvsp[0].set); 1261 ; 1262 break;} 1263 case 12: 1264 #line 210 "parser.y" 1265 { 1266 pimsg ("service dispatch mode:", yyvsp[0].set[0].v.ival); 1267 pimsg ("service dispatch over:", lastovernr); 1268 psmsg ("service dispatch exth:", lastext); 1269 cur_service.dispatchtype = yyvsp[0].set[0].v.ival; 1270 cur_service.dispatchover = lastovernr; 1271 cur_service.dispatchext = lastext; 1272 free (yyvsp[0].set); 1273 ; 1274 break;} 1275 case 13: 1276 #line 220 "parser.y" 1277 { 1278 pimsg ("service revival interval:", yyvsp[0].set[0].v.ival); 1279 cur_service.rev_interval = yyvsp[0].set[0].v.ival; 1280 free (yyvsp[0].set); 1281 ; 1282 break;} 1283 case 14: 1284 #line 226 "parser.y" 1285 { 1286 pimsg ("service backlog:", yyvsp[0].set[0].v.ival); 1287 cur_service.backlog = yyvsp[0].set[0].v.ival; 1288 free (yyvsp[0].set); 1289 ; 1290 break;} 1291 case 15: 1292 #line 232 "parser.y" 1293 { 1294 pimsg ("service shmkey:", yyvsp[0].set[0].v.ival); 1295 cur_service.shmkey = yyvsp[0].set[0].v.ival; 1296 free (yyvsp[0].set); 1297 ; 1298 break;} 1299 case 16: 1300 #line 238 "parser.y" 1301 { 1302 pimsg ("connection timout:", yyvsp[0].set[0].v.ival); 1303 cur_service.connectiontimeout = yyvsp[0].set[0].v.ival; 1304 free (yyvsp[0].set); 1305 ; 1306 break;} 1307 case 17: 1308 #line 244 "parser.y" 1309 { 1310 pimsg ("max clients in service:", yyvsp[0].set[0].v.ival); 1311 cur_service.maxconnections = yyvsp[0].set[0].v.ival; 1312 free (yyvsp[0].set); 1313 ; 1314 break;} 1315 case 18: 1316 #line 250 "parser.y" 1317 { 1318 pimsg ("service type: ", yyvsp[0].set[0].v.ival); 1319 cur_service.type = yyvsp[0].set[0].v.ival; 1320 free (yyvsp[0].set); 1321 ; 1322 break;} 1323 case 19: 1324 #line 256 "parser.y" 1325 { 1326 psmsg ("allow from: ", yyvsp[0].set[0].v.sval); 1327 add_allowfrom (yyvsp[0].set[0].v.sval); 1328 free (yyvsp[0].set); 1329 ; 1330 break;} 1331 case 20: 1332 #line 262 "parser.y" 1333 { 1334 psmsg ("allow file: ", yyvsp[0].set[0].v.sval); 1335 cur_service.allowfile = yyvsp[0].set[0].v.sval; 1336 free (yyvsp[0].set); 1337 ; 1338 break;} 1339 case 21: 1340 #line 268 "parser.y" 1341 { 1342 psmsg ("deny from: ", yyvsp[0].set[0].v.sval); 1343 add_denyfrom (yyvsp[0].set[0].v.sval); 1344 free (yyvsp[0].set); 1345 ; 1346 break;} 1347 case 22: 1348 #line 274 "parser.y" 1349 { 1350 psmsg ("deny file: ", yyvsp[0].set[0].v.sval); 1351 cur_service.denyfile = yyvsp[0].set[0].v.sval; 1352 free (yyvsp[0].set); 1353 ; 1354 break;} 1355 case 23: 1356 #line 280 "parser.y" 1357 { 1358 psmsg ("user account: ", yyvsp[0].set[0].v.sval); 1359 setuseraccount (yyvsp[0].set[0].v.sval); 1360 free (yyvsp[0].set[0].v.sval); 1361 free (yyvsp[0].set); 1362 ; 1363 break;} 1364 case 24: 1365 #line 287 "parser.y" 1366 { 1367 pimsg ("converting backend statements, count is", yyvsp[0].n); 1368 for (i = 0; i < yyvsp[0].n; i++) 1369 switch (yyvsp[0].set[i].cf) { 1370 case cf_portspec: 1371 pimsg ("backend block port:", yyvsp[0].set[i].v.ival); 1372 cur_backend.port = yyvsp[0].set[i].v.ival; 1373 break; 1374 case cf_serverspec: 1375 psmsg ("backend block server:", yyvsp[0].set[i].v.sval); 1376 cur_backend.server = serverpart (yyvsp[0].set[i].v.sval); 1377 cur_backend.port = portpart (yyvsp[0].set[i].v.sval); 1378 free (yyvsp[0].set[i].v.sval); 1379 break; 1380 case cf_verbosityspec: 1381 pimsg ("backend block verbosity:", yyvsp[0].set[i].v.ival); 1382 cur_backend.verbosity = yyvsp[0].set[i].v.ival; 1383 break; 1384 case cf_onstartspec: 1385 psmsg ("backend block onstart:", yyvsp[0].set[i].v.sval); 1386 cur_backend.onstart = yyvsp[0].set[i].v.sval; 1387 break; 1388 case cf_onfailspec: 1389 psmsg ("backend block onfail:", yyvsp[0].set[i].v.sval); 1390 cur_backend.onfail = yyvsp[0].set[i].v.sval; 1391 break; 1392 case cf_onendspec: 1393 psmsg ("backend block onend:", yyvsp[0].set[i].v.sval); 1394 cur_backend.onend = yyvsp[0].set[i].v.sval; 1395 break; 1396 case cf_dumpspec: 1397 psmsg ("backend trafficlog:", yyvsp[0].set[i].v.sval); 1398 cur_backend.dumpfile = yyvsp[0].set[i].v.sval; 1399 break; 1400 case cf_thruspec: 1401 psmsg ("backend throughputlog:", yyvsp[0].set[i].v.sval); 1402 cur_backend.thruputfile = yyvsp[0].set[i].v.sval; 1403 break; 1404 case cf_weightspec: 1405 pimsg ("backend weight:", yyvsp[0].set[i].v.ival); 1406 cur_backend.weight = yyvsp[0].set[i].v.ival; 1407 break; 1408 case cf_decayspec: 1409 pimsg ("backend decay:", yyvsp[0].set[i].v.ival); 1410 if (yyvsp[0].set[i].v.ival >= 100) 1411 error ("Decay specifier %d must be a percentage, " 1412 "never more than 99", 1413 yyvsp[0].set[i].v.ival); 1414 cur_backend.decay = yyvsp[0].set[i].v.ival; 1415 break; 1416 case cf_maxconnectionsspec: 1417 pimsg ("backend max clients: ", yyvsp[0].set[i].v.ival); 1418 cur_backend.maxconnections = yyvsp[0].set[i].v.ival; 1419 break; 1420 case cf_stickycookiespec: 1421 psmsg ("backend sticky cookie:", 1422 yyvsp[0].set[i].v.sval); 1423 cur_backend.stickycookie = yyvsp[0].set[i].v.sval; 1424 break; 1425 case cf_addclientheaderspec: 1426 psmsg ("client header to add:", 1427 yyvsp[0].set[i].v.sval); 1428 cur_backend.addclientheader = 1429 xrealloc (cur_backend.addclientheader, 1430 (cur_backend.naddclientheader + 1) * 1431 sizeof(char*)); 1432 cur_backend.addclientheader 1433 [cur_backend.naddclientheader++] = 1434 yyvsp[0].set[i].v.sval; 1435 break; 1436 case cf_setclientheaderspec: 1437 psmsg ("client header to set:", 1438 yyvsp[0].set[i].v.sval); 1439 cur_backend.setclientheader = 1440 xrealloc (cur_backend.setclientheader, 1441 (cur_backend.nsetclientheader + 1) * 1442 sizeof(char*)); 1443 cur_backend.setclientheader 1444 [cur_backend.nsetclientheader++] = 1445 yyvsp[0].set[i].v.sval; 1446 break; 1447 case cf_appendclientheaderspec: 1448 psmsg ("client header to append:", 1449 yyvsp[0].set[i].v.sval); 1450 cur_backend.appendclientheader = 1451 xrealloc (cur_backend.appendclientheader, 1452 (cur_backend.nappendclientheader + 1) * 1453 sizeof(char*)); 1454 cur_backend.appendclientheader 1455 [cur_backend.nappendclientheader++] = 1456 yyvsp[0].set[i].v.sval; 1457 break; 1458 case cf_addserverheaderspec: 1459 psmsg ("server header to add:", 1460 yyvsp[0].set[i].v.sval); 1461 cur_backend.addserverheader = 1462 xrealloc (cur_backend.addserverheader, 1463 (cur_backend.naddserverheader + 1) * 1464 sizeof(char*)); 1465 cur_backend.addserverheader 1466 [cur_backend.naddserverheader++] = 1467 yyvsp[0].set[i].v.sval; 1468 break; 1469 case cf_setserverheaderspec: 1470 psmsg ("server header to set:", 1471 yyvsp[0].set[i].v.sval); 1472 cur_backend.setserverheader = 1473 xrealloc (cur_backend.setserverheader, 1474 (cur_backend.nsetserverheader + 1) * 1475 sizeof(char*)); 1476 cur_backend.setserverheader 1477 [cur_backend.nsetserverheader++] = 1478 yyvsp[0].set[i].v.sval; 1479 break; 1480 case cf_appendserverheaderspec: 1481 psmsg ("server header to append:", 1482 yyvsp[0].set[i].v.sval); 1483 cur_backend.appendserverheader = 1484 xrealloc (cur_backend.appendserverheader, 1485 (cur_backend.nappendserverheader + 1) * 1486 sizeof(char*)); 1487 cur_backend.appendserverheader 1488 [cur_backend.nappendserverheader++] = 1489 yyvsp[0].set[i].v.sval; 1490 break; 1491 default: 1492 error ("Internal jam, unhandled type %d " 1493 "in backend specification", 1494 yyvsp[0].set[i].cf); 1495 } 1496 free (yyvsp[0].set); 1497 1498 /* Verify the backend block, supply defaults, 1499 * And so on. 1500 */ 1501 if (!cur_service.port) 1502 error ("Back end %s lacks port", 1503 cur_service.port); 1504 if (!cur_backend.weight) 1505 cur_backend.weight = 1; 1506 1507 /* Add to the list. */ 1508 cur_service.backend = xrealloc (cur_service.backend, 1509 ++cur_service.nbackend * 1510 sizeof(Backend)); 1511 cur_service.backend[cur_service.nbackend - 1] = 1512 cur_backend; 1513 pimsg ("this was backend defintion", cur_service.nbackend); 1514 memset (&cur_backend, 0, sizeof(cur_backend)); 1515 ; 1516 break;} 1517 case 25: 1518 #line 442 "parser.y" 1519 { 1520 pimsg ("port statement:", lastnr); 1521 yyval.n = 1; 1522 yyval.set = xmalloc (sizeof(Confset)); 1523 yyval.set[0].cf = cf_portspec; 1524 yyval.set[0].v.ival = lastnr; 1525 ; 1526 break;} 1527 case 26: 1528 #line 454 "parser.y" 1529 { 1530 psmsg ("bindto statement:", laststr); 1531 yyval.n = 1; 1532 yyval.set = xmalloc (sizeof(Confset)); 1533 yyval.set[0].cf = cf_bindspec; 1534 yyval.set[0].v.sval = xstrdup(laststr); 1535 ; 1536 break;} 1537 case 27: 1538 #line 465 "parser.y" 1539 { 1540 setlaststr (laststring); 1541 free (laststring); 1542 laststring = 0; 1543 ; 1544 break;} 1545 case 28: 1546 #line 474 "parser.y" 1547 { 1548 setlastnr (yytext); 1549 ; 1550 break;} 1551 case 30: 1552 #line 488 "parser.y" 1553 { 1554 pimsg ("verbosity statement:", lastnr); 1555 yyval.n = 1; 1556 yyval.set = xmalloc (sizeof(Confset)); 1557 yyval.set[0].cf = cf_verbosityspec; 1558 yyval.set[0].v.ival = lastnr; 1559 ; 1560 break;} 1561 case 31: 1562 #line 498 "parser.y" 1563 { 1564 lastnr = 1; 1565 ; 1566 break;} 1567 case 32: 1568 #line 502 "parser.y" 1569 { 1570 lastnr = 0; 1571 ; 1572 break;} 1573 case 33: 1574 #line 511 "parser.y" 1575 { 1576 yyval = yyvsp[-2]; 1577 ; 1578 break;} 1579 case 37: 1580 #line 526 "parser.y" 1581 { 1582 pimsg ("dispatch mode statement:", lastnr); 1583 yyval.n = 1; 1584 yyval.set = xmalloc (sizeof(Confset)); 1585 yyval.set[0].cf = cf_dispatchspec; 1586 yyval.set[0].v.ival = lastnr; 1587 1588 if (lastovernr && 1589 (lastnr != ds_bysize && lastnr != ds_byduration)) 1590 error ("Service '%s': this dispatch mode " 1591 "doesn't support 'over <connections>'", 1592 cur_service.name); 1593 ; 1594 break;} 1595 case 38: 1596 #line 543 "parser.y" 1597 { 1598 setlastovernr (yytext); 1599 ; 1600 break;} 1601 case 39: 1602 #line 549 "parser.y" 1603 { 1604 psmsg ("external handler:", laststr); 1605 if (lastnr != ds_externalhandler) 1606 error ("Service %s: this dispatch mode doesn't support " 1607 "an external handler", cur_service.name); 1608 setlastext (laststr); 1609 ; 1610 break;} 1611 case 40: 1612 #line 560 "parser.y" 1613 { 1614 yyval.n = 1; 1615 yyval.set = xmalloc (sizeof(Confset)); 1616 yyval.set[0].v.ival = lastnr; 1617 ; 1618 break;} 1619 case 41: 1620 #line 568 "parser.y" 1621 { 1622 lastnr = ds_roundrobin; 1623 ; 1624 break;} 1625 case 42: 1626 #line 572 "parser.y" 1627 { 1628 lastnr = ds_random; 1629 ; 1630 break;} 1631 case 43: 1632 #line 576 "parser.y" 1633 { 1634 lastnr = ds_byduration; 1635 ; 1636 break;} 1637 case 44: 1638 #line 580 "parser.y" 1639 { 1640 lastnr = ds_bysize; 1641 ; 1642 break;} 1643 case 45: 1644 #line 584 "parser.y" 1645 { 1646 lastnr = ds_byorder; 1647 ; 1648 break;} 1649 case 46: 1650 #line 588 "parser.y" 1651 { 1652 lastnr = ds_byconnections; 1653 ; 1654 break;} 1655 case 47: 1656 #line 592 "parser.y" 1657 { 1658 lastnr = ds_externalhandler; 1659 ; 1660 break;} 1661 case 48: 1662 #line 600 "parser.y" 1663 { 1664 pimsg ("user account statement:", laststr); 1665 yyval.n = 1; 1666 yyval.set = xmalloc (sizeof(Confset)); 1667 yyval.set[0].cf = cf_useraccountspec; 1668 yyval.set[0].v.sval = xstrdup (laststr); 1669 ; 1670 break;} 1671 case 49: 1672 #line 611 "parser.y" 1673 { 1674 setlaststr (laststring); 1675 free (laststring); 1676 laststring = 0; 1677 ; 1678 break;} 1679 case 50: 1680 #line 621 "parser.y" 1681 { 1682 pimsg ("reviving interval statement:", lastnr); 1683 yyval.n = 1; 1684 yyval.set = xmalloc (sizeof(Confset)); 1685 yyval.set[0].cf = cf_revivespec; 1686 yyval.set[0].v.ival = lastnr; 1687 ; 1688 break;} 1689 case 51: 1690 #line 633 "parser.y" 1691 { 1692 pimsg ("backlog statement:", lastnr); 1693 yyval.n = 1; 1694 yyval.set = xmalloc (sizeof(Confset)); 1695 yyval.set[0].cf = cf_revivespec; 1696 yyval.set[0].v.ival = lastnr; 1697 ; 1698 break;} 1699 case 52: 1700 #line 645 "parser.y" 1701 { 1702 pimsg ("shmkey statement:", lastnr); 1703 yyval.n = 1; 1704 yyval.set = xmalloc (sizeof(Confset)); 1705 yyval.set[0].cf = cf_shmkeyspec; 1706 yyval.set[0].v.ival = lastnr; 1707 ; 1708 break;} 1709 case 53: 1710 #line 657 "parser.y" 1711 { 1712 pimsg ("connection timeout statement:", lastnr); 1713 yyval.n = 1; 1714 yyval.set = xmalloc (sizeof(Confset)); 1715 yyval.set[0].cf = cf_connectiontimeoutspec; 1716 yyval.set[0].v.ival = lastnr; 1717 ; 1718 break;} 1719 case 54: 1720 #line 669 "parser.y" 1721 { 1722 pimsg ("max clients statement (service):", lastnr); 1723 yyval.n = 1; 1724 yyval.set = xmalloc (sizeof(Confset)); 1725 yyval.set[0].cf = cf_maxconnectionsspec; 1726 yyval.set[0].v.ival = lastnr; 1727 ; 1728 break;} 1729 case 55: 1730 #line 681 "parser.y" 1731 { 1732 pimsg ("service type:", lastnr); 1733 yyval.n = 1; 1734 yyval.set = xmalloc (sizeof(Confset)); 1735 yyval.set[0].cf = cf_typespec; 1736 yyval.set[0].v.ival = lastnr; 1737 ; 1738 break;} 1739 case 57: 1740 #line 696 "parser.y" 1741 { 1742 lastnr = type_any; 1743 ; 1744 break;} 1745 case 58: 1746 #line 700 "parser.y" 1747 { 1748 lastnr = type_http; 1749 ; 1750 break;} 1751 case 59: 1752 #line 708 "parser.y" 1753 { 1754 psmsg ("allow from: ", laststr); 1755 yyval.n = 1; 1756 yyval.set = xmalloc (sizeof(Confset)); 1757 yyval.set[0].cf = cf_allowfromspec; 1758 yyval.set[0].v.sval = xstrdup(laststr); 1759 ; 1760 break;} 1761 case 60: 1762 #line 720 "parser.y" 1763 { 1764 psmsg ("allow from: ", laststr); 1765 yyval.n = 1; 1766 yyval.set = xmalloc (sizeof(Confset)); 1767 yyval.set[0].cf = cf_denyfromspec; 1768 yyval.set[0].v.sval = xstrdup(laststr); 1769 ; 1770 break;} 1771 case 61: 1772 #line 732 "parser.y" 1773 { 1774 psmsg ("allow file: ", laststr); 1775 yyval.n = 1; 1776 yyval.set = xmalloc (sizeof(Confset)); 1777 yyval.set[0].cf = cf_allowfilespec; 1778 yyval.set[0].v.sval = xstrdup(laststr); 1779 ; 1780 break;} 1781 case 62: 1782 #line 744 "parser.y" 1783 { 1784 psmsg ("allow file: ", laststr); 1785 yyval.n = 1; 1786 yyval.set = xmalloc (sizeof(Confset)); 1787 yyval.set[0].cf = cf_allowfilespec; 1788 yyval.set[0].v.sval = xstrdup(laststr); 1789 ; 1790 break;} 1791 case 63: 1792 #line 755 "parser.y" 1793 { 1794 setlaststr (laststring); 1795 free (laststring); 1796 laststring = 0; 1797 ; 1798 break;} 1799 case 64: 1800 #line 767 "parser.y" 1801 { 1802 yyval = yyvsp[-1]; 1803 ; 1804 break;} 1805 case 65: 1806 #line 774 "parser.y" 1807 { 1808 psmsg ("backend name:", yytext); 1809 cur_backend.name = xstrdup (yytext); 1810 ; 1811 break;} 1812 case 66: 1813 #line 782 "parser.y" 1814 { 1815 yyvsp[-1].n++; 1816 yyvsp[-1].set = xrealloc (yyvsp[-1].set, yyvsp[-1].n * sizeof(Confset)); 1817 yyvsp[-1].set[yyvsp[-1].n - 1] = yyvsp[0].set[0]; 1818 yyval = yyvsp[-1]; 1819 ; 1820 break;} 1821 case 67: 1822 #line 789 "parser.y" 1823 { 1824 yyval = yyvsp[0]; 1825 ; 1826 break;} 1827 case 68: 1828 #line 796 "parser.y" 1829 { 1830 yyval = yyvsp[0]; 1831 ; 1832 break;} 1833 case 69: 1834 #line 802 "parser.y" 1835 { 1836 psmsg ("backend server:", yyvsp[0].set[0].v.sval); 1837 yyval = yyvsp[0]; 1838 ; 1839 break;} 1840 case 70: 1841 #line 807 "parser.y" 1842 { 1843 pimsg ("backend port:", yyvsp[0].set[0].v.ival); 1844 yyval = yyvsp[0]; 1845 ; 1846 break;} 1847 case 71: 1848 #line 812 "parser.y" 1849 { 1850 pimsg ("backend verbosity:", yyvsp[0].set[0].v.ival); 1851 yyval = yyvsp[0]; 1852 ; 1853 break;} 1854 case 72: 1855 #line 817 "parser.y" 1856 { 1857 psmsg ("backend onstart:", yyvsp[0].set[0].v.sval); 1858 yyval = yyvsp[0]; 1859 ; 1860 break;} 1861 case 73: 1862 #line 822 "parser.y" 1863 { 1864 psmsg ("backend onend:", yyvsp[0].set[0].v.sval); 1865 yyval = yyvsp[0]; 1866 ; 1867 break;} 1868 case 74: 1869 #line 827 "parser.y" 1870 { 1871 psmsg ("backend onfail:", yyvsp[0].set[0].v.sval); 1872 yyval = yyvsp[0]; 1873 ; 1874 break;} 1875 case 75: 1876 #line 832 "parser.y" 1877 { 1878 psmsg ("backend trafficlog:", yyvsp[0].set[0].v.sval); 1879 yyval = yyvsp[0]; 1880 ; 1881 break;} 1882 case 76: 1883 #line 837 "parser.y" 1884 { 1885 psmsg ("backend trafficlog:", yyvsp[0].set[0].v.sval); 1886 yyval = yyvsp[0]; 1887 ; 1888 break;} 1889 case 77: 1890 #line 842 "parser.y" 1891 { 1892 pimsg ("backend weight:", yyvsp[0].set[0].v.ival); 1893 yyval = yyvsp[0]; 1894 ; 1895 break;} 1896 case 78: 1897 #line 847 "parser.y" 1898 { 1899 pimsg ("backend decay:", yyvsp[0].set[0].v.ival); 1900 yyval = yyvsp[0]; 1901 ; 1902 break;} 1903 case 79: 1904 #line 852 "parser.y" 1905 { 1906 pimsg ("backend maxconnections:", yyvsp[0].set[0].v.ival); 1907 yyval = yyvsp[0]; 1908 ; 1909 break;} 1910 case 80: 1911 #line 857 "parser.y" 1912 { 1913 psmsg ("backend sticky cookie:", yyvsp[0].set[0].v.sval); 1914 yyval = yyvsp[0]; 1915 ; 1916 break;} 1917 case 81: 1918 #line 862 "parser.y" 1919 { 1920 psmsg ("addclientheader:", yyvsp[0].set[0].v.sval); 1921 yyval = yyvsp[0]; 1922 ; 1923 break;} 1924 case 82: 1925 #line 867 "parser.y" 1926 { 1927 psmsg ("setclientheader:", yyvsp[0].set[0].v.sval); 1928 yyval = yyvsp[0]; 1929 ; 1930 break;} 1931 case 83: 1932 #line 872 "parser.y" 1933 { 1934 psmsg ("appendclientheader:", yyvsp[0].set[0].v.sval); 1935 yyval = yyvsp[0]; 1936 ; 1937 break;} 1938 case 84: 1939 #line 877 "parser.y" 1940 { 1941 psmsg ("addserverheader:", yyvsp[0].set[0].v.sval); 1942 yyval = yyvsp[0]; 1943 ; 1944 break;} 1945 case 85: 1946 #line 882 "parser.y" 1947 { 1948 psmsg ("setserverheader:", yyvsp[0].set[0].v.sval); 1949 yyval = yyvsp[0]; 1950 ; 1951 break;} 1952 case 86: 1953 #line 887 "parser.y" 1954 { 1955 psmsg ("appendserverheader:", yyvsp[0].set[0].v.sval); 1956 yyval = yyvsp[0]; 1957 ; 1958 break;} 1959 case 87: 1960 #line 897 "parser.y" 1961 { 1962 psmsg ("server statement:", laststr); 1963 yyval.n = 1; 1964 yyval.set = xmalloc (sizeof (Confset)); 1965 yyval.set[0].cf = cf_serverspec; 1966 yyval.set[0].v.sval = xstrdup (laststr); 1967 ; 1968 break;} 1969 case 88: 1970 #line 909 "parser.y" 1971 { 1972 pimsg ("weight statement", lastnr); 1973 yyval.n = 1; 1974 yyval.set = xmalloc (sizeof (Confset)); 1975 yyval.set[0].cf = cf_weightspec; 1976 yyval.set[0].v.ival = lastnr; 1977 ; 1978 break;} 1979 case 89: 1980 #line 921 "parser.y" 1981 { 1982 pimsg ("decay statement", lastnr); 1983 yyval.n = 1; 1984 yyval.set = xmalloc (sizeof (Confset)); 1985 yyval.set[0].cf = cf_decayspec; 1986 yyval.set[0].v.ival = lastnr; 1987 ; 1988 break;} 1989 case 90: 1990 #line 931 "parser.y" 1991 { 1992 setlaststr (laststring); 1993 ; 1994 break;} 1995 case 91: 1996 #line 939 "parser.y" 1997 { 1998 psmsg ("onstart statement:", laststr); 1999 yyval.n = 1; 2000 yyval.set = xmalloc (sizeof (Confset)); 2001 yyval.set[0].cf = cf_onstartspec; 2002 yyval.set[0].v.sval = xstrdup (laststr); 2003 ; 2004 break;} 2005 case 92: 2006 #line 951 "parser.y" 2007 { 2008 psmsg ("onfail statement:", laststr); 2009 yyval.n = 1; 2010 yyval.set = xmalloc (sizeof (Confset)); 2011 yyval.set[0].cf = cf_onfailspec; 2012 yyval.set[0].v.sval = xstrdup (laststr); 2013 ; 2014 break;} 2015 case 93: 2016 #line 963 "parser.y" 2017 { 2018 psmsg ("onend statement:", laststr); 2019 yyval.n = 1; 2020 yyval.set = xmalloc (sizeof (Confset)); 2021 yyval.set[0].cf = cf_onendspec; 2022 yyval.set[0].v.sval = xstrdup (laststr); 2023 ; 2024 break;} 2025 case 94: 2026 #line 975 "parser.y" 2027 { 2028 psmsg ("trafficlog statement:", laststr); 2029 yyval.n = 1; 2030 yyval.set = xmalloc (sizeof (Confset)); 2031 yyval.set[0].cf = cf_dumpspec; 2032 yyval.set[0].v.sval = xstrdup (laststr); 2033 ; 2034 break;} 2035 case 95: 2036 #line 987 "parser.y" 2037 { 2038 psmsg ("throughputlog statement:", laststr); 2039 yyval.n = 1; 2040 yyval.set = xmalloc (sizeof (Confset)); 2041 yyval.set[0].cf = cf_thruspec; 2042 yyval.set[0].v.sval = xstrdup (laststr); 2043 ; 2044 break;} 2045 case 96: 2046 #line 998 "parser.y" 2047 { 2048 setlaststr (laststring); 2049 free (laststring); 2050 laststring = 0; 2051 ; 2052 break;} 2053 case 97: 2054 #line 1007 "parser.y" 2055 { 2056 setlaststr (laststring); 2057 free (laststring); 2058 laststring = 0; 2059 ; 2060 break;} 2061 case 98: 2062 #line 1017 "parser.y" 2063 { 2064 psmsg ("insertcookie statement:", laststr); 2065 yyval.n = 1; 2066 yyval.set = xmalloc (sizeof (Confset)); 2067 yyval.set[0].cf = cf_stickycookiespec; 2068 yyval.set[0].v.sval = xstrdup (laststr); 2069 ; 2070 break;} 2071 case 99: 2072 #line 1028 "parser.y" 2073 { 2074 setlaststr (laststring); 2075 free (laststring); 2076 laststring = 0; 2077 ; 2078 break;} 2079 case 100: 2080 #line 1038 "parser.y" 2081 { 2082 psmsg ("addclientheader statement:", laststr); 2083 yyval.n = 1; 2084 yyval.set = xmalloc (sizeof(Confset)); 2085 yyval.set[0].cf = cf_addclientheaderspec; 2086 yyval.set[0].v.sval = xstrdup (laststr); 2087 ; 2088 break;} 2089 case 101: 2090 #line 1050 "parser.y" 2091 { 2092 psmsg ("setclientheader statement:", laststr); 2093 yyval.n = 1; 2094 yyval.set = xmalloc (sizeof(Confset)); 2095 yyval.set[0].cf = cf_setclientheaderspec; 2096 yyval.set[0].v.sval = xstrdup (laststr); 2097 ; 2098 break;} 2099 case 102: 2100 #line 1062 "parser.y" 2101 { 2102 psmsg ("appendclientheader statement:", laststr); 2103 yyval.n = 1; 2104 yyval.set = xmalloc (sizeof(Confset)); 2105 yyval.set[0].cf = cf_appendclientheaderspec; 2106 yyval.set[0].v.sval = xstrdup (laststr); 2107 ; 2108 break;} 2109 case 103: 2110 #line 1074 "parser.y" 2111 { 2112 psmsg ("addserverheader statement:", laststr); 2113 yyval.n = 1; 2114 yyval.set = xmalloc (sizeof(Confset)); 2115 yyval.set[0].cf = cf_addserverheaderspec; 2116 yyval.set[0].v.sval = xstrdup (laststr); 2117 ; 2118 break;} 2119 case 104: 2120 #line 1086 "parser.y" 2121 { 2122 psmsg ("setserverheader statement:", laststr); 2123 yyval.n = 1; 2124 yyval.set = xmalloc (sizeof(Confset)); 2125 yyval.set[0].cf = cf_setserverheaderspec; 2126 yyval.set[0].v.sval = xstrdup (laststr); 2127 ; 2128 break;} 2129 case 105: 2130 #line 1098 "parser.y" 2131 { 2132 psmsg ("appendserverheader statement:", laststr); 2133 yyval.n = 1; 2134 yyval.set = xmalloc (sizeof(Confset)); 2135 yyval.set[0].cf = cf_appendserverheaderspec; 2136 yyval.set[0].v.sval = xstrdup (laststr); 2137 ; 2138 break;} 2139 case 106: 2140 #line 1109 "parser.y" 2141 { 2142 setlaststr (laststring); 2143 free (laststring); 2144 laststring = 0; 2145 ; 2146 break;} 2147 case 107: 2148 #line 1116 "parser.y" 2149 { 2150 yyerrmsg = "HTTP header specifier expected"; 2151 ; 2152 break;} 2153 case 108: 2154 #line 1121 "parser.y" 2155 { 2156 yyerrmsg = "cookie specifier expected"; 2157 ; 2158 break;} 2159 case 109: 2160 #line 1126 "parser.y" 2161 { 2162 yyerrmsg = "number expected"; 2163 ; 2164 break;} 2165 case 110: 2166 #line 1131 "parser.y" 2167 { 2168 yyerrmsg = "hostname or IP address expected"; 2169 ; 2170 break;} 2171 case 111: 2172 #line 1136 "parser.y" 2173 { 2174 yyerrmsg = "'service' expected"; 2175 ; 2176 break;} 2177 case 112: 2178 #line 1141 "parser.y" 2179 { 2180 yyerrmsg = "backend definition statement expected"; 2181 ; 2182 break;} 2183 case 113: 2184 #line 1146 "parser.y" 2185 { 2186 yyerrmsg = "service body statement expected"; 2187 ; 2188 break;} 2189 case 114: 2190 #line 1151 "parser.y" 2191 { 2192 yyerrmsg = "semicolon (;) expected"; 2193 ; 2194 break;} 2195 case 115: 2196 #line 1156 "parser.y" 2197 { 2198 yyerrmsg = "'on' or 'off' expetcted"; 2199 ; 2200 break;} 2201 case 116: 2202 #line 1161 "parser.y" 2203 { 2204 yyerrmsg = "dispatch method expected"; 2205 ; 2206 break;} 2207 case 117: 2208 #line 1166 "parser.y" 2209 { 2210 yyerrmsg = "command line expected"; 2211 ; 2212 break;} 2213 case 118: 2214 #line 1171 "parser.y" 2215 { 2216 yyerrmsg = "file name expected"; 2217 ; 2218 break;} 2219 case 119: 2220 #line 1176 "parser.y" 2221 { 2222 yyerrmsg = "service name (identifier) expected"; 2223 ; 2224 break;} 2225 case 120: 2226 #line 1181 "parser.y" 2227 { 2228 yyerrmsg = "backend name (identifier) expected"; 2229 ; 2230 break;} 2231 case 121: 2232 #line 1186 "parser.y" 2233 { 2234 yyerrmsg = "IP address or 'any' expected"; 2235 ; 2236 break;} 2237 case 122: 2238 #line 1191 "parser.y" 2239 { 2240 yyerrmsg = "Service type expected ('any', 'stickyhttp', ...)"; 2241 ; 2242 break;} 2243 case 123: 2244 #line 1196 "parser.y" 2245 { 2246 yyerrmsg = "IP filter(s) expected"; 2247 ; 2248 break;} 2249 case 124: 2250 #line 1201 "parser.y" 2251 { 2252 yyerrmsg = "username expected"; 2253 ; 2254 break;} 2255 } 2256 2257 #line 705 "/sw/share/bison/bison.simple" 2258 2259 2260 yyvsp -= yylen; 2261 yyssp -= yylen; 2262 #if YYLSP_NEEDED 2263 yylsp -= yylen; 2264 #endif 2265 2266 #if YYDEBUG 2267 if (yydebug) 2268 { 2269 short *yyssp1 = yyss - 1; 2270 YYFPRINTF (stderr, "state stack now"); 2271 while (yyssp1 != yyssp) 2272 YYFPRINTF (stderr, " %d", *++yyssp1); 2273 YYFPRINTF (stderr, "\n"); 2274 } 2275 #endif 2276 2277 *++yyvsp = yyval; 2278 #if YYLSP_NEEDED 2279 *++yylsp = yyloc; 2280 #endif 2281 2282 /* Now `shift' the result of the reduction. Determine what state 2283 that goes to, based on the state we popped back to and the rule 2284 number reduced by. */ 2285 2286 yyn = yyr1[yyn]; 2287 2288 yystate = yypgoto[yyn - YYNTBASE] + *yyssp; 2289 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2290 yystate = yytable[yystate]; 2291 else 2292 yystate = yydefgoto[yyn - YYNTBASE]; 2293 2294 goto yynewstate; 2295 2296 2297 /*------------------------------------. 2298 | yyerrlab -- here on detecting error | 2299 `------------------------------------*/ 2300 yyerrlab: 2301 /* If not already recovering from an error, report this error. */ 2302 if (!yyerrstatus) 2303 { 2304 ++yynerrs; 2305 2306 #ifdef YYERROR_VERBOSE 2307 yyn = yypact[yystate]; 2308 2309 if (yyn > YYFLAG && yyn < YYLAST) 2310 { 2311 YYSIZE_T yysize = 0; 2312 char *yymsg; 2313 int yyx, yycount; 2314 2315 yycount = 0; 2316 /* Start YYX at -YYN if negative to avoid negative indexes in 2317 YYCHECK. */ 2318 for (yyx = yyn < 0 ? -yyn : 0; 2319 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) 2320 if (yycheck[yyx + yyn] == yyx) 2321 yysize += yystrlen (yytname[yyx]) + 15, yycount++; 2322 yysize += yystrlen ("parse error, unexpected ") + 1; 2323 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); 2324 yymsg = (char *) YYSTACK_ALLOC (yysize); 2325 if (yymsg != 0) 2326 { 2327 char *yyp = yystpcpy (yymsg, "parse error, unexpected "); 2328 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); 2329 2330 if (yycount < 5) 2331 { 2332 yycount = 0; 2333 for (yyx = yyn < 0 ? -yyn : 0; 2334 yyx < (int) (sizeof (yytname) / sizeof (char *)); 2335 yyx++) 2336 if (yycheck[yyx + yyn] == yyx) 2337 { 2338 const char *yyq = ! yycount ? ", expecting " : " or "; 2339 yyp = yystpcpy (yyp, yyq); 2340 yyp = yystpcpy (yyp, yytname[yyx]); 2341 yycount++; 2342 } 2343 } 2344 yyerror (yymsg); 2345 YYSTACK_FREE (yymsg); 2346 } 2347 else 2348 yyerror ("parse error; also virtual memory exhausted"); 2349 } 2350 else 2351 #endif /* defined (YYERROR_VERBOSE) */ 2352 yyerror ("parse error"); 2353 } 2354 goto yyerrlab1; 2355 2356 2357 /*--------------------------------------------------. 2358 | yyerrlab1 -- error raised explicitly by an action | 2359 `--------------------------------------------------*/ 2360 yyerrlab1: 2361 if (yyerrstatus == 3) 2362 { 2363 /* If just tried and failed to reuse lookahead token after an 2364 error, discard it. */ 2365 2366 /* return failure if at end of input */ 2367 if (yychar == YYEOF) 2368 YYABORT; 2369 YYDPRINTF ((stderr, "Discarding token %d (%s).\n", 2370 yychar, yytname[yychar1])); 2371 yychar = YYEMPTY; 2372 } 2373 2374 /* Else will try to reuse lookahead token after shifting the error 2375 token. */ 2376 2377 yyerrstatus = 3; /* Each real token shifted decrements this */ 2378 2379 goto yyerrhandle; 2380 2381 2382 /*-------------------------------------------------------------------. 2383 | yyerrdefault -- current state does not do anything special for the | 2384 | error token. | 2385 `-------------------------------------------------------------------*/ 2386 yyerrdefault: 2387 #if 0 2388 /* This is wrong; only states that explicitly want error tokens 2389 should shift them. */ 2390 2391 /* If its default is to accept any token, ok. Otherwise pop it. */ 2392 yyn = yydefact[yystate]; 2393 if (yyn) 2394 goto yydefault; 2395 #endif 2396 2397 2398 /*---------------------------------------------------------------. 2399 | yyerrpop -- pop the current state because it cannot handle the | 2400 | error token | 2401 `---------------------------------------------------------------*/ 2402 yyerrpop: 2403 if (yyssp == yyss) 2404 YYABORT; 2405 yyvsp--; 2406 yystate = *--yyssp; 2407 #if YYLSP_NEEDED 2408 yylsp--; 2409 #endif 2410 2411 #if YYDEBUG 2412 if (yydebug) 2413 { 2414 short *yyssp1 = yyss - 1; 2415 YYFPRINTF (stderr, "Error: state stack now"); 2416 while (yyssp1 != yyssp) 2417 YYFPRINTF (stderr, " %d", *++yyssp1); 2418 YYFPRINTF (stderr, "\n"); 2419 } 2420 #endif 2421 2422 /*--------------. 2423 | yyerrhandle. | 2424 `--------------*/ 2425 yyerrhandle: 2426 yyn = yypact[yystate]; 2427 if (yyn == YYFLAG) 2428 goto yyerrdefault; 2429 2430 yyn += YYTERROR; 2431 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) 2432 goto yyerrdefault; 2433 2434 yyn = yytable[yyn]; 2435 if (yyn < 0) 2436 { 2437 if (yyn == YYFLAG) 2438 goto yyerrpop; 2439 yyn = -yyn; 2440 goto yyreduce; 2441 } 2442 else if (yyn == 0) 2443 goto yyerrpop; 2444 2445 if (yyn == YYFINAL) 2446 YYACCEPT; 2447 2448 YYDPRINTF ((stderr, "Shifting error token, ")); 2449 2450 *++yyvsp = yylval; 2451 #if YYLSP_NEEDED 2452 *++yylsp = yylloc; 2453 #endif 2454 2455 yystate = yyn; 2456 goto yynewstate; 2457 2458 2459 /*-------------------------------------. 2460 | yyacceptlab -- YYACCEPT comes here. | 2461 `-------------------------------------*/ 2462 yyacceptlab: 2463 yyresult = 0; 2464 goto yyreturn; 2465 2466 /*-----------------------------------. 2467 | yyabortlab -- YYABORT comes here. | 2468 `-----------------------------------*/ 2469 yyabortlab: 2470 yyresult = 1; 2471 goto yyreturn; 2472 2473 /*---------------------------------------------. 2474 | yyoverflowab -- parser overflow comes here. | 2475 `---------------------------------------------*/ 2476 yyoverflowlab: 2477 yyerror ("parser stack overflow"); 2478 yyresult = 2; 2479 /* Fall through. */ 2480 2481 yyreturn: 2482 #ifndef yyoverflow 2483 if (yyss != yyssa) 2484 YYSTACK_FREE (yyss); 2485 #endif 2486 return yyresult; 2487 } 2488 #line 1205 "parser.y"