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 | .\" | |
7403e690 | 5 | .\" @(#)resolver.3 1.2 (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 |
7403e690 | 18 | .B #include <arpa/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 | |
58 | .B dn_expand(msg, comp_dn, exp_dn, length) | |
59 | .br | |
60 | .SM | |
61 | .B char *msg, *comp_dn, exp_dn; | |
62 | .br | |
63 | .B int length; | |
64 | .SH DESCRIPTION | |
65 | These routines are used for making, sending and interpreting packets to | |
66 | Internet domain name servers. 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. Options | |
70 | stored in | |
71 | .I _res.options | |
72 | are defined in | |
73 | .I resolv.h | |
74 | and are as follows. Options are a simple bit mask and are or'ed in to | |
75 | enable. | |
76 | .IP RES_INIT | |
77 | True if the initial name server address and default domain name are | |
78 | initialized (i.e., | |
79 | .I res_init | |
80 | has been called). | |
81 | .IP RES_DEBUG | |
82 | Print debugging messages. | |
83 | .IP RES_AAONLY | |
84 | Accept authoritative answers only. | |
85 | .I Res_send | |
86 | will continue until it finds an authoritative answer or finds an error. | |
87 | Currently this is not implemented. | |
88 | .IP RES_USEVC | |
89 | Use TCP connections for queries instead of UDP. | |
90 | .IP RES_PRIMARY | |
91 | Unused currently. | |
92 | .IP RES_IGNTC | |
93 | Unused currently (ignore truncation errors, i.e., don't retry with TCP). | |
94 | .IP RES_RECURSE | |
95 | Set the recursion desired bit in queries. This is the default. | |
96 | ( | |
97 | .I res_send | |
7403e690 | 98 | does not currently perform iterative queries and expects the name server |
49bbe9e0 KD |
99 | to handle recursion. This should be fixed.) |
100 | .IP RES_DEFNAMES | |
101 | Append the default domain name to single label queries. This is the default. | |
102 | .PP | |
103 | .I Res_init | |
104 | .PP | |
7403e690 KD |
105 | reads the initialization file to get the default |
106 | domain name and the Internet address of the initial hosts | |
49bbe9e0 | 107 | running the name server. If this line does not exist, the host running |
7403e690 | 108 | the resolver is tried. |
49bbe9e0 KD |
109 | .I Res_mkquery |
110 | is used to make a standard query message and places it in | |
111 | .IR buf . | |
112 | .I Res_mkquery | |
113 | will return the size of the query or \-1 if the query is | |
114 | larger than | |
115 | .IR buflen . | |
116 | .I Op | |
117 | is usually QUERY but can be any of the query types defined in | |
118 | .IR nameser.h . | |
119 | .I Dname | |
120 | is the domain name. If | |
121 | .I dname | |
122 | consists of a single label and the RES_DEFNAMES flag is enabled | |
123 | (the default), | |
124 | .I dname | |
125 | will be appended with the current domain name. The current | |
126 | domain name is defined in a system file and can be overridden | |
127 | by the environment variable LOCALDOMAIN. | |
128 | .I Newrr | |
129 | is currently unused but is intended for making update messages. | |
130 | .PP | |
131 | .I Res_send | |
132 | is used to send a query to name servers and return an answer. | |
133 | It will call | |
134 | .I res_init | |
7403e690 | 135 | if RES_INIT is not set, send the query to the local name server, and |
49bbe9e0 KD |
136 | handle timeouts and retries. The length of the message is returned or |
137 | \-1 if there were errors. | |
138 | .PP | |
139 | .I Dn_expand | |
140 | Expands the compressed domain name | |
141 | .I comp_dn | |
142 | to a full domain name. Expanded names are converted to upper case. | |
143 | .I Msg | |
144 | is a pointer to the beginning of the message, | |
145 | .I exp_dn | |
146 | is a pointer to a buffer of size | |
147 | .I length | |
148 | for the result. | |
149 | The size of compressed name is returned or -1 if there was an error. | |
150 | .PP | |
151 | .I Dn_comp | |
152 | Compresses the domain name | |
153 | .I exp_dn | |
154 | and stores it in | |
155 | .IR comp_dn . | |
156 | The size of the compressed name is returned or -1 if there were errors. | |
157 | .I length is the size of the array pointed to by | |
158 | .IR comp_dn . | |
159 | .I Dnptrs | |
160 | is a list of pointers to previously compressed names in the current message. | |
161 | The first pointer points to | |
162 | to the beginning of the message and the list ends with NULL. | |
163 | .I lastdnptr | |
164 | is a pointer to the end of the array pointed to | |
165 | .IR dnptrs . | |
166 | A side effect is to update the list of pointers for | |
167 | labels inserted into the message by | |
168 | .I dn_comp | |
169 | as the name is compressed. | |
170 | If | |
171 | .I dnptr | |
172 | is NULL, we don't try to compress names. If | |
173 | .I lastdnptr | |
174 | is NULL, we don't update the list. | |
175 | .SH FILES | |
7403e690 KD |
176 | resolv.conf Contains the default resolver information read by res_init. |
177 | There are two types of records in this file, domain and name server. | |
178 | The domain record specifies the default domain for the resolver to use. | |
179 | You can have multiple name server records to designate the name servers | |
180 | addresses you would like the resolver to try. By using this | |
181 | file you don't have to have a name server actually running on your system | |
182 | and you can have a back up name server to try in the event your local server | |
183 | is not responsive. | |
49bbe9e0 KD |
184 | .SH "SEE ALSO" |
185 | named(8), RFC882, RFC883 |