Base class that wraps the IDiarkisTcp class for easy use of TCP functionality.
More...
#include <DiarkisTcpBase.h>
|
| 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< IDiarkisTcp > | Get () |
| 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...
|
|
Base class that wraps the IDiarkisTcp class for easy use of TCP functionality.
◆ DiarkisTcpBase()
DiarkisTcpBase::DiarkisTcpBase |
( |
| ) |
|
◆ ~DiarkisTcpBase()
DiarkisTcpBase::~DiarkisTcpBase |
( |
| ) |
|
|
virtual |
◆ Setup()
void DiarkisTcpBase::Setup |
( |
const std::shared_ptr< LoggerFactory > & |
loggerFactory | ) |
|
|
virtual |
Setup function.
Register loggers and callback functions.
- Parameters
-
[in] | loggerFactory | Pointer to logger class |
◆ Connect() [1/3]
bool DiarkisTcpBase::Connect |
( |
const char * |
endpoint, |
|
|
const char * |
clientKey, |
|
|
const struct AuthInfo * |
auth |
|
) |
| |
Connect with TCP server.
- Parameters
-
[in] | endpoint | TCP server address |
[in] | clientKey | Client key |
[in] | auth | Authentication information |
◆ Connect() [2/3]
bool DiarkisTcpBase::Connect |
( |
const std::string & |
endpoint, |
|
|
const std::string & |
clientKey, |
|
|
const struct AuthInfo * |
auth |
|
) |
| |
◆ 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] | endpoint | TCP server address |
[in] | clientKey | Client key |
[in] | sid | Session ID |
[in] | key | Encryption key |
[in] | iv | Encryption initialization vector (IV) |
[in] | mackey | MAC key |
◆ IsConnected()
bool DiarkisTcpBase::IsConnected |
( |
| ) |
|
Whether or not you are connected to the TCP server.
◆ Disconnect()
void DiarkisTcpBase::Disconnect |
( |
| ) |
|
Disconnect from the TCP server.
◆ 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()
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()
Callback function called when connecting to the server.
◆ 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()
Callback function called when a response is received from the server.
◆ OnPush()
Callback function called when a push is received from the server.
◆ OnHeartbeat()
void DiarkisTcpBase::OnHeartbeat |
( |
| ) |
|
|
protectedvirtual |
Callback function called when a heartbeat is received from the server.
◆ OnNotification()
Callback function called when a notification is received from the server.
◆ tcp_
Pointer to IDiarkisTcp class.
◆ logger_
Pointer to IDiarkisLogger class.
◆ eventUnsubscriptions_
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: