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
printpooldata(ip_pool_t * pool,int opts)12 printpooldata(ip_pool_t *pool, int opts)
13 {
14
15 if (opts & OPT_SAVEOUT) {
16 if ((pool->ipo_flags & IPOOL_DELETE) != 0)
17 PRINTF("# ");
18 PRINTF("pool ");
19 } else if ((opts & OPT_DEBUG) == 0) {
20 if ((pool->ipo_flags & IPOOL_ANON) != 0)
21 PRINTF("# 'anonymous' tree %s\n", pool->ipo_name);
22 if ((pool->ipo_flags & IPOOL_DELETE) != 0)
23 PRINTF("# ");
24 PRINTF("table role=");
25 } else {
26 if ((pool->ipo_flags & IPOOL_DELETE) != 0)
27 PRINTF("# ");
28 PRINTF("%s: %s",
29 ISDIGIT(*pool->ipo_name) ? "Number" : "Name",
30 pool->ipo_name);
31 if ((pool->ipo_flags & IPOOL_ANON) == IPOOL_ANON)
32 PRINTF("(anon)");
33 putchar(' ');
34 PRINTF("Role: ");
35 }
36
37 printunit(pool->ipo_unit);
38
39 if ((opts & OPT_SAVEOUT)) {
40 PRINTF("/tree (%s \"\%s\";)\n",
41 (!*pool->ipo_name || ISDIGIT(*pool->ipo_name)) ? \
42 "number" : "name", pool->ipo_name);
43 } else if ((opts & OPT_DEBUG) == 0) {
44 PRINTF(" type=tree %s=%s\n",
45 (!*pool->ipo_name || ISDIGIT(*pool->ipo_name)) ? \
46 "number" : "name", pool->ipo_name);
47 } else {
48 putchar(' ');
49
50 PRINTF("\tReferences: %d\tHits: %lu\n", pool->ipo_ref,
51 pool->ipo_hits);
52 if ((pool->ipo_flags & IPOOL_DELETE) != 0)
53 PRINTF("# ");
54 PRINTF("\tNodes Starting at %p\n", pool->ipo_list);
55 }
56 }
57