Remove the old dummynet directory and update the new code with the missing files...
[ipfw.git] / dummynet / test_radix.c
diff --git a/dummynet/test_radix.c b/dummynet/test_radix.c
deleted file mode 100644 (file)
index b0e37d5..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Test the radix tree net
- */
-
-#include <sys/param.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <netinet/in.h>        /* htonl */
-#include "include/net/radix.h"
-
-struct d {
-       uint8_t len[4];
-       uint32_t data;
-};
-
-struct table_entry {
-        struct radix_node       rn[2];
-       struct d x, mask;
-        int               value;
-};
-
-static int
-del(struct radix_node *rn, void *arg)
-{
-        struct radix_node_head * const rnh = arg;
-        struct table_entry *ent;
-
-        ent = (struct table_entry *)
-            rnh->rnh_deladdr(rn->rn_key, rn->rn_mask, rnh);
-       fprintf(stderr, "del returns %p\n", ent);
-        if (0 && ent != NULL)
-                free(ent);
-        return (0);
-}
-
-int
-list(struct radix_node *rn, void *arg)
-{
-        struct table_entry *ent = (struct table_entry *)rn;
-
-       fprintf(stderr, "walking on node %d\n", ent->value);
-        return (0);
-}
-
-static void
-print_dt(struct timeval *start, struct timeval *end, int n, const char *msg)
-{
-       int ds = 0, du, l;
-       du = end->tv_usec - start->tv_usec;
-       if (du < 0) {
-               ds = -1;
-               du += 1000000;
-       }
-       ds += end->tv_sec - start->tv_sec;
-       if (n <= 1)
-               n = 1;
-       l = (ds * 1000000+ du)/n;
-       fprintf(stderr, "%d tries in %d.%06ds, %dus each\n",
-               n, ds, du, l);
-}
-
-static void
-test1(struct radix_node_head *h, int n)
-{
-       struct table_entry *p;
-       struct timeval start, end;
-       int i;
-
-       p = calloc(n, sizeof(*p));
-       if (!p)
-               return;
-       for (i=0; i < n; i++) {
-               p->value = i;
-               p->x.len[0] = p->mask.len[0] = 8;
-               p->mask.data = 0xffffffff;
-               p->x.data = htonl(i);
-       }
-       gettimeofday(&start, NULL);
-       for (i=0; i < n; i++) {
-               h->rnh_addaddr(&(p->x), &(p->mask), h, (void *)p);
-       }
-       gettimeofday(&end, NULL);
-       print_dt(&start, &end, n, NULL);
-       h->rnh_walktree(h, del, h);
-}
-
-int
-main(int argc, char *argv[])
-{
-        struct radix_node_head *h = NULL;
-
-       rn_init(64); // XXX bits or bytes ?
-       rn_inithead((void **)&h, 32); /* data offset in bits */
-       test1(h, 1000000);
-       return 0;
-}