reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
adig.c
Go to the documentation of this file.
1/* Copyright 1998 by the Massachusetts Institute of Technology.
2 *
3 * Permission to use, copy, modify, and distribute this
4 * software and its documentation for any purpose and without
5 * fee is hereby granted, provided that the above copyright
6 * notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting
8 * documentation, and that the name of M.I.T. not be used in
9 * advertising or publicity pertaining to distribution of the
10 * software without specific, written prior permission.
11 * M.I.T. makes no representations about the suitability of
12 * this software for any purpose. It is provided "as is"
13 * without express or implied warranty.
14 */
15
16#include <sys/types.h>
17
18#ifdef WIN32
19#include <winsock2.h>
20#include <stdlib.h>
21#include <io.h>
22#else
23#include <sys/time.h>
24#include <sys/socket.h>
25#include <netinet/in.h>
26#include <arpa/inet.h>
27#include "ares_nameser.h"
28#include <unistd.h>
29#include <netdb.h>
30#endif
31
32#include "rutil/ResipAssert.h"
33#include <stdio.h>
34#include <stdlib.h>
35#include <string.h>
36#include <ctype.h>
37
38#include <errno.h>
39
40#include "ares.h"
41#include "ares_dns.h"
42#include "ares_compat.h"
43
44#if defined(WIN32) || defined(__QNX__)
45#define strcasecmp(a,b) stricmp(a,b)
46#define strncasecmp(a,b,c) strnicmp(a,b,c)
47#endif
48
49
50#ifndef INADDR_NONE
51#define INADDR_NONE 0xffffffff
52#endif
53
54extern int optind;
55extern char *optarg;
56
57struct nv {
58 const char *name;
59 int value;
60};
61
62static const struct nv flags[] = {
63 { "usevc", ARES_FLAG_USEVC },
64 { "primary", ARES_FLAG_PRIMARY },
65 { "igntc", ARES_FLAG_IGNTC },
66 { "norecurse", ARES_FLAG_NORECURSE },
67 { "stayopen", ARES_FLAG_STAYOPEN },
68 { "noaliases", ARES_FLAG_NOALIASES }
69};
70static const int nflags = sizeof(flags) / sizeof(flags[0]);
71
72static const struct nv classes[] = {
73 { "IN", C_IN },
74 { "CHAOS", C_CHAOS },
75 { "HS", C_HS },
76 { "ANY", C_ANY }
77};
78static const int nclasses = sizeof(classes) / sizeof(classes[0]);
79
80static const struct nv types[] = {
81 { "A", T_A },
82 { "NS", T_NS },
83 { "MD", T_MD },
84 { "MF", T_MF },
85 { "CNAME", T_CNAME },
86 { "SOA", T_SOA },
87 { "MB", T_MB },
88 { "MG", T_MG },
89 { "MR", T_MR },
90 { "NULL", T_NULL },
91 { "WKS", T_WKS },
92 { "PTR", T_PTR },
93 { "HINFO", T_HINFO },
94 { "MINFO", T_MINFO },
95 { "MX", T_MX },
96 { "TXT", T_TXT },
97 { "RP", T_RP },
98 { "AFSDB", T_AFSDB },
99 { "X25", T_X25 },
100 { "ISDN", T_ISDN },
101 { "RT", T_RT },
102 { "NSAP", T_NSAP },
103 { "NSAP_PTR", T_NSAP_PTR },
104 { "SIG", T_SIG },
105 { "KEY", T_KEY },
106 { "PX", T_PX },
107 { "GPOS", T_GPOS },
108 { "AAAA", T_AAAA },
109 { "LOC", T_LOC },
110 { "SRV", T_SRV },
111 { "AXFR", T_AXFR },
112 { "MAILB", T_MAILB },
113 { "MAILA", T_MAILA },
114 { "NAPTR", T_NAPTR },
115 { "ANY", T_ANY }
116};
117static const int ntypes = sizeof(types) / sizeof(types[0]);
118
119static const char *opcodes[] = {
120 "QUERY", "IQUERY", "STATUS", "(reserved)", "NOTIFY",
121 "(unknown)", "(unknown)", "(unknown)", "(unknown)",
122 "UPDATEA", "UPDATED", "UPDATEDA", "UPDATEM", "UPDATEMA",
123 "ZONEINIT", "ZONEREF"
124};
125
126static const char *rcodes[] = {
127 "NOERROR", "FORMERR", "SERVFAIL", "NXDOMAIN", "NOTIMP", "REFUSED",
128 "(unknown)", "(unknown)", "(unknown)", "(unknown)", "(unknown)",
129 "(unknown)", "(unknown)", "(unknown)", "(unknown)", "NOCHANGE"
130};
131
132static void callback(void *arg, int status, unsigned char *abuf, int alen);
133static const unsigned char *display_question(const unsigned char *aptr,
134 const unsigned char *abuf,
135 int alen);
136static const unsigned char *display_rr(const unsigned char *aptr,
137 const unsigned char *abuf, int alen);
138static const char *type_name(int type);
139static const char *class_name(int dnsclass);
140static void usage(void);
141
142#ifdef WIN32
143struct option
144{
145 const char *name;
146 int has_arg;
147 int *flag;
148 int val;
149};
150
151char *optarg = 0;
152int optind = 0;
153
158int getopt(int argc,
159 char * argv[],
160 char *optstring )
161{
162 static int carg = 0;
163 //static int nextchar = 0;
164 char * p;
165
166 carg++;
167 if ( carg >= argc ) return -1;
168
169 p = argv[carg];
170 //register int al = strlen(argv[carg]);
171
172 if (*p == '-' && isalnum((unsigned char)*(p+1)))
173 {
174 char o = *(p+1);
175 int i,l;
176
177 l = (int)strlen(optstring);
178
179 for( i = 0 ; i < l; i++)
180 {
181
182 if (optstring[i] == ':') continue;
183
184 if ( optstring[i] == o ) // match option char
185 {
186
187 if ( optstring[i+1] == ':' ) // arg option
188 {
189 optind = ++carg;
190 optarg = argv[optind];
191
192 }
193 else
194 {
195 optind = 0;
196 optarg = 0;
197 }
198 return (int)o;
199 }
200
201 }
202
203 return (int)'?';
204 }
205 return (int)'?';
206}
207#endif
208
209int main(int argc, char **argv)
210{
211 ares_channel channel;
212 int c, i, optmask = ARES_OPT_FLAGS, dnsclass = C_IN, type = T_A;
213 int status, nfds, count;
214 struct ares_options options;
216 struct timeval *tvp, tv;
217
218#ifdef WIN32
221 int err;
222
224 if ( err != 0 )
225 {
226 // could not find a usable WinSock DLL
227 //cerr << "Could not load winsock" << endl;
228 resip_assert(0); // is this is failing, try a different version that 2.2, 1.0 or later will likely work
229 exit(1);
230 }
231
232 /* Confirm that the WinSock DLL supports 2.2.*/
233 /* Note that if the DLL supports versions greater */
234 /* than 2.2 in addition to 2.2, it will still return */
235 /* 2.2 in wVersion since that is the version we */
236 /* requested. */
237
238 if ( LOBYTE( wsaData.wVersion ) != 2 ||
239 HIBYTE( wsaData.wVersion ) != 2 )
240 {
241 /* Tell the user that we could not find a usable */
242 /* WinSock DLL. */
243 WSACleanup( );
244 //cerr << "Bad winsock verion" << endl;
245 resip_assert(0); // is this is failing, try a different version that 2.2, 1.0 or later will likely work
246 exit(1);
247 }
248#endif
249
251 options.servers = NULL;
252 options.nservers = 0;
253
254 while ((c = getopt(argc, argv, "f:s:c:t:T:U:")) != -1)
255 {
256 switch (c)
257 {
258 case 'f':
259 /* Add a flag. */
260 for (i = 0; i < nflags; i++)
261 {
262 if (strcmp(flags[i].name, optarg) == 0)
263 break;
264 }
265 if (i == nflags)
266 usage();
267 options.flags |= flags[i].value;
268 break;
269
270 case 's':
271 /* Add a server, and specify servers in the option mask. */
272 {
273 struct addrinfo hints = { 0 };
274 struct addrinfo* res = NULL;
275 hints.ai_family = AF_INET;
276 hints.ai_socktype = SOCK_STREAM;
277 if (getaddrinfo(optarg, NULL, &hints, &res) != 0 || res == NULL)
278 {
279 fprintf(stderr, "adig: server %s not found.\n", optarg);
280 return 1;
281 }
282 options.servers = realloc(options.servers, (options.nservers + 1)
283 * sizeof(struct in_addr));
284 if (!options.servers)
285 {
287 fprintf(stderr, "Out of memory!\n");
288 return 1;
289 }
290 memcpy(&options.servers[options.nservers],
291 &((struct sockaddr_in*)res->ai_addr)->sin_addr,
292 sizeof(struct in_addr));
294 options.nservers++;
296 }
297 break;
298
299 case 'c':
300 /* Set the query class. */
301 for (i = 0; i < nclasses; i++)
302 {
303 if (strcasecmp(classes[i].name, optarg) == 0)
304 break;
305 }
306 if (i == nclasses)
307 usage();
308 dnsclass = classes[i].value;
309 break;
310
311 case 't':
312 /* Set the query type. */
313 for (i = 0; i < ntypes; i++)
314 {
315 if (strcasecmp(types[i].name, optarg) == 0)
316 break;
317 }
318 if (i == ntypes)
319 usage();
320 type = types[i].value;
321 break;
322
323 case 'T':
324 /* Set the TCP port number. */
325 if (!isdigit((unsigned char)*optarg))
326 usage();
327 options.tcp_port = (unsigned short)strtol(optarg, NULL, 0);
329 break;
330
331 case 'U':
332 /* Set the UDP port number. */
333 if (!isdigit((unsigned char)*optarg))
334 usage();
335 options.udp_port = (unsigned short)strtol(optarg, NULL, 0);
337 break;
338 }
339 }
340 argc -= optind;
341 argv += optind;
342 if (argc == 0)
343 usage();
344
345 status = ares_init_options(&channel, &options, optmask);
346 if (status != ARES_SUCCESS)
347 {
348 fprintf(stderr, "ares_init_options: %s\n",
349 ares_strerror(status));
350 return 1;
351 }
352
353 /* Initiate the queries, one per command-line argument. If there is
354 * only one query to do, supply NULL as the callback argument;
355 * otherwise, supply the query name as an argument so we can
356 * distinguish responses for the user when printing them out.
357 */
358 if (argc == 1)
359 ares_query(channel, *argv, dnsclass, type, callback, (char *) NULL);
360 else
361 {
362 for (; *argv; argv++)
363 ares_query(channel, *argv, dnsclass, type, callback, *argv);
364 }
365
366 /* Wait for all queries to complete. */
367 while (1)
368 {
371 nfds = ares_fds(channel, &read_fds, &write_fds);
372 if (nfds == 0)
373 break;
374 tvp = ares_timeout(channel, NULL, &tv);
375 count = select(nfds, &read_fds, &write_fds, NULL, tvp);
376 if (count < 0 && errno != EINVAL)
377 {
378 perror("select");
379 return 1;
380 }
381 ares_process(channel, &read_fds, &write_fds);
382 }
383
384 ares_destroy(channel);
385 return 0;
386}
387
388static void callback(void *arg, int status, unsigned char *abuf, int alen)
389{
390 char *name = (char *) arg;
391 int id, qr, opcode, aa, tc, rd, ra, rcode, i;
392 unsigned int qdcount, ancount, nscount, arcount;
393 const unsigned char *aptr;
394
395 /* Display the query name if given. */
396 if (name)
397 printf("Answer for query %s:\n", name);
398
399 /* Display an error message if there was an error, but only stop if
400 * we actually didn't get an answer buffer.
401 */
402 if (status != ARES_SUCCESS)
403 {
404 printf("%s\n", ares_strerror(status));
405 if (!abuf)
406 return;
407 }
408
409 /* Won't happen, but check anyway, for safety. */
410 if (alen < HFIXEDSZ)
411 return;
412
413 /* Parse the answer header. */
414 id = DNS_HEADER_QID(abuf); /* query identification number */
415 qr = DNS_HEADER_QR(abuf); /* query response */
416 opcode = DNS_HEADER_OPCODE(abuf); /* opcode */
417 aa = DNS_HEADER_AA(abuf); /* authoritative answer */
418 tc = DNS_HEADER_TC(abuf); /* truncation */
419 rd = DNS_HEADER_RD(abuf); /* recursion desired */
420 ra = DNS_HEADER_RA(abuf); /* recursion available */
421 rcode = DNS_HEADER_RCODE(abuf); /* response code */
422 qdcount = DNS_HEADER_QDCOUNT(abuf); /* question count */
423 ancount = DNS_HEADER_ANCOUNT(abuf); /* answer record count */
424 nscount = DNS_HEADER_NSCOUNT(abuf); /* name server record count */
425 arcount = DNS_HEADER_ARCOUNT(abuf); /* additional record count */
426
427 /* Display the answer header. */
428 printf("id: %d\n", id);
429 printf("flags: %s%s%s%s%s\n",
430 qr ? "qr " : "",
431 aa ? "aa " : "",
432 tc ? "tc " : "",
433 rd ? "rd " : "",
434 ra ? "ra " : "");
435 printf("opcode: %s\n", opcodes[opcode]);
436 printf("rcode: %s\n", rcodes[rcode]);
437
438 /* Display the questions. */
439 printf("Questions:\n");
440 aptr = abuf + HFIXEDSZ;
441 for (i = 0; i < (int)qdcount; i++)
442 {
443 aptr = display_question(aptr, abuf, alen);
444 if (aptr == NULL)
445 return;
446 }
447
448 /* Display the answers. */
449 printf("Answers:\n");
450 for (i = 0; i < (int)ancount; i++)
451 {
452 aptr = display_rr(aptr, abuf, alen);
453 if (aptr == NULL)
454 return;
455 }
456
457 /* Display the NS records. */
458 printf("NS records:\n");
459 for (i = 0; i < (int)nscount; i++)
460 {
461 aptr = display_rr(aptr, abuf, alen);
462 if (aptr == NULL)
463 return;
464 }
465
466 /* Display the additional records. */
467 printf("Additional records:\n");
468 for (i = 0; i < (int)arcount; i++)
469 {
470 aptr = display_rr(aptr, abuf, alen);
471 if (aptr == NULL)
472 return;
473 }
474}
475
476static const unsigned char *display_question(const unsigned char *aptr,
477 const unsigned char *abuf,
478 int alen)
479{
480 char *name;
481 int type, dnsclass, status, len;
482
483 /* Parse the question name. */
484 status = ares_expand_name(aptr, abuf, alen, &name, &len);
485 if (status != ARES_SUCCESS)
486 return NULL;
487 aptr += len;
488
489 /* Make sure there's enough data after the name for the fixed part
490 * of the question.
491 */
492 if (aptr + QFIXEDSZ > abuf + alen)
493 {
494 free(name);
495 return NULL;
496 }
497
498 /* Parse the question type and class. */
499 type = DNS_QUESTION_TYPE(aptr);
500 dnsclass = DNS_QUESTION_CLASS(aptr);
501 aptr += QFIXEDSZ;
502
503 /* Display the question, in a format sort of similar to how we will
504 * display RRs.
505 */
506 printf("\t%-15s.\t", name);
507 if (dnsclass != C_IN)
508 printf("\t%s", class_name(dnsclass));
509 printf("\t%s\n", type_name(type));
510 free(name);
511 return aptr;
512}
513
514static const unsigned char *display_rr(const unsigned char *aptr,
515 const unsigned char *abuf, int alen)
516{
517 const unsigned char *p;
518 char *name;
519 int type, dnsclass, ttl, dlen, status, len;
520 struct in_addr addr;
521
522 /* Parse the RR name. */
523 status = ares_expand_name(aptr, abuf, alen, &name, &len);
524 if (status != ARES_SUCCESS)
525 return NULL;
526 aptr += len;
527
528 /* Make sure there is enough data after the RR name for the fixed
529 * part of the RR.
530 */
531 if (aptr + RRFIXEDSZ > abuf + alen)
532 {
533 free(name);
534 return NULL;
535 }
536
537 /* Parse the fixed part of the RR, and advance to the RR data
538 * field. */
539 type = DNS_RR_TYPE(aptr);
540 dnsclass = DNS_RR_CLASS(aptr);
541 ttl = DNS_RR_TTL(aptr);
543 aptr += RRFIXEDSZ;
544 if (aptr + dlen > abuf + alen)
545 {
546 free(name);
547 return NULL;
548 }
549
550 /* Display the RR name, class, and type. */
551 printf("\t%-15s.\t%d", name, ttl);
552 if (dnsclass != C_IN)
553 printf("\t%s", class_name(dnsclass));
554 printf("\t%s", type_name(type));
555 free(name);
556
557 /* Display the RR data. Don't touch aptr. */
558 switch (type)
559 {
560 case T_CNAME:
561 case T_MB:
562 case T_MD:
563 case T_MF:
564 case T_MG:
565 case T_MR:
566 case T_NS:
567 case T_PTR:
568 /* For these types, the RR data is just a domain name. */
569 status = ares_expand_name(aptr, abuf, alen, &name, &len);
570 if (status != ARES_SUCCESS)
571 return NULL;
572 printf("\t%s.", name);
573 free(name);
574 break;
575
576 case T_HINFO:
577 /* The RR data is two length-counted character strings. */
578 p = aptr;
579 len = *p;
580 if (p + len + 1 > aptr + dlen)
581 return NULL;
582 printf("\t%.*s", len, p + 1);
583 p += len + 1;
584 len = *p;
585 if (p + len + 1 > aptr + dlen)
586 return NULL;
587 printf("\t%.*s", len, p + 1);
588 break;
589
590 case T_MINFO:
591 /* The RR data is two domain names. */
592 p = aptr;
593 status = ares_expand_name(p, abuf, alen, &name, &len);
594 if (status != ARES_SUCCESS)
595 return NULL;
596 printf("\t%s.", name);
597 free(name);
598 p += len;
599 status = ares_expand_name(p, abuf, alen, &name, &len);
600 if (status != ARES_SUCCESS)
601 return NULL;
602 printf("\t%s.", name);
603 free(name);
604 break;
605
606 case T_MX:
607 /* The RR data is two bytes giving a preference ordering, and
608 * then a domain name.
609 */
610 if (dlen < 2)
611 return NULL;
612 printf("\t%d", (aptr[0] << 8) | aptr[1]);
613 status = ares_expand_name(aptr + 2, abuf, alen, &name, &len);
614 if (status != ARES_SUCCESS)
615 return NULL;
616 printf("\t%s.", name);
617 free(name);
618 break;
619
620 case T_SOA:
621 /* The RR data is two domain names and then five four-byte
622 * numbers giving the serial number and some timeouts.
623 */
624 p = aptr;
625 status = ares_expand_name(p, abuf, alen, &name, &len);
626 if (status != ARES_SUCCESS)
627 return NULL;
628 printf("\t%s.\n", name);
629 free(name);
630 p += len;
631 status = ares_expand_name(p, abuf, alen, &name, &len);
632 if (status != ARES_SUCCESS)
633 return NULL;
634 printf("\t\t\t\t\t\t%s.\n", name);
635 free(name);
636 p += len;
637 if (p + 20 > aptr + dlen)
638 return NULL;
639 printf("\t\t\t\t\t\t( %d %d %d %d %d )",
640 (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3],
641 (p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7],
642 (p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11],
643 (p[12] << 24) | (p[13] << 16) | (p[14] << 8) | p[15],
644 (p[16] << 24) | (p[17] << 16) | (p[18] << 8) | p[19]);
645 break;
646
647 case T_TXT:
648 /* The RR data is one or more length-counted character
649 * strings. */
650 p = aptr;
651 while (p < aptr + dlen)
652 {
653 len = *p;
654 if (p + len + 1 > aptr + dlen)
655 return NULL;
656 printf("\t%.*s", len, p + 1);
657 p += len + 1;
658 }
659 break;
660
661 case T_A:
662 /* The RR data is a four-byte Internet address. */
663 if (dlen != 4)
664 return NULL;
666 memcpy(&addr, aptr, sizeof(struct in_addr));
667 inet_ntop(AF_INET, &addr, addrBuf, sizeof(addrBuf));
668 printf("\t%s", addrBuf);
669 break;
670
671 case T_WKS:
672 /* Not implemented yet */
673 break;
674
675 case T_SRV:
676 /* The RR data is three two-byte numbers representing the
677 * priority, weight, and port, followed by a domain name.
678 */
679
680 printf("\t%d", DNS__16BIT(aptr));
681 printf(" %d", DNS__16BIT(aptr + 2));
682 printf(" %d", DNS__16BIT(aptr + 4));
683
684 status = ares_expand_name(aptr + 6, abuf, alen, &name, &len);
685 if (status != ARES_SUCCESS)
686 return NULL;
687 printf("\t%s.", name);
688 free(name);
689 break;
690
691 case T_NAPTR:
692 /* The RR data is two two-byte numbers representing the
693 * order and preference, followed by three character strings
694 * representing flags, services, a regex, and a domain name.
695 */
696
697 printf("\t%d", DNS__16BIT(aptr));
698 printf(" %d", DNS__16BIT(aptr + 2));
699
700 p = aptr + 4;
701 len = *p;
702 if (p + len + 1 > aptr + dlen)
703 return NULL;
704 printf(" %.*s", len, p + 1);
705 p += len + 1;
706 len = *p;
707 if (p + len + 1 > aptr + dlen)
708 return NULL;
709 printf(" %.*s", len, p + 1);
710 p += len + 1;
711 len = *p;
712 if (p + len + 1 > aptr + dlen)
713 return NULL;
714 printf(" %.*s", len, p + 1);
715 p += len + 1;
716 status = ares_expand_name(p, abuf, alen, &name, &len);
717 if (status != ARES_SUCCESS)
718 return NULL;
719 printf("\t%s.", name);
720 free(name);
721 break;
722
723 default:
724 printf("\t[Unknown RR; cannot parse]");
725 }
726 printf("\n");
727
728 return aptr + dlen;
729}
730
731static const char *type_name(int type)
732{
733 int i;
734
735 for (i = 0; i < ntypes; i++)
736 {
737 if (types[i].value == type)
738 return types[i].name;
739 }
740 return "(unknown)";
741}
742
743static const char *class_name(int dnsclass)
744{
745 int i;
746
747 for (i = 0; i < nclasses; i++)
748 {
749 if (classes[i].value == dnsclass)
750 return classes[i].name;
751 }
752 return "(unknown)";
753}
754
755static void usage(void)
756{
757 fprintf(stderr, "usage: adig [-f flag] [-s server] [-c class] "
758 "[-t type] [-p port] name ...\n");
759 exit(1);
760}
#define resip_assert(x)
This file needs to work for both C and C++ code.
static const char * rcodes[]
Definition adig.c:126
static const struct nv flags[]
Definition adig.c:62
static const char * class_name(int dnsclass)
Definition adig.c:743
int main(int argc, char **argv)
Definition adig.c:209
static const char * type_name(int type)
Definition adig.c:731
static const int nclasses
Definition adig.c:78
static const struct nv types[]
Definition adig.c:80
static void callback(void *arg, int status, unsigned char *abuf, int alen)
Definition adig.c:388
static const unsigned char * display_rr(const unsigned char *aptr, const unsigned char *abuf, int alen)
Definition adig.c:514
static const int ntypes
Definition adig.c:117
static const int nflags
Definition adig.c:70
static const unsigned char * display_question(const unsigned char *aptr, const unsigned char *abuf, int alen)
Definition adig.c:476
static const char * opcodes[]
Definition adig.c:119
int optind
static void usage(void)
Definition adig.c:755
char * optarg
static const struct nv classes[]
Definition adig.c:72
#define ARES_SUCCESS
Definition ares.h:79
#define ARES_FLAG_NOALIASES
Definition ares.h:108
#define ARES_FLAG_IGNTC
Definition ares.h:104
#define DNS_RR_LEN(r)
Definition ares.h:53
#define ARES_FLAG_PRIMARY
Definition ares.h:103
#define ARES_OPT_UDP_PORT
Definition ares.h:117
struct timeval * ares_timeout(ares_channel channel, struct timeval *maxtv, struct timeval *tv)
void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
const char * ares_strerror(int code)
#define DNS_HEADER_QDCOUNT(h)
Definition ares.h:48
#define ARES_OPT_SERVERS
Definition ares.h:119
void ares_destroy(ares_channel channel)
#define DNS_HEADER_NSCOUNT(h)
Definition ares.h:50
#define DNS_HEADER_ANCOUNT(h)
Definition ares.h:49
#define ARES_OPT_TCP_PORT
Definition ares.h:118
#define ARES_FLAG_NOCHECKRESP
Definition ares.h:109
#define DNS_HEADER_ARCOUNT(h)
Definition ares.h:51
#define DNS_RR_TTL(r)
Definition ares.h:54
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, int alen, char **s, long *enclen)
#define ARES_FLAG_NORECURSE
Definition ares.h:105
#define ARES_FLAG_STAYOPEN
Definition ares.h:106
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
Definition ares_fds.c:22
#define ARES_FLAG_USEVC
Definition ares.h:102
#define ARES_OPT_FLAGS
Definition ares.h:113
void ares_query(ares_channel channel, const char *name, int dnsclass, int type, ares_callback callback, void *arg)
Definition ares_query.c:38
int ares_init_options(ares_channel *channelptr, struct ares_options *options, int optmask)
Definition ares_init.c:114
#define DNS_RR_TYPE(r)
Definition ares.h:52
#define DNS__16BIT(p)
Definition ares.h:45
#define DNS_RR_CLASS(r)
Definition ares_dns.h:69
#define DNS_QUESTION_CLASS(q)
Definition ares_dns.h:61
#define DNS_HEADER_AA(h)
Definition ares_dns.h:33
#define DNS_HEADER_QR(h)
Definition ares_dns.h:31
#define DNS_QUESTION_TYPE(q)
Definition ares_dns.h:60
#define DNS_HEADER_TC(h)
Definition ares_dns.h:34
#define DNS_HEADER_RD(h)
Definition ares_dns.h:35
#define DNS_HEADER_QID(h)
Definition ares_dns.h:30
#define DNS_HEADER_OPCODE(h)
Definition ares_dns.h:32
#define DNS_HEADER_RCODE(h)
Definition ares_dns.h:38
#define DNS_HEADER_RA(h)
Definition ares_dns.h:36
#define T_X25
#define C_ANY
#define T_NS
#define T_HINFO
#define C_HS
#define T_MAILA
#define C_CHAOS
#define QFIXEDSZ
#define T_PTR
#define T_AFSDB
#define C_IN
#define T_MX
#define T_CNAME
#define T_MR
#define T_MF
#define T_LOC
#define T_AXFR
#define T_SIG
#define T_KEY
#define T_TXT
#define T_NSAP_PTR
#define T_RP
#define T_NSAP
#define T_WKS
#define T_MINFO
#define T_SOA
#define T_ANY
#define T_MB
#define T_RT
#define T_PX
#define T_GPOS
#define HFIXEDSZ
#define T_ISDN
#define T_MAILB
#define T_MG
#define RRFIXEDSZ
#define T_NULL
#define T_MD
#define T_NAPTR
Definition compat.hxx:140
#define T_A
Definition compat.hxx:152
#define T_AAAA
Definition compat.hxx:148
#define T_SRV
Definition compat.hxx:144
Definition adig.c:57
int value
Definition adig.c:59
const char * name
Definition adig.c:58
void list()
Definition userAdmin.cxx:66