Skip to content

class flake::Wire

Abstract base class for all client-side wire implementations. More...

#include <platform/flake/Wire.h>

Public Functions

Name
virtual~Wire() =default
virtual ssize_tread(uint8_t * buf, size_t len) =0
Read data from the wire.
virtual ssize_twrite(constuint8_t * buf, size_t len) =0
Write data to the wire.
virtual intclose() =0
Close the wire and release associated resources.
virtual boolisOpen() =0
Check whether the wire is currently open.
virtual intopen() =0
Open (or re-open) the wire.
virtual intsecure() const =0
Query whether the wire uses a secure transport (e.g. TLS).
virtual intauthenticated() const =0
Query whether the peer has been authenticated.
virtual WireTypetype() const =0
Return the wire's transport category.

Protected Functions

Name
Wire() =default

Detailed Description

cpp
class flake::Wire;

Abstract base class for all client-side wire implementations.

Note: The class is non-copyable and non-movable by design.

Users create a concrete Wire (e.g. via flakeCreateTcpWire()) and pass it to flakeInitialize() to establish a connection to the router.

Public Functions Documentation

function ~Wire

cpp
virtual ~Wire() =default

function read

cpp
virtual ssize_t read(
    uint8_t * buf,
    size_t len
) =0

Read data from the wire.

Parameters:

  • buf Destination buffer.
  • len Maximum number of bytes to read.

Return: Number of bytes actually read, or a negative value on error.

function write

cpp
virtual ssize_t write(
    constuint8_t * buf,
    size_t len
) =0

Write data to the wire.

Parameters:

  • buf Source buffer.
  • len Number of bytes to write.

Return: Number of bytes actually written, or a negative value on error.

function close

cpp
virtual int close() =0

Close the wire and release associated resources.

Return: E_OK on success, or a negative error code.

function isOpen

cpp
virtual bool isOpen() =0

Check whether the wire is currently open.

Return: true if the wire is open, false otherwise.

function open

cpp
virtual int open() =0

Open (or re-open) the wire.

Return: E_OK on success, or a negative error code.

function secure

cpp
virtual int secure() const =0

Query whether the wire uses a secure transport (e.g. TLS).

Return: Non-zero if the transport is secure, 0 otherwise.

function authenticated

cpp
virtual int authenticated() const =0

Query whether the peer has been authenticated.

Return: Non-zero if authenticated, 0 otherwise.

function type

cpp
virtual WireType type() const =0

Return the wire's transport category.

Return: WireType::wtStream or WireType::wtDatagram.

Protected Functions Documentation

function Wire

cpp
Wire() =default