1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #if ENABLE_DNS_OVER_TLS 5 6 #include <stdint.h> 7 #include <sys/uio.h> 8 9 typedef struct DnsServer DnsServer; 10 typedef struct DnsStream DnsStream; 11 typedef struct DnsTlsManagerData DnsTlsManagerData; 12 typedef struct DnsTlsServerData DnsTlsServerData; 13 typedef struct DnsTlsStreamData DnsTlsStreamData; 14 typedef struct Manager Manager; 15 16 #if DNS_OVER_TLS_USE_GNUTLS 17 #include "resolved-dnstls-gnutls.h" 18 #elif DNS_OVER_TLS_USE_OPENSSL 19 #include "resolved-dnstls-openssl.h" 20 #else 21 #error Unknown dependency for supporting DNS-over-TLS 22 #endif 23 24 #define DNSTLS_STREAM_CLOSED 1 25 26 int dnstls_stream_connect_tls(DnsStream *stream, DnsServer *server); 27 void dnstls_stream_free(DnsStream *stream); 28 int dnstls_stream_on_io(DnsStream *stream, uint32_t revents); 29 int dnstls_stream_shutdown(DnsStream *stream, int error); 30 ssize_t dnstls_stream_writev(DnsStream *stream, const struct iovec *iov, size_t iovcnt); 31 ssize_t dnstls_stream_read(DnsStream *stream, void *buf, size_t count); 32 33 void dnstls_server_free(DnsServer *server); 34 35 int dnstls_manager_init(Manager *manager); 36 void dnstls_manager_free(Manager *manager); 37 38 #endif /* ENABLE_DNS_OVER_TLS */ 39