summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2000-04-28 11:48:28 +0200
committerPavel Machek <pavel@ucw.cz>2000-04-28 11:48:28 +0200
commitff95080f9272c4a0123ab05dff608a43cf3c15b7 (patch)
treee38fc0d3168c0f16f77aadb42edd88dde8d53924
parent602b1445e3bfa24b1ce9cd1d148e4aa5cb742cf4 (diff)
downloadbird-ff95080f9272c4a0123ab05dff608a43cf3c15b7.tar
bird-ff95080f9272c4a0123ab05dff608a43cf3c15b7.zip
Cleanup of dead code + example documentation for two functions.
-rw-r--r--filter/filter.c72
1 files changed, 27 insertions, 45 deletions
diff --git a/filter/filter.c b/filter/filter.c
index fc8db89..2cf59e0 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -619,6 +619,23 @@ i_same(struct f_inst *f1, struct f_inst *f2)
return i_same(f1->next, f2->next);
}
+/**
+ * f_run - external entry point to filters
+ * @filter: pointer to filter to run
+ * @rte: pointer to pointer to rte being filtered. When route is modified, this is changed with rte_cow.
+ * @tmp_pool: all filter allocations go from this pool
+ *
+ * Filter consists of tree of &f_inst structures, one structure per
+ * "instruction". Each &f_inst contains code, aux value which is
+ * usually type of data this instruction operates on, and two generic
+ * arguments (a1, a2). Some instructinos contain pointer(s) to other
+ * instructions in their (a1, a2) fields.
+ *
+ * Filters use structure &f_val for its variables. Each &f_val contains
+ * type and value. Types are constants prefixed with %T_. Few of types
+ * are special; %T_RETURN can be or-ed with type to indicate that return
+ * from function/from whole filter should be forced.
+ */
int
f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struct linpool *tmp_pool, int flags)
{
@@ -659,6 +676,16 @@ filters_postconfig(void)
}
}
+/**
+ * filter_same - compare two filters
+ * @new: first filter to be compared
+ * @old: second filter to be compared, notice that this filter is
+ * damaged while comparing.
+ *
+ * Returns 1 in case filters are same, otherwise 0. If there are
+ * underlying bugs, it will rather say 0 on same filters than say
+ * 1 on different.
+ */
int
filter_same(struct filter *new, struct filter *old)
{
@@ -670,51 +697,6 @@ filter_same(struct filter *new, struct filter *old)
return i_same(new->root, old->root);
}
-/* This should end up far away from here!
- */
-struct adata *
-comlist_add(struct linpool *pool, struct adata *list, u32 val)
-{
- struct adata *res = lp_alloc(pool, list->length + sizeof(struct adata) + 4);
- res->length = list->length+4;
- * (u32 *) res->data = val;
- memcpy((char *) res->data + 4, list->data, list->length);
- return res;
-}
-
-struct adata *
-comlist_contains(struct adata *list, u32 val)
-{
- u32 *l = &(list->data);
- int i;
- for (i=0; i<list->length/4; i++)
- if (*l++ == val)
- return 1;
- return 0;
-}
-
-struct adata *
-comlist_del(struct linpool *pool, struct adata *list, u32 val)
-{
- struct adata *res;
- u32 *l, *k;
- int i;
-
- if (!comlist_contains(list, val))
- return list;
-
- res = lp_alloc(pool, list->length + sizeof(struct adata) - 4);
- res->length = list->length-4;
-
- l = &(list->data);
- k = &(res->data);
- for (i=0; i<list->length/4; i++)
- if (l[i] != val)
- *k++ = l[i];
-
- return res;
-}
-
struct adata *
adata_empty(struct linpool *pool)
{