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

  man pages->FreeBSD man pages -> realhostname (3)              
Title
Content
Arch
Section
 

REALHOSTNAME(3)

Contents


NAME    [Toc]    [Back]

     realhostname -- convert an IP number to the real host name

LIBRARY    [Toc]    [Back]

     System Utilities Library (libutil, -lutil)

SYNOPSIS    [Toc]    [Back]

     #include <sys/types.h>
     #include <netinet/in.h>
     #include <libutil.h>

     int
     realhostname(char *host, size_t hsize, const struct in_addr *ip);

DESCRIPTION    [Toc]    [Back]

     The function realhostname() converts ip to the corresponding host name.
     This is done by resolving ip to a host name and then ensuring that the
     host name resolves back to ip.

     host must point to a buffer of at least hsize bytes, and will always be
     written to by this function.

     If the name resolution doesn't work both ways or if the host name is
     longer than hsize bytes, inet_ntoa(3) is used to convert ip to an ASCII
     form.

     If the string written to host is hsize bytes long, host will not be NUL
     terminated.

RETURN VALUES    [Toc]    [Back]

     The realhostname() function will return one of the following constants
     which are defined in <libutil.h>:

	HOSTNAME_FOUND
	     A valid host name was found.

	HOSTNAME_INCORRECTNAME
	     A host name was found, but it did not resolve back to the passed
	     ip.  host now contains the numeric value of ip.

	HOSTNAME_INVALIDADDR
	     ip could not be resolved.	host now contains the numeric value of
	     ip.

	HOSTNAME_INVALIDNAME
	     A host name was found, but it could not be resolved back to any
	     ip number.  host now contains the numeric value of ip.

SEE ALSO    [Toc]    [Back]

      
      
     gethostbyaddr(3), gethostbyname(3), inet_ntoa(3), realhostname_sa(3)


FreeBSD 5.2.1			 April 6, 1999			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
realhostname_sa FreeBSD convert a struct sockaddr to the real host name
precision IRIX Returns the decimal precision of a number in the real number model
radix IRIX Returns the base number from the real or integer number models
htonl Tru64 Convert an unsigned 32-bit integer from host byte
phones OpenBSD remote host phone number file
byteorder IRIX convert values between host and network byte order
byteorder FreeBSD convert values between host and network byte order
ntohs NetBSD convert values between host and network byte order
htonl FreeBSD convert values between host and network byte order
ntohl NetBSD convert values between host and network byte order
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service