|
|
HP-UX IPv6 Porting Guide: HP-UX 11i v2 September 2004 > Chapter 6 Function Calls Converting Names to Addressesgetipnodebyname(3N) |
|
An application program calls the getipnodebyname() function to performs lookups for IPv4/IPv6 hosts.
*name: A pointer to a node name or numeric string, such as an IPv4 dotted-decimal address or an IPv6 hexadecimal address. Addr_family: An integer that sets the address-type searched-for and returned-by the function. Addr_family is either AF_INET (IPv4) or AF_INET6 (IPv6). flags: An integer that specifies the conditions for returning an address, such as IPv6-only, IPv4-mapped if no IPv6 address found, or return an address only if the remote node name has at least one IP address configured. *error_num: A pointer to the error code returned by the getipnodebyname() function. Host_ptr: The struct hostent returned by the getipnodebyname() function, containing one or more IP address for name.The hostent structure comprises the following fields: char *h_name: A pointer to the canonical name (Fully Qualified Name) of host name. char **h_alias: A pointer to an array of pointers-to-aliases for the host name. int h_addrtype: The type of address returned within the hostent structure: either AF_INET for IPv4 addresses or AF_INET6 for IPv6 addresses. int h_length: The length of the IP address pointed-to by name, either 4 octets (IPv4) or 16 octets (IPv6)*. char **h_addr_list[0]: Pointer to an array of pointers-to-IPv4-or-IPv6-addresses for the host name. |
|