295 lines
5.9 KiB
HTML
295 lines
5.9 KiB
HTML
Content-type: text/html
|
|
|
|
<HTML><HEAD><TITLE>Manpage of IPSEC_ATOASR</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>IPSEC_ATOASR</H1>
|
|
Section: C Library Functions (3)<BR>Updated: 11 June 2001<BR><A HREF="#index">Index</A>
|
|
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
ipsec atoasr - convert ASCII to Internet address, subnet, or range
|
|
<BR>
|
|
|
|
ipsec rangetoa - convert Internet address range to ASCII
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:/usr/include/freeswan.h">freeswan.h</A>></B>
|
|
|
|
<P>
|
|
<B>const char *atoasr(const char *src, size_t srclen,</B>
|
|
|
|
<BR>
|
|
|
|
<B>char *type, struct in_addr *addrs);</B>
|
|
|
|
<BR>
|
|
|
|
<B>size_t rangetoa(struct in_addr *addrs, int format,</B>
|
|
|
|
<BR>
|
|
|
|
<B>char *dst, size_t dstlen);</B>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
These functions are obsolete;
|
|
there is no current equivalent,
|
|
because so far they have not proved useful.
|
|
<P>
|
|
|
|
<I>Atoasr</I>
|
|
|
|
converts an ASCII address, subnet, or address range
|
|
into a suitable combination of binary addresses
|
|
(in network byte order).
|
|
<I>Rangetoa</I>
|
|
|
|
converts an address range back into ASCII,
|
|
using dotted-decimal form for the addresses
|
|
(the other reverse conversions are handled by
|
|
<I><A HREF="ipsec_addrtoa.3.html">ipsec_addrtoa</A></I>(3)
|
|
|
|
and
|
|
<I><A HREF="ipsec_subnettoa.3.html">ipsec_subnettoa</A></I>(3)).
|
|
|
|
<P>
|
|
|
|
A single address can be any form acceptable to
|
|
<I><A HREF="ipsec_atoaddr.3.html">ipsec_atoaddr</A></I>(3):
|
|
|
|
dotted decimal, DNS name, or hexadecimal number.
|
|
A subnet
|
|
specification uses the form <I>network</I><B>/</B><I>mask</I>
|
|
interpreted by
|
|
<I><A HREF="ipsec_atosubnet.3.html">ipsec_atosubnet</A></I>(3).
|
|
|
|
<P>
|
|
|
|
An address range is two
|
|
<I><A HREF="ipsec_atoaddr.3.html">ipsec_atoaddr</A></I>(3)
|
|
|
|
addresses separated by a
|
|
<B>...</B>
|
|
|
|
delimiter.
|
|
If there are four dots rather than three, the first is taken as
|
|
part of the begin address,
|
|
e.g. for a complete DNS name which ends with
|
|
<B>.</B>
|
|
|
|
to suppress completion attempts.
|
|
The begin address of a range must be
|
|
less than or equal to the end address.
|
|
<P>
|
|
|
|
The
|
|
<I>srclen</I>
|
|
|
|
parameter of
|
|
<I>atoasr</I>
|
|
|
|
specifies the length of the ASCII string pointed to by
|
|
<I>src</I>;
|
|
|
|
it is an error for there to be anything else
|
|
(e.g., a terminating NUL) within that length.
|
|
As a convenience for cases where an entire NUL-terminated string is
|
|
to be converted,
|
|
a
|
|
<I>srclen</I>
|
|
|
|
value of
|
|
<B>0</B>
|
|
|
|
is taken to mean
|
|
<B>strlen(src)</B>.
|
|
|
|
<P>
|
|
|
|
The
|
|
<I>type</I>
|
|
|
|
parameter of
|
|
<I>atoasr</I>
|
|
|
|
must point to a
|
|
<B>char</B>
|
|
|
|
variable used to record which form was found.
|
|
The
|
|
<I>addrs</I>
|
|
|
|
parameter must point to a two-element array of
|
|
<B>struct in_addr</B>
|
|
|
|
which receives the results.
|
|
The values stored into
|
|
<B>*type</B>,
|
|
|
|
and the corresponding values in the array, are:
|
|
<P>
|
|
|
|
|
|
|
|
<TT> </TT>*typeaddrs[0]addrs[1]<BR>
|
|
<P>
|
|
address<B>'a'</B>address-<BR>
|
|
<BR>
|
|
|
|
subnet<TT> </TT><B>'s'</B>networkmask<BR>
|
|
<BR>
|
|
|
|
range<TT> </TT><B>'r'</B>beginend<BR>
|
|
<P>
|
|
|
|
The
|
|
<I>dstlen</I>
|
|
|
|
parameter of
|
|
<I>rangetoa</I>
|
|
|
|
specifies the size of the
|
|
<I>dst</I>
|
|
|
|
parameter;
|
|
under no circumstances are more than
|
|
<I>dstlen</I>
|
|
|
|
bytes written to
|
|
<I>dst</I>.
|
|
|
|
A result which will not fit is truncated.
|
|
<I>Dstlen</I>
|
|
|
|
can be zero, in which case
|
|
<I>dst</I>
|
|
|
|
need not be valid and no result is written,
|
|
but the return value is unaffected;
|
|
in all other cases, the (possibly truncated) result is NUL-terminated.
|
|
The
|
|
<I>freeswan.h</I>
|
|
|
|
header file defines a constant,
|
|
<B>RANGETOA_BUF</B>,
|
|
|
|
which is the size of a buffer just large enough for worst-case results.
|
|
<P>
|
|
|
|
The
|
|
<I>format</I>
|
|
|
|
parameter of
|
|
<I>rangetoa</I>
|
|
|
|
specifies what format is to be used for the conversion.
|
|
The value
|
|
<B>0</B>
|
|
|
|
(not the ASCII character
|
|
<B>'0'</B>,
|
|
|
|
but a zero value)
|
|
specifies a reasonable default,
|
|
and is in fact the only format currently available.
|
|
This parameter is a hedge against future needs.
|
|
<P>
|
|
|
|
<I>Atoasr</I>
|
|
|
|
returns NULL for success and
|
|
a pointer to a string-literal error message for failure;
|
|
see DIAGNOSTICS.
|
|
<I>Rangetoa</I>
|
|
|
|
returns
|
|
<B>0</B>
|
|
|
|
for a failure, and otherwise
|
|
always returns the size of buffer which would
|
|
be needed to
|
|
accommodate the full conversion result, including terminating NUL;
|
|
it is the caller's responsibility to check this against the size of
|
|
the provided buffer to determine whether truncation has occurred.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<A HREF="ipsec_atoaddr.3.html">ipsec_atoaddr</A>(3), <A HREF="ipsec_atosubnet.3.html">ipsec_atosubnet</A>(3)
|
|
<A NAME="lbAF"> </A>
|
|
<H2>DIAGNOSTICS</H2>
|
|
|
|
Fatal errors in
|
|
<I>atoasr</I>
|
|
|
|
are:
|
|
empty input;
|
|
error in
|
|
<I><A HREF="ipsec_atoaddr.3.html">ipsec_atoaddr</A></I>(3)
|
|
|
|
or
|
|
<I><A HREF="ipsec_atosubnet.3.html">ipsec_atosubnet</A></I>(3)
|
|
|
|
during conversion;
|
|
begin address of range exceeds end address.
|
|
<P>
|
|
|
|
Fatal errors in
|
|
<I>rangetoa</I>
|
|
|
|
are:
|
|
unknown format.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>HISTORY</H2>
|
|
|
|
Written for the FreeS/WAN project by Henry Spencer.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
The restriction of error reports to literal strings
|
|
(so that callers don't need to worry about freeing them or copying them)
|
|
does limit the precision of error reporting.
|
|
<P>
|
|
|
|
The error-reporting convention lends itself
|
|
to slightly obscure code,
|
|
because many readers will not think of NULL as signifying success.
|
|
A good way to make it clearer is to write something like:
|
|
<P>
|
|
|
|
<DL COMPACT><DT><DD>
|
|
<PRE>
|
|
<B>const char *error;</B>
|
|
|
|
<B>error = atoasr( /* ... */ );</B>
|
|
<B>if (error != NULL) {</B>
|
|
<B> /* something went wrong */</B>
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT><A HREF="#lbAB">NAME</A><DD>
|
|
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT><A HREF="#lbAE">SEE ALSO</A><DD>
|
|
<DT><A HREF="#lbAF">DIAGNOSTICS</A><DD>
|
|
<DT><A HREF="#lbAG">HISTORY</A><DD>
|
|
<DT><A HREF="#lbAH">BUGS</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 21:40:18 GMT, November 11, 2003
|
|
</BODY>
|
|
</HTML>
|