1
Content-type: text/html
3
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<HTML><HEAD><TITLE>Man page of IPSEC_ATOASR</TITLE>
7
Section: C Library Functions (3)<BR>Updated: 11 June 2001<BR><A HREF="#index">Index</A>
8
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
11
<A NAME="lbAB"> </A>
14
ipsec atoasr - convert ASCII to Internet address, subnet, or range
17
ipsec rangetoa - convert Internet address range to ASCII
18
<A NAME="lbAC"> </A>
21
<B>#include <<A HREF="file:///usr/include/freeswan.h">freeswan.h</A>></B>
24
<B>const char *atoasr(const char *src, size_t srclen,</B>
28
<B>char *type, struct in_addr *addrs);</B>
32
<B>size_t rangetoa(struct in_addr *addrs, int format,</B>
36
<B>char *dst, size_t dstlen);</B>
38
<A NAME="lbAD"> </A>
41
These functions are obsolete;
42
there is no current equivalent,
43
because so far they have not proved useful.
48
converts an ASCII address, subnet, or address range
49
into a suitable combination of binary addresses
50
(in network byte order).
53
converts an address range back into ASCII,
54
using dotted-decimal form for the addresses
55
(the other reverse conversions are handled by
56
<I><A HREF="/cgi-bin/man/man2html?3+ipsec_addrtoa">ipsec_addrtoa</A></I>(3)
59
<I><A HREF="/cgi-bin/man/man2html?3+ipsec_subnettoa">ipsec_subnettoa</A></I>(3)).
63
A single address can be any form acceptable to
64
<I><A HREF="/cgi-bin/man/man2html?3+ipsec_atoaddr">ipsec_atoaddr</A></I>(3):
66
dotted decimal, DNS name, or hexadecimal number.
68
specification uses the form <I>network</I><B>/</B><I>mask</I>
70
<I><A HREF="/cgi-bin/man/man2html?3+ipsec_atosubnet">ipsec_atosubnet</A></I>(3).
74
An address range is two
75
<I><A HREF="/cgi-bin/man/man2html?3+ipsec_atoaddr">ipsec_atoaddr</A></I>(3)
77
addresses separated by a
81
If there are four dots rather than three, the first is taken as
82
part of the begin address,
83
e.g. for a complete DNS name which ends with
86
to suppress completion attempts.
87
The begin address of a range must be
88
less than or equal to the end address.
97
specifies the length of the ASCII string pointed to by
100
it is an error for there to be anything else
101
(e.g., a terminating NUL) within that length.
102
As a convenience for cases where an entire NUL-terminated string is
124
variable used to record which form was found.
128
parameter must point to a two-element array of
129
<B>struct in_addr</B>
131
which receives the results.
132
The values stored into
135
and the corresponding values in the array, are:
140
<TT> </TT>*typeaddrs[0]addrs[1]<BR>
142
address<B>'a'</B>address-<BR>
145
subnet<TT> </TT><B>'s'</B>networkmask<BR>
148
range<TT> </TT><B>'r'</B>beginend<BR>
157
specifies the size of the
161
under no circumstances are more than
167
A result which will not fit is truncated.
170
can be zero, in which case
173
need not be valid and no result is written,
174
but the return value is unaffected;
175
in all other cases, the (possibly truncated) result is NUL-terminated.
179
header file defines a constant,
182
which is the size of a buffer just large enough for worst-case results.
191
specifies what format is to be used for the conversion.
195
(not the ASCII character
199
specifies a reasonable default,
200
and is in fact the only format currently available.
201
This parameter is a hedge against future needs.
206
returns NULL for success and
207
a pointer to a string-literal error message for failure;
214
for a failure, and otherwise
215
always returns the size of buffer which would
217
accommodate the full conversion result, including terminating NUL;
218
it is the caller's responsibility to check this against the size of
219
the provided buffer to determine whether truncation has occurred.
220
<A NAME="lbAE"> </A>
223
<A HREF="/cgi-bin/man/man2html?3+ipsec_atoaddr">ipsec_atoaddr</A>(3), <A HREF="/cgi-bin/man/man2html?3+ipsec_atosubnet">ipsec_atosubnet</A>(3)
224
<A NAME="lbAF"> </A>
233
<I><A HREF="/cgi-bin/man/man2html?3+ipsec_atoaddr">ipsec_atoaddr</A></I>(3)
236
<I><A HREF="/cgi-bin/man/man2html?3+ipsec_atosubnet">ipsec_atosubnet</A></I>(3)
239
begin address of range exceeds end address.
247
<A NAME="lbAG"> </A>
250
Written for the FreeS/WAN project by Henry Spencer.
251
<A NAME="lbAH"> </A>
254
The restriction of error reports to literal strings
255
(so that callers don't need to worry about freeing them or copying them)
256
does limit the precision of error reporting.
259
The error-reporting convention lends itself
260
to slightly obscure code,
261
because many readers will not think of NULL as signifying success.
262
A good way to make it clearer is to write something like:
267
<B>const char *error;</B>
269
<B>error = atoasr( /* ... */ );</B>
270
<B>if (error != NULL) {</B>
271
<B> /* something went wrong */</B>
279
<A NAME="index"> </A><H2>Index</H2>
281
<DT><A HREF="#lbAB">NAME</A><DD>
282
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
283
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
284
<DT><A HREF="#lbAE">SEE ALSO</A><DD>
285
<DT><A HREF="#lbAF">DIAGNOSTICS</A><DD>
286
<DT><A HREF="#lbAG">HISTORY</A><DD>
287
<DT><A HREF="#lbAH">BUGS</A><DD>
290
This document was created by
291
<A HREF="/cgi-bin/man/man2html">man2html</A>,
292
using the manual pages.<BR>
293
Time: 10:29:41 GMT, June 17, 2004