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(p, ptype, fieldnum)
36 for (i = 1; poolfields[i].w_word != NULL; i++) {
37 if (poolfields[i].w_value > 0) {
38 printpoolfield(p, ptype, i);
39 if (poolfields[i + 1].w_value > 0)
46 if (ptype == IPLT_POOL) {
47 ip_pool_node_t *node = (ip_pool_node_t *)p;
52 PRINTF("%s", inet_ntop(a->adf_family, &a->adf_addr,
54 } else if (ptype == IPLT_HASH) {
55 iphtent_t *node = (iphtent_t *)p;
57 PRINTF("%s", inet_ntop(node->ipe_family,
60 } else if (ptype == IPLT_DSTLIST) {
61 ipf_dstnode_t *node = (ipf_dstnode_t *)p;
63 a = &node->ipfd_dest.fd_addr;
64 PRINTF("%s", inet_ntop(a->adf_family, &a->adf_addr,
70 if (ptype == IPLT_POOL) {
71 ip_pool_node_t *node = (ip_pool_node_t *)p;
74 PRINTF("%s", inet_ntop(a->adf_family, &a->adf_addr,
76 } else if (ptype == IPLT_HASH) {
77 iphtent_t *node = (iphtent_t *)p;
79 PRINTF("%s", inet_ntop(node->ipe_family,
82 } else if (ptype == IPLT_DSTLIST) {
88 if (ptype == IPLT_POOL) {
90 } else if (ptype == IPLT_HASH) {
92 } else if (ptype == IPLT_DSTLIST) {
93 ipf_dstnode_t *node = (ipf_dstnode_t *)p;
95 if (node->ipfd_dest.fd_name == -1) {
98 PRINTF("%s", node->ipfd_names +
99 node->ipfd_dest.fd_name);
105 if (ptype == IPLT_POOL) {
106 ip_pool_node_t *node = (ip_pool_node_t *)p;
109 PRINTF("%"PRIu64"", node->ipn_hits);
111 PRINTF("%lu", node->ipn_hits);
113 } else if (ptype == IPLT_HASH) {
114 iphtent_t *node = (iphtent_t *)p;
117 PRINTF("%"PRIu64"", node->ipe_hits);
119 PRINTF("%lu", node->ipe_hits);
121 } else if (ptype == IPLT_DSTLIST) {
127 if (ptype == IPLT_POOL) {
128 ip_pool_node_t *node = (ip_pool_node_t *)p;
131 PRINTF("%"PRIu64"", node->ipn_bytes);
133 PRINTF("%lu", node->ipn_bytes);
135 } else if (ptype == IPLT_HASH) {
136 iphtent_t *node = (iphtent_t *)p;
139 PRINTF("%"PRIu64"", node->ipe_bytes);
141 PRINTF("%lu", node->ipe_bytes);
143 } else if (ptype == IPLT_DSTLIST) {
149 if (ptype == IPLT_POOL) {
150 ip_pool_node_t *node = (ip_pool_node_t *)p;
152 PRINTF("%s", familyname(node->ipn_addr.adf_family));
153 } else if (ptype == IPLT_HASH) {
154 iphtent_t *node = (iphtent_t *)p;
156 PRINTF("%s", familyname(node->ipe_family));
157 } else if (ptype == IPLT_DSTLIST) {
158 ipf_dstnode_t *node = (ipf_dstnode_t *)p;
160 a = &node->ipfd_dest.fd_addr;
161 PRINTF("%s", familyname(a->adf_family));