Skip to content

Commit

Permalink
sock_dodtls: provide getters for sock and session
Browse files Browse the repository at this point in the history
To be able to implement the DNS message exchange outside the module.
  • Loading branch information
miri64 committed Jul 26, 2022
1 parent 96b1d9c commit 1b6c9a8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sys/include/net/sock/dodtls.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
*
Expand Down
10 changes: 10 additions & 0 deletions sys/net/application_layer/sock_dodtls/sock_dodtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 1b6c9a8

Please sign in to comment.