Comtrol eCos User Manual
Page 519

Chapter 38. TCP/IP Library Reference
to an object with the following structure describing an internet host
referenced by name or by address, respectively.
This structure contains
either information obtained from the name server (i.e., resolver(3) and
named(8)), broken-out fields from a line in /etc/hosts, or database
entries supplied by the yp(8) system.
resolv.conf(5) describes how the
particular database is chosen.
struct
hostent {
char
*h_name;
/* official name of host */
char
**h_aliases;
/* alias list */
int
h_addrtype;
/* host address type */
int
h_length;
/* length of address */
char
**h_addr_list;
/* list of addresses from name server */
};
#define h_addr
h_addr_list[0]
/* address, for backward compatibility */
The members of this structure are:
h_name
Official name of the host.
h_aliases
A zero-terminated array of alternate names for the host.
h_addrtype
The type of address being returned.
h_length
The length, in bytes, of the address.
h_addr_list
A zero-terminated array of network addresses for the host.
Host addresses are returned in network byte order.
h_addr
The first address in h_addr_list; this is for backward com-
patibility.
The function gethostbyname() will search for the named host in the cur-
rent domain and its parents using the search lookup semantics detailed in
resolv.conf(5) and hostname(7).
gethostbyname2() is an advanced form of gethostbyname() which allows
lookups in address families other than AF_INET, for example AF_INET6.
The gethostbyaddr() function will search for the specified address of
length len in the address family af.
The only address family currently
supported is AF_INET.
The sethostent() function may be used to request the use of a connected
TCP socket for queries.
If the stayopen flag is non-zero, this sets the
option to send all queries to the name server using TCP and to retain the
connection after each call to gethostbyname() or gethostbyaddr().
Other-
wise, queries are performed using UDP datagrams.
The endhostent() function closes the TCP connection.
The herror() function prints an error message describing the failure.
If
its argument string is non-null, it is prepended to the message string
and separated from it by a colon (‘:’) and a space.
The error message is
printed with a trailing newline.
The contents of the error message is
415