OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / doc / manpage.d / ipsec_masktobits.3.html
1 Content-type: text/html
2
3 <HTML><HEAD><TITLE>Manpage of IPSEC_GOODMASK</TITLE>
4 </HEAD><BODY>
5 <H1>IPSEC_GOODMASK</H1>
6 Section: C Library Functions (3)<BR>Updated: 11 June 2001<BR><A HREF="#index">Index</A>
7 <A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
8
9
10 <A NAME="lbAB">&nbsp;</A>
11 <H2>NAME</H2>
12
13 ipsec goodmask - is this Internet subnet mask a valid one?
14 <BR>
15
16 ipsec masktobits - convert Internet subnet mask to bit count
17 <BR>
18
19 ipsec bitstomask - convert bit count to Internet subnet mask
20 <A NAME="lbAC">&nbsp;</A>
21 <H2>SYNOPSIS</H2>
22
23 <B>#include &lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
24
25 <P>
26 <B>int goodmask(struct in_addr mask);</B>
27
28 <BR>
29
30 <B>int masktobits(struct in_addr mask);</B>
31
32 <BR>
33
34 <B>struct in_addr bitstomask(int n);</B>
35
36 <A NAME="lbAD">&nbsp;</A>
37 <H2>DESCRIPTION</H2>
38
39 These functions are obsolete;
40 see
41 <I><A HREF="ipsec_masktocount.3.html">ipsec_masktocount</A></I>(3)
42
43 for a partial replacement.
44 <P>
45
46 <I>Goodmask</I>
47
48 reports whether the subnet
49 <I>mask</I>
50
51 is a valid one,
52 i.e. consists of a (possibly empty) sequence of
53 <B>1</B>s
54
55 followed by a (possibly empty) sequence of
56 <B>0</B>s.
57
58 <I>Masktobits</I>
59
60 takes a (valid) subnet mask and returns the number of
61 <B>1</B>
62
63 bits in it.
64 <I>Bitstomask</I>
65
66 reverses this,
67 returning the subnet mask corresponding to bit count
68 <I>n</I>.
69
70 <P>
71
72 All masks are in network byte order.
73 <A NAME="lbAE">&nbsp;</A>
74 <H2>SEE ALSO</H2>
75
76 <A HREF="inet.3.html">inet</A>(3), <A HREF="ipsec_atosubnet.3.html">ipsec_atosubnet</A>(3)
77 <A NAME="lbAF">&nbsp;</A>
78 <H2>DIAGNOSTICS</H2>
79
80 <I>Masktobits</I>
81
82 returns
83 <B>-1</B>
84
85 for an invalid mask.
86 <I>Bitstomask</I>
87
88 returns an all-zeros mask for a negative or out-of-range
89 <I>n</I>.
90
91 <A NAME="lbAG">&nbsp;</A>
92 <H2>HISTORY</H2>
93
94 Written for the FreeS/WAN project by Henry Spencer.
95 <A NAME="lbAH">&nbsp;</A>
96 <H2>BUGS</H2>
97
98 The error-reporting convention of
99 <I>bitstomask</I>
100
101 is less than ideal;
102 zero is sometimes a legitimate mask.
103 <P>
104
105 <HR>
106 <A NAME="index">&nbsp;</A><H2>Index</H2>
107 <DL>
108 <DT><A HREF="#lbAB">NAME</A><DD>
109 <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
110 <DT><A HREF="#lbAD">DESCRIPTION</A><DD>
111 <DT><A HREF="#lbAE">SEE ALSO</A><DD>
112 <DT><A HREF="#lbAF">DIAGNOSTICS</A><DD>
113 <DT><A HREF="#lbAG">HISTORY</A><DD>
114 <DT><A HREF="#lbAH">BUGS</A><DD>
115 </DL>
116 <HR>
117 This document was created by
118 <A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
119 using the manual pages.<BR>
120 Time: 05:09:32 GMT, June 19, 2001
121 </BODY>
122 </HTML>