summaryrefslogtreecommitdiffstats
path: root/contrib/ipfilter/lib/printpooldata.c
blob: 8d8e962cbbdecda63273abad179b2ef192c5116e (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
74
75
76
77
78
/*
 * Copyright (C) 2002 by Darren Reed.
 *
 * See the IPFILTER.LICENCE file for details on licencing.
 */

#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);
		if ((pool->ipo_flags & IPOOL_DELETE) != 0)
			PRINTF("# ");
		PRINTF("table role = ");
	} else {
		if ((pool->ipo_flags & IPOOL_DELETE) != 0)
			PRINTF("# ");
		PRINTF("%s: %s",
			isdigit(*pool->ipo_name) ? "Number" : "Name",
			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 %s = %s\n",
			isdigit(*pool->ipo_name) ? "number" : "name",
			pool->ipo_name);
	} else {
		putchar(' ');

		PRINTF("\tReferences: %d\tHits: %lu\n", pool->ipo_ref,
			pool->ipo_hits);
		if ((pool->ipo_flags & IPOOL_DELETE) != 0)
			PRINTF("# ");
		PRINTF("\tNodes Starting at %p\n", pool->ipo_list);
	}
}
OpenPOWER on IntegriCloud