Annotation of 43BSDTahoe/man/man3/resolver.3, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1985 Regents of the University of California.
                      2: .\" All rights reserved.  The Berkeley software License Agreement
                      3: .\" specifies the terms and conditions for redistribution.
                      4: .\"
                      5: .\"    @(#)resolver.3  6.1 (Berkeley) 11/21/87
                      6: .\"
                      7: .TH RESOLVER 3 "November 21, 1987"
                      8: .UC 4
                      9: .SH NAME
                     10: res_mkquery, res_send, res_init, dn_comp, dn_expand \- resolver routines
                     11: .SH SYNOPSIS
                     12: .B #include <sys/types.h>
                     13: .br
                     14: .B #include <netinet/in.h>
                     15: .br
                     16: .B #include <arpa/nameser.h>
                     17: .br
                     18: .B #include <resolv.h>
                     19: .PP
                     20: .B "res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)"
                     21: .br
                     22: .B int op;
                     23: .br
                     24: .B char *dname;
                     25: .br
                     26: .B int class, type;
                     27: .br
                     28: .B char *data;
                     29: .br
                     30: .B int datalen;
                     31: .br
                     32: .B struct rrec *newrr;
                     33: .br
                     34: .B char *buf;
                     35: .br
                     36: .B int buflen;
                     37: .PP
                     38: .B res_send(msg, msglen, answer, anslen)
                     39: .br
                     40: .B char *msg;
                     41: .br
                     42: .B int msglen;
                     43: .br
                     44: .B char *answer;
                     45: .br
                     46: .B int anslen;
                     47: .PP
                     48: .B res_init()
                     49: .PP
                     50: .B dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
                     51: .br
                     52: .B char *exp_dn, *comp_dn;
                     53: .br
                     54: .B int length;
                     55: .br
                     56: .B char **dnptrs, **lastdnptr;
                     57: .PP
                     58: .B dn_expand(msg, eomorig, comp_dn, exp_dn, length)
                     59: .br
                     60: .B char *msg, *eomorig, *comp_dn, exp_dn;
                     61: .br
                     62: .B int  length;
                     63: .SH DESCRIPTION
                     64: These routines are used for making, sending and interpreting packets
                     65: for use with Internet domain name servers.
                     66: Global information that is used by the
                     67: resolver routines is kept in the variable
                     68: .IR _res .
                     69: Most of the values have reasonable defaults and can be ignored.
                     70: Options
                     71: stored in
                     72: .I _res.options
                     73: are defined in
                     74: .I resolv.h
                     75: and are as follows.
                     76: Options are stored a simple bit mask containing the bitwise ``or''
                     77: of the options enabled.
                     78: .IP RES_INIT
                     79: True if the initial name server address and default domain name are
                     80: initialized (i.e.,
                     81: .I res_init
                     82: has been called).
                     83: .IP RES_DEBUG
                     84: Print debugging messages.
                     85: .IP RES_AAONLY
                     86: Accept authoritative answers only.
                     87: With this option,
                     88: .I res_send
                     89: should continue until it finds an authoritative answer or finds an error.
                     90: Currently this is not implemented.
                     91: .IP RES_USEVC
                     92: Use TCP connections for queries instead of UDP datagrams.
                     93: .IP RES_STAYOPEN
                     94: Used with RES_USEVC to keep the TCP connection open between
                     95: queries.
                     96: This is useful only in programs that regularly do many queries.
                     97: UDP should be the normal mode used.
                     98: .IP RES_IGNTC
                     99: Unused currently (ignore truncation errors, i.e., don't retry with TCP).
                    100: .IP RES_RECURSE
                    101: Set the recursion-desired bit in queries.
                    102: This is the default.
                    103: (
                    104: .I res_send
                    105: does not do iterative queries and expects the name server
                    106: to handle recursion.)
                    107: .IP RES_DEFNAMES
                    108: If set,
                    109: .I res_mkquery
                    110: will append the default domain name to single-component names
                    111: (those that do not contain a dot).
                    112: This is the default.
                    113: .IP RES_DNSRCH
                    114: If this option is set,
                    115: the standard host lookup routine
                    116: .IR gethostbyname (3)
                    117: will search for host names in the current domain and in parent domains; see
                    118: .IR hostname (7).
                    119: .PP
                    120: .I Res_init
                    121: .PP
                    122: reads the initialization file to get the default
                    123: domain name and the Internet address of the initial hosts
                    124: running the name server.
                    125: If this line does not exist, the host running
                    126: the resolver is tried.
                    127: .I Res_mkquery
                    128: makes a standard query message and places it in
                    129: .IR buf .
                    130: .I Res_mkquery
                    131: will return the size of the query or \-1 if the query is
                    132: larger than
                    133: .IR buflen .
                    134: .I Op
                    135: is usually QUERY but can be any of the query types defined in
                    136: .IR nameser.h .
                    137: .I Dname
                    138: is the domain name.
                    139: If
                    140: .I dname
                    141: consists of a single label and the RES_DEFNAMES flag is enabled
                    142: (the default), the current domain name will be appended to
                    143: .IR dname .
                    144: The current domain name is defined by the hostname
                    145: or is specified in a system file; it can be overridden
                    146: by the environment variable LOCALDOMAIN.
                    147: .I Newrr
                    148: is currently unused but is intended for making update messages.
                    149: .PP
                    150: .I Res_send
                    151: sends a query to name servers and returns an answer.
                    152: It will call
                    153: .I res_init
                    154: if RES_INIT is not set, send the query to the local name server, and
                    155: handle timeouts and retries.
                    156: The length of the message is returned, or
                    157: \-1 if there were errors.
                    158: .PP
                    159: .I Dn_expand
                    160: expands the compressed domain name
                    161: .I comp_dn
                    162: to a full domain name.  Expanded names are converted to upper case.
                    163: .I Msg
                    164: is a pointer to the beginning of the message,
                    165: .I exp_dn
                    166: is a pointer to a buffer of size
                    167: .I length
                    168: for the result.
                    169: The size of compressed name is returned or -1 if there was an error.
                    170: .PP
                    171: .I Dn_comp
                    172: compresses the domain name
                    173: .I exp_dn
                    174: and stores it in
                    175: .IR comp_dn .
                    176: The size of the compressed name is returned or -1 if there were errors.
                    177: .I length is the size of the array pointed to by
                    178: .IR comp_dn .
                    179: .I Dnptrs
                    180: is a list of pointers to previously compressed names in the current message.
                    181: The first pointer points to
                    182: to the beginning of the message and the list ends with NULL.
                    183: .I lastdnptr
                    184: is a pointer to the end of the array pointed to
                    185: .IR dnptrs .
                    186: A side effect is to update the list of pointers for
                    187: labels inserted into the message by
                    188: .I dn_comp
                    189: as the name is compressed.
                    190: If
                    191: .I dnptr
                    192: is NULL, names are not compressed.
                    193: If
                    194: .I lastdnptr
                    195: is NULL, the list of labels is not updated.
                    196: .SH FILES
                    197: /etc/resolv.conf       see resolver(5)
                    198: .SH "SEE ALSO"
                    199: gethostbyname(3), named(8), resolver(5), hostname(7),
                    200: .br
                    201: RFC882, RFC883, RFC973, RFC974,
                    202: .br
                    203: SMM:11 Name Server Operations Guide for BIND

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.