http://gimel.esc.cam.ac.uk/james/rpld/src/rpld-1.5.tar.gz
[rpld.git] / rpld_conf.tab.c
index 613f122..12a226e 100644 (file)
@@ -8,9 +8,9 @@ static char yysccsid[] = "@(#)yaccpar   1.9 (Berkeley) 02/21/93";
 #define yyerrok (yyerrflag=0)
 #define YYRECOVERING (yyerrflag!=0)
 #define YYPREFIX "yy"
-#line 65 "rpld_conf.y"
+#line 77 "rpld_conf.y"
 
-static char rcsid[]="$Id: rpld_conf.y,v 1.3 2000/07/16 13:18:10 root Exp root $";
+static char rcsid[]="$Id: rpld_conf.y,v 1.7 2000/07/23 19:14:19 root Exp $";
 
 #include "project.h"
 
@@ -21,54 +21,59 @@ typedef enum {INIT, GLOBALBLOCK, HOSTBLOCK, FILEBLOCK} STATE ;
 
 /*void process_thing(THING thing, char *name, int type, YYSTYPE *pvalue);*/
 
-#line 81 "rpld_conf.y"
+#line 93 "rpld_conf.y"
 typedef union {
                long number;
                char *name;
                char *text;
                char mac_address[6];
+               struct partial_mac {
+                       char mac_address[6];
+                       int mac_len;
+               } pm;
        } YYSTYPE;
-#line 32 "rpld_conf.tab.c"
+#line 36 "rpld_conf.tab.c"
 #define BLOCK_START 257
 #define BLOCK_END 258
 #define NAME 259
 #define TEXT 260
 #define NUMBER 261
 #define MACADDR 262
+#define MACADDR_PARTIAL 263
 #define YYERRCODE 256
 short yylhs[] = {                                        -1,
     0,    0,    1,    1,    2,    2,    3,    3,    3,    4,
-    4,    4,    4,    4,
+    4,    4,    4,    4,    4,
 };
 short yylen[] = {                                         2,
     2,    3,    3,    2,    2,    1,    1,    2,    3,    1,
-    3,    3,    3,    1,
+    3,    3,    3,    3,    1,
 };
 short yydefred[] = {                                      0,
     6,    0,    0,    0,    0,    5,    0,    1,    4,    0,
-    7,   14,    0,    0,    2,    0,    3,    0,    8,   11,
-   12,   13,    9,
+    7,   15,    0,    0,    2,    0,    3,    0,    8,   11,
+   12,   13,   14,    9,
 };
 short yydgoto[] = {                                       3,
    12,    5,   13,   14,
 };
 short yysindex[] = {                                   -244,
-    0, -254, -244,  -55,  -59,    0,  -50,    0,    0,  -60,
-    0,    0, -251,  -45,    0, -250,    0,  -43,    0,    0,
-    0,    0,    0,
+    0, -250, -244,  -51,  -59,    0,  -45,    0,    0,  -60,
+    0,    0, -247,  -43,    0, -258,    0,  -42,    0,    0,
+    0,    0,    0,    0,
 };
 short yyrindex[] = {                                      0,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,  -42,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  -41,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-    0,    0,    0,
+    0,    0,    0,    0,
 };
 short yygindex[] = {                                      0,
-    2,    0,    0,    5,
+    6,    0,    0,    7,
 };
 #define YYTABLESIZE 200
 short yytable[] = {                                      11,
-   16,    4,    6,    8,    7,    1,   17,   10,   15,   20,
-   21,   22,    1,   19,    2,   23,   10,   18,    0,    0,
+   16,   20,   21,   22,   23,    4,    6,    8,    7,    1,
+   17,   10,    1,   15,    2,   19,   24,   10,    0,   18,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
@@ -89,8 +94,8 @@ short yytable[] = {                                      11,
     0,    0,    0,    0,    0,    0,    6,    1,    9,   10,
 };
 short yycheck[] = {                                      59,
-   61,    0,  257,   59,    3,  257,  258,  259,   59,  260,
-  261,  262,  257,   59,  259,   59,   59,   13,   -1,   -1,
+   61,  260,  261,  262,  263,    0,  257,   59,    3,  257,
+  258,  259,  257,   59,  259,   59,   59,   59,   -1,   13,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
@@ -114,7 +119,7 @@ short yycheck[] = {                                      59,
 #ifndef YYDEBUG
 #define YYDEBUG 0
 #endif
-#define YYMAXTOKEN 262
+#define YYMAXTOKEN 263
 #if YYDEBUG
 char *yyname[] = {
 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -124,7 +129,7 @@ char *yyname[] = {
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"BLOCK_START","BLOCK_END",
-"NAME","TEXT","NUMBER","MACADDR",
+"NAME","TEXT","NUMBER","MACADDR","MACADDR_PARTIAL",
 };
 char *yyrule[] = {
 "$accept : block_list",
@@ -141,6 +146,7 @@ char *yyrule[] = {
 "statement : NAME '=' TEXT",
 "statement : NAME '=' NUMBER",
 "statement : NAME '=' MACADDR",
+"statement : NAME '=' MACADDR_PARTIAL",
 "statement : block",
 };
 #endif
@@ -166,7 +172,7 @@ YYSTYPE yylval;
 short yyss[YYSTACKSIZE];
 YYSTYPE yyvs[YYSTACKSIZE];
 #define yystacksize YYSTACKSIZE
-#line 114 "rpld_conf.y"
+#line 131 "rpld_conf.y"
 
 //
 // ERROR REPORTING
@@ -205,6 +211,8 @@ struct clientinfo
        // optional
        int have_framesize;
        int have_blocksize;
+       int have_pacing;
+       int have_nospew;
 };
 
 struct clfileinfo
@@ -257,6 +265,7 @@ void process_thing(THING thing, char *name, int type, YYSTYPE *pvalue)
 
                                pc->blocklen=MY_BLOCK_LEN;
                                pc->framelen=MY_FRAME_LEN;
+                               pc->pacing=MY_PACING;
                                
                                state = HOSTBLOCK;
                                break;
@@ -332,7 +341,12 @@ void process_thing(THING thing, char *name, int type, YYSTYPE *pvalue)
                        THROW_ERROR("Unknown directive");
                } else if (state == HOSTBLOCK) {
                        // no host assertions ATM
-                       THROW_ERROR("Unknown directive");
+                       if (strsame(name,"nospew")) {
+                               if (ci.have_pacing) THROW_ERROR("Directive nospew incompatible with pacing ");
+                               if (ci.have_nospew) THROW_ERROR("Repeated directive");
+                               ci.have_nospew=1;
+                               pc->nospew++;
+                       } else THROW_ERROR("Unknown directive");
                } else if (state == FILEBLOCK) {
                        if (strsame(name,"linux")) {
                                if (!cfi.have_path) THROW_ERROR("A path to a
@@ -343,7 +357,7 @@ valid kernel must precede linux");
                                cfi.have_offset=1;
                                cfi.have_length=1;
                                ci.have_run_addr=1;
-                       } else{
+                       }else{
                        THROW_ERROR("Unknown directive");
                        }
                } else THROW_ERROR("Unknown directive");
@@ -356,11 +370,19 @@ valid kernel must precede linux");
                } else if (state == HOSTBLOCK) {
                        // ethernet address
                        if (strsame(name, "ethernet") || strsame(name, "mac")) {
-                               if (type != MACADDR) THROW_ERROR("Directive must be followed by an ethernet address");
+                               if (type != MACADDR && type != MACADDR_PARTIAL)
+                                       THROW_ERROR("Directive must be followed by a (partial or complete) ethernet address");
                                else if (ci.have_mac) THROW_ERROR("Repeated directive");
 
-                               // set MAC address
-                               bcopy(pvalue->mac_address,pc->mac,ETH_ALEN);
+                               if (type == MACADDR) {
+                                       // set MAC address; this is non-partial, so len = ETH_ALEN
+                                       bcopy(pvalue->mac_address, pc->mac, ETH_ALEN);
+                                       pc->partial_mac_len = ETH_ALEN;
+                               } else {
+                                       bcopy(pvalue->pm.mac_address, pc->mac, pvalue->pm.mac_len);
+                                       pc->partial_mac_len = pvalue->pm.mac_len;
+                               }
+
                                ci.have_mac = 1;
                        }
                        // execute address
@@ -388,6 +410,13 @@ valid kernel must precede linux");
                                pc->framelen = pvalue->number;
                                ci.have_framesize = 1;
                        }
+                       else if (strsame(name,"pacing")) {
+                               if (type != NUMBER) THROW_ERROR("Directive must be followed by an integer ");
+                               if (ci.have_nospew) THROW_ERROR("Directive pacing incompatible with nospew ");
+                               if (ci.have_pacing) THROW_ERROR("Repeated directive");
+                               pc->pacing = pvalue->number;
+                               ci.have_pacing =1;
+                       }
                        else THROW_ERROR("Unknown directive");
                } else if (state == FILEBLOCK) {
                        // path
@@ -435,7 +464,7 @@ valid kernel must precede linux");
        
 
 }
-#line 439 "rpld_conf.tab.c"
+#line 468 "rpld_conf.tab.c"
 #define YYABORT goto yyabort
 #define YYREJECT goto yyabort
 #define YYACCEPT goto yyaccept
@@ -577,38 +606,42 @@ yyreduce:
     switch (yyn)
     {
 case 3:
-#line 96 "rpld_conf.y"
+#line 112 "rpld_conf.y"
 { process_thing(BLOCK_END, "", 0, NULL); }
 break;
 case 4:
-#line 97 "rpld_conf.y"
+#line 113 "rpld_conf.y"
 { process_thing(BLOCK_END, "", 0, NULL); }
 break;
 case 5:
-#line 99 "rpld_conf.y"
+#line 115 "rpld_conf.y"
 { process_thing(BLOCK_START, yyvsp[-1].name, 0, NULL); }
 break;
 case 6:
-#line 100 "rpld_conf.y"
+#line 116 "rpld_conf.y"
 { process_thing(BLOCK_START, "", 0, NULL); }
 break;
 case 10:
-#line 107 "rpld_conf.y"
+#line 123 "rpld_conf.y"
 { process_thing(ASSERTION, yyvsp[0].name, 0, NULL); }
 break;
 case 11:
-#line 108 "rpld_conf.y"
+#line 124 "rpld_conf.y"
 { process_thing(ASSIGNMENT, yyvsp[-2].name, TEXT, &yyvsp[0]); }
 break;
 case 12:
-#line 109 "rpld_conf.y"
+#line 125 "rpld_conf.y"
 { process_thing(ASSIGNMENT, yyvsp[-2].name, NUMBER, &yyvsp[0]); }
 break;
 case 13:
-#line 110 "rpld_conf.y"
+#line 126 "rpld_conf.y"
 { process_thing(ASSIGNMENT, yyvsp[-2].name, MACADDR, &yyvsp[0]); }
 break;
-#line 612 "rpld_conf.tab.c"
+case 14:
+#line 127 "rpld_conf.y"
+{ process_thing(ASSIGNMENT, yyvsp[-2].name, MACADDR_PARTIAL, &yyvsp[0]); }
+break;
+#line 645 "rpld_conf.tab.c"
     }
     yyssp -= yym;
     yystate = *yyssp;