/[svn]/ircd-hybrid-7.2/include/irc_res.h
ViewVC logotype

Annotation of /ircd-hybrid-7.2/include/irc_res.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 447 - (hide annotations)
Sun Feb 12 02:59:16 2006 UTC (14 years, 1 month ago) by db
File MIME type: text/x-csrc
File size: 2817 byte(s)
- reported by Jon, resolver was not checking for NXDOMAIN as well as SERVFAIL
this caused odd DNS reports and took longer to connect.

Tested by Jon (ThaPrince).

(backported from head)


1 adx 30 /*
2     * include/irc_res.h for referencing functions in src/irc_res.c
3     *
4 knight 31 * $Id$
5 adx 30 */
6    
7     #ifndef INCLUDED_irc_res_h
8     #define INCLUDED_irc_res_h
9    
10     #include "listener.h"
11     #include "setup.h"
12    
13     /* Here we define some values lifted from nameser.h */
14     #define NS_NOTIFY_OP 4
15     #define NS_INT16SZ 2
16     #define NS_IN6ADDRSZ 16
17     #define NS_INADDRSZ 4
18     #define NS_INT32SZ 4
19     #define NS_CMPRSFLGS 0xc0
20     #define NS_MAXCDNAME 255
21     #define QUERY 0
22     #define IQUERY 1
23     #define NO_ERRORS 0
24     #define SERVFAIL 2
25 db 447 #define NXDOMAIN 3
26 adx 30 #define T_A 1
27     #define T_AAAA 28
28     #define T_PTR 12
29     #define T_CNAME 5
30     #define T_NULL 10
31     #define C_IN 1
32     #define QFIXEDSZ 4
33     #define RRFIXEDSZ 10
34     #define HFIXEDSZ 12
35    
36     struct DNSReply
37     {
38     char *h_name;
39     struct irc_ssaddr addr;
40     };
41    
42     struct DNSQuery
43     {
44     #ifdef _WIN32
45     dlink_node node;
46     HANDLE handle;
47     char reply[MAXGETHOSTSTRUCT];
48     #endif
49     void *ptr; /* pointer used by callback to identify request */
50     void (*callback)(void* vptr, struct DNSReply *reply); /* callback to call */
51     };
52    
53     typedef struct
54     {
55     unsigned id :16; /* query identification number */
56     #ifdef WORDS_BIGENDIAN
57     /* fields in third byte */
58     unsigned qr: 1; /* response flag */
59     unsigned opcode: 4; /* purpose of message */
60     unsigned aa: 1; /* authoritive answer */
61     unsigned tc: 1; /* truncated message */
62     unsigned rd: 1; /* recursion desired */
63     /* fields in fourth byte */
64     unsigned ra: 1; /* recursion available */
65     unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
66     unsigned ad: 1; /* authentic data from named */
67     unsigned cd: 1; /* checking disabled by resolver */
68     unsigned rcode :4; /* response code */
69     #else
70     /* fields in third byte */
71     unsigned rd :1; /* recursion desired */
72     unsigned tc :1; /* truncated message */
73     unsigned aa :1; /* authoritive answer */
74     unsigned opcode :4; /* purpose of message */
75     unsigned qr :1; /* response flag */
76     /* fields in fourth byte */
77     unsigned rcode :4; /* response code */
78     unsigned cd: 1; /* checking disabled by resolver */
79     unsigned ad: 1; /* authentic data from named */
80     unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
81     unsigned ra :1; /* recursion available */
82     #endif
83     /* remaining bytes */
84     unsigned qdcount :16; /* number of question entries */
85     unsigned ancount :16; /* number of answer entries */
86     unsigned nscount :16; /* number of authority entries */
87     unsigned arcount :16; /* number of resource entries */
88     } HEADER;
89    
90     extern void init_resolver(void);
91     extern void restart_resolver(void);
92     extern void delete_resolver_queries(const struct DNSQuery *);
93     extern void report_dns_servers(struct Client *);
94     extern void gethost_byname_type(const char *, struct DNSQuery *, int);
95     extern void gethost_byname(const char *, struct DNSQuery *);
96     extern void gethost_byaddr(const struct irc_ssaddr *, struct DNSQuery *);
97     extern void add_local_domain(char *, size_t);
98    
99     #endif

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.26