ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/res.h
Revision: 4565
Committed: Sun Aug 24 10:27:40 2014 UTC (11 years ago) by michael
Content type: text/x-chdr
File size: 4149 byte(s)
Log Message:
- Update GPL 2 license headers

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2935 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 2935 * Copyright (c) 1997-2014 ircd-hybrid development team
5     *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 michael 2935 * USA
20 adx 30 */
21    
22 michael 3322 /*! \file res.h
23 michael 2935 * \brief ircd resolver functions
24     * \version $Id$
25     */
26    
27 adx 30 #ifndef INCLUDED_irc_res_h
28     #define INCLUDED_irc_res_h
29    
30 michael 912 #include "config.h"
31 adx 30
32 michael 1011 struct Client; /* XXX */
33    
34 michael 4408
35 michael 4444 /*
36     * From RFC 1035:
37     *
38     * Domain names in messages are expressed in terms of a sequence of labels.
39     * Each label is represented as a one octet length field followed by that
40     * number of octets. Since every domain name ends with the null label of
41     * the root, a domain name is terminated by a length byte of zero. The
42     * high order two bits of every length octet must be zero, and the
43     * remaining six bits of the length field limit the label to 63 octets or
44     * less.
45     *
46     * To simplify implementations, the total length of a domain name (i.e.,
47     * label octets and label length octets) is restricted to 255 octets or
48     * less.
49     */
50 michael 4408 #define RFC1035_MAX_DOMAIN_LENGTH 255
51 michael 4444
52    
53 adx 30 /* Here we define some values lifted from nameser.h */
54     #define NS_NOTIFY_OP 4
55     #define NS_INT16SZ 2
56     #define NS_IN6ADDRSZ 16
57 michael 2935 #define NS_INADDRSZ 4
58 adx 30 #define NS_INT32SZ 4
59     #define NS_CMPRSFLGS 0xc0
60     #define NS_MAXCDNAME 255
61     #define QUERY 0
62     #define IQUERY 1
63     #define NO_ERRORS 0
64     #define SERVFAIL 2
65 db 447 #define NXDOMAIN 3
66 adx 30 #define T_A 1
67     #define T_AAAA 28
68     #define T_PTR 12
69     #define T_CNAME 5
70     #define T_NULL 10
71     #define C_IN 1
72     #define QFIXEDSZ 4
73     #define RRFIXEDSZ 10
74     #define HFIXEDSZ 12
75    
76    
77     typedef struct
78     {
79 michael 2935 unsigned id :16; /* query identification number */
80 adx 30 #ifdef WORDS_BIGENDIAN
81 michael 2935 /* fields in third byte */
82     unsigned qr: 1; /* response flag */
83     unsigned opcode: 4; /* purpose of message */
84     unsigned aa: 1; /* authoritive answer */
85     unsigned tc: 1; /* truncated message */
86     unsigned rd: 1; /* recursion desired */
87    
88     /* fields in fourth byte */
89     unsigned ra: 1; /* recursion available */
90     unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
91     unsigned ad: 1; /* authentic data from named */
92     unsigned cd: 1; /* checking disabled by resolver */
93     unsigned rcode :4; /* response code */
94 adx 30 #else
95 michael 2935 /* fields in third byte */
96     unsigned rd :1; /* recursion desired */
97     unsigned tc :1; /* truncated message */
98     unsigned aa :1; /* authoritive answer */
99     unsigned opcode :4; /* purpose of message */
100     unsigned qr :1; /* response flag */
101    
102     /* fields in fourth byte */
103     unsigned rcode :4; /* response code */
104     unsigned cd: 1; /* checking disabled by resolver */
105     unsigned ad: 1; /* authentic data from named */
106     unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
107     unsigned ra :1; /* recursion available */
108 adx 30 #endif
109 michael 2935 /* remaining bytes */
110     unsigned qdcount :16; /* number of question entries */
111     unsigned ancount :16; /* number of answer entries */
112     unsigned nscount :16; /* number of authority entries */
113     unsigned arcount :16; /* number of resource entries */
114 adx 30 } HEADER;
115    
116 michael 4408 typedef void (*dns_callback_fnc)(void *, const struct irc_ssaddr *, const char *, size_t);
117 michael 992
118 adx 30 extern void init_resolver(void);
119     extern void restart_resolver(void);
120 michael 992 extern void delete_resolver_queries(const void *);
121 adx 30 extern void report_dns_servers(struct Client *);
122 michael 992 extern void gethost_byname_type(dns_callback_fnc , void *, const char *, int);
123     extern void gethost_byaddr(dns_callback_fnc, void *, const struct irc_ssaddr *);
124 adx 30 #endif

Properties

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