dns.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
29 #ifndef NET_GCOAP_DNS_H
30 #define NET_GCOAP_DNS_H
31 
32 #include <stdint.h>
33 
34 #include "mutex.h"
35 #include "net/credman.h"
36 #include "net/coap.h"
37 #include "net/gcoap.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
51 #ifndef CONFIG_GCOAP_DNS_SERVER_URI_LEN
52 #define CONFIG_GCOAP_DNS_SERVER_URI_LEN 64U
53 #endif
54 
58 #ifndef CONFIG_GCOAP_DNS_CREDS_MAX
59 #if IS_USED(MODULE_GCOAP_DTLS) || defined(DOXYGEN)
60 #define CONFIG_GCOAP_DNS_CREDS_MAX 1U
61 #else
62 #define CONFIG_GCOAP_DNS_CREDS_MAX 0U
63 #endif
64 #endif
65 
69 #ifndef CONFIG_GCOAP_DNS_PDU_BUF_SIZE
70 #define CONFIG_GCOAP_DNS_PDU_BUF_SIZE 128U
71 #endif
72 
80 #ifndef CONFIG_GCOAP_DNS_BLOCK_SIZE
81 #define CONFIG_GCOAP_DNS_BLOCK_SIZE 64U
82 #endif
112 int gcoap_dns_query(const char *domain_name, void *addr_out, int family);
113 
126 int gcoap_dns_server_uri_set(const char *uri);
127 
135 
145 ssize_t gcoap_dns_server_uri_get(char *uri, size_t uri_len);
146 
153 
167 
177 
182 
193 int gcoap_dns_server_proxy_set(const char *proxy);
194 
202 
212 ssize_t gcoap_dns_server_proxy_get(char *proxy, size_t proxy_len);
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #endif /* NET_GCOAP_DNS_H */
(D)TLS credentials management module definitions
gcoap definition
uint16_t credman_tag_t
Tag of the credential.
Definition: credman.h:96
credman_type_t
Credential types.
Definition: credman.h:106
bool gcoap_dns_server_uri_is_set(void)
Checks if the URI for the DoC server is set.
int gcoap_dns_cred_add(credman_credential_t *creds)
Adds a credential for the use with the configured DoC server.
ssize_t gcoap_dns_server_uri_get(char *uri, size_t uri_len)
Gets the URI for the DoC server.
void gcoap_dns_server_proxy_reset(void)
Deletes the proxy URI.
int gcoap_dns_server_proxy_set(const char *proxy)
Sets and checks a proxy URI.
int gcoap_dns_query(const char *domain_name, void *addr_out, int family)
Query a domain name via CoAP synchronously.
int gcoap_dns_server_uri_set(const char *uri)
Sets and checks a URI for a DoC server.
void gcoap_dns_cred_remove(credman_tag_t tag, credman_type_t type)
Remove a credential for the use with the configured DoC server.
ssize_t gcoap_dns_server_proxy_get(char *proxy, size_t proxy_len)
Gets the proxy URI.
bool gcoap_dns_server_proxy_is_set(void)
Checks if a proxy URI is set.
void gcoap_dns_cred_reset(void)
Deletes all added credentials.
Mutex for thread synchronization.
Generic CoAP values as defined by RFC7252.
Credential information.
Definition: credman.h:120