summaryrefslogtreecommitdiffstats
path: root/filter/f-util.c
blob: 65b8b52ade0903705013419dc520c38d045458b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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_postconfig(void)
{
  if (!last_func)
    printf( "No function defined\n" );
  else {
    interpret(last_func);
  }
}