Blame
Date:
Sat Aug 1 09:01:52 2020 UTC
Message:
move extended RCODE's out of the RCODE section those are only 0x00 through 0x0F make a section that shows extended RCODE's that are added to a EDNS0 tag.
001
2016-07-06
pjp
/*
002
2020-05-07
pjp
* Copyright (c) 2005-2020 Peter J. Philipp
003
2016-07-06
pjp
* All rights reserved.
004
2016-07-06
pjp
*
005
2016-07-06
pjp
* Redistribution and use in source and binary forms, with or without
006
2016-07-06
pjp
* modification, are permitted provided that the following conditions
007
2016-07-06
pjp
* are met:
008
2016-07-06
pjp
* 1. Redistributions of source code must retain the above copyright
009
2016-07-06
pjp
* notice, this list of conditions and the following disclaimer.
010
2016-07-06
pjp
* 2. Redistributions in binary form must reproduce the above copyright
011
2016-07-06
pjp
* notice, this list of conditions and the following disclaimer in the
012
2016-07-06
pjp
* documentation and/or other materials provided with the distribution.
013
2016-07-06
pjp
* 3. The name of the author may not be used to endorse or promote products
014
2016-07-06
pjp
* derived from this software without specific prior written permission
015
2016-07-06
pjp
*
016
2016-07-06
pjp
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
017
2016-07-06
pjp
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
018
2016-07-06
pjp
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
019
2016-07-06
pjp
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
020
2016-07-06
pjp
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
021
2016-07-06
pjp
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
022
2016-07-06
pjp
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
023
2016-07-06
pjp
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
024
2016-07-06
pjp
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
025
2016-07-06
pjp
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
026
2016-07-06
pjp
*
027
2016-07-06
pjp
*/
028
2017-10-26
pjp
029
2017-10-26
pjp
/*
030
2020-07-27
pjp
* $Id: ddd-db.h,v 1.51 2020/07/27 05:11:19 pjp Exp $
031
2017-10-26
pjp
*/
032
2017-10-26
pjp
033
2016-07-06
pjp
#ifndef _DB_H
034
2016-07-06
pjp
#define _DB_H
035
2016-07-06
pjp
036
2017-06-26
pjp
#include <sys/types.h>
037
2017-06-26
pjp
#include <limits.h>
038
2017-06-26
pjp
039
2019-11-02
pjp
#include <openssl/hmac.h>
040
2019-12-11
pjp
#include "ddd-config.h"
041
2019-11-02
pjp
042
2019-12-11
pjp
#ifndef DEFAULT_CONFFILE
043
2019-09-20
pjp
#define CONFFILE "/etc/delphinusdns/delphinusdns.conf"
044
2019-12-11
pjp
#else
045
2019-12-11
pjp
#define CONFFILE DEFAULT_CONFFILE
046
2019-12-11
pjp
#endif
047
2019-12-11
pjp
048
2016-07-06
pjp
#define DEFAULT_SOCKET 64
049
2016-07-06
pjp
050
2019-11-14
pjp
#define PARSEFILE_FLAG_NOSOCKET 0x1
051
2019-11-14
pjp
052
2019-11-14
pjp
053
2017-08-09
pjp
#define IMSG_HELLO_MESSAGE 0 /* hello the master process a few */
054
2017-08-09
pjp
#define IMSG_SPREAD_MESSAGE 1 /* spread a record to all childs */
055
2017-08-09
pjp
#define IMSG_XFR_MESSAGE 2 /* forward message to axfr proc */
056
2017-11-28
pjp
#define IMSG_PARSE_MESSAGE 4 /* pass message to pledge parser */
057
2017-11-28
pjp
#define IMSG_PARSEREPLY_MESSAGE 5 /* return message from pledge parser */
058
2019-01-29
pjp
#define IMSG_SHUTDOWN_MESSAGE 6 /* shut the server down */
059
2019-01-29
pjp
#define IMSG_RELOAD_MESSAGE 7 /* reload/restart the server */
060
2019-02-24
pjp
#define IMSG_PARSEAUTH_MESSAGE 8 /* parse message with auth required */
061
2019-11-04
pjp
#define IMSG_NOTIFY_MESSAGE 9 /* notify our replicant engine */
062
2020-06-25
pjp
#define IMSG_SETUP_NEURON 10 /* set up a new imsg via fd passing */
063
2020-06-25
pjp
#define IMSG_CRIPPLE_NEURON 11 /* no new neurons are needed */
064
2020-06-30
pjp
#define IMSG_FORWARD_UDP 12 /* forward a UDP packet */
065
2020-06-30
pjp
#define IMSG_FORWARD_TCP 13 /* forward a TCP packet (with fd) */
066
2020-07-08
pjp
#define IMSG_RR_ATTACHED 14 /* an RR is sent through imsg */
067
2020-07-10
pjp
#define IMSG_PARSEERROR_MESSAGE 15 /* return error message from pledge parser */
068
2017-08-09
pjp
069
2016-07-06
pjp
#define ERR_DROP 0x1
070
2016-07-06
pjp
#define ERR_NXDOMAIN 0x2
071
2016-07-06
pjp
#define ERR_NOERROR 0x4
072
2016-07-06
pjp
#define ERR_REFUSED 0x8
073
2017-01-09
pjp
#define ERR_NODATA 0x10
074
2019-10-30
pjp
#define ERR_DELEGATE 0x20
075
2020-06-30
pjp
#define ERR_FORWARD 0x40
076
2016-07-06
pjp
077
2016-07-06
pjp
#define RECORD_COUNT 20
078
2016-07-06
pjp
#define NEGATIVE_CACHE_TIME 600 /* DNS & Bind 3rd edition page 35 */
079
2016-07-06
pjp
080
2019-11-03
pjp
#ifndef DEFAULT_PRIVILEGE
081
2019-11-03
pjp
#define DEFAULT_PRIVILEGE "_ddd"
082
2019-11-03
pjp
#endif
083
2019-11-03
pjp
084
2016-07-06
pjp
/* db stuff */
085
2016-07-06
pjp
086
2016-07-06
pjp
struct dnskey {
087
2016-07-06
pjp
u_int16_t flags;
088
2016-07-06
pjp
#define DNSKEY_ZONE_KEY (1 << 7)
089
2016-07-06
pjp
#define DNSKEY_SECURE_ENTRY (1 << 15)
090
2016-07-06
pjp
u_int8_t protocol; /* must be 3 */
091
2016-07-06
pjp
u_int8_t algorithm; /* would be 5, RFC 3110 */
092
2016-07-06
pjp
char public_key[4096];
093
2016-07-06
pjp
u_int16_t publickey_len;
094
2016-07-06
pjp
} __attribute__((packed));
095
2016-07-06
pjp
096
2016-07-06
pjp
struct rrsig {
097
2016-07-06
pjp
u_int16_t type_covered;
098
2016-07-06
pjp
u_int8_t algorithm; /* usually 5, RFC3110 */
099
2016-07-06
pjp
u_int8_t labels;
100
2016-07-06
pjp
u_int32_t original_ttl;
101
2016-07-06
pjp
u_int32_t signature_expiration;
102
2016-07-06
pjp
u_int32_t signature_inception;
103
2016-07-06
pjp
u_int16_t key_tag;
104
2016-07-06
pjp
char signers_name[DNS_MAXNAME];
105
2016-07-06
pjp
u_int8_t signame_len;
106
2016-07-06
pjp
char signature[4096];
107
2016-07-06
pjp
u_int16_t signature_len;
108
2020-05-07
pjp
uint32_t ttl; /* RFC 4034 section 3, the TTL value of ... */
109
2019-02-15
pjp
int used; /* if this RRSIG is used at all */
110
2020-07-06
pjp
time_t created; /* when this was added to the cache */
111
2016-07-06
pjp
} __attribute__((packed));
112
2016-07-06
pjp
113
2019-02-15
pjp
#if 0
114
2019-02-15
pjp
struct rrsig {
115
2019-02-15
pjp
struct internal_rrsig internal[3];
116
2019-02-15
pjp
#define RRSIG_RRSET 0
117
2019-02-15
pjp
#define RRSIG_DNSKEY 1
118
2019-02-15
pjp
#define RRSIG_DS 2
119
2019-02-15
pjp
} __attribute__((packed));
120
2019-02-15
pjp
#endif
121
2019-02-15
pjp
122
2016-07-06
pjp
struct nsec {
123
2016-07-06
pjp
char next_domain_name[DNS_MAXNAME];
124
2016-07-06
pjp
u_int8_t ndn_len; /* next domain name length */
125
2016-07-06
pjp
char bitmap[8192];
126
2016-07-06
pjp
u_int16_t bitmap_len;
127
2016-07-06
pjp
} __attribute__((packed));
128
2016-07-06
pjp
129
2016-07-06
pjp
struct nsec3 {
130
2016-07-06
pjp
u_int8_t algorithm;
131
2016-07-06
pjp
u_int8_t flags;
132
2016-07-06
pjp
u_int16_t iterations;
133
2016-07-06
pjp
u_int8_t saltlen;
134
2016-07-06
pjp
char salt[256];
135
2016-07-06
pjp
char next[DNS_MAXNAME];
136
2016-07-06
pjp
u_int8_t nextlen; /* next domain name length */
137
2016-07-06
pjp
char bitmap[8192];
138
2016-07-06
pjp
u_int16_t bitmap_len;
139
2016-07-06
pjp
} __attribute__((packed));
140
2016-07-06
pjp
141
2016-07-06
pjp
struct nsec3param {
142
2016-07-06
pjp
u_int8_t algorithm;
143
2016-07-06
pjp
u_int8_t flags;
144
2016-07-06
pjp
u_int16_t iterations;
145
2016-07-06
pjp
u_int8_t saltlen;
146
2016-07-06
pjp
char salt[256];
147
2016-07-06
pjp
} __attribute__((packed));
148
2016-07-06
pjp
149
2016-07-06
pjp
struct ds {
150
2016-07-06
pjp
u_int16_t key_tag;
151
2016-07-06
pjp
u_int8_t algorithm;
152
2016-07-06
pjp
u_int8_t digest_type;
153
2016-07-06
pjp
char digest[4096];
154
2016-07-06
pjp
u_int16_t digestlen;
155
2016-07-06
pjp
} __attribute__((packed));
156
2016-07-06
pjp
157
2016-07-06
pjp
158
2016-07-06
pjp
struct soa {
159
2016-07-06
pjp
char nsserver[DNS_MAXNAME];
160
2016-07-06
pjp
u_int8_t nsserver_len;
161
2016-07-06
pjp
char responsible_person[DNS_MAXNAME];
162
2016-07-06
pjp
u_int8_t rp_len;
163
2016-07-06
pjp
u_int32_t serial;
164
2016-07-06
pjp
u_int32_t refresh;
165
2016-07-06
pjp
u_int32_t retry;
166
2016-07-06
pjp
u_int32_t expire;
167
2016-07-06
pjp
u_int32_t minttl;
168
2016-07-06
pjp
} __attribute__((packed));
169
2016-07-06
pjp
170
2016-07-06
pjp
struct smx {
171
2016-07-06
pjp
u_int16_t preference; /* MX preference */
172
2016-07-06
pjp
char exchange[DNS_MAXNAME]; /* name of exchange server */
173
2016-07-06
pjp
int exchangelen; /* length of exchange server name */
174
2016-07-06
pjp
} __attribute__((packed));
175
2016-07-06
pjp
176
2016-07-06
pjp
struct ns {
177
2016-07-06
pjp
char nsserver[DNS_MAXNAME]; /* NS name */
178
2016-07-06
pjp
int nslen; /* length of NS */
179
2019-02-15
pjp
int ns_type; /* set if it's a delegation */
180
2019-02-15
pjp
#define NS_TYPE_DELEGATE 0x1
181
2019-02-15
pjp
#define NS_TYPE_HINT 0x2
182
2019-02-15
pjp
183
2016-07-06
pjp
} __attribute__((packed));
184
2016-07-06
pjp
185
2016-07-06
pjp
struct srv {
186
2016-07-06
pjp
u_int16_t priority; /* SRV 16 bit priority */
187
2016-07-06
pjp
u_int16_t weight; /* 16 bit weight */
188
2016-07-06
pjp
u_int16_t port; /* 16 bit port */
189
2016-07-06
pjp
char target[DNS_MAXNAME]; /* SRV target name */
190
2016-07-06
pjp
int targetlen; /* SRV target name length */
191
2016-07-06
pjp
} __attribute__((packed));
192
2016-07-06
pjp
193
2016-07-06
pjp
struct sshfp {
194
2016-07-06
pjp
u_int8_t algorithm; /* SSHFP algorithm */
195
2016-07-06
pjp
u_int8_t fptype; /* SSHFP fingerprint type */
196
2016-07-06
pjp
char fingerprint[DNS_MAXNAME]; /* fingerprint */
197
2016-07-06
pjp
int fplen; /* fingerprint length */
198
2016-07-06
pjp
} __attribute__((packed));
199
2016-07-06
pjp
200
2016-07-06
pjp
struct tlsa {
201
2016-07-06
pjp
u_int8_t usage; /* TLSA usage */
202
2016-07-06
pjp
u_int8_t selector; /* TLSA selector */
203
2016-07-06
pjp
u_int8_t matchtype; /* TLSA matching type */
204
2016-07-06
pjp
char data[DNS_MAXNAME]; /* TLSA data */
205
2016-07-06
pjp
int datalen; /* data length */
206
2016-07-06
pjp
} __attribute__((packed));
207
2016-07-06
pjp
208
2016-07-06
pjp
struct naptr {
209
2016-07-06
pjp
u_int16_t order; /* NAPTR 16 bit order */
210
2016-07-06
pjp
u_int16_t preference; /* 16 bit preference */
211
2016-07-06
pjp
char flags[DNS_MAXNAME]; /* flags 255 bytes */
212
2016-07-06
pjp
int flagslen; /* flags length */
213
2016-07-06
pjp
char services[DNS_MAXNAME]; /* services */
214
2016-07-06
pjp
int serviceslen; /* services length */
215
2016-07-06
pjp
char regexp[DNS_MAXNAME]; /* regexp */
216
2016-07-06
pjp
int regexplen; /* regexp len */
217
2016-07-06
pjp
char replacement[DNS_MAXNAME]; /* replacement this is a domain */
218
2016-07-06
pjp
int replacementlen;
219
2016-07-06
pjp
} __attribute__((packed));
220
2016-07-06
pjp
221
2019-02-15
pjp
struct cname {
222
2019-02-15
pjp
char cname[DNS_MAXNAME]; /* CNAME RR */
223
2019-02-15
pjp
int cnamelen; /* len of CNAME */
224
2016-07-06
pjp
} __attribute__((packed));
225
2016-07-06
pjp
226
2019-02-15
pjp
struct ptr {
227
2019-02-15
pjp
char ptr[DNS_MAXNAME]; /* PTR RR */
228
2019-02-15
pjp
int ptrlen; /* len of PTR */
229
2016-07-06
pjp
} __attribute__((packed));
230
2016-07-06
pjp
231
2019-02-15
pjp
struct txt {
232
2019-04-30
pjp
char txt[1024]; /* TXT string */
233
2019-02-15
pjp
int txtlen; /* len of TXT */
234
2016-07-06
pjp
} __attribute__((packed));
235
2016-07-06
pjp
236
2020-07-20
pjp
struct hinfo {
237
2020-07-20
pjp
char cpu[255];
238
2020-07-20
pjp
int cpulen;
239
2020-07-20
pjp
char os[255];
240
2020-07-20
pjp
int oslen;
241
2020-07-20
pjp
} __attribute__((packed));
242
2020-07-20
pjp
243
2020-07-20
pjp
struct rp {
244
2020-07-20
pjp
char mbox[DNS_MAXNAME];
245
2020-07-20
pjp
int mboxlen;
246
2020-07-20
pjp
char txt[DNS_MAXNAME];
247
2020-07-20
pjp
int txtlen;
248
2020-07-20
pjp
} __attribute__((packed));
249
2020-07-20
pjp
250
2020-07-20
pjp
struct caa {
251
2020-07-20
pjp
uint8_t flags;
252
2020-07-20
pjp
char tag[DNS_MAXNAME];
253
2020-07-20
pjp
int taglen;
254
2020-07-20
pjp
char value[1024]; /* something reasonable, could be 65000! */
255
2020-07-20
pjp
int valuelen;
256
2020-07-20
pjp
} __attribute__((packed));
257
2020-07-20
pjp
258
2019-02-15
pjp
struct a {
259
2019-02-15
pjp
in_addr_t a; /* IP addresses */
260
2016-07-06
pjp
} __attribute__((packed));
261
2016-07-06
pjp
262
2019-02-15
pjp
struct aaaa {
263
2019-02-15
pjp
struct in6_addr aaaa; /* IPv6 addresses */
264
2016-07-06
pjp
} __attribute__((packed));
265
2016-07-06
pjp
266
2016-07-06
pjp
267
2016-07-06
pjp
268
2016-07-06
pjp
struct sreply {
269
2016-07-06
pjp
int so; /* socket */
270
2016-07-06
pjp
char *buf; /* question packet */
271
2016-07-06
pjp
int len; /* question packet length */
272
2016-07-06
pjp
struct question *q; /* struct question */
273
2016-07-06
pjp
struct sockaddr *sa; /* struct sockaddr of question */
274
2016-07-06
pjp
int salen; /* length of struct sockaddr */
275
2019-02-15
pjp
struct rbtree *rbt1; /* first resolved domain */
276
2019-02-15
pjp
struct rbtree *rbt2; /* CNAME to second resolved domain */
277
2016-07-06
pjp
u_int8_t region; /* region of question */
278
2016-07-06
pjp
int istcp; /* when set it's tcp */
279
2016-07-06
pjp
int wildcard; /* wildcarding boolean */
280
2016-07-06
pjp
char *replybuf; /* reply buffer */
281
2016-07-06
pjp
};
282
2016-07-06
pjp
283
2017-06-26
pjp
284
2019-01-29
pjp
/* ddd command socket */
285
2017-06-26
pjp
286
2019-01-29
pjp
#define SOCKPATH "/var/run/delphinusdnsd.sock"
287
2019-01-29
pjp
struct dddcomm {
288
2019-01-29
pjp
int command;
289
2019-01-29
pjp
union {
290
2019-01-29
pjp
pid_t rpid;
291
2019-01-29
pjp
} ret;
292
2016-07-06
pjp
};
293
2016-07-06
pjp
294
2016-07-06
pjp
295
2017-06-26
pjp
typedef struct {
296
2017-06-26
pjp
size_t size;
297
2017-06-26
pjp
char *data;
298
2017-06-26
pjp
} ddDBT;
299
2016-07-06
pjp
300
2019-02-19
pjp
struct node {
301
2019-02-19
pjp
RB_ENTRY(node) rbentry; /* the node entry */
302
2019-02-19
pjp
char domainname[DNS_MAXNAME + 1]; /* domain name key name */
303
2019-02-19
pjp
int len; /* length of domain name */
304
2019-02-19
pjp
char *data; /* data it points to */
305
2019-02-19
pjp
size_t datalen; /* the length of the data */
306
2019-02-19
pjp
};
307
2019-02-19
pjp
308
2019-02-19
pjp
309
2019-02-19
pjp
extern int domaincmp(struct node *e1, struct node *e2);
310
2019-02-19
pjp
311
2019-02-19
pjp
RB_HEAD(domaintree, node);
312
2019-02-19
pjp
RB_GENERATE_STATIC(domaintree, node, rbentry, domaincmp)
313
2017-06-26
pjp
typedef struct __dddb {
314
2017-06-26
pjp
int (*put)(struct __dddb *, ddDBT *, ddDBT *);
315
2017-06-26
pjp
int (*get)(struct __dddb *, ddDBT *, ddDBT *);
316
2017-06-26
pjp
int (*close)(struct __dddb *);
317
2017-06-26
pjp
int (*remove)(struct __dddb *, ddDBT *);
318
2017-06-26
pjp
size_t offset;
319
2017-06-26
pjp
size_t size;
320
2017-06-26
pjp
char *nodes;
321
2019-02-19
pjp
struct domaintree head;
322
2017-06-26
pjp
} ddDB;
323
2016-07-06
pjp
324
2016-07-06
pjp
325
2019-02-15
pjp
struct rr {
326
2019-02-15
pjp
void *rdata;
327
2020-07-15
pjp
uint16_t rdlen;
328
2019-02-15
pjp
time_t changed;
329
2019-02-15
pjp
TAILQ_ENTRY(rr) entries;
330
2019-02-15
pjp
};
331
2016-07-06
pjp
332
2019-02-15
pjp
struct rrset {
333
2019-02-15
pjp
u_int16_t rrtype;
334
2020-05-07
pjp
u_int32_t ttl;
335
2020-07-06
pjp
time_t created;
336
2019-02-15
pjp
TAILQ_ENTRY(rrset) entries;
337
2019-02-15
pjp
TAILQ_HEAD(rrh, rr) rr_head;
338
2016-07-06
pjp
};
339
2016-07-06
pjp
340
2019-02-15
pjp
341
2019-02-15
pjp
struct rbtree {
342
2019-02-15
pjp
char zone[DNS_MAXNAME];
343
2019-02-15
pjp
int zonelen;
344
2019-02-15
pjp
char humanname[DNS_MAXNAME + 1];
345
2019-11-11
pjp
uint32_t flags; /* 32 bit flags */
346
2019-02-15
pjp
347
2019-11-11
pjp
#define RBT_DNSSEC 0x1 /* this rbtree entry is of type DNSSEC */
348
2019-11-11
pjp
#define RBT_APEX 0x2 /* this rbtree entry is the apex of zone */
349
2019-11-11
pjp
#define RBT_GLUE 0x4 /* this rbtree entry is GLUE data */
350
2019-11-11
pjp
351
2019-11-11
pjp
352
2020-07-08
pjp
TAILQ_HEAD(rrseth, rrset) rrset_head;
353
2019-02-15
pjp
};
354
2019-02-15
pjp
355
2019-02-07
pjp
struct rrtab {
356
2019-02-07
pjp
char *name;
357
2019-02-07
pjp
u_int16_t type;
358
2019-02-15
pjp
u_int16_t internal_type;
359
2019-02-07
pjp
};
360
2019-02-07
pjp
361
2019-02-07
pjp
362
2016-07-06
pjp
struct cfg {
363
2016-07-06
pjp
int udp[DEFAULT_SOCKET]; /* udp sockets */
364
2016-07-06
pjp
int tcp[DEFAULT_SOCKET]; /* tcp socket */
365
2016-07-06
pjp
int axfr[DEFAULT_SOCKET]; /* axfr udp socket */
366
2016-07-06
pjp
char *ident[DEFAULT_SOCKET]; /* identification of interface */
367
2020-07-21
pjp
struct sockaddr_storage ss[DEFAULT_SOCKET]; /* some addr storage */
368
2017-08-09
pjp
struct my_imsg {
369
2017-08-09
pjp
int imsg_fds[2];
370
2017-08-09
pjp
} my_imsg[100];
371
2020-06-25
pjp
#define MY_IMSG_CORTEX 0
372
2020-06-25
pjp
#define MY_IMSG_AXFR 1
373
2020-06-25
pjp
#define MY_IMSG_TCP 2
374
2020-06-25
pjp
#define MY_IMSG_PARSER 3
375
2020-06-25
pjp
#define MY_IMSG_RAXFR 4
376
2020-06-25
pjp
#define MY_IMSG_MASTER 5
377
2020-06-25
pjp
#define MY_IMSG_UNIXCONTROL 6
378
2020-06-25
pjp
#define MY_IMSG_UDP 7
379
2020-06-30
pjp
#define MY_IMSG_FORWARD 8
380
2020-06-30
pjp
#define MY_IMSG_MAX 9
381
2020-07-21
pjp
int raw[2];
382
2020-07-21
pjp
#define RAW_IPSOCKET 0
383
2020-07-21
pjp
#define RAW_IP6SOCKET 1
384
2020-07-21
pjp
u_short port;
385
2016-07-06
pjp
int sockcount; /* set sockets */
386
2017-12-26
pjp
int nth;
387
2017-12-26
pjp
pid_t pid;
388
2020-07-10
pjp
char *shptr; /* shared memory 1 */
389
2020-07-11
pjp
size_t shptrsize;
390
2020-07-10
pjp
char *shptr2; /* shared memory 2 */
391
2020-07-11
pjp
size_t shptr2size;
392
2020-07-10
pjp
char *shptr3; /* shared memory 3 */
393
2020-07-11
pjp
size_t shptr3size;
394
2017-06-26
pjp
ddDB *db; /* database */
395
2016-07-06
pjp
};
396
2017-06-26
pjp
397
2016-07-06
pjp
398
2017-06-26
pjp
ddDB * dddbopen(void);
399
2017-06-26
pjp
int dddbget(ddDB *, ddDBT *, ddDBT *);
400
2017-06-26
pjp
int dddbput(ddDB *, ddDBT *, ddDBT *);
401
2017-06-26
pjp
int dddbclose(ddDB *);
402
2017-06-26
pjp
403
2017-06-26
pjp
#define DDDB_NOTFOUND (-1)
404
2017-06-26
pjp
405
2019-11-14
pjp
int parse_file(ddDB *db, char *, uint32_t);
406
2017-06-26
pjp
ddDB * opendatabase(ddDB *);
407
2017-06-26
pjp
408
2019-02-07
pjp
/* dig stuff */
409
2019-02-07
pjp
410
2019-02-07
pjp
#define BIND_FORMAT 0x1
411
2019-02-07
pjp
#define INDENT_FORMAT 0x2
412
2019-02-07
pjp
#define ZONE_FORMAT 0x4
413
2019-02-07
pjp
#define DNSSEC_FORMAT 0x8
414
2019-02-07
pjp
#define TCP_FORMAT 0x10
415
2019-06-26
pjp
416
2019-06-26
pjp
/* mzone */
417
2019-06-26
pjp
struct mzone_dest {
418
2019-06-26
pjp
struct sockaddr_storage notifydest;
419
2019-06-26
pjp
SLIST_ENTRY(mzone_dest) entries;
420
2019-06-26
pjp
int notified;
421
2019-06-26
pjp
char requestmac[32];
422
2019-06-26
pjp
char *tsigkey;
423
2019-07-09
pjp
u_int16_t port;
424
2019-06-26
pjp
};
425
2019-06-26
pjp
426
2019-06-26
pjp
struct mzone {
427
2019-06-26
pjp
SLIST_ENTRY(mzone) mzone_entry;
428
2019-06-26
pjp
char *zonename;
429
2019-06-26
pjp
int zonenamelen;
430
2019-06-26
pjp
char *humanname;
431
2019-06-26
pjp
struct sockaddr_storage notifybind;
432
2019-06-26
pjp
SLIST_HEAD(,mzone_dest) dest;
433
2019-06-26
pjp
} *mz, *mz0;
434
2019-11-01
pjp
435
2019-12-11
pjp
#ifndef DEFAULT_RZONE_DIR
436
2019-11-01
pjp
#define DELPHINUS_RZONE_PATH "/etc/delphinusdns/replicant"
437
2019-12-11
pjp
#else
438
2019-12-11
pjp
#define DELPHINUS_RZONE_PATH DEFAULT_RZONE_DIR
439
2019-12-11
pjp
#endif
440
2019-11-01
pjp
441
2020-07-27
pjp
struct soa_constraints {
442
2020-07-27
pjp
uint32_t refresh;
443
2020-07-27
pjp
uint32_t retry;
444
2020-07-27
pjp
uint32_t expire;
445
2020-07-27
pjp
};
446
2020-07-27
pjp
447
2019-11-01
pjp
struct rzone {
448
2019-11-01
pjp
SLIST_ENTRY(rzone) rzone_entry;
449
2019-11-01
pjp
int active;
450
2019-11-01
pjp
char *zonename;
451
2019-11-04
pjp
char *zone;
452
2019-11-04
pjp
int zonelen;
453
2019-11-01
pjp
u_int16_t masterport;
454
2019-11-01
pjp
char *master;
455
2019-11-01
pjp
struct sockaddr_storage storage;
456
2019-11-01
pjp
char *tsigkey;
457
2019-11-01
pjp
char *filename;
458
2020-07-27
pjp
struct soa soa;
459
2020-07-27
pjp
struct soa_constraints constraints;
460
2019-11-01
pjp
} *rz, *rz0;
461
2019-11-01
pjp
462
2019-11-02
pjp
struct raxfr_logic {
463
2019-11-02
pjp
int rrtype;
464
2019-11-02
pjp
int dnssec;
465
2020-07-08
pjp
int (*raxfr)(FILE *, u_char *, u_char *, u_char *, struct soa *, u_int16_t, HMAC_CTX *);
466
2019-11-02
pjp
};
467
2020-07-06
pjp
468
2020-07-08
pjp
struct scache {
469
2020-07-08
pjp
u_char *payload;
470
2020-07-08
pjp
u_char *estart;
471
2020-07-08
pjp
u_char *end;
472
2020-07-08
pjp
uint16_t rdlen;
473
2020-07-08
pjp
char *name;
474
2020-07-08
pjp
int namelen;
475
2020-07-08
pjp
uint32_t dnsttl;
476
2020-07-08
pjp
uint16_t rrtype;
477
2020-07-18
pjp
int authentic;
478
2020-07-08
pjp
struct imsgbuf *imsgbuf;
479
2020-07-10
pjp
struct imsgbuf *bimsgbuf;
480
2020-07-12
pjp
struct cfg *cfg;
481
2020-07-08
pjp
};
482
2020-07-06
pjp
483
2020-07-08
pjp
struct cache_logic {
484
2020-07-08
pjp
int rrtype;
485
2020-07-08
pjp
int dnssec;
486
2020-07-08
pjp
int (*cacheit)(struct scache *);
487
2020-07-08
pjp
};
488
2020-07-08
pjp
489
2020-07-06
pjp
/* reply logic */
490
2020-07-06
pjp
491
2020-07-06
pjp
struct reply_logic {
492
2020-07-06
pjp
int rrtype;
493
2020-07-06
pjp
int type0;
494
2020-07-06
pjp
int buildtype;
495
2020-07-06
pjp
#define BUILD_CNAME 1
496
2020-07-06
pjp
#define BUILD_OTHER 2
497
2020-07-21
pjp
int (*reply)(struct sreply *, int *, ddDB *);
498
2020-07-06
pjp
};
499
2020-07-06
pjp
500
2020-07-06
pjp
501
2020-07-06
pjp
#ifndef MIN
502
2020-07-06
pjp
#define MIN(a,b) (((a) < (b))?(a):(b))
503
2020-07-06
pjp
#endif
504
2020-07-06
pjp
505
2020-07-10
pjp
struct sf_imsg {
506
2020-07-12
pjp
union {
507
2020-07-12
pjp
struct {
508
2020-07-12
pjp
int read; /* 4 */
509
2020-07-12
pjp
int len; /* 8 */
510
2020-07-12
pjp
char pad[10]; /* 18 */
511
2020-07-12
pjp
struct sforward sf; /* 924 */
512
2020-07-12
pjp
} s;
513
2020-07-12
pjp
514
2020-07-12
pjp
char pad[1024];
515
2020-07-12
pjp
} u;
516
2020-07-12
pjp
#define sfi_sf u.s.sf
517
2020-07-10
pjp
};
518
2020-07-10
pjp
519
2020-07-08
pjp
struct rr_imsg {
520
2020-07-08
pjp
union {
521
2020-07-10
pjp
struct {
522
2020-07-12
pjp
int read; /* 4 */
523
2020-07-12
pjp
int len; /* 8 */
524
2020-07-12
pjp
char pad[12]; /* 20 */
525
2020-07-10
pjp
526
2020-07-12
pjp
struct {
527
2020-07-12
pjp
char name[DNS_MAXNAME + 1]; /* 256 */
528
2020-07-12
pjp
int namelen; /* 260 */
529
2020-07-12
pjp
uint16_t rrtype; /* 262 */
530
2020-07-12
pjp
uint32_t ttl; /* 266 */
531
2020-07-18
pjp
int authentic;
532
2020-07-12
pjp
533
2020-07-18
pjp
uint16_t buflen;
534
2020-07-10
pjp
535
2020-07-12
pjp
char un[0];
536
2020-07-18
pjp
} rr;
537
2020-07-12
pjp
} s;
538
2020-07-12
pjp
539
2020-07-10
pjp
char pad[8192];
540
2020-07-12
pjp
} u;
541
2020-07-12
pjp
#define rri_rr u.s.rr
542
2020-07-08
pjp
}; /* end of struct rr_imsg */
543
2020-07-08
pjp
544
2020-07-14
pjp
struct pkt_imsg {
545
2020-07-14
pjp
union {
546
2020-07-14
pjp
struct {
547
2020-07-14
pjp
int read;
548
2020-07-14
pjp
int rc;
549
2020-07-14
pjp
int istcp;
550
2020-07-14
pjp
int cache;
551
2020-07-14
pjp
int tsigcheck;
552
2020-07-14
pjp
struct tsig tsig;
553
2020-07-14
pjp
char mac[32];
554
2020-07-14
pjp
int buflen;
555
2020-07-14
pjp
char buf[0];
556
2020-07-14
pjp
} s;
557
2020-07-10
pjp
558
2020-07-14
pjp
char buf[16384];
559
2020-07-14
pjp
} u;
560
2020-07-14
pjp
#define pkt_s u.s
561
2020-07-14
pjp
}; /* 16384 */
562
2020-07-10
pjp
563
2020-07-10
pjp
564
2020-07-10
pjp
#define SHAREDMEMSIZE 400
565
2020-07-10
pjp
#define SHAREDMEMSIZE3 200
566
2016-07-06
pjp
567
2016-07-06
pjp
#endif /* _DB_H */
repomaster@centroid.eu