Skip to content

class flake::Connection

Primary client-side handle to the Flake system. More...

#include <platform/flake/Connection.h>

Public Functions

Name
virtual intconnect(AuthenticationSink * authentication_sink) =0
Establish a connection to the router using challenge-based authentication.
virtual intconnect(PropArray & props) =0
Establish a connection to the router with interactive (property-based) authentication.
virtual voiddisconnect() =0
Disconnect from the router.
virtual boolconnected() =0
Check whether the connection to the router is active.
virtual intregisterObject(ObjectDelegate * srv, uniqueId_t & uuid, bool requires_auth =false) =0
Register a local object with the router so that remote clients can discover and interact with it.
virtual intunregisterObject(ObjectDelegate * srv) =0
Unregister a previously registered object from the router.
virtual intqueryObjects(uniqueId_t type, Object ** objects, int maxCount) =0
Query the router for all objects matching a given type UUID.
virtual uint16_tgetMTU() const =0
Retrieve the Maximum Transmission Unit configured for this connection.
virtual ConnectionImpl *impl() =0
Obtain the internal implementation object.

Protected Functions

Name
Connection() =default
Connection(constConnection & ) =deleted
Connection &operator=(constConnection & ) =deleted
Connection(Connection && ) =deleted
Connection &operator=(Connection && ) =deleted
virtual~Connection() =default

Detailed Description

cpp
class flake::Connection;

Primary client-side handle to the Flake system.

Note: Non-copyable, non-movable. Instances are created and destroyed exclusively by the library.

A Connection is obtained through one of the flakeInitialize* functions. It provides methods for:

  • Establishing and tearing down the session with the router.
  • Registering / unregistering local ObjectDelegate instances.
  • Querying the router for remote objects by type UUID.

Public Functions Documentation

function connect

cpp
virtual int connect(
    AuthenticationSink * authentication_sink
) =0

Establish a connection to the router using challenge-based authentication.

Parameters:

  • authentication_sink Sink that handles the auth handshake (may be nullptr if no auth is needed).

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

function connect

cpp
virtual int connect(
    PropArray & props
) =0

Establish a connection to the router with interactive (property-based) authentication.

Parameters:

  • props Properties to send during the connect handshake (e.g. user/password).

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

function disconnect

cpp
virtual void disconnect() =0

Disconnect from the router.

Any registered objects will be unregistered automatically.

function connected

cpp
virtual bool connected() =0

Check whether the connection to the router is active.

Return: true if connected, false otherwise.

function registerObject

cpp
virtual int registerObject(
    ObjectDelegate * srv,
    uniqueId_t & uuid,
    bool requires_auth =false
) =0

Register a local object with the router so that remote clients can discover and interact with it.

Parameters:

  • srv The delegate implementing the object logic.
  • uuid The type UUID of the object. The library may modify this in place.
  • requires_auth If true, remote access to this object requires prior authentication.

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

function unregisterObject

cpp
virtual int unregisterObject(
    ObjectDelegate * srv
) =0

Unregister a previously registered object from the router.

Parameters:

  • srv The delegate to unregister.

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

function queryObjects

cpp
virtual int queryObjects(
    uniqueId_t type,
    Object ** objects,
    int maxCount
) =0

Query the router for all objects matching a given type UUID.

Parameters:

  • type The type UUID to search for.
  • objects Caller-allocated array to receive Object pointers.
  • maxCount Maximum number of elements in objects.

Return: Total number of objects found (may exceed maxCount), or a negative error code.

Note: The caller must call unref() on every returned Object that it does not intend to keep.

function getMTU

cpp
virtual uint16_t getMTU() const =0

Retrieve the Maximum Transmission Unit configured for this connection.

Return: MTU in bytes.

function impl

cpp
virtual ConnectionImpl * impl() =0

Obtain the internal implementation object.

Return: Pointer to the ConnectionImpl (for internal use).

Protected Functions Documentation

function Connection

cpp
Connection() =default

function Connection

cpp
Connection(
    constConnection & 
) =deleted

function operator=

cpp
Connection & operator=(
    constConnection & 
) =deleted

function Connection

cpp
Connection(
    Connection && 
) =deleted

function operator=

cpp
Connection & operator=(
    Connection && 
) =deleted

function ~Connection

cpp
virtual ~Connection() =default