1 | /*
|
---|
2 | Linux DNS client library implementation
|
---|
3 |
|
---|
4 | Copyright (C) 2006 Krishna Ganugapati <krishnag@centeris.com>
|
---|
5 | Copyright (C) 2006 Gerald Carter <jerry@samba.org>
|
---|
6 |
|
---|
7 | ** NOTE! The following LGPL license applies to the libaddns
|
---|
8 | ** library. This does NOT imply that all of Samba is released
|
---|
9 | ** under the LGPL
|
---|
10 |
|
---|
11 | This library is free software; you can redistribute it and/or
|
---|
12 | modify it under the terms of the GNU Lesser General Public
|
---|
13 | License as published by the Free Software Foundation; either
|
---|
14 | version 2.1 of the License, or (at your option) any later version.
|
---|
15 |
|
---|
16 | This library is distributed in the hope that it will be useful,
|
---|
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | Lesser General Public License for more details.
|
---|
20 |
|
---|
21 | You should have received a copy of the GNU Lesser General Public
|
---|
22 | License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifndef _DNS_H
|
---|
26 | #define _DNS_H
|
---|
27 |
|
---|
28 | #include "lib/replace/replace.h"
|
---|
29 | #include "system/network.h"
|
---|
30 |
|
---|
31 | /* make sure we have included the correct config.h */
|
---|
32 | #ifndef NO_CONFIG_H /* for some tests */
|
---|
33 | #ifndef CONFIG_H_IS_FROM_SAMBA
|
---|
34 | #error "make sure you have removed all config.h files from standalone builds!"
|
---|
35 | #error "the included config.h isn't from samba!"
|
---|
36 | #endif
|
---|
37 | #endif /* NO_CONFIG_H */
|
---|
38 |
|
---|
39 | #include <stdio.h>
|
---|
40 | #include <stdlib.h>
|
---|
41 | #include <fcntl.h>
|
---|
42 | #include <time.h>
|
---|
43 | #ifndef __OS2__
|
---|
44 | #include <string.h>
|
---|
45 | #endif
|
---|
46 | #include <errno.h>
|
---|
47 | #include <netdb.h>
|
---|
48 | #include <sys/types.h>
|
---|
49 | #include <sys/socket.h>
|
---|
50 | #include <netinet/in.h>
|
---|
51 | #include <arpa/inet.h>
|
---|
52 | #include <stdarg.h>
|
---|
53 |
|
---|
54 | #ifdef HAVE_UUID_UUID_H
|
---|
55 | #include <uuid/uuid.h>
|
---|
56 | #endif
|
---|
57 |
|
---|
58 | #ifdef HAVE_KRB5_H
|
---|
59 | #include <krb5.h>
|
---|
60 | #endif
|
---|
61 |
|
---|
62 | #ifdef HAVE_INTTYPES_H
|
---|
63 | #include <inttypes.h>
|
---|
64 |
|
---|
65 | #ifndef int16
|
---|
66 | #define int16 int16_t
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | #ifndef uint16
|
---|
70 | #define uint16 uint16_t
|
---|
71 | #endif
|
---|
72 |
|
---|
73 | #ifndef int32
|
---|
74 | #define int32 int32_t
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | #ifndef uint32
|
---|
78 | #define uint32 uint32_t
|
---|
79 | #endif
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | #ifdef HAVE_KRB5_H
|
---|
83 | #include <krb5.h>
|
---|
84 | #endif
|
---|
85 |
|
---|
86 | #if HAVE_GSSAPI_GSSAPI_H
|
---|
87 | #include <gssapi/gssapi.h>
|
---|
88 | #elif HAVE_GSSAPI_GSSAPI_GENERIC_H
|
---|
89 | #include <gssapi/gssapi_generic.h>
|
---|
90 | #elif HAVE_GSSAPI_H
|
---|
91 | #include <gssapi.h>
|
---|
92 | #endif
|
---|
93 |
|
---|
94 | #if defined(HAVE_GSSAPI_H) || defined(HAVE_GSSAPI_GSSAPI_H) || defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
|
---|
95 | #define HAVE_GSSAPI_SUPPORT 1
|
---|
96 | #endif
|
---|
97 |
|
---|
98 | #include <talloc.h>
|
---|
99 |
|
---|
100 | #if 0
|
---|
101 |
|
---|
102 | Disable these now we have checked all code paths and ensured
|
---|
103 | NULL returns on zero request. JRA.
|
---|
104 |
|
---|
105 | void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
|
---|
106 | void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);
|
---|
107 | void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
|
---|
108 | void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
|
---|
109 | void *talloc_zeronull(const void *context, size_t size, const char *name);
|
---|
110 |
|
---|
111 | #define TALLOC(ctx, size) talloc_zeronull(ctx, size, __location__)
|
---|
112 | #define TALLOC_P(ctx, type) (type *)talloc_zeronull(ctx, sizeof(type), #type)
|
---|
113 | #define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array_zeronull(ctx, sizeof(type), count, #type)
|
---|
114 | #define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup_zeronull(ctx, ptr, size, __location__)
|
---|
115 | #define TALLOC_ZERO(ctx, size) _talloc_zero_zeronull(ctx, size, __location__)
|
---|
116 | #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero_zeronull(ctx, sizeof(type), #type)
|
---|
117 | #define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array_zeronull(ctx, sizeof(type), count, #type)
|
---|
118 | #define TALLOC_SIZE(ctx, size) talloc_zeronull(ctx, size, __location__)
|
---|
119 | #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero_zeronull(ctx, size, __location__)
|
---|
120 |
|
---|
121 | #else
|
---|
122 |
|
---|
123 | #define TALLOC(ctx, size) talloc_named_const(ctx, size, __location__)
|
---|
124 | #define TALLOC_P(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
|
---|
125 | #define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type)
|
---|
126 | #define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup(ctx, ptr, size, __location__)
|
---|
127 | #define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__)
|
---|
128 | #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
|
---|
129 | #define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type)
|
---|
130 | #define TALLOC_SIZE(ctx, size) talloc_named_const(ctx, size, __location__)
|
---|
131 | #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__)
|
---|
132 |
|
---|
133 | #endif
|
---|
134 |
|
---|
135 | #define TALLOC_REALLOC(ctx, ptr, count) _talloc_realloc(ctx, ptr, count, __location__)
|
---|
136 | #define TALLOC_REALLOC_ARRAY(ctx, ptr, type, count) (type *)_talloc_realloc_array(ctx, ptr, sizeof(type), count, #type)
|
---|
137 | #define talloc_destroy(ctx) talloc_free(ctx)
|
---|
138 | #define TALLOC_FREE(ctx) do { if ((ctx) != NULL) {talloc_free(ctx); ctx=NULL;} } while(0)
|
---|
139 |
|
---|
140 | /*******************************************************************
|
---|
141 | Type definitions for int16, int32, uint16 and uint32. Needed
|
---|
142 | for Samba coding style
|
---|
143 | *******************************************************************/
|
---|
144 |
|
---|
145 | #ifndef uint8
|
---|
146 | # define uint8 unsigned char
|
---|
147 | #endif
|
---|
148 |
|
---|
149 | #if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
|
---|
150 | # if (SIZEOF_SHORT == 4)
|
---|
151 | # define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
|
---|
152 | # else /* SIZEOF_SHORT != 4 */
|
---|
153 | # define int16 short
|
---|
154 | # endif /* SIZEOF_SHORT != 4 */
|
---|
155 | /* needed to work around compile issue on HP-UX 11.x */
|
---|
156 | # define _INT16 1
|
---|
157 | #endif
|
---|
158 |
|
---|
159 | /*
|
---|
160 | * Note we duplicate the size tests in the unsigned
|
---|
161 | * case as int16 may be a typedef from rpc/rpc.h
|
---|
162 | */
|
---|
163 |
|
---|
164 | #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
|
---|
165 | # if (SIZEOF_SHORT == 4)
|
---|
166 | # define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
|
---|
167 | # else /* SIZEOF_SHORT != 4 */
|
---|
168 | # define uint16 unsigned short
|
---|
169 | # endif /* SIZEOF_SHORT != 4 */
|
---|
170 | #endif
|
---|
171 |
|
---|
172 | #if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
|
---|
173 | # if (SIZEOF_INT == 4)
|
---|
174 | # define int32 int
|
---|
175 | # elif (SIZEOF_LONG == 4)
|
---|
176 | # define int32 long
|
---|
177 | # elif (SIZEOF_SHORT == 4)
|
---|
178 | # define int32 short
|
---|
179 | # else
|
---|
180 | /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
|
---|
181 | # define int32 int
|
---|
182 | # endif
|
---|
183 | /* needed to work around compile issue on HP-UX 11.x */
|
---|
184 | # define _INT32 1
|
---|
185 | #endif
|
---|
186 |
|
---|
187 | /*
|
---|
188 | * Note we duplicate the size tests in the unsigned
|
---|
189 | * case as int32 may be a typedef from rpc/rpc.h
|
---|
190 | */
|
---|
191 |
|
---|
192 | #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
|
---|
193 | # if (SIZEOF_INT == 4)
|
---|
194 | # define uint32 unsigned int
|
---|
195 | # elif (SIZEOF_LONG == 4)
|
---|
196 | # define uint32 unsigned long
|
---|
197 | # elif (SIZEOF_SHORT == 4)
|
---|
198 | # define uint32 unsigned short
|
---|
199 | # else
|
---|
200 | /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
|
---|
201 | # define uint32 unsigned
|
---|
202 | # endif
|
---|
203 | #endif
|
---|
204 |
|
---|
205 | /*
|
---|
206 | * check for 8 byte long long
|
---|
207 | */
|
---|
208 |
|
---|
209 | #if !defined(uint64)
|
---|
210 | # if (SIZEOF_LONG == 8)
|
---|
211 | # define uint64 unsigned long
|
---|
212 | # elif (SIZEOF_LONG_LONG == 8)
|
---|
213 | # define uint64 unsigned long long
|
---|
214 | # endif /* don't lie. If we don't have it, then don't use it */
|
---|
215 | #endif
|
---|
216 |
|
---|
217 | /* needed on Sun boxes */
|
---|
218 | #ifndef INADDR_NONE
|
---|
219 | #define INADDR_NONE 0xFFFFFFFF
|
---|
220 | #endif
|
---|
221 |
|
---|
222 | #include "dnserr.h"
|
---|
223 |
|
---|
224 |
|
---|
225 | #define DNS_TCP 1
|
---|
226 | #define DNS_UDP 2
|
---|
227 |
|
---|
228 | #define DNS_OPCODE_UPDATE 1
|
---|
229 |
|
---|
230 | /* DNS Class Types */
|
---|
231 |
|
---|
232 | #define DNS_CLASS_IN 1
|
---|
233 | #define DNS_CLASS_ANY 255
|
---|
234 | #define DNS_CLASS_NONE 254
|
---|
235 |
|
---|
236 | /* DNS RR Types */
|
---|
237 |
|
---|
238 | #define DNS_RR_A 1
|
---|
239 |
|
---|
240 | #define DNS_TCP_PORT 53
|
---|
241 | #define DNS_UDP_PORT 53
|
---|
242 |
|
---|
243 | #define QTYPE_A 1
|
---|
244 | #define QTYPE_NS 2
|
---|
245 | #define QTYPE_MD 3
|
---|
246 | #define QTYPE_CNAME 5
|
---|
247 | #define QTYPE_SOA 6
|
---|
248 | #define QTYPE_ANY 255
|
---|
249 | #define QTYPE_TKEY 249
|
---|
250 | #define QTYPE_TSIG 250
|
---|
251 |
|
---|
252 | /*
|
---|
253 | MF 4 a mail forwarder (Obsolete - use MX)
|
---|
254 | CNAME 5 the canonical name for an alias
|
---|
255 | SOA 6 marks the start of a zone of authority
|
---|
256 | MB 7 a mailbox domain name (EXPERIMENTAL)
|
---|
257 | MG 8 a mail group member (EXPERIMENTAL)
|
---|
258 | MR 9 a mail rename domain name (EXPERIMENTAL)
|
---|
259 | NULL 10 a null RR (EXPERIMENTAL)
|
---|
260 | WKS 11 a well known service description
|
---|
261 | PTR 12 a domain name pointer
|
---|
262 | HINFO 13 host information
|
---|
263 | MINFO 14 mailbox or mail list information
|
---|
264 | MX 15 mail exchange
|
---|
265 | TXT 16 text strings
|
---|
266 | */
|
---|
267 |
|
---|
268 | #define QR_QUERY 0x0000
|
---|
269 | #define QR_RESPONSE 0x0001
|
---|
270 |
|
---|
271 | #define OPCODE_QUERY 0x00
|
---|
272 | #define OPCODE_IQUERY 0x01
|
---|
273 | #define OPCODE_STATUS 0x02
|
---|
274 |
|
---|
275 | #define AA 1
|
---|
276 |
|
---|
277 | #define RECURSION_DESIRED 0x01
|
---|
278 |
|
---|
279 | #define RCODE_NOERROR 0
|
---|
280 | #define RCODE_FORMATERROR 1
|
---|
281 | #define RCODE_SERVER_FAILURE 2
|
---|
282 | #define RCODE_NAME_ERROR 3
|
---|
283 | #define RCODE_NOTIMPLEMENTED 4
|
---|
284 | #define RCODE_REFUSED 5
|
---|
285 |
|
---|
286 | #define SENDBUFFER_SIZE 65536
|
---|
287 | #define RECVBUFFER_SIZE 65536
|
---|
288 |
|
---|
289 | /*
|
---|
290 | * TKEY Modes from rfc2930
|
---|
291 | */
|
---|
292 |
|
---|
293 | #define DNS_TKEY_MODE_SERVER 1
|
---|
294 | #define DNS_TKEY_MODE_DH 2
|
---|
295 | #define DNS_TKEY_MODE_GSSAPI 3
|
---|
296 | #define DNS_TKEY_MODE_RESOLVER 4
|
---|
297 | #define DNS_TKEY_MODE_DELETE 5
|
---|
298 |
|
---|
299 |
|
---|
300 | #define DNS_ONE_DAY_IN_SECS 86400
|
---|
301 | #define DNS_TEN_HOURS_IN_SECS 36000
|
---|
302 |
|
---|
303 | #define SOCKET_ERROR -1
|
---|
304 | #define INVALID_SOCKET -1
|
---|
305 |
|
---|
306 | #define DNS_NO_ERROR 0
|
---|
307 | #define DNS_FORMAT_ERROR 1
|
---|
308 | #define DNS_SERVER_FAILURE 2
|
---|
309 | #define DNS_NAME_ERROR 3
|
---|
310 | #define DNS_NOT_IMPLEMENTED 4
|
---|
311 | #define DNS_REFUSED 5
|
---|
312 |
|
---|
313 | typedef long HANDLE;
|
---|
314 |
|
---|
315 | enum dns_ServerType { DNS_SRV_ANY, DNS_SRV_WIN2000, DNS_SRV_WIN2003 };
|
---|
316 |
|
---|
317 | struct dns_domain_label {
|
---|
318 | struct dns_domain_label *next;
|
---|
319 | char *label;
|
---|
320 | size_t len;
|
---|
321 | };
|
---|
322 |
|
---|
323 | struct dns_domain_name {
|
---|
324 | struct dns_domain_label *pLabelList;
|
---|
325 | };
|
---|
326 |
|
---|
327 | struct dns_question {
|
---|
328 | struct dns_domain_name *name;
|
---|
329 | uint16 q_type;
|
---|
330 | uint16 q_class;
|
---|
331 | };
|
---|
332 |
|
---|
333 | /*
|
---|
334 | * Before changing the definition of dns_zone, look
|
---|
335 | * dns_marshall_update_request(), we rely on this being the same as
|
---|
336 | * dns_question right now.
|
---|
337 | */
|
---|
338 |
|
---|
339 | struct dns_zone {
|
---|
340 | struct dns_domain_name *name;
|
---|
341 | uint16 z_type;
|
---|
342 | uint16 z_class;
|
---|
343 | };
|
---|
344 |
|
---|
345 | struct dns_rrec {
|
---|
346 | struct dns_domain_name *name;
|
---|
347 | uint16 type;
|
---|
348 | uint16 r_class;
|
---|
349 | uint32 ttl;
|
---|
350 | uint16 data_length;
|
---|
351 | uint8 *data;
|
---|
352 | };
|
---|
353 |
|
---|
354 | struct dns_tkey_record {
|
---|
355 | struct dns_domain_name *algorithm;
|
---|
356 | time_t inception;
|
---|
357 | time_t expiration;
|
---|
358 | uint16 mode;
|
---|
359 | uint16 error;
|
---|
360 | uint16 key_length;
|
---|
361 | uint8 *key;
|
---|
362 | };
|
---|
363 |
|
---|
364 | struct dns_request {
|
---|
365 | uint16 id;
|
---|
366 | uint16 flags;
|
---|
367 | uint16 num_questions;
|
---|
368 | uint16 num_answers;
|
---|
369 | uint16 num_auths;
|
---|
370 | uint16 num_additionals;
|
---|
371 | struct dns_question **questions;
|
---|
372 | struct dns_rrec **answers;
|
---|
373 | struct dns_rrec **auths;
|
---|
374 | struct dns_rrec **additionals;
|
---|
375 | };
|
---|
376 |
|
---|
377 | /*
|
---|
378 | * Before changing the definition of dns_update_request, look
|
---|
379 | * dns_marshall_update_request(), we rely on this being the same as
|
---|
380 | * dns_request right now.
|
---|
381 | */
|
---|
382 |
|
---|
383 | struct dns_update_request {
|
---|
384 | uint16 id;
|
---|
385 | uint16 flags;
|
---|
386 | uint16 num_zones;
|
---|
387 | uint16 num_preqs;
|
---|
388 | uint16 num_updates;
|
---|
389 | uint16 num_additionals;
|
---|
390 | struct dns_zone **zones;
|
---|
391 | struct dns_rrec **preqs;
|
---|
392 | struct dns_rrec **updates;
|
---|
393 | struct dns_rrec **additionals;
|
---|
394 | };
|
---|
395 |
|
---|
396 | struct dns_connection {
|
---|
397 | int32 hType;
|
---|
398 | int s;
|
---|
399 | struct sockaddr RecvAddr;
|
---|
400 | };
|
---|
401 |
|
---|
402 | struct dns_buffer {
|
---|
403 | uint8 *data;
|
---|
404 | size_t size;
|
---|
405 | size_t offset;
|
---|
406 | DNS_ERROR error;
|
---|
407 | };
|
---|
408 |
|
---|
409 | /* from dnsutils.c */
|
---|
410 |
|
---|
411 | DNS_ERROR dns_domain_name_from_string( TALLOC_CTX *mem_ctx,
|
---|
412 | const char *pszDomainName,
|
---|
413 | struct dns_domain_name **presult );
|
---|
414 | char *dns_generate_keyname( TALLOC_CTX *mem_ctx );
|
---|
415 |
|
---|
416 | /* from dnsrecord.c */
|
---|
417 |
|
---|
418 | DNS_ERROR dns_create_query( TALLOC_CTX *mem_ctx, const char *name,
|
---|
419 | uint16 q_type, uint16 q_class,
|
---|
420 | struct dns_request **preq );
|
---|
421 | DNS_ERROR dns_create_update( TALLOC_CTX *mem_ctx, const char *name,
|
---|
422 | struct dns_update_request **preq );
|
---|
423 | DNS_ERROR dns_create_probe(TALLOC_CTX *mem_ctx, const char *zone,
|
---|
424 | const char *host, int num_ips,
|
---|
425 | const struct sockaddr_storage *sslist,
|
---|
426 | struct dns_update_request **preq);
|
---|
427 | DNS_ERROR dns_create_rrec(TALLOC_CTX *mem_ctx, const char *name,
|
---|
428 | uint16 type, uint16 r_class, uint32 ttl,
|
---|
429 | uint16 data_length, uint8 *data,
|
---|
430 | struct dns_rrec **prec);
|
---|
431 | DNS_ERROR dns_add_rrec(TALLOC_CTX *mem_ctx, struct dns_rrec *rec,
|
---|
432 | uint16 *num_records, struct dns_rrec ***records);
|
---|
433 | DNS_ERROR dns_create_tkey_record(TALLOC_CTX *mem_ctx, const char *keyname,
|
---|
434 | const char *algorithm_name, time_t inception,
|
---|
435 | time_t expiration, uint16 mode, uint16 error,
|
---|
436 | uint16 key_length, const uint8 *key,
|
---|
437 | struct dns_rrec **prec);
|
---|
438 | DNS_ERROR dns_create_name_in_use_record(TALLOC_CTX *mem_ctx,
|
---|
439 | const char *name,
|
---|
440 | const struct sockaddr_storage *ip,
|
---|
441 | struct dns_rrec **prec);
|
---|
442 | DNS_ERROR dns_create_delete_record(TALLOC_CTX *mem_ctx, const char *name,
|
---|
443 | uint16 type, uint16 r_class,
|
---|
444 | struct dns_rrec **prec);
|
---|
445 | DNS_ERROR dns_create_name_not_in_use_record(TALLOC_CTX *mem_ctx,
|
---|
446 | const char *name, uint32 type,
|
---|
447 | struct dns_rrec **prec);
|
---|
448 | DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host,
|
---|
449 | uint32 ttl, const struct sockaddr_storage *pss,
|
---|
450 | struct dns_rrec **prec);
|
---|
451 | DNS_ERROR dns_unmarshall_tkey_record(TALLOC_CTX *mem_ctx, struct dns_rrec *rec,
|
---|
452 | struct dns_tkey_record **ptkey);
|
---|
453 | DNS_ERROR dns_create_tsig_record(TALLOC_CTX *mem_ctx, const char *keyname,
|
---|
454 | const char *algorithm_name,
|
---|
455 | time_t time_signed, uint16 fudge,
|
---|
456 | uint16 mac_length, const uint8 *mac,
|
---|
457 | uint16 original_id, uint16 error,
|
---|
458 | struct dns_rrec **prec);
|
---|
459 | DNS_ERROR dns_add_rrec(TALLOC_CTX *mem_ctx, struct dns_rrec *rec,
|
---|
460 | uint16 *num_records, struct dns_rrec ***records);
|
---|
461 | DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
|
---|
462 | const char *domainname,
|
---|
463 | const char *hostname,
|
---|
464 | const struct sockaddr_storage *ip_addr,
|
---|
465 | size_t num_adds,
|
---|
466 | struct dns_update_request **preq);
|
---|
467 |
|
---|
468 | /* from dnssock.c */
|
---|
469 |
|
---|
470 | DNS_ERROR dns_open_connection( const char *nameserver, int32 dwType,
|
---|
471 | TALLOC_CTX *mem_ctx,
|
---|
472 | struct dns_connection **conn );
|
---|
473 | DNS_ERROR dns_send(struct dns_connection *conn, const struct dns_buffer *buf);
|
---|
474 | DNS_ERROR dns_receive(TALLOC_CTX *mem_ctx, struct dns_connection *conn,
|
---|
475 | struct dns_buffer **presult);
|
---|
476 | DNS_ERROR dns_transaction(TALLOC_CTX *mem_ctx, struct dns_connection *conn,
|
---|
477 | const struct dns_request *req,
|
---|
478 | struct dns_request **resp);
|
---|
479 | DNS_ERROR dns_update_transaction(TALLOC_CTX *mem_ctx,
|
---|
480 | struct dns_connection *conn,
|
---|
481 | struct dns_update_request *up_req,
|
---|
482 | struct dns_update_request **up_resp);
|
---|
483 |
|
---|
484 | /* from dnsmarshall.c */
|
---|
485 |
|
---|
486 | struct dns_buffer *dns_create_buffer(TALLOC_CTX *mem_ctx);
|
---|
487 | void dns_marshall_buffer(struct dns_buffer *buf, const uint8 *data,
|
---|
488 | size_t len);
|
---|
489 | void dns_marshall_uint16(struct dns_buffer *buf, uint16 val);
|
---|
490 | void dns_marshall_uint32(struct dns_buffer *buf, uint32 val);
|
---|
491 | void dns_unmarshall_buffer(struct dns_buffer *buf, uint8 *data,
|
---|
492 | size_t len);
|
---|
493 | void dns_unmarshall_uint16(struct dns_buffer *buf, uint16 *val);
|
---|
494 | void dns_unmarshall_uint32(struct dns_buffer *buf, uint32 *val);
|
---|
495 | void dns_unmarshall_domain_name(TALLOC_CTX *mem_ctx,
|
---|
496 | struct dns_buffer *buf,
|
---|
497 | struct dns_domain_name **pname);
|
---|
498 | void dns_marshall_domain_name(struct dns_buffer *buf,
|
---|
499 | const struct dns_domain_name *name);
|
---|
500 | void dns_unmarshall_domain_name(TALLOC_CTX *mem_ctx,
|
---|
501 | struct dns_buffer *buf,
|
---|
502 | struct dns_domain_name **pname);
|
---|
503 | DNS_ERROR dns_marshall_request(TALLOC_CTX *mem_ctx,
|
---|
504 | const struct dns_request *req,
|
---|
505 | struct dns_buffer **pbuf);
|
---|
506 | DNS_ERROR dns_unmarshall_request(TALLOC_CTX *mem_ctx,
|
---|
507 | struct dns_buffer *buf,
|
---|
508 | struct dns_request **preq);
|
---|
509 | DNS_ERROR dns_marshall_update_request(TALLOC_CTX *mem_ctx,
|
---|
510 | struct dns_update_request *update,
|
---|
511 | struct dns_buffer **pbuf);
|
---|
512 | DNS_ERROR dns_unmarshall_update_request(TALLOC_CTX *mem_ctx,
|
---|
513 | struct dns_buffer *buf,
|
---|
514 | struct dns_update_request **pupreq);
|
---|
515 | struct dns_request *dns_update2request(struct dns_update_request *update);
|
---|
516 | struct dns_update_request *dns_request2update(struct dns_request *request);
|
---|
517 | uint16 dns_response_code(uint16 flags);
|
---|
518 |
|
---|
519 | /* from dnsgss.c */
|
---|
520 |
|
---|
521 | #ifdef HAVE_GSSAPI_SUPPORT
|
---|
522 |
|
---|
523 | void display_status( const char *msg, OM_uint32 maj_stat, OM_uint32 min_stat );
|
---|
524 | DNS_ERROR dns_negotiate_sec_ctx( const char *target_realm,
|
---|
525 | const char *servername,
|
---|
526 | const char *keyname,
|
---|
527 | gss_ctx_id_t *gss_ctx,
|
---|
528 | enum dns_ServerType srv_type );
|
---|
529 | DNS_ERROR dns_sign_update(struct dns_update_request *req,
|
---|
530 | gss_ctx_id_t gss_ctx,
|
---|
531 | const char *keyname,
|
---|
532 | const char *algorithmname,
|
---|
533 | time_t time_signed, uint16 fudge);
|
---|
534 |
|
---|
535 | #endif /* HAVE_GSSAPI_SUPPORT */
|
---|
536 |
|
---|
537 | #endif /* _DNS_H */
|
---|