Name-to-Address Mapping

Name-to-address mapping enables an application to obtain the address of a service on a specified host independent of the transport used. Name-to-address mapping consists of the following interfaces:

netdir_getbyname()

Maps the host and service name to a set of addresses. For more information, see the netdir_getbyname(3C) man page.

netdir_getbyaddr()

Maps addresses into host and service names. For more information, see the netdir_getbyaddr(3C) man page.

netdir_free()

Frees structures allocated by the name-to-address translation routines. For more information, see the netdir_free(3C) man page.

taddr2uaddr()

Translates an address and returns a transport-independent character representation of the address. For more information, see the taddr2uaddr(3C) man page.

uaddr2taddr()

The universal address is translated into a netbuf structure. For more information, see the uaddr2taddr(3C) man page.

netdir_options()

Interfaces to transport-specific capabilities such as the broadcast address and reserved port facilities of TCP and UDP. For more information, see the netdir_options(3C) man page.

netdir_perror()

Displays a message stating why one of the routines that map name-to-address failed on stderr. For more information, see the netdir_perror(3C) man page.

netdir_sperror()

Returns a string containing the error message stating why one of the routines that map name-to-address failed. For more information, see the netdir_sperror(3C) man page.

The first argument of each routine points to a netconfig structure that describes a transport. The routine uses the array of directory-lookup library paths in the netconfig structure to call each path until the translation succeeds. For more information, see the netconfig(5) man page.

The name-to-address libraries are described in Table 10-1. The routines that are described in Using the Name-to-Address Mapping Routines are defined in the netdir(3C) man page.

Note:

The following libraries no longer exist in the Oracle Solaris environment: tcpip.so, switch.so, and nis.so. For more information about this change, see the nsswitch.conf(5) man page and the NOTES section of the gethostbyname(3C) man page.

Table 10-1 Name-to-Address Libraries

Library Transport Family Description

-

inet

The name-to-address mapping for networks of the protocol family inet is provided by the name service switch based on the entries for hosts and services in the file nsswitch.conf(5). For networks of other families, the dash indicates a nonfunctional name-to-address mapping.