summaryrefslogtreecommitdiffstats
path: root/nest/a-set.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-04-17 12:18:55 +0200
committerMartin Mares <mj@ucw.cz>2000-04-17 12:18:55 +0200
commitc6add07fa6ca8366fbdcfcd9bc2872c129378366 (patch)
tree326030c1a1798b35c68ef11428461dd7a60e02cd /nest/a-set.c
parentafc54517db6946e9cfb62bbdc855954316152c62 (diff)
downloadbird-c6add07fa6ca8366fbdcfcd9bc2872c129378366.tar
bird-c6add07fa6ca8366fbdcfcd9bc2872c129378366.zip
Printing of AS paths and community sets.
Diffstat (limited to 'nest/a-set.c')
-rw-r--r--nest/a-set.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/nest/a-set.c b/nest/a-set.c
index 7c7d689..deef5df 100644
--- a/nest/a-set.c
+++ b/nest/a-set.c
@@ -9,4 +9,32 @@
#include "nest/bird.h"
#include "nest/route.h"
+#include "nest/attrs.h"
#include "lib/resource.h"
+#include "lib/string.h"
+
+void
+int_set_format(struct adata *set, byte *buf, unsigned int size)
+{
+ u32 *z = (u32 *) set->data;
+ int l = set->length / 4;
+ int sp = 1;
+ byte *end = buf + size - 16;
+
+ while (l--)
+ {
+ if (sp)
+ {
+ sp = 0;
+ *buf++ = ' ';
+ }
+ if (buf > end)
+ {
+ strcpy(buf, "...");
+ return;
+ }
+ buf += bsprintf(buf, "%d:%d", *z/65536, *z & 0xffff);
+ z++;
+ }
+ *buf = 0;
+}