Electroneum
Loading...
Searching...
No Matches
authzone.h
Go to the documentation of this file.
1/*
2 * services/authzone.h - authoritative zone that is locally hosted.
3 *
4 * Copyright (c) 2017, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * Neither the name of the NLNET LABS nor the names of its contributors may
20 * be used to endorse or promote products derived from this software without
21 * specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
43
44#ifndef SERVICES_AUTHZONE_H
45#define SERVICES_AUTHZONE_H
46#include "util/rbtree.h"
47#include "util/locks.h"
48#include "services/mesh.h"
50struct regional;
51struct config_file;
52struct config_auth;
53struct query_info;
54struct dns_msg;
55struct edns_data;
56struct module_env;
57struct worker;
58struct comm_point;
59struct comm_timer;
60struct comm_reply;
61struct auth_rrset;
62struct auth_nextprobe;
63struct auth_probe;
64struct auth_transfer;
65struct auth_master;
66struct auth_chunk;
67
85
134
154
166
180struct auth_xfer {
183
192
196 size_t namelen;
202
207
210
215
233
234 /* protected by the lock on the structure, information about
235 * the loaded authority zone. */
241
246 time_t retry;
249 time_t refresh;
253 time_t expiry;
254
259};
260
271 /* Worker pointer. NULL means unowned. */
272 struct worker* worker;
273 /* module env for this task */
275
277 time_t backoff;
283};
284
297 /* Worker pointer. NULL means unowned. */
298 struct worker* worker;
299 /* module env for this task */
301
304
312
321
326 struct comm_point* cp;
332};
333
340 /* Worker pointer. NULL means unowned. */
341 struct worker* worker;
342 /* module env for this task */
344
350
353
358
371
390
395 struct comm_point* cp;
396};
397
399struct auth_addr {
405 socklen_t addrlen;
406};
407
413 char* host;
415 char* file;
417 int http;
419 int ixfr;
424 int ssl;
426 int port;
429};
430
440 size_t len;
441};
442
447
455int auth_zones_apply_cfg(struct auth_zones* az, struct config_file* cfg,
456 int setup);
457
463void auth_xfer_pickup_initial(struct auth_zones* az, struct module_env* env);
464
471
476
480int auth_zone_write_file(struct auth_zone* z, const char* fname);
481
501int auth_zones_lookup(struct auth_zones* az, struct query_info* qinfo,
502 struct regional* region, struct dns_msg** msg, int* fallback,
503 uint8_t* dp_nm, size_t dp_nmlen);
504
515int auth_zones_answer(struct auth_zones* az, struct module_env* env,
516 struct query_info* qinfo, struct edns_data* edns, struct sldns_buffer* buf,
517 struct regional* temp);
518
530 uint8_t* name, size_t name_len, uint16_t dclass);
531
534 size_t nmlen, uint16_t dclass);
535
538 size_t nmlen, uint16_t dclass);
539
543 size_t nmlen, uint16_t dclass);
544
547
550int auth_zone_set_fallback(struct auth_zone* z, char* fallbackstr);
551
561int auth_zones_can_fallback(struct auth_zones* az, uint8_t* nm, size_t nmlen,
563
582int auth_zones_notify(struct auth_zones* az, struct module_env* env,
583 uint8_t* nm, size_t nmlen, uint16_t dclass,
584 struct sockaddr_storage* addr, socklen_t addrlen, int has_serial,
585 uint32_t serial, int* refused);
586
590
593
596
598int auth_zone_cmp(const void* z1, const void* z2);
599
601int auth_data_cmp(const void* z1, const void* z2);
602
604int auth_xfer_cmp(const void* z1, const void* z2);
605
612struct auth_xfer* auth_xfer_create(struct auth_zones* az, struct auth_zone* z);
613
621int xfer_set_masters(struct auth_master** list, struct config_auth* c,
622 int with_http);
623
625void auth_xfer_timer(void* arg);
626
628int auth_xfer_probe_udp_callback(struct comm_point* c, void* arg, int err,
629 struct comm_reply* repinfo);
631int auth_xfer_transfer_tcp_callback(struct comm_point* c, void* arg, int err,
632 struct comm_reply* repinfo);
634int auth_xfer_transfer_http_callback(struct comm_point* c, void* arg, int err,
635 struct comm_reply* repinfo);
639void auth_xfer_probe_lookup_callback(void* arg, int rcode,
640 struct sldns_buffer* buf, enum sec_status sec, char* why_bogus);
642void auth_xfer_transfer_lookup_callback(void* arg, int rcode,
643 struct sldns_buffer* buf, enum sec_status sec, char* why_bogus);
644
645/*
646 * Compares two 32-bit serial numbers as defined in RFC1982. Returns
647 * <0 if a < b, 0 if a == b, and >0 if a > b. The result is undefined
648 * if a != b but neither is greater or smaller (see RFC1982 section
649 * 3.2.).
650 */
652
653#endif /* SERVICES_AUTHZONE_H */
struct auth_zone * auth_zone_find(struct auth_zones *az, uint8_t *nm, size_t nmlen, uint16_t dclass)
struct auth_zone * auth_zones_find_zone(struct auth_zones *az, uint8_t *name, size_t name_len, uint16_t dclass)
int auth_xfer_transfer_tcp_callback(struct comm_point *c, void *arg, int err, struct comm_reply *repinfo)
struct auth_xfer * auth_xfer_create(struct auth_zones *az, struct auth_zone *z)
struct auth_zones * auth_zones_create(void)
int auth_zone_get_serial(struct auth_zone *z, uint32_t *serial)
int auth_zone_write_file(struct auth_zone *z, const char *fname)
void auth_zones_cleanup(struct auth_zones *az)
void auth_xfer_probe_timer_callback(void *arg)
int compare_serial(uint32_t a, uint32_t b)
int xfer_set_masters(struct auth_master **list, struct config_auth *c, int with_http)
void auth_zones_delete(struct auth_zones *az)
int auth_zone_read_zonefile(struct auth_zone *z)
int auth_zones_notify(struct auth_zones *az, struct module_env *env, uint8_t *nm, size_t nmlen, uint16_t dclass, struct sockaddr_storage *addr, socklen_t addrlen, int has_serial, uint32_t serial, int *refused)
int auth_xfer_transfer_http_callback(struct comm_point *c, void *arg, int err, struct comm_reply *repinfo)
int auth_zones_can_fallback(struct auth_zones *az, uint8_t *nm, size_t nmlen, uint16_t dclass)
int auth_xfer_cmp(const void *z1, const void *z2)
int auth_zone_cmp(const void *z1, const void *z2)
int auth_zone_set_zonefile(struct auth_zone *z, char *zonefile)
void auth_xfer_pickup_initial(struct auth_zones *az, struct module_env *env)
int auth_xfer_probe_udp_callback(struct comm_point *c, void *arg, int err, struct comm_reply *repinfo)
int auth_data_cmp(const void *z1, const void *z2)
struct auth_xfer * auth_xfer_find(struct auth_zones *az, uint8_t *nm, size_t nmlen, uint16_t dclass)
void auth_xfer_timer(void *arg)
struct auth_zone * auth_zone_create(struct auth_zones *az, uint8_t *nm, size_t nmlen, uint16_t dclass)
int auth_zone_parse_notify_serial(struct sldns_buffer *pkt, uint32_t *serial)
int auth_zone_set_fallback(struct auth_zone *z, char *fallbackstr)
int auth_zones_apply_cfg(struct auth_zones *az, struct config_file *cfg, int setup)
int auth_zones_answer(struct auth_zones *az, struct module_env *env, struct query_info *qinfo, struct edns_data *edns, struct sldns_buffer *buf, struct regional *temp)
void auth_xfer_probe_lookup_callback(void *arg, int rcode, struct sldns_buffer *buf, enum sec_status sec, char *why_bogus)
int auth_zones_lookup(struct auth_zones *az, struct query_info *qinfo, struct regional *region, struct dns_msg **msg, int *fallback, uint8_t *dp_nm, size_t dp_nmlen)
void auth_xfer_transfer_lookup_callback(void *arg, int rcode, struct sldns_buffer *buf, enum sec_status sec, char *why_bogus)
int lock_rw_type
Definition locks.h:261
int lock_basic_type
Definition locks.h:269
sec_status
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1124
const char * buf
unsigned short uint16_t
Definition stdint.h:125
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124
struct auth_addr * next
Definition authzone.h:401
socklen_t addrlen
Definition authzone.h:405
struct sockaddr_storage addr
Definition authzone.h:403
size_t len
Definition authzone.h:440
struct auth_chunk * next
Definition authzone.h:434
uint8_t * data
Definition authzone.h:438
rbnode_type node
Definition authzone.h:140
uint8_t * name
Definition authzone.h:142
struct auth_rrset * rrsets
Definition authzone.h:152
int namelabs
Definition authzone.h:146
size_t namelen
Definition authzone.h:144
char * file
Definition authzone.h:415
struct auth_master * next
Definition authzone.h:411
char * host
Definition authzone.h:413
struct auth_addr * list
Definition authzone.h:428
int allow_notify
Definition authzone.h:422
time_t next_probe
Definition authzone.h:279
struct comm_timer * timer
Definition authzone.h:282
time_t backoff
Definition authzone.h:277
struct module_env * env
Definition authzone.h:274
struct worker * worker
Definition authzone.h:272
struct comm_point * cp
Definition authzone.h:326
struct auth_addr * scan_addr
Definition authzone.h:320
struct auth_master * scan_specific
Definition authzone.h:315
struct module_env * env
Definition authzone.h:300
int only_lookup
Definition authzone.h:311
struct comm_timer * timer
Definition authzone.h:329
uint16_t id
Definition authzone.h:323
struct auth_master * masters
Definition authzone.h:303
struct worker * worker
Definition authzone.h:298
struct auth_master * scan_target
Definition authzone.h:318
int lookup_aaaa
Definition authzone.h:308
int timeout
Definition authzone.h:331
struct auth_master * lookup_target
Definition authzone.h:306
struct packed_rrset_data * data
Definition authzone.h:164
struct auth_rrset * next
Definition authzone.h:160
uint16_t type
Definition authzone.h:162
uint16_t id
Definition authzone.h:392
struct auth_master * master
Definition authzone.h:370
int on_ixfr_is_axfr
Definition authzone.h:386
struct auth_master * masters
Definition authzone.h:352
struct auth_master * lookup_target
Definition authzone.h:355
struct auth_chunk * chunks_last
Definition authzone.h:349
struct worker * worker
Definition authzone.h:341
int got_xfr_serial
Definition authzone.h:382
struct comm_point * cp
Definition authzone.h:395
struct auth_master * scan_target
Definition authzone.h:364
struct module_env * env
Definition authzone.h:343
uint32_t incoming_xfr_serial
Definition authzone.h:389
struct auth_master * scan_specific
Definition authzone.h:361
struct auth_addr * scan_addr
Definition authzone.h:367
size_t rr_scan_num
Definition authzone.h:384
struct auth_chunk * chunks_first
Definition authzone.h:347
uint8_t * name
Definition authzone.h:194
time_t retry
Definition authzone.h:246
int notify_has_serial
Definition authzone.h:226
rbnode_type node
Definition authzone.h:182
struct auth_transfer * task_transfer
Definition authzone.h:214
size_t namelen
Definition authzone.h:196
struct auth_master * allow_notify_list
Definition authzone.h:232
int notify_received
Definition authzone.h:224
lock_basic_type lock
Definition authzone.h:191
int zone_expired
Definition authzone.h:238
time_t lease_time
Definition authzone.h:258
uint32_t serial
Definition authzone.h:243
uint32_t notify_serial
Definition authzone.h:228
time_t refresh
Definition authzone.h:249
int have_zone
Definition authzone.h:240
struct auth_nextprobe * task_nextprobe
Definition authzone.h:206
int namelabs
Definition authzone.h:198
uint16_t dclass
Definition authzone.h:201
struct auth_probe * task_probe
Definition authzone.h:209
time_t expiry
Definition authzone.h:253
struct auth_zone * delete_next
Definition authzone.h:132
char * zonefile
Definition authzone.h:115
int zone_deleted
Definition authzone.h:130
rbnode_type node
Definition authzone.h:92
int namelabs
Definition authzone.h:99
uint8_t * name
Definition authzone.h:95
int zone_is_slave
Definition authzone.h:122
int zone_expired
Definition authzone.h:120
uint16_t dclass
Definition authzone.h:102
int for_downstream
Definition authzone.h:125
size_t namelen
Definition authzone.h:97
lock_rw_type lock
Definition authzone.h:108
int fallback_enabled
Definition authzone.h:117
rbtree_type data
Definition authzone.h:112
int for_upstream
Definition authzone.h:128
lock_rw_type lock
Definition authzone.h:73
size_t num_query_down
Definition authzone.h:83
rbtree_type ztree
Definition authzone.h:75
size_t num_query_up
Definition authzone.h:81
int have_downstream
Definition authzone.h:79
rbtree_type xtree
Definition authzone.h:77
Definition dns.h:61