diff options
author | Grigorii Demidov <grigorii.demidov@nic.cz> | 2018-11-07 11:41:23 +0100 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2018-11-12 16:53:03 +0100 |
commit | a0cb9296f44a136c11ade006101ed64d630aae75 (patch) | |
tree | c07ee1d5456457f95b4fdb3340063632abae1b4d /daemon/ffimodule.c | |
parent | Merge !693: policy docs improvements (diff) | |
download | knot-resolver-a0cb9296f44a136c11ade006101ed64d630aae75.tar.xz knot-resolver-a0cb9296f44a136c11ade006101ed64d630aae75.zip |
prepare for adding EDNS modules
- answer_finalize: new layer
- kr_request: keep ::qsource.packet beyond the begin phase
- kr_request: add ::daemon_context
Diffstat (limited to 'daemon/ffimodule.c')
-rw-r--r-- | daemon/ffimodule.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/daemon/ffimodule.c b/daemon/ffimodule.c index 496867d7..31a1560f 100644 --- a/daemon/ffimodule.c +++ b/daemon/ffimodule.c @@ -37,6 +37,7 @@ enum { SLOT_consume, SLOT_produce, SLOT_checkout, + SLOT_answer_finalize, SLOT_count }; #define SLOT_size sizeof(int) @@ -129,6 +130,7 @@ static int l_ffi_deinit(struct kr_module *module) LAYER_UNREGISTER(L, api, consume); LAYER_UNREGISTER(L, api, produce); LAYER_UNREGISTER(L, api, checkout); + LAYER_UNREGISTER(L, api, answer_finalize); LAYER_UNREGISTER(L, api, reset); free(api); } @@ -205,6 +207,13 @@ static int l_ffi_layer_checkout(kr_layer_t *ctx, knot_pkt_t *pkt, struct sockadd lua_pushboolean(L, type == SOCK_STREAM); return l_ffi_call(L, 5); } + +static int l_ffi_layer_answer_finalize(kr_layer_t *ctx) +{ + LAYER_FFI_CALL(ctx, answer_finalize); + lua_pushlightuserdata(L, ctx->req); + return l_ffi_call(L, 2); +} #undef LAYER_FFI_CALL /** @internal Conditionally register layer trampoline @@ -234,6 +243,7 @@ static kr_layer_api_t *l_ffi_layer_create(lua_State *L, struct kr_module *module LAYER_REGISTER(L, api, consume); LAYER_REGISTER(L, api, produce); LAYER_REGISTER(L, api, checkout); + LAYER_REGISTER(L, api, answer_finalize); LAYER_REGISTER(L, api, reset); /* Begin is always set, as it initializes layer baton. */ api->begin = l_ffi_layer_begin; |