xref: /freebsd/sbin/ipf/libipf/printlookup.c (revision 963f5dc7a30624e95d72fb7f87b8892651164e46)
1 /*
2  * Copyright (C) 2012 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id$
7  */
8 
9 #include "ipf.h"
10 
11 
12 void
13 printlookup(base, addr, mask)
14 	char *base;
15 	i6addr_t *addr, *mask;
16 {
17 	char name[32];
18 
19 	switch (addr->iplookuptype)
20 	{
21 	case IPLT_POOL :
22 		PRINTF("pool/");
23 		break;
24 	case IPLT_HASH :
25 		PRINTF("hash/");
26 		break;
27 	case IPLT_DSTLIST :
28 		PRINTF("dstlist/");
29 		break;
30 	default :
31 		PRINTF("lookup(%x)=", addr->iplookuptype);
32 		break;
33 	}
34 
35 	if (addr->iplookupsubtype == 0)
36 		PRINTF("%u", addr->iplookupnum);
37 	else if (addr->iplookupsubtype == 1) {
38 		strncpy(name, base + addr->iplookupname, sizeof(name));
39 		name[sizeof(name) - 1] = '\0';
40 		PRINTF("%s", name);
41 	}
42 }
43