Appearance
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 int | connect(AuthenticationSink * authentication_sink) override |
virtual int | connect(PropArray & props) override |
void | reset() |
virtual void | disconnect() override Disconnect from the router. |
virtual void | queryObjects(uniqueId_t type, int * numObjects, Object ** objects[]) override |
virtual int8_t | registerService(Service * srv, uniqueId_t & uuid, bool requires_auth =false) override |
virtual int8_t | createObject(uniqueId_t & objectType, PropArray & properties, Object ** object) override |
int | subscribeObject(ObjectImpl * s, std::function< void(Indication &)> f) |
void | unsubscribeObject(ObjectImpl * s) |
int | openStream(ObjectImpl * s, string name, Stream ** str) |
int | sendRequest(Message ** dgram, ConfirmationSink * sink =nullptr, bool synchronous =false, uint32_t timeout_ms =FLAKE_DEFAULT_TIMEOUT_MS) |
int | validateMessageParameters(const addr_t src, const addr_t dst, const uint32_t messageType) |
virtual void | ref() override |
virtual void | unref() override |
bool | softConnect() |
Protected Functions
Name | |
---|---|
void | pollFunc(void * arg) |
~ConnectionImpl() | |
virtual bool | connected() override |
virtual void | onWireConnect() override |
virtual void | onWireDisconnect() override |
virtual void | onConfirmation(Confirmation & confirmation) override |
virtual void | onIndication(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() |
bool | isInitialized() |
virtual TagArray | defaultPropset() |
virtual int | subscribe(std::function< void(Indication &)> f) override |
virtual void | unsubscribe() override Unsubscribes from the object, effectively removing ALL subscriptions if there are multiple ones. |
virtual int | invoke(string command, PropArray & params, bool blocking, Confirmation ** conf) override |
virtual int | broadcast(const string message, PropArray & params) override |
virtual int | setProperty(const Property & property) override |
virtual void | getProperty(Property & property) override |
virtual int | getProperties(PropArray & properties) override |
virtual int | setProperties(PropArray & properties, int timeout_ms =FLAKE_DEFAULT_TIMEOUT_MS) override |
int | setPropertiesEx(PropArray & properties, bool dontBlock =false, int timeout_ms =FLAKE_DEFAULT_TIMEOUT_MS) |
virtual void | beginUpdate() override |
virtual int8_t | commitUpdate(int timeout_ms =0) override |
virtual int8_t | commitUpdate(PropArray * result, int timeout_ms =0) override |
virtual void | getPendingProperty(Property & property) override |
virtual int | getPendingProperties(PropArray & properties) override |
Protected Functions inherited from flake::ObjectImpl
Name | |
---|---|
ObjectImpl(ConnectionImpl * conn) | |
virtual | ~ObjectImpl() |
virtual void | onInitialized() |
int | registerProperties(PropArray & properties) |
virtual int8_t | handleCustomMessage(string name, PropArray & data, PropArray & outProps) |
virtual int8_t | handleStreamData(Stream * s, byte * cb, uint32_t len) |
virtual int | setPropertyRequested(uint32_t tag, Property & value, const PropArray & transaction, bool internal) |
virtual int | getPropertyRequested(uint32_t tag, Property & value) |
Public Attributes inherited from flake::ObjectImpl
Name | |
---|---|
const addr_t | EMPTY_ADDR |
Friends inherited from flake::ObjectImpl
Name | |
---|---|
class | Service |
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 void | pushQueue(Message * dgram) override |
bool | tryPushQueue(Message * dgram) |
ConnectionState | connectionState() |
virtual uint32_t | wireId() const override |
virtual Wire * | wire() const override |
virtual int | latency_us() override |
virtual void | shutdown() override |
virtual bool | isConnected() override |
virtual bool | isShutdown() override |
virtual bool | isShuttingDown() override |
int8_t | sendDatagram(Message * d) |
int | processBuffer(unsigned char * receiveBuffer, unsigned int buflen, Message ** d) |
Protected Functions inherited from flake::TransportImpl
Name | |
---|---|
void | start() |
Public Attributes inherited from flake::TransportImpl
Name | |
---|---|
flakeMutexId_t | m_wireMutex |
Protected Attributes inherited from flake::TransportImpl
Name | |
---|---|
volatile ConnectionState | m_connectionState |
ThreadQueue< Message * > * | m_dgramOutQueue |
WireConnectionSink * | m_wireConnectionSink |
int | m_pingCount |
uint32_t | m_lastDgramTimestamp |
Friends inherited from flake::TransportImpl
Name | |
---|---|
class | Router |
Public Functions inherited from flake::ConnectedObject
Name | |
---|---|
virtual addr_t | addr() const =0 |
virtual addr_t | broadcastAddr() const =0 |
Protected Functions inherited from flake::ConnectedObject
Name | |
---|---|
~ConnectedObject() =default |
Public Attributes inherited from flake::ConnectedObject
Name | |
---|---|
const addr_t | EMPTY_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_t | addr() const override |
virtual addr_t | broadcastAddr() const override |
Protected Attributes inherited from flake::ConnectedObjectImpl
Name | |
---|---|
addr_t | m_addr |
addr_t | m_parentAddr |
addr_t | m_broadcastAddr |
ConnectionImpl * | m_connection |
Public Functions inherited from flake::Object
Name | |
---|---|
virtual int | invoke(string command, PropArray & params, bool blocking, Confirmation ** conf) =0 |
virtual int | broadcast(string message, PropArray & params) =0 |
virtual int | getProperties(PropArray & properties) =0 |
virtual int | setProperties(PropArray & properties, int timeout_ms) =0 |
virtual int | setProperty(const Property & property) =0 |
virtual void | getProperty(Property & property) =0 |
virtual int | subscribe(std::function< void(Indication &)> f) =0 |
virtual void | unsubscribe() =0 Unsubscribes from the object, effectively removing ALL subscriptions if there are multiple ones. |
virtual void | beginUpdate() =0 |
virtual int8_t | commitUpdate(int timeout_ms =0) =0 |
virtual int8_t | commitUpdate(PropArray * result, int timeout_ms =0) =0 |
virtual void | getPendingProperty(Property & property) =0 |
virtual int | getPendingProperties(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) |
void | copyFrom(const PropArray & other) |
void | clear() |
const Property & | get(uint32_t tag) const |
bool | has(uint32_t tag) const |
void | set(const Property & val) |
char * | toString() |
size_type | count() const |
virtual bool | serialize(uint16_t * len, flake::byte ** buf) override |
virtual bool | unserialize(uint16_t len, flake::byte * buf) override |
Public Attributes inherited from flake::PropArray
Name | |
---|---|
Property | VAL_ERR_NOT_FOUND |
Public Functions inherited from flake::Serializable
Name | |
---|---|
virtual bool | serialize(uint16_t * len, flake::byte ** buf) =0 |
virtual bool | unserialize(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_t | wireId() const =0 |
virtual Wire * | wire() const =0 |
virtual void | pushQueue(Message * ) =0 |
virtual Message * | pollQueue(bool nonblocking) =0 |
virtual Message * | pollOutQueue(bool nonblocking) =0 |
virtual int | latency_us() =0 |
virtual void | shutdown() =0 |
virtual bool | isConnected() =0 |
virtual bool | isShutdown() =0 |
virtual bool | isShuttingDown() =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