4 * Copyright (C) 2000-2005 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * Id: optprint.c,v 1.6.4.2 2006/06/16 17:21:08 darrenr Exp
13 void optprint(sec
, optmsk
, optbits
)
15 u_long optmsk
, optbits
;
17 u_short secmsk
= sec
[0], secbits
= sec
[1];
18 struct ipopt_names
*io
, *so
;
22 for (io
= ionames
; io
->on_name
; io
++)
23 if ((io
->on_bit
& optmsk
) &&
24 ((io
->on_bit
& optmsk
) == (io
->on_bit
& optbits
))) {
25 if ((io
->on_value
!= IPOPT_SECURITY
) ||
26 (!secmsk
&& !secbits
)) {
27 printf("%s%s", s
, io
->on_name
);
29 * Because the ionames table has this entry
32 if (io
->on_value
== IPOPT_SECURITY
)
39 if (secmsk
& secbits
) {
40 printf("%ssec-class", s
);
42 for (so
= secclass
; so
->on_name
; so
++)
43 if ((secmsk
& so
->on_bit
) &&
44 ((so
->on_bit
& secmsk
) == (so
->on_bit
& secbits
))) {
45 printf("%s%s", s
, so
->on_name
);
50 if ((optmsk
&& (optmsk
!= optbits
)) ||
51 (secmsk
&& (secmsk
!= secbits
))) {
54 if (optmsk
!= optbits
) {
55 for (io
= ionames
; io
->on_name
; io
++)
56 if ((io
->on_bit
& optmsk
) &&
57 ((io
->on_bit
& optmsk
) !=
58 (io
->on_bit
& optbits
))) {
59 if ((io
->on_value
!= IPOPT_SECURITY
) ||
60 (!secmsk
&& !secbits
)) {
61 printf("%s%s", s
, io
->on_name
);
71 if (secmsk
!= secbits
) {
72 printf("%ssec-class", s
);
74 for (so
= secclass
; so
->on_name
; so
++)
75 if ((so
->on_bit
& secmsk
) &&
76 ((so
->on_bit
& secmsk
) !=
77 (so
->on_bit
& secbits
))) {
78 printf("%s%s", s
, so
->on_name
);