Commit | Line | Data |
---|---|---|
7403e690 | 1 | .\" Copyright (c) 1985 Regents of the University of California. |
49bbe9e0 KD |
2 | .\" All rights reserved. The Berkeley software License Agreement |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
21b6cc0f | 5 | .\" @(#)resolver.3 1.5 (Berkeley) %G% |
49bbe9e0 | 6 | .\" |
7403e690 | 7 | .TH RESOLVER 3 "15 November 1985" |
49bbe9e0 KD |
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 | |
7403e690 | 16 | .B #include <arpa/nameser.h> |
49bbe9e0 | 17 | .br |
21b6cc0f | 18 | .B #include <resolv.h> |
49bbe9e0 KD |
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 | |
66ad1208 | 58 | .B dn_expand(msg, msglen, comp_dn, exp_dn, length) |
49bbe9e0 | 59 | .br |
49bbe9e0 KD |
60 | .B char *msg, *comp_dn, exp_dn; |
61 | .br | |
66ad1208 | 62 | .B int msglen, length; |
49bbe9e0 KD |
63 | .SH DESCRIPTION |
64 | These routines are used for making, sending and interpreting packets to | |
65 | Internet domain name servers. Global information that is used by the | |
66 | resolver routines is kept in the variable | |
67 | .IR _res . | |
68 | Most of the values have reasonable defaults and can be ignored. Options | |
69 | stored in | |
70 | .I _res.options | |
71 | are defined in | |
72 | .I resolv.h | |
73 | and are as follows. Options are a simple bit mask and are or'ed in to | |
74 | enable. | |
75 | .IP RES_INIT | |
76 | True if the initial name server address and default domain name are | |
77 | initialized (i.e., | |
78 | .I res_init | |
79 | has been called). | |
80 | .IP RES_DEBUG | |
81 | Print debugging messages. | |
82 | .IP RES_AAONLY | |
83 | Accept authoritative answers only. | |
84 | .I Res_send | |
85 | will continue until it finds an authoritative answer or finds an error. | |
86 | Currently this is not implemented. | |
87 | .IP RES_USEVC | |
88 | Use TCP connections for queries instead of UDP. | |
21b6cc0f KD |
89 | .IP RES_STAYOPEN |
90 | Used with RES_USEVC to keep the TCP connection open between | |
91 | queries. | |
92 | This is useful only in programs that regularly do many queries. | |
93 | UDP should be the normal mode used. | |
49bbe9e0 KD |
94 | .IP RES_IGNTC |
95 | Unused currently (ignore truncation errors, i.e., don't retry with TCP). | |
96 | .IP RES_RECURSE | |
97 | Set the recursion desired bit in queries. This is the default. | |
98 | ( | |
99 | .I res_send | |
21b6cc0f KD |
100 | does not do iterative queries and expects the name server |
101 | to handle recursion.) | |
49bbe9e0 KD |
102 | .IP RES_DEFNAMES |
103 | Append the default domain name to single label queries. This is the default. | |
104 | .PP | |
105 | .I Res_init | |
106 | .PP | |
7403e690 KD |
107 | reads the initialization file to get the default |
108 | domain name and the Internet address of the initial hosts | |
49bbe9e0 | 109 | running the name server. If this line does not exist, the host running |
7403e690 | 110 | the resolver is tried. |
49bbe9e0 | 111 | .I Res_mkquery |
21b6cc0f | 112 | makes a standard query message and places it in |
49bbe9e0 KD |
113 | .IR buf . |
114 | .I Res_mkquery | |
115 | will return the size of the query or \-1 if the query is | |
116 | larger than | |
117 | .IR buflen . | |
118 | .I Op | |
119 | is usually QUERY but can be any of the query types defined in | |
120 | .IR nameser.h . | |
121 | .I Dname | |
122 | is the domain name. If | |
123 | .I dname | |
124 | consists of a single label and the RES_DEFNAMES flag is enabled | |
125 | (the default), | |
126 | .I dname | |
127 | will be appended with the current domain name. The current | |
128 | domain name is defined in a system file and can be overridden | |
129 | by the environment variable LOCALDOMAIN. | |
130 | .I Newrr | |
131 | is currently unused but is intended for making update messages. | |
132 | .PP | |
133 | .I Res_send | |
21b6cc0f | 134 | sends a query to name servers and returns an answer. |
49bbe9e0 KD |
135 | It will call |
136 | .I res_init | |
7403e690 | 137 | if RES_INIT is not set, send the query to the local name server, and |
49bbe9e0 KD |
138 | handle timeouts and retries. The length of the message is returned or |
139 | \-1 if there were errors. | |
140 | .PP | |
141 | .I Dn_expand | |
142 | Expands the compressed domain name | |
143 | .I comp_dn | |
144 | to a full domain name. Expanded names are converted to upper case. | |
145 | .I Msg | |
146 | is a pointer to the beginning of the message, | |
147 | .I exp_dn | |
148 | is a pointer to a buffer of size | |
149 | .I length | |
150 | for the result. | |
151 | The size of compressed name is returned or -1 if there was an error. | |
152 | .PP | |
153 | .I Dn_comp | |
154 | Compresses the domain name | |
155 | .I exp_dn | |
156 | and stores it in | |
157 | .IR comp_dn . | |
158 | The size of the compressed name is returned or -1 if there were errors. | |
159 | .I length is the size of the array pointed to by | |
160 | .IR comp_dn . | |
161 | .I Dnptrs | |
162 | is a list of pointers to previously compressed names in the current message. | |
163 | The first pointer points to | |
164 | to the beginning of the message and the list ends with NULL. | |
165 | .I lastdnptr | |
166 | is a pointer to the end of the array pointed to | |
167 | .IR dnptrs . | |
168 | A side effect is to update the list of pointers for | |
169 | labels inserted into the message by | |
170 | .I dn_comp | |
171 | as the name is compressed. | |
172 | If | |
173 | .I dnptr | |
174 | is NULL, we don't try to compress names. If | |
175 | .I lastdnptr | |
176 | is NULL, we don't update the list. | |
177 | .SH FILES | |
09bbc5a9 | 178 | /etc/resolv.conf see resolver(5) |
49bbe9e0 | 179 | .SH "SEE ALSO" |
21b6cc0f KD |
180 | named(8), resolver(5), RFC882, RFC883, RFC973, RFC974, |
181 | BIND - Operations Guide |