diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:41:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:41:58 +0000 |
commit | 1852910ef0fd7393da62b88aee66ee092208748e (patch) | |
tree | ad3b659dbbe622b58a5bda4fe0b5e1d80eee9277 /daemon/zimport.h | |
parent | Initial commit. (diff) | |
download | knot-resolver-1852910ef0fd7393da62b88aee66ee092208748e.tar.xz knot-resolver-1852910ef0fd7393da62b88aee66ee092208748e.zip |
Adding upstream version 5.3.1.upstream/5.3.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | daemon/zimport.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/daemon/zimport.h b/daemon/zimport.h new file mode 100644 index 0000000..96e8a73 --- /dev/null +++ b/daemon/zimport.h @@ -0,0 +1,56 @@ +/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include <stdbool.h> + +struct worker_ctx; +/** Zone import context (opaque). */ +struct zone_import_ctx; + +/** + * Completion callback + * + * @param state -1 - fail + * 0 - success + * 1 - success, but there are non-critical errors + * @param pointer to user data + */ +typedef void (*zi_callback)(int state, void *param); + +/** + * Allocate and initialize zone import context. + * + * @param worker pointer to worker state + * @return NULL or pointer to zone import context. + */ +struct zone_import_ctx *zi_allocate(struct worker_ctx *worker, + zi_callback cb, void *param); + +/** Free zone import context. */ +void zi_free(struct zone_import_ctx *z_import); + +/** + * Import zone from file. + * + * @note only root zone import is supported; origin must be NULL or "." + * @param z_import pointer to zone import context + * @param zone_file zone file name + * @param origin default origin + * @param rclass default class + * @param ttl default ttl + * @return 0 or an error code + */ +int zi_zone_import(struct zone_import_ctx *z_import, + const char *zone_file, const char *origin, + uint16_t rclass, uint32_t ttl); + +/** + * Check if import already in process. + * + * @param z_import pointer to zone import context. + * @return true if import already in process; false otherwise. + */ +bool zi_import_started(struct zone_import_ctx *z_import); |