[Index of Books][Next Chapter]

TCP/IP for DOS Socket Library Reference

Appendix B. Transport Database Files

Functions in the DOS and Windows socket libraries access specific transport database files. Reference pages in this appendix describe these files and their formats. All database file formats are consistent with standards set by the 4.3BSD socket interface.

Functions in the socket libraries provide access to four database files:

A fifth file, RESOLV.CFG, is used by the Domain Name Service (DNS) function calls res_init(), reskquery(), and res_send() to access name server facilities maintained on the network.

The default location for all of these files is the \NET\TCP directory on the local workstation. To support the workgroup environment, multiple copies of the files can be stored on local and network drives. The files are accessed based on the PATH setting under the Protocol TCPIP section heading in the workstation's NET.CFG file. The PATH setting follows the same syntax as the DOS PATH command. For compatibility with previous versions of TCP/IP for DOS, the EXCELAN® environment variable can also be set to specify a directory for the database files and RESOLV.CFG.

When the TCPIP.EXE TSR program is loaded into memory, it stores the NET.CFG Protocol TCPIP PATH information internally. Subsequent function calls that access the files search each directory in the path stored by TCPIP.EXE to locate the appropriate file, and search each file until a match is found. If no match is found, the directory specified by the EXCELAN environment variable is then searched.

This approach allows workgroups to maintain a centrally administered version of each file while also allowing users to keep individual versions. However, for changes to a workstation's NET.CFG Protocol TCPIP PATH to take effect, you must reload TCPIP.EXE.

The database files provide information associated with the transport system. The database files contain information on hosts, networks, protocols, and services known to or provided by the transport. Access to file entries is through functions that perform searches based on user-supplied arguments.

This appendix describes each of the database files and lists the functions that access them.

The transport database files contain the information listed in Table B-l.

Table B-l. Transport Database Files

File Description
HOSTS Associates hostname and aliases with Internet network and host IP addresses.
NETWORKS Associates network names and aliases with Internet IP addresses.
PROTOCOL Associates protocol name and aliases with standard Internet protocol numbers.
SERVICES Associates service name and aliases with standard Internet protocol and port numbers.

HOSTS File

Description

The HOSTS file contains information about the known hosts, both on the local network as well as on the Internet network. Each host is represented by a single line, with the following parameters separated by one or more blank spaces:

Internet_address host_name [ alias [...] ]

Internet_address is a 4-byte address in standard dotted notation. Each byte is a decimal or hexadecimal value and is separated by a period. Hexadecimal numbers start with the character pair 0x or 0X.

The host_name is the name of the system associated with this Internet address. It can contain any printable character other than a field delimiter (space or tab), a newline character, or number sign (#). The hostname is an arbitrary string, preferably long enough for each name to be unique across the network.

The alias is another name for the same system. Typically, this is a shorter name and does not need to be unique across the network. A single host can have more than one alias. For example, the host "sales" could have the following address and aliases:

129.0.9.5 sales sa sell

Each system's entry in its own HOSTS file must contain the alias "localhost." For example, on the system named "sales" (and on this system only) the entry in its HOSTS file might be the following:

129.0.9.5 sales sa localhost # address of local host

A number sign (#) in the HOSTS file, at any position on a line, indicates the beginning of a comment. Characters between the number sign and the newline character are ignored by the functions that search the file.

The HOSTS file can be created from the official host database maintained at the Network Information System Center (NISC), although local changes may be required to bring it up to date regarding unofficial aliases and unknown hosts. Such a file should be centrally administered for consistency. The sample HOSTS file in the WET\SAMPLE directory is included with the TCP/IP for DOS TCP/IP transport software. The default directory for the HOSTS file is \NET\TCP.

Sample Files

\NET\SAMPLE\HOSTS

See Also

gethostbyaddr(), gethostbyname().

NETWORKS File

Description

The NETWORKS file contains information about the known networks that make up the Internet network. Each network is represented by a single line with the following parameters separated by one or more blank spaces:

network_name Internet_number [ alias [...] ]

The network_name is the name of the network associated with this Internet network number. It can contain any printable character other than a field delimiter (space or tab), newline character, or number sign (#). The network name is an arbitrary string, preferably long enough for each name to be unique.

The Internet_number is the number of the Internet network. Hexadecimal numbers start with the character pair Ox or OX.

The alias is another name for the same network.

A number sign (#) in the NETWORKS file indicates the beginning of a comment. Characters between the number sign and the newline character are ignored by functions that search the file.

For example, the network "cornet" might have the following entry in the NETWORKS file:

cornet 144.61 horn

The NETWORKS file can be created from the official host database maintained at the Network Information System Center (NISC), although local changes may be required to bring it up to date regarding unofficial aliases and unknown networks. Such a file should be centrally administered for consistency. The default directory for the NETWORKS file is \NET\TCP.

Sample Files

\NET\SAMPLE\NETWORKS

See Also

getnetbyaddr(), getnetbyname().

PROTOCOL File

Description

The PROTOCOL file contains information about the known protocols used on the Internet network. Each protocol is represented by a single line with the following parameters separated by one or more blanks:

protocol_name protocol_number [ alias [...] ]

The protocol_name is the name of the Internet protocol associated with this protocol number. It can contain any printable character other than a field delimiter (space or tab), newline character, or number sign (#).

The protocol_number is the number of the Internet protocol.

The alias is an alternate name for the protocol.

A number sign (#) in the PROTOCOL file indicates the beginning of a comment. Characters from the number sign up to the newline character are ignored by the functions that search the file.

For example, the TCP protocol has the following entry in the PROTOCOL file:

tcp 6 TCP # transmission control protocol

The default directory for the PROTOCOL file is \NET\TCP.

Sample Files

\NET\SAMPLE\PROTOCOL

See Also

getprotobyname(), getprotobynumber().

RESOLV,CFG File

Description

The RESOLV.CFG file contains domain name, local domain, and known name server information for the local network. The domain name is represented by the keyword "domain" followed by the local domain name in Domain Name System format. Up to three name servers can be specified, one to a line, with the keyword "nameserver" followed by blanks and the name server address in Internet address format. The keywords must be lowercase.

When you install the TCP/IP transport software, the installation program asks if you are using the Domain Name System; if you are, it asks for the Internet address for one name server. If you have more than one name server, edit the RESOLV.CFG file to add the additional name servers.

A semicolon (;) in the RESOLV.CFG file indicates the beginning of a comment. Characters between the semicolon and the newline character are ignored by functions that search the file.

The default directory for the RESOLV.CFG file is \NET\TCP.

Sample File

\NET\SAMPLE\RESOLV.CFG

See Also

res_init().

SERVICES File

Description

The SERVICES file contains information about the known services used on the Internet network. Each service is represented by a single line with the following parameters, each separated by one or more blanks:

service_name port_number/protocol_name [ alias [...] ]

The service_name is the name of the service associated with this port number and protocol name. It can contain any printable character other than a field delimiter (space or tab), newline character, or number sign (#). These services are generally application, presentation, or session-level modules, such as TFTP, FTP, SMTP, and TELNET.

The port_number is the number of the Internet port used by the service. The pro tocol_name is the protocol with which the service is associated. This protocol is generally a transport-level or network-level module, such as TCP or UDP. Separate the port number and the protocol name with a slash.

The alias is an alternate name for the service.

A number sign ( ) in the SERVICES file indicates the beginning of a comment. Characters between the number sign and the newline character are ignored by the functions that search the file.

For example, the following line is the entry for the SMTP mail protocol:

SMTP 25/TCP MAIL

The default directory for the SERVICES file is \NET\TCP.

Sample Files

\NET\SAMPLE\SERVICES

See Also

getservbyname(), getservbyport()