diff options
author | Vladimír Čunát <vladimir.cunat@nic.cz> | 2024-06-10 15:52:42 +0200 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2024-07-22 17:57:47 +0200 |
commit | 05b046ce953beb6324e919d6e0c6fe225b0a8910 (patch) | |
tree | c433ac1bf1fd3c5f4aa2a4d9f6654f4874aafe0d /daemon | |
parent | daemon: set options on sockets towards clients (optionally) (diff) | |
download | knot-resolver-05b046ce953beb6324e919d6e0c6fe225b0a8910.tar.xz knot-resolver-05b046ce953beb6324e919d6e0c6fe225b0a8910.zip |
daemon/lua: bind `the_network` into lua
Because why not. It's easy and it might become useful one day.
> (require 'ffi').C.the_network.tcp.user_timeout
1000
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/lua/kres-gen-33.lua | 32 | ||||
-rwxr-xr-x | daemon/lua/kres-gen.sh | 7 |
2 files changed, 39 insertions, 0 deletions
diff --git a/daemon/lua/kres-gen-33.lua b/daemon/lua/kres-gen-33.lua index 77e69f2c..6be16bc4 100644 --- a/daemon/lua/kres-gen-33.lua +++ b/daemon/lua/kres-gen-33.lua @@ -509,6 +509,7 @@ int kr_rule_zonefile(const struct kr_rule_zonefile_config *); int kr_rule_forward(const knot_dname_t *, kr_rule_fwd_flags_t, const struct sockaddr **); int kr_rule_local_address(const char *, const char *, _Bool, uint32_t, kr_rule_tags_t); int kr_rule_local_hosts(const char *, _Bool, uint32_t, kr_rule_tags_t); +struct tls_credentials; typedef struct { int sock_type; _Bool tls; @@ -559,6 +560,36 @@ typedef struct { zi_callback cb; void *cb_param; } zi_config_t; +typedef struct uv_loop_s uv_loop_t; +typedef struct trie tls_client_params_t; +struct net_tcp_param { + uint64_t in_idle_timeout; + uint64_t tls_handshake_timeout; + unsigned int user_timeout; +}; +struct network { + uv_loop_t *loop; + trie_t *endpoints; + trie_t *endpoint_kinds; + _Bool missing_kind_is_error : 1; + _Bool proxy_all4 : 1; + _Bool proxy_all6 : 1; + trie_t *proxy_addrs4; + trie_t *proxy_addrs6; + struct tls_credentials *tls_credentials; + tls_client_params_t *tls_client_params; + struct tls_session_ticket_ctx *tls_session_ticket_ctx; + struct net_tcp_param tcp; + int tcp_backlog; + struct { + int snd; + int rcv; + } listen_udp_buflens; + struct { + int snd; + int rcv; + } listen_tcp_buflens; +}; struct args *the_args; struct endpoint { void *handle; @@ -591,6 +622,7 @@ struct worker_ctx { struct kr_context *the_resolver; struct worker_ctx *the_worker; struct engine *the_engine; +struct network *the_network; typedef struct { uint8_t *params_position; uint8_t *mandatory_position; diff --git a/daemon/lua/kres-gen.sh b/daemon/lua/kres-gen.sh index 8554a783..d335c0ec 100755 --- a/daemon/lua/kres-gen.sh +++ b/daemon/lua/kres-gen.sh @@ -312,6 +312,7 @@ EOF ## kresd itself: worker stuff +echo "struct tls_credentials;" ${CDEFS} ${KRESD} types <<-EOF endpoint_flags_t @@ -322,6 +323,11 @@ ${CDEFS} ${KRESD} types <<-EOF config_array_t struct args zi_config_t + # struct network - and all requirements that are missing so far + typedef uv_loop_t + typedef tls_client_params_t + struct net_tcp_param + struct network EOF echo "struct args *the_args;" @@ -349,6 +355,7 @@ printf "\tchar _stub[];\n};\n" echo "struct kr_context *the_resolver;" echo "struct worker_ctx *the_worker;" echo "struct engine *the_engine;" +echo "struct network *the_network;" ## libzscanner API for ./zonefile.lua |