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