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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [doc/] [gethost.html] - Blame information for rev 1254

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
<html>
2
<body>
3
<pre>
4
NAME
5
       gethostbyname, gethostbyaddr, herror, hstrerror - get network host entry
6
 
7
SYNOPSIS
8
       #include &lt;network.h&gt;
9
 
10
       struct hostent *gethostbyname(const char *name);
11
 
12
       struct hostent *gethostbyaddr(const char *addr, int len, int type);
13
 
14
       void herror(const char *s);
15
 
16
       const char * hstrerror(int err);
17
 
18
DESCRIPTION
19
       The gethostbyname() function returns a structure  of  type
20
       hostent  for  the  given host name.  Here name is either a
21
       host name, or an IPv4 address in standard dot notation, or
22
       an IPv6 address in colon (and possibly dot) notation. (See
23
       RFC 1884 for the description of IPv6 addresses.)  If  name
24
       is  an  IPv4  or  IPv6 address, no lookup is performed and
25
       gethostbyname() simply copies name into the  h_name  field
26
       and  its struct in_addr equivalent into the h_addr_list[0]
27
       field of the returned hostent structure.  If name  doesn't
28
       end  in  a dot and the environment variable HOSTALIASES is
29
       set, the alias file pointed to by HOSTALIASES  will  first
30
       be  searched for name.  (See hostname(7) for the file for­
31
       mat.)  The current domain and  its  parents  are  searched
32
       unless name ends in a dot.
33
 
34
       The  gethostbyaddr()  function returns a structure of type
35
       hostent for the given host address addr of length len  and
36
       address  type  type.   The only valid address type is cur­
37
       rently AF_INET.
38
 
39
       The  (obsolete) herror() function prints the error message
40
       associated with the current value of h_errno on stderr.
41
 
42
       The (obsolete) hstrerror() function takes an error  number
43
       (typically  h_errno) and returns the corresponding message
44
       string.
45
 
46
       The domain name queries carried out by gethostbyname() and
47
       gethostbyaddr()  use  a  combination  of any or all of the
48
       name server named(8), a broken out line  from  /etc/hosts,
49
       and the Network Information Service (NIS or YP), depending
50
       upon the contents of the  order  line  in  /etc/host.conf.
51
       (See   resolv+(8)).    The  default  action  is  to  query
52
       named(8), followed by /etc/hosts.
53
 
54
       The hostent structure is defined in &lt;netdb.h&gt; as follows:
55
 
56
              struct hostent {
57
                      char    *h_name;        /* official name of host */
58
                      char    **h_aliases;    /* alias list */
59
                      int     h_addrtype;     /* host address type */
60
                      int     h_length;       /* length of address */
61
                      char    **h_addr_list;  /* list of addresses */
62
              }
63
              #define h_addr  h_addr_list[0]  /* for backward compatibility */
64
 
65
       The members of the hostent structure are:
66
 
67
       h_name The official name of the host.
68
 
69
       h_aliases
70
              A zero-terminated array of  alternative  names  for
71
              the host.
72
 
73
       h_addrtype
74
              The type of address; always AF_INET at present.
75
 
76
       h_length
77
              The length of the address in bytes.
78
 
79
       h_addr_list
80
              A  zero-terminated  array  of network addresses for
81
              the host in network byte order.
82
 
83
       h_addr The first address in h_addr_list for backward  com­
84
              patibility.
85
 
86
RETURN VALUE
87
       The  gethostbyname()  and gethostbyaddr() functions return
88
       the hostent structure  or  a  NULL  pointer  if  an  error
89
       occurs.   On  error,  the  h_errno variable holds an error
90
       number.
91
 
92
ERRORS
93
       The variable h_errno can have the following values:
94
 
95
       HOST_NOT_FOUND
96
              The specified host is unknown.
97
 
98
       NO_ADDRESS or NO_DATA
99
              The requested name is valid but does not have an IP
100
              address.
101
 
102
       NO_RECOVERY
103
              A non-recoverable name server error occurred.
104
 
105
       TRY_AGAIN
106
              A temporary error occurred on an authoritative name
107
              server.  Try again later.
108
</pre>
109
</body>
110
</html>

powered by: WebSVN 2.1.0

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