]> git.ipfire.org Git - people/ms/strongswan.git/blame - doc/manpage.d/ipsec_subnettypeof.3.html
- import of strongswan-2.7.0
[people/ms/strongswan.git] / doc / manpage.d / ipsec_subnettypeof.3.html
CommitLineData
997358a6
MW
1Content-type: text/html
2
3<HTML><HEAD><TITLE>Manpage of IPSEC_INITSUBNET</TITLE>
4</HEAD><BODY>
5<H1>IPSEC_INITSUBNET</H1>
6Section: C Library Functions (3)<BR>Updated: 12 March 2002<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
13ipsec initsubnet - initialize an ip_subnet
14<BR>
15
16ipsec addrtosubnet - initialize a singleton ip_subnet
17<BR>
18
19ipsec subnettypeof - get address type of an ip_subnet
20<BR>
21
22ipsec masktocount - convert subnet mask to bit count
23<BR>
24
25ipsec networkof - get base address of an ip_subnet
26<BR>
27
28ipsec maskof - get subnet mask of an ip_subnet
29<A NAME="lbAC">&nbsp;</A>
30<H2>SYNOPSIS</H2>
31
32<B>#include &lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
33
34<P>
35<B>const char *initsubnet(const ip_address *addr,</B>
36
37<BR>
38&nbsp;
39<B>int maskbits, int clash, ip_subnet *dst);</B>
40
41<BR>
42
43<B>const char *addrtosubnet(const ip_address *addr,</B>
44
45<BR>
46&nbsp;
47<B>ip_subnet *dst);</B>
48
49<P>
50<B>int subnettypeof(const ip_subnet *src);</B>
51
52<BR>
53
54<B>int masktocount(const ip_address *src);</B>
55
56<BR>
57
58<B>void networkof(const ip_subnet *src, ip_address *dst);</B>
59
60<BR>
61
62<B>void maskof(const ip_subnet *src, ip_address *dst);</B>
63
64<A NAME="lbAD">&nbsp;</A>
65<H2>DESCRIPTION</H2>
66
67The
68<B>&lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
69
70library uses an internal type
71<I>ip_subnet</I>
72
73to contain a description of an IP subnet
74(base address plus mask).
75These functions provide basic tools for creating and examining this type.
76<P>
77
78<I>Initsubnet</I>
79
80initializes a variable
81<I>*dst</I>
82
83of type
84<I>ip_subnet</I>
85
86from a base address and
87a count of mask bits.
88The
89<I>clash</I>
90
91parameter specifies what to do if the base address includes
92<B>1</B>
93
94bits outside the prefix specified by the mask
95(that is, in the ``host number'' part of the address):
96<DL COMPACT><DT><DD>
97<DL COMPACT>
98<DT>'0'<DD>
99zero out host-number bits
100<DT>'x'<DD>
101non-zero host-number bits are an error
102</DL>
103</DL>
104
105<P>
106
107<I>Initsubnet</I>
108
109returns
110<B>NULL</B>
111
112for success and
113a pointer to a string-literal error message for failure;
114see DIAGNOSTICS.
115<P>
116
117<I>Addrtosubnet</I>
118
119initializes an
120<I>ip_subnet</I>
121
122variable
123<I>*dst</I>
124
125to a ``singleton subnet'' containing the single address
126<I>*addr</I>.
127
128It returns
129<B>NULL</B>
130
131for success and
132a pointer to a string-literal error message for failure.
133<P>
134
135<I>Subnettypeof</I>
136
137returns the address type of a subnet,
138normally
139<B>AF_INET</B>
140
141or
142<B>AF_INET6</B>.
143
144(The
145<B>&lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
146
147header file arranges to include the necessary headers for these
148names to be known.)
149<P>
150
151<I>Masktocount</I>
152
153converts a subnet mask, expressed as an address, to a bit count
154suitable for use with
155<I>initsubnet</I>.
156
157It returns
158<B>-1</B>
159
160for error; see DIAGNOSTICS.
161<P>
162
163<I>Networkof</I>
164
165fills in
166<I>*dst</I>
167
168with the base address of subnet
169<I>src</I>.
170
171<P>
172
173<I>Maskof</I>
174
175fills in
176<I>*dst</I>
177
178with the subnet mask of subnet
179<I>src</I>,
180
181expressed as an address.
182<A NAME="lbAE">&nbsp;</A>
183<H2>SEE ALSO</H2>
184
185<A HREF="inet.3.html">inet</A>(3), <A HREF="ipsec_ttosubnet.3.html">ipsec_ttosubnet</A>(3), <A HREF="ipsec_rangetosubnet.3.html">ipsec_rangetosubnet</A>(3)
186<A NAME="lbAF">&nbsp;</A>
187<H2>DIAGNOSTICS</H2>
188
189Fatal errors in
190<I>initsubnet</I>
191
192are:
193unknown address family;
194unknown
195<I>clash</I>
196
197value;
198impossible mask bit count;
199non-zero host-number bits and
200<I>clash</I>
201
202is
203<B>'x'</B>.
204
205Fatal errors in
206<I>addrtosubnet</I>
207
208are:
209unknown address family.
210Fatal errors in
211<I>masktocount</I>
212
213are:
214unknown address family;
215mask bits not contiguous.
216<A NAME="lbAG">&nbsp;</A>
217<H2>HISTORY</H2>
218
219Written for the FreeS/WAN project by Henry Spencer.
220<P>
221
222<HR>
223<A NAME="index">&nbsp;</A><H2>Index</H2>
224<DL>
225<DT><A HREF="#lbAB">NAME</A><DD>
226<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
227<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
228<DT><A HREF="#lbAE">SEE ALSO</A><DD>
229<DT><A HREF="#lbAF">DIAGNOSTICS</A><DD>
230<DT><A HREF="#lbAG">HISTORY</A><DD>
231</DL>
232<HR>
233This document was created by
234<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
235using the manual pages.<BR>
236Time: 21:40:18 GMT, November 11, 2003
237</BODY>
238</HTML>