Skip to content

File SolidSyslogStream.h

FileList > Core > Interface > SolidSyslogStream.h

Go to the source code of this file

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

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

Public Attributes

Type Name
EXTERN_C_BEGIN typedef intptr_t SolidSyslogSsize
Signed byte count, the return type of Read.

Public Functions

Type Name
void SolidSyslogStream_Close (struct SolidSyslogStream * stream)
Close the underlying socket.
bool SolidSyslogStream_Open (struct SolidSyslogStream * stream, const struct SolidSyslogAddress * addr)
Connect to addr , bounded (a stream implementation caps the connect, and any TLS handshake, so the servicing thread cannot hang on an unresponsive peer).
SolidSyslogSsize SolidSyslogStream_Read (struct SolidSyslogStream * stream, void * buffer, size_t size)
Non-blocking read of up to size bytes intobuffer .
bool SolidSyslogStream_Send (struct SolidSyslogStream * stream, const void * buffer, size_t size)
Non-blocking, all-or-nothing send of buffer [0..size).

Detailed Description

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

Public Attributes Documentation

variable SolidSyslogSsize

Signed byte count, the return type of Read.

EXTERN_C_BEGIN 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

function SolidSyslogStream_Close

Close the underlying socket.

void SolidSyslogStream_Close (
    struct SolidSyslogStream * stream
) 

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


function 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.

function 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.

function 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