ReactOS 0.4.15-dev-7711-g5627da4
types.c
Go to the documentation of this file.
1/*
2 * types.c
3 * - RR-type-specific code, and the machinery to call it
4 */
5/*
6 * This file is
7 * Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk>
8 *
9 * It is part of adns, which is
10 * Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
11 * Copyright (C) 1999-2000 Tony Finch <dot@dotat.at>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software Foundation,
25 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 */
27
28#ifdef ADNS_JGAA_WIN32
29# include "adns_win32.h"
30#else
31# include <stdlib.h>
32# include <sys/types.h>
33# include <sys/socket.h>
34# include <netinet/in.h>
35# include <arpa/inet.h>
36#endif
37
38#include "internal.h"
39
40#define R_NOMEM return adns_s_nomemory
41#define CSP_ADDSTR(s) do { if (!adns__vbuf_appendstr(vb,(s))) R_NOMEM; } while (0)
42
43/*
44 * order of sections:
45 *
46 * _string (pap)
47 * _textdata, _qstring (csp)
48 * _str (mf,cs)
49 * _intstr (mf,csp,cs)
50 * _manyistr (mf,cs)
51 * _txt (pa)
52 * _inaddr (pa,dip,di)
53 * _addr (pa,di,csp,cs)
54 * _domain (pap)
55 * _host_raw (pa)
56 * _hostaddr (pap,pa,dip,di,mfp,mf,csp,cs +pap_findaddrs)
57 * _mx_raw (pa,di)
58 * _mx (pa,di)
59 * _inthostaddr (mf,cs)
60 * _ptr (pa)
61 * _strpair (mf,cs)
62 * _intstrpair (mf,cs)
63 * _hinfo (pa)
64 * _mailbox (pap +pap_mailbox822)
65 * _rp (pa)
66 * _soa (pa,mf,cs)
67 * _flat (mf)
68 *
69 * within each section:
70 * pap_*
71 * pa_*
72 * dip_*
73 * di_*
74 * mfp_*
75 * mf_*
76 * csp_*
77 * cs_*
78 */
79
80/*
81 * _qstring (pap,csp)
82 */
83
84static adns_status pap_qstring(const parseinfo *pai, int *cbyte_io, int max,
85 int *len_r, char **str_r) {
86 /* Neither len_r nor str_r may be null.
87 * End of datagram (overrun) is indicated by returning adns_s_invaliddata;
88 */
89 const byte *dgram= pai->dgram;
90 int l, cbyte;
91 char *str;
92
93 cbyte= *cbyte_io;
94
95 if (cbyte >= max) return adns_s_invaliddata;
96 GET_B(cbyte,l);
97 if (cbyte+l > max) return adns_s_invaliddata;
98
99 str= adns__alloc_interim(pai->qu, (size_t)l+1);
100 if (!str) R_NOMEM;
101
102 str[l]= 0;
103 memcpy(str,dgram+cbyte,(size_t)l);
104
105 *len_r= l;
106 *str_r= str;
107 *cbyte_io= cbyte+l;
108
109 return adns_s_ok;
110}
111
112static adns_status csp_qstring(vbuf *vb, const char *dp, int len) {
113 unsigned char ch;
114 char buf[10];
115 int cn;
116
117 CSP_ADDSTR("\"");
118 for (cn=0; cn<len; cn++) {
119 ch= *dp++;
120 if (ch == '\\') {
121 CSP_ADDSTR("\\\\");
122 } else if (ch == '"') {
123 CSP_ADDSTR("\\\"");
124 } else if (ch >= 32 && ch <= 126) {
125 if (!adns__vbuf_append(vb,&ch,1)) R_NOMEM;
126 } else {
127 sprintf(buf,"\\x%02x",ch);
129 }
130 }
131 CSP_ADDSTR("\"");
132
133 return adns_s_ok;
134}
135
136/*
137 * _str (mf)
138 */
139
140static void mf_str(adns_query qu, void *datap) {
141 char **rrp= datap;
142
143 adns__makefinal_str(qu,rrp);
144}
145
146/*
147 * _intstr (mf)
148 */
149
150static void mf_intstr(adns_query qu, void *datap) {
151 adns_rr_intstr *rrp= datap;
152
153 adns__makefinal_str(qu,&rrp->str);
154}
155
156/*
157 * _manyistr (mf)
158 */
159
160static void mf_manyistr(adns_query qu, void *datap) {
161 adns_rr_intstr **rrp= datap;
162 adns_rr_intstr *te, *table;
163 void *tablev;
164 int tc;
165
166 for (tc=0, te= *rrp; te->i >= 0; te++, tc++);
167 tablev= *rrp;
168 adns__makefinal_block(qu,&tablev,sizeof(*te)*(tc+1));
169 *rrp= table= tablev;
170 for (te= *rrp; te->i >= 0; te++)
171 adns__makefinal_str(qu,&te->str);
172}
173
174/*
175 * _txt (pa,cs)
176 */
177
178static adns_status pa_txt(const parseinfo *pai, int cbyte, int max, void *datap) {
179 adns_rr_intstr **rrp= datap, *table, *te;
180 const byte *dgram= pai->dgram;
181 int ti, tc, l, startbyte;
182 adns_status st;
183
184 startbyte= cbyte;
185 if (cbyte >= max) return adns_s_invaliddata;
186 tc= 0;
187 while (cbyte < max) {
188 GET_B(cbyte,l);
189 cbyte+= l;
190 tc++;
191 }
192 if (cbyte != max || !tc) return adns_s_invaliddata;
193
194 table= adns__alloc_interim(pai->qu,sizeof(*table)*(tc+1));
195 if (!table) R_NOMEM;
196
197 for (cbyte=startbyte, ti=0, te=table; ti<tc; ti++, te++) {
198 st= pap_qstring(pai, &cbyte, max, &te->i, &te->str);
199 if (st) return st;
200 }
201 assert(cbyte == max);
202
203 te->i= -1;
204 te->str= 0;
205
206 *rrp= table;
207 return adns_s_ok;
208}
209
210static adns_status cs_txt(vbuf *vb, const void *datap) {
211 const adns_rr_intstr *const *rrp= datap;
212 const adns_rr_intstr *current;
213 adns_status st;
214 int spc;
215
216 for (current= *rrp, spc=0; current->i >= 0; current++, spc=1) {
217 if (spc) CSP_ADDSTR(" ");
218 st= csp_qstring(vb,current->str,current->i); if (st) return st;
219 }
220 return adns_s_ok;
221}
222
223/*
224 * _hinfo (cs)
225 */
226
227static adns_status cs_hinfo(vbuf *vb, const void *datap) {
228 const adns_rr_intstrpair *rrp= datap;
229 adns_status st;
230
231 st= csp_qstring(vb,rrp->array[0].str,rrp->array[0].i); if (st) return st;
232 CSP_ADDSTR(" ");
233 st= csp_qstring(vb,rrp->array[1].str,rrp->array[1].i); if (st) return st;
234 return adns_s_ok;
235}
236
237/*
238 * _inaddr (pa,dip,di)
239 */
240
241static adns_status pa_inaddr(const parseinfo *pai, int cbyte, int max, void *datap) {
242 struct in_addr *storeto= datap;
243
244 if (max-cbyte != 4) return adns_s_invaliddata;
245 memcpy(storeto, pai->dgram + cbyte, 4);
246 return adns_s_ok;
247}
248
249static int search_sortlist(adns_state ads, struct in_addr ad) {
250 const struct sortlist *slp;
251 int i;
252
253 for (i=0, slp=ads->sortlist;
254 i<ads->nsortlist && !((ad.s_addr & slp->mask.s_addr) == slp->base.s_addr);
255 i++, slp++);
256 return i;
257}
258
259static int dip_inaddr(adns_state ads, struct in_addr a, struct in_addr b) {
260 int ai, bi;
261
262 if (!ads->nsortlist) return 0;
263
264 ai= search_sortlist(ads,a);
265 bi= search_sortlist(ads,b);
266 return bi<ai;
267}
268
269static int di_inaddr(adns_state ads, const void *datap_a, const void *datap_b) {
270 const struct in_addr *ap= datap_a, *bp= datap_b;
271
272 return dip_inaddr(ads,*ap,*bp);
273}
274
275static adns_status cs_inaddr(vbuf *vb, const void *datap) {
276 const struct in_addr *rrp= datap, rr= *rrp;
277 const char *ia;
278
279 ia= inet_ntoa(rr); assert(ia);
280 CSP_ADDSTR(ia);
281 return adns_s_ok;
282}
283
284/*
285 * _addr (pa,di,csp,cs)
286 */
287
288static adns_status pa_addr(const parseinfo *pai, int cbyte, int max, void *datap) {
289 adns_rr_addr *storeto= datap;
290 const byte *dgram= pai->dgram;
291
292 if (max-cbyte != 4) return adns_s_invaliddata;
293 storeto->len= sizeof(storeto->addr.inet);
294 memset(&storeto->addr,0,sizeof(storeto->addr.inet));
295 storeto->addr.inet.sin_family= AF_INET;
296 memcpy(&storeto->addr.inet.sin_addr,dgram+cbyte,4);
297 return adns_s_ok;
298}
299
300static int di_addr(adns_state ads, const void *datap_a, const void *datap_b) {
301 const adns_rr_addr *ap= datap_a, *bp= datap_b;
302
303 assert(ap->addr.sa.sa_family == AF_INET);
304 return dip_inaddr(ads, ap->addr.inet.sin_addr, bp->addr.inet.sin_addr);
305}
306
307static int div_addr(void *context, const void *datap_a, const void *datap_b) {
308 const adns_state ads= context;
309
310 return di_addr(ads, datap_a, datap_b);
311}
312
313static adns_status csp_addr(vbuf *vb, const adns_rr_addr *rrp) {
314 const char *ia;
315 static char buf[30];
316
317 switch (rrp->addr.inet.sin_family) {
318 case AF_INET:
319 CSP_ADDSTR("INET ");
320 ia= inet_ntoa(rrp->addr.inet.sin_addr); assert(ia);
321 CSP_ADDSTR(ia);
322 break;
323 default:
324 sprintf(buf,"AF=%u",rrp->addr.sa.sa_family);
326 break;
327 }
328 return adns_s_ok;
329}
330
331static adns_status cs_addr(vbuf *vb, const void *datap) {
332 const adns_rr_addr *rrp= datap;
333
334 return csp_addr(vb,rrp);
335}
336
337/*
338 * _domain (pap,csp,cs)
339 * _dom_raw (pa)
340 */
341
342static adns_status pap_domain(const parseinfo *pai, int *cbyte_io, int max,
343 char **domain_r, parsedomain_flags flags) {
344 adns_status st;
345 char *dm;
346
347 st= adns__parse_domain(pai->qu->ads, pai->serv, pai->qu, &pai->qu->vb, flags,
348 pai->dgram,pai->dglen, cbyte_io, max);
349 if (st) return st;
350 if (!pai->qu->vb.used) return adns_s_invaliddata;
351
352 dm= adns__alloc_interim(pai->qu, (size_t) pai->qu->vb.used+1);
353 if (!dm) R_NOMEM;
354
355 dm[pai->qu->vb.used]= 0;
356 memcpy(dm,pai->qu->vb.buf, (size_t) pai->qu->vb.used);
357
358 *domain_r= dm;
359 return adns_s_ok;
360}
361
362static adns_status csp_domain(vbuf *vb, const char *domain) {
364 if (!*domain) CSP_ADDSTR(".");
365 return adns_s_ok;
366}
367
368static adns_status cs_domain(vbuf *vb, const void *datap) {
369 const char *const *domainp= datap;
370 return csp_domain(vb,*domainp);
371}
372
373static adns_status pa_dom_raw(const parseinfo *pai, int cbyte, int max, void *datap) {
374 char **rrp= datap;
375 adns_status st;
376
377 st= pap_domain(pai, &cbyte, max, rrp, pdf_quoteok);
378 if (st) return st;
379
380 if (cbyte != max) return adns_s_invaliddata;
381 return adns_s_ok;
382}
383
384/*
385 * _host_raw (pa)
386 */
387
388static adns_status pa_host_raw(const parseinfo *pai, int cbyte, int max, void *datap) {
389 char **rrp= datap;
390 adns_status st;
391
392 st= pap_domain(pai, &cbyte, max, rrp,
394 if (st) return st;
395
396 if (cbyte != max) return adns_s_invaliddata;
397 return adns_s_ok;
398}
399
400/*
401 * _hostaddr (pap,pa,dip,di,mfp,mf,csp,cs +icb_hostaddr, pap_findaddrs)
402 */
403
405 int *cbyte_io, int count, int dmstart) {
406 int rri, naddrs;
407 int type, class, rdlen, rdstart, ownermatched;
408 unsigned long ttl;
409 adns_status st;
410
411 for (rri=0, naddrs=-1; rri<count; rri++) {
412 st= adns__findrr_anychk(pai->qu, pai->serv, pai->dgram, pai->dglen, cbyte_io,
413 &type, &class, &ttl, &rdlen, &rdstart,
414 pai->dgram, pai->dglen, dmstart, &ownermatched);
415 if (st) return st;
416 if (!ownermatched || class != DNS_CLASS_IN || type != adns_r_a) {
417 if (naddrs>0) break; else continue;
418 }
419 if (naddrs == -1) {
420 naddrs= 0;
421 }
422 if (!adns__vbuf_ensure(&pai->qu->vb, (int) ((naddrs+1)*sizeof(adns_rr_addr)))) R_NOMEM;
423 adns__update_expires(pai->qu,ttl,pai->now);
424 st= pa_addr(pai, rdstart,rdstart+rdlen,
425 pai->qu->vb.buf + naddrs*sizeof(adns_rr_addr));
426 if (st) return st;
427 naddrs++;
428 }
429 if (naddrs >= 0) {
430 ha->addrs= adns__alloc_interim(pai->qu, naddrs*sizeof(adns_rr_addr));
431 if (!ha->addrs) R_NOMEM;
432 memcpy(ha->addrs, pai->qu->vb.buf, naddrs*sizeof(adns_rr_addr));
433 ha->naddrs= naddrs;
434 ha->astatus= adns_s_ok;
435
436 adns__isort(ha->addrs, naddrs, sizeof(adns_rr_addr), pai->qu->vb.buf,
437 div_addr, pai->ads);
438 }
439 return adns_s_ok;
440}
441
443 adns_answer *cans= child->answer;
444 adns_rr_hostaddr *rrp= child->ctx.info.hostaddr;
445 adns_state ads= parent->ads;
446 adns_status st;
447
448 st= cans->status;
449 rrp->astatus= st;
450 rrp->naddrs= (st>0 && st<=adns_s_max_tempfail) ? -1 : cans->nrrs;
451 rrp->addrs= cans->rrs.addr;
453
454 if (parent->children.head) {
455 LIST_LINK_TAIL(ads->childw,parent);
456 } else {
458 }
459}
460
461static adns_status pap_hostaddr(const parseinfo *pai, int *cbyte_io,
462 int max, adns_rr_hostaddr *rrp) {
463 adns_status st;
464 int dmstart, cbyte;
466 int id;
467 adns_query nqu;
468 adns_queryflags nflags;
469
470 dmstart= cbyte= *cbyte_io;
471 st= pap_domain(pai, &cbyte, max, &rrp->host,
473 if (st) return st;
474 *cbyte_io= cbyte;
475
476 rrp->astatus= adns_s_ok;
477 rrp->naddrs= -1;
478 rrp->addrs= 0;
479
480 cbyte= pai->nsstart;
481
482 st= pap_findaddrs(pai, rrp, &cbyte, pai->nscount, dmstart);
483 if (st) return st;
484 if (rrp->naddrs != -1) return adns_s_ok;
485
486 st= pap_findaddrs(pai, rrp, &cbyte, pai->arcount, dmstart);
487 if (st) return st;
488 if (rrp->naddrs != -1) return adns_s_ok;
489
490 st= adns__mkquery_frdgram(pai->ads, &pai->qu->vb, &id,
491 pai->dgram, pai->dglen, dmstart,
493 if (st) return st;
494
495 ctx.ext= 0;
496 ctx.callback= icb_hostaddr;
497 ctx.info.hostaddr= rrp;
498
499 nflags= adns_qf_quoteok_query;
500 if (!(pai->qu->flags & adns_qf_cname_loose)) nflags |= adns_qf_cname_forbid;
501
503 &pai->qu->vb, id, nflags, pai->now, &ctx);
504 if (st) return st;
505
506 nqu->parent= pai->qu;
507 LIST_LINK_TAIL_PART(pai->qu->children,nqu,siblings.);
508
509 return adns_s_ok;
510}
511
512static adns_status pa_hostaddr(const parseinfo *pai, int cbyte, int max, void *datap) {
513 adns_rr_hostaddr *rrp= datap;
514 adns_status st;
515
516 st= pap_hostaddr(pai, &cbyte, max, rrp);
517 if (st) return st;
518 if (cbyte != max) return adns_s_invaliddata;
519
520 return adns_s_ok;
521}
522
524 if (ap->astatus != bp->astatus) return ap->astatus;
525 if (ap->astatus) return 0;
526
527 assert(ap->addrs[0].addr.sa.sa_family == AF_INET);
528 assert(bp->addrs[0].addr.sa.sa_family == AF_INET);
529 return dip_inaddr(ads,
530 ap->addrs[0].addr.inet.sin_addr,
531 bp->addrs[0].addr.inet.sin_addr);
532}
533
534static int di_hostaddr(adns_state ads, const void *datap_a, const void *datap_b) {
535 const adns_rr_hostaddr *ap= datap_a, *bp= datap_b;
536
537 return dip_hostaddr(ads, ap,bp);
538}
539
541 void *tablev;
542
543 adns__makefinal_str(qu,&rrp->host);
544 tablev= rrp->addrs;
545 adns__makefinal_block(qu, &tablev, rrp->naddrs*sizeof(*rrp->addrs));
546 rrp->addrs= tablev;
547}
548
549static void mf_hostaddr(adns_query qu, void *datap) {
550 adns_rr_hostaddr *rrp= datap;
551
552 mfp_hostaddr(qu,rrp);
553}
554
556 const char *errstr;
557 adns_status st;
558 char buf[20];
559 int i;
560
561 st= csp_domain(vb,rrp->host); if (st) return st;
562
563 CSP_ADDSTR(" ");
565
566 sprintf(buf," %d ",rrp->astatus);
568
570 CSP_ADDSTR(" ");
571
573 st= csp_qstring(vb,errstr,(int)strlen(errstr)); if (st) return st;
574
575 if (rrp->naddrs >= 0) {
576 CSP_ADDSTR(" (");
577 for (i=0; i<rrp->naddrs; i++) {
578 CSP_ADDSTR(" ");
579 st= csp_addr(vb,&rrp->addrs[i]);
580 }
581 CSP_ADDSTR(" )");
582 } else {
583 CSP_ADDSTR(" ?");
584 }
585 return adns_s_ok;
586}
587
588static adns_status cs_hostaddr(vbuf *vb, const void *datap) {
589 const adns_rr_hostaddr *rrp= datap;
590
591 return csp_hostaddr(vb,rrp);
592}
593
594/*
595 * _mx_raw (pa,di)
596 */
597
598static adns_status pa_mx_raw(const parseinfo *pai, int cbyte, int max, void *datap) {
599 const byte *dgram= pai->dgram;
600 adns_rr_intstr *rrp= datap;
601 adns_status st;
602 int pref;
603
604 if (cbyte+2 > max) return adns_s_invaliddata;
605 GET_W(cbyte,pref);
606 rrp->i= pref;
607 st= pap_domain(pai, &cbyte, max, &rrp->str,
609 if (st) return st;
610
611 if (cbyte != max) return adns_s_invaliddata;
612 return adns_s_ok;
613}
614
615static int di_mx_raw(adns_state ads, const void *datap_a, const void *datap_b) {
616 const adns_rr_intstr *ap= datap_a, *bp= datap_b;
617
618 if (ap->i < bp->i) return 0;
619 if (ap->i > bp->i) return 1;
620 return 0;
621}
622
623/*
624 * _mx (pa,di)
625 */
626
627static adns_status pa_mx(const parseinfo *pai, int cbyte, int max, void *datap) {
628 const byte *dgram= pai->dgram;
629 adns_rr_inthostaddr *rrp= datap;
630 adns_status st;
631 int pref;
632
633 if (cbyte+2 > max) return adns_s_invaliddata;
634 GET_W(cbyte,pref);
635 rrp->i= pref;
636 st= pap_hostaddr(pai, &cbyte, max, &rrp->ha);
637 if (st) return st;
638
639 if (cbyte != max) return adns_s_invaliddata;
640 return adns_s_ok;
641}
642
643static int di_mx(adns_state ads, const void *datap_a, const void *datap_b) {
644 const adns_rr_inthostaddr *ap= datap_a, *bp= datap_b;
645
646 if (ap->i < bp->i) return 0;
647 if (ap->i > bp->i) return 1;
648 return dip_hostaddr(ads, &ap->ha, &bp->ha);
649}
650
651/*
652 * _inthostaddr (mf,cs)
653 */
654
655static void mf_inthostaddr(adns_query qu, void *datap) {
656 adns_rr_inthostaddr *rrp= datap;
657
658 mfp_hostaddr(qu,&rrp->ha);
659}
660
661static adns_status cs_inthostaddr(vbuf *vb, const void *datap) {
662 const adns_rr_inthostaddr *rrp= datap;
663 char buf[10];
664
665 sprintf(buf,"%u ",rrp->i);
667
668 return csp_hostaddr(vb,&rrp->ha);
669}
670
671/*
672 * _inthost (cs)
673 */
674
675static adns_status cs_inthost(vbuf *vb, const void *datap) {
676 const adns_rr_intstr *rrp= datap;
677 char buf[10];
678
679 sprintf(buf,"%u ",rrp->i);
681 return csp_domain(vb,rrp->str);
682}
683
684/*
685 * _ptr (pa, +icb_ptr)
686 */
687
689 adns_answer *cans= child->answer;
690 const adns_rr_addr *queried, *found;
691 adns_state ads= parent->ads;
692 int i;
693
694 if (cans->status == adns_s_nxdomain || cans->status == adns_s_nodata) {
696 return;
697 } else if (cans->status) {
699 return;
700 }
701
702 queried= &parent->ctx.info.ptr_parent_addr;
703 for (i=0, found=cans->rrs.addr; i<cans->nrrs; i++, found++) {
704 if (queried->len == found->len &&
705 !memcmp(&queried->addr,&found->addr,(size_t) queried->len)) {
706 if (!parent->children.head) {
708 return;
709 } else {
710 LIST_LINK_TAIL(ads->childw,parent);
711 return;
712 }
713 }
714 }
715
717}
718
719static adns_status pa_ptr(const parseinfo *pai, int dmstart, int max, void *datap) {
720 static const char *(expectdomain[])= { DNS_INADDR_ARPA };
721
722 char **rrp= datap;
723 adns_status st;
726 char *ep;
727 byte ipv[4];
728 char labbuf[4];
729 int cbyte, i, lablen, labstart, l, id;
730 adns_query nqu;
732
733 cbyte= dmstart;
734 st= pap_domain(pai, &cbyte, max, rrp,
736 if (st) return st;
737 if (cbyte != max) return adns_s_invaliddata;
738
739 ap= &pai->qu->ctx.info.ptr_parent_addr;
740 if (!ap->len) {
741 adns__findlabel_start(&fls, pai->ads, -1, pai->qu,
742 pai->qu->query_dgram, pai->qu->query_dglen,
743 pai->qu->query_dglen, DNS_HDRSIZE, 0);
744 for (i=0; i<4; i++) {
745 st= adns__findlabel_next(&fls,&lablen,&labstart); assert(!st);
746 if (lablen<=0 || lablen>3) return adns_s_querydomainwrong;
747 memcpy(labbuf, pai->qu->query_dgram + labstart, (size_t) lablen); labbuf[lablen]= 0;
748 ipv[3-i]= (unsigned char)strtoul(labbuf,&ep,10); if (*ep) return adns_s_querydomainwrong;
749 if (lablen>1 && pai->qu->query_dgram[labstart]=='0')
751 }
752 for (i=0; i<(int)sizeof(expectdomain)/(int)sizeof(*expectdomain); i++) {
753 st= adns__findlabel_next(&fls,&lablen,&labstart); assert(!st);
754 l= strlen(expectdomain[i]);
755 if (lablen != l || memcmp(pai->qu->query_dgram + labstart, expectdomain[i], (size_t)l))
757 }
758 st= adns__findlabel_next(&fls,&lablen,0); assert(!st);
759 if (lablen) return adns_s_querydomainwrong;
760
761 ap->len= sizeof(struct sockaddr_in);
762 memset(&ap->addr,0,sizeof(ap->addr.inet));
763 ap->addr.inet.sin_family= AF_INET;
764 ap->addr.inet.sin_addr.s_addr=
765 htonl((u_long)(ipv[0]<<24) | (ipv[1]<<16) | (ipv[2]<<8) | (ipv[3]));
766 }
767
768 st= adns__mkquery_frdgram(pai->ads, &pai->qu->vb, &id,
769 pai->dgram, pai->dglen, dmstart,
771 if (st) return st;
772
773 ctx.ext= 0;
774 ctx.callback= icb_ptr;
775 memset(&ctx.info,0,(size_t) sizeof(ctx.info));
777 &pai->qu->vb, id,
779 if (st) return st;
780
781 nqu->parent= pai->qu;
782 LIST_LINK_TAIL_PART(pai->qu->children,nqu,siblings.);
783 return adns_s_ok;
784}
785
786/*
787 * _strpair (mf)
788 */
789
790static void mf_strpair(adns_query qu, void *datap) {
791 adns_rr_strpair *rrp= datap;
792
793 adns__makefinal_str(qu,&rrp->array[0]);
794 adns__makefinal_str(qu,&rrp->array[1]);
795}
796
797/*
798 * _intstrpair (mf)
799 */
800
801static void mf_intstrpair(adns_query qu, void *datap) {
802 adns_rr_intstrpair *rrp= datap;
803
804 adns__makefinal_str(qu,&rrp->array[0].str);
805 adns__makefinal_str(qu,&rrp->array[1].str);
806}
807
808/*
809 * _hinfo (pa)
810 */
811
812static adns_status pa_hinfo(const parseinfo *pai, int cbyte, int max, void *datap) {
813 adns_rr_intstrpair *rrp= datap;
814 adns_status st;
815 int i;
816
817 for (i=0; i<2; i++) {
818 st= pap_qstring(pai, &cbyte, max, &rrp->array[i].i, &rrp->array[i].str);
819 if (st) return st;
820 }
821
822 if (cbyte != max) return adns_s_invaliddata;
823
824 return adns_s_ok;
825}
826
827/*
828 * _mailbox (pap,cs)
829 */
830
831static adns_status pap_mailbox822(const parseinfo *pai, int *cbyte_io, int max,
832 char **mb_r) {
833 int lablen, labstart, i, needquote, c, r, neednorm;
834 const unsigned char *p;
835 char *str;
837 adns_status st;
838 vbuf *vb;
839
840 vb= &pai->qu->vb;
841 vb->used= 0;
843 -1, pai->qu,
844 pai->dgram, pai->dglen, max,
845 *cbyte_io, cbyte_io);
846 st= adns__findlabel_next(&fls,&lablen,&labstart);
847 if (!lablen) {
848 adns__vbuf_appendstr(vb,".");
849 goto x_ok;
850 }
851
852 neednorm= 1;
853 for (i=0, needquote=0, p= pai->dgram+labstart; i<lablen; i++) {
854 c= *p++;
855 if ((c&~128) < 32 || (c&~128) == 127) return adns_s_invaliddata;
856 if (c == '.' && !neednorm) neednorm= 1;
857 else if (c==' ' || c>=127 || ctype_822special(c)) needquote++;
858 else neednorm= 0;
859 }
860
861 if (needquote || neednorm) {
862 r= adns__vbuf_ensure(vb, lablen+needquote+4); if (!r) R_NOMEM;
863 adns__vbuf_appendq(vb,(byte*)"\"",1);
864 for (i=0, needquote=0, p= pai->dgram+labstart; i<lablen; i++, p++) {
865 c= *p;
866 if (c == '"' || c=='\\') adns__vbuf_appendq(vb,(byte*)"\\",1);
867 adns__vbuf_appendq(vb,p,1);
868 }
869 adns__vbuf_appendq(vb,(byte*)"\"",1);
870 } else {
871 r= adns__vbuf_append(vb, pai->dgram+labstart, lablen); if (!r) R_NOMEM;
872 }
873
874 r= adns__vbuf_appendstr(vb,"@"); if (!r) R_NOMEM;
875
876 st= adns__parse_domain_more(&fls,pai->ads, pai->qu,vb,0, pai->dgram);
877 if (st) return st;
878
879 x_ok:
880 str= adns__alloc_interim(pai->qu, (size_t) vb->used+1); if (!str) R_NOMEM;
881 memcpy(str,vb->buf,(size_t) vb->used);
882 str[vb->used]= 0;
883 *mb_r= str;
884 return adns_s_ok;
885}
886
887static adns_status pap_mailbox(const parseinfo *pai, int *cbyte_io, int max,
888 char **mb_r) {
889 if (pai->qu->typei->type & adns__qtf_mail822) {
890 return pap_mailbox822(pai, cbyte_io, max, mb_r);
891 } else {
892 return pap_domain(pai, cbyte_io, max, mb_r, pdf_quoteok);
893 }
894}
895
896static adns_status csp_mailbox(vbuf *vb, const char *mailbox) {
897 return csp_domain(vb,mailbox);
898}
899
900/*
901 * _rp (pa,cs)
902 */
903
904static adns_status pa_rp(const parseinfo *pai, int cbyte, int max, void *datap) {
905 adns_rr_strpair *rrp= datap;
906 adns_status st;
907
908 st= pap_mailbox(pai, &cbyte, max, &rrp->array[0]);
909 if (st) return st;
910
911 st= pap_domain(pai, &cbyte, max, &rrp->array[1], pdf_quoteok);
912 if (st) return st;
913
914 if (cbyte != max) return adns_s_invaliddata;
915 return adns_s_ok;
916}
917
918static adns_status cs_rp(vbuf *vb, const void *datap) {
919 const adns_rr_strpair *rrp= datap;
920 adns_status st;
921
922 st= csp_mailbox(vb,rrp->array[0]); if (st) return st;
923 CSP_ADDSTR(" ");
924 st= csp_domain(vb,rrp->array[1]); if (st) return st;
925
926 return adns_s_ok;
927}
928
929/*
930 * _soa (pa,mf,cs)
931 */
932
933static adns_status pa_soa(const parseinfo *pai, int cbyte, int max, void *datap) {
934 adns_rr_soa *rrp= datap;
935 const byte *dgram= pai->dgram;
936 adns_status st;
937 int msw, lsw, i;
938
939 st= pap_domain(pai, &cbyte, max, &rrp->mname,
941 if (st) return st;
942
943 st= pap_mailbox(pai, &cbyte, max, &rrp->rname);
944 if (st) return st;
945
946 if (cbyte+20 != max) return adns_s_invaliddata;
947
948 for (i=0; i<5; i++) {
949 GET_W(cbyte,msw);
950 GET_W(cbyte,lsw);
951 (&rrp->serial)[i]= (msw<<16) | lsw;
952 }
953
954 return adns_s_ok;
955}
956
957static void mf_soa(adns_query qu, void *datap) {
958 adns_rr_soa *rrp= datap;
959
960 adns__makefinal_str(qu,&rrp->mname);
961 adns__makefinal_str(qu,&rrp->rname);
962}
963
964static adns_status cs_soa(vbuf *vb, const void *datap) {
965 const adns_rr_soa *rrp= datap;
966 char buf[20];
967 int i;
968 adns_status st;
969
970 st= csp_domain(vb,rrp->mname); if (st) return st;
971 CSP_ADDSTR(" ");
972 st= csp_mailbox(vb,rrp->rname); if (st) return st;
973
974 for (i=0; i<5; i++) {
975 sprintf(buf," %lu",(&rrp->serial)[i]);
977 }
978
979 return adns_s_ok;
980}
981
982/*
983 * _flat (mf)
984 */
985
986static void mf_flat(adns_query qu, void *data) { }
987
988/*
989 * Now the table.
990 */
991
992#define TYPESZ_M(member) (sizeof(*((adns_answer*)0)->rrs.member))
993
994#define DEEP_MEMB(memb) TYPESZ_M(memb), mf_##memb, cs_##memb
995#define FLAT_MEMB(memb) TYPESZ_M(memb), mf_flat, cs_##memb
996
997#define DEEP_TYPE(code,rrt,fmt,memb,parser,comparer,printer) \
998 { adns_r_##code, rrt, fmt, TYPESZ_M(memb), mf_##memb, printer, parser, comparer }
999#define FLAT_TYPE(code,rrt,fmt,memb,parser,comparer,printer) \
1000 { adns_r_##code, rrt, fmt, TYPESZ_M(memb), mf_flat, printer, parser, comparer }
1001
1002static const typeinfo typeinfos[] = {
1003/* Must be in ascending order of rrtype ! */
1004/* mem-mgmt code rrt fmt member parser comparer printer */
1005
1006FLAT_TYPE(a, "A", 0, inaddr, pa_inaddr, di_inaddr, cs_inaddr ),
1007DEEP_TYPE(ns_raw, "NS", "raw", str, pa_host_raw,0, cs_domain ),
1008DEEP_TYPE(cname, "CNAME", 0, str, pa_dom_raw, 0, cs_domain ),
1009DEEP_TYPE(soa_raw,"SOA", "raw", soa, pa_soa, 0, cs_soa ),
1010DEEP_TYPE(ptr_raw,"PTR", "raw", str, pa_host_raw,0, cs_domain ),
1011DEEP_TYPE(hinfo, "HINFO", 0, intstrpair, pa_hinfo, 0, cs_hinfo ),
1012DEEP_TYPE(mx_raw, "MX", "raw", intstr, pa_mx_raw, di_mx_raw, cs_inthost ),
1013DEEP_TYPE(txt, "TXT", 0, manyistr, pa_txt, 0, cs_txt ),
1014DEEP_TYPE(rp_raw, "RP", "raw", strpair, pa_rp, 0, cs_rp ),
1015
1016FLAT_TYPE(addr, "A", "addr", addr, pa_addr, di_addr, cs_addr ),
1017DEEP_TYPE(ns, "NS", "+addr", hostaddr, pa_hostaddr,di_hostaddr,cs_hostaddr ),
1018DEEP_TYPE(ptr, "PTR","checked",str, pa_ptr, 0, cs_domain ),
1019DEEP_TYPE(mx, "MX", "+addr", inthostaddr,pa_mx, di_mx, cs_inthostaddr),
1020
1021DEEP_TYPE(soa, "SOA","822", soa, pa_soa, 0, cs_soa ),
1022DEEP_TYPE(rp, "RP", "822", strpair, pa_rp, 0, cs_rp ),
1023};
1024
1026 const typeinfo *begin, *end, *mid;
1027
1028 begin= typeinfos; end= typeinfos+(sizeof(typeinfos)/sizeof(typeinfo));
1029
1030 while (begin < end) {
1031 mid= begin + ((end-begin)>>1);
1032 if (mid->type == type) return mid;
1033 if (type > mid->type) begin= mid+1;
1034 else end= mid;
1035 }
1036 return 0;
1037}
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
adns_state ads
Definition: adh-query.c:35
adns_rrtype
Definition: adns.h:113
@ adns_r_addr
Definition: adns.h:143
@ adns__qtf_mail822
Definition: adns.h:116
@ adns_r_a
Definition: adns.h:120
ADNS_API const char * adns_errtypeabbrev(adns_status st)
Definition: general.c:311
ADNS_API const char * adns_strerror(adns_status st)
Definition: general.c:268
adns_status
Definition: adns.h:215
@ adns_s_invaliddata
Definition: adns.h:248
@ adns_s_ok
Definition: adns.h:216
@ adns_s_querydomainwrong
Definition: adns.h:253
@ adns_s_nodata
Definition: adns.h:261
@ adns_s_max_tempfail
Definition: adns.h:241
@ adns_s_inconsistent
Definition: adns.h:244
@ adns_s_nxdomain
Definition: adns.h:260
ADNS_API const char * adns_errabbrev(adns_status st)
Definition: general.c:275
adns_queryflags
Definition: adns.h:100
@ adns_qf_quoteok_query
Definition: adns.h:104
@ adns_qf_quoteok_anshost
Definition: adns.h:106
@ adns_qf_cname_forbid
Definition: adns.h:109
@ adns_qf_cname_loose
Definition: adns.h:108
static int cbyte
Definition: adnsresfilter.c:73
static int fls(int x)
Definition: bitops.h:157
r l[0]
Definition: byte_order.h:168
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned char
Definition: typeof.h:29
#define assert(x)
Definition: debug.h:53
r parent
Definition: btrfs.c:3010
unsigned long u_long
Definition: linux.h:269
#define AF_INET
Definition: tcpip.h:117
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const GLfloat * tc
Definition: glext.h:8925
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLenum const GLvoid * addr
Definition: glext.h:9621
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint id
Definition: glext.h:5910
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define inet_ntoa(addr)
Definition: inet.h:100
#define c
Definition: ke_i.h:80
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct task_struct * current
Definition: linux.c:32
#define htonl(x)
Definition: module.h:214
static PVOID ptr
Definition: dispmode.c:27
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static BYTE cn[]
Definition: cert.c:2938
static HWND child
Definition: cursoricon.c:298
const WCHAR * str
#define LIST_LINK_TAIL_PART(list, node, part)
Definition: dlist.h:42
#define LIST_LINK_TAIL(list, node)
Definition: dlist.h:51
int adns__vbuf_append(vbuf *vb, const byte *data, int len)
Definition: general.c:131
void adns__vbuf_appendq(vbuf *vb, const byte *data, int len)
Definition: general.c:126
int adns__vbuf_ensure(vbuf *vb, int want)
Definition: general.c:116
void adns__isort(void *array, int nobjs, int sz, void *tempbuf, int(*needswap)(void *context, const void *a, const void *b), void *context)
Definition: general.c:319
int adns__vbuf_appendstr(vbuf *vb, const char *data)
Definition: general.c:149
void adns__transfer_interim(adns_query from, adns_query to, void *block, size_t sz)
Definition: query.c:366
adns_status adns__findrr_anychk(adns_query qu, int serv, const byte *dgram, int dglen, int *cbyte_io, int *type_r, int *class_r, unsigned long *ttl_r, int *rdlen_r, int *rdstart_r, const byte *eo_dgram, int eo_dglen, int eo_cbyte, int *eo_matched_r)
Definition: parse.c:163
adns_status adns__parse_domain_more(findlabel_state *fls, adns_state ads, adns_query qu, vbuf *vb, parsedomain_flags flags, const byte *dgram)
Definition: parse.c:127
static int ctype_822special(int c)
Definition: internal.h:702
#define DNS_HDRSIZE
Definition: internal.h:76
adns_status adns__internal_submit(adns_state ads, adns_query *query_r, const typeinfo *typei, vbuf *qumsg_vb, int id, adns_queryflags flags, struct timeval now, const qcontext *ctx)
Definition: query.c:111
void * adns__alloc_interim(adns_query qu, size_t sz)
Definition: query.c:342
void adns__query_fail(adns_query qu, adns_status stat)
Definition: query.c:547
#define DNS_INADDR_ARPA
Definition: internal.h:80
adns_status adns__parse_domain(adns_state ads, int serv, adns_query qu, vbuf *vb, adns_queryflags flags, const byte *dgram, int dglen, int *cbyte_io, int max)
Definition: parse.c:117
#define GET_B(cb, tv)
Definition: internal.h:716
#define DNS_CLASS_IN
Definition: internal.h:78
adns_status adns__findlabel_next(findlabel_state *fls, int *lablen_r, int *labstart_r)
Definition: parse.c:74
void adns__findlabel_start(findlabel_state *fls, adns_state ads, int serv, adns_query qu, const byte *dgram, int dglen, int max, int dmbegin, int *dmend_rlater)
Definition: parse.c:59
adns_status adns__mkquery_frdgram(adns_state ads, vbuf *vb, int *id_r, const byte *qd_dgram, int qd_dglen, int qd_begin, adns_rrtype type, adns_queryflags flags)
Definition: transmit.c:138
void adns__makefinal_str(adns_query qu, char **strp)
Definition: query.c:553
void adns__makefinal_block(adns_query qu, void **blpp, size_t sz)
Definition: query.c:565
void adns__update_expires(adns_query qu, unsigned long ttl, struct timeval now)
Definition: query.c:458
parsedomain_flags
Definition: internal.h:577
@ pdf_quoteok
Definition: internal.h:578
#define GET_W(cb, tv)
Definition: internal.h:717
void adns__query_done(adns_query qu)
Definition: query.c:503
#define memset(x, y, z)
Definition: compat.h:39
adns_query parent
Definition: internal.h:184
byte * query_dgram
Definition: internal.h:192
const typeinfo * typei
Definition: internal.h:191
struct adns__query::@4224 children
int query_dglen
Definition: internal.h:193
adns_state ads
Definition: internal.h:182
qcontext ctx
Definition: internal.h:233
struct adns__state::sortlist sortlist[MAXSORTLIST]
int nsortlist
Definition: internal.h:300
int nrrs
Definition: adns.h:316
adns_rr_addr * addr
Definition: adns.h:322
union adns_answer::@4221 rrs
adns_status status
Definition: adns.h:311
union adns_rr_addr::@4220 addr
int len
Definition: adns.h:268
struct sockaddr_in inet
Definition: adns.h:271
struct sockaddr sa
Definition: adns.h:270
adns_rr_addr * addrs
Definition: adns.h:279
char * host
Definition: adns.h:276
adns_status astatus
Definition: adns.h:277
adns_rr_hostaddr ha
Definition: adns.h:288
char * str
Definition: adns.h:298
adns_rr_intstr array[2]
Definition: adns.h:302
unsigned long serial
Definition: adns.h:307
char * rname
Definition: adns.h:306
char * mname
Definition: adns.h:306
char * array[2]
Definition: adns.h:283
Definition: http.c:7252
Definition: cookie.c:42
Definition: tcpip.h:126
u32_t s_addr
Definition: inet.h:45
Definition: mxnamespace.c:45
int serv
Definition: internal.h:118
const byte * dgram
Definition: internal.h:119
int nsstart
Definition: internal.h:120
adns_state ads
Definition: internal.h:116
int nscount
Definition: internal.h:120
struct timeval now
Definition: internal.h:121
adns_query qu
Definition: internal.h:117
int arcount
Definition: internal.h:120
int dglen
Definition: internal.h:120
union qcontext::@4222 info
adns_rr_addr ptr_parent_addr
Definition: internal.h:176
adns_rrtype type
Definition: internal.h:125
Definition: internal.h:110
int used
Definition: internal.h:111
byte * buf
Definition: internal.h:112
#define max(a, b)
Definition: svc.c:63
static adns_status pa_txt(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:178
static int dip_inaddr(adns_state ads, struct in_addr a, struct in_addr b)
Definition: types.c:259
const typeinfo * adns__findtype(adns_rrtype type)
Definition: types.c:1025
static adns_status pap_qstring(const parseinfo *pai, int *cbyte_io, int max, int *len_r, char **str_r)
Definition: types.c:84
static adns_status csp_qstring(vbuf *vb, const char *dp, int len)
Definition: types.c:112
static adns_status cs_inaddr(vbuf *vb, const void *datap)
Definition: types.c:275
static void icb_hostaddr(adns_query parent, adns_query child)
Definition: types.c:442
static int dip_hostaddr(adns_state ads, const adns_rr_hostaddr *ap, const adns_rr_hostaddr *bp)
Definition: types.c:523
static void mf_strpair(adns_query qu, void *datap)
Definition: types.c:790
#define FLAT_TYPE(code, rrt, fmt, memb, parser, comparer, printer)
Definition: types.c:999
static adns_status pap_mailbox(const parseinfo *pai, int *cbyte_io, int max, char **mb_r)
Definition: types.c:887
static adns_status cs_addr(vbuf *vb, const void *datap)
Definition: types.c:331
static void mf_manyistr(adns_query qu, void *datap)
Definition: types.c:160
static adns_status pap_domain(const parseinfo *pai, int *cbyte_io, int max, char **domain_r, parsedomain_flags flags)
Definition: types.c:342
static adns_status cs_inthost(vbuf *vb, const void *datap)
Definition: types.c:675
static adns_status pa_mx_raw(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:598
static adns_status pa_rp(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:904
static adns_status csp_addr(vbuf *vb, const adns_rr_addr *rrp)
Definition: types.c:313
static void mf_flat(adns_query qu, void *data)
Definition: types.c:986
#define CSP_ADDSTR(s)
Definition: types.c:41
static adns_status pa_host_raw(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:388
static void mf_soa(adns_query qu, void *datap)
Definition: types.c:957
static int div_addr(void *context, const void *datap_a, const void *datap_b)
Definition: types.c:307
static adns_status pa_mx(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:627
static adns_status pa_ptr(const parseinfo *pai, int dmstart, int max, void *datap)
Definition: types.c:719
static adns_status cs_domain(vbuf *vb, const void *datap)
Definition: types.c:368
static int di_inaddr(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:269
static adns_status csp_domain(vbuf *vb, const char *domain)
Definition: types.c:362
static adns_status pap_hostaddr(const parseinfo *pai, int *cbyte_io, int max, adns_rr_hostaddr *rrp)
Definition: types.c:461
static int di_mx_raw(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:615
static adns_status pa_hinfo(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:812
static const typeinfo typeinfos[]
Definition: types.c:1002
static int search_sortlist(adns_state ads, struct in_addr ad)
Definition: types.c:249
static adns_status pap_mailbox822(const parseinfo *pai, int *cbyte_io, int max, char **mb_r)
Definition: types.c:831
static adns_status pap_findaddrs(const parseinfo *pai, adns_rr_hostaddr *ha, int *cbyte_io, int count, int dmstart)
Definition: types.c:404
static adns_status pa_hostaddr(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:512
static adns_status cs_txt(vbuf *vb, const void *datap)
Definition: types.c:210
static adns_status csp_hostaddr(vbuf *vb, const adns_rr_hostaddr *rrp)
Definition: types.c:555
static int di_mx(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:643
static adns_status cs_hostaddr(vbuf *vb, const void *datap)
Definition: types.c:588
static adns_status cs_rp(vbuf *vb, const void *datap)
Definition: types.c:918
static void icb_ptr(adns_query parent, adns_query child)
Definition: types.c:688
static void mf_inthostaddr(adns_query qu, void *datap)
Definition: types.c:655
static adns_status csp_mailbox(vbuf *vb, const char *mailbox)
Definition: types.c:896
static void mf_intstr(adns_query qu, void *datap)
Definition: types.c:150
static void mf_intstrpair(adns_query qu, void *datap)
Definition: types.c:801
static adns_status pa_addr(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:288
static void mf_str(adns_query qu, void *datap)
Definition: types.c:140
#define R_NOMEM
Definition: types.c:40
static int di_hostaddr(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:534
static adns_status pa_dom_raw(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:373
#define DEEP_TYPE(code, rrt, fmt, memb, parser, comparer, printer)
Definition: types.c:997
static adns_status cs_hinfo(vbuf *vb, const void *datap)
Definition: types.c:227
static void mf_hostaddr(adns_query qu, void *datap)
Definition: types.c:549
static int di_addr(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:300
static adns_status cs_inthostaddr(vbuf *vb, const void *datap)
Definition: types.c:661
static adns_status pa_soa(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:933
static adns_status pa_inaddr(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:241
static adns_status cs_soa(vbuf *vb, const void *datap)
Definition: types.c:964
static void mfp_hostaddr(adns_query qu, adns_rr_hostaddr *rrp)
Definition: types.c:540
const char * errstr(int errcode)
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
static clock_t begin
Definition: xmllint.c:458