OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / doc / manpage.d / ipsec_addrbytesof.3.html
1 Content-type: text/html
2
3 <HTML><HEAD><TITLE>Manpage of IPSEC_INITADDR</TITLE>
4 </HEAD><BODY>
5 <H1>IPSEC_INITADDR</H1>
6 Section: 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
13 ipsec initaddr - initialize an ip_address
14 <BR>
15
16 ipsec addrtypeof - get address type of an ip_address
17 <BR>
18
19 ipsec addrlenof - get length of address within an ip_address
20 <BR>
21
22 ipsec addrbytesof - get copy of address within an ip_address
23 <BR>
24
25 ipsec 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, unsigned char *dst,</B>
49
50 <BR>
51 &nbsp;
52 <B>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
65 The
66 <B>&lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
67
68 library uses an internal type
69 <I>ip_address</I>
70
71 to contain one of the (currently two) types of IP address.
72 These functions provide basic tools for creating and examining this type.
73 <P>
74
75 <I>Initaddr</I>
76
77 initializes a variable
78 <I>*dst</I>
79
80 of type
81 <I>ip_address</I>
82
83 from an address
84 (in network byte order,
85 indicated by a pointer
86 <I>src</I>
87
88 and a length
89 <I>srclen</I>)
90
91 and an address family
92 <I>af</I>
93
94 (typically
95 <B>AF_INET</B>
96
97 or
98 <B>AF_INET6</B>).
99
100 The length must be consistent with the address family.
101 <P>
102
103 <I>Addrtypeof</I>
104
105 returns the address type of an address,
106 normally
107 <B>AF_INET</B>
108
109 or
110 <B>AF_INET6</B>.
111
112 (The
113 <B>&lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
114
115 header file arranges to include the necessary headers for these
116 names to be known.)
117 <P>
118
119 <I>Addrlenof</I>
120
121 returns the size (in bytes) of the address within an
122 <I>ip_address</I>,
123
124 to permit storage allocation etc.
125 <P>
126
127 <I>Addrbytesof</I>
128
129 copies the address within the
130 <I>ip_address</I>
131
132 <I>src</I>
133
134 to the buffer indicated by the pointer
135 <I>dst</I>
136
137 and the length
138 <I>dstlen</I>,
139
140 and returns the address length.
141 If the address will not fit,
142 as many bytes as will fit are copied;
143 the returned length is still the full length.
144 It is the caller's responsibility to check the
145 returned value to ensure that there was enough room.
146 <P>
147
148 <I>Addrbytesptr</I>
149
150 sets
151 <I>*dst</I>
152
153 to a pointer to the internal address within the
154 <I>ip_address</I>,
155
156 and returns the address length.
157 If
158 <I>dst</I>
159
160 is
161 <B>NULL</B>,
162
163 it just returns the address length.
164 The pointer points to
165 <B>const</B>
166
167 to discourage misuse.
168 <P>
169
170 <I>Initaddr</I>
171
172 returns
173 <B>NULL</B>
174
175 for success and
176 a pointer to a string-literal error message for failure;
177 see DIAGNOSTICS.
178 <P>
179
180 The functions which return
181 <I>size_t</I>
182
183 return
184 <B>0</B>
185
186 for 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
194 An unknown address family is a fatal error for any of these functions
195 except
196 <I>addrtypeof</I>.
197
198 An address-size mismatch is a fatal error for
199 <I>initaddr</I>.
200
201 <A NAME="lbAG">&nbsp;</A>
202 <H2>HISTORY</H2>
203
204 Written for the FreeS/WAN project by Henry Spencer.
205 <A NAME="lbAH">&nbsp;</A>
206 <H2>BUGS</H2>
207
208 <I>Addrtypeof</I>
209
210 should 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>
227 This document was created by
228 <A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
229 using the manual pages.<BR>
230 Time: 05:09:30 GMT, June 19, 2001
231 </BODY>
232 </HTML>