]> git.ipfire.org Git - people/ms/strongswan.git/blame - doc/manpage.d/ipsec_addrlenof.3.html
(no commit message)
[people/ms/strongswan.git] / doc / manpage.d / ipsec_addrlenof.3.html
CommitLineData
997358a6
MW
1Content-type: text/html
2
3<HTML><HEAD><TITLE>Manpage of IPSEC_INITADDR</TITLE>
4</HEAD><BODY>
5<H1>IPSEC_INITADDR</H1>
6Section: C Library Functions (3)<BR>Updated: 11 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
13ipsec initaddr - initialize an ip_address
14<BR>
15
16ipsec addrtypeof - get address type of an ip_address
17<BR>
18
19ipsec addrlenof - get length of address within an ip_address
20<BR>
21
22ipsec addrbytesof - get copy of address within an ip_address
23<BR>
24
25ipsec addrbytesptr - get pointer to address within an ip_address
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 *initaddr(const char *src, size_t srclen,</B>
33
34<BR>
35&nbsp;
36<B>int af, ip_address *dst);</B>
37
38<BR>
39
40<B>int addrtypeof(const ip_address *src);</B>
41
42<BR>
43
44<B>size_t addrlenof(const ip_address *src);</B>
45
46<BR>
47
48<B>size_t addrbytesof(const ip_address *src,</B>
49
50<BR>
51&nbsp;
52<B>unsigned char *dst, size_t dstlen);</B>
53
54<BR>
55
56<B>size_t addrbytesptr(const ip_address *src,</B>
57
58<BR>
59&nbsp;
60<B>const unsigned char **dst);</B>
61
62<A NAME="lbAD">&nbsp;</A>
63<H2>DESCRIPTION</H2>
64
65The
66<B>&lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
67
68library uses an internal type
69<I>ip_address</I>
70
71to contain one of the (currently two) types of IP address.
72These functions provide basic tools for creating and examining this type.
73<P>
74
75<I>Initaddr</I>
76
77initializes a variable
78<I>*dst</I>
79
80of type
81<I>ip_address</I>
82
83from an address
84(in network byte order,
85indicated by a pointer
86<I>src</I>
87
88and a length
89<I>srclen</I>)
90
91and an address family
92<I>af</I>
93
94(typically
95<B>AF_INET</B>
96
97or
98<B>AF_INET6</B>).
99
100The length must be consistent with the address family.
101<P>
102
103<I>Addrtypeof</I>
104
105returns the address type of an address,
106normally
107<B>AF_INET</B>
108
109or
110<B>AF_INET6</B>.
111
112(The
113<B>&lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
114
115header file arranges to include the necessary headers for these
116names to be known.)
117<P>
118
119<I>Addrlenof</I>
120
121returns the size (in bytes) of the address within an
122<I>ip_address</I>,
123
124to permit storage allocation etc.
125<P>
126
127<I>Addrbytesof</I>
128
129copies the address within the
130<I>ip_address</I>
131
132<I>src</I>
133
134to the buffer indicated by the pointer
135<I>dst</I>
136
137and the length
138<I>dstlen</I>,
139
140and returns the address length (in bytes).
141If the address will not fit,
142as many bytes as will fit are copied;
143the returned length is still the full length.
144It is the caller's responsibility to check the
145returned value to ensure that there was enough room.
146<P>
147
148<I>Addrbytesptr</I>
149
150sets
151<I>*dst</I>
152
153to a pointer to the internal address within the
154<I>ip_address</I>,
155
156and returns the address length (in bytes).
157If
158<I>dst</I>
159
160is
161<B>NULL</B>,
162
163it just returns the address length.
164The pointer points to
165<B>const</B>
166
167to discourage misuse.
168<P>
169
170<I>Initaddr</I>
171
172returns
173<B>NULL</B>
174
175for success and
176a pointer to a string-literal error message for failure;
177see DIAGNOSTICS.
178<P>
179
180The functions which return
181<I>size_t</I>
182
183return
184<B>0</B>
185
186for a failure.
187<A NAME="lbAE">&nbsp;</A>
188<H2>SEE ALSO</H2>
189
190<A HREF="inet.3.html">inet</A>(3), <A HREF="ipsec_ttoaddr.3.html">ipsec_ttoaddr</A>(3)
191<A NAME="lbAF">&nbsp;</A>
192<H2>DIAGNOSTICS</H2>
193
194An unknown address family is a fatal error for any of these functions
195except
196<I>addrtypeof</I>.
197
198An address-size mismatch is a fatal error for
199<I>initaddr</I>.
200
201<A NAME="lbAG">&nbsp;</A>
202<H2>HISTORY</H2>
203
204Written for the FreeS/WAN project by Henry Spencer.
205<A NAME="lbAH">&nbsp;</A>
206<H2>BUGS</H2>
207
208<I>Addrtypeof</I>
209
210should probably have been named
211<I>addrfamilyof</I>.
212
213<P>
214
215<HR>
216<A NAME="index">&nbsp;</A><H2>Index</H2>
217<DL>
218<DT><A HREF="#lbAB">NAME</A><DD>
219<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
220<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
221<DT><A HREF="#lbAE">SEE ALSO</A><DD>
222<DT><A HREF="#lbAF">DIAGNOSTICS</A><DD>
223<DT><A HREF="#lbAG">HISTORY</A><DD>
224<DT><A HREF="#lbAH">BUGS</A><DD>
225</DL>
226<HR>
227This document was created by
228<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
229using the manual pages.<BR>
230Time: 21:40:17 GMT, November 11, 2003
231</BODY>
232</HTML>