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(ip_pool_t *pool, int opts) 13 { 14 15 if (opts & OPT_SAVEOUT) { 16 PRINTF("pool "); 17 } else 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_SAVEOUT)) { 38 PRINTF("/tree (%s \"\%s\";)\n", 39 (!*pool->ipo_name || ISDIGIT(*pool->ipo_name)) ? \ 40 "number" : "name", pool->ipo_name); 41 } else if ((opts & OPT_DEBUG) == 0) { 42 PRINTF(" type=tree %s=%s\n", 43 (!*pool->ipo_name || ISDIGIT(*pool->ipo_name)) ? \ 44 "number" : "name", pool->ipo_name); 45 } else { 46 putchar(' '); 47 48 PRINTF("\tReferences: %d\tHits: %lu\n", pool->ipo_ref, 49 pool->ipo_hits); 50 if ((pool->ipo_flags & IPOOL_DELETE) != 0) 51 PRINTF("# "); 52 PRINTF("\tNodes Starting at %p\n", pool->ipo_list); 53 } 54 } 55