]> git.ipfire.org Git - people/ms/strongswan.git/blob - doc/manpage.d/ipsec_subnettypeof.3.html
- import of strongswan-2.7.0
[people/ms/strongswan.git] / doc / manpage.d / ipsec_subnettypeof.3.html
1 Content-type: text/html
2
3 <HTML><HEAD><TITLE>Manpage of IPSEC_INITSUBNET</TITLE>
4 </HEAD><BODY>
5 <H1>IPSEC_INITSUBNET</H1>
6 Section: 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
13 ipsec initsubnet - initialize an ip_subnet
14 <BR>
15
16 ipsec addrtosubnet - initialize a singleton ip_subnet
17 <BR>
18
19 ipsec subnettypeof - get address type of an ip_subnet
20 <BR>
21
22 ipsec masktocount - convert subnet mask to bit count
23 <BR>
24
25 ipsec networkof - get base address of an ip_subnet
26 <BR>
27
28 ipsec 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
67 The
68 <B>&lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
69
70 library uses an internal type
71 <I>ip_subnet</I>
72
73 to contain a description of an IP subnet
74 (base address plus mask).
75 These functions provide basic tools for creating and examining this type.
76 <P>
77
78 <I>Initsubnet</I>
79
80 initializes a variable
81 <I>*dst</I>
82
83 of type
84 <I>ip_subnet</I>
85
86 from a base address and
87 a count of mask bits.
88 The
89 <I>clash</I>
90
91 parameter specifies what to do if the base address includes
92 <B>1</B>
93
94 bits 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>
99 zero out host-number bits
100 <DT>'x'<DD>
101 non-zero host-number bits are an error
102 </DL>
103 </DL>
104
105 <P>
106
107 <I>Initsubnet</I>
108
109 returns
110 <B>NULL</B>
111
112 for success and
113 a pointer to a string-literal error message for failure;
114 see DIAGNOSTICS.
115 <P>
116
117 <I>Addrtosubnet</I>
118
119 initializes an
120 <I>ip_subnet</I>
121
122 variable
123 <I>*dst</I>
124
125 to a ``singleton subnet'' containing the single address
126 <I>*addr</I>.
127
128 It returns
129 <B>NULL</B>
130
131 for success and
132 a pointer to a string-literal error message for failure.
133 <P>
134
135 <I>Subnettypeof</I>
136
137 returns the address type of a subnet,
138 normally
139 <B>AF_INET</B>
140
141 or
142 <B>AF_INET6</B>.
143
144 (The
145 <B>&lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
146
147 header file arranges to include the necessary headers for these
148 names to be known.)
149 <P>
150
151 <I>Masktocount</I>
152
153 converts a subnet mask, expressed as an address, to a bit count
154 suitable for use with
155 <I>initsubnet</I>.
156
157 It returns
158 <B>-1</B>
159
160 for error; see DIAGNOSTICS.
161 <P>
162
163 <I>Networkof</I>
164
165 fills in
166 <I>*dst</I>
167
168 with the base address of subnet
169 <I>src</I>.
170
171 <P>
172
173 <I>Maskof</I>
174
175 fills in
176 <I>*dst</I>
177
178 with the subnet mask of subnet
179 <I>src</I>,
180
181 expressed 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
189 Fatal errors in
190 <I>initsubnet</I>
191
192 are:
193 unknown address family;
194 unknown
195 <I>clash</I>
196
197 value;
198 impossible mask bit count;
199 non-zero host-number bits and
200 <I>clash</I>
201
202 is
203 <B>'x'</B>.
204
205 Fatal errors in
206 <I>addrtosubnet</I>
207
208 are:
209 unknown address family.
210 Fatal errors in
211 <I>masktocount</I>
212
213 are:
214 unknown address family;
215 mask bits not contiguous.
216 <A NAME="lbAG">&nbsp;</A>
217 <H2>HISTORY</H2>
218
219 Written 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>
233 This document was created by
234 <A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
235 using the manual pages.<BR>
236 Time: 21:40:18 GMT, November 11, 2003
237 </BODY>
238 </HTML>