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 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
19 |
|
|
* USA |
20 |
adx |
30 |
*/ |
21 |
|
|
|
22 |
michael |
2935 |
/*! \file irc_res.h |
23 |
|
|
* \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 |
adx |
30 |
/* Here we define some values lifted from nameser.h */ |
35 |
|
|
#define NS_NOTIFY_OP 4 |
36 |
|
|
#define NS_INT16SZ 2 |
37 |
|
|
#define NS_IN6ADDRSZ 16 |
38 |
michael |
2935 |
#define NS_INADDRSZ 4 |
39 |
adx |
30 |
#define NS_INT32SZ 4 |
40 |
|
|
#define NS_CMPRSFLGS 0xc0 |
41 |
|
|
#define NS_MAXCDNAME 255 |
42 |
|
|
#define QUERY 0 |
43 |
|
|
#define IQUERY 1 |
44 |
|
|
#define NO_ERRORS 0 |
45 |
|
|
#define SERVFAIL 2 |
46 |
db |
447 |
#define NXDOMAIN 3 |
47 |
adx |
30 |
#define T_A 1 |
48 |
|
|
#define T_AAAA 28 |
49 |
|
|
#define T_PTR 12 |
50 |
|
|
#define T_CNAME 5 |
51 |
|
|
#define T_NULL 10 |
52 |
|
|
#define C_IN 1 |
53 |
|
|
#define QFIXEDSZ 4 |
54 |
|
|
#define RRFIXEDSZ 10 |
55 |
|
|
#define HFIXEDSZ 12 |
56 |
|
|
|
57 |
|
|
|
58 |
|
|
typedef struct |
59 |
|
|
{ |
60 |
michael |
2935 |
unsigned id :16; /* query identification number */ |
61 |
adx |
30 |
#ifdef WORDS_BIGENDIAN |
62 |
michael |
2935 |
/* fields in third byte */ |
63 |
|
|
unsigned qr: 1; /* response flag */ |
64 |
|
|
unsigned opcode: 4; /* purpose of message */ |
65 |
|
|
unsigned aa: 1; /* authoritive answer */ |
66 |
|
|
unsigned tc: 1; /* truncated message */ |
67 |
|
|
unsigned rd: 1; /* recursion desired */ |
68 |
|
|
|
69 |
|
|
/* fields in fourth byte */ |
70 |
|
|
unsigned ra: 1; /* recursion available */ |
71 |
|
|
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ |
72 |
|
|
unsigned ad: 1; /* authentic data from named */ |
73 |
|
|
unsigned cd: 1; /* checking disabled by resolver */ |
74 |
|
|
unsigned rcode :4; /* response code */ |
75 |
adx |
30 |
#else |
76 |
michael |
2935 |
/* fields in third byte */ |
77 |
|
|
unsigned rd :1; /* recursion desired */ |
78 |
|
|
unsigned tc :1; /* truncated message */ |
79 |
|
|
unsigned aa :1; /* authoritive answer */ |
80 |
|
|
unsigned opcode :4; /* purpose of message */ |
81 |
|
|
unsigned qr :1; /* response flag */ |
82 |
|
|
|
83 |
|
|
/* fields in fourth byte */ |
84 |
|
|
unsigned rcode :4; /* response code */ |
85 |
|
|
unsigned cd: 1; /* checking disabled by resolver */ |
86 |
|
|
unsigned ad: 1; /* authentic data from named */ |
87 |
|
|
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ |
88 |
|
|
unsigned ra :1; /* recursion available */ |
89 |
adx |
30 |
#endif |
90 |
michael |
2935 |
/* remaining bytes */ |
91 |
|
|
unsigned qdcount :16; /* number of question entries */ |
92 |
|
|
unsigned ancount :16; /* number of answer entries */ |
93 |
|
|
unsigned nscount :16; /* number of authority entries */ |
94 |
|
|
unsigned arcount :16; /* number of resource entries */ |
95 |
adx |
30 |
} HEADER; |
96 |
|
|
|
97 |
michael |
992 |
typedef void (*dns_callback_fnc)(void *, const struct irc_ssaddr *, const char *); |
98 |
|
|
|
99 |
adx |
30 |
extern void init_resolver(void); |
100 |
|
|
extern void restart_resolver(void); |
101 |
michael |
992 |
extern void delete_resolver_queries(const void *); |
102 |
adx |
30 |
extern void report_dns_servers(struct Client *); |
103 |
michael |
992 |
extern void gethost_byname_type(dns_callback_fnc , void *, const char *, int); |
104 |
|
|
extern void gethost_byname(dns_callback_fnc, void *, const char *); |
105 |
|
|
extern void gethost_byaddr(dns_callback_fnc, void *, const struct irc_ssaddr *); |
106 |
adx |
30 |
#endif |