aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/tls/tls_stream.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-04-26 18:25:48 -0700
committerGarrett D'Amore <garrett@damore.org>2025-04-27 10:53:52 -0700
commite7977ae777ac62928041e2a07f6eddc69eb4fc40 (patch)
tree823feb4f4661f98d3dab082961e305c3b9f9206e /src/supplemental/tls/tls_stream.h
parent527a07c6b632f6991102d4fd08ac1f5f962ddfdf (diff)
downloadnng-e7977ae777ac62928041e2a07f6eddc69eb4fc40.tar.gz
nng-e7977ae777ac62928041e2a07f6eddc69eb4fc40.tar.bz2
nng-e7977ae777ac62928041e2a07f6eddc69eb4fc40.zip
TLS: break up the TLS layer a bit to refactor for DTLS.
This allows us to break the assumption that the bottom half is TCP, or even an nng_stream, since the DTLS layer will use a totally different layer. Only nng_stream neeeds to support dial and listen. Also: UDP: Make the sockaddr arguments to open const. Also: Align the IPv6 address in the sockaddr (this allows for efficient 64-bit or even 128-bit operations on these values.)
Diffstat (limited to 'src/supplemental/tls/tls_stream.h')
-rw-r--r--src/supplemental/tls/tls_stream.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/supplemental/tls/tls_stream.h b/src/supplemental/tls/tls_stream.h
new file mode 100644
index 00000000..78760f82
--- /dev/null
+++ b/src/supplemental/tls/tls_stream.h
@@ -0,0 +1,31 @@
+//
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2018 Capitar IT Group BV <info@capitar.com>
+// Copyright 2019 Devolutions <info@devolutions.net>
+//
+// This software is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+#ifndef NNG_TLS_TLS_STREAM_H
+#define NNG_TLS_TLS_STREAM_H
+
+#include "core/nng_impl.h"
+#include "tls_common.h"
+
+typedef struct tls_stream_s {
+ nng_stream stream;
+ size_t size;
+ nni_reap_node reap;
+ nni_aio conn_aio;
+ nni_aio *user_aio;
+ tls_conn conn; // NB: must be last!
+} tls_stream;
+
+extern void nni_tls_stream_free(void *arg);
+extern int nni_tls_stream_alloc(
+ tls_stream **tsp, nng_tls_config *cfg, nng_aio *user_aio);
+
+#endif