FIXME: create community lists
FIXME: write access to dynamic attributes.
FIXME: '! =' should not be permitted. Ze `!=' by nemelo byt totez jako `! =' Nadefinujes si pres %token novy token a do cf-lex.l pridas nove pravidlo, ktere jej rozpoznava. Napriklad != return NEQ;
+ FIXME: write access to static attribute: Z rte ma byt read/write: pref, attrs (neprimo).
*/
;
constant:
- CONST '(' expr ')' { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_INT; $$->a2.i = $3; }
- | NUM { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_INT; $$->a2.i = $1; }
- | TRUE { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_BOOL; $$->a2.i = 1; }
- | FALSE { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_BOOL; $$->a2.i = 0; }
- | TEXT { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_STRING; $$->a2.p = $1; }
- | pair { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_PAIR; $$->a2.i = $1; }
+ CONST '(' expr ')' { $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_INT; $$->a2.i = $3; }
+ | NUM { $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_INT; $$->a2.i = $1; }
+ | TRUE { $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_BOOL; $$->a2.i = 1; }
+ | FALSE { $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_BOOL; $$->a2.i = 0; }
+ | TEXT { $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_STRING; $$->a2.p = $1; }
+ | pair { $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_PAIR; $$->a2.i = $1; }
| ipa { NEW_F_VAL; $$ = f_new_inst(); $$->code = 'C'; $$->a1.p = val; *val = $1; }
| prefix_s {NEW_F_VAL; $$ = f_new_inst(); $$->code = 'C'; $$->a1.p = val; *val = $1; }
- | '[' set_items ']' { printf( "We've got a set here..." ); $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_SET; $$->a2.p = build_tree($2); printf( "ook\n" ); }
- | ENUM { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = $1 >> 16; $$->a2.i = $1 & 0xffff; }
+ | '[' set_items ']' { printf( "We've got a set here..." ); $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_SET; $$->a2.p = build_tree($2); printf( "ook\n" ); }
+ | ENUM { $$ = f_new_inst(); $$->code = 'c'; $$->aux = $1 >> 16; $$->a2.i = $1 & 0xffff; }
;
any_dynamic:
- RIP_METRIC { $$ = f_new_inst(); $$->a1.i = T_INT; $$->a2.i = EA_RIP_METRIC;}
- | RIP_TAG { $$ = f_new_inst(); $$->a1.i = T_INT; $$->a2.i = EA_RIP_TAG; }
+ RIP_METRIC { $$ = f_new_inst(); $$->aux = T_INT; $$->a2.i = EA_RIP_METRIC;}
+ | RIP_TAG { $$ = f_new_inst(); $$->aux = T_INT; $$->a2.i = EA_RIP_TAG; }
;
| RTA '.' any_dynamic { $$ = $3; $$->code = 'ea'; }
- | term '.' IP { $$ = f_new_inst(); $$->code = 'cp'; $$->a1.p = $1; $$->a2.i = T_IP; }
- | term '.' LEN { $$ = f_new_inst(); $$->code = 'cp'; $$->a1.p = $1; $$->a2.i = T_INT; }
+ | term '.' IP { $$ = f_new_inst(); $$->code = 'cp'; $$->a1.p = $1; $$->aux = T_IP; }
+ | term '.' LEN { $$ = f_new_inst(); $$->code = 'cp'; $$->a1.p = $1; $$->aux = T_INT; }
| term '.' MASK '(' term ')' { $$ = f_new_inst(); $$->code = 'iM'; $$->a1.p = $1; $$->a2.p = $5; }
;
$$->a1.p = $1;
$$->a2.p = $3;
}
+ | RTA '.' any_dynamic '=' term ';' {
+ $$ = $3;
+ $$->code = 'eS';
+
+ }
| break_command print_list ';' { $$ = f_new_inst(); $$->code = 'p,'; $$->a1.p = $2; $$->a2.i = $1; }
| SYM '(' var_list ')' ';' {
struct symbol *sym;
break;
case 'c': /* integer (or simple type) constant */
- res.type = what->a1.i;
+ res.type = what->aux;
res.val.i = what->a2.i;
break;
case 'C':
case F_ACCEPT:
/* Should take care about turning ACCEPT into MODIFY */
case F_ERROR:
- case F_REJECT:
+ case F_REJECT: /* FIXME (noncritical) Should print compele route along with reason to reject route */
res.type = T_RETURN;
res.val.i = what->a1.i;
break;
case 'a': /* rta access */
{
struct rta *rta = (*f_rte)->attrs;
- res.type = what->a1.i;
+ res.type = what->aux;
switch(res.type) {
case T_IP:
res.val.px.ip = * (ip_addr *) ((char *) rta + what->a2.i);
break;
+ case T_ENUM:
+ res.val.i = * ((char *) rta + what->a2.i);
+ break;
case T_PREFIX: /* Warning: this works only for prefix of network */
{
res.val.px.ip = (*f_rte)->net->n.prefix;
res.type = T_VOID;
break;
}
- res.type = what->a1.i;
+ res.type = what->aux;
switch (what->a1.i) {
case T_INT:
res.val.i = e->u.data;
ONEARG;
if (v1.type != T_PREFIX)
runtime( "Can not convert non-prefix this way" );
- res.type = what->a2.i;
+ res.type = what->aux;
switch(res.type) {
case T_INT: res.val.i = v1.val.px.len; break;
case T_IP: res.val.px.ip = v1.val.px.ip; break;
filter testf
int j;
{
- print "Heya, filtering route to " rta.net.ip " prefixlen " rta.net.len;
+ print "Heya, filtering route to " rta.net.ip " prefixlen " rta.net.len " source " rta.source;
print "This route was from " rta.from;
j = 7;
j = 17;
- if rta.rip_metric > 15 then
- print "RIP Metric is more than infinity";
+ if rta.rip_metric > 15 then {
+ reject "RIP Metric is more than infinity";
+ }
- accept;
+ accept "ok I take that";
}