ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/res.h
Revision: 5347
Committed: Sun Jan 11 12:42:20 2015 UTC (10 years, 7 months ago) by michael
Content type: text/x-chdr
File size: 4149 byte(s)
Log Message:
- Update copyright years

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2015 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 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file res.h
23 * \brief ircd resolver functions
24 * \version $Id$
25 */
26
27 #ifndef INCLUDED_irc_res_h
28 #define INCLUDED_irc_res_h
29
30 #include "config.h"
31
32 struct Client; /* XXX */
33
34
35 /*
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 #define RFC1035_MAX_DOMAIN_LENGTH 255
51
52
53 /* 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 #define NS_INADDRSZ 4
58 #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 #define NXDOMAIN 3
66 #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 unsigned id :16; /* query identification number */
80 #ifdef WORDS_BIGENDIAN
81 /* 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 #else
95 /* 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 #endif
109 /* 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 } HEADER;
115
116 typedef void (*dns_callback_fnc)(void *, const struct irc_ssaddr *, const char *, size_t);
117
118 extern void init_resolver(void);
119 extern void restart_resolver(void);
120 extern void delete_resolver_queries(const void *);
121 extern void report_dns_servers(struct Client *);
122 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 #endif

Properties

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