#include "filter/filter.h"
#include "proto/aggregator/aggregator.h"
-#include <stdlib.h>
-#include <assert.h>
-
extern linpool *rte_update_pool;
/*
}
/*
- * Insert @bucket to the list of bucket pointers in @p to position @bucket.id
+ * Add @bucket to the list of bucket pointers in @p to position @bucket.id
*/
+// TODO: enable to reset bucket ptr?
static void
aggregator_add_bucket(struct aggregator_proto *p, struct aggregator_bucket *bucket)
{
{
aggregator_recalculate(p, old_route, new_route);
- /* Process all route withdrawals which were caused by the update */
+ /* Process route withdrawals triggered by recalculation */
aggregator_withdraw_rte(p);
}
}
cf->dst->debug = cf->src->debug;
}
+// TODO: set pools to NULL?
static struct proto *
aggregator_init(struct proto_config *CF)
{
#include "filter/filter.h"
#include "proto/aggregator/aggregator.h"
-#include <stdlib.h>
-#include <assert.h>
-
static const char *px_origin_str[] = {
[FILLER] = "filler",
[ORIGINAL] = "original",
/*
* Allocate new node in trie slab
*/
+// TODO: inline in aggregator.h?
struct trie_node *
aggregator_create_new_node(struct slab *trie_slab)
{
/*
* Unlink node from the trie by setting appropriate child of parent node to NULL
+ * and free memory.
*/
static inline void
aggregator_remove_node(struct trie_node *node)
/*
* If old and new values are different, the result of their XOR will be
- * non-zero, thus @changed will be set to non-zero - true, as well.
+ * non-zero, thus @has_changed will be set to non-zero -- true, as well.
*/
has_changed |= !!(old[i] ^ target->potential_buckets[i]);
}
else
ipa_setbit(prefix, node->depth + ipa_shift[type]);
+ // TODO: remove after testing, traversing back to target node is not neccessary
node = node->child[path[i]];
+
len++;
ASSERT_DIE((u32)node->depth == len);
}
*/
aggregator_node_add_potential_bucket(&imaginary_node, node->original_bucket);
- /* Nodes with exactly one child */
+ /* Nodes with only one child */
if ((left && !right) || (!left && right))
{
if (left && !right)
ASSERT_DIE(left != NULL && right != NULL);
- /* The parent's set wasn't affected by merging, stop here */
+ /* The parent's set didn't change by merging, stop here */
if (aggregator_merge_potential_buckets(parent, left, right) == 0)
return node;
}
*/
+ // TODO: root should never get here
ASSERT_DIE(ancestor != NULL);
ASSERT_DIE(ancestor != updated_node);
ASSERT_DIE(ancestor->status == IN_FIB);