2 * Copyright (C) 2012 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: printpoolfield.c,v 1.1.2.4 2012/01/26 05:44:26 darren_r Exp $
11 wordtab_t poolfields[] = {
24 printpoolfield(void *p, int ptype, int fieldnum)
33 for (i = 1; poolfields[i].w_word != NULL; i++) {
34 if (poolfields[i].w_value > 0) {
35 printpoolfield(p, ptype, i);
36 if (poolfields[i + 1].w_value > 0)
43 if (ptype == IPLT_POOL) {
44 ip_pool_node_t *node = (ip_pool_node_t *)p;
49 PRINTF("%s", inet_ntop(a->adf_family, &a->adf_addr,
51 } else if (ptype == IPLT_HASH) {
52 iphtent_t *node = (iphtent_t *)p;
54 PRINTF("%s", inet_ntop(node->ipe_family,
57 } else if (ptype == IPLT_DSTLIST) {
58 ipf_dstnode_t *node = (ipf_dstnode_t *)p;
60 a = &node->ipfd_dest.fd_addr;
61 PRINTF("%s", inet_ntop(a->adf_family, &a->adf_addr,
67 if (ptype == IPLT_POOL) {
68 ip_pool_node_t *node = (ip_pool_node_t *)p;
71 PRINTF("%s", inet_ntop(a->adf_family, &a->adf_addr,
73 } else if (ptype == IPLT_HASH) {
74 iphtent_t *node = (iphtent_t *)p;
76 PRINTF("%s", inet_ntop(node->ipe_family,
79 } else if (ptype == IPLT_DSTLIST) {
85 if (ptype == IPLT_POOL) {
87 } else if (ptype == IPLT_HASH) {
89 } else if (ptype == IPLT_DSTLIST) {
90 ipf_dstnode_t *node = (ipf_dstnode_t *)p;
92 if (node->ipfd_dest.fd_name == -1) {
95 PRINTF("%s", node->ipfd_names +
96 node->ipfd_dest.fd_name);
102 if (ptype == IPLT_POOL) {
103 ip_pool_node_t *node = (ip_pool_node_t *)p;
106 PRINTF("%"PRIu64"", node->ipn_hits);
108 PRINTF("%lu", node->ipn_hits);
110 } else if (ptype == IPLT_HASH) {
111 iphtent_t *node = (iphtent_t *)p;
114 PRINTF("%"PRIu64"", node->ipe_hits);
116 PRINTF("%lu", node->ipe_hits);
118 } else if (ptype == IPLT_DSTLIST) {
124 if (ptype == IPLT_POOL) {
125 ip_pool_node_t *node = (ip_pool_node_t *)p;
128 PRINTF("%"PRIu64"", node->ipn_bytes);
130 PRINTF("%lu", node->ipn_bytes);
132 } else if (ptype == IPLT_HASH) {
133 iphtent_t *node = (iphtent_t *)p;
136 PRINTF("%"PRIu64"", node->ipe_bytes);
138 PRINTF("%lu", node->ipe_bytes);
140 } else if (ptype == IPLT_DSTLIST) {
146 if (ptype == IPLT_POOL) {
147 ip_pool_node_t *node = (ip_pool_node_t *)p;
149 PRINTF("%s", familyname(node->ipn_addr.adf_family));
150 } else if (ptype == IPLT_HASH) {
151 iphtent_t *node = (iphtent_t *)p;
153 PRINTF("%s", familyname(node->ipe_family));
154 } else if (ptype == IPLT_DSTLIST) {
155 ipf_dstnode_t *node = (ipf_dstnode_t *)p;
157 a = &node->ipfd_dest.fd_addr;
158 PRINTF("%s", familyname(a->adf_family));