Diarkis C++Client Library API Document
DiarkisTcpBase Class Reference

Base class that wraps the IDiarkisTcp class for easy use of TCP functionality. More...

#include <DiarkisTcpBase.h>

Collaboration diagram for DiarkisTcpBase:

Public Member Functions

 DiarkisTcpBase ()
 DiarkisTcpBase constructor. More...
 
virtual ~DiarkisTcpBase ()
 DiarkisTcpBase destructor. More...
 
virtual void Setup (const std::shared_ptr< LoggerFactory > &loggerFactory)
 Setup function. More...
 
bool Connect (const char *endpoint, const char *clientKey, const struct AuthInfo *auth)
 Connect with TCP server. More...
 
bool Connect (const std::string &endpoint, const std::string &clientKey, const struct AuthInfo *auth)
 Same as Connect(const char*, const char*, const struct AuthInfo*) More...
 
bool Connect (const std::string &endpoint, const std::string &clientKey, const std::vector< uint8_t > &sid, const std::vector< uint8_t > &key, const std::vector< uint8_t > &iv, const std::vector< uint8_t > &mackey)
 Connect with TCP server. More...
 
bool IsConnected ()
 Whether or not you are connected to the TCP server. More...
 
void Disconnect ()
 Disconnect from the TCP server. More...
 
void Update ()
 Update function that calls TCP processing in the client library. Must be called periodically. More...
 
void SetSchedulerAddNotifyEvent (std::function< void()> notifyEventFunc)
 Sets the process to be called when TCP related events are added to a scheduler. More...
 
bool IsOffline ()
 Whether the TCP server is preparing for shutdown. More...
 
std::shared_ptr< IDiarkisTcpGet ()
 Get a pointer to IDiarkisTcp. More...
 
bool SendHeartbeat (void)
 Sends a heartbeat to the. More...
 
bool SendMigrate (void)
 Attempts to change the current connection to a differernt server. More...
 

Protected Member Functions

virtual void OnConnect (const DiarkisConnectionEventArgs &args)
 Callback function called when connecting to the server. More...
 
virtual void OnDisconnect (bool isReconnect)
 Callback function called when disconnect from the server. More...
 
virtual void OnOffline ()
 Callback function called when the server prepares to shutdown. More...
 
virtual void OnResponse (const DiarkisResponseEventArgs &args, DiarkisTransportType tt)
 Callback function called when a response is received from the server. More...
 
virtual void OnPush (const DiarkisPushEventArgs &args, DiarkisTransportType tt)
 Callback function called when a push is received from the server. More...
 
virtual void OnHeartbeat ()
 Callback function called when a heartbeat is received from the server. More...
 
virtual void OnNotification (const DiarkisPushEventArgs &args)
 Callback function called when a notification is received from the server. More...
 

Protected Attributes

std::shared_ptr< IDiarkisTcptcp_
 Pointer to IDiarkisTcp class. More...
 
std::shared_ptr< IDiarkisLoggerlogger_
 Pointer to IDiarkisLogger class. More...
 
Diarkis::StdVector< std::function< void()> > eventUnsubscriptions_
 List of lambda functions. More...
 
std::function< void()> schedulerAddNotifyEventFunc_
 Callback function called when TCP related events are added. More...
 
bool bOffline_
 Whether the server is getting ready to shut down. More...
 

Detailed Description

Base class that wraps the IDiarkisTcp class for easy use of TCP functionality.

Constructor & Destructor Documentation

◆ DiarkisTcpBase()

DiarkisTcpBase::DiarkisTcpBase ( )

DiarkisTcpBase constructor.

◆ ~DiarkisTcpBase()

DiarkisTcpBase::~DiarkisTcpBase ( )
virtual

DiarkisTcpBase destructor.

Member Function Documentation

◆ Setup()

void DiarkisTcpBase::Setup ( const std::shared_ptr< LoggerFactory > &  loggerFactory)
virtual

Setup function.

Register loggers and callback functions.

Parameters
[in]loggerFactoryPointer to logger class
Here is the call graph for this function:

◆ Connect() [1/3]

bool DiarkisTcpBase::Connect ( const char *  endpoint,
const char *  clientKey,
const struct AuthInfo auth 
)

Connect with TCP server.

Parameters
[in]endpointTCP server address
[in]clientKeyClient key
[in]authAuthentication information
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Connect() [2/3]

bool DiarkisTcpBase::Connect ( const std::string &  endpoint,
const std::string &  clientKey,
const struct AuthInfo auth 
)

Same as Connect(const char*, const char*, const struct AuthInfo*)

Here is the call graph for this function:

◆ Connect() [3/3]

bool DiarkisTcpBase::Connect ( const std::string &  endpoint,
const std::string &  clientKey,
const std::vector< uint8_t > &  sid,
const std::vector< uint8_t > &  key,
const std::vector< uint8_t > &  iv,
const std::vector< uint8_t > &  mackey 
)

Connect with TCP server.

Parameters
[in]endpointTCP server address
[in]clientKeyClient key
[in]sidSession ID
[in]keyEncryption key
[in]ivEncryption initialization vector (IV)
[in]mackeyMAC key
Here is the call graph for this function:

◆ IsConnected()

bool DiarkisTcpBase::IsConnected ( )

Whether or not you are connected to the TCP server.

◆ Disconnect()

void DiarkisTcpBase::Disconnect ( )

Disconnect from the TCP server.

Here is the call graph for this function:

◆ Update()

void DiarkisTcpBase::Update ( )

Update function that calls TCP processing in the client library. Must be called periodically.

◆ SetSchedulerAddNotifyEvent()

void DiarkisTcpBase::SetSchedulerAddNotifyEvent ( std::function< void()>  notifyEventFunc)

Sets the process to be called when TCP related events are added to a scheduler.

◆ IsOffline()

bool DiarkisTcpBase::IsOffline ( )

Whether the TCP server is preparing for shutdown.

◆ Get()

std::shared_ptr< IDiarkisTcp > DiarkisTcpBase::Get ( )

Get a pointer to IDiarkisTcp.

◆ SendHeartbeat()

bool DiarkisTcpBase::SendHeartbeat ( void  )

Sends a heartbeat to the.

TCP server.

Callback events registered with GetHeartbeatEvent() (e.g. OnHeartbeat) will be triggered.
There is no need to call SendHeartbeat from outside the library, as it is sent periodically by the library's Update function.

◆ SendMigrate()

bool DiarkisTcpBase::SendMigrate ( void  )

Attempts to change the current connection to a differernt server.

SID, encryption key, IV, and MAC key are maintained after migration.

◆ OnConnect()

void DiarkisTcpBase::OnConnect ( const DiarkisConnectionEventArgs args)
protectedvirtual

Callback function called when connecting to the server.

Here is the call graph for this function:

◆ OnDisconnect()

void DiarkisTcpBase::OnDisconnect ( bool  isReconnect)
protectedvirtual

Callback function called when disconnect from the server.

◆ OnOffline()

void DiarkisTcpBase::OnOffline ( )
protectedvirtual

Callback function called when the server prepares to shutdown.

◆ OnResponse()

void DiarkisTcpBase::OnResponse ( const DiarkisResponseEventArgs args,
DiarkisTransportType  tt 
)
protectedvirtual

Callback function called when a response is received from the server.

Here is the call graph for this function:

◆ OnPush()

void DiarkisTcpBase::OnPush ( const DiarkisPushEventArgs args,
DiarkisTransportType  tt 
)
protectedvirtual

Callback function called when a push is received from the server.

Here is the call graph for this function:

◆ OnHeartbeat()

void DiarkisTcpBase::OnHeartbeat ( )
protectedvirtual

Callback function called when a heartbeat is received from the server.

◆ OnNotification()

void DiarkisTcpBase::OnNotification ( const DiarkisPushEventArgs args)
protectedvirtual

Callback function called when a notification is received from the server.

Here is the call graph for this function:

Member Data Documentation

◆ tcp_

std::shared_ptr<IDiarkisTcp> DiarkisTcpBase::tcp_
protected

Pointer to IDiarkisTcp class.

◆ logger_

std::shared_ptr<IDiarkisLogger> DiarkisTcpBase::logger_
protected

Pointer to IDiarkisLogger class.

◆ eventUnsubscriptions_

Diarkis::StdVector<std::function<void()> > DiarkisTcpBase::eventUnsubscriptions_
protected

List of lambda functions.

◆ schedulerAddNotifyEventFunc_

std::function<void()> DiarkisTcpBase::schedulerAddNotifyEventFunc_
protected

Callback function called when TCP related events are added.

◆ bOffline_

bool DiarkisTcpBase::bOffline_
protected

Whether the server is getting ready to shut down.


The documentation for this class was generated from the following files: