Network selection is a simple way by which users and applications may dynamically select transports, according to both their preferences and the available transports. It is based on two mechanisms, the netconfig(ADMN) database, which lists the transports available on the host and identifies them by type, and the optional environment variable NETPATH, which allows the user to specify preferences among the transports available in /etc/netconfig that are acceptable to the application. For more details about network selection, see ``Network selection'' and the getnetconfig(NS) manual page.
The /etc/netconfig file contains several lines, each of which corresponds to an available transport (see netconfig(ADMN)). These are some possible entries:
# The Network Configuration File. # # Each entry is of the form: # # network_id semantics flags protofamily protoname device nametoaddr_libs # ticlts tpi_clts v loopback - /dev/ticlts /usr/lib/straddr.so ticots tpi_cots v loopback - /dev/ticots /usr/lib/straddr.so ticotsord tpi_cots_ord v loopback - /dev/ticotsord /usr/lib/straddr.so starlan tpi_cots v osinet - /dev/starlan /usr/lib/straddr.so starlang tpi_clts v osinet - /dev/starlang /usr/lib/straddr.so tcp tpi_cots_ord v inet tcp /dev/tcp /usr/lib/tcpip.so udp tpi_clts v inet udp /dev/udp /usr/lib/tcpip.so icmp tpi_raw - inet icmp /dev/icmp /usr/lib/tcpip.so rawip tpi_raw - inet - /dev/rawip /usr/lib/tcpip.soThe following are a few points about /etc/netconfig, and the applications interface to it:
The format of NETPATH is an ordered list of network identifiers separated by colons (:) (for example: udp:tcp:starlan). By setting NETPATH, the user can specify the order in which the application should try the various networks. If NETPATH is not set, the system defaults to all visible transports specified in /etc/netconfig, in the order they appear.
RPC divides selectable transports into the following types:
When a transport-dependent application begins execution, it begins by calling the setnetconfig, getnetconfig, and endnetconfig routines, using them to search /etc/netconfig for a transport of appropriate type. This information is then stored in local data structures of type struct netconfig and is available for later use. setnetconfig, getnetconfig, and endnetconfig are described on the getnetconfig(NS) manual page; the Network Selection Administrative file /etc/netconfig is described on the netconfig(ADMN) manual page.
Taken together, these mechanisms allow a fine degree of control over network selection: a user can specify a preferred transport, and if it is reasonable, applications will use it. In cases where the specified transport is inappropriate (as, for example, when a remote server does not support a specified transport) the application should automatically try others with the right characteristics.