ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/res.h
Revision: 7006
Committed: Fri Jan 1 00:07:54 2016 UTC (9 years, 7 months ago) by michael
Content type: text/x-chdr
File size: 4065 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-2016 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_res_h
28 #define INCLUDED_res_h
29
30 #include "config.h"
31
32 /*
33 * From RFC 1035:
34 *
35 * Domain names in messages are expressed in terms of a sequence of labels.
36 * Each label is represented as a one octet length field followed by that
37 * number of octets. Since every domain name ends with the null label of
38 * the root, a domain name is terminated by a length byte of zero. The
39 * high order two bits of every length octet must be zero, and the
40 * remaining six bits of the length field limit the label to 63 octets or
41 * less.
42 *
43 * To simplify implementations, the total length of a domain name (i.e.,
44 * label octets and label length octets) is restricted to 255 octets or
45 * less.
46 */
47 #define RFC1035_MAX_DOMAIN_LENGTH 255
48
49
50 /* Here we define some values lifted from nameser.h */
51 #define NS_NOTIFY_OP 4
52 #define NS_INT16SZ 2
53 #define NS_IN6ADDRSZ 16
54 #define NS_INADDRSZ 4
55 #define NS_INT32SZ 4
56 #define NS_CMPRSFLGS 0xc0
57 #define NS_MAXCDNAME 255
58 #define QUERY 0
59 #define IQUERY 1
60 #define NO_ERRORS 0
61 #define SERVFAIL 2
62 #define NXDOMAIN 3
63 #define T_A 1
64 #define T_AAAA 28
65 #define T_PTR 12
66 #define T_CNAME 5
67 #define T_NULL 10
68 #define C_IN 1
69 #define QFIXEDSZ 4
70 #define RRFIXEDSZ 10
71 #define HFIXEDSZ 12
72
73
74 typedef struct
75 {
76 unsigned id :16; /* query identification number */
77 #ifdef WORDS_BIGENDIAN
78 /* fields in third byte */
79 unsigned qr: 1; /* response flag */
80 unsigned opcode: 4; /* purpose of message */
81 unsigned aa: 1; /* authoritive answer */
82 unsigned tc: 1; /* truncated message */
83 unsigned rd: 1; /* recursion desired */
84
85 /* fields in fourth byte */
86 unsigned ra: 1; /* recursion available */
87 unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
88 unsigned ad: 1; /* authentic data from named */
89 unsigned cd: 1; /* checking disabled by resolver */
90 unsigned rcode :4; /* response code */
91 #else
92 /* fields in third byte */
93 unsigned rd :1; /* recursion desired */
94 unsigned tc :1; /* truncated message */
95 unsigned aa :1; /* authoritive answer */
96 unsigned opcode :4; /* purpose of message */
97 unsigned qr :1; /* response flag */
98
99 /* fields in fourth byte */
100 unsigned rcode :4; /* response code */
101 unsigned cd: 1; /* checking disabled by resolver */
102 unsigned ad: 1; /* authentic data from named */
103 unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
104 unsigned ra :1; /* recursion available */
105 #endif
106 /* remaining bytes */
107 unsigned qdcount :16; /* number of question entries */
108 unsigned ancount :16; /* number of answer entries */
109 unsigned nscount :16; /* number of authority entries */
110 unsigned arcount :16; /* number of resource entries */
111 } HEADER;
112
113 typedef void (*dns_callback_fnc)(void *, const struct irc_ssaddr *, const char *, size_t);
114
115 extern void init_resolver(void);
116 extern void restart_resolver(void);
117 extern void delete_resolver_queries(const void *);
118 extern void gethost_byname_type(dns_callback_fnc , void *, const char *, int);
119 extern void gethost_byaddr(dns_callback_fnc, void *, const struct irc_ssaddr *);
120 #endif

Properties

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