resolved: add missing error code check when initializing DNS-over-TLS
[thirdparty/systemd.git] / src / resolve / resolved-dnstls.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #if !ENABLE_DNS_OVER_TLS
5 #error This source file requires DNS-over-TLS to be enabled
6 #endif
7
8 typedef struct DnsTlsManagerData DnsTlsManagerData;
9 typedef struct DnsTlsServerData DnsTlsServerData;
10 typedef struct DnsTlsStreamData DnsTlsStreamData;
11
12 #if DNS_OVER_TLS_USE_GNUTLS
13 #include "resolved-dnstls-gnutls.h"
14 #elif DNS_OVER_TLS_USE_OPENSSL
15 #include "resolved-dnstls-openssl.h"
16 #else
17 #error Unknown dependency for supporting DNS-over-TLS
18 #endif
19
20 #include "resolved-dns-stream.h"
21 #include "resolved-dns-transaction.h"
22
23 #define DNSTLS_STREAM_CLOSED 1
24
25 int dnstls_stream_connect_tls(DnsStream *stream, DnsServer *server);
26 void dnstls_stream_free(DnsStream *stream);
27 int dnstls_stream_on_io(DnsStream *stream, uint32_t revents);
28 int dnstls_stream_shutdown(DnsStream *stream, int error);
29 ssize_t dnstls_stream_write(DnsStream *stream, const char *buf, size_t count);
30 ssize_t dnstls_stream_read(DnsStream *stream, void *buf, size_t count);
31
32 void dnstls_server_free(DnsServer *server);
33
34 int dnstls_manager_init(Manager *manager);
35 void dnstls_manager_free(Manager *manager);