1 /* $NetBSD: printpooldata.c,v 1.1.1.2 2012/07/22 13:44:38 darrenr Exp $ */ 2 3 /* 4 * Copyright (C) 2012 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 */ 8 9 #include "ipf.h" 10 #include <ctype.h> 11 12 13 void 14 printpooldata(pool, opts) 15 ip_pool_t *pool; 16 int opts; 17 { 18 19 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_DEBUG) == 0) { 40 PRINTF(" type=tree %s=%s\n", 41 (!*pool->ipo_name || ISDIGIT(*pool->ipo_name)) ? \ 42 "number" : "name", pool->ipo_name); 43 } else { 44 putchar(' '); 45 46 PRINTF("\tReferences: %d\tHits: %lu\n", pool->ipo_ref, 47 pool->ipo_hits); 48 if ((pool->ipo_flags & IPOOL_DELETE) != 0) 49 PRINTF("# "); 50 PRINTF("\tNodes Starting at %p\n", pool->ipo_list); 51 } 52 } 53