Revision b1c9d871

View differences:

filter/filter.c
43 43

  
44 44
#define P(a,b) ((a<<8) | b)
45 45

  
46
struct f_inst *startup_func = NULL, *test1_func, *test2_func;
47

  
48 46
#define CMP_ERROR 999
49 47

  
50 48
static int
......
665 663
  return res.val.i;
666 664
}
667 665

  
668
void
669
filters_postconfig(void)
666
int
667
f_eval_int(struct f_inst *expr)
670 668
{
671 669
  struct f_val res;
672 670

  
673
#if 1
674
  if (!i_same(test1_func, test2_func))
675
    bug("i_same does not work");
676
#endif
677
  if (startup_func) {
678
    debug( "Launching startup function...\n" );
679
    f_pool = lp_new(&root_pool, 1024);
680
    res = interpret(startup_func);
681
    if (res.type == F_ERROR)
682
      die( "Startup function resulted in error." );
683
    debug( "done\n" );
684
  }
685
} 
671
  f_flags = 0;
672
  f_tmp_attrs = NULL;
673
  f_rte = NULL;
674
  f_rte_old = NULL;
675
  f_rta_copy = NULL;
676
  f_pool = cfg_mem;
677
  res = interpret(expr);
678
  if (res.type != T_INT)
679
    cf_error("Integer expression expected");
680
  return res.val.i;
681
}
686 682

  
687 683
/**
688 684
 * filter_same - compare two filters
filter/filter.h
31 31
#define arg1 a1.p
32 32
#define arg2 a2.p
33 33

  
34
struct prefix {
34
struct f_prefix {
35 35
  ip_addr ip;
36 36
  int len;
37 37
#define LEN_MASK 0xff
......
46 46
  union {
47 47
    int i;
48 48
    /*    ip_addr ip; Folded into prefix */	
49
    struct prefix px;
49
    struct f_prefix px;
50 50
    char *s;
51 51
    struct f_tree *t;
52 52
    struct adata *ad;
......
59 59
  struct f_inst *root;
60 60
};
61 61

  
62
void filters_postconfig(void);
63 62
struct f_inst *f_new_inst(void);
64 63
struct f_inst *f_new_dynamic_attr(int type, int f_type, int code);	/* Type as core knows it, type as filters know it, and code of dynamic attribute */
65 64
struct f_tree *f_new_tree(void);
......
72 71
struct rte;
73 72

  
74 73
int f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struct linpool *tmp_pool, int flags);
74
int f_eval_int(struct f_inst *expr);
75 75
char *filter_name(struct filter *filter);
76 76
int filter_same(struct filter *new, struct filter *old);
77 77

  

Also available in: Unified diff