dns.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2021 Freie Universität Berlin
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
29 #include <stdint.h>
30 
31 #include "mutex.h"
32 #include "net/credman.h"
33 #include "net/coap.h"
34 #include "net/gcoap.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
48 #ifndef CONFIG_GCOAP_DNS_SERVER_URI_LEN
49 #define CONFIG_GCOAP_DNS_SERVER_URI_LEN 64U
50 #endif
51 
55 #ifndef CONFIG_GCOAP_DNS_CREDS_MAX
56 #if IS_USED(MODULE_GCOAP_DTLS) || defined(DOXYGEN)
57 #define CONFIG_GCOAP_DNS_CREDS_MAX 1U
58 #else
59 #define CONFIG_GCOAP_DNS_CREDS_MAX 0U
60 #endif
61 #endif
62 
66 #ifndef CONFIG_GCOAP_DNS_PDU_BUF_SIZE
67 #define CONFIG_GCOAP_DNS_PDU_BUF_SIZE 128U
68 #endif
69 
77 #ifndef CONFIG_GCOAP_DNS_BLOCK_SIZE
78 #define CONFIG_GCOAP_DNS_BLOCK_SIZE 64U
79 #endif
109 int gcoap_dns_query(const char *domain_name, void *addr_out, int family);
110 
123 int gcoap_dns_server_uri_set(const char *uri);
124 
132 
142 ssize_t gcoap_dns_server_uri_get(char *uri, size_t uri_len);
143 
150 
164 
174 
179 
190 int gcoap_dns_server_proxy_set(const char *proxy);
191 
199 
209 ssize_t gcoap_dns_server_proxy_get(char *proxy, size_t proxy_len);
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
(D)TLS credentials management module definitions
gcoap definition
uint16_t credman_tag_t
Tag of the credential.
Definition: credman.h:92
credman_type_t
Credential types.
Definition: credman.h:102
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:116