summaryrefslogtreecommitdiff
path: root/lib/libc/net/getaddrinfo.3
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>1999-07-05 04:41:01 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>1999-07-05 04:41:01 +0000
commit4f34f217849a15233c45b3dfdc12e3b279e485cf (patch)
tree44abacbb6778dba1bcc99fde94e0d6aae55628d9 /lib/libc/net/getaddrinfo.3
parentc4947e730cf4e8e35d069af6dc731caa94558f3c (diff)
repairs; better English, formatting, etc.
Diffstat (limited to 'lib/libc/net/getaddrinfo.3')
-rw-r--r--lib/libc/net/getaddrinfo.397
1 files changed, 49 insertions, 48 deletions
diff --git a/lib/libc/net/getaddrinfo.3 b/lib/libc/net/getaddrinfo.3
index 5d644ba549e..6bf86d48cf3 100644
--- a/lib/libc/net/getaddrinfo.3
+++ b/lib/libc/net/getaddrinfo.3
@@ -1,3 +1,4 @@
+.\" $OpenBSD: getaddrinfo.3,v 1.3 1999/07/05 04:40:59 aaron Exp $
.\" Copyright (c) 1983, 1987, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -30,13 +31,13 @@
.\" SUCH DAMAGE.
.\"
.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
-.\" $Id: getaddrinfo.3,v 1.2 1999/07/03 20:26:55 deraadt Exp $
+.\" $Id: getaddrinfo.3,v 1.3 1999/07/05 04:40:59 aaron Exp $
.\"
.Dd May 25, 1995
.Dt GETADDRINFO 3
-.Os KAME
+.Os
.Sh NAME
-.Nm getaddrinfo
+.Nm getaddrinfo ,
.Nm freeaddrinfo ,
.Nm gai_strerror
.Nd nodename-to-address translation in protocol-independent manner
@@ -60,8 +61,10 @@ and
.Xr getservbyname 3 ,
but in a more sophisticated manner.
.Pp
-The addrinfo structure is defined as a result of including the
-.Li <netdb.h>
+The
+.Li addrinfo
+structure is defined as a result of including the
+.Aq Pa netdb.h
header:
.Bd -literal -offset
struct addrinfo { *
@@ -82,9 +85,7 @@ and
.Fa servname
arguments are pointers to null-terminated strings or
.Dv NULL .
-One or both of these two arguments must be a
-.Pf non Dv -NULL
-pointer.
+One or both of these two arguments must be a non-null pointer.
In the normal client scenario, both the
.Fa nodename
and
@@ -93,15 +94,11 @@ are specified.
In the normal server scenario, only the
.Fa servname
is specified.
-A
-.Pf non Dv -NULL
+A non-null
.Fa nodename
string can be either a node name or a numeric host address string
-.Po
-i.e., a dotted-decimal IPv4 address or an IPv6 hex address
-.Pc .
-A
-.Pf non Dv -NULL
+(i.e., a dotted-decimal IPv4 address or an IPv6 hex address)
+A non-null
.Fa servname
string can be either a service name or a decimal port number.
.Pp
@@ -117,9 +114,7 @@ structure all members other than
.Fa ai_socktype ,
and
.Fa ai_protocol
-must be zero or a
-.Dv NULL
-pointer.
+must be zero or a null pointer.
A value of
.Dv PF_UNSPEC
for
@@ -149,13 +144,12 @@ when
is called.
If the third argument to
.Fn getaddrinfo
-is a
-.Dv NULL
-pointer, this is the same as if the caller had filled in an
+is a null pointer, this is the same as if the caller had filled in an
.Li addrinfo
structure initialized to zero with
.Fa ai_family
-set to PF_UNSPEC.
+set to
+.Dv PF_UNSPEC .
.Pp
Upon successful return a pointer to a linked list of one or more
.Li addrinfo
@@ -164,9 +158,7 @@ The caller can process each
.Li addrinfo
structure in this list by following the
.Fa ai_next
-pointer, until a
-.Dv NULL
-pointer is encountered.
+pointer, until a null pointer is encountered.
In each returned
.Li addrinfo
structure the three members
@@ -197,9 +189,7 @@ structure in a call to
.Fn bind .
In this case, if the
.Fa nodename
-argument is a
-.Dv NULL
-pointer, then the IP address portion of the socket
+argument is a null pointer, then the IP address portion of the socket
address structure will be set to
.Dv INADDR_ANY
for an IPv4 address or
@@ -218,14 +208,13 @@ call to
.Pq for a connection-oriented protocol
or either
.Fn connect ,
-.Fn sendto , or
+.Fn sendto ,
+or
.Fn sendmsg
.Pq for a connectionless protocol .
In this case, if the
.Fa nodename
-argument is a
-.Dv NULL
-pointer, then the IP address portion of the
+argument is a null pointer, then the IP address portion of the
socket address structure will be set to the loopback address.
.Pp
If the
@@ -248,8 +237,7 @@ bit is set in the
.Fa ai_flags
member of the
.Fa hints
-structure, then a
-.Pf non Dv -NULL
+structure, then a non-null
.Fa nodename
string must be a numeric host address string.
Otherwise an error of
@@ -263,7 +251,7 @@ All of the information returned by
is dynamically allocated:
the
.Li addrinfo
-structures, and the socket address structures and canonical node name
+structures, the socket address structures, and canonical node name
strings pointed to by the addrinfo structures.
To return this information to the system the function
.Fn freeaddrinfo
@@ -303,32 +291,44 @@ Error return status from
.Fn getaddrinfo
is zero on success and non-zero on errors.
Non-zero error codes are defined in
-.Li <netdb.h> ,
+.Aq Pa netdb.h ,
and as follows:
.Pp
.Bl -tag -width EAI_ADDRFAMILY -compact
.It Dv EAI_ADDRFAMILY
-address family for nodename not supported
+Address family for
+.Fa nodename
+not supported.
.It Dv EAI_AGAIN
-temporary failure in name resolution
+Temporary failure in name resolution.
.It Dv EAI_BADFLAGS
-invalid value for ai_flags
+Invalid value for
+.Fa ai_flags .
.It Dv EAI_FAIL
-non-recoverable failure in name resolution
+Non-recoverable failure in name resolution.
.It Dv EAI_FAMILY
-ai_family not supported
+.Fa ai_family
+not supported.
.It Dv EAI_MEMORY
-memory allocation failure
+Memory allocation failure.
.It Dv EAI_NODATA
-no address associated with nodename
+No address associated with
+.Fa nodename .
.It Dv EAI_NONAME
-nodename nor servname provided, or not known
+.Fa nodename
+nor
+.Fa servname
+provided, or not known.
.It Dv EAI_SERVICE
-servname not supported for ai_socktype
+.Fa servname
+not supported for
+.Fa ai_socktype .
.It Dv EAI_SOCKTYPE
-ai_socktype not supported
+.Fa ai_socktype
+not supported.
.It Dv EAI_SYSTEM
-system error returned in errno
+System error returned in
+.Va errno .
.El
.Pp
If called with proper argument,
@@ -353,7 +353,8 @@ R. Gilligan, S. Thomson, J. Bound, and W. Stevens,
The
.Fn getaddrinfo
function is defined IEEE POSIX 1003.1g draft specification,
-and documented in ``Basic Socket Interface Extensions for IPv6''
+and documented in
+.Dq Basic Socket Interface Extensions for IPv6
.Pq RFC2533 .
.Sh BUGS
The text was shamelessly copied from RFC2553.