summaryrefslogtreecommitdiffstats
path: root/filter/f-util.c
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>1999-01-15 17:49:17 +0100
committerPavel Machek <pavel@ucw.cz>1999-01-15 17:49:17 +0100
commitb9d70dc84e488212328103438bdf4e369c7d27a1 (patch)
tree96afe1e6d460c3ba55b27a92c052800d9616df25 /filter/f-util.c
parentb79f9215b99c7a54dbb2639c972dda497d141133 (diff)
downloadbird-b9d70dc84e488212328103438bdf4e369c7d27a1.tar
bird-b9d70dc84e488212328103438bdf4e369c7d27a1.zip
Filters, second try. This time they have their own directory.
Diffstat (limited to 'filter/f-util.c')
-rw-r--r--filter/f-util.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/filter/f-util.c b/filter/f-util.c
new file mode 100644
index 0000000..df6babb
--- /dev/null
+++ b/filter/f-util.c
@@ -0,0 +1,67 @@
+/*
+ * Filters: utility functions
+ *
+ * Copyright 1998 Pavel Machek <pavel@ucw.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/signal.h>
+
+#include "nest/bird.h"
+#include "lib/lists.h"
+#include "lib/resource.h"
+#include "lib/socket.h"
+#include "nest/route.h"
+#include "nest/protocol.h"
+#include "nest/iface.h"
+#include "conf/conf.h"
+#include "filter/filter.h"
+
+struct f_instruction *last_func = NULL;
+
+static void
+interpret(struct f_instruction *what)
+{
+ struct symbol *sym;
+ if (!what)
+ return 0;
+ switch(what->code) {
+ case ',':
+ interpret(what->arg1);
+ interpret(what->arg2);
+ break;
+ case '=':
+ sym = what->arg1;
+ sym->aux = what->arg2;
+ break;
+ case 'p':
+ sym = what->arg1;
+ switch(sym->class) {
+ case SYM_VARIABLE_INT:
+ printf( "Printing: %d\n", sym->aux );
+ break;
+ default:
+ printf( "Unknown type passed to print\n" );
+ break;
+ }
+ break;
+ case 'D':
+ printf( "DEBUGGING PRINT\n" );
+ break;
+ }
+}
+
+void
+filters_init(void)
+{
+ if (!last_func)
+ printf( "No function defined\n" );
+ else {
+ interpret(last_func);
+ }
+}
+