Commit 0a04ba7b authored by Andreas Gustafsson's avatar Andreas Gustafsson
Browse files

Bob says lwres_net_aton and lwres_net_pton were never intended to be

part of the public interface of the lwres library
parent 3c1472d7
.\" Copyright (C) 2000 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" $Id: lwres_inetaton.3,v 1.3 2000/08/01 01:21:39 tale Exp $
.\"
.Dd Jun 30, 2000
.Dt LWRES_INETATON 3
.Os BIND9 9
.ds vT BIND9 Programmer's Manual
.Sh NAME
.Nm lwres_net_aton
.Nd lightweight resolver IPv4 address manipulation
.Sh SYNOPSIS
.Fd #include <lwres/int.h>
.Fd #include <lwres/net.h>
.Fd
.Ft int
.Fo lwres_net_aton
.Fa "const char *cp"
.Fa "struct in_addr *addr"
.Fc
.Sh DESCRIPTION
.Fn lwres_net_aton
checks that
.Fa cp
is a valid ASCII representation of an IPv4 address and optionally converts
it to a binary address in network byte order.
If
.Fa addr
is not
.Dv NULL,
.Li addr->s_addr
is set to the binary representation of address given by
.Fa cp
if it was a valid string.
This function supersedes
.Fn inet_addr
whose return value cannot distinguish between failure and a local
broadcast address.
.Pp
.Fa cp
should be a string in conventional dot notation of the form:
.Bd -literal -offset indent
a
a.b
a.b.c
a.b.c.d
.Ed
.Pp
Each part of the address can be represented in octal, decimal or
hexadeximal using the standard C notation: a leading 0 implies octal;
a leading 0x or 0X implies hex; a decimal number is assumed otherwise.
.Pp
If a one-part address is given, its value is placed in the network
address without any byte rearrangement.
When a two-part address -
.Li a.b -
is supplied, the last part is considered a 24-bit quantity and placed
in the bottom 3 bytes of
.Li addr->s_addr .
The first part is placed in the top byte of the address.
A three-part address -
.Li a.b.c -
is treated as if the last part was a 16-bit quantity.
The first two parts -
.Li a.b -
is put in the top 2 bytes and the last part in the low-end 2 bytes of
.Li addr->s_addr .
When a four-part address is supplied in
.Fa cp ,
each part is treated as a byte of data and assigned to the four bytes
of an Internet address.
In all four cases, the internet address in
.Li addr->s_addr
is stored in network byte order (big-endian) where the bytes are
ordered from left to right: i.e. 0, 1, 2, 3.
.Sh RETURN VALUES
The function returns 1 if
.Fa cp
was successfully interpreted as an IPv4 address or 0
if it was an invalid string.
.Sh SEE ALSO
.Xr inet_aton 3 ,
.Xr inet_addr 3 .
.\" Copyright (C) 2000 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" $Id: lwres_inetpton.3,v 1.3 2000/08/01 01:21:42 tale Exp $
.\"
.Dd Jun 30, 2000
.Dt LWRES_INETPTON 3
.Os BIND9 9
.ds vT BIND9 Programmer's Manual
.Sh NAME
.Nm lwres_net_pton
.Nd lightweight resolver IP address conversion
.Sh SYNOPSIS
.Fd #include <lwres/net.h>
.Fd
.Ft int
.Fo lwres_net_pton
.Fa "int af"
.Fa "const char *src"
.Fa "void *dst"
.Fc
.Sh DESCRIPTION
.Fn lwres_net_pton
converts the presentation format of an IP address
.Fa src
to its representation in network format.
.Fa af
indicates the protocol family for the address
.Dv PF_INET
or
.Dv PF_INET6
and
.Fa src
is either a dotted decimal string for an IPv4 address or
a string in colon notation if it represents an IPv6 address.
RFC1884 defines the text notation to represent IPv6 addresses.
.Sh RETURN VALUES
.Fn lwres_net_pton
returns 1 if address
.Fa src
was valid for protocol family
.Fa af .
The network representation of the address is returned in
.Fa *dst .
Zero is returned if the address was invalid and -1 is returned if some
other error occurred.
.Fa *dst
is not altered for either of these errors.
.Sh SEE ALSO
.Xr inet_pton 3 ,
.Xr RFC1884 .
.\" Copyright (C) 2000 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" $Id: lwres_net_aton.3,v 1.3 2000/08/01 01:21:45 tale Exp $
.\"
.so lwres_inetaton.3
.\" Copyright (C) 2000 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" $Id: lwres_net_pton.3,v 1.3 2000/08/01 01:21:47 tale Exp $
.\"
.so lwres_inetpton.3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment