Cross Reference: printhashnode.c
xref
: /
illumos-gate
/
usr
/
src
/
cmd
/
ipf
/
lib
/
common
/
printhashnode.c
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
printhashnode.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (C) 2002 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*/
#
include
"
ipf.h
"
#
define
PRINTF
(
void
)
printf
#
define
FPRINTF
(
void
)
fprintf
iphtent_t
*
printhashnode
(
iph
,
ipep
,
copyfunc
,
opts
)
iphtable_t
*
iph
;
iphtent_t
*
ipep
;
copyfunc_t
copyfunc
;
int
opts
;
{
iphtent_t
ipe
;
if
((*
copyfunc
)(
ipep
, &
ipe
,
sizeof
(
ipe
)))
return
NULL
;
ipe
.
ipe_addr
.
in4_addr
=
htonl
(
ipe
.
ipe_addr
.
in4_addr
);
ipe
.
ipe_mask
.
in4_addr
=
htonl
(
ipe
.
ipe_mask
.
in4_addr
);
if
((
opts
&
OPT_DEBUG
) != 0) {
PRINTF
(
"\tAddress: %s"
,
inet_ntoa
(
ipe
.
ipe_addr
.
in4
));
printmask
((
u_32_t
*)&
ipe
.
ipe_mask
.
in4_addr
);
PRINTF
(
"\tRef. Count: %d\tValue: %d\n"
,
ipe
.
ipe_ref
,
ipe
.
ipe_value
);
}
else
{
putchar
(
' '
);
printip
((
u_32_t
*)&
ipe
.
ipe_addr
.
in4_addr
);
printmask
((
u_32_t
*)&
ipe
.
ipe_mask
.
in4_addr
);
if
(
ipe
.
ipe_value
!= 0) {
switch
(
iph
->
iph_type
& ~
IPHASH_ANON
)
{
case
IPHASH_GROUPMAP
:
PRINTF
(
", group = %s"
,
ipe
.
ipe_group
);
break
;
}
}
putchar
(
';'
);
}
ipep
=
ipe
.
ipe_next
;
return
ipep
;
}