summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd/xfrd-notify.h
blob: 242c7e763cab8ec339fe0d7a69d340c645204067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * xfrd-notify.h - notify sending routines.
 *
 * Copyright (c) 2001-2011, NLnet Labs. All rights reserved.
 *
 * See LICENSE for the license.
 *
 */

#ifndef XFRD_NOTIFY_H
#define XFRD_NOTIFY_H

#include "config.h"
#include "tsig.h"
#include "netio.h"
#include "rbtree.h"

struct nsd;
struct region;
struct xfrd_zone;
struct zone_options;
struct zone;
struct xfrd_soa;
struct acl_options;

/**
 * This struct keeps track of outbound notifies for a zone.
 */
struct notify_zone_t {
	rbnode_t node;
	/* name of the zone */
	const dname_type* apex;
	const char* apex_str;

	tsig_record_type notify_tsig; /* tsig state for notify */
	struct zone_options* options;
	struct xfrd_soa *current_soa; /* current SOA in NSD */

	/* notify sending handler */
	/* Not saved on disk (i.e. kill of daemon stops notifies) */
	netio_handler_type notify_send_handler;
	struct timespec notify_timeout;
	struct acl_options* notify_current; /* current slave to notify */
	uint8_t notify_retry; /* how manieth retry in sending to current */
	uint16_t notify_query_id;

	/* is this notify waiting for a socket? */
	uint8_t is_waiting;
	/* next in the waiting list for the udp sockets */
	struct notify_zone_t* waiting_next;
};

/* initialise outgoing notifies */
void init_notify_send(rbtree_t* tree, netio_type* netio, region_type* region,
        const dname_type* apex, struct zone_options* options,
	struct zone* dbzone);

/* send notifications to all in the notify list */
void xfrd_send_notify(rbtree_t* tree, const struct dname* apex,
	struct xfrd_soa* new_soa);

/* handle soa update notify for a master zone. newsoa can be NULL.
   Makes sure that the soa (serial) has changed. Or drops notify. */
void notify_handle_master_zone_soainfo(rbtree_t* tree,
	const dname_type* apex, struct xfrd_soa* new_soa);

/* close fds in use for notification sending */
void close_notify_fds(rbtree_t* tree);

#endif /* XFRD_NOTIFY_H */