xref: /illumos-gate/usr/src/cmd/ipf/lib/printpooldata.c (revision f3ac6781)
1 /*
2  * Copyright (C) 2002 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
7  * Use is subject to license terms.
8  */
9 
10 #include "ipf.h"
11 
12 #define	PRINTF	(void)printf
13 #define	FPRINTF	(void)fprintf
14 
printpooldata(pool,opts)15 void printpooldata(pool, opts)
16 ip_pool_t *pool;
17 int opts;
18 {
19 
20 	if ((opts & OPT_DEBUG) == 0) {
21 		if ((pool->ipo_flags & IPOOL_ANON) != 0)
22 			PRINTF("# 'anonymous' tree %s\n", pool->ipo_name);
23 		PRINTF("table role = ");
24 	} else {
25 		PRINTF("Name: %s", pool->ipo_name);
26 		if ((pool->ipo_flags & IPOOL_ANON) == IPOOL_ANON)
27 			PRINTF("(anon)");
28 		putchar(' ');
29 		PRINTF("Role: ");
30 	}
31 
32 	switch (pool->ipo_unit)
33 	{
34 	case IPL_LOGIPF :
35 		PRINTF("ipf");
36 		break;
37 	case IPL_LOGNAT :
38 		PRINTF("nat");
39 		break;
40 	case IPL_LOGSTATE :
41 		PRINTF("state");
42 		break;
43 	case IPL_LOGAUTH :
44 		PRINTF("auth");
45 		break;
46 	case IPL_LOGSYNC :
47 		PRINTF("sync");
48 		break;
49 	case IPL_LOGSCAN :
50 		PRINTF("scan");
51 		break;
52 	case IPL_LOGLOOKUP :
53 		PRINTF("lookup");
54 		break;
55 	case IPL_LOGCOUNT :
56 		PRINTF("count");
57 		break;
58 	default :
59 		PRINTF("unknown(%d)", pool->ipo_unit);
60 	}
61 
62 	if ((opts & OPT_DEBUG) == 0) {
63 		PRINTF(" type = tree number = %s\n", pool->ipo_name);
64 	} else {
65 		putchar(' ');
66 
67 		PRINTF("\tReferences: %d\tHits: %lu\n", pool->ipo_ref,
68 			pool->ipo_hits);
69 		PRINTF("\tNodes Starting at %p\n", pool->ipo_list);
70 	}
71 }
72