Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ resolver(3N) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

named(1M)

gethostbyname(3N)

resolv.conf(4)

in(5)

resolver(3N)                                                   resolver(3N)

NAME
     resolver: resquery, ressearch, resmkquery, ressend, resinit,
     dncomp, dnexpand - resolver routines

SYNOPSIS
     #include <sys/types.h>
     #include <netinet/in.h>
     #include <arpa/nameser.h>
     #include <resolv.h>

     int resquery(const char *dname, int class, int type,
                   uchar *answer, int anslen);

     int ressearch(const char *dname, int class, int type,
                   uchar *answer, int anslen);

     int resmkquery(int op, const char *dname, int class, int type,
                   const uchar *data, int datalen,
                   const uchar *newrrin, uchar *buf, int buflen);

     int ressend(const uchar *msg, int msglen,
                   uchar *answer, int anslen);

     int resinit(void);

     int dncomp(const char *expdn, uchar *compdn, int length,
                   uchar **dnptrs, uchar **lastdnptr);

     int dnexpand(const uchar *msg, const uchar *eomorig,
                   const uchar *compdn, char *expdn, int length);

DESCRIPTION
     These routines are used for making, sending and interpreting query and
     reply messages with Internet domain name servers.

     Global configuration and state information that is used by the resol-
     ver routines is kept in the variable res, structure resstate. Most
     of the values have reasonable defaults and can be ignored. Options
     stored in res.options are defined in resolv.h and are as follows.
     Options are stored as a simple bit mask containing the bitwise "or" of
     the options enabled.

     RESINIT
          True if the initial name server address and default domain name
          are initialized (i.e., resinit has been called).

     RESDEBUG
          Print debugging messages.







Page 1                       Reliant UNIX 5.44                Printed 11/98

resolver(3N)                                                   resolver(3N)

     RESAAONLY
          Accept authoritative answers only. With this option, ressend
          should continue until it finds an authoritative answer or finds
          an error. Currently this is not implemented.

     RESUSEVC
          Use TCP connections for queries instead of UDP datagrams.

     RESSTAYOPEN
          Used with RESUSEVC to keep the TCP connection open between
          queries. This is useful only in programs that regularly do many
          queries. UDP should be the normal mode used.

     RESIGNTC
          Unused currently (ignore truncation errors, i.e., don't retry
          with TCP).

     RESRECURSE
          Set the recursion-desired bit in queries. This is the default.
          (ressend does not do iterative queries and expects the name
          server to handle recursion.)

     RESDEFNAMES
          If set, ressearch will append the default domain name to
          single-component names (those that do not contain a dot). This
          option is enabled by default.

     RESDNSRCH
          If this option is set, ressearch will search for host names in
          the current domain and in parent domains. This is used by the
          standard host lookup routine gethostbyname(3N). This option is
          enabled by default.

     RESNOALIASES
          This option turns off the user level aliasing feature controlled
          by the HOSTALIASES environment variable. Network daemons should
          set this option.

     The resinit routine reads the configuration file [if any; see
     resolv.conf(4)] to get the default domain name, search list and the
     Internet address of the local name server(s). If no server is config-
     ured, the host running the resolver is tried. The current domain name
     is defined by the hostname if not specified in the configuration file;
     it can be overridden by the environment variable LOCALDOMAIN. This
     environment variable may contain several blank-separated tokens if you
     wish to override the "search list" on a per-process basis. This is
     similar to the search command in the configuration file. Another envi-
     ronment variable (RESOPTIONS) can be set to override certain internal
     resolver options which are otherwise set by changing fields in the
     res structure or are inherited from the configuration file's options
     command. The syntax of the RESOPTIONS environment variable is
     explained in resolv.conf(4). Initialization normally occurs on the


Page 2                       Reliant UNIX 5.44                Printed 11/98

resolver(3N)                                                   resolver(3N)

     first call to one of the other resolver routines.

     The resquery function provides an interface to the server query
     mechanism. It constructs a query, sends it to the server, awaits a
     response, and makes preliminary checks on the reply. The query
     requests information of the specified type and class for the specified
     fully-qualified domain name dname. The reply message is left in the
     answer buffer with length anslen supplied by the caller.

     The ressearch routine makes a query and awaits a response like
     resquery, but in addition, it implements the default and search rules
     controlled by the RESDEFNAMES and RESDNSRCH options. It returns the
     first successful reply.

     The remaining routines are lower-level routines used by resquery. The
     resmkquery function constructs a standard query message and places it
     in buf. It returns the size of the query, or -1 if the query is larger
     than buflen. The query type op is usually QUERY, but can be any of the
     query types defined in <arpa/nameser.h>. The domain name for the query
     is given by dname. newrrin is currently unused but is intended for
     making update messages.

     The ressend routine sends a pre-formatted query and returns an
     answer. It will call resinit if RESINIT is not set, send the query
     to the name server, and handle timeouts and retries. The length of the
     reply message is returned, or -1 if there were errors.

     The dncomp function compresses the domain name expdn and stores it
     in compdn. The size of the compressed name is returned or -1 if there
     were errors. The size of the array pointed to by compdn is given by
     length. The compression uses an array of pointers dnptrs to previously
     compressed names in the current message. The first pointer points to
     to the beginning of the message and the list ends with NULL. The limit
     to the array is specified by lastdnptr. A side effect of dncomp is to
     update the list of pointers for labels inserted into the message as
     the name is compressed. If dnptr is NULL, names are not compressed. If
     lastdnptr is NULL, the list of labels is not updated. (Both parameters
     should never be NULL!)

     The dnexpand entry expands the compressed domain name compdn to a
     full domain name The compressed name is contained in a query or reply
     message; msg is a pointer to the beginning of the message. The
     uncompressed name is placed in the buffer indicated by expdn which is
     of size length. The size of compressed name is returned or -1 if there
     was an error.

NOTE
     Programs must be linked with the option -lresolv.






Page 3                       Reliant UNIX 5.44                Printed 11/98

resolver(3N)                                                   resolver(3N)

FILES
     /usr/include/arpa/nameser.h

     /usr/include/netinet/in.h
          See in(5)

     /usr/include/resolv.h

     /usr/include/sys/types.h

     /etc/resolv.conf
          See resolv.conf(4)

     /usr/lib/libresolv.a

     /usr/lib/named/bog.ascii
     /usr/lib/named/bog.ps
          Name Server Operations Guide for BIND ("BOG"); ASCII and
          PostScript format

SEE ALSO
     named(1M), gethostbyname(3N), resolv.conf(4), in(5).

     RFC1032, RFC1033, RFC1034, RFC1035, RFC974.






























Page 4                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026