summaryrefslogtreecommitdiffstats
path: root/contrib/ipfilter/lib/printlookup.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ipfilter/lib/printlookup.c')
-rw-r--r--contrib/ipfilter/lib/printlookup.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/ipfilter/lib/printlookup.c b/contrib/ipfilter/lib/printlookup.c
new file mode 100644
index 0000000..51f8d6e
--- /dev/null
+++ b/contrib/ipfilter/lib/printlookup.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * $Id$
+ */
+
+#include "ipf.h"
+
+
+void
+printlookup(base, addr, mask)
+ char *base;
+ i6addr_t *addr, *mask;
+{
+ char name[32];
+
+ switch (addr->iplookuptype)
+ {
+ case IPLT_POOL :
+ PRINTF("pool/");
+ break;
+ case IPLT_HASH :
+ PRINTF("hash/");
+ break;
+ case IPLT_DSTLIST :
+ PRINTF("dstlist/");
+ break;
+ default :
+ PRINTF("lookup(%x)=", addr->iplookuptype);
+ break;
+ }
+
+ if (addr->iplookupsubtype == 0)
+ PRINTF("%u", addr->iplookupnum);
+ else if (addr->iplookupsubtype == 1) {
+ strncpy(name, base + addr->iplookupname, sizeof(name));
+ name[sizeof(name) - 1] = '\0';
+ PRINTF("%s", name);
+ }
+}
OpenPOWER on IntegriCloud