diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:26:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:26:00 +0000 |
commit | 830407e88f9d40d954356c3754f2647f91d5c06a (patch) | |
tree | d6a0ece6feea91f3c656166dbaa884ef8a29740e /daemon/zimport.h | |
parent | Initial commit. (diff) | |
download | knot-resolver-830407e88f9d40d954356c3754f2647f91d5c06a.tar.xz knot-resolver-830407e88f9d40d954356c3754f2647f91d5c06a.zip |
Adding upstream version 5.6.0.upstream/5.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | daemon/zimport.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/daemon/zimport.h b/daemon/zimport.h new file mode 100644 index 0000000..5bbd992 --- /dev/null +++ b/daemon/zimport.h @@ -0,0 +1,48 @@ +/* Copyright (C) CZ.NIC, z.s.p.o. <knot-resolver@labs.nic.cz> + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include <stdbool.h> +#include <libknot/rrset.h> +#include "lib/defines.h" + +/** + * Completion callback + * + * @param state 0 for OK completion, < 0 for errors (unfinished) + * @param param pointer to user data + */ +typedef void (*zi_callback)(int state, void *param); +typedef struct { + /* Parser, see zs_init() */ + const char *zone_file; + const char *origin; + uint32_t ttl; + + /// Source of time: current real time, or file modification time. + enum { ZI_STAMP_NOW = 0, ZI_STAMP_MTIM } time_src; + + /* Validator */ + bool downgrade; /// true -> disable validation + bool zonemd; /// true -> verify zonemd + const knot_rrset_t *ds; /// NULL -> use trust anchors + + zi_callback cb; + void *cb_param; +} zi_config_t; + +/** Import zone from a file. + * + * Error can be directly returned in the first phase (parsing + ZONEMD); + * otherwise it will be kr_ok() and config->cb gets (optionally) called finally. + * + * Large zone would pause other processing for longer time; + * that's generally not advisable. + * + * Zone origin is detected from SOA, but it's certainly not perfect now. + */ +KR_EXPORT +int zi_zone_import(const zi_config_t config); + |