1 Content-type: text/html
3 <HTML><HEAD><TITLE>Manpage of IPSEC_ATOASR
</TITLE>
6 Section: 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>
10 <A NAME=
"lbAB"> </A>
13 ipsec atoasr - convert ASCII to Internet address, subnet, or range
16 ipsec rangetoa - convert Internet address range to ASCII
17 <A NAME=
"lbAC"> </A>
20 <B>#include
<<A HREF=
"file:/usr/include/freeswan.h">freeswan.h
</A>></B>
23 <B>const char *atoasr(const char *src, size_t srclen,
</B>
27 <B>char *type, struct in_addr *addrs);
</B>
31 <B>size_t rangetoa(struct in_addr *addrs, int format,
</B>
35 <B>char *dst, size_t dstlen);
</B>
37 <A NAME=
"lbAD"> </A>
40 These functions are obsolete;
41 there is no current equivalent,
42 because so far they have not proved useful.
47 converts an ASCII address, subnet, or address range
48 into a suitable combination of binary addresses
49 (in network byte order).
52 converts an address range back into ASCII,
53 using 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)
58 <I><A HREF=
"ipsec_subnettoa.3.html">ipsec_subnettoa
</A></I>(
3)).
62 A single address can be any form acceptable to
63 <I><A HREF=
"ipsec_atoaddr.3.html">ipsec_atoaddr
</A></I>(
3):
65 dotted decimal, DNS name, or hexadecimal number.
67 specification uses the form
<I>network
</I><B>/
</B><I>mask
</I>
69 <I><A HREF=
"ipsec_atosubnet.3.html">ipsec_atosubnet
</A></I>(
3).
73 An address range is two
74 <I><A HREF=
"ipsec_atoaddr.3.html">ipsec_atoaddr
</A></I>(
3)
76 addresses separated by a
80 If there are four dots rather than three, the first is taken as
81 part of the begin address,
82 e.g. for a complete DNS name which ends with
85 to suppress completion attempts.
86 The begin address of a range must be
87 less than or equal to the end address.
96 specifies the length of the ASCII string pointed to by
99 it is an error for there to be anything else
100 (e.g., a terminating NUL) within that length.
101 As a convenience for cases where an entire NUL-terminated string is
123 variable used to record which form was found.
127 parameter must point to a two-element array of
128 <B>struct in_addr
</B>
130 which receives the results.
131 The values stored into
134 and the corresponding values in the array, are:
139 <TT> </TT>*typeaddrs[
0]addrs[
1]
<BR>
141 address
<B>'a'
</B>address-
<BR>
144 subnet
<TT> </TT><B>'s'
</B>networkmask
<BR>
147 range
<TT> </TT><B>'r'
</B>beginend
<BR>
156 specifies the size of the
160 under no circumstances are more than
166 A result which will not fit is truncated.
169 can be zero, in which case
172 need not be valid and no result is written,
173 but the return value is unaffected;
174 in all other cases, the (possibly truncated) result is NUL-terminated.
178 header file defines a constant,
181 which is the size of a buffer just large enough for worst-case results.
190 specifies what format is to be used for the conversion.
194 (not the ASCII character
198 specifies a reasonable default,
199 and is in fact the only format currently available.
200 This parameter is a hedge against future needs.
205 returns NULL for success and
206 a pointer to a string-literal error message for failure;
213 for a failure, and otherwise
214 always returns the size of buffer which would
216 accommodate the full conversion result, including terminating NUL;
217 it is the caller's responsibility to check this against the size of
218 the provided buffer to determine whether truncation has occurred.
219 <A NAME=
"lbAE"> </A>
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"> </A>
232 <I><A HREF=
"ipsec_atoaddr.3.html">ipsec_atoaddr
</A></I>(
3)
235 <I><A HREF=
"ipsec_atosubnet.3.html">ipsec_atosubnet
</A></I>(
3)
238 begin address of range exceeds end address.
246 <A NAME=
"lbAG"> </A>
249 Written for the FreeS/WAN project by Henry Spencer.
250 <A NAME=
"lbAH"> </A>
253 The restriction of error reports to literal strings
254 (so that callers don't need to worry about freeing them or copying them)
255 does limit the precision of error reporting.
258 The error-reporting convention lends itself
259 to slightly obscure code,
260 because many readers will not think of NULL as signifying success.
261 A good way to make it clearer is to write something like:
266 <B>const char *error;
</B>
268 <B>error = atoasr( /* ... */ );
</B>
269 <B>if (error != NULL) {
</B>
270 <B> /* something went wrong */
</B>
278 <A NAME=
"index"> </A><H2>Index
</H2>
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>
289 This document was created by
290 <A HREF=
"http://localhost/cgi-bin/man/man2html">man2html
</A>,
291 using the manual pages.
<BR>
292 Time:
21:
40:
17 GMT, November
11,
2003