LEN,
DEFINED,
ADD, DELETE, CONTAINS, RESET,
- PREPEND, MATCH,
+ PREPEND, FIRST, LAST, MATCH,
EMPTY,
FILTER, WHERE, EVAL)
| term '.' IP { $$ = f_new_inst(); $$->code = P('c','p'); $$->a1.p = $1; $$->aux = T_IP; }
| term '.' LEN { $$ = f_new_inst(); $$->code = 'L'; $$->a1.p = $1; }
| term '.' MASK '(' term ')' { $$ = f_new_inst(); $$->code = P('i','M'); $$->a1.p = $1; $$->a2.p = $5; }
+ | term '.' FIRST { $$ = f_new_inst(); $$->code = P('a','f'); $$->a1.p = $1; }
+ | term '.' LAST { $$ = f_new_inst(); $$->code = P('a','l'); $$->a1.p = $1; }
/* Communities */
/* This causes one shift/reduce conflict
struct f_val v1, v2, res;
unsigned u1, u2;
int i;
+ u32 as;
res.type = T_VOID;
if (!what)
default: bug( "Unknown prefix to conversion" );
}
break;
+ case P('a','f'): /* Get first ASN from AS PATH */
+ ONEARG;
+ if (v1.type != T_PATH)
+ runtime( "AS Path expected" );
+
+ as = 0;
+ as_path_get_last(v1.val.ad, &as); /* really last */
+ res.type = T_INT;
+ res.val.i = as;
+ break;
+ case P('a','l'): /* Get last ASN from AS PATH */
+ ONEARG;
+ if (v1.type != T_PATH)
+ runtime( "AS path expected" );
+
+ as = 0;
+ as_path_get_first(v1.val.ad, &as); /* really first */
+ res.type = T_INT;
+ res.val.i = as;
+ break;
case 'r':
ONEARG;
res = v1;