]>
git.ipfire.org Git - thirdparty/bird.git/blob - filter/filter.h
2 * BIRD Internet Routing Daemon -- Filters
4 * (c) 1999 Pavel Machek <pavel@ucw.cz>
5 * (c) 2018--2019 Maria Matejka <mq@jmq.cz>
7 * Can be freely distributed and used under the terms of the GNU GPL.
13 #include "lib/resource.h"
15 #include "lib/macro.h"
16 #include "nest/route.h"
17 #include "nest/attrs.h"
19 /* Possible return values of filter execution */
24 F_ACCEPT
, /* Need to preserve ordering: accepts < rejects! */
29 static inline const char *filter_return_str(const enum filter_return fret
) {
31 #define FRS(x) case x: return #x
39 default: bug("This shall not happen");
45 /* The filter encapsulating structure to be pointed-to from outside */
49 const struct f_line
*root
;
54 enum filter_return
f_run(const struct filter
*filter
, struct rte
**rte
, struct linpool
*tmp_pool
, int flags
);
55 enum filter_return
f_eval_rte(const struct f_line
*expr
, struct rte
**rte
, struct linpool
*tmp_pool
);
56 uint
f_eval_int(const struct f_line
*expr
);
57 enum filter_return
f_eval_buf(const struct f_line
*expr
, struct linpool
*tmp_pool
, buffer
*buf
);
59 const char *filter_name(const struct filter
*filter
);
60 int filter_same(const struct filter
*new, const struct filter
*old
);
61 int f_same(const struct f_line
*f1
, const struct f_line
*f2
);
63 void filter_commit(struct config
*new, struct config
*old
);
65 void filters_dump_all(void);
67 #define FILTER_ACCEPT NULL
68 #define FILTER_REJECT ((struct filter *) 1)
69 #define FILTER_UNDEF ((struct filter *) 2) /* Used in BGP */
71 #define FF_SILENT 2 /* Silent filter execution */
73 /* Custom route attributes */
74 struct custom_attribute
{
76 struct f_dynamic_attr
*fda
;
80 struct custom_attribute
*ca_lookup(pool
*p
, const char *name
, int ea_type
);