]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Added ip_scope_text() for translating of scopes to strings.
authorMartin Mares <mj@ucw.cz>
Thu, 25 Nov 1999 15:34:20 +0000 (15:34 +0000)
committerMartin Mares <mj@ucw.cz>
Thu, 25 Nov 1999 15:34:20 +0000 (15:34 +0000)
lib/Modules
lib/ip.c [new file with mode: 0644]
lib/ip.h

index cf654127a2eaf1b26177970fcd9718008d9f865a..17de720ce83e4ec105202ec638462d4587692b25 100644 (file)
@@ -2,6 +2,7 @@ birdlib.h
 bitops.c
 bitops.h
 ip.h
+ip.c
 #ifdef IPV6
 ipv6.c
 ipv6.h
diff --git a/lib/ip.c b/lib/ip.c
new file mode 100644 (file)
index 0000000..06cc42c
--- /dev/null
+++ b/lib/ip.c
@@ -0,0 +1,24 @@
+/*
+ *     BIRD Library -- IP address routines common for IPv4 and IPv6
+ *
+ *     (c) 1998--1999 Martin Mares <mj@ucw.cz>
+ *
+ *     Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "nest/bird.h"
+#include "lib/ip.h"
+
+char *
+ip_scope_text(unsigned scope)
+{
+  static char *scope_table[] = { "host", "link", "site", "org", "univ" };
+
+  if (scope > SCOPE_UNIVERSE)
+    return "?";
+  else
+    return scope_table[scope];
+}
index 9b247d5725f90fe02e6537b984685a9759b299b1..38f561b4a2fc7d035ece68ea81a2b36eb67d1321 100644 (file)
--- a/lib/ip.h
+++ b/lib/ip.h
@@ -38,6 +38,8 @@
 #define SCOPE_ORGANIZATION 3
 #define SCOPE_UNIVERSE 4
 
+char *ip_scope_text(unsigned);
+
 /*
  *     Is it a valid network prefix?
  */