OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [doc/] [gethost.man] - Diff between revs 27 and 174

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 27 Rev 174
NAME
NAME
       gethostbyname, gethostbyaddr, herror, hstrerror - get network host entry
       gethostbyname, gethostbyaddr, herror, hstrerror - get network host entry
 
 
SYNOPSIS
SYNOPSIS
       #include <network.h>
       #include <network.h>
 
 
       struct hostent *gethostbyname(const char *name);
       struct hostent *gethostbyname(const char *name);
 
 
       struct hostent *gethostbyaddr(const char *addr, int len, int type);
       struct hostent *gethostbyaddr(const char *addr, int len, int type);
 
 
       void herror(const char *s);
       void herror(const char *s);
 
 
       const char * hstrerror(int err);
       const char * hstrerror(int err);
 
 
DESCRIPTION
DESCRIPTION
       The gethostbyname() function returns a structure  of  type
       The gethostbyname() function returns a structure  of  type
       hostent  for  the  given host name.  Here name is either a
       hostent  for  the  given host name.  Here name is either a
       host name, or an IPv4 address in standard dot notation, or
       host name, or an IPv4 address in standard dot notation, or
       an IPv6 address in colon (and possibly dot) notation. (See
       an IPv6 address in colon (and possibly dot) notation. (See
       RFC 1884 for the description of IPv6 addresses.)  If  name
       RFC 1884 for the description of IPv6 addresses.)  If  name
       is  an  IPv4  or  IPv6 address, no lookup is performed and
       is  an  IPv4  or  IPv6 address, no lookup is performed and
       gethostbyname() simply copies name into the  h_name  field
       gethostbyname() simply copies name into the  h_name  field
       and  its struct in_addr equivalent into the h_addr_list[0]
       and  its struct in_addr equivalent into the h_addr_list[0]
       field of the returned hostent structure.  If name  doesn't
       field of the returned hostent structure.  If name  doesn't
       end  in  a dot and the environment variable HOSTALIASES is
       end  in  a dot and the environment variable HOSTALIASES is
       set, the alias file pointed to by HOSTALIASES  will  first
       set, the alias file pointed to by HOSTALIASES  will  first
       be  searched for name.  (See hostname(7) for the file for­
       be  searched for name.  (See hostname(7) for the file for­
       mat.)  The current domain and  its  parents  are  searched
       mat.)  The current domain and  its  parents  are  searched
       unless name ends in a dot.
       unless name ends in a dot.
 
 
       The  gethostbyaddr()  function returns a structure of type
       The  gethostbyaddr()  function returns a structure of type
       hostent for the given host address addr of length len  and
       hostent for the given host address addr of length len  and
       address  type  type.   The only valid address type is cur­
       address  type  type.   The only valid address type is cur­
       rently AF_INET.
       rently AF_INET.
 
 
       The  (obsolete) herror() function prints the error message
       The  (obsolete) herror() function prints the error message
       associated with the current value of h_errno on stderr.
       associated with the current value of h_errno on stderr.
 
 
       The (obsolete) hstrerror() function takes an error  number
       The (obsolete) hstrerror() function takes an error  number
       (typically  h_errno) and returns the corresponding message
       (typically  h_errno) and returns the corresponding message
       string.
       string.
 
 
       The domain name queries carried out by gethostbyname() and
       The domain name queries carried out by gethostbyname() and
       gethostbyaddr()  use  a  combination  of any or all of the
       gethostbyaddr()  use  a  combination  of any or all of the
       name server named(8), a broken out line  from  /etc/hosts,
       name server named(8), a broken out line  from  /etc/hosts,
       and the Network Information Service (NIS or YP), depending
       and the Network Information Service (NIS or YP), depending
       upon the contents of the  order  line  in  /etc/host.conf.
       upon the contents of the  order  line  in  /etc/host.conf.
       (See   resolv+(8)).    The  default  action  is  to  query
       (See   resolv+(8)).    The  default  action  is  to  query
       named(8), followed by /etc/hosts.
       named(8), followed by /etc/hosts.
 
 
       The hostent structure is defined in <netdb.h> as follows:
       The hostent structure is defined in <netdb.h> as follows:
 
 
              struct hostent {
              struct hostent {
                      char    *h_name;        /* official name of host */
                      char    *h_name;        /* official name of host */
                      char    **h_aliases;    /* alias list */
                      char    **h_aliases;    /* alias list */
                      int     h_addrtype;     /* host address type */
                      int     h_addrtype;     /* host address type */
                      int     h_length;       /* length of address */
                      int     h_length;       /* length of address */
                      char    **h_addr_list;  /* list of addresses */
                      char    **h_addr_list;  /* list of addresses */
              }
              }
              #define h_addr  h_addr_list[0]  /* for backward compatibility */
              #define h_addr  h_addr_list[0]  /* for backward compatibility */
 
 
       The members of the hostent structure are:
       The members of the hostent structure are:
 
 
       h_name The official name of the host.
       h_name The official name of the host.
 
 
       h_aliases
       h_aliases
              A zero-terminated array of  alternative  names  for
              A zero-terminated array of  alternative  names  for
              the host.
              the host.
 
 
       h_addrtype
       h_addrtype
              The type of address; always AF_INET at present.
              The type of address; always AF_INET at present.
 
 
       h_length
       h_length
              The length of the address in bytes.
              The length of the address in bytes.
 
 
       h_addr_list
       h_addr_list
              A  zero-terminated  array  of network addresses for
              A  zero-terminated  array  of network addresses for
              the host in network byte order.
              the host in network byte order.
 
 
       h_addr The first address in h_addr_list for backward  com­
       h_addr The first address in h_addr_list for backward  com­
              patibility.
              patibility.
 
 
RETURN VALUE
RETURN VALUE
       The  gethostbyname()  and gethostbyaddr() functions return
       The  gethostbyname()  and gethostbyaddr() functions return
       the hostent structure  or  a  NULL  pointer  if  an  error
       the hostent structure  or  a  NULL  pointer  if  an  error
       occurs.   On  error,  the  h_errno variable holds an error
       occurs.   On  error,  the  h_errno variable holds an error
       number.
       number.
 
 
ERRORS
ERRORS
       The variable h_errno can have the following values:
       The variable h_errno can have the following values:
 
 
       HOST_NOT_FOUND
       HOST_NOT_FOUND
              The specified host is unknown.
              The specified host is unknown.
 
 
       NO_ADDRESS or NO_DATA
       NO_ADDRESS or NO_DATA
              The requested name is valid but does not have an IP
              The requested name is valid but does not have an IP
              address.
              address.
 
 
       NO_RECOVERY
       NO_RECOVERY
              A non-recoverable name server error occurred.
              A non-recoverable name server error occurred.
 
 
       TRY_AGAIN
       TRY_AGAIN
              A temporary error occurred on an authoritative name
              A temporary error occurred on an authoritative name
              server.  Try again later.
              server.  Try again later.
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.