From 1b6c9a8334a480b5d686c7dcb926751add2052b8 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 24 Sep 2021 14:29:06 +0200 Subject: [PATCH] sock_dodtls: provide getters for sock and session To be able to implement the DNS message exchange outside the module. --- sys/include/net/sock/dodtls.h | 15 +++++++++++++++ .../application_layer/sock_dodtls/sock_dodtls.c | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/sys/include/net/sock/dodtls.h b/sys/include/net/sock/dodtls.h index feac88e050..49508f73cb 100644 --- a/sys/include/net/sock/dodtls.h +++ b/sys/include/net/sock/dodtls.h @@ -32,6 +32,7 @@ #ifndef NET_SOCK_DODTLS_H #define NET_SOCK_DODTLS_H +#include "net/sock/dtls.h" #include "net/sock/udp.h" #ifdef __cplusplus @@ -105,6 +106,20 @@ int sock_dodtls_query(const char *domain_name, void *addr_out, int family); */ int sock_dodtls_get_server(sock_udp_ep_t *server); +/** + * @brief Return the sock used by the DNS over DTLS client + * + * @return The sock used by the DNS over DTLS client + */ +sock_dtls_t *sock_dodtls_get_dtls_sock(void); + +/** + * @brief Return the DTLS ssession used by the DNS over DTLS client + * + * @return The DTLS session used by the DNS over DTLS client + */ +sock_dtls_session_t *sock_dodtls_get_server_session(void); + /** * @brief Configure and establish session with DNS over DTLS server * diff --git a/sys/net/application_layer/sock_dodtls/sock_dodtls.c b/sys/net/application_layer/sock_dodtls/sock_dodtls.c index 2af5e68d5e..26259336dc 100644 --- a/sys/net/application_layer/sock_dodtls/sock_dodtls.c +++ b/sys/net/application_layer/sock_dodtls/sock_dodtls.c @@ -136,6 +136,16 @@ int sock_dodtls_get_server(sock_udp_ep_t *server) return res; } +sock_dtls_t *sock_dodtls_get_dtls_sock(void) +{ + return &_dtls_sock; +} + +sock_dtls_session_t *sock_dodtls_get_server_session(void) +{ + return &_server_session; +} + int sock_dodtls_set_server(const sock_udp_ep_t *server, const credman_credential_t *creds) {