Skip to content

File SolidSyslogStream.h

FileList > Core > Interface > SolidSyslogStream.h

  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>
  • #include "SolidSyslogExternC.h"

Detailed Description

The stream role: connection-oriented byte transport (Open / Send / Read / Close) for octet-framed delivery.

These calls dispatch to the injected stream's vtable, so behaviour - connect bound, blocking discipline, any TLS layering - is that stream's.

Public Types Documentation

SolidSyslogSsize

Signed byte count, the return type of Read.

typedef intptr_t SolidSyslogSsize;

Models POSIX ssize_t using a standard-C type for portability to targets that lack <sys/types.h>'s ssize_t (notably MSVC).


Public Functions Documentation

SolidSyslogStream_Close

Close the underlying socket.

void SolidSyslogStream_Close (
    struct SolidSyslogStream * stream
) 

Idempotent, and the stream is reusable: a later Open reconnects.


SolidSyslogStream_Open

Connect to addr , bounded (a stream implementation caps the connect, and any TLS handshake, so the servicing thread cannot hang on an unresponsive peer).

bool SolidSyslogStream_Open (
    struct SolidSyslogStream * stream,
    const struct SolidSyslogAddress * addr
) 

On failure the underlying socket is already closed internally, so a bare Open retries cleanly.

Return value:

  • true connected and ready for Send / Read.
  • false not connected; call Open again to retry.

SolidSyslogStream_Read

Non-blocking read of up to size bytes intobuffer .

SolidSyslogSsize SolidSyslogStream_Read (
    struct SolidSyslogStream * stream,
    void * buffer,
    size_t size
) 

The zero return is distinct from the negative one: 0 keeps the connection, negative tears it down.

Return value:

  • >0 bytes transferred into buffer.
  • 0 nothing available right now (would-block); connection intact.
  • <0 EOF or error; the socket is closed internally, so the caller must Open before the next Send or Read.

SolidSyslogStream_Send

Non-blocking, all-or-nothing send of buffer [0..size).

bool SolidSyslogStream_Send (
    struct SolidSyslogStream * stream,
    const void * buffer,
    size_t size
) 

A short write or any error (would-block, reset, broken pipe) is treated as a lost connection: the socket is closed internally and false returned, so the caller must Open before the next Send or Read. Bounded this way, the servicing thread's drain rate stays insensitive to a wedged peer or a full kernel send buffer. buffer is read during the call and need not outlive it.



The documentation for this class was generated from the following file Core/Interface/SolidSyslogStream.h