]> git.ipfire.org Git - thirdparty/bird.git/blob - filter/f-util.c
filters_init() renamed to filters_postconfig().
[thirdparty/bird.git] / filter / f-util.c
1 /*
2 * Filters: utility functions
3 *
4 * Copyright 1998 Pavel Machek <pavel@ucw.cz>
5 *
6 * Can be freely distributed and used under the terms of the GNU GPL.
7 */
8
9 #include <stdio.h>
10 #include <fcntl.h>
11 #include <unistd.h>
12 #include <sys/signal.h>
13
14 #include "nest/bird.h"
15 #include "lib/lists.h"
16 #include "lib/resource.h"
17 #include "lib/socket.h"
18 #include "nest/route.h"
19 #include "nest/protocol.h"
20 #include "nest/iface.h"
21 #include "conf/conf.h"
22 #include "filter/filter.h"
23
24 struct f_instruction *last_func = NULL;
25
26 static void
27 interpret(struct f_instruction *what)
28 {
29 struct symbol *sym;
30 if (!what)
31 return 0;
32 switch(what->code) {
33 case ',':
34 interpret(what->arg1);
35 interpret(what->arg2);
36 break;
37 case '=':
38 sym = what->arg1;
39 sym->aux = what->arg2;
40 break;
41 case 'p':
42 sym = what->arg1;
43 switch(sym->class) {
44 case SYM_VARIABLE_INT:
45 printf( "Printing: %d\n", sym->aux );
46 break;
47 default:
48 printf( "Unknown type passed to print\n" );
49 break;
50 }
51 break;
52 case 'D':
53 printf( "DEBUGGING PRINT\n" );
54 break;
55 }
56 }
57
58 void
59 filters_postconfig(void)
60 {
61 if (!last_func)
62 printf( "No function defined\n" );
63 else {
64 interpret(last_func);
65 }
66 }
67