summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ipf/lib/common/printpooldata.c
blob: a699af67dfed06dcc41180d2f94d0277b94c27ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Copyright (C) 2002 by Darren Reed.
 *
 * See the IPFILTER.LICENCE file for details on licencing.
 *
 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#include "ipf.h"

#define	PRINTF	(void)printf
#define	FPRINTF	(void)fprintf

void printpooldata(pool, opts)
ip_pool_t *pool;
int opts;
{

	if ((opts & OPT_DEBUG) == 0) {
		if ((pool->ipo_flags & IPOOL_ANON) != 0)
			PRINTF("# 'anonymous' tree %s\n", pool->ipo_name);
		PRINTF("table role = ");
	} else {
		PRINTF("Name: %s", pool->ipo_name);
		if ((pool->ipo_flags & IPOOL_ANON) == IPOOL_ANON)
			PRINTF("(anon)");
		putchar(' ');
		PRINTF("Role: ");
	}

	switch (pool->ipo_unit)
	{
	case IPL_LOGIPF :
		PRINTF("ipf");
		break;
	case IPL_LOGNAT :
		PRINTF("nat");
		break;
	case IPL_LOGSTATE :
		PRINTF("state");
		break;
	case IPL_LOGAUTH :
		PRINTF("auth");
		break;
	case IPL_LOGSYNC :
		PRINTF("sync");
		break;
	case IPL_LOGSCAN :
		PRINTF("scan");
		break;
	case IPL_LOGLOOKUP :
		PRINTF("lookup");
		break;
	case IPL_LOGCOUNT :
		PRINTF("count");
		break;
	default :
		PRINTF("unknown(%d)", pool->ipo_unit);
	}

	if ((opts & OPT_DEBUG) == 0) {
		PRINTF(" type = tree number = %s\n", pool->ipo_name);
	} else {
		putchar(' ');

		PRINTF("\tReferences: %d\tHits: %lu\n", pool->ipo_ref,
			pool->ipo_hits);
		PRINTF("\tNodes Starting at %p\n", pool->ipo_list);
	}
}