xref: /titanic_41/usr/src/cmd/ipf/lib/common/printpooldata.c (revision 6d24d8e5e4f6a2d14992d9392981d8a16d695aec)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
11 
12 #include "ipf.h"
13 
14 #define	PRINTF	(void)printf
15 #define	FPRINTF	(void)fprintf
16 
17 void printpooldata(pool, opts)
18 ip_pool_t *pool;
19 int opts;
20 {
21 
22 	if ((opts & OPT_DEBUG) == 0) {
23 		if ((pool->ipo_flags & IPOOL_ANON) != 0)
24 			PRINTF("# 'anonymous' tree %s\n", pool->ipo_name);
25 		PRINTF("table role = ");
26 	} else {
27 		PRINTF("Name: %s", pool->ipo_name);
28 		if ((pool->ipo_flags & IPOOL_ANON) == IPOOL_ANON)
29 			PRINTF("(anon)");
30 		putchar(' ');
31 		PRINTF("Role: ");
32 	}
33 
34 	switch (pool->ipo_unit)
35 	{
36 	case IPL_LOGIPF :
37 		PRINTF("ipf");
38 		break;
39 	case IPL_LOGNAT :
40 		PRINTF("nat");
41 		break;
42 	case IPL_LOGSTATE :
43 		PRINTF("state");
44 		break;
45 	case IPL_LOGAUTH :
46 		PRINTF("auth");
47 		break;
48 	case IPL_LOGSYNC :
49 		PRINTF("sync");
50 		break;
51 	case IPL_LOGSCAN :
52 		PRINTF("scan");
53 		break;
54 	case IPL_LOGLOOKUP :
55 		PRINTF("lookup");
56 		break;
57 	case IPL_LOGCOUNT :
58 		PRINTF("count");
59 		break;
60 	default :
61 		PRINTF("unknown(%d)", pool->ipo_unit);
62 	}
63 
64 	if ((opts & OPT_DEBUG) == 0) {
65 		PRINTF(" type = tree number = %s\n", pool->ipo_name);
66 	} else {
67 		putchar(' ');
68 
69 		PRINTF("\tReferences: %d\tHits: %lu\n", pool->ipo_ref,
70 			pool->ipo_hits);
71 		PRINTF("\tNodes Starting at %p\n", pool->ipo_list);
72 	}
73 }
74