aboutsummaryrefslogtreecommitdiff
path: root/src/sp/transport/tcp
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-04-27 18:40:40 -0700
committerGarrett D'Amore <garrett@damore.org>2025-06-01 22:49:00 -0700
commit8bcb82d245a5fce1bd519e2f99250dedf11e763d (patch)
tree4d663bedbb043b9d599f061d7f2b5f9509c8f390 /src/sp/transport/tcp
parent08400bd437149c4fb31af9b2abece2ae44041283 (diff)
downloadnng-8bcb82d245a5fce1bd519e2f99250dedf11e763d.tar.gz
nng-8bcb82d245a5fce1bd519e2f99250dedf11e763d.tar.bz2
nng-8bcb82d245a5fce1bd519e2f99250dedf11e763d.zip
Introduce DTLS transport for NNG.
This introduces a new experimental transport for DTLS, that provides encryption over UDP. It has a simpler protocol than the current UDP SP protocol (but we intend to fix that by making the UDP transport simpler in a follow up!) There are a few other fixes in the TLS layer itself, and in the build, that were needed to accomplish this work. Also there was an endianness bug in the UDP protocol handling, which is fixed here.
Diffstat (limited to 'src/sp/transport/tcp')
-rw-r--r--src/sp/transport/tcp/CMakeLists.txt10
-rw-r--r--src/sp/transport/tcp/tcp.c8
2 files changed, 13 insertions, 5 deletions
diff --git a/src/sp/transport/tcp/CMakeLists.txt b/src/sp/transport/tcp/CMakeLists.txt
index fea821c2..e611a502 100644
--- a/src/sp/transport/tcp/CMakeLists.txt
+++ b/src/sp/transport/tcp/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
+# Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
# Copyright 2018 Capitar IT Group BV <info@capitar.com>
#
# This software is supplied under the terms of the MIT License, a
@@ -11,6 +11,8 @@
# TCP protocol
nng_directory(tcp)
-nng_sources_if(NNG_TRANSPORT_TCP tcp.c)
-nng_defines_if(NNG_TRANSPORT_TCP NNG_TRANSPORT_TCP)
-nng_test(tcp_test)
+if (NNG_TRANSPORT_TCP)
+ nng_sources(tcp.c)
+ nng_defines(NNG_TRANSPORT_TCP)
+ nng_test(tcp_test)
+endif()
diff --git a/src/sp/transport/tcp/tcp.c b/src/sp/transport/tcp/tcp.c
index d77e7b2f..096d2e24 100644
--- a/src/sp/transport/tcp/tcp.c
+++ b/src/sp/transport/tcp/tcp.c
@@ -964,8 +964,14 @@ tcptran_ep_accept(void *arg, nni_aio *aio)
nni_mtx_unlock(&ep->mtx);
}
+static size_t
+tcptran_pipe_size(void)
+{
+ return (sizeof(tcptran_pipe));
+}
+
static nni_sp_pipe_ops tcptran_pipe_ops = {
- .p_size = sizeof(tcptran_pipe),
+ .p_size = tcptran_pipe_size,
.p_init = tcptran_pipe_init,
.p_fini = tcptran_pipe_fini,
.p_stop = tcptran_pipe_stop,