OSDN Git Service

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