summaryrefslogtreecommitdiff
path: root/doc/manpage.d/ipsec_goodmask.3.html
blob: a67a08d8321f3ab0d9a28ec6f0553a653258586b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Content-type: text/html

<HTML><HEAD><TITLE>Manpage of IPSEC_GOODMASK</TITLE>
</HEAD><BODY>
<H1>IPSEC_GOODMASK</H1>
Section: C Library Functions (3)<BR>Updated: 11 June 2001<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>


<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>

ipsec goodmask - is this Internet subnet mask a valid one?
<BR>

ipsec masktobits - convert Internet subnet mask to bit count
<BR>

ipsec bitstomask - convert bit count to Internet subnet mask
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>

<B>#include &lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>

<P>
<B>int goodmask(struct in_addr mask);</B>

<BR>

<B>int masktobits(struct in_addr mask);</B>

<BR>

<B>struct in_addr bitstomask(int n);</B>

<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>

These functions are obsolete;
see
<I><A HREF="ipsec_masktocount.3.html">ipsec_masktocount</A></I>(3)

for a partial replacement.
<P>

<I>Goodmask</I>

reports whether the subnet
<I>mask</I>

is a valid one,
i.e. consists of a (possibly empty) sequence of
<B>1</B>s

followed by a (possibly empty) sequence of
<B>0</B>s.

<I>Masktobits</I>

takes a (valid) subnet mask and returns the number of
<B>1</B>

bits in it.
<I>Bitstomask</I>

reverses this,
returning the subnet mask corresponding to bit count
<I>n</I>.

<P>

All masks are in network byte order.
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>

<A HREF="inet.3.html">inet</A>(3), <A HREF="ipsec_atosubnet.3.html">ipsec_atosubnet</A>(3)
<A NAME="lbAF">&nbsp;</A>
<H2>DIAGNOSTICS</H2>

<I>Masktobits</I>

returns
<B>-1</B>

for an invalid mask.
<I>Bitstomask</I>

returns an all-zeros mask for a negative or out-of-range
<I>n</I>.

<A NAME="lbAG">&nbsp;</A>
<H2>HISTORY</H2>

Written for the FreeS/WAN project by Henry Spencer.
<A NAME="lbAH">&nbsp;</A>
<H2>BUGS</H2>

The error-reporting convention of
<I>bitstomask</I>

is less than ideal;
zero is sometimes a legitimate mask.
<P>

<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT><A HREF="#lbAE">SEE ALSO</A><DD>
<DT><A HREF="#lbAF">DIAGNOSTICS</A><DD>
<DT><A HREF="#lbAG">HISTORY</A><DD>
<DT><A HREF="#lbAH">BUGS</A><DD>
</DL>
<HR>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 21:40:17 GMT, November 11, 2003
</BODY>
</HTML>