Skip to content

File SolidSyslogTlsStream.h

FileList > Interface > SolidSyslogTlsStream.h

Go to the source code of this file

TLS over an injected byte-transport Stream (OpenSSL reference integration), for a StreamSender that needs an encrypted channel. More...

  • #include "ExternC.h"
  • #include "SolidSyslogSleep.h"
  • #include "SolidSyslogTlsHandshakeTimeoutFunction.h"

Classes

Type Name
struct SolidSyslogTlsStreamConfig
Wires SolidSyslogTlsStream to its transport, trust anchors, and identity.

Public Functions

Type Name
struct SolidSyslogStream * SolidSyslogTlsStream_Create (const struct SolidSyslogTlsStreamConfig * config)
Draw a TLS stream from the pool over the injected transport (see the file overview for the handshake and I/O behaviour).
void SolidSyslogTlsStream_Destroy (struct SolidSyslogStream * base)
Release the pool slot; closes the TLS session and the underlying transport first if the stream is still Open.

Detailed Description

The transport (a plain TcpStream, typically) carries the ciphertext; this stream owns the TLS.

What the stream does through its vtable is the substance:

  • Open opens the transport, then builds a fresh SSL_CTX every call (the cert-rotation contract — a reconnect re-reads the cert/key files), pins the TLS 1.2 floor, loads CaBundlePath as the trust anchors with SSL_VERIFY_PEER, wires the transport as a custom BIO, sets SNI + the expected peer identity from ServerName, and drives the handshake. Any step failing closes the whole stream so the sender reconnects on its next pass.
  • The handshake is a bounded, non-blocking retry: SSL_connect is polled, and each WANT_READ / WANT_WRITE sleeps briefly via the injected Sleep until the handshake completes, hits a hard error (rejected), or the deadline from GetHandshakeTimeoutMs expires (re-read each attempt, so a runtime-tunable value applies on the next reconnect).
  • Send is all-or-nothing over SSL_write: a short write or any error is taken as a dead connection, so the stream closes itself and the sender reconnects.
  • Read returns the bytes read, 0 for would-block (WANT_READ, connection kept), or closes on anything else — including a mid-stream WANT_WRITE (renegotiation) which fail-fast semantics treat as a transport failure; store-and-forward replays after the reopen.

Public Functions Documentation

function SolidSyslogTlsStream_Create

Draw a TLS stream from the pool over the injected transport (see the file overview for the handshake and I/O behaviour).

struct SolidSyslogStream * SolidSyslogTlsStream_Create (
    const struct SolidSyslogTlsStreamConfig * config
) 

An exhausted pool (default size 1) falls back to the shared NullStream.


function SolidSyslogTlsStream_Destroy

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

void SolidSyslogTlsStream_Destroy (
    struct SolidSyslogStream * base
) 



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