]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/resolve/resolved-dns-stream.h
Merge pull request #9901 from peterbaouoft/pr/preset_enable_multiple_instances
[thirdparty/systemd.git] / src / resolve / resolved-dns-stream.h
index 5542e9e2ba92225d5eb2c368eba54a9e4eb90479..46d2704afefdde6da94d0004628af26ad6faacbb 100644 (file)
@@ -1,12 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 #pragma once
 
-/***
-  This file is part of systemd.
-
-  Copyright 2014 Lennart Poettering
-***/
-
 #include "socket-util.h"
 
 typedef struct DnsStream DnsStream;
@@ -14,11 +8,12 @@ typedef struct DnsStream DnsStream;
 #include "resolved-dns-packet.h"
 #include "resolved-dns-transaction.h"
 #include "resolved-manager.h"
-
-#if HAVE_GNUTLS
-#include <gnutls/gnutls.h>
+#if ENABLE_DNS_OVER_TLS
+#include "resolved-dnstls.h"
 #endif
 
+#define DNS_STREAM_WRITE_TLS_DATA 1
+
 /* Streams are used by three subsystems:
  *
  *   1. The normal transaction logic when doing a DNS or LLMNR lookup via TCP
@@ -28,7 +23,7 @@ typedef struct DnsStream DnsStream;
 
 struct DnsStream {
         Manager *manager;
-        int n_ref;
+        unsigned n_ref;
 
         DnsProtocol protocol;
 
@@ -45,10 +40,9 @@ struct DnsStream {
         union sockaddr_union tfo_address;
         socklen_t tfo_salen;
 
-#if HAVE_GNUTLS
-        gnutls_session_t tls_session;
-        int tls_handshake;
-        bool tls_bye;
+#if ENABLE_DNS_OVER_TLS
+        DnsTlsStreamData dnstls_data;
+        int dnstls_events;
 #endif
 
         sd_event_source *io_event_source;
@@ -74,8 +68,8 @@ struct DnsStream {
 };
 
 int dns_stream_new(Manager *m, DnsStream **s, DnsProtocol protocol, int fd, const union sockaddr_union *tfo_address);
-#if HAVE_GNUTLS
-int dns_stream_connect_tls(DnsStream *s, gnutls_session_t tls_session);
+#if ENABLE_DNS_OVER_TLS
+int dns_stream_connect_tls(DnsStream *s, void *tls_session);
 #endif
 DnsStream *dns_stream_unref(DnsStream *s);
 DnsStream *dns_stream_ref(DnsStream *s);
@@ -83,6 +77,7 @@ DnsStream *dns_stream_ref(DnsStream *s);
 DEFINE_TRIVIAL_CLEANUP_FUNC(DnsStream*, dns_stream_unref);
 
 int dns_stream_write_packet(DnsStream *s, DnsPacket *p);
+ssize_t dns_stream_writev(DnsStream *s, const struct iovec *iov, size_t iovcnt, int flags);
 
 static inline bool DNS_STREAM_QUEUED(DnsStream *s) {
         assert(s);