Blame
Date:
Mon Jan 11 09:00:47 2021 UTC
Message:
a usleep makes it unnecessary slow, I guess it forces a context switch...
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
2016-07-06
pjp
#ifndef _DB_H
030
2016-07-06
pjp
#define _DB_H
031
2016-07-06
pjp
032
2017-06-26
pjp
#include <sys/types.h>
033
2017-06-26
pjp
#include <limits.h>
034
2017-06-26
pjp
035
2019-11-02
pjp
#include <openssl/hmac.h>
036
2019-12-11
pjp
#include "ddd-config.h"
037
2019-11-02
pjp
038
2019-12-11
pjp
#ifndef DEFAULT_CONFFILE
039
2020-09-06
pjp
#define CONFFILE "/var/delphinusdnsd/etc/delphinusdns.conf"
040
2019-12-11
pjp
#else
041
2019-12-11
pjp
#define CONFFILE DEFAULT_CONFFILE
042
2019-12-11
pjp
#endif
043
2019-12-11
pjp
044
2016-07-06
pjp
#define DEFAULT_SOCKET 64
045
2016-07-06
pjp
046
2019-11-14
pjp
#define PARSEFILE_FLAG_NOSOCKET 0x1
047
2019-11-14
pjp
048
2019-11-14
pjp
049
2017-08-09
pjp
#define IMSG_HELLO_MESSAGE 0 /* hello the master process a few */
050
2017-08-09
pjp
#define IMSG_SPREAD_MESSAGE 1 /* spread a record to all childs */
051
2017-08-09
pjp
#define IMSG_XFR_MESSAGE 2 /* forward message to axfr proc */
052
2017-11-28
pjp
#define IMSG_PARSE_MESSAGE 4 /* pass message to pledge parser */
053
2017-11-28
pjp
#define IMSG_PARSEREPLY_MESSAGE 5 /* return message from pledge parser */
054
2019-01-29
pjp
#define IMSG_SHUTDOWN_MESSAGE 6 /* shut the server down */
055
2019-01-29
pjp
#define IMSG_RELOAD_MESSAGE 7 /* reload/restart the server */
056
2019-02-24
pjp
#define IMSG_PARSEAUTH_MESSAGE 8 /* parse message with auth required */
057
2019-11-04
pjp
#define IMSG_NOTIFY_MESSAGE 9 /* notify our replicant engine */
058
2020-06-25
pjp
#define IMSG_SETUP_NEURON 10 /* set up a new imsg via fd passing */
059
2020-06-25
pjp
#define IMSG_CRIPPLE_NEURON 11 /* no new neurons are needed */
060
2020-06-30
pjp
#define IMSG_FORWARD_UDP 12 /* forward a UDP packet */
061
2020-06-30
pjp
#define IMSG_FORWARD_TCP 13 /* forward a TCP packet (with fd) */
062
2020-07-08
pjp
#define IMSG_RR_ATTACHED 14 /* an RR is sent through imsg */
063
2020-07-10
pjp
#define IMSG_PARSEERROR_MESSAGE 15 /* return error message from pledge parser */
064
2017-08-09
pjp
065
2016-07-06
pjp
#define ERR_DROP 0x1
066
2016-07-06
pjp
#define ERR_NXDOMAIN 0x2
067
2016-07-06
pjp
#define ERR_NOERROR 0x4
068
2016-07-06
pjp
#define ERR_REFUSED 0x8
069
2017-01-09
pjp
#define ERR_NODATA 0x10
070
2019-10-30
pjp
#define ERR_DELEGATE 0x20
071
2020-06-30
pjp
#define ERR_FORWARD 0x40
072
2016-07-06
pjp
073
2016-07-06
pjp
#define RECORD_COUNT 20
074
2016-07-06
pjp
#define NEGATIVE_CACHE_TIME 600 /* DNS & Bind 3rd edition page 35 */
075
2016-07-06
pjp
076
2019-11-03
pjp
#ifndef DEFAULT_PRIVILEGE
077
2019-11-03
pjp
#define DEFAULT_PRIVILEGE "_ddd"
078
2019-11-03
pjp
#endif
079
2019-11-03
pjp
080
2016-07-06
pjp
/* db stuff */
081
2016-07-06
pjp
082
2016-07-06
pjp
struct dnskey {
083
2016-07-06
pjp
u_int16_t flags;
084
2016-07-06
pjp
#define DNSKEY_ZONE_KEY (1 << 7)
085
2016-07-06
pjp
#define DNSKEY_SECURE_ENTRY (1 << 15)
086
2016-07-06
pjp
u_int8_t protocol; /* must be 3 */
087
2016-07-06
pjp
u_int8_t algorithm; /* would be 5, RFC 3110 */
088
2016-07-06
pjp
char public_key[4096];
089
2016-07-06
pjp
u_int16_t publickey_len;
090
2020-08-08
pjp
};
091
2016-07-06
pjp
092
2016-07-06
pjp
struct rrsig {
093
2016-07-06
pjp
u_int16_t type_covered;
094
2016-07-06
pjp
u_int8_t algorithm; /* usually 5, RFC3110 */
095
2016-07-06
pjp
u_int8_t labels;
096
2016-07-06
pjp
u_int32_t original_ttl;
097
2016-07-06
pjp
u_int32_t signature_expiration;
098
2016-07-06
pjp
u_int32_t signature_inception;
099
2016-07-06
pjp
u_int16_t key_tag;
100
2016-07-06
pjp
char signers_name[DNS_MAXNAME];
101
2016-07-06
pjp
u_int8_t signame_len;
102
2016-07-06
pjp
char signature[4096];
103
2016-07-06
pjp
u_int16_t signature_len;
104
2020-05-07
pjp
uint32_t ttl; /* RFC 4034 section 3, the TTL value of ... */
105
2019-02-15
pjp
int used; /* if this RRSIG is used at all */
106
2020-07-06
pjp
time_t created; /* when this was added to the cache */
107
2020-08-08
pjp
};
108
2016-07-06
pjp
109
2016-07-06
pjp
struct nsec {
110
2016-07-06
pjp
char next_domain_name[DNS_MAXNAME];
111
2016-07-06
pjp
u_int8_t ndn_len; /* next domain name length */
112
2016-07-06
pjp
char bitmap[8192];
113
2016-07-06
pjp
u_int16_t bitmap_len;
114
2020-08-08
pjp
};
115
2016-07-06
pjp
116
2016-07-06
pjp
struct nsec3 {
117
2016-07-06
pjp
u_int8_t algorithm;
118
2016-07-06
pjp
u_int8_t flags;
119
2016-07-06
pjp
u_int16_t iterations;
120
2016-07-06
pjp
u_int8_t saltlen;
121
2016-07-06
pjp
char salt[256];
122
2016-07-06
pjp
char next[DNS_MAXNAME];
123
2016-07-06
pjp
u_int8_t nextlen; /* next domain name length */
124
2016-07-06
pjp
char bitmap[8192];
125
2016-07-06
pjp
u_int16_t bitmap_len;
126
2020-08-08
pjp
};
127
2016-07-06
pjp
128
2016-07-06
pjp
struct nsec3param {
129
2016-07-06
pjp
u_int8_t algorithm;
130
2016-07-06
pjp
u_int8_t flags;
131
2016-07-06
pjp
u_int16_t iterations;
132
2016-07-06
pjp
u_int8_t saltlen;
133
2016-07-06
pjp
char salt[256];
134
2020-08-08
pjp
};
135
2016-07-06
pjp
136
2016-07-06
pjp
struct ds {
137
2016-07-06
pjp
u_int16_t key_tag;
138
2016-07-06
pjp
u_int8_t algorithm;
139
2016-07-06
pjp
u_int8_t digest_type;
140
2016-07-06
pjp
char digest[4096];
141
2016-07-06
pjp
u_int16_t digestlen;
142
2020-08-08
pjp
};
143
2016-07-06
pjp
144
2016-07-06
pjp
145
2016-07-06
pjp
struct soa {
146
2016-07-06
pjp
char nsserver[DNS_MAXNAME];
147
2016-07-06
pjp
u_int8_t nsserver_len;
148
2016-07-06
pjp
char responsible_person[DNS_MAXNAME];
149
2016-07-06
pjp
u_int8_t rp_len;
150
2016-07-06
pjp
u_int32_t serial;
151
2016-07-06
pjp
u_int32_t refresh;
152
2016-07-06
pjp
u_int32_t retry;
153
2016-07-06
pjp
u_int32_t expire;
154
2016-07-06
pjp
u_int32_t minttl;
155
2020-08-08
pjp
};
156
2016-07-06
pjp
157
2016-07-06
pjp
struct smx {
158
2016-07-06
pjp
u_int16_t preference; /* MX preference */
159
2016-07-06
pjp
char exchange[DNS_MAXNAME]; /* name of exchange server */
160
2016-07-06
pjp
int exchangelen; /* length of exchange server name */
161
2020-08-08
pjp
};
162
2016-07-06
pjp
163
2016-07-06
pjp
struct ns {
164
2016-07-06
pjp
char nsserver[DNS_MAXNAME]; /* NS name */
165
2016-07-06
pjp
int nslen; /* length of NS */
166
2019-02-15
pjp
int ns_type; /* set if it's a delegation */
167
2019-02-15
pjp
#define NS_TYPE_DELEGATE 0x1
168
2019-02-15
pjp
#define NS_TYPE_HINT 0x2
169
2016-07-06
pjp
170
2020-08-08
pjp
};
171
2019-02-15
pjp
172
2016-07-06
pjp
struct srv {
173
2016-07-06
pjp
u_int16_t priority; /* SRV 16 bit priority */
174
2016-07-06
pjp
u_int16_t weight; /* 16 bit weight */
175
2016-07-06
pjp
u_int16_t port; /* 16 bit port */
176
2016-07-06
pjp
char target[DNS_MAXNAME]; /* SRV target name */
177
2016-07-06
pjp
int targetlen; /* SRV target name length */
178
2020-08-08
pjp
};
179
2016-07-06
pjp
180
2016-07-06
pjp
struct sshfp {
181
2016-07-06
pjp
u_int8_t algorithm; /* SSHFP algorithm */
182
2016-07-06
pjp
u_int8_t fptype; /* SSHFP fingerprint type */
183
2016-07-06
pjp
char fingerprint[DNS_MAXNAME]; /* fingerprint */
184
2016-07-06
pjp
int fplen; /* fingerprint length */
185
2020-08-08
pjp
};
186
2016-07-06
pjp
187
2016-07-06
pjp
struct tlsa {
188
2016-07-06
pjp
u_int8_t usage; /* TLSA usage */
189
2016-07-06
pjp
u_int8_t selector; /* TLSA selector */
190
2016-07-06
pjp
u_int8_t matchtype; /* TLSA matching type */
191
2016-07-06
pjp
char data[DNS_MAXNAME]; /* TLSA data */
192
2016-07-06
pjp
int datalen; /* data length */
193
2020-08-08
pjp
};
194
2016-07-06
pjp
195
2016-07-06
pjp
struct naptr {
196
2016-07-06
pjp
u_int16_t order; /* NAPTR 16 bit order */
197
2016-07-06
pjp
u_int16_t preference; /* 16 bit preference */
198
2016-07-06
pjp
char flags[DNS_MAXNAME]; /* flags 255 bytes */
199
2016-07-06
pjp
int flagslen; /* flags length */
200
2016-07-06
pjp
char services[DNS_MAXNAME]; /* services */
201
2016-07-06
pjp
int serviceslen; /* services length */
202
2016-07-06
pjp
char regexp[DNS_MAXNAME]; /* regexp */
203
2016-07-06
pjp
int regexplen; /* regexp len */
204
2016-07-06
pjp
char replacement[DNS_MAXNAME]; /* replacement this is a domain */
205
2016-07-06
pjp
int replacementlen;
206
2020-08-08
pjp
};
207
2016-07-06
pjp
208
2019-02-15
pjp
struct cname {
209
2019-02-15
pjp
char cname[DNS_MAXNAME]; /* CNAME RR */
210
2019-02-15
pjp
int cnamelen; /* len of CNAME */
211
2020-08-08
pjp
};
212
2016-07-06
pjp
213
2019-02-15
pjp
struct ptr {
214
2019-02-15
pjp
char ptr[DNS_MAXNAME]; /* PTR RR */
215
2019-02-15
pjp
int ptrlen; /* len of PTR */
216
2020-08-08
pjp
};
217
2016-07-06
pjp
218
2019-02-15
pjp
struct txt {
219
2019-04-30
pjp
char txt[1024]; /* TXT string */
220
2019-02-15
pjp
int txtlen; /* len of TXT */
221
2020-08-08
pjp
};
222
2016-07-06
pjp
223
2020-07-20
pjp
struct hinfo {
224
2020-07-20
pjp
char cpu[255];
225
2020-07-20
pjp
int cpulen;
226
2020-07-20
pjp
char os[255];
227
2020-07-20
pjp
int oslen;
228
2020-08-08
pjp
};
229
2020-07-20
pjp
230
2020-07-20
pjp
struct rp {
231
2020-07-20
pjp
char mbox[DNS_MAXNAME];
232
2020-07-20
pjp
int mboxlen;
233
2020-07-20
pjp
char txt[DNS_MAXNAME];
234
2020-07-20
pjp
int txtlen;
235
2020-08-08
pjp
};
236
2020-07-20
pjp
237
2020-07-20
pjp
struct caa {
238
2020-07-20
pjp
uint8_t flags;
239
2020-07-20
pjp
char tag[DNS_MAXNAME];
240
2020-07-20
pjp
int taglen;
241
2020-07-20
pjp
char value[1024]; /* something reasonable, could be 65000! */
242
2020-07-20
pjp
int valuelen;
243
2020-08-08
pjp
};
244
2020-07-20
pjp
245
2019-02-15
pjp
struct a {
246
2019-02-15
pjp
in_addr_t a; /* IP addresses */
247
2020-08-08
pjp
};
248
2016-07-06
pjp
249
2019-02-15
pjp
struct aaaa {
250
2019-02-15
pjp
struct in6_addr aaaa; /* IPv6 addresses */
251
2020-08-08
pjp
};
252
2016-07-06
pjp
253
2016-07-06
pjp
254
2016-07-06
pjp
255
2016-07-06
pjp
struct sreply {
256
2016-07-06
pjp
int so; /* socket */
257
2016-07-06
pjp
char *buf; /* question packet */
258
2016-07-06
pjp
int len; /* question packet length */
259
2016-07-06
pjp
struct question *q; /* struct question */
260
2016-07-06
pjp
struct sockaddr *sa; /* struct sockaddr of question */
261
2016-07-06
pjp
int salen; /* length of struct sockaddr */
262
2019-02-15
pjp
struct rbtree *rbt1; /* first resolved domain */
263
2019-02-15
pjp
struct rbtree *rbt2; /* CNAME to second resolved domain */
264
2016-07-06
pjp
u_int8_t region; /* region of question */
265
2016-07-06
pjp
int istcp; /* when set it's tcp */
266
2016-07-06
pjp
int wildcard; /* wildcarding boolean */
267
2016-07-06
pjp
char *replybuf; /* reply buffer */
268
2016-07-06
pjp
};
269
2016-07-06
pjp
270
2017-06-26
pjp
271
2019-01-29
pjp
/* ddd command socket */
272
2017-06-26
pjp
273
2019-01-29
pjp
#define SOCKPATH "/var/run/delphinusdnsd.sock"
274
2019-01-29
pjp
struct dddcomm {
275
2019-01-29
pjp
int command;
276
2019-01-29
pjp
union {
277
2019-01-29
pjp
pid_t rpid;
278
2019-01-29
pjp
} ret;
279
2016-07-06
pjp
};
280
2016-07-06
pjp
281
2016-07-06
pjp
282
2017-06-26
pjp
typedef struct {
283
2017-06-26
pjp
size_t size;
284
2017-06-26
pjp
char *data;
285
2017-06-26
pjp
} ddDBT;
286
2016-07-06
pjp
287
2019-02-19
pjp
struct node {
288
2019-02-19
pjp
RB_ENTRY(node) rbentry; /* the node entry */
289
2019-02-19
pjp
char domainname[DNS_MAXNAME + 1]; /* domain name key name */
290
2019-02-19
pjp
int len; /* length of domain name */
291
2019-02-19
pjp
char *data; /* data it points to */
292
2019-02-19
pjp
size_t datalen; /* the length of the data */
293
2019-02-19
pjp
};
294
2019-02-19
pjp
295
2019-02-19
pjp
296
2019-02-19
pjp
extern int domaincmp(struct node *e1, struct node *e2);
297
2019-02-19
pjp
298
2019-02-19
pjp
RB_HEAD(domaintree, node);
299
2019-02-19
pjp
RB_GENERATE_STATIC(domaintree, node, rbentry, domaincmp)
300
2017-06-26
pjp
typedef struct __dddb {
301
2017-06-26
pjp
int (*put)(struct __dddb *, ddDBT *, ddDBT *);
302
2017-06-26
pjp
int (*get)(struct __dddb *, ddDBT *, ddDBT *);
303
2017-06-26
pjp
int (*close)(struct __dddb *);
304
2017-06-26
pjp
int (*remove)(struct __dddb *, ddDBT *);
305
2017-06-26
pjp
size_t offset;
306
2017-06-26
pjp
size_t size;
307
2017-06-26
pjp
char *nodes;
308
2019-02-19
pjp
struct domaintree head;
309
2017-06-26
pjp
} ddDB;
310
2016-07-06
pjp
311
2016-07-06
pjp
312
2019-02-15
pjp
struct rr {
313
2019-02-15
pjp
void *rdata;
314
2020-07-15
pjp
uint16_t rdlen;
315
2019-02-15
pjp
time_t changed;
316
2021-01-05
pjp
uint32_t zonenumber;
317
2019-02-15
pjp
TAILQ_ENTRY(rr) entries;
318
2019-02-15
pjp
};
319
2016-07-06
pjp
320
2019-02-15
pjp
struct rrset {
321
2019-02-15
pjp
u_int16_t rrtype;
322
2020-05-07
pjp
u_int32_t ttl;
323
2020-07-06
pjp
time_t created;
324
2019-02-15
pjp
TAILQ_ENTRY(rrset) entries;
325
2019-02-15
pjp
TAILQ_HEAD(rrh, rr) rr_head;
326
2016-07-06
pjp
};
327
2016-07-06
pjp
328
2019-02-15
pjp
329
2019-02-15
pjp
struct rbtree {
330
2019-02-15
pjp
char zone[DNS_MAXNAME];
331
2019-02-15
pjp
int zonelen;
332
2019-02-15
pjp
char humanname[DNS_MAXNAME + 1];
333
2019-11-11
pjp
uint32_t flags; /* 32 bit flags */
334
2019-02-15
pjp
335
2019-11-11
pjp
#define RBT_DNSSEC 0x1 /* this rbtree entry is of type DNSSEC */
336
2019-11-11
pjp
#define RBT_APEX 0x2 /* this rbtree entry is the apex of zone */
337
2019-11-11
pjp
#define RBT_GLUE 0x4 /* this rbtree entry is GLUE data */
338
2021-01-07
pjp
#define RBT_CACHE 0x8 /* this rbtree lies in the cache */
339
2019-11-11
pjp
340
2020-07-08
pjp
TAILQ_HEAD(rrseth, rrset) rrset_head;
341
2019-02-15
pjp
};
342
2019-02-15
pjp
343
2019-02-07
pjp
struct rrtab {
344
2019-02-07
pjp
char *name;
345
2019-02-07
pjp
u_int16_t type;
346
2019-02-15
pjp
u_int16_t internal_type;
347
2019-02-07
pjp
};
348
2019-02-07
pjp
349
2019-02-07
pjp
350
2016-07-06
pjp
struct cfg {
351
2016-07-06
pjp
int udp[DEFAULT_SOCKET]; /* udp sockets */
352
2016-07-06
pjp
int tcp[DEFAULT_SOCKET]; /* tcp socket */
353
2016-07-06
pjp
int axfr[DEFAULT_SOCKET]; /* axfr udp socket */
354
2016-07-06
pjp
char *ident[DEFAULT_SOCKET]; /* identification of interface */
355
2020-07-21
pjp
struct sockaddr_storage ss[DEFAULT_SOCKET]; /* some addr storage */
356
2017-08-09
pjp
struct my_imsg {
357
2017-08-09
pjp
int imsg_fds[2];
358
2017-08-09
pjp
} my_imsg[100];
359
2020-06-25
pjp
#define MY_IMSG_CORTEX 0
360
2020-06-25
pjp
#define MY_IMSG_AXFR 1
361
2020-06-25
pjp
#define MY_IMSG_TCP 2
362
2020-06-25
pjp
#define MY_IMSG_PARSER 3
363
2020-06-25
pjp
#define MY_IMSG_RAXFR 4
364
2020-06-25
pjp
#define MY_IMSG_MASTER 5
365
2020-06-25
pjp
#define MY_IMSG_UNIXCONTROL 6
366
2020-06-25
pjp
#define MY_IMSG_UDP 7
367
2020-06-30
pjp
#define MY_IMSG_FORWARD 8
368
2020-06-30
pjp
#define MY_IMSG_MAX 9
369
2020-07-21
pjp
int raw[2];
370
2020-07-21
pjp
#define RAW_IPSOCKET 0
371
2020-07-21
pjp
#define RAW_IP6SOCKET 1
372
2020-07-21
pjp
u_short port;
373
2016-07-06
pjp
int sockcount; /* set sockets */
374
2017-12-26
pjp
int nth;
375
2017-12-26
pjp
pid_t pid;
376
2020-07-10
pjp
char *shptr; /* shared memory 1 */
377
2020-07-11
pjp
size_t shptrsize;
378
2020-07-10
pjp
char *shptr2; /* shared memory 2 */
379
2020-07-11
pjp
size_t shptr2size;
380
2020-07-10
pjp
char *shptr3; /* shared memory 3 */
381
2020-07-11
pjp
size_t shptr3size;
382
2021-01-11
pjp
char *shptr_pq; /* shared memory 4 */
383
2021-01-11
pjp
size_t shptr_pqsize;
384
2017-06-26
pjp
ddDB *db; /* database */
385
2016-07-06
pjp
};
386
2017-06-26
pjp
387
2016-07-06
pjp
388
2017-06-26
pjp
ddDB * dddbopen(void);
389
2017-06-26
pjp
int dddbget(ddDB *, ddDBT *, ddDBT *);
390
2017-06-26
pjp
int dddbput(ddDB *, ddDBT *, ddDBT *);
391
2017-06-26
pjp
int dddbclose(ddDB *);
392
2017-06-26
pjp
393
2017-06-26
pjp
#define DDDB_NOTFOUND (-1)
394
2017-06-26
pjp
395
2019-11-14
pjp
int parse_file(ddDB *db, char *, uint32_t);
396
2017-06-26
pjp
ddDB * opendatabase(ddDB *);
397
2017-06-26
pjp
398
2019-02-07
pjp
/* dig stuff */
399
2019-02-07
pjp
400
2019-02-07
pjp
#define BIND_FORMAT 0x1
401
2019-02-07
pjp
#define INDENT_FORMAT 0x2
402
2019-02-07
pjp
#define ZONE_FORMAT 0x4
403
2019-02-07
pjp
#define DNSSEC_FORMAT 0x8
404
2019-02-07
pjp
#define TCP_FORMAT 0x10
405
2019-06-26
pjp
406
2019-06-26
pjp
/* mzone */
407
2019-06-26
pjp
struct mzone_dest {
408
2019-06-26
pjp
struct sockaddr_storage notifydest;
409
2019-06-26
pjp
SLIST_ENTRY(mzone_dest) entries;
410
2019-06-26
pjp
int notified;
411
2019-06-26
pjp
char requestmac[32];
412
2019-06-26
pjp
char *tsigkey;
413
2019-07-09
pjp
u_int16_t port;
414
2019-06-26
pjp
};
415
2019-06-26
pjp
416
2019-06-26
pjp
struct mzone {
417
2019-06-26
pjp
SLIST_ENTRY(mzone) mzone_entry;
418
2019-06-26
pjp
char *zonename;
419
2019-06-26
pjp
int zonenamelen;
420
2019-06-26
pjp
char *humanname;
421
2019-06-26
pjp
struct sockaddr_storage notifybind;
422
2019-06-26
pjp
SLIST_HEAD(,mzone_dest) dest;
423
2019-06-26
pjp
} *mz, *mz0;
424
2019-11-01
pjp
425
2019-12-11
pjp
#ifndef DEFAULT_RZONE_DIR
426
2020-09-06
pjp
#define DELPHINUS_RZONE_PATH "/var/delphinusdnsd/replicant"
427
2019-12-11
pjp
#else
428
2019-12-11
pjp
#define DELPHINUS_RZONE_PATH DEFAULT_RZONE_DIR
429
2019-12-11
pjp
#endif
430
2019-11-01
pjp
431
2020-07-27
pjp
struct soa_constraints {
432
2020-07-27
pjp
uint32_t refresh;
433
2020-07-27
pjp
uint32_t retry;
434
2020-07-27
pjp
uint32_t expire;
435
2020-07-27
pjp
};
436
2020-07-27
pjp
437
2019-11-01
pjp
struct rzone {
438
2019-11-01
pjp
SLIST_ENTRY(rzone) rzone_entry;
439
2019-11-01
pjp
int active;
440
2019-11-01
pjp
char *zonename;
441
2019-11-04
pjp
char *zone;
442
2019-11-04
pjp
int zonelen;
443
2019-11-01
pjp
u_int16_t masterport;
444
2019-11-01
pjp
char *master;
445
2019-11-01
pjp
struct sockaddr_storage storage;
446
2019-11-01
pjp
char *tsigkey;
447
2019-11-01
pjp
char *filename;
448
2020-07-27
pjp
struct soa soa;
449
2020-07-27
pjp
struct soa_constraints constraints;
450
2020-09-24
pjp
uint32_t bytelimit;
451
2019-11-01
pjp
} *rz, *rz0;
452
2019-11-01
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-06
pjp
496
2021-01-11
pjp
struct pq_imsg {
497
2021-01-11
pjp
union {
498
2021-01-11
pjp
struct {
499
2021-01-11
pjp
int read; /* 4 */
500
2021-01-11
pjp
int len; /* 8 */
501
2021-01-11
pjp
char pad[10]; /* 18 */
502
2021-01-11
pjp
struct parsequestion pq;
503
2021-01-11
pjp
} s;
504
2021-01-11
pjp
505
2021-01-11
pjp
char pad[1024];
506
2021-01-11
pjp
} u;
507
2021-01-11
pjp
#define pqi_pq u.s.pq
508
2021-01-11
pjp
};
509
2021-01-11
pjp
510
2020-07-10
pjp
struct sf_imsg {
511
2020-07-12
pjp
union {
512
2020-07-12
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[10]; /* 18 */
516
2020-07-12
pjp
struct sforward sf; /* 924 */
517
2020-07-12
pjp
} s;
518
2020-07-12
pjp
519
2020-07-12
pjp
char pad[1024];
520
2020-07-12
pjp
} u;
521
2020-07-12
pjp
#define sfi_sf u.s.sf
522
2020-07-10
pjp
};
523
2020-07-10
pjp
524
2020-07-08
pjp
struct rr_imsg {
525
2020-07-08
pjp
union {
526
2020-07-10
pjp
struct {
527
2020-07-12
pjp
int read; /* 4 */
528
2020-07-12
pjp
int len; /* 8 */
529
2020-07-12
pjp
char pad[12]; /* 20 */
530
2020-07-10
pjp
531
2020-07-12
pjp
struct {
532
2020-07-12
pjp
char name[DNS_MAXNAME + 1]; /* 256 */
533
2020-07-12
pjp
int namelen; /* 260 */
534
2020-07-12
pjp
uint16_t rrtype; /* 262 */
535
2020-07-12
pjp
uint32_t ttl; /* 266 */
536
2020-07-18
pjp
int authentic;
537
2020-07-12
pjp
538
2020-07-18
pjp
uint16_t buflen;
539
2020-07-10
pjp
540
2020-07-12
pjp
char un[0];
541
2020-07-18
pjp
} rr;
542
2020-07-12
pjp
} s;
543
2020-07-12
pjp
544
2020-07-10
pjp
char pad[8192];
545
2020-07-12
pjp
} u;
546
2020-07-12
pjp
#define rri_rr u.s.rr
547
2020-07-08
pjp
}; /* end of struct rr_imsg */
548
2020-07-08
pjp
549
2020-07-14
pjp
struct pkt_imsg {
550
2020-07-14
pjp
union {
551
2020-07-14
pjp
struct {
552
2020-07-14
pjp
int read;
553
2020-07-14
pjp
int rc;
554
2020-07-14
pjp
int istcp;
555
2020-07-14
pjp
int cache;
556
2020-07-14
pjp
int tsigcheck;
557
2020-07-14
pjp
struct tsig tsig;
558
2020-07-14
pjp
char mac[32];
559
2020-07-14
pjp
int buflen;
560
2020-07-14
pjp
char buf[0];
561
2020-07-14
pjp
} s;
562
2020-07-10
pjp
563
2020-07-14
pjp
char buf[16384];
564
2020-07-14
pjp
} u;
565
2020-07-14
pjp
#define pkt_s u.s
566
2020-07-14
pjp
}; /* 16384 */
567
2020-07-10
pjp
568
2020-07-10
pjp
569
2020-07-10
pjp
#define SHAREDMEMSIZE 400
570
2020-07-10
pjp
#define SHAREDMEMSIZE3 200
571
2021-01-11
pjp
#define SM_NOLOCK 0x4e4c4e4b /* NLCK */
572
2020-08-26
pjp
573
2020-08-26
pjp
struct walkentry {
574
2020-08-26
pjp
struct rbtree *rbt;
575
2020-08-26
pjp
TAILQ_ENTRY(walkentry) walk_entry;
576
2020-08-26
pjp
} *we1, *wep;
577
2020-08-26
pjp
578
2020-08-26
pjp
struct zoneentry {
579
2020-08-26
pjp
char name[DNS_MAXNAME];
580
2020-08-26
pjp
int namelen;
581
2020-08-26
pjp
char *humanname;
582
2021-01-05
pjp
uint32_t zonenumber;
583
2020-08-26
pjp
TAILQ_HEAD(, walkentry) walkhead;
584
2020-08-26
pjp
RB_ENTRY(zoneentry) zone_entry;
585
2020-08-26
pjp
};
586
2020-08-26
pjp
587
2020-08-26
pjp
RB_HEAD(zonetree, zoneentry);
588
2020-08-26
pjp
RB_PROTOTYPE(zonetree, zoneentry, zone_entry, zonecmp);
589
2020-08-26
pjp
590
2020-08-26
pjp
extern int zonecmp(struct zoneentry *, struct zoneentry *);
591
2020-08-26
pjp
592
2021-01-07
pjp
struct pnentry {
593
2021-01-07
pjp
char name[DNS_MAXNAME];
594
2021-01-07
pjp
int namelen;
595
2021-01-07
pjp
char *humanname;
596
2021-01-07
pjp
int wildcard;
597
2021-01-07
pjp
RB_ENTRY(pnentry) pn_entry;
598
2021-01-07
pjp
};
599
2020-08-26
pjp
600
2021-01-07
pjp
RB_HEAD(pntree, pnentry);
601
2021-01-07
pjp
RB_PROTOTYPE(pntree, pnentry, pn_entry, pncmp);
602
2021-01-07
pjp
603
2021-01-07
pjp
extern int pncmp(struct pnentry *, struct pnentry *);
604
2016-07-06
pjp
605
2016-07-06
pjp
#endif /* _DB_H */
repomaster@centroid.eu