summaryrefslogtreecommitdiffstats
path: root/modules/dnstap
diff options
context:
space:
mode:
authorVladimír Čunát <vladimir.cunat@nic.cz>2019-03-14 13:09:48 +0100
committerTomas Krizek <tomas.krizek@nic.cz>2019-04-17 18:44:29 +0200
commit176b1c282a54b2547b5795238120e842fcaeb6bd (patch)
tree984a4d1a1b9f347ee6daf344d8dd2a1d13ee0d74 /modules/dnstap
parentMerge branch 'dnstap-turris' into 'master' (diff)
downloadknot-resolver-176b1c282a54b2547b5795238120e842fcaeb6bd.tar.xz
knot-resolver-176b1c282a54b2547b5795238120e842fcaeb6bd.zip
module API+ABI: remove one level of indirection
... for layers and props. This breaks C module API+ABI. It seemed weird to repeatedly call a function that returns a pointer to a structure in which we find the function we want to actually call. We've never used changing these functions AFAIK, and the target functions could easily be written to change their behavior instead (i.e. move the indirection *inside* the function). When breaking this, I also removed these two (_layers and _props) from the dynamic symbols (to be) exported from the C modules. They always pointed to memory belonging inside the module, and they seem quite sensible to be set up by the _init symbol instead.
Diffstat (limited to 'modules/dnstap')
-rw-r--r--modules/dnstap/dnstap.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/modules/dnstap/dnstap.c b/modules/dnstap/dnstap.c
index 09184260..57c22c18 100644
--- a/modules/dnstap/dnstap.c
+++ b/modules/dnstap/dnstap.c
@@ -211,6 +211,13 @@ static int dnstap_log(kr_layer_t *ctx) {
KR_EXPORT
int dnstap_init(struct kr_module *module) {
+ static kr_layer_api_t layer = {
+ .finish = &dnstap_log,
+ };
+ /* Store module reference */
+ layer.data = module;
+ module->layer = &layer;
+
/* allocated memory for internal data */
struct dnstap_data *data = malloc(sizeof(*data));
if (!data) {
@@ -368,15 +375,5 @@ int dnstap_config(struct kr_module *module, const char *conf) {
return kr_ok();
}
-KR_EXPORT
-const kr_layer_api_t *dnstap_layer(struct kr_module *module) {
- static kr_layer_api_t _layer = {
- .finish = &dnstap_log,
- };
- /* Store module reference */
- _layer.data = module;
- return &_layer;
-}
-
KR_MODULE_EXPORT(dnstap)