*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> getipnodebyaddr (3)              
Title
Content
Arch
Section
 

getipnodebyaddr(3)

Contents


NAME    [Toc]    [Back]

       getipnodebyaddr - Get a network host entry by address

SYNOPSIS    [Toc]    [Back]

       #include <netdb.h>

       struct hostent *getipnodebyaddr(
               const void *src,
               size_t len,
               int af,
               int *error_num );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

PARAMETERS    [Toc]    [Back]

       Specifies an Internet address in network order.  Specifies
       the number of bytes in an Internet address.  Specifies the
       Internet  domain address format.  Valid values are AF_INET
       and AF_INET6.  Specifies an error return code value if the
       function  is not successful.  See the ERRORS section for a
       description of the values.

DESCRIPTION    [Toc]    [Back]

       The use of this routine is deprecated.  Use  the  getnameinfo(3)  routine instead; it is also protocol-independent.

       The getipnodebyaddr() routine is an evolution of the gethostbyaddr()
   routine  that  enables  address  lookups  in
       address families other than AF_INET.

       The getipnodebyaddr()  routine  returns  a  pointer  to  a
       structure  of  type  hostent.   Its  members  specify data
       obtained from  the  local  /etc/ipnodes  file,  /etc/hosts
       file,  or one of the files distributed by DNS/BIND or NIS.
       To determine which file or files to search, and  in  which
       order,  the  system uses the switches in the /etc/svc.conf
       file.  The netdb.h header file defines the hostent  structure.


       The  getipnodebyaddr()  routine  searches the network host
       database sequentially until a match with the  src  and  af
       parameters  occurs.   The  len  parameter must specify the
       number of bytes in an Internet address.  The src parameter
       must specify the address in network order.  The af parameter
 can be either the constant AF_INET or AF_INET6,  which
       specifies  the  Internet Protocol Version 4 (IPv4) address
       format or Internet Protocol Version 6 (IPv6) address  format,
  respectively.   When  EOF  (End-of-File)  is reached
       without a match, an error value is returned.

       If the src parameter is either an Internet  Protocol  Version
  4  (IPv4)  mapped IPv6 address or an IPv4-compatible
       IPv6 address, the routine performs the following steps  in
       order:  If the af parameter is AF_INET6, the len parameter
       is 16, and the src parameter is either an IPV4-mapped IPv6
       address  or  an  IPv4-compatible IPv6 address, the routine
       skips the first 12  bytes  of  the  address,  sets  af  to
       AF_INET and len to 4.  If the af parameter is AF_INET, the
       routine queries for  a  PTR  record  in  the  in-addr.arpa
       domain.   If  the  af  parameter  is AF_INET6, the routine
       queries for a PTR record in the ip6.int  domain.   If  the
       routine  returns  success,  the single address and address
       family returned in the hostent structure are copies of the
       src  parameter  and  the  af parameter, respectively, that
       were passed to the routine.

                                  Note

       The :: and ::1 IPv6 addresses are not considered IPv4-compatible
 addresses.

       If using DNS/BIND, the information is obtained from a name
       server specified in the /etc/resolv.conf file.   When  the
       name  server is not running, the getipnodebyaddr() routine
       searches the local ipnodes name file  for  IPv6  and  IPv4
       addresses  and  the hosts name file for IPv4 addresses, if
       none are found in the ipnodes file.

       The getipnodebyaddr() routine  dynamically  allocates  the
       hostent  structure.  Use the freehostent() routine to free
       the allocated memory.

RETURN VALUES    [Toc]    [Back]

       Upon successful completion, the getipnodebyaddr()  routine
       returns  a  pointer to a hostent structure.  If it reaches
       the end of the network hostname  database,  it  returns  a
       null pointer.

ERRORS    [Toc]    [Back]

       If  the getipnodebyaddr() routine call fails, error_num is
       set to one of the following values: Host is unknown.   The
       server recognized the request and the name, but no address
       is available for the name.  Another type  of  name  server
       request  may  be successful.  An unexpected server failure
       occurred.  This is a nonrecoverable  error.   A  transient
       error  occurred,  for example, the server did not respond.
       A retry at some later time may be successful.

EXAMPLES    [Toc]    [Back]

       For IPv4 applications (backward  compatibility),  use  the
       following syntax:

       getipnodebyaddr(address, 4, AF_INET, &error_num);

FILES    [Toc]    [Back]

       The  Internet  network node name database.  Each record in
       the file occupies a single line and has three fields  consisting
  of the node address (IPv6 or IPv4), official node
       name, and aliases.  This  file  is  the  Internet  network
       hostname  database.   Each  record  in the file occupies a
       single line and has three fields consisting  of  the  host
       IPv4   address,   official  hostname,  and  aliases.   The
       resolver configuration file.  The database service  selection
 configuration file.

SEE ALSO    [Toc]    [Back]

      
      
       Routines:  endhostent(3),  freehostent(3), getnameinfo(3),
       getipnodebyname(3), sethostent(3).

       Files: hosts(4), resolv.conf(4), svc.conf(4).

       Networks: bind_intro(7), nis_intro(7).

       Standards: standards(5).



                                               getipnodebyaddr(3)
[ Back ]
 Similar pages
Name OS Title
getipnodebyname Tru64 Get a network host entry by name for a specific address family
getnetbyaddr Tru64 Get a network entry by address
getnetbyaddr_r Tru64 Get a network entry by address
gethostbyname Linux get network host entry
herror NetBSD get network host entry
gethostent OpenBSD get network host entry
gethostbyname2 OpenBSD get network host entry
sethostent FreeBSD get network host entry
gethostbyname OpenBSD get network host entry
gethostbyaddr OpenBSD get network host entry
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service