SRV(2)                                                     SRV(2)

     NAME
          srv, ipsrv - network name and address translation

     SYNOPSIS
          include "srv.m"
          srv:= load Srv Srv->PATH;
          Srv: module
          {
            PATH:  con "$Srv";
            iph2a: fn(host: string): list of string;
            ipa2h: fn(addr: string): list of string;
            ipn2p: fn(protocol, service: string): string;
          };

          ipsrv := load Ipsrv Ipsrv->PATH;
          Ipsrv: module
          {
            init:  fn(nil: list of string);
            iph2a: fn(host: string): list of string;
            ipa2h: fn(addr: string): list of string;
            ipn2p: fn(protocol, service: string): string;
          };

     DESCRIPTION
          These modules provide name and address translation in hosted
          and native modes.

          Srv is a module built in to emu(1) that accesses the Inter-
          net name resolution services of a host operating system.

          Given a host name, Iph2a returns a list of its Internet
          addresses (if any).  Given an Internet address, ipa2h
          returns a list of host names (if any) that have that
          address.  The results are only as accurate as the host
          system's name service.

          Ipn2p returns the port number (as a string) for the given
          service when accessed using a particular protocol protocol
          (typically tcp or udp).

          Ipsrv provides a superset of the srv(2) interface for name
          and address translation.  It can be used in both hosted and
          native modes.  It has an additional init function that must
          be called before any of the other functions is used; its
          argument should be nil.  It uses the Internet Domain Name
          Service (DNS) for both host name lookup and reverse
          (address) lookup.  The addresses of the DNS servers, which
          must be numeric IP addresses, and an (optional) local domain
          name are read from /services/dns/db.  It uses services(6) to
          map protocol and service names to Internet port numbers.

     Page 1                       Plan 9            (printed 11/18/24)

     SRV(2)                                                     SRV(2)

     SOURCE
          /appl/lib/ipsrv.b

     SEE ALSO
          sys-file2chan(2), cs(8)

     BUGS
          Srv should have an init function.  On the other hand, Ipsrv
          should not take arguments to its init function.
          Ipsrv uses TCP/IP not UDP/IP to access the DNS.

     Page 2                       Plan 9            (printed 11/18/24)