ReactOS 0.4.15-dev-7788-g1ad9096
setup.c
Go to the documentation of this file.
1/*
2 * setup.c
3 * - configuration file parsing
4 * - management of global state
5 */
6/*
7 * This file is
8 * Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk>
9 *
10 * It is part of adns, which is
11 * Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
12 * Copyright (C) 1999-2000 Tony Finch <dot@dotat.at>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2, or (at your option)
17 * any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29#ifdef ADNS_JGAA_WIN32
30# include "adns_win32.h"
31# include <iphlpapi.h>
32#else
33# include <stdlib.h>
34# include <errno.h>
35# include <limits.h>
36# include <unistd.h>
37# include <fcntl.h>
38# include <netdb.h>
39# include <sys/socket.h>
40# include <netinet/in.h>
41# include <arpa/inet.h>
42#endif
43
44#include "internal.h"
45
46static void readconfig(adns_state ads, const char *filename, int warnmissing);
47
48static void addserver(adns_state ads, struct in_addr addr) {
49 int i;
50 struct server *ss;
51
52 for (i=0; i<ads->nservers; i++) {
53 if (ads->servers[i].addr.s_addr == addr.s_addr) {
54 adns__debug(ads,-1,0,"duplicate nameserver %s ignored",inet_ntoa(addr));
55 return;
56 }
57 }
58
59 if (ads->nservers>=MAXSERVERS) {
60 adns__diag(ads,-1,0,"too many nameservers, ignoring %s",inet_ntoa(addr));
61 return;
62 }
63
65 ss->addr= addr;
66 ads->nservers++;
67}
68
72}
73
74static void saveerr(adns_state ads, int en) {
76}
77
78static void configparseerr(adns_state ads, const char *fn, int lno,
79 const char *fmt, ...) {
80 va_list al;
81
83 if (!ads->diagfile || (ads->iflags & adns_if_noerrprint)) return;
84
85 if (lno==-1) fprintf(ads->diagfile,"adns: %s: ",fn);
86 else fprintf(ads->diagfile,"adns: %s:%d: ",fn,lno);
87 va_start(al,fmt);
89 va_end(al);
90 fputc('\n',ads->diagfile);
91}
92
93static int nextword(const char **bufp_io, const char **word_r, int *l_r) {
94 const char *p, *q;
95
96 p= *bufp_io;
97 while (ctype_whitespace(*p)) p++;
98 if (!*p) return 0;
99
100 q= p;
101 while (*q && !ctype_whitespace(*q)) q++;
102
103 *l_r= q-p;
104 *word_r= p;
105 *bufp_io= q;
106
107 return 1;
108}
109
110static void ccf_nameserver(adns_state ads, const char *fn, int lno, const char *buf) {
111 struct in_addr ia;
112
113 if (!inet_aton(buf,&ia)) {
114 configparseerr(ads,fn,lno,"invalid nameserver address `%s'",buf);
115 return;
116 }
117 adns__debug(ads,-1,0,"using nameserver %s",inet_ntoa(ia));
118 addserver(ads,ia);
119}
120
121static void ccf_search(adns_state ads, const char *fn, int lno, const char *buf) {
122 const char *bufp, *word;
123 char *newchars, **newptrs, **pp;
124 int count, tl, l;
125
126 if (!buf) return;
127
128 bufp= buf;
129 count= 0;
130 tl= 0;
131 while (nextword(&bufp,&word,&l)) { count++; tl += l+1; }
132
133 newptrs= malloc(sizeof(char*)*count); if (!newptrs) { saveerr(ads,errno); return; }
134 newchars= malloc(tl); if (!newchars) { saveerr(ads,errno); free(newptrs); return; }
135
136 bufp= buf;
137 pp= newptrs;
138 while (nextword(&bufp,&word,&l)) {
139 *pp++= newchars;
140 memcpy(newchars,word,l);
141 newchars += l;
142 *newchars++ = 0;
143 }
144
147 ads->searchlist= newptrs;
148}
149
150static void ccf_sortlist(adns_state ads, const char *fn, int lno, const char *buf) {
151 const char *word;
152 char tbuf[200], *slash, *ep;
153 struct in_addr base, mask;
154 int l;
155 unsigned long initial, baselocal;
156
157 if (!buf) return;
158
159 ads->nsortlist= 0;
160 while (nextword(&buf,&word,&l)) {
161 if (ads->nsortlist >= MAXSORTLIST) {
162 adns__diag(ads,-1,0,"too many sortlist entries, ignoring %.*s onwards",l,word);
163 return;
164 }
165
166 if (l >= sizeof(tbuf)) {
167 configparseerr(ads,fn,lno,"sortlist entry `%.*s' too long",l,word);
168 continue;
169 }
170
171 memcpy(tbuf,word,l); tbuf[l]= 0;
172 slash= strchr(tbuf,'/');
173 if (slash) *slash++= 0;
174
175 if (!inet_aton(tbuf,&base)) {
176 configparseerr(ads,fn,lno,"invalid address `%s' in sortlist",tbuf);
177 continue;
178 }
179
180 if (slash) {
181 if (strchr(slash,'.')) {
182 if (!inet_aton(slash,&mask)) {
183 configparseerr(ads,fn,lno,"invalid mask `%s' in sortlist",slash);
184 continue;
185 }
186 if (base.s_addr & ~mask.s_addr) {
188 "mask `%s' in sortlist overlaps address `%s'",slash,tbuf);
189 continue;
190 }
191 } else {
192 initial= strtoul(slash,&ep,10);
193 if (*ep || initial>32) {
194 configparseerr(ads,fn,lno,"mask length `%s' invalid",slash);
195 continue;
196 }
197 mask.s_addr= htonl((0x0ffffffffUL) << (32-initial));
198 }
199 } else {
200 baselocal= ntohl(base.s_addr);
201 if (!(baselocal & 0x080000000UL)) /* class A */
202 mask.s_addr= htonl(0x0ff000000UL);
203 else if ((baselocal & 0x0c0000000UL) == 0x080000000UL)
204 mask.s_addr= htonl(0x0ffff0000UL); /* class B */
205 else if ((baselocal & 0x0f0000000UL) == 0x0e0000000UL)
206 mask.s_addr= htonl(0x0ff000000UL); /* class C */
207 else {
209 "network address `%s' in sortlist is not in classed ranges,"
210 " must specify mask explicitly", tbuf);
211 continue;
212 }
213 }
214
215 ads->sortlist[ads->nsortlist].base= base;
216 ads->sortlist[ads->nsortlist].mask= mask;
217 ads->nsortlist++;
218 }
219}
220
221static void ccf_options(adns_state ads, const char *fn, int lno, const char *buf) {
222 const char *word;
223 char *ep;
224 unsigned long v;
225 int l;
226
227 if (!buf) return;
228
229 while (nextword(&buf,&word,&l)) {
230 if (l==5 && !memcmp(word,"debug",5)) {
232 continue;
233 }
234 if (l>=6 && !memcmp(word,"ndots:",6)) {
235 v= strtoul(word+6,&ep,10);
236 if (l==6 || ep != word+l || v > INT_MAX) {
237 configparseerr(ads,fn,lno,"option `%.*s' malformed or has bad value",l,word);
238 continue;
239 }
240 ads->searchndots= v;
241 continue;
242 }
243 if (l>=12 && !memcmp(word,"adns_checkc:",12)) {
244 if (!strcmp(word+12,"none")) {
245 ads->iflags &= ~adns_if_checkc_freq;
247 } else if (!strcmp(word+12,"entex")) {
248 ads->iflags &= ~adns_if_checkc_freq;
250 } else if (!strcmp(word+12,"freq")) {
252 } else {
253 configparseerr(ads,fn,lno, "option adns_checkc has bad value `%s' "
254 "(must be none, entex or freq", word+12);
255 }
256 continue;
257 }
258 adns__diag(ads,-1,0,"%s:%d: unknown option `%.*s'", fn,lno, l,word);
259 }
260}
261
262static void ccf_clearnss(adns_state ads, const char *fn, int lno, const char *buf) {
263 ads->nservers= 0;
264}
265
266static void ccf_include(adns_state ads, const char *fn, int lno, const char *buf) {
267 if (!*buf) {
268 configparseerr(ads,fn,lno,"`include' directive with no filename");
269 return;
270 }
271 readconfig(ads,buf,1);
272}
273
274static const struct configcommandinfo {
275 const char *name;
276 void (*fn)(adns_state ads, const char *fn, int lno, const char *buf);
278 { "nameserver", ccf_nameserver },
279 { "domain", ccf_search },
280 { "search", ccf_search },
281 { "sortlist", ccf_sortlist },
282 { "options", ccf_options },
283 { "clearnameservers", ccf_clearnss },
284 { "include", ccf_include },
285 { 0 }
287
288typedef union {
290 const char *text;
292
293static int gl_file(adns_state ads, getline_ctx *src_io, const char *filename,
294 int lno, char *buf, int buflen) {
295 FILE *file= src_io->file;
296 int c, i;
297 char *p;
298
299 p= buf;
300 buflen--;
301 i= 0;
302
303 for (;;) { /* loop over chars */
304 if (i == buflen) {
305 adns__diag(ads,-1,0,"%s:%d: line too long, ignored",filename,lno);
306 goto x_badline;
307 }
308 c= getc(file);
309 if (!c) {
310 adns__diag(ads,-1,0,"%s:%d: line contains nul, ignored",filename,lno);
311 goto x_badline;
312 } else if (c == '\n') {
313 break;
314 } else if (c == EOF) {
315 if (ferror(file)) {
317 adns__diag(ads,-1,0,"%s:%d: read error: %s",filename,lno,strerror(errno));
318 return -1;
319 }
320 if (!i) return -1;
321 break;
322 } else {
323 *p++= c;
324 i++;
325 }
326 }
327
328 *p++= 0;
329 return i;
330
331 x_badline:
333 while ((c= getc(file)) != EOF && c != '\n');
334 return -2;
335}
336
337static int gl_text(adns_state ads, getline_ctx *src_io, const char *filename,
338 int lno, char *buf, int buflen) {
339 const char *cp= src_io->text;
340 int l;
341
342 if (!cp || !*cp) return -1;
343
344 if (*cp == ';' || *cp == '\n') cp++;
345 l= strcspn(cp,";\n");
346 src_io->text = cp+l;
347
348 if (l >= buflen) {
349 adns__diag(ads,-1,0,"%s:%d: line too long, ignored",filename,lno);
351 return -2;
352 }
353
354 memcpy(buf,cp,l);
355 buf[l]= 0;
356 return l;
357}
358
359static void readconfiggeneric(adns_state ads, const char *filename,
361 const char *filename, int lno,
362 char *buf, int buflen),
363 /* Returns >=0 for success, -1 for EOF or error
364 * (error will have been reported), or -2 for
365 * bad line was encountered, try again.
366 */
367 getline_ctx gl_ctx) {
368 char linebuf[2000], *p, *q;
369 int lno, l, dirl;
370 const struct configcommandinfo *ccip;
371
372 for (lno=1;
373 (l= getline(ads,&gl_ctx, filename,lno, linebuf,sizeof(linebuf))) != -1;
374 lno++) {
375 if (l == -2) continue;
376 while (l>0 && ctype_whitespace(linebuf[l-1])) l--;
377 linebuf[l]= 0;
378 p= linebuf;
379 while (ctype_whitespace(*p)) p++;
380 if (*p == '#' || !*p) continue;
381 q= p;
382 while (*q && !ctype_whitespace(*q)) q++;
383 dirl= q-p;
384 for (ccip=configcommandinfos;
385 ccip->name && !((int)strlen(ccip->name)==dirl && !memcmp(ccip->name,p,q-p));
386 ccip++);
387 if (!ccip->name) {
388 adns__diag(ads,-1,0,"%s:%d: unknown configuration directive `%.*s'",
389 filename,lno,q-p,p);
390 continue;
391 }
392 while (ctype_whitespace(*q)) q++;
393 ccip->fn(ads,filename,lno,q);
394 }
395}
396
397static const char *instrum_getenv(adns_state ads, const char *envvar) {
398 const char *value;
399
400 value= getenv(envvar);
401 if (!value) adns__debug(ads,-1,0,"environment variable %s not set",envvar);
402 else adns__debug(ads,-1,0,"environment variable %s set to `%s'",envvar,value);
403 return value;
404}
405
406static void readconfig(adns_state ads, const char *filename, int warnmissing) {
407 getline_ctx gl_ctx;
408
409 gl_ctx.file= fopen(filename,"r");
410 if (!gl_ctx.file) {
411 if (errno == ENOENT) {
412 if (warnmissing)
413 adns__debug(ads,-1,0,"configuration file `%s' does not exist",filename);
414 return;
415 }
417 adns__diag(ads,-1,0,"cannot open configuration file `%s': %s",
419 return;
420 }
421
423
424 fclose(gl_ctx.file);
425}
426
427static void readconfigtext(adns_state ads, const char *text, const char *showname) {
428 getline_ctx gl_ctx;
429
430 gl_ctx.text= text;
431 readconfiggeneric(ads,showname,gl_text,gl_ctx);
432}
433
434static void readconfigenv(adns_state ads, const char *envvar) {
435 const char *filename;
436
437 if (ads->iflags & adns_if_noenv) {
438 adns__debug(ads,-1,0,"not checking environment variable `%s'",envvar);
439 return;
440 }
441 filename= instrum_getenv(ads,envvar);
443}
444
445static void readconfigenvtext(adns_state ads, const char *envvar) {
446 const char *textdata;
447
448 if (ads->iflags & adns_if_noenv) {
449 adns__debug(ads,-1,0,"not checking environment variable `%s'",envvar);
450 return;
451 }
452 textdata= instrum_getenv(ads,envvar);
453 if (textdata) readconfigtext(ads,textdata,envvar);
454}
455
456
458#ifdef ADNS_JGAA_WIN32
459 unsigned long Val = 1;
460 return (ioctlsocket (fd, FIONBIO, &Val) == 0) ? 0 : -1;
461#else
462 int r;
463
464 r= fcntl(fd,F_GETFL,0); if (r<0) return errno;
465 r |= O_NONBLOCK;
466 r= fcntl(fd,F_SETFL,r); if (r<0) return errno;
467 return 0;
468#endif
469}
470
471static int init_begin(adns_state *ads_r, adns_initflags flags, FILE *diagfile) {
473
474#ifdef ADNS_JGAA_WIN32
475 WORD wVersionRequested = MAKEWORD( 2, 0 );
476 WSADATA wsaData;
477 int err;
478#endif
479
480 ads= malloc(sizeof(*ads)); if (!ads) return errno;
481
482 ads->iflags= flags;
483 ads->diagfile= diagfile;
484 ads->configerrno= 0;
485 LIST_INIT(ads->udpw);
486 LIST_INIT(ads->tcpw);
487 LIST_INIT(ads->childw);
489 ads->forallnext= 0;
490 ads->nextid= 0x311f;
491 ads->udpsocket= ads->tcpsocket= -1;
494 ads->tcprecv_skip= 0;
496 ads->searchndots= 1;
497 ads->tcpstate= server_disconnected;
499 ads->searchlist= 0;
500
501 #ifdef ADNS_JGAA_WIN32
502 err= WSAStartup( wVersionRequested, &wsaData );
503 if ( err != 0 ) {
505 fprintf(ads->diagfile,"adns: WSAStartup() failed. \n");
506 return -1;}
507 if (LOBYTE( wsaData.wVersion ) != 2 ||
508 HIBYTE( wsaData.wVersion ) != 0 ) {
510 fprintf(ads->diagfile,"adns: Need Winsock 2.0 or better!\n");
511
512 WSACleanup();
513 return -1;}
514
515 /* The WinSock DLL is acceptable. Proceed. */
516#endif
517
518 *ads_r= ads;
519
520 return 0;
521}
522
524 struct protoent *proto;
525 int r;
526/* Don't add loopback on ReactOS it slows down queries to non existent server */
527#ifndef __REACTOS__
528 struct in_addr ia;
529 if (!ads->nservers) {
531 fprintf(ads->diagfile,"adns: no nameservers, using localhost\n");
533 addserver(ads,ia);
534 }
535#endif
536 proto= getprotobyname("udp"); if (!proto) { r= ENOPROTOOPT; goto x_free; }
540 if (ads->udpsocket<0) { r= errno; goto x_free; }
541
543 if (r) { r= errno; goto x_closeudp; }
544 return 0;
545
546 x_closeudp:
548 x_free:
549 free(ads);
550#ifdef ADNS_JGAA_WIN32
551 WSACleanup();
552#endif /* WIN32 */
553 return r;
554}
555
557 if (ads->nsearchlist) {
558 free(ads->searchlist[0]);
560 }
561 free(ads);
562#ifdef ADNS_JGAA_WIN32
563 WSACleanup();
564#endif /* WIN32 */
565
566}
567
570 const char *res_options, *adns_res_options;
571 int r;
572#ifdef ADNS_JGAA_WIN32
573 #define SECURE_PATH_LEN (MAX_PATH - 64)
574 char PathBuf[MAX_PATH];
575#endif
576
577 r= init_begin(&ads, flags, diagfile ? diagfile : stderr);
578 if (r) return r;
579
580 res_options= instrum_getenv(ads,"RES_OPTIONS");
581 adns_res_options= instrum_getenv(ads,"ADNS_RES_OPTIONS");
582 ccf_options(ads,"RES_OPTIONS",-1,res_options);
583 ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);
584
585#ifdef ADNS_JGAA_WIN32
586 GetWindowsDirectory(PathBuf, SECURE_PATH_LEN);
587 strcat(PathBuf,"\\resolv.conf");
588 readconfig(ads,PathBuf,1);
589 GetWindowsDirectory(PathBuf, SECURE_PATH_LEN);
590 strcat(PathBuf,"\\resolv-adns.conf");
591 readconfig(ads,PathBuf,0);
592 GetWindowsDirectory(PathBuf, SECURE_PATH_LEN);
593 strcat(PathBuf,"\\System32\\Drivers\\etc\\resolv.conf");
594 readconfig(ads,PathBuf,1);
595 GetWindowsDirectory(PathBuf, SECURE_PATH_LEN);
596 strcat(PathBuf,"\\System32\\Drivers\\etc\\resolv-adns.conf");
597 readconfig(ads,PathBuf,0);
598#else
599 readconfig(ads,"/etc/resolv.conf",1);
600 readconfig(ads,"/etc/resolv-adns.conf",0);
601#endif
602
603 readconfigenv(ads,"RES_CONF");
604 readconfigenv(ads,"ADNS_RES_CONF");
605
606 readconfigenvtext(ads,"RES_CONF_TEXT");
607 readconfigenvtext(ads,"ADNS_RES_CONF_TEXT");
608
609 ccf_options(ads,"RES_OPTIONS",-1,res_options);
610 ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options);
611
612 ccf_search(ads,"LOCALDOMAIN",-1,instrum_getenv(ads,"LOCALDOMAIN"));
613 ccf_search(ads,"ADNS_LOCALDOMAIN",-1,instrum_getenv(ads,"ADNS_LOCALDOMAIN"));
614
615 if (ads->configerrno && ads->configerrno != EINVAL) {
616 r= ads->configerrno;
618 return r;
619 }
620
621 r= init_finish(ads);
622 if (r) return r;
623
625 *ads_r= ads;
626 return 0;
627}
628
630 FILE *diagfile, const char *configtext) {
632 int r;
633
634 r= init_begin(&ads, flags, diagfile); if (r) return r;
635
636 readconfigtext(ads,configtext,"<supplied configuration text>");
637 if (ads->configerrno) {
638 r= ads->configerrno;
640 return r;
641 }
642
643 r= init_finish(ads); if (r) return r;
645 *ads_r= ads;
646 return 0;
647}
648
649
652 for (;;) {
653 if (ads->udpw.head) adns_cancel(ads->udpw.head);
654 else if (ads->tcpw.head) adns_cancel(ads->tcpw.head);
655 else if (ads->childw.head) adns_cancel(ads->childw.head);
656 else if (ads->output.head) adns_cancel(ads->output.head);
657 else break;
658 }
664 free(ads);
665#ifdef ADNS_JGAA_WIN32
666 WSACleanup();
667#endif /* WIN32 */
668
669}
670
674 ads->udpw.head ? ads->udpw.head :
675 ads->tcpw.head ? ads->tcpw.head :
676 ads->childw.head ? ads->childw.head :
677 ads->output.head;
678}
679
681 adns_query qu, nqu;
682
684 nqu= ads->forallnext;
685 for (;;) {
686 qu= nqu;
687 if (!qu) return 0;
688 if (qu->next) {
689 nqu= qu->next;
690 } else if (qu == ads->udpw.tail) {
691 nqu=
692 ads->tcpw.head ? ads->tcpw.head :
693 ads->childw.head ? ads->childw.head :
694 ads->output.head;
695 } else if (qu == ads->tcpw.tail) {
696 nqu=
697 ads->childw.head ? ads->childw.head :
698 ads->output.head;
699 } else if (qu == ads->childw.tail) {
700 nqu= ads->output.head;
701 } else {
702 nqu= 0;
703 }
704 if (!qu->parent) break;
705 }
706 ads->forallnext= nqu;
707 if (context_r) *context_r= qu->ctx.ext;
708 return qu;
709}
710
711/* ReactOS addition */
714}
715void adns_ccf_search(adns_state ads, const char *fn, int lno, const char *buf) {
716 ccf_search(ads, fn, lno, buf);
717}
719 return ads->nservers;
720}
void adns__consistency(adns_state ads, adns_query qu, consistency_checks cc)
Definition: check.c:185
#define ENOENT
Definition: acclib.h:79
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define EINVAL
Definition: acclib.h:90
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
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
char * strchr(const char *String, int ch)
Definition: utclib.c:501
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
adns_state ads
Definition: adh-query.c:35
adns_initflags
Definition: adns.h:87
@ adns_if_checkc_freq
Definition: adns.h:97
@ adns_if_noerrprint
Definition: adns.h:89
@ adns_if_noenv
Definition: adns.h:88
@ adns_if_debug
Definition: adns.h:91
@ adns_if_checkc_entex
Definition: adns.h:96
ADNS_API void adns_cancel(adns_query query)
Definition: query.c:430
#define ADNS_SOCKET
Definition: adns_win32.h:98
#define ADNS_CLEAR_ERRNO
Definition: adns_win32.h:108
#define adns_socket_close(sck)
Definition: adns_win32.h:99
#define ADNS_CAPTURE_ERRNO
Definition: adns_win32.h:107
#define timerclear(tvp)
Definition: rdesktop.h:190
r l[0]
Definition: byte_order.h:168
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define MAX_PATH
Definition: compat.h:34
const WCHAR * text
Definition: package.c:1799
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
int en
Definition: doserrmap.h:8
#define ENOPROTOOPT
Definition: errno.h:100
#define AF_INET
Definition: tcpip.h:117
unsigned short WORD
Definition: ntddk_ex.h:93
LPPROTOENT WSAAPI getprotobyname(IN CONST CHAR FAR *name)
Definition: getproto.c:305
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
const GLubyte * c
Definition: glext.h:8905
GLenum GLint GLuint mask
Definition: glext.h:6028
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
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 ss
Definition: i386-dis.c:441
#define INT_MAX
Definition: limits.h:40
_Check_return_ _CRTIMP int __cdecl ferror(_In_ FILE *_File)
_Check_return_ _CRTIMP int __cdecl getc(_Inout_ FILE *_File)
#define EOF
Definition: stdio.h:24
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fputc(_In_ int _Ch, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
const char * filename
Definition: ioapi.h:137
#define inet_aton(cp, addr)
Definition: inet.h:99
#define inet_ntoa(addr)
Definition: inet.h:100
#define INADDR_LOOPBACK
Definition: inet.h:51
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
const WCHAR * word
Definition: lex.c:36
#define c
Definition: ke_i.h:80
POINT cp
Definition: magnifier.c:59
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ntohl(x)
Definition: module.h:205
#define htonl(x)
Definition: module.h:214
#define O_NONBLOCK
Definition: port.h:158
const char * strerror(int err)
Definition: compat_str.c:23
#define ioctlsocket
Definition: ncftp.h:481
#define err(...)
#define getline
Definition: schily.h:567
#define errno
Definition: errno.h:18
_Check_return_ _CRTIMP size_t __cdecl strcspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
void adns__vbuf_init(vbuf *vb)
Definition: general.c:112
void adns__debug(adns_state ads, int serv, adns_query qu, const char *fmt,...)
Definition: general.c:86
void adns__vbuf_free(vbuf *vb)
Definition: general.c:155
void adns__diag(adns_state ads, int serv, adns_query qu, const char *fmt,...)
Definition: general.c:102
static int ctype_whitespace(int c)
Definition: internal.h:697
#define MAXSERVERS
Definition: internal.h:63
@ cc_entex
Definition: internal.h:86
#define MAXSORTLIST
Definition: internal.h:64
static void ccf_options(adns_state ads, const char *fn, int lno, const char *buf)
Definition: setup.c:221
int adns_numservers(adns_state ads)
Definition: setup.c:718
static int nextword(const char **bufp_io, const char **word_r, int *l_r)
Definition: setup.c:93
static void ccf_nameserver(adns_state ads, const char *fn, int lno, const char *buf)
Definition: setup.c:110
static int init_begin(adns_state *ads_r, adns_initflags flags, FILE *diagfile)
Definition: setup.c:471
static void ccf_search(adns_state ads, const char *fn, int lno, const char *buf)
Definition: setup.c:121
static int gl_file(adns_state ads, getline_ctx *src_io, const char *filename, int lno, char *buf, int buflen)
Definition: setup.c:293
static void saveerr(adns_state ads, int en)
Definition: setup.c:74
static void ccf_clearnss(adns_state ads, const char *fn, int lno, const char *buf)
Definition: setup.c:262
void adns_finish(adns_state ads)
Definition: setup.c:650
static void readconfig(adns_state ads, const char *filename, int warnmissing)
Definition: setup.c:406
static void readconfigenvtext(adns_state ads, const char *envvar)
Definition: setup.c:445
static const char * instrum_getenv(adns_state ads, const char *envvar)
Definition: setup.c:397
void adns_addserver(adns_state ads, struct in_addr addr)
Definition: setup.c:712
static void addserver(adns_state ads, struct in_addr addr)
Definition: setup.c:48
static void readconfigtext(adns_state ads, const char *text, const char *showname)
Definition: setup.c:427
static void init_abort(adns_state ads)
Definition: setup.c:556
int adns__setnonblock(adns_state ads, ADNS_SOCKET fd)
Definition: setup.c:457
int adns_init(adns_state *ads_r, adns_initflags flags, FILE *diagfile)
Definition: setup.c:568
static const struct configcommandinfo configcommandinfos[]
static void readconfiggeneric(adns_state ads, const char *filename, int(*getline)(adns_state ads, getline_ctx *, const char *filename, int lno, char *buf, int buflen), getline_ctx gl_ctx)
Definition: setup.c:359
static void ccf_sortlist(adns_state ads, const char *fn, int lno, const char *buf)
Definition: setup.c:150
void adns_forallqueries_begin(adns_state ads)
Definition: setup.c:671
adns_query adns_forallqueries_next(adns_state ads, void **context_r)
Definition: setup.c:680
static int init_finish(adns_state ads)
Definition: setup.c:523
static void readconfigenv(adns_state ads, const char *envvar)
Definition: setup.c:434
static int gl_text(adns_state ads, getline_ctx *src_io, const char *filename, int lno, char *buf, int buflen)
Definition: setup.c:337
static void ccf_include(adns_state ads, const char *fn, int lno, const char *buf)
Definition: setup.c:266
static void freesearchlist(adns_state ads)
Definition: setup.c:69
int adns_init_strcfg(adns_state *ads_r, adns_initflags flags, FILE *diagfile, const char *configtext)
Definition: setup.c:629
static void configparseerr(adns_state ads, const char *fn, int lno, const char *fmt,...)
Definition: setup.c:78
void adns_ccf_search(adns_state ads, const char *fn, int lno, const char *buf)
Definition: setup.c:715
static int fd
Definition: io.c:51
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
WORD wVersion
Definition: winsock.h:517
adns_query parent
Definition: internal.h:184
adns_query next
Definition: internal.h:184
qcontext ctx
Definition: internal.h:233
int nservers
Definition: internal.h:300
adns_query forallnext
Definition: internal.h:296
int searchndots
Definition: internal.h:300
int configerrno
Definition: internal.h:294
ADNS_SOCKET tcpsocket
Definition: internal.h:298
struct adns__state::sortlist sortlist[MAXSORTLIST]
int tcprecv_skip
Definition: internal.h:300
enum adns__state::adns__tcpstate tcpstate
int nextid
Definition: internal.h:297
vbuf tcprecv
Definition: internal.h:299
struct query_queue udpw tcpw childw output
Definition: internal.h:295
ADNS_SOCKET udpsocket
Definition: internal.h:298
struct timeval tcptimeout
Definition: internal.h:305
int nsearchlist
Definition: internal.h:300
struct adns__state::server servers[MAXSERVERS]
adns_initflags iflags
Definition: internal.h:292
int tcpserver
Definition: internal.h:300
vbuf tcpsend
Definition: internal.h:299
FILE * diagfile
Definition: internal.h:293
int nsortlist
Definition: internal.h:300
char ** searchlist
Definition: internal.h:322
void(* fn)(adns_state ads, const char *fn, int lno, const char *buf)
Definition: setup.c:276
const char * name
Definition: setup.c:275
Definition: fci.c:127
Definition: dsound.c:943
Definition: tcpip.h:126
u32_t s_addr
Definition: inet.h:45
void * ext
Definition: internal.h:173
#define LIST_INIT(head)
Definition: queue.h:197
#define MAKEWORD(a, b)
Definition: typedefs.h:248
FILE * file
Definition: setup.c:289
const char * text
Definition: setup.c:290
Definition: pdh_main.c:94
static rfbScreenInfoPtr server
Definition: vnc.c:74
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
#define GetWindowsDirectory
Definition: winbase.h:3792
int PASCAL FAR WSACleanup(void)
Definition: startup.c:60
#define SOCK_DGRAM
Definition: winsock.h:336
#define FIONBIO
Definition: winsock.h:149