aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/tls/tls_engine.h
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/supplemental/tls/tls_engine.h
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/supplemental/tls/tls_engine.h')
-rw-r--r--src/supplemental/tls/tls_engine.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/supplemental/tls/tls_engine.h b/src/supplemental/tls/tls_engine.h
index bbc5a944..66d40826 100644
--- a/src/supplemental/tls/tls_engine.h
+++ b/src/supplemental/tls/tls_engine.h
@@ -44,7 +44,10 @@ typedef struct nng_tls_engine_conn_ops_s {
// init is used to initialize a connection object.
// The passed in connection state will be aligned naturally,
// and zeroed. On success this returns 0, else an NNG error code.
- int (*init)(nng_tls_engine_conn *, void *, nng_tls_engine_config *);
+ // The sockaddr is the peer's socket adress (needed for DTLS or
+ // possibly session resumption.)
+ int (*init)(nng_tls_engine_conn *, void *, nng_tls_engine_config *,
+ const nng_sockaddr *);
// fini destroys a connection object. This will
// be called only when no other external use of the connection
@@ -175,7 +178,7 @@ typedef enum nng_tls_engine_version_e {
} nng_tls_engine_version;
typedef struct nng_tls_engine_s {
- // _version is the engine version. This for now must
+ // version is the engine version. This for now must
// be NNG_TLS_ENGINE_VERSION. If the version does not match
// then registration of the engine will fail.
nng_tls_engine_version version;
@@ -212,7 +215,7 @@ extern int nng_tls_engine_register(const nng_tls_engine *);
// is the context structure passed in when starting the engine.
extern int nng_tls_engine_send(void *, const uint8_t *, size_t *);
-// nng_tls_engine_recv is called byu the engine to receive data over
+// nng_tls_engine_recv is called by the engine to receive data over
// the underlying connection. It returns zero on success, NNG_EAGAIN
// if the operation can't be completed yet (there is no data available
// for reading), or some other error. On success the count is updated