Skip to content

Mbed TLS platform

«interface»SolidSyslogStreamMbedTlsStreamMbedTls«interface»SolidSyslogStream«interface»SolidSyslogMbedTlsCredentials

File SolidSyslogMbedTlsStream.h

FileList > Interface > SolidSyslogMbedTlsStream.h

  • #include "SolidSyslogExternC.h"
  • #include "SolidSyslogSleep.h"
  • #include "SolidSyslogStream.h"
  • #include "SolidSyslogTlsHandshakeTimeoutFunction.h"

Classes

Type Name
struct SolidSyslogMbedTlsProfile
What one connection is made with, supplied by the integrator at each Open.
struct SolidSyslogMbedTlsStreamConfig
Wires SolidSyslogMbedTlsStream to its transport, trust anchors, and identity.

Detailed Description

TLS over an injected byte-transport Stream via Mbed TLS, itself a Stream - so a StreamSender speaks TLS to a remote collector without knowing the transport underneath, whether a TCP stream from a platform pack or one the caller supplies.

What the stream does through its vtable is the substance:

  • Open first opens the underlying transport, applies the library-owned TLS policy (client mode, TLS 1.2 floor, VERIFY_REQUIRED), asks the credentials source to install the material for this connection, installs the peer identity, then drives the handshake to completion. The non-blocking transport means each mbedtls_ssl_handshake may want more I/O; the injected Sleep bridges those polls until the handshake completes, hits a hard error (HANDSHAKE_REJECTED), or the bounded budget expires (HANDSHAKE_TIMEOUT - re-read from GetHandshakeTimeoutMs each attempt, so a runtime-tunable value applies on the next reconnect). A failed Open closes the stream so the sender reconnects on its next pass.
  • Send is all-or-nothing: a short write or any TLS error is taken as an unrecoverable session and closes the stream, so the sender reconnects.
  • Read returns the bytes read, 0 for would-block, or closes the stream on any other TLS return (alert, transport error) - fail-fast, and store-and-forward replays after the reconnect.

Peer identity comes from the profile's ServerName, asked for at each Open, or from a usable pinned fingerprint where no name is supplied. No key material reaches this stream: it asks its credentials source to install onto the ssl_config at Open and tells it at Close, so a deployment can keep material out of memory between connections. Coexistence contract: this adapter touches only per-instance ssl_config / ssl_context state and never calls process-global mbedTLS APIs (platform setup/teardown, psa_crypto_init, threading-alt, debug hooks), so it drops into an integrator process that already uses Mbed TLS elsewhere. See docs/platforms/mbedtls/setup.md.

Public Types Documentation

SolidSyslogMbedTlsProfileFunction

Called at each Open to fill profile .

typedef void(* SolidSyslogMbedTlsProfileFunction) (struct SolidSyslogMbedTlsProfile *profile, void *context);

Runs on the servicing thread, so a value the integrator changes elsewhere is read here rather than stored, and moving the stream's Version is what makes the change take effect. context is ProfileContext, passed through unchanged.


Public Functions Documentation

SolidSyslogMbedTlsStream_Create

Draw a TLS stream from the pool over the config's Transport (see the file overview for the handshake and I/O behaviour).

struct SolidSyslogStream * SolidSyslogMbedTlsStream_Create (
    const struct SolidSyslogMbedTlsStreamConfig * config
) 

A NULL config, a NULL Transport, a NULL Sleep, a NULL Rng or a NULL Credentials is reported and falls back to the shared NullStream, as does an exhausted pool.


SolidSyslogMbedTlsStream_Destroy

Release the pool slot; closes the TLS session and the underlying transport if the stream is still open.

void SolidSyslogMbedTlsStream_Destroy (
    struct SolidSyslogStream * base
) 



The documentation for this class was generated from the following file Platform/MbedTls/Interface/SolidSyslogMbedTlsStream.h