]> git.ipfire.org Git - thirdparty/strongswan.git/blame - doc/manpage.d/ipsec_atoasr.3.html
- import of strongswan-2.7.0
[thirdparty/strongswan.git] / doc / manpage.d / ipsec_atoasr.3.html
CommitLineData
997358a6
MW
1Content-type: text/html
2
3<HTML><HEAD><TITLE>Manpage of IPSEC_ATOASR</TITLE>
4</HEAD><BODY>
5<H1>IPSEC_ATOASR</H1>
6Section: C Library Functions (3)<BR>Updated: 11 June 2001<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 atoasr - convert ASCII to Internet address, subnet, or range
14<BR>
15
16ipsec rangetoa - convert Internet address range to ASCII
17<A NAME="lbAC">&nbsp;</A>
18<H2>SYNOPSIS</H2>
19
20<B>#include &lt;<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>&gt;</B>
21
22<P>
23<B>const char *atoasr(const char *src, size_t srclen,</B>
24
25<BR>
26&nbsp;
27<B>char *type, struct in_addr *addrs);</B>
28
29<BR>
30
31<B>size_t rangetoa(struct in_addr *addrs, int format,</B>
32
33<BR>
34&nbsp;
35<B>char *dst, size_t dstlen);</B>
36
37<A NAME="lbAD">&nbsp;</A>
38<H2>DESCRIPTION</H2>
39
40These functions are obsolete;
41there is no current equivalent,
42because so far they have not proved useful.
43<P>
44
45<I>Atoasr</I>
46
47converts an ASCII address, subnet, or address range
48into a suitable combination of binary addresses
49(in network byte order).
50<I>Rangetoa</I>
51
52converts an address range back into ASCII,
53using dotted-decimal form for the addresses
54(the other reverse conversions are handled by
55<I><A HREF="ipsec_addrtoa.3.html">ipsec_addrtoa</A></I>(3)
56
57and
58<I><A HREF="ipsec_subnettoa.3.html">ipsec_subnettoa</A></I>(3)).
59
60<P>
61
62A single address can be any form acceptable to
63<I><A HREF="ipsec_atoaddr.3.html">ipsec_atoaddr</A></I>(3):
64
65dotted decimal, DNS name, or hexadecimal number.
66A subnet
67specification uses the form <I>network</I><B>/</B><I>mask</I>
68interpreted by
69<I><A HREF="ipsec_atosubnet.3.html">ipsec_atosubnet</A></I>(3).
70
71<P>
72
73An address range is two
74<I><A HREF="ipsec_atoaddr.3.html">ipsec_atoaddr</A></I>(3)
75
76addresses separated by a
77<B>...</B>
78
79delimiter.
80If there are four dots rather than three, the first is taken as
81part of the begin address,
82e.g. for a complete DNS name which ends with
83<B>.</B>
84
85to suppress completion attempts.
86The begin address of a range must be
87less than or equal to the end address.
88<P>
89
90The
91<I>srclen</I>
92
93parameter of
94<I>atoasr</I>
95
96specifies the length of the ASCII string pointed to by
97<I>src</I>;
98
99it is an error for there to be anything else
100(e.g., a terminating NUL) within that length.
101As a convenience for cases where an entire NUL-terminated string is
102to be converted,
103a
104<I>srclen</I>
105
106value of
107<B>0</B>
108
109is taken to mean
110<B>strlen(src)</B>.
111
112<P>
113
114The
115<I>type</I>
116
117parameter of
118<I>atoasr</I>
119
120must point to a
121<B>char</B>
122
123variable used to record which form was found.
124The
125<I>addrs</I>
126
127parameter must point to a two-element array of
128<B>struct in_addr</B>
129
130which receives the results.
131The values stored into
132<B>*type</B>,
133
134and the corresponding values in the array, are:
135<P>
136
137
138
139<TT>&nbsp;&nbsp;&nbsp;</TT>*typeaddrs[0]addrs[1]<BR>
140<P>
141address<B>'a'</B>address-<BR>
142<BR>
143
144subnet<TT>&nbsp;</TT><B>'s'</B>networkmask<BR>
145<BR>
146
147range<TT>&nbsp;&nbsp;</TT><B>'r'</B>beginend<BR>
148<P>
149
150The
151<I>dstlen</I>
152
153parameter of
154<I>rangetoa</I>
155
156specifies the size of the
157<I>dst</I>
158
159parameter;
160under no circumstances are more than
161<I>dstlen</I>
162
163bytes written to
164<I>dst</I>.
165
166A result which will not fit is truncated.
167<I>Dstlen</I>
168
169can be zero, in which case
170<I>dst</I>
171
172need not be valid and no result is written,
173but the return value is unaffected;
174in all other cases, the (possibly truncated) result is NUL-terminated.
175The
176<I>freeswan.h</I>
177
178header file defines a constant,
179<B>RANGETOA_BUF</B>,
180
181which is the size of a buffer just large enough for worst-case results.
182<P>
183
184The
185<I>format</I>
186
187parameter of
188<I>rangetoa</I>
189
190specifies what format is to be used for the conversion.
191The value
192<B>0</B>
193
194(not the ASCII character
195<B>'0'</B>,
196
197but a zero value)
198specifies a reasonable default,
199and is in fact the only format currently available.
200This parameter is a hedge against future needs.
201<P>
202
203<I>Atoasr</I>
204
205returns NULL for success and
206a pointer to a string-literal error message for failure;
207see DIAGNOSTICS.
208<I>Rangetoa</I>
209
210returns
211<B>0</B>
212
213for a failure, and otherwise
214always returns the size of buffer which would
215be needed to
216accommodate the full conversion result, including terminating NUL;
217it is the caller's responsibility to check this against the size of
218the provided buffer to determine whether truncation has occurred.
219<A NAME="lbAE">&nbsp;</A>
220<H2>SEE ALSO</H2>
221
222<A HREF="ipsec_atoaddr.3.html">ipsec_atoaddr</A>(3), <A HREF="ipsec_atosubnet.3.html">ipsec_atosubnet</A>(3)
223<A NAME="lbAF">&nbsp;</A>
224<H2>DIAGNOSTICS</H2>
225
226Fatal errors in
227<I>atoasr</I>
228
229are:
230empty input;
231error in
232<I><A HREF="ipsec_atoaddr.3.html">ipsec_atoaddr</A></I>(3)
233
234or
235<I><A HREF="ipsec_atosubnet.3.html">ipsec_atosubnet</A></I>(3)
236
237during conversion;
238begin address of range exceeds end address.
239<P>
240
241Fatal errors in
242<I>rangetoa</I>
243
244are:
245unknown format.
246<A NAME="lbAG">&nbsp;</A>
247<H2>HISTORY</H2>
248
249Written for the FreeS/WAN project by Henry Spencer.
250<A NAME="lbAH">&nbsp;</A>
251<H2>BUGS</H2>
252
253The restriction of error reports to literal strings
254(so that callers don't need to worry about freeing them or copying them)
255does limit the precision of error reporting.
256<P>
257
258The error-reporting convention lends itself
259to slightly obscure code,
260because many readers will not think of NULL as signifying success.
261A good way to make it clearer is to write something like:
262<P>
263
264<DL COMPACT><DT><DD>
265<PRE>
266<B>const char *error;</B>
267
268<B>error = atoasr( /* ... */ );</B>
269<B>if (error != NULL) {</B>
270<B> /* something went wrong */</B>
271</PRE>
272
273</DL>
274
275<P>
276
277<HR>
278<A NAME="index">&nbsp;</A><H2>Index</H2>
279<DL>
280<DT><A HREF="#lbAB">NAME</A><DD>
281<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
282<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
283<DT><A HREF="#lbAE">SEE ALSO</A><DD>
284<DT><A HREF="#lbAF">DIAGNOSTICS</A><DD>
285<DT><A HREF="#lbAG">HISTORY</A><DD>
286<DT><A HREF="#lbAH">BUGS</A><DD>
287</DL>
288<HR>
289This document was created by
290<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
291using the manual pages.<BR>
292Time: 21:40:17 GMT, November 11, 2003
293</BODY>
294</HTML>