Skip to content

class flake::ConnectionImpl

#include </Users/ios_developer/workspace/coldwave-os/build/_deps/flake-src/protocol/ClientConnection.h>

Inherits from flake::Connection, flake::ObjectImpl, flake::WireConnectionSink, ClientObjectRegistry, flake::TransportImpl, flake::ConnectedObject, flake::IndicationSink, flake::ConfirmationSink, flake::ConnectedObjectImpl, flake::Object, flake::PropArray, flake::Serializable, flake::Transport

Public Functions

Name
ConnectionImpl(Wire * w, ConnectionSink * s, AuthenticationSink * a =nullptr)
virtual intconnect(AuthenticationSink * authentication_sink) override
virtual intconnect(PropArray & props) override
voidreset()
virtual voiddisconnect() override
Disconnect from the router.
virtual voidqueryObjects(uniqueId_t type, int * numObjects, Object ** objects[]) override
virtual int8_tregisterService(Service * srv, uniqueId_t & uuid, bool requires_auth =false) override
virtual int8_tcreateObject(uniqueId_t & objectType, PropArray & properties, Object ** object) override
intsubscribeObject(ObjectImpl * s, std::function< void(Indication &)> f)
voidunsubscribeObject(ObjectImpl * s)
intopenStream(ObjectImpl * s, string name, Stream ** str)
intsendRequest(Message ** dgram, ConfirmationSink * sink =nullptr, bool synchronous =false, uint32_t timeout_ms =FLAKE_DEFAULT_TIMEOUT_MS)
intvalidateMessageParameters(const addr_t src, const addr_t dst, const uint32_t messageType)
virtual voidref() override
virtual voidunref() override
boolsoftConnect()

Protected Functions

Name
voidpollFunc(void * arg)
~ConnectionImpl()
virtual boolconnected() override
virtual voidonWireConnect() override
virtual voidonWireDisconnect() override
virtual voidonConfirmation(Confirmation & confirmation) override
virtual voidonIndication(Indication & indication) override

Protected Attributes

Name
ThreadQueue< Message * >m_dgramInQueue

Additional inherited members

Protected Functions inherited from flake::Connection

Name
~Connection() =default

Public Functions inherited from flake::ObjectImpl

Name
ObjectImpl()
ObjectImpl(Service * srv)
Connection *connection()
const char *getObjectType()
boolisInitialized()
virtual TagArraydefaultPropset()
virtual intsubscribe(std::function< void(Indication &)> f) override
virtual voidunsubscribe() override
Unsubscribes from the object, effectively removing ALL subscriptions if there are multiple ones.
virtual intinvoke(string command, PropArray & params, bool blocking, Confirmation ** conf) override
virtual intbroadcast(const string message, PropArray & params) override
virtual intsetProperty(const Property & property) override
virtual voidgetProperty(Property & property) override
virtual intgetProperties(PropArray & properties) override
virtual intsetProperties(PropArray & properties, int timeout_ms =FLAKE_DEFAULT_TIMEOUT_MS) override
intsetPropertiesEx(PropArray & properties, bool dontBlock =false, int timeout_ms =FLAKE_DEFAULT_TIMEOUT_MS)
virtual voidbeginUpdate() override
virtual int8_tcommitUpdate(int timeout_ms =0) override
virtual int8_tcommitUpdate(PropArray * result, int timeout_ms =0) override
virtual voidgetPendingProperty(Property & property) override
virtual intgetPendingProperties(PropArray & properties) override

Protected Functions inherited from flake::ObjectImpl

Name
ObjectImpl(ConnectionImpl * conn)
virtual~ObjectImpl()
virtual voidonInitialized()
intregisterProperties(PropArray & properties)
virtual int8_thandleCustomMessage(string name, PropArray & data, PropArray & outProps)
virtual int8_thandleStreamData(Stream * s, byte * cb, uint32_t len)
virtual intsetPropertyRequested(uint32_t tag, Property & value, const PropArray & transaction, bool internal)
virtual intgetPropertyRequested(uint32_t tag, Property & value)

Public Attributes inherited from flake::ObjectImpl

Name
const addr_tEMPTY_ADDR

Friends inherited from flake::ObjectImpl

Name
classService

Public Functions inherited from flake::TransportImpl

Name
TransportImpl(Wire * w, ThreadQueue< Message * > & inQueue, ThreadQueue< Message * > * outQueue, WireConnectionSink * wiresink)
virtual~TransportImpl()
virtual Message *pollQueue(bool nonblocking) override
virtual voidpushQueue(Message * dgram) override
booltryPushQueue(Message * dgram)
ConnectionStateconnectionState()
virtual uint32_twireId() const override
virtual Wire *wire() const override
virtual intlatency_us() override
virtual voidshutdown() override
virtual boolisConnected() override
virtual boolisShutdown() override
virtual boolisShuttingDown() override
int8_tsendDatagram(Message * d)
intprocessBuffer(unsigned char * receiveBuffer, unsigned int buflen, Message ** d)

Protected Functions inherited from flake::TransportImpl

Name
voidstart()

Public Attributes inherited from flake::TransportImpl

Name
flakeMutexId_tm_wireMutex

Protected Attributes inherited from flake::TransportImpl

Name
volatile ConnectionStatem_connectionState
ThreadQueue< Message * > *m_dgramOutQueue
WireConnectionSink *m_wireConnectionSink
intm_pingCount
uint32_tm_lastDgramTimestamp

Friends inherited from flake::TransportImpl

Name
classRouter

Public Functions inherited from flake::ConnectedObject

Name
virtual addr_taddr() const =0
virtual addr_tbroadcastAddr() const =0

Protected Functions inherited from flake::ConnectedObject

Name
~ConnectedObject() =default

Public Attributes inherited from flake::ConnectedObject

Name
const addr_tEMPTY_ADDR

Protected Functions inherited from flake::IndicationSink

Name
~IndicationSink() =default

Protected Functions inherited from flake::ConfirmationSink

Name
~ConfirmationSink() =default

Public Functions inherited from flake::ConnectedObjectImpl

Name
ConnectedObjectImpl(ConnectionImpl * conn)
~ConnectedObjectImpl() override
virtual addr_taddr() const override
virtual addr_tbroadcastAddr() const override

Protected Attributes inherited from flake::ConnectedObjectImpl

Name
addr_tm_addr
addr_tm_parentAddr
addr_tm_broadcastAddr
ConnectionImpl *m_connection

Public Functions inherited from flake::Object

Name
virtual intinvoke(string command, PropArray & params, bool blocking, Confirmation ** conf) =0
virtual intbroadcast(string message, PropArray & params) =0
virtual intgetProperties(PropArray & properties) =0
virtual intsetProperties(PropArray & properties, int timeout_ms) =0
virtual intsetProperty(const Property & property) =0
virtual voidgetProperty(Property & property) =0
virtual intsubscribe(std::function< void(Indication &)> f) =0
virtual voidunsubscribe() =0
Unsubscribes from the object, effectively removing ALL subscriptions if there are multiple ones.
virtual voidbeginUpdate() =0
virtual int8_tcommitUpdate(int timeout_ms =0) =0
virtual int8_tcommitUpdate(PropArray * result, int timeout_ms =0) =0
virtual voidgetPendingProperty(Property & property) =0
virtual intgetPendingProperties(PropArray & properties) =0

Protected Functions inherited from flake::Object

Name
~Object() =default

Public Functions inherited from flake::PropArray

Name
virtual~PropArray()
PropArray()
PropArray(const PropArray & va)
const Property &operator[](size_type __n) const
PropArray &operator=(const PropArray & other)
voidcopyFrom(const PropArray & other)
voidclear()
const Property &get(uint32_t tag) const
boolhas(uint32_t tag) const
voidset(const Property & val)
char *toString()
size_typecount() const
virtual boolserialize(uint16_t * len, flake::byte ** buf) override
virtual boolunserialize(uint16_t len, flake::byte * buf) override

Public Attributes inherited from flake::PropArray

Name
PropertyVAL_ERR_NOT_FOUND

Public Functions inherited from flake::Serializable

Name
virtual boolserialize(uint16_t * len, flake::byte ** buf) =0
virtual boolunserialize(uint16_t len, flake::byte * buf) =0

Protected Functions inherited from flake::Serializable

Name
~Serializable() =default

Public Functions inherited from flake::Transport

Name
virtual uint32_twireId() const =0
virtual Wire *wire() const =0
virtual voidpushQueue(Message * ) =0
virtual Message *pollQueue(bool nonblocking) =0
virtual Message *pollOutQueue(bool nonblocking) =0
virtual intlatency_us() =0
virtual voidshutdown() =0
virtual boolisConnected() =0
virtual boolisShutdown() =0
virtual boolisShuttingDown() =0

Public Functions Documentation

function ConnectionImpl

cpp
ConnectionImpl(
    Wire * w,
    ConnectionSink * s,
    AuthenticationSink * a =nullptr
)

function connect

cpp
virtual int connect(
    AuthenticationSink * authentication_sink
) override

Return: E_OK if the connection has been established or an error if it failed

Reimplements: flake::Connection::connect

Establish a connection to the router

function connect

cpp
virtual int connect(
    PropArray & props
) override

Reimplements: flake::Connection::connect

function reset

cpp
void reset()

function disconnect

cpp
virtual void disconnect() override

Disconnect from the router.

Reimplements: flake::Connection::disconnect

function queryObjects

cpp
virtual void queryObjects(
    uniqueId_t type,
    int * numObjects,
    Object ** objects[]
) override

Parameters:

  • type the type of the service (the service-class)
  • numObjects number of found objects
  • objects array of objects

Reimplements: flake::Connection::queryObjects

Queries the router for exisiting service-objects. it is important to call 'unref()' on any returned object, that the caller doesn't want to use

function registerService

cpp
virtual int8_t registerService(
    Service * srv,
    uniqueId_t & uuid,
    bool requires_auth =false
) override

Reimplements: flake::Connection::registerService

we need to set all actionable props here, because they rarely ever get updated by the service itself and otherwise they'd be unknown to the router and anybody trying to set them.

we need to do this again, so the local service has them too, because pimpl->init clears the existing props...

function createObject

cpp
virtual int8_t createObject(
    uniqueId_t & objectType,
    PropArray & properties,
    Object ** object
) override

Reimplements: flake::Connection::createObject

function subscribeObject

cpp
int subscribeObject(
    ObjectImpl * s,
    std::function< void(Indication &)> f
)

function unsubscribeObject

cpp
void unsubscribeObject(
    ObjectImpl * s
)

function openStream

cpp
int openStream(
    ObjectImpl * s,
    string name,
    Stream ** str
)

function sendRequest

cpp
int sendRequest(
    Message ** dgram,
    ConfirmationSink * sink =nullptr,
    bool synchronous =false,
    uint32_t timeout_ms =FLAKE_DEFAULT_TIMEOUT_MS
)

function validateMessageParameters

cpp
int validateMessageParameters(
    const addr_t src,
    const addr_t dst,
    const uint32_t messageType
)

function ref

cpp
inline virtual void ref() override

Reimplements: flake::ConnectedObject::ref

function unref

cpp
inline virtual void unref() override

Reimplements: flake::ConnectedObject::unref

function softConnect

cpp
bool softConnect()

Protected Functions Documentation

function pollFunc

cpp
static void pollFunc(
    void * arg
)

function ~ConnectionImpl

cpp
inline ~ConnectionImpl()

function connected

cpp
inline virtual bool connected() override

Reimplements: flake::Connection::connected

function onWireConnect

cpp
virtual void onWireConnect() override

Reimplements: flake::WireConnectionSink::onWireConnect

function onWireDisconnect

cpp
virtual void onWireDisconnect() override

Reimplements: flake::WireConnectionSink::onWireDisconnect

function onConfirmation

cpp
virtual void onConfirmation(
    Confirmation & confirmation
) override

Parameters:

  • confirmation

Reimplements: flake::ConfirmationSink::onConfirmation

function onIndication

cpp
virtual void onIndication(
    Indication & indication
) override

Parameters:

  • indication

Reimplements: flake::IndicationSink::onIndication

Protected Attributes Documentation

variable m_dgramInQueue

cpp
ThreadQueue<Message*> flake::ConnectionImpl::m_dgramInQueue