summaryrefslogtreecommitdiffstats
path: root/filter/f-util.c
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>1999-03-02 20:49:28 +0100
committerPavel Machek <pavel@ucw.cz>1999-03-02 20:49:28 +0100
commit84c7e1943f0dbf896b1dd8d02a21120aa00463f4 (patch)
tree9fa531c365d7cec8377e2bedd06d112d01efa47c /filter/f-util.c
parent05a845ed8e623c51025058037d0ca25db712ae68 (diff)
downloadbird-84c7e1943f0dbf896b1dd8d02a21120aa00463f4.tar
bird-84c7e1943f0dbf896b1dd8d02a21120aa00463f4.zip
Add interface for running filters (please comment!), avoid bison warnings
Diffstat (limited to 'filter/f-util.c')
-rw-r--r--filter/f-util.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/filter/f-util.c b/filter/f-util.c
index 65b8b52..66bf5f1 100644
--- a/filter/f-util.c
+++ b/filter/f-util.c
@@ -28,7 +28,7 @@ interpret(struct f_instruction *what)
{
struct symbol *sym;
if (!what)
- return 0;
+ return;
switch(what->code) {
case ',':
interpret(what->arg1);
@@ -36,7 +36,7 @@ interpret(struct f_instruction *what)
break;
case '=':
sym = what->arg1;
- sym->aux = what->arg2;
+ sym->aux = (int) what->arg2;
break;
case 'p':
sym = what->arg1;
@@ -52,7 +52,11 @@ interpret(struct f_instruction *what)
case 'D':
printf( "DEBUGGING PRINT\n" );
break;
+ case '0':
+ printf( "No operation\n" );
+ break;
}
+ interpret(what->next);
}
void
@@ -65,3 +69,24 @@ filters_postconfig(void)
}
}
+struct f_instruction *
+f_new_inst(void)
+{
+ struct f_instruction * ret;
+ ret = cfg_alloc(sizeof(struct f_instruction));
+ ret->code = 0;
+ ret->arg1 = ret->arg2 = ret->next = NULL;
+ return ret;
+}
+
+int
+f_run(struct symbol *filter, struct rte *rtein, struct rte **rteout)
+{
+ struct f_instruction *inst;
+ debug( "Running filter `%s'...", filter->name );
+
+ inst = filter->def;
+ interpret(inst);
+ debug( "done\n" );
+ return F_ACCEPT;
+}