1 /* 2 * Copyright (C) 2002 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 */ 6 7 #include "ipf.h" 8 9 #define PRINTF (void)printf 10 #define FPRINTF (void)fprintf 11 12 iphtent_t *printhashnode(iph, ipep, copyfunc, opts) 13 iphtable_t *iph; 14 iphtent_t *ipep; 15 copyfunc_t copyfunc; 16 int opts; 17 { 18 iphtent_t ipe; 19 20 if ((*copyfunc)(ipep, &ipe, sizeof(ipe))) 21 return NULL; 22 23 ipe.ipe_addr.in4_addr = htonl(ipe.ipe_addr.in4_addr); 24 ipe.ipe_mask.in4_addr = htonl(ipe.ipe_mask.in4_addr); 25 26 if ((opts & OPT_DEBUG) != 0) { 27 PRINTF("\tAddress: %s", 28 inet_ntoa(ipe.ipe_addr.in4)); 29 printmask((u_32_t *)&ipe.ipe_mask.in4_addr); 30 PRINTF("\tRef. Count: %d\tValue: %d\n", ipe.ipe_ref, 31 ipe.ipe_value); 32 } else { 33 putchar(' '); 34 printip((u_32_t *)&ipe.ipe_addr.in4_addr); 35 printmask((u_32_t *)&ipe.ipe_mask.in4_addr); 36 if (ipe.ipe_value != 0) { 37 switch (iph->iph_type & ~IPHASH_ANON) 38 { 39 case IPHASH_GROUPMAP : 40 PRINTF(", group = %s", ipe.ipe_group); 41 break; 42 } 43 } 44 putchar(';'); 45 } 46 ipep = ipe.ipe_next; 47 return ipep; 48 } 49