#ifndef XFRD_NOTIFY_H
#define XFRD_NOTIFY_H
#ifndef USE_MINI_EVENT
# ifdef HAVE_EVENT_H
# include <event.h>
# else
# include <event2/event.h>
# include "event2/event_struct.h"
# include "event2/event_compat.h"
# endif
#else
# include "mini_event.h"
#endif
#include "tsig.h"
#include "rbtree.h"
struct nsd;
struct region;
struct xfrd_zone;
struct zone_options;
struct zone;
struct xfrd_soa;
struct acl_options;
struct xfrd_state;
#define NOTIFY_CONCURRENT_MAX 16
struct notify_pkt {
struct acl_options* dest;
uint8_t notify_retry;
uint16_t notify_query_id;
time_t send_time;
};
struct notify_zone {
rbnode_type node;
const dname_type* apex;
const char* apex_str;
tsig_record_type notify_tsig;
struct zone_options* options;
struct xfrd_soa *current_soa;
int notify_send_enable;
struct event notify_send_handler;
int notify_send6_enable;
struct event notify_send6_handler;
struct timeval notify_timeout;
struct acl_options* notify_current;
uint8_t notify_restart;
struct notify_pkt pkts[NOTIFY_CONCURRENT_MAX];
int notify_pkt_count;
uint8_t is_waiting;
struct notify_zone* waiting_next;
struct notify_zone* waiting_prev;
} ATTR_PACKED;
void init_notify_send(rbtree_type* tree, region_type* region,
struct zone_options* options);
void xfrd_del_notify(struct xfrd_state* xfrd, const dname_type* dname);
void xfrd_send_notify(rbtree_type* tree, const struct dname* apex,
struct xfrd_soa* new_soa);
void xfrd_notify_start(struct notify_zone* zone, struct xfrd_state* xfrd);
void notify_handle_master_zone_soainfo(rbtree_type* tree,
const dname_type* apex, struct xfrd_soa* new_soa);
void close_notify_fds(rbtree_type* tree);
void notify_disable(struct notify_zone* zone);
#endif