printipfexpr.c (41edb306f05651fcaf6c74f9e3557f59f80292e1) printipfexpr.c (efeb8bffe34422937c7f8df836afb5b817366d16)
1#include "ipf.h"
2
3static void printport(int *);
4static void printhosts(int *);
5static void printsingle(int *);
6#ifdef USE_INET6
7static void printhostsv6(int *);
8#endif
9
10void
1#include "ipf.h"
2
3static void printport(int *);
4static void printhosts(int *);
5static void printsingle(int *);
6#ifdef USE_INET6
7static void printhostsv6(int *);
8#endif
9
10void
11printipfexpr(array)
12 int *array;
11printipfexpr(int *array)
13{
14 int i, nelems, j, not;
15 ipfexp_t *ipfe;
16
17 nelems = array[0];
18
19 for (i = 1; i < nelems; ) {
20 ipfe = (ipfexp_t *)(array + i);

--- 106 unchanged lines hidden (view full) ---

127 i += ipfe->ipfe_size;
128 if (array[i] != IPF_EXP_END)
129 putchar(' ');
130 }
131}
132
133
134static void
12{
13 int i, nelems, j, not;
14 ipfexp_t *ipfe;
15
16 nelems = array[0];
17
18 for (i = 1; i < nelems; ) {
19 ipfe = (ipfexp_t *)(array + i);

--- 106 unchanged lines hidden (view full) ---

126 i += ipfe->ipfe_size;
127 if (array[i] != IPF_EXP_END)
128 putchar(' ');
129 }
130}
131
132
133static void
135printsingle(array)
136 int *array;
134printsingle(int *array)
137{
138 ipfexp_t *ipfe = (ipfexp_t *)array;
139 int i;
140
141 for (i = 0; i < ipfe->ipfe_narg; ) {
142 PRINTF("%d", array[i + 4]);
143 i++;
144 if (i < ipfe->ipfe_narg)
145 putchar(',');
146 }
147}
148
149
150static void
135{
136 ipfexp_t *ipfe = (ipfexp_t *)array;
137 int i;
138
139 for (i = 0; i < ipfe->ipfe_narg; ) {
140 PRINTF("%d", array[i + 4]);
141 i++;
142 if (i < ipfe->ipfe_narg)
143 putchar(',');
144 }
145}
146
147
148static void
151printport(array)
152 int *array;
149printport(int *array)
153{
154 ipfexp_t *ipfe = (ipfexp_t *)array;
155 int i;
156
157 for (i = 0; i < ipfe->ipfe_narg; ) {
158 PRINTF("%d", ntohs(array[i + 4]));
159 i++;
160 if (i < ipfe->ipfe_narg)
161 putchar(',');
162 }
163}
164
165
166static void
150{
151 ipfexp_t *ipfe = (ipfexp_t *)array;
152 int i;
153
154 for (i = 0; i < ipfe->ipfe_narg; ) {
155 PRINTF("%d", ntohs(array[i + 4]));
156 i++;
157 if (i < ipfe->ipfe_narg)
158 putchar(',');
159 }
160}
161
162
163static void
167printhosts(array)
168 int *array;
164printhosts(int *array)
169{
170 ipfexp_t *ipfe = (ipfexp_t *)array;
171 int i, j;
172
173 for (i = 0, j = 0; i < ipfe->ipfe_narg; j++) {
174 printhostmask(AF_INET, (u_32_t *)ipfe->ipfe_arg0 + j * 2,
175 (u_32_t *)ipfe->ipfe_arg0 + j * 2 + 1);
176 i += 2;
177 if (i < ipfe->ipfe_narg)
178 putchar(',');
179 }
180}
181
182
183#ifdef USE_INET6
184static void
165{
166 ipfexp_t *ipfe = (ipfexp_t *)array;
167 int i, j;
168
169 for (i = 0, j = 0; i < ipfe->ipfe_narg; j++) {
170 printhostmask(AF_INET, (u_32_t *)ipfe->ipfe_arg0 + j * 2,
171 (u_32_t *)ipfe->ipfe_arg0 + j * 2 + 1);
172 i += 2;
173 if (i < ipfe->ipfe_narg)
174 putchar(',');
175 }
176}
177
178
179#ifdef USE_INET6
180static void
185printhostsv6(array)
186 int *array;
181printhostsv6(int *array)
187{
188 ipfexp_t *ipfe = (ipfexp_t *)array;
189 int i, j;
190
191 for (i = 4, j= 0; i < ipfe->ipfe_size; j++) {
192 printhostmask(AF_INET6, (u_32_t *)ipfe->ipfe_arg0 + j * 8,
193 (u_32_t *)ipfe->ipfe_arg0 + j * 8 + 4);
194 i += 8;
195 if (i < ipfe->ipfe_size)
196 putchar(',');
197 }
198}
199#endif
182{
183 ipfexp_t *ipfe = (ipfexp_t *)array;
184 int i, j;
185
186 for (i = 4, j= 0; i < ipfe->ipfe_size; j++) {
187 printhostmask(AF_INET6, (u_32_t *)ipfe->ipfe_arg0 + j * 8,
188 (u_32_t *)ipfe->ipfe_arg0 + j * 8 + 4);
189 i += 8;
190 if (i < ipfe->ipfe_size)
191 putchar(',');
192 }
193}
194#endif