]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ipfilter/lib/printpooldata.c
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ipfilter / lib / printpooldata.c
1 /*
2  * Copyright (C) 2012 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  */
6
7 #include "ipf.h"
8 #include <ctype.h>
9
10
11 void
12 printpooldata(pool, opts)
13         ip_pool_t *pool;
14         int opts;
15 {
16
17         if ((opts & OPT_DEBUG) == 0) {
18                 if ((pool->ipo_flags & IPOOL_ANON) != 0)
19                         PRINTF("# 'anonymous' tree %s\n", pool->ipo_name);
20                 if ((pool->ipo_flags & IPOOL_DELETE) != 0)
21                         PRINTF("# ");
22                 PRINTF("table role=");
23         } else {
24                 if ((pool->ipo_flags & IPOOL_DELETE) != 0)
25                         PRINTF("# ");
26                 PRINTF("%s: %s",
27                         ISDIGIT(*pool->ipo_name) ? "Number" : "Name",
28                         pool->ipo_name);
29                 if ((pool->ipo_flags & IPOOL_ANON) == IPOOL_ANON)
30                         PRINTF("(anon)");
31                 putchar(' ');
32                 PRINTF("Role: ");
33         }
34
35         printunit(pool->ipo_unit);
36
37         if ((opts & OPT_DEBUG) == 0) {
38                 PRINTF(" type=tree %s=%s\n",
39                         (!*pool->ipo_name || ISDIGIT(*pool->ipo_name)) ? \
40                         "number" : "name", pool->ipo_name);
41         } else {
42                 putchar(' ');
43
44                 PRINTF("\tReferences: %d\tHits: %lu\n", pool->ipo_ref,
45                         pool->ipo_hits);
46                 if ((pool->ipo_flags & IPOOL_DELETE) != 0)
47                         PRINTF("# ");
48                 PRINTF("\tNodes Starting at %p\n", pool->ipo_list);
49         }
50 }