summaryrefslogtreecommitdiffstats
path: root/src/knot/conf/module.h
blob: a821792ba08a29376d4a7ca6eb1bbf685b8b3b06 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*  Copyright (C) 2023 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#pragma once

#include "knot/conf/base.h"

struct server;

/*!
 * Finds specific module in static or dynamic modules.
 *
 * \param[in] conf       Configuration.
 * \param[in] name       Module name.
 * \param[in] len        Module name length.
 * \param[in] temporary  Find only a temporary module indication.
 *
 * \return Module, NULL if not found.
 */
module_t *conf_mod_find(
	conf_t *conf,
	const char *name,
	size_t len,
	bool temporary
);

/*!
 * Loads common static and shared modules.
 *
 * \param[in] conf  Configuration.
 *
 * \return Error code, KNOT_EOK if success.
 */
int conf_mod_load_common(
	conf_t *conf
);

/*!
 * Loads extra shared module.
 *
 * \param[in] conf       Configuration.
 * \param[in] mod_name   Module name.
 * \param[in] file_name  Shared library file name.
 * \param[in] type       Type of module.
 *
 * \return Error code, KNOT_EOK if success.
 */
int conf_mod_load_extra(
	conf_t *conf,
	const char *mod_name,
	const char *file_name,
	module_type_t type
);

/*!
 * Purges temporary schemas and modules after all modules loading.
 *
 * \param[in] conf       Configuration.
 * \param[in] temporary  Purge only temporary modules indication.
 */
void conf_mod_load_purge(
	conf_t *conf,
	bool temporary
);

/*!
 * Unloads all shared modules.
 *
 * \param[in] conf  Configuration.
 */
void conf_mod_unload_shared(
	conf_t *conf
);

/*!
 * Activates configured query modules for the specified zone or for all zones.
 *
 * \param[in] conf           Configuration.
 * \param[in] zone_name      Zone name, NULL for all zones.
 * \param[in] query_modules  Destination query modules list.
 * \param[in] query_plan     Destination query plan.
 */
void conf_activate_modules(
	conf_t *conf,
	struct server *server,
	const knot_dname_t *zone_name,
	list_t *query_modules,
	struct query_plan **query_plan
);

/*!
 * Deactivates query modules list.
 *
 * \param[in] query_modules  Destination query modules list.
 * \param[in] query_plan     Destination query plan.
 */
void conf_deactivate_modules(
	list_t *query_modules,
	struct query_plan **query_plan
);

/*!
 * Re-activates query modules in list.
 *
 * \param[in] conf           Configuration.
 * \param[in] query_modules  Query module list.
 * \param[in] query_plan     Query plan.
 */
void conf_reset_modules(
	conf_t *conf,
	list_t *query_modules,
	struct query_plan **query_plan
);