ReactOS  0.4.13-dev-249-gcba1a2f
query.c
Go to the documentation of this file.
1 /*
2  * query.c
3  * - overall query management (allocation, completion)
4  * - per-query memory management
5  * - query submission and cancellation (user-visible and internal)
6  */
7 /*
8  * This file is
9  * Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
10  *
11  * It is part of adns, which is
12  * Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
13  * Copyright (C) 1999-2000 Tony Finch <dot@dotat.at>
14  *
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 2, or (at your option)
18  * any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software Foundation,
27  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28  */
29 
30 #ifdef ADNS_JGAA_WIN32
31 # include "adns_win32.h"
32 #else
33 # include <stdlib.h>
34 # include <unistd.h>
35 # include <errno.h>
36 # include <sys/time.h>
37 #endif
38 
39 #include "internal.h"
40 
42  adns_queryflags flags, struct timeval now) {
43  /* Allocate a virgin query and return it. */
44  adns_query qu;
45 
46  qu= malloc(sizeof(*qu)); if (!qu) return 0;
47  qu->answer= malloc(sizeof(*qu->answer)); if (!qu->answer) { free(qu); return 0; }
48 
49  qu->ads= ads;
50  qu->state= query_tosend;
51  qu->back= qu->next= qu->parent= 0;
52  LIST_INIT(qu->children);
53  LINK_INIT(qu->siblings);
55  qu->interim_allocd= 0;
56  qu->preserved_allocd= 0;
57  qu->final_allocspace= 0;
58 
59  qu->typei= typei;
60  qu->query_dgram= 0;
61  qu->query_dglen= 0;
62  adns__vbuf_init(&qu->vb);
63 
64  qu->cname_dgram= 0;
65  qu->cname_dglen= qu->cname_begin= 0;
66 
68  qu->search_origlen= qu->search_pos= qu->search_doneabs= 0;
69 
70  qu->id= -2; /* will be overwritten with real id before we leave adns */
71  qu->flags= flags;
72  qu->retries= 0;
73  qu->udpnextserver= 0;
74  qu->udpsent= 0;
75  timerclear(&qu->timeout);
76  qu->expires= now.tv_sec + MAXTTLBELIEVE;
77 
78  memset(&qu->ctx,0,sizeof(qu->ctx));
79 
80  qu->answer->status= adns_s_ok;
81  qu->answer->cname= qu->answer->owner= 0;
82  qu->answer->type= typei->type;
83  qu->answer->expires= -1;
84  qu->answer->nrrs= 0;
85  qu->answer->rrs.untyped= 0;
86  qu->answer->rrsz= typei->rrsz;
87 
88  return qu;
89 }
90 
92  const typeinfo *typei, vbuf *qumsg_vb, int id,
93  adns_queryflags flags, struct timeval now) {
94  /* Fills in the query message in for a previously-allocated query,
95  * and submits it. Cannot fail. Takes over the memory for qumsg_vb.
96  */
97 
98  qu->vb= *qumsg_vb;
99  adns__vbuf_init(qumsg_vb);
100 
101  qu->query_dgram= malloc( (size_t) qu->vb.used);
102  if (!qu->query_dgram) { adns__query_fail(qu,adns_s_nomemory); return; }
103 
104  qu->id= id;
105  qu->query_dglen= qu->vb.used;
106  memcpy(qu->query_dgram,qu->vb.buf,(size_t) qu->vb.used);
107 
108  adns__query_send(qu,now);
109 }
110 
112  const typeinfo *typei, vbuf *qumsg_vb, int id,
114  const qcontext *ctx) {
115  adns_query qu;
116 
117  qu= query_alloc(ads,typei,flags,now);
118  if (!qu) { adns__vbuf_free(qumsg_vb); return adns_s_nomemory; }
119  *query_r= qu;
120 
121  memcpy(&qu->ctx,ctx,(size_t) sizeof(qu->ctx));
122  query_submit(ads,qu, typei,qumsg_vb,id,flags,now);
123 
124  return adns_s_ok;
125 }
126 
128  const char *owner, int ol,
129  const typeinfo *typei, adns_queryflags flags,
130  struct timeval now) {
131  vbuf vb_new;
132  int id;
134 
135  stat= adns__mkquery(ads,&qu->vb,&id, owner,ol, typei,flags);
136  if (stat) {
139  return;
140  } else {
142  return;
143  }
144  }
145 
146  vb_new= qu->vb;
147  adns__vbuf_init(&qu->vb);
148  query_submit(ads,qu, typei,&vb_new,id, flags,now);
149 }
150 
152  const char *nextentry;
154 
155  if (qu->search_doneabs<0) {
156  nextentry= 0;
157  qu->search_doneabs= 1;
158  } else {
159  if (qu->search_pos >= ads->nsearchlist) {
160  if (qu->search_doneabs) {
161  stat= adns_s_nxdomain; goto x_fail;
162  return;
163  } else {
164  nextentry= 0;
165  qu->search_doneabs= 1;
166  }
167  } else {
168  nextentry= ads->searchlist[qu->search_pos++];
169  }
170  }
171 
172  qu->search_vb.used= qu->search_origlen;
173  if (nextentry) {
174  if (!adns__vbuf_append(&qu->search_vb,(byte*)".",1) ||
175  !adns__vbuf_appendstr(&qu->search_vb,nextentry)) {
176  stat= adns_s_nomemory; goto x_fail;
177  }
178  }
179 
180  free(qu->query_dgram);
181  qu->query_dgram= 0; qu->query_dglen= 0;
182 
183  query_simple(ads,qu, (char*)qu->search_vb.buf, qu->search_vb.used, qu->typei, qu->flags, now);
184  return;
185 
186 x_fail:
188 }
189 
190 static int save_owner(adns_query qu, const char *owner, int ol) {
191  /* Returns 1 if OK, otherwise there was no memory. */
192  adns_answer *ans;
193 
194  ans= qu->answer;
195  assert(!ans->owner);
196 
197  ans->owner= adns__alloc_preserved(qu, (size_t) ol+1); if (!ans->owner) return 0;
198 
199  memcpy(ans->owner,owner, (size_t) ol);
200  ans->owner[ol]= 0;
201  return 1;
202 }
203 
205  const char *owner,
208  void *context,
209  adns_query *query_r) {
210  int r, ol, ndots;
212  const typeinfo *typei;
213  struct timeval now;
214  adns_query qu;
215  const char *p;
216 
218 
219  typei= adns__findtype(type);
220  if (!typei) return ENOSYS;
221 
222  r= gettimeofday(&now,0); if (r) goto x_errno;
223  qu= query_alloc(ads,typei,flags,now); if (!qu) goto x_errno;
224 
225  qu->ctx.ext= context;
226  qu->ctx.callback= 0;
227  memset(&qu->ctx.info,0,sizeof(qu->ctx.info));
228 
229  *query_r= qu;
230 
231  ol= strlen(owner);
232  if (!ol) { stat= adns_s_querydomaininvalid; goto x_adnsfail; }
233  if (ol>DNS_MAXDOMAIN+1) { stat= adns_s_querydomaintoolong; goto x_adnsfail; }
234 
235  if (ol>=1 && owner[ol-1]=='.' && (ol<2 || owner[ol-2]!='\\')) {
236  flags &= ~adns_qf_search;
237  qu->flags= flags;
238  ol--;
239  }
240 
241  if (flags & adns_qf_search) {
242  r= adns__vbuf_append(&qu->search_vb,(byte*)owner,ol);
243  if (!r) { stat= adns_s_nomemory; goto x_adnsfail; }
244 
245  for (ndots=0, p=owner; (p= strchr(p,'.')); p++, ndots++);
246  qu->search_doneabs= (ndots >= ads->searchndots) ? -1 : 0;
247  qu->search_origlen= ol;
249  } else {
250  if (flags & adns_qf_owner) {
251  if (!save_owner(qu,owner,ol)) { stat= adns_s_nomemory; goto x_adnsfail; }
252  }
253  query_simple(ads,qu, owner,ol, typei,flags, now);
254  }
257  return 0;
258 
259  x_adnsfail:
262  return 0;
263 
264  x_errno:
265  r= errno;
266  assert(r);
268  return r;
269 }
270 
272  const struct sockaddr *addr,
273  const char *zone,
276  void *context,
277  adns_query *query_r) {
278  const unsigned char *iaddr;
279  char *buf, *buf_free;
280  char shortbuf[100];
281  int r, lreq;
282 
283  flags &= ~adns_qf_search;
284 
285  if (addr->sa_family != AF_INET) return ENOSYS;
286  iaddr= (const unsigned char*) &(((const struct sockaddr_in*)addr) -> sin_addr);
287 
288  lreq= strlen(zone) + 4*4 + 1;
289  if (lreq > (int)sizeof(shortbuf)) {
290  buf= malloc( strlen(zone) + 4*4 + 1 );
291  if (!buf) return errno;
292  buf_free= buf;
293  } else {
294  buf= shortbuf;
295  buf_free= 0;
296  }
297  sprintf(buf, "%d.%d.%d.%d.%s", iaddr[3], iaddr[2], iaddr[1], iaddr[0], zone);
298 
299  r= adns_submit(ads,buf,type,flags,context,query_r);
300  free(buf_free);
301  return r;
302 }
303 
305  const struct sockaddr *addr,
308  void *context,
309  adns_query *query_r) {
310  if (type != adns_r_ptr && type != adns_r_ptr_raw) return EINVAL;
311  return adns_submit_reverse_any(ads,addr,"in-addr.arpa",type,flags,context,query_r);
312 }
313 
315  const char *owner,
318  adns_answer **answer_r) {
319  adns_query qu;
320  int r;
321 
322  r= adns_submit(ads,owner,type,flags,0,&qu);
323  if (r) return r;
324 
325  r= adns_wait(ads,&qu,answer_r,0);
326  if (r) adns_cancel(qu);
327 
328  return r;
329 }
330 
331 static void *alloc_common(adns_query qu, size_t sz) {
332  allocnode *an;
333 
334  if (!sz) return qu; /* Any old pointer will do */
335  assert(!qu->final_allocspace);
336  an= malloc(MEM_ROUND(MEM_ROUND(sizeof(*an)) + sz));
337  if (!an) return 0;
338  LIST_LINK_TAIL(qu->allocations,an);
339  return (byte*)an + MEM_ROUND(sizeof(*an));
340 }
341 
342 void *adns__alloc_interim(adns_query qu, size_t sz) {
343  void *rv;
344 
345  sz= MEM_ROUND(sz);
346  rv= alloc_common(qu,sz);
347  if (!rv) return 0;
348  qu->interim_allocd += sz;
349  return rv;
350 }
351 
352 void *adns__alloc_preserved(adns_query qu, size_t sz) {
353  void *rv;
354 
355  sz= MEM_ROUND(sz);
356  rv= adns__alloc_interim(qu,sz);
357  if (!rv) return 0;
358  qu->preserved_allocd += sz;
359  return rv;
360 }
361 
362 void *adns__alloc_mine(adns_query qu, size_t sz) {
363  return alloc_common(qu,MEM_ROUND(sz));
364 }
365 
367  allocnode *an;
368 
369  if (!block) return;
370  an= (void*)((byte*)block - MEM_ROUND(sizeof(*an)));
371 
372  assert(!to->final_allocspace);
373  assert(!from->final_allocspace);
374 
375  LIST_UNLINK(from->allocations,an);
376  LIST_LINK_TAIL(to->allocations,an);
377 
378  sz= MEM_ROUND(sz);
379  from->interim_allocd -= sz;
380  to->interim_allocd += sz;
381 
382  if (to->expires > from->expires) to->expires= from->expires;
383 }
384 
385 void *adns__alloc_final(adns_query qu, size_t sz) {
386  /* When we're in the _final stage, we _subtract_ from interim_alloc'd
387  * each allocation, and use final_allocspace to point to the next free
388  * bit.
389  */
390  void *rp;
391 
392  sz= MEM_ROUND(sz);
393  rp= qu->final_allocspace;
394  assert(rp);
395  qu->interim_allocd -= sz;
396  assert(qu->interim_allocd>=0);
397  qu->final_allocspace= (byte*)rp + sz;
398  return rp;
399 }
400 
401 static void cancel_children(adns_query qu) {
402  adns_query cqu, ncqu;
403 
404  for (cqu= qu->children.head; cqu; cqu= ncqu) {
405  ncqu= cqu->siblings.next;
406  adns_cancel(cqu);
407  }
408 }
409 
411  assert(!qu->final_allocspace);
412  cancel_children(qu);
413  qu->answer->nrrs= 0;
414  qu->answer->rrs.untyped= 0;
416 }
417 
418 static void free_query_allocs(adns_query qu) {
419  allocnode *an, *ann;
420 
421  cancel_children(qu);
422  for (an= qu->allocations.head; an; an= ann) { ann= an->next; free(an); }
423  LIST_INIT(qu->allocations);
424  adns__vbuf_free(&qu->vb);
426  free(qu->query_dgram);
427  qu->query_dgram= 0;
428 }
429 
431  adns_state ads;
432 
433  ads= qu->ads;
435  if (qu->parent) LIST_UNLINK_PART(qu->parent->children,qu,siblings.);
436  switch (qu->state) {
437  case query_tosend:
438  LIST_UNLINK(ads->udpw,qu);
439  break;
440  case query_tcpw:
441  LIST_UNLINK(ads->tcpw,qu);
442  break;
443  case query_childw:
444  LIST_UNLINK(ads->childw,qu);
445  break;
446  case query_done:
447  LIST_UNLINK(ads->output,qu);
448  break;
449  default:
450  abort();
451  }
452  free_query_allocs(qu);
453  free(qu->answer);
454  free(qu);
456 }
457 
458 void adns__update_expires(adns_query qu, unsigned long ttl, struct timeval now) {
459  time_t max;
460 
461  assert(ttl <= MAXTTLBELIEVE);
462  max= now.tv_sec + ttl;
463  if (qu->expires < max) return;
464  qu->expires= max;
465 }
466 
467 static void makefinal_query(adns_query qu) {
468  adns_answer *ans;
469  int rrn;
470 
471  ans= qu->answer;
472 
473  if (qu->interim_allocd) {
474  ans= realloc(qu->answer, MEM_ROUND(MEM_ROUND(sizeof(*ans)) + qu->interim_allocd));
475  if (!ans) goto x_nomem;
476  qu->answer= ans;
477  }
478 
479  qu->final_allocspace= (byte*)ans + MEM_ROUND(sizeof(*ans));
480  adns__makefinal_str(qu,&ans->cname);
481  adns__makefinal_str(qu,&ans->owner);
482 
483  if (ans->nrrs) {
484  adns__makefinal_block(qu, &ans->rrs.untyped, (size_t) ans->nrrs*ans->rrsz);
485 
486  for (rrn=0; rrn<ans->nrrs; rrn++)
487  qu->typei->makefinal(qu, ans->rrs.bytes + rrn*ans->rrsz);
488  }
489 
490  free_query_allocs(qu);
491  return;
492 
493  x_nomem:
494  qu->preserved_allocd= 0;
495  qu->answer->cname= 0;
496  qu->answer->owner= 0;
497  adns__reset_preserved(qu); /* (but we just threw away the preserved stuff) */
498 
500  free_query_allocs(qu);
501 }
502 
504  adns_answer *ans;
506 
507  cancel_children(qu);
508 
509  qu->id= -1;
510  ans= qu->answer;
511 
512  if (qu->flags & adns_qf_owner && qu->flags & adns_qf_search &&
513  ans->status != adns_s_nomemory) {
514  if (!save_owner(qu, (char*)qu->search_vb.buf, qu->search_vb.used)) {
516  return;
517  }
518  }
519 
520  if (ans->nrrs && qu->typei->diff_needswap) {
521  if (!adns__vbuf_ensure(&qu->vb,qu->typei->rrsz)) {
523  return;
524  }
525  adns__isort(ans->rrs.bytes, ans->nrrs, ans->rrsz,
526  qu->vb.buf,
527  (int(*)(void*, const void*, const void*))qu->typei->diff_needswap,
528  qu->ads);
529  }
530 
531  ans->expires= qu->expires;
532  parent= qu->parent;
533  if (parent) {
534  LIST_UNLINK_PART(parent->children,qu,siblings.);
535  LIST_UNLINK(qu->ads->childw,parent);
536  qu->ctx.callback(parent,qu);
537  free_query_allocs(qu);
538  free(qu->answer);
539  free(qu);
540  } else {
541  makefinal_query(qu);
542  LIST_LINK_TAIL(qu->ads->output,qu);
543  qu->state= query_done;
544  }
545 }
546 
549  qu->answer->status= stat;
550  adns__query_done(qu);
551 }
552 
553 void adns__makefinal_str(adns_query qu, char **strp) {
554  int l;
555  char *before, *after;
556 
557  before= *strp;
558  if (!before) return;
559  l= strlen(before)+1;
560  after= adns__alloc_final(qu, (size_t) l);
561  memcpy(after,before,(size_t) l);
562  *strp= after;
563 }
564 
565 void adns__makefinal_block(adns_query qu, void **blpp, size_t sz) {
566  void *before, *after;
567 
568  before= *blpp;
569  if (!before) return;
570  after= adns__alloc_final(qu,sz);
571  memcpy(after,before, (size_t) sz);
572  *blpp= after;
573 }
#define realloc
Definition: debug_ros.c:6
static unsigned int block
Definition: xmlmemory.c:118
int preserved_allocd
Definition: internal.h:188
time_t expires
Definition: internal.h:231
void adns__update_expires(adns_query qu, unsigned long ttl, struct timeval now)
Definition: query.c:458
void adns__vbuf_free(vbuf *vb)
Definition: general.c:155
struct adns__query::@3826 siblings
void query_done(struct query_node *qun, adns_answer *answer)
Definition: adh-query.c:253
#define max(a, b)
Definition: svc.c:63
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
unsigned char * bytes
Definition: adns.h:319
adns_state ads
Definition: adh-query.c:35
adns_rrtype type
Definition: adns.h:314
Definition: http.c:6587
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
struct adns__query::@3825 children
void adns__vbuf_init(vbuf *vb)
Definition: general.c:112
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
adns_rrtype
Definition: adns.h:113
char ** searchlist
Definition: internal.h:322
Definition: arc.h:39
#define free
Definition: debug_ros.c:5
void adns_cancel(adns_query qu)
Definition: query.c:430
int cname_begin
Definition: internal.h:213
int udpnextserver
Definition: internal.h:228
static adns_query query_alloc(adns_state ads, const typeinfo *typei, adns_queryflags flags, struct timeval now)
Definition: query.c:41
void * adns__alloc_mine(adns_query qu, size_t sz)
Definition: query.c:362
enum adns__query::@3824 state
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
__inline int before(__u32 seq1, __u32 seq2)
Definition: tcpcore.h:2414
int retries
Definition: internal.h:227
const typeinfo * typei
Definition: internal.h:191
int errno
static void * alloc_common(adns_query qu, size_t sz)
Definition: query.c:331
void * adns__alloc_interim(adns_query qu, size_t sz)
Definition: query.c:342
int cname_dglen
Definition: internal.h:213
#define sprintf(buf, format,...)
Definition: sprintf.c:55
int(* diff_needswap)(adns_state ads, const void *datap_a, const void *datap_b)
Definition: internal.h:153
int rrsz
Definition: adns.h:316
#define gettimeofday(tv, tz)
Definition: adns_win32.h:159
int adns__vbuf_ensure(vbuf *vb, int want)
Definition: general.c:116
#define LIST_LINK_TAIL(list, node)
Definition: dlist.h:51
adns_status
Definition: adns.h:215
time_t now
Definition: finger.c:65
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_preserved(adns_query qu, size_t sz)
Definition: query.c:352
unsigned long udpsent
Definition: internal.h:229
struct timeval timeout
Definition: internal.h:230
int search_origlen
Definition: internal.h:217
adns_query back
Definition: internal.h:184
int adns_submit_reverse_any(adns_state ads, const struct sockaddr *addr, const char *zone, adns_rrtype type, adns_queryflags flags, void *context, adns_query *query_r)
Definition: query.c:271
void * final_allocspace
Definition: internal.h:189
int adns__vbuf_append(vbuf *vb, const byte *data, int len)
Definition: general.c:131
byte * cname_dgram
Definition: internal.h:212
#define LINK_INIT(link)
Definition: dlist.h:32
#define LIST_UNLINK(list, node)
Definition: dlist.h:50
adns_state ads
Definition: internal.h:182
vbuf search_vb
Definition: internal.h:216
void adns__makefinal_block(adns_query qu, void **blpp, size_t sz)
Definition: query.c:565
void adns__makefinal_str(adns_query qu, char **strp)
Definition: query.c:553
static int save_owner(adns_query qu, const char *owner, int ol)
Definition: query.c:190
void(* makefinal)(adns_query qu, void *data)
Definition: internal.h:130
#define MEM_ROUND(sz)
Definition: internal.h:711
r l[0]
Definition: byte_order.h:167
union adns_answer::@3822 rrs
const typeinfo * adns__findtype(adns_rrtype type)
Definition: types.c:1025
adns_query next
Definition: internal.h:184
#define ENOSYS
Definition: errno.h:45
qcontext ctx
Definition: internal.h:233
r parent
Definition: btrfs.c:2677
struct allocnode * next
Definition: internal.h:160
#define LIST_INIT(head)
Definition: queue.h:197
adns_answer * answer
Definition: internal.h:201
void * untyped
Definition: adns.h:318
struct adns__query::@3827 allocations
adns_status adns__mkquery(adns_state ads, vbuf *vb, int *id_r, const char *owner, int ol, const typeinfo *typei, adns_queryflags flags)
Definition: transmit.c:81
void adns__query_done(adns_query qu)
Definition: query.c:503
time_t expires
Definition: adns.h:315
#define MAXTTLBELIEVE
Definition: internal.h:70
GLbitfield flags
Definition: glext.h:7161
#define LIST_UNLINK_PART(list, node, part)
Definition: dlist.h:34
byte * query_dgram
Definition: internal.h:192
adns_status status
Definition: adns.h:311
int query_dglen
Definition: internal.h:193
void adns__reset_preserved(adns_query qu)
Definition: query.c:410
void(* callback)(adns_query parent, adns_query child)
Definition: internal.h:174
GLenum const GLvoid * addr
Definition: glext.h:9621
int adns__vbuf_appendstr(vbuf *vb, const char *data)
Definition: general.c:149
int search_pos
Definition: internal.h:217
Definition: dhcpd.h:125
char * cname
Definition: adns.h:312
Definition: stat.h:55
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
__inline int after(__u32 seq1, __u32 seq2)
Definition: tcpcore.h:2419
Definition: internal.h:110
void adns__autosys(adns_state ads, struct timeval now)
Definition: event.c:665
adns_queryflags
Definition: adns.h:100
int adns_submit_reverse(adns_state ads, const struct sockaddr *addr, adns_rrtype type, adns_queryflags flags, void *context, adns_query *query_r)
Definition: query.c:304
static void cancel_children(adns_query qu)
Definition: query.c:401
DWORD zone
Definition: sec_mgr.c:1760
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
byte * buf
Definition: internal.h:112
int nrrs
Definition: adns.h:316
__kernel_time_t time_t
Definition: linux.h:252
int search_doneabs
Definition: internal.h:217
#define DNS_MAXDOMAIN
Definition: internal.h:75
static void makefinal_query(adns_query qu)
Definition: query.c:467
#define abort()
Definition: i386-dis.c:35
adns_rrtype type
Definition: internal.h:125
int used
Definition: internal.h:111
void adns__query_fail(adns_query qu, adns_status stat)
Definition: query.c:547
void * adns__alloc_final(adns_query qu, size_t sz)
Definition: query.c:385
char * strchr(const char *String, int ch)
Definition: utclib.c:501
void adns__consistency(adns_state ads, adns_query qu, consistency_checks cc)
Definition: check.c:185
int adns_synchronous(adns_state ads, const char *owner, adns_rrtype type, adns_queryflags flags, adns_answer **answer_r)
Definition: query.c:314
int nsearchlist
Definition: internal.h:300
void adns__query_send(adns_query qu, struct timeval now)
Definition: transmit.c:232
int rrsz
Definition: internal.h:128
GLenum GLuint id
Definition: glext.h:5579
struct query_queue udpw tcpw childw output
Definition: internal.h:295
#define AF_INET
Definition: tcpip.h:117
#define malloc
Definition: debug_ros.c:4
char * owner
Definition: adns.h:313
GLfloat GLfloat p
Definition: glext.h:8902
CardRegion * from
Definition: spigame.cpp:19
ADNS_API int adns_wait(adns_state ads, adns_query *query_io, adns_answer **answer_r, void **context_r)
Definition: event.c:696
int adns_submit(adns_state ads, const char *owner, adns_rrtype type, adns_queryflags flags, void *context, adns_query *query_r)
Definition: query.c:204
#define memset(x, y, z)
Definition: compat.h:39
#define timerclear(tvp)
Definition: rdesktop.h:190
static void free_query_allocs(adns_query qu)
Definition: query.c:418
adns_query parent
Definition: internal.h:184
void adns__search_next(adns_state ads, adns_query qu, struct timeval now)
Definition: query.c:151
int searchndots
Definition: internal.h:300
void adns__transfer_interim(adns_query from, adns_query to, void *block, size_t sz)
Definition: query.c:366
static void query_simple(adns_state ads, adns_query qu, const char *owner, int ol, const typeinfo *typei, adns_queryflags flags, struct timeval now)
Definition: query.c:127
static void query_submit(adns_state ads, adns_query qu, const typeinfo *typei, vbuf *qumsg_vb, int id, adns_queryflags flags, struct timeval now)
Definition: query.c:91
int interim_allocd
Definition: internal.h:188