summaryrefslogtreecommitdiffstats
path: root/lib/libc/net
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-11-01 06:29:00 +0000
committerpeter <peter@FreeBSD.org>1996-11-01 06:29:00 +0000
commit259bccfa492f72406c4205a16808d8749926d8ea (patch)
tree58bbf766db3c172803a17c29ef522324ae3fcab6 /lib/libc/net
parentf21a0e44182a336c25b015823557bf2ac004e6b7 (diff)
downloadFreeBSD-src-259bccfa492f72406c4205a16808d8749926d8ea.zip
FreeBSD-src-259bccfa492f72406c4205a16808d8749926d8ea.tar.gz
Doc updates and cleanups made with the bind-4.9.4 update some time ago.
I thought I had committed these, but it seems not.
Diffstat (limited to 'lib/libc/net')
-rw-r--r--lib/libc/net/Makefile.inc2
-rw-r--r--lib/libc/net/gethostbyname.374
-rw-r--r--lib/libc/net/getnetent.310
-rw-r--r--lib/libc/net/resolver.340
4 files changed, 102 insertions, 24 deletions
diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc
index 4eb9ead..0b9bdb4 100644
--- a/lib/libc/net/Makefile.inc
+++ b/lib/libc/net/Makefile.inc
@@ -32,7 +32,7 @@ MLINKS+=ethers.3 ether_line.3 ethers.3 ether_aton.3 ethers.3 ether_ntoa.3 \
ethers.3 ether_ntohost.3 ethers.3 ether_hostton.3
MLINKS+=gethostbyname.3 endhostent.3 gethostbyname.3 gethostbyaddr.3 \
gethostbyname.3 sethostent.3 gethostbyname.3 gethostent.3 \
- gethostbyname.3 herror.3
+ gethostbyname.3 herror.3 gethostbyname.3 hstrerror.3
MLINKS+=getnetent.3 endnetent.3 getnetent.3 getnetbyaddr.3 \
getnetent.3 getnetbyname.3 getnetent.3 setnetent.3
MLINKS+=getprotoent.3 endprotoent.3 getprotoent.3 getprotobyname.3 \
diff --git a/lib/libc/net/gethostbyname.3 b/lib/libc/net/gethostbyname.3
index 59cf308..af5e369 100644
--- a/lib/libc/net/gethostbyname.3
+++ b/lib/libc/net/gethostbyname.3
@@ -29,18 +29,20 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)gethostbyname.3 8.2 (Berkeley) 4/19/94
+.\" @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
.\"
-.Dd April 19, 1994
+.Dd May 25, 1995
.Dt GETHOSTBYNAME 3
.Os BSD 4.2
.Sh NAME
.Nm gethostbyname ,
+.Nm gethostbyname2 ,
.Nm gethostbyaddr ,
.Nm gethostent ,
.Nm sethostent ,
.Nm endhostent ,
-.Nm herror
+.Nm herror ,
+.Nm hstrerror
.Nd get network host entry
.Sh SYNOPSIS
.Fd #include <netdb.h>
@@ -48,15 +50,20 @@
.Ft struct hostent *
.Fn gethostbyname "const char *name"
.Ft struct hostent *
+.Fn gethostbyname2 "const char *name" "int af"
+.Ft struct hostent *
.Fn gethostbyaddr "const char *addr" "int len" "int type"
.Ft struct hostent *
.Fn gethostent void
.Fn sethostent "int stayopen"
.Fn endhostent void
.Fn herror "const char *string"
+.Ft const char *
+.Fn hstrerror "int err"
.Sh DESCRIPTION
The
-.Fn gethostbyname
+.Fn gethostbyname ,
+.Fn gethostbyname2
and
.Fn gethostbyaddr
functions
@@ -85,22 +92,25 @@ The members of this structure are:
.It Fa h_name
Official name of the host.
.It Fa h_aliases
-A zero terminated array of alternate names for the host.
+A NULL-terminated array of alternate names for the host.
.It Fa h_addrtype
-The type of address being returned; currently always
+The type of address being returned; usually
.Dv AF_INET .
.It Fa h_length
The length, in bytes, of the address.
.It Fa h_addr_list
-A zero terminated array of network addresses for the host.
+A NULL-terminated array of network addresses for the host.
Host addresses are returned in network byte order.
.It Fa h_addr
The first address in
.Fa h_addr_list ;
this is for backward compatibility.
+.El
.Pp
When using the nameserver,
.Fn gethostbyname
+and
+.Fn gethostbyname
will search for the named host in the current domain and its parents
unless the name ends in a dot.
If the name contains no dot, and if the environment variable
@@ -112,6 +122,25 @@ See
for the domain search procedure and the alias file format.
.Pp
The
+.Fn gethostbyname2
+function is an evolution of
+.Fn gethostbyname
+which is intended to allow lookups in address families other than
+.Dv AF_INET ,
+for example
+.Dv AF_INET6 .
+Currently the
+.Fa af
+argument must be specified as
+.Dv AF_INET
+else the fuction will return
+.Dv NULL
+after having set
+.Va h_errno
+to
+.Dv NETDB_INTERNAL
+.Pp
+The
.Fn sethostent
function
may be used to request the use of a connected
@@ -123,7 +152,8 @@ flag is non-zero,
this sets the option to send all queries to the name server using
.Tn TCP
and to retain the connection after each call to
-.Fn gethostbyname
+.Fn gethostbyname ,
+.Fn gethostbyname2
or
.Fn gethostbyaddr .
Otherwise, queries are performed using
@@ -136,13 +166,31 @@ function
closes the
.Tn TCP
connection.
+.Pp
+The
+.Fn herror
+function writes a message to the diagnostic output consisting of the
+string parameter
+.Fa s ,
+the constant string ": ", and a message corresponding to the value of
+.Va h_errno .
+.Pp
+The
+.Fn hstrerror
+function returns a string which is the message text corresponding to the
+value of the
+.Fa err
+parameter.
.Sh FILES
-.Bl -tag -width /etc/hosts -compact
+.Bl -tag -width /etc/resolv.conf -compact
.It Pa /etc/hosts
+.It Pa /etc/host.conf
+.It Pa /etc/resolv.conf
.El
.Sh DIAGNOSTICS
Error return status from
-.Fn gethostbyname
+.Fn gethostbyname ,
+.Fn gethostbyname2
and
.Fn gethostbyaddr
is indicated by return of a null pointer.
@@ -219,7 +267,8 @@ If the
.Fa stayopen
argument is non-zero,
the file will not be closed after each call to
-.Fn gethostbyname
+.Fn gethostbyname ,
+.Fn gethostbyname2
or
.Fn gethostbyaddr .
.Pp
@@ -241,6 +290,9 @@ and
.Fn sethostent
functions appeared in
.Bx 4.2 .
+The
+.Fn gethostbyname2
+functrion first appeared in bind-4.9.4.
.Sh BUGS
These functions use static data storage;
if the data is needed for future use, it should be
diff --git a/lib/libc/net/getnetent.3 b/lib/libc/net/getnetent.3
index 7514371c..6b6aeb9 100644
--- a/lib/libc/net/getnetent.3
+++ b/lib/libc/net/getnetent.3
@@ -46,7 +46,7 @@
.Ft struct netent *
.Fn getnetent
.Ft struct netent *
-.Fn getnetbyname "char *name"
+.Fn getnetbyname "const char *name"
.Ft struct netent *
.Fn getnetbyaddr "long net" "int type"
.Fn setnetent "int stayopen"
@@ -117,7 +117,10 @@ net name or
net address and type is found,
or until
.Dv EOF
-is encountered.
+is encountered. The
+.Fa type
+must be
+.Dv AF_INET .
Network numbers are supplied in host order.
.Sh FILES
.Bl -tag -width /etc/networks -compact
@@ -129,7 +132,8 @@ Null pointer
.Dv EOF
or error.
.Sh SEE ALSO
-.Xr networks 5
+.Xr networks 5 ,
+.%T RFC 1101
.Sh HISTORY
The
.Fn getnetent ,
diff --git a/lib/libc/net/resolver.3 b/lib/libc/net/resolver.3
index 4014c72..f157904 100644
--- a/lib/libc/net/resolver.3
+++ b/lib/libc/net/resolver.3
@@ -49,14 +49,14 @@
.Fd #include <arpa/nameser.h>
.Fd #include <resolv.h>
.Fo res_query
-.Fa "char *dname"
+.Fa "const char *dname"
.Fa "int class"
.Fa "int type"
.Fa "u_char *answer"
.Fa "int anslen"
.Fc
.Fo res_search
-.Fa "char *dname"
+.Fa "const char *dname"
.Fa "int class"
.Fa "int type"
.Fa "u_char *answer"
@@ -64,33 +64,33 @@
.Fc
.Fo res_mkquery
.Fa "int op"
-.Fa "char *dname"
+.Fa "const char *dname"
.Fa "int class"
.Fa "int type"
-.Fa "char *data"
+.Fa "const char *data"
.Fa "int datalen"
.Fa "struct rrec *newrr"
.Fa "char *buf"
.Fa "int buflen"
.Fc
.Fo res_send
-.Fa "char *msg"
+.Fa "const char *msg"
.Fa "int msglen"
.Fa "char *answer"
.Fa "int anslen"
.Fc
.Fn res_init
.Fo dn_comp
-.Fa "char *exp_dn"
+.Fa "const char *exp_dn"
.Fa "char *comp_dn"
.Fa "int length"
.Fa "char **dnptrs"
.Fa "char **lastdnptr"
.Fc
.Fo dn_expand
-.Fa "u_char *msg"
-.Fa "u_char *eomorig"
-.Fa "u_char *comp_dn"
+.Fa "const u_char *msg"
+.Fa "const u_char *eomorig"
+.Fa "const u_char *comp_dn"
.Fa "u_char *exp_dn"
.Fa "int length"
.Fc
@@ -163,6 +163,10 @@ will search for host names in the current domain and in parent domains; see
This is used by the standard host lookup routine
.Xr gethostbyname 3 .
This option is enabled by default.
+.It Dv RES_NOALIASES
+This option turns off the user level aliasing feature controlled by the
+.Dq Ev HOSTALIASES
+environment variable. Network daemons should set this option.
.El
.Pp
The
@@ -179,6 +183,24 @@ The current domain name is defined by the hostname
if not specified in the configuration file;
it can be overridden by the environment variable
.Ev LOCALDOMAIN .
+This environment variable may contain several blank-separated
+tokens if you wish to override the
+.Em "search list"
+on a per-process basis. This is similar to the
+.Em search
+command in the configuration file.
+Another environment variable (
+.Dq Ev RES_OPTIONS
+can be set to
+override certain internal resolver options which are otherwise
+set by changing fields in the
+.Em _res
+structure or are inherited from the configuration file's
+.Em options
+command. The syntax of the
+.Dq Ev RES_OPTIONS
+environment variable is explained in
+.Xr resolver 5 .
Initialization normally occurs on the first call
to one of the following routines.
.Pp
OpenPOWER on IntegriCloud