]> git.saurik.com Git - apple/libinfo.git/blobdiff - gen.subproj/getipnodebyname.3
Libinfo-330.9.tar.gz
[apple/libinfo.git] / gen.subproj / getipnodebyname.3
index 0e15009a216cac54117fe53719fa6f5cc0ec11f7..a4cbb1e48619e9cd91d806b0abb53c1613fcb669 100644 (file)
@@ -1,4 +1,3 @@
-.\"    $FreeBSD: src/lib/libc/net/getipnodebyname.3,v 1.2.2.3 2001/08/17 15:42:38 ru Exp $
 .\"    $KAME: getipnodebyname.3,v 1.6 2000/08/09 21:16:17 itojun Exp $
 .\"
 .\" Copyright (c) 1983, 1987, 1991, 1993
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -33,8 +28,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)gethostbyname.3      8.4 (Berkeley) 5/25/95
+.\" $FreeBSD: src/lib/libc/net/getipnodebyname.3,v 1.18 2007/01/09 00:28:02 imp Exp $
 .\"
-.Dd May 25, 1995
+.Dd August 6, 2004
 .Dt GETIPNODEBYNAME 3
 .Os
 .\"
@@ -47,9 +43,9 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/socket.h>
-.Fd #include <netdb.h>
+.In sys/types.h
+.In sys/socket.h
+.In netdb.h
 .Ft "struct hostent *"
 .Fn getipnodebyname "const char *name" "int af" "int flags" "int *error_num"
 .Ft "struct hostent *"
@@ -58,6 +54,7 @@
 .Fn freehostent "struct hostent *ptr"
 .\"
 .Sh DESCRIPTION
+The
 .Fn getipnodebyname
 and
 .Fn getipnodebyaddr
@@ -69,9 +66,9 @@ and
 The functions cover all the functionalities provided by the older ones,
 and provide better interface to programmers.
 The functions require additional arguments,
-.Ar af ,
+.Fa af ,
 and
-.Ar flags ,
+.Fa flags ,
 for specifying address family and operation mode.
 The additional arguments allow programmer to get address for a nodename,
 for specific address family
@@ -80,7 +77,7 @@ for specific address family
 or
 .Dv AF_INET6 ) .
 The functions also require an additional pointer argument,
-.Ar error_num
+.Fa error_num
 to return the appropriate error code,
 to support thread safe error code returns.
 .Pp
@@ -92,18 +89,18 @@ is described in
 For
 .Fn getipnodebyname ,
 the
-.Ar name
+.Fa name
 argument can be either a node name or a numeric address
 string
 (i.e., a dotted-decimal IPv4 address or an IPv6 hex address).
 The
-.Ar af
+.Fa af
 argument specifies the address family, either
 .Dv AF_INET
 or
 .Dv AF_INET6 .
 The
-.Ar flags
+.Fa flags
 argument specifies the types of addresses that are searched for,
 and the types of addresses that are returned.
 We note that a special flags value of
@@ -122,22 +119,22 @@ with
 .Pp
 Applications desiring finer control over the types of addresses
 searched for and returned, can specify other combinations of the
-.Ar flags
+.Fa flags
 argument.
 .Pp
 A
-.Ar flags
+.Fa flags
 of
 .Li 0
 implies a strict interpretation of the
-.Ar af
+.Fa af
 argument:
 .Bl -bullet
 .It
 If
-.Ar flags
+.Fa flags
 is 0 and
-.Ar af
+.Fa af
 is
 .Dv AF_INET ,
 then the caller wants only IPv4 addresses.
@@ -153,9 +150,9 @@ structure will be 4, else the function returns a
 pointer.
 .It
 If
-.Ar flags
+.Fa flags
 is 0 and if
-.Ar af
+.Fa af
 is
 .Li AF_INET6 ,
 then the caller wants only IPv6 addresses.
@@ -172,14 +169,14 @@ pointer.
 .El
 .Pp
 Other constants can be logically-ORed into the
-.Ar flags
+.Fa flags
 argument, to modify the behavior of the function.
 .Bl -bullet
 .It
 If the
 .Dv AI_V4MAPPED
 flag is specified along with an
-.Ar af
+.Fa af
 of
 .Dv AF_INET6 ,
 then the caller will accept IPv4-mapped IPv6 addresses.
@@ -193,7 +190,7 @@ will be 16).
 The
 .Dv AI_V4MAPPED
 flag is ignored unless
-.Ar af
+.Fa af
 equals
 .Dv AF_INET6 .
 .It
@@ -216,15 +213,19 @@ flag then the caller wants all addresses: IPv6 and IPv4-mapped IPv6.
 A query is first made for
 .Li AAAA
 records and if successful, the
-IPv6 addresses are returned.  Another query is then made for
+IPv6 addresses are returned.
+Another query is then made for
 .Li A
 records and any found are returned as IPv4-mapped IPv6 addresses.
 .Li h_length
-will be 16.  Only if both queries fail does the function
+will be 16.
+Only if both queries fail does the function
 return a
 .Dv NULL
-pointer.  This flag is ignored unless af equals
-AF_INET6.  If both
+pointer.
+This flag is ignored unless af equals
+AF_INET6.
+If both
 .Dv AI_ALL
 and
 .Dv AI_V4MAPPED
@@ -245,7 +246,7 @@ configured.
 .Pp
 For example, if the node has no IPv6 source addresses configured,
 and
-.Ar af
+.Fa af
 equals AF_INET6, and the node name being looked up has both
 .Li AAAA
 and
@@ -276,40 +277,40 @@ is defined as
 We noted that the
 .Fn getipnodebyname
 function must allow the
-.Ar name
+.Fa name
 argument to be either a node name or a literal address string
 (i.e., a dotted-decimal IPv4 address or an IPv6 hex address).
 This saves applications from having to call
 .Xr inet_pton 3
 to handle literal address strings.
 When the
-.Ar name
+.Fa name
 argument is a literal address string,
 the
-.Ar flags
+.Fa flags
 argument is always ignored.
 .Pp
 There are four scenarios based on the type of literal address string
 and the value of the
-.Ar af
+.Fa af
 argument.
 The two simple cases are when
-.Ar name
+.Fa name
 is a dotted-decimal IPv4 address and
-.Ar af
+.Fa af
 equals
 .Dv AF_INET ,
 or when
-.Ar name
+.Fa name
 is an IPv6 hex address and
-.Ar af
+.Fa af
 equals
 .Dv AF_INET6 .
 The members of the
 returned hostent structure are:
 .Li h_name
 points to a copy of the
-.Ar name
+.Fa name
 argument,
 .Li h_aliases
 is a
@@ -317,7 +318,7 @@ is a
 pointer,
 .Li h_addrtype
 is a copy of the
-.Ar af
+.Fa af
 argument,
 .Li h_length
 is either 4
@@ -335,9 +336,9 @@ is a
 pointer.
 .Pp
 When
-.Ar name
+.Fa name
 is a dotted-decimal IPv4 address and
-.Ar af
+.Fa af
 equals
 .Dv AF_INET6 ,
 and
@@ -363,60 +364,71 @@ is a
 pointer.
 .Pp
 It is an error when
-.Ar name
+.Fa name
 is an IPv6 hex address and
-.Ar af
+.Fa af
 equals
 .Dv AF_INET .
 The function's return value is a
 .Dv NULL
 pointer and the value pointed to by
-.Ar error_num
+.Fa error_num
 equals
 .Dv HOST_NOT_FOUND .
 .Pp
+The
 .Fn getipnodebyaddr
+function
 takes almost the same argument as
 .Xr gethostbyaddr 3 ,
 but adds a pointer to return an error number.
 Additionally it takes care of IPv4-mapped IPv6 addresses,
 and IPv4-compatible IPv6 addresses.
 .Pp
+The
 .Fn getipnodebyname
 and
 .Fn getipnodebyaddr
+functions
 dynamically allocate the structure to be returned to the caller.
+The
 .Fn freehostent
+function
 reclaims memory region allocated and returned by
 .Fn getipnodebyname
 or
 .Fn getipnodebyaddr .
 .\"
 .Sh FILES
-.Bl -tag -width /etc/resolv.conf -compact
+.Bl -tag -width /etc/nsswitch.conf -compact
 .It Pa /etc/hosts
-.It Pa /etc/host.conf
+.\".It Pa /etc/nsswitch.conf
 .It Pa /etc/resolv.conf
 .El
 .\"
 .Sh DIAGNOSTICS
+The
 .Fn getipnodebyname
 and
 .Fn getipnodebyaddr
+functions
 returns
 .Dv NULL
 on errors.
 The integer values pointed to by
-.Ar error_num
+.Fa error_num
 may then be checked to see whether this is a temporary failure
 or an invalid or unknown host.
 The meanings of each error code are described in
 .Xr gethostbyname 3 .
 .\"
 .Sh SEE ALSO
+.Xr getaddrinfo 3 ,
 .Xr gethostbyaddr 3 ,
 .Xr gethostbyname 3 ,
+.Xr getnameinfo 3 ,
 .Xr hosts 5 ,
+.Xr nsswitch.conf 5 ,
 .Xr services 5 ,
 .Xr hostname 7 ,
 .Xr named 8
@@ -431,21 +443,25 @@ The meanings of each error code are described in
 .%D March 1999
 .Re
 .\"
-.Sh HISTORY
-The implementation first appeared in KAME advanced networking kit.
-.\"
 .Sh STANDARDS
+The
 .Fn getipnodebyname
 and
 .Fn getipnodebyaddr
+functions
 are documented in
 .Dq Basic Socket Interface Extensions for IPv6
 (RFC2553).
 .\"
+.Sh HISTORY
+The implementation first appeared in KAME advanced networking kit.
+.\"
 .Sh BUGS
+The
 .Fn getipnodebyname
 and
 .Fn getipnodebyaddr
+functions
 do not handle scoped IPv6 address properly.
 If you use these functions,
 your program will not be able to handle scoped IPv6 addresses.