Blame
Date:
Thu Sep 10 14:45:56 2020 UTC
Message:
I want to stick with ldns-verify-zone
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-09-06
pjp
* $Id: ddd-db.h,v 1.54 2020/09/06 07:38:00 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
2020-09-06
pjp
#define CONFFILE "/var/delphinusdnsd/etc/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
2020-08-08
pjp
};
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
2020-08-08
pjp
};
112
2016-07-06
pjp
113
2016-07-06
pjp
struct nsec {
114
2016-07-06
pjp
char next_domain_name[DNS_MAXNAME];
115
2016-07-06
pjp
u_int8_t ndn_len; /* next domain name length */
116
2016-07-06
pjp
char bitmap[8192];
117
2016-07-06
pjp
u_int16_t bitmap_len;
118
2020-08-08
pjp
};
119
2016-07-06
pjp
120
2016-07-06
pjp
struct nsec3 {
121
2016-07-06
pjp
u_int8_t algorithm;
122
2016-07-06
pjp
u_int8_t flags;
123
2016-07-06
pjp
u_int16_t iterations;
124
2016-07-06
pjp
u_int8_t saltlen;
125
2016-07-06
pjp
char salt[256];
126
2016-07-06
pjp
char next[DNS_MAXNAME];
127
2016-07-06
pjp
u_int8_t nextlen; /* next domain name length */
128
2016-07-06
pjp
char bitmap[8192];
129
2016-07-06
pjp
u_int16_t bitmap_len;
130
2020-08-08
pjp
};
131
2016-07-06
pjp
132
2016-07-06
pjp
struct nsec3param {
133
2016-07-06
pjp
u_int8_t algorithm;
134
2016-07-06
pjp
u_int8_t flags;
135
2016-07-06
pjp
u_int16_t iterations;
136
2016-07-06
pjp
u_int8_t saltlen;
137
2016-07-06
pjp
char salt[256];
138
2020-08-08
pjp
};
139
2016-07-06
pjp
140
2016-07-06
pjp
struct ds {
141
2016-07-06
pjp
u_int16_t key_tag;
142
2016-07-06
pjp
u_int8_t algorithm;
143
2016-07-06
pjp
u_int8_t digest_type;
144
2016-07-06
pjp
char digest[4096];
145
2016-07-06
pjp
u_int16_t digestlen;
146
2020-08-08
pjp
};
147
2016-07-06
pjp
148
2016-07-06
pjp
149
2016-07-06
pjp
struct soa {
150
2016-07-06
pjp
char nsserver[DNS_MAXNAME];
151
2016-07-06
pjp
u_int8_t nsserver_len;
152
2016-07-06
pjp
char responsible_person[DNS_MAXNAME];
153
2016-07-06
pjp
u_int8_t rp_len;
154
2016-07-06
pjp
u_int32_t serial;
155
2016-07-06
pjp
u_int32_t refresh;
156
2016-07-06
pjp
u_int32_t retry;
157
2016-07-06
pjp
u_int32_t expire;
158
2016-07-06
pjp
u_int32_t minttl;
159
2020-08-08
pjp
};
160
2016-07-06
pjp
161
2016-07-06
pjp
struct smx {
162
2016-07-06
pjp
u_int16_t preference; /* MX preference */
163
2016-07-06
pjp
char exchange[DNS_MAXNAME]; /* name of exchange server */
164
2016-07-06
pjp
int exchangelen; /* length of exchange server name */
165
2020-08-08
pjp
};
166
2016-07-06
pjp
167
2016-07-06
pjp
struct ns {
168
2016-07-06
pjp
char nsserver[DNS_MAXNAME]; /* NS name */
169
2016-07-06
pjp
int nslen; /* length of NS */
170
2019-02-15
pjp
int ns_type; /* set if it's a delegation */
171
2019-02-15
pjp
#define NS_TYPE_DELEGATE 0x1
172
2019-02-15
pjp
#define NS_TYPE_HINT 0x2
173
2016-07-06
pjp
174
2020-08-08
pjp
};
175
2019-02-15
pjp
176
2016-07-06
pjp
struct srv {
177
2016-07-06
pjp
u_int16_t priority; /* SRV 16 bit priority */
178
2016-07-06
pjp
u_int16_t weight; /* 16 bit weight */
179
2016-07-06
pjp
u_int16_t port; /* 16 bit port */
180
2016-07-06
pjp
char target[DNS_MAXNAME]; /* SRV target name */
181
2016-07-06
pjp
int targetlen; /* SRV target name length */
182
2020-08-08
pjp
};
183
2016-07-06
pjp
184
2016-07-06
pjp
struct sshfp {
185
2016-07-06
pjp
u_int8_t algorithm; /* SSHFP algorithm */
186
2016-07-06
pjp
u_int8_t fptype; /* SSHFP fingerprint type */
187
2016-07-06
pjp
char fingerprint[DNS_MAXNAME]; /* fingerprint */
188
2016-07-06
pjp
int fplen; /* fingerprint length */
189
2020-08-08
pjp
};
190
2016-07-06
pjp
191
2016-07-06
pjp
struct tlsa {
192
2016-07-06
pjp
u_int8_t usage; /* TLSA usage */
193
2016-07-06
pjp
u_int8_t selector; /* TLSA selector */
194
2016-07-06
pjp
u_int8_t matchtype; /* TLSA matching type */
195
2016-07-06
pjp
char data[DNS_MAXNAME]; /* TLSA data */
196
2016-07-06
pjp
int datalen; /* data length */
197
2020-08-08
pjp
};
198
2016-07-06
pjp
199
2016-07-06
pjp
struct naptr {
200
2016-07-06
pjp
u_int16_t order; /* NAPTR 16 bit order */
201
2016-07-06
pjp
u_int16_t preference; /* 16 bit preference */
202
2016-07-06
pjp
char flags[DNS_MAXNAME]; /* flags 255 bytes */
203
2016-07-06
pjp
int flagslen; /* flags length */
204
2016-07-06
pjp
char services[DNS_MAXNAME]; /* services */
205
2016-07-06
pjp
int serviceslen; /* services length */
206
2016-07-06
pjp
char regexp[DNS_MAXNAME]; /* regexp */
207
2016-07-06
pjp
int regexplen; /* regexp len */
208
2016-07-06
pjp
char replacement[DNS_MAXNAME]; /* replacement this is a domain */
209
2016-07-06
pjp
int replacementlen;
210
2020-08-08
pjp
};
211
2016-07-06
pjp
212
2019-02-15
pjp
struct cname {
213
2019-02-15
pjp
char cname[DNS_MAXNAME]; /* CNAME RR */
214
2019-02-15
pjp
int cnamelen; /* len of CNAME */
215
2020-08-08
pjp
};
216
2016-07-06
pjp
217
2019-02-15
pjp
struct ptr {
218
2019-02-15
pjp
char ptr[DNS_MAXNAME]; /* PTR RR */
219
2019-02-15
pjp
int ptrlen; /* len of PTR */
220
2020-08-08
pjp
};
221
2016-07-06
pjp
222
2019-02-15
pjp
struct txt {
223
2019-04-30
pjp
char txt[1024]; /* TXT string */
224
2019-02-15
pjp
int txtlen; /* len of TXT */
225
2020-08-08
pjp
};
226
2016-07-06
pjp
227
2020-07-20
pjp
struct hinfo {
228
2020-07-20
pjp
char cpu[255];
229
2020-07-20
pjp
int cpulen;
230
2020-07-20
pjp
char os[255];
231
2020-07-20
pjp
int oslen;
232
2020-08-08
pjp
};
233
2020-07-20
pjp
234
2020-07-20
pjp
struct rp {
235
2020-07-20
pjp
char mbox[DNS_MAXNAME];
236
2020-07-20
pjp
int mboxlen;
237
2020-07-20
pjp
char txt[DNS_MAXNAME];
238
2020-07-20
pjp
int txtlen;
239
2020-08-08
pjp
};
240
2020-07-20
pjp
241
2020-07-20
pjp
struct caa {
242
2020-07-20
pjp
uint8_t flags;
243
2020-07-20
pjp
char tag[DNS_MAXNAME];
244
2020-07-20
pjp
int taglen;
245
2020-07-20
pjp
char value[1024]; /* something reasonable, could be 65000! */
246
2020-07-20
pjp
int valuelen;
247
2020-08-08
pjp
};
248
2020-07-20
pjp
249
2019-02-15
pjp
struct a {
250
2019-02-15
pjp
in_addr_t a; /* IP addresses */
251
2020-08-08
pjp
};
252
2016-07-06
pjp
253
2019-02-15
pjp
struct aaaa {
254
2019-02-15
pjp
struct in6_addr aaaa; /* IPv6 addresses */
255
2020-08-08
pjp
};
256
2016-07-06
pjp
257
2016-07-06
pjp
258
2016-07-06
pjp
259
2016-07-06
pjp
struct sreply {
260
2016-07-06
pjp
int so; /* socket */
261
2016-07-06
pjp
char *buf; /* question packet */
262
2016-07-06
pjp
int len; /* question packet length */
263
2016-07-06
pjp
struct question *q; /* struct question */
264
2016-07-06
pjp
struct sockaddr *sa; /* struct sockaddr of question */
265
2016-07-06
pjp
int salen; /* length of struct sockaddr */
266
2019-02-15
pjp
struct rbtree *rbt1; /* first resolved domain */
267
2019-02-15
pjp
struct rbtree *rbt2; /* CNAME to second resolved domain */
268
2016-07-06
pjp
u_int8_t region; /* region of question */
269
2016-07-06
pjp
int istcp; /* when set it's tcp */
270
2016-07-06
pjp
int wildcard; /* wildcarding boolean */
271
2016-07-06
pjp
char *replybuf; /* reply buffer */
272
2016-07-06
pjp
};
273
2016-07-06
pjp
274
2017-06-26
pjp
275
2019-01-29
pjp
/* ddd command socket */
276
2017-06-26
pjp
277
2019-01-29
pjp
#define SOCKPATH "/var/run/delphinusdnsd.sock"
278
2019-01-29
pjp
struct dddcomm {
279
2019-01-29
pjp
int command;
280
2019-01-29
pjp
union {
281
2019-01-29
pjp
pid_t rpid;
282
2019-01-29
pjp
} ret;
283
2016-07-06
pjp
};
284
2016-07-06
pjp
285
2016-07-06
pjp
286
2017-06-26
pjp
typedef struct {
287
2017-06-26
pjp
size_t size;
288
2017-06-26
pjp
char *data;
289
2017-06-26
pjp
} ddDBT;
290
2016-07-06
pjp
291
2019-02-19
pjp
struct node {
292
2019-02-19
pjp
RB_ENTRY(node) rbentry; /* the node entry */
293
2019-02-19
pjp
char domainname[DNS_MAXNAME + 1]; /* domain name key name */
294
2019-02-19
pjp
int len; /* length of domain name */
295
2019-02-19
pjp
char *data; /* data it points to */
296
2019-02-19
pjp
size_t datalen; /* the length of the data */
297
2019-02-19
pjp
};
298
2019-02-19
pjp
299
2019-02-19
pjp
300
2019-02-19
pjp
extern int domaincmp(struct node *e1, struct node *e2);
301
2019-02-19
pjp
302
2019-02-19
pjp
RB_HEAD(domaintree, node);
303
2019-02-19
pjp
RB_GENERATE_STATIC(domaintree, node, rbentry, domaincmp)
304
2017-06-26
pjp
typedef struct __dddb {
305
2017-06-26
pjp
int (*put)(struct __dddb *, ddDBT *, ddDBT *);
306
2017-06-26
pjp
int (*get)(struct __dddb *, ddDBT *, ddDBT *);
307
2017-06-26
pjp
int (*close)(struct __dddb *);
308
2017-06-26
pjp
int (*remove)(struct __dddb *, ddDBT *);
309
2017-06-26
pjp
size_t offset;
310
2017-06-26
pjp
size_t size;
311
2017-06-26
pjp
char *nodes;
312
2019-02-19
pjp
struct domaintree head;
313
2017-06-26
pjp
} ddDB;
314
2016-07-06
pjp
315
2016-07-06
pjp
316
2019-02-15
pjp
struct rr {
317
2019-02-15
pjp
void *rdata;
318
2020-07-15
pjp
uint16_t rdlen;
319
2019-02-15
pjp
time_t changed;
320
2019-02-15
pjp
TAILQ_ENTRY(rr) entries;
321
2019-02-15
pjp
};
322
2016-07-06
pjp
323
2019-02-15
pjp
struct rrset {
324
2019-02-15
pjp
u_int16_t rrtype;
325
2020-05-07
pjp
u_int32_t ttl;
326
2020-07-06
pjp
time_t created;
327
2019-02-15
pjp
TAILQ_ENTRY(rrset) entries;
328
2019-02-15
pjp
TAILQ_HEAD(rrh, rr) rr_head;
329
2016-07-06
pjp
};
330
2016-07-06
pjp
331
2019-02-15
pjp
332
2019-02-15
pjp
struct rbtree {
333
2019-02-15
pjp
char zone[DNS_MAXNAME];
334
2019-02-15
pjp
int zonelen;
335
2019-02-15
pjp
char humanname[DNS_MAXNAME + 1];
336
2019-11-11
pjp
uint32_t flags; /* 32 bit flags */
337
2019-02-15
pjp
338
2019-11-11
pjp
#define RBT_DNSSEC 0x1 /* this rbtree entry is of type DNSSEC */
339
2019-11-11
pjp
#define RBT_APEX 0x2 /* this rbtree entry is the apex of zone */
340
2019-11-11
pjp
#define RBT_GLUE 0x4 /* this rbtree entry is GLUE data */
341
2019-11-11
pjp
342
2019-11-11
pjp
343
2020-07-08
pjp
TAILQ_HEAD(rrseth, rrset) rrset_head;
344
2019-02-15
pjp
};
345
2019-02-15
pjp
346
2019-02-07
pjp
struct rrtab {
347
2019-02-07
pjp
char *name;
348
2019-02-07
pjp
u_int16_t type;
349
2019-02-15
pjp
u_int16_t internal_type;
350
2019-02-07
pjp
};
351
2019-02-07
pjp
352
2019-02-07
pjp
353
2016-07-06
pjp
struct cfg {
354
2016-07-06
pjp
int udp[DEFAULT_SOCKET]; /* udp sockets */
355
2016-07-06
pjp
int tcp[DEFAULT_SOCKET]; /* tcp socket */
356
2016-07-06
pjp
int axfr[DEFAULT_SOCKET]; /* axfr udp socket */
357
2016-07-06
pjp
char *ident[DEFAULT_SOCKET]; /* identification of interface */
358
2020-07-21
pjp
struct sockaddr_storage ss[DEFAULT_SOCKET]; /* some addr storage */
359
2017-08-09
pjp
struct my_imsg {
360
2017-08-09
pjp
int imsg_fds[2];
361
2017-08-09
pjp
} my_imsg[100];
362
2020-06-25
pjp
#define MY_IMSG_CORTEX 0
363
2020-06-25
pjp
#define MY_IMSG_AXFR 1
364
2020-06-25
pjp
#define MY_IMSG_TCP 2
365
2020-06-25
pjp
#define MY_IMSG_PARSER 3
366
2020-06-25
pjp
#define MY_IMSG_RAXFR 4
367
2020-06-25
pjp
#define MY_IMSG_MASTER 5
368
2020-06-25
pjp
#define MY_IMSG_UNIXCONTROL 6
369
2020-06-25
pjp
#define MY_IMSG_UDP 7
370
2020-06-30
pjp
#define MY_IMSG_FORWARD 8
371
2020-06-30
pjp
#define MY_IMSG_MAX 9
372
2020-07-21
pjp
int raw[2];
373
2020-07-21
pjp
#define RAW_IPSOCKET 0
374
2020-07-21
pjp
#define RAW_IP6SOCKET 1
375
2020-07-21
pjp
u_short port;
376
2016-07-06
pjp
int sockcount; /* set sockets */
377
2017-12-26
pjp
int nth;
378
2017-12-26
pjp
pid_t pid;
379
2020-07-10
pjp
char *shptr; /* shared memory 1 */
380
2020-07-11
pjp
size_t shptrsize;
381
2020-07-10
pjp
char *shptr2; /* shared memory 2 */
382
2020-07-11
pjp
size_t shptr2size;
383
2020-07-10
pjp
char *shptr3; /* shared memory 3 */
384
2020-07-11
pjp
size_t shptr3size;
385
2017-06-26
pjp
ddDB *db; /* database */
386
2016-07-06
pjp
};
387
2017-06-26
pjp
388
2016-07-06
pjp
389
2017-06-26
pjp
ddDB * dddbopen(void);
390
2017-06-26
pjp
int dddbget(ddDB *, ddDBT *, ddDBT *);
391
2017-06-26
pjp
int dddbput(ddDB *, ddDBT *, ddDBT *);
392
2017-06-26
pjp
int dddbclose(ddDB *);
393
2017-06-26
pjp
394
2017-06-26
pjp
#define DDDB_NOTFOUND (-1)
395
2017-06-26
pjp
396
2019-11-14
pjp
int parse_file(ddDB *db, char *, uint32_t);
397
2017-06-26
pjp
ddDB * opendatabase(ddDB *);
398
2019-02-07
pjp
399
2019-02-07
pjp
/* dig stuff */
400
2019-02-07
pjp
401
2019-02-07
pjp
#define BIND_FORMAT 0x1
402
2019-02-07
pjp
#define INDENT_FORMAT 0x2
403
2019-02-07
pjp
#define ZONE_FORMAT 0x4
404
2019-02-07
pjp
#define DNSSEC_FORMAT 0x8
405
2019-02-07
pjp
#define TCP_FORMAT 0x10
406
2019-06-26
pjp
407
2019-06-26
pjp
/* mzone */
408
2019-06-26
pjp
struct mzone_dest {
409
2019-06-26
pjp
struct sockaddr_storage notifydest;
410
2019-06-26
pjp
SLIST_ENTRY(mzone_dest) entries;
411
2019-06-26
pjp
int notified;
412
2019-06-26
pjp
char requestmac[32];
413
2019-06-26
pjp
char *tsigkey;
414
2019-07-09
pjp
u_int16_t port;
415
2019-06-26
pjp
};
416
2019-06-26
pjp
417
2019-06-26
pjp
struct mzone {
418
2019-06-26
pjp
SLIST_ENTRY(mzone) mzone_entry;
419
2019-06-26
pjp
char *zonename;
420
2019-06-26
pjp
int zonenamelen;
421
2019-06-26
pjp
char *humanname;
422
2019-06-26
pjp
struct sockaddr_storage notifybind;
423
2019-06-26
pjp
SLIST_HEAD(,mzone_dest) dest;
424
2019-06-26
pjp
} *mz, *mz0;
425
2019-11-01
pjp
426
2019-12-11
pjp
#ifndef DEFAULT_RZONE_DIR
427
2020-09-06
pjp
#define DELPHINUS_RZONE_PATH "/var/delphinusdnsd/replicant"
428
2019-12-11
pjp
#else
429
2019-12-11
pjp
#define DELPHINUS_RZONE_PATH DEFAULT_RZONE_DIR
430
2019-12-11
pjp
#endif
431
2019-11-01
pjp
432
2020-07-27
pjp
struct soa_constraints {
433
2020-07-27
pjp
uint32_t refresh;
434
2020-07-27
pjp
uint32_t retry;
435
2020-07-27
pjp
uint32_t expire;
436
2020-07-27
pjp
};
437
2020-07-27
pjp
438
2019-11-01
pjp
struct rzone {
439
2019-11-01
pjp
SLIST_ENTRY(rzone) rzone_entry;
440
2019-11-01
pjp
int active;
441
2019-11-01
pjp
char *zonename;
442
2019-11-04
pjp
char *zone;
443
2019-11-04
pjp
int zonelen;
444
2019-11-01
pjp
u_int16_t masterport;
445
2019-11-01
pjp
char *master;
446
2019-11-01
pjp
struct sockaddr_storage storage;
447
2019-11-01
pjp
char *tsigkey;
448
2019-11-01
pjp
char *filename;
449
2020-07-27
pjp
struct soa soa;
450
2020-07-27
pjp
struct soa_constraints constraints;
451
2019-11-01
pjp
} *rz, *rz0;
452
2019-11-02
pjp
453
2019-11-02
pjp
struct raxfr_logic {
454
2019-11-02
pjp
int rrtype;
455
2019-11-02
pjp
int dnssec;
456
2020-07-08
pjp
int (*raxfr)(FILE *, u_char *, u_char *, u_char *, struct soa *, u_int16_t, HMAC_CTX *);
457
2019-11-02
pjp
};
458
2020-07-06
pjp
459
2020-07-08
pjp
struct scache {
460
2020-07-08
pjp
u_char *payload;
461
2020-07-08
pjp
u_char *estart;
462
2020-07-08
pjp
u_char *end;
463
2020-07-08
pjp
uint16_t rdlen;
464
2020-07-08
pjp
char *name;
465
2020-07-08
pjp
int namelen;
466
2020-07-08
pjp
uint32_t dnsttl;
467
2020-07-08
pjp
uint16_t rrtype;
468
2020-07-18
pjp
int authentic;
469
2020-07-08
pjp
struct imsgbuf *imsgbuf;
470
2020-07-10
pjp
struct imsgbuf *bimsgbuf;
471
2020-07-12
pjp
struct cfg *cfg;
472
2020-07-08
pjp
};
473
2020-07-06
pjp
474
2020-07-08
pjp
struct cache_logic {
475
2020-07-08
pjp
int rrtype;
476
2020-07-08
pjp
int dnssec;
477
2020-07-08
pjp
int (*cacheit)(struct scache *);
478
2020-07-08
pjp
};
479
2020-07-08
pjp
480
2020-07-06
pjp
/* reply logic */
481
2020-07-06
pjp
482
2020-07-06
pjp
struct reply_logic {
483
2020-07-06
pjp
int rrtype;
484
2020-07-06
pjp
int type0;
485
2020-07-06
pjp
int buildtype;
486
2020-07-06
pjp
#define BUILD_CNAME 1
487
2020-07-06
pjp
#define BUILD_OTHER 2
488
2020-07-21
pjp
int (*reply)(struct sreply *, int *, ddDB *);
489
2020-07-06
pjp
};
490
2020-07-06
pjp
491
2020-07-06
pjp
492
2020-07-06
pjp
#ifndef MIN
493
2020-07-06
pjp
#define MIN(a,b) (((a) < (b))?(a):(b))
494
2020-07-06
pjp
#endif
495
2020-07-08
pjp
496
2020-07-10
pjp
struct sf_imsg {
497
2020-07-12
pjp
union {
498
2020-07-12
pjp
struct {
499
2020-07-12
pjp
int read; /* 4 */
500
2020-07-12
pjp
int len; /* 8 */
501
2020-07-12
pjp
char pad[10]; /* 18 */
502
2020-07-12
pjp
struct sforward sf; /* 924 */
503
2020-07-12
pjp
} s;
504
2020-07-12
pjp
505
2020-07-12
pjp
char pad[1024];
506
2020-07-12
pjp
} u;
507
2020-07-12
pjp
#define sfi_sf u.s.sf
508
2020-07-10
pjp
};
509
2020-07-10
pjp
510
2020-07-08
pjp
struct rr_imsg {
511
2020-07-08
pjp
union {
512
2020-07-10
pjp
struct {
513
2020-07-12
pjp
int read; /* 4 */
514
2020-07-12
pjp
int len; /* 8 */
515
2020-07-12
pjp
char pad[12]; /* 20 */
516
2020-07-10
pjp
517
2020-07-12
pjp
struct {
518
2020-07-12
pjp
char name[DNS_MAXNAME + 1]; /* 256 */
519
2020-07-12
pjp
int namelen; /* 260 */
520
2020-07-12
pjp
uint16_t rrtype; /* 262 */
521
2020-07-12
pjp
uint32_t ttl; /* 266 */
522
2020-07-18
pjp
int authentic;
523
2020-07-12
pjp
524
2020-07-18
pjp
uint16_t buflen;
525
2020-07-10
pjp
526
2020-07-12
pjp
char un[0];
527
2020-07-18
pjp
} rr;
528
2020-07-12
pjp
} s;
529
2020-07-12
pjp
530
2020-07-10
pjp
char pad[8192];
531
2020-07-12
pjp
} u;
532
2020-07-12
pjp
#define rri_rr u.s.rr
533
2020-07-08
pjp
}; /* end of struct rr_imsg */
534
2020-07-10
pjp
535
2020-07-14
pjp
struct pkt_imsg {
536
2020-07-14
pjp
union {
537
2020-07-14
pjp
struct {
538
2020-07-14
pjp
int read;
539
2020-07-14
pjp
int rc;
540
2020-07-14
pjp
int istcp;
541
2020-07-14
pjp
int cache;
542
2020-07-14
pjp
int tsigcheck;
543
2020-07-14
pjp
struct tsig tsig;
544
2020-07-14
pjp
char mac[32];
545
2020-07-14
pjp
int buflen;
546
2020-07-14
pjp
char buf[0];
547
2020-07-14
pjp
} s;
548
2020-07-10
pjp
549
2020-07-14
pjp
char buf[16384];
550
2020-07-14
pjp
} u;
551
2020-07-14
pjp
#define pkt_s u.s
552
2020-07-14
pjp
}; /* 16384 */
553
2020-07-10
pjp
554
2020-07-10
pjp
555
2020-07-10
pjp
#define SHAREDMEMSIZE 400
556
2020-07-10
pjp
#define SHAREDMEMSIZE3 200
557
2020-08-26
pjp
558
2020-08-26
pjp
struct walkentry {
559
2020-08-26
pjp
struct rbtree *rbt;
560
2020-08-26
pjp
TAILQ_ENTRY(walkentry) walk_entry;
561
2020-08-26
pjp
} *we1, *wep;
562
2020-08-26
pjp
563
2020-08-26
pjp
struct zoneentry {
564
2020-08-26
pjp
char name[DNS_MAXNAME];
565
2020-08-26
pjp
int namelen;
566
2020-08-26
pjp
char *humanname;
567
2020-08-26
pjp
TAILQ_HEAD(, walkentry) walkhead;
568
2020-08-26
pjp
RB_ENTRY(zoneentry) zone_entry;
569
2020-08-26
pjp
};
570
2020-08-26
pjp
571
2020-08-26
pjp
RB_HEAD(zonetree, zoneentry);
572
2020-08-26
pjp
RB_PROTOTYPE(zonetree, zoneentry, zone_entry, zonecmp);
573
2020-08-26
pjp
574
2020-08-26
pjp
extern int zonecmp(struct zoneentry *, struct zoneentry *);
575
2020-08-26
pjp
576
2020-08-26
pjp
577
2016-07-06
pjp
578
2016-07-06
pjp
#endif /* _DB_H */
repomaster@centroid.eu