index.txt
INTERNET(3) Library Functions Manual INTERNET(3) NAME in_host, in_ntoa, in_address, in_service - internet operations SYNOPSIS #include <sys/inet/in.h> char *in_host(hostaddr) in_addr hostaddr; char *in_ntoa(hostaddr) in_addr hostaddr; in_addr in_address(hostname) char *hostname; struct in_service *in_service(name, proto, port) char *name, *proto; unsigned int port; DESCRIPTION These routines are loaded by the -lin option of ld(1). Internet addresses, type in_addr, are 32 bit quantities global to the network. The ascii representation for an in_addr can be either a host name or the form b1.b2.b3.b4, where each `bx' is the value of the x'th byte of the address in decimal. The mapping of an internet address to a host name is an n to m mapping. Since host names are considered lo‐ cal `aliases' for internet addresses, the host to address mapping is subjective. In_address maps an internet host name to an address. In_host maps an internet address into a host name. In_ntoa maps an internet address to its ascii numeric format. In_service looks up an entry in the services file and returns the clos‐ est match. If either name or port are 0, they will match any name or port. If proto is 0, the ``tcp'' protocol is assumed. FILES /usr/inet/lib/hosts mapping between host names and addresses /usr/inet/lib/networks mapping between network names and addresses /usr/inet/lib/services database of services /usr/inet/lib/hosts.equiv machines with common administration SEE ALSO tcp(3), udp(3) BUGS The mappings between internet addresses and names is arbitrary at best. The hosts file may contain many addresses for each name and/or many names for each address. In_address and in_host each start at the be‐ ginning of the file and search sequentially for a match. Therefore, in_addr(in_host(addr)) == addr is not necessarily true. INTERNET(3)