![]() |
Diarkis C++Client Library API Document
|
Base class for interfaces that manipulate the Diarkis library. More...
#include <DiarkisInterfaceBase.h>
Classes | |
struct | ActiveInstanceList |
struct | AsyncGetEndpointArgs |
The arguments passing to the asynchronous getting the endpoint process. More... | |
struct | RuntimeThreadData |
Public Types | |
enum | AsyncGetEndpointStatus { AsyncGetEndpointStatus::NotRunning, AsyncGetEndpointStatus::Running, AsyncGetEndpointStatus::Finish } |
Running status of the process of getting the endpoint asynchronously. More... | |
Public Member Functions | |
DiarkisInterfaceBase (const char *userId, bool bInitBaseClass=true) | |
Constructor of Diarkis interface class. More... | |
DiarkisInterfaceBase (const std::string &userId, bool bInitBaseClass=true) | |
Same as DiarkisInterfaceBase() More... | |
virtual | ~DiarkisInterfaceBase () |
Destructor of Diarkis interface class. More... | |
void | UpdateComponents () |
Update functions for UDP, TCP, and P2P. More... | |
bool | ConnectTcp (void) |
Connect to TCP server. More... | |
virtual bool | SetupTcp (void) |
Initialize DiarkisTcpBase class. More... | |
bool | ConnectTcp (const char *tcpEndpoint) |
Connect to TCP server. The status of the connection can be checked with DiarkisTCPBase::IsConnected(). More... | |
bool | ConnectTcp (const std::string &tcpEndpoint) |
Same as ConnectTcp() More... | |
bool | ConnectUdp (void) |
Connect to UDP server. More... | |
bool | GetEndpoint (const char *host, const char *clientKey, const char *serverType, char *endpoint, size_t endpointBuf) |
Obtain server connection information from the HTTP server. More... | |
bool | GetEndpoint (const std::string &host, const std::string &clientKey, const std::string &type, Diarkis::StdString &endpoint) |
Same as GetEndpoint() More... | |
virtual bool | SetupUdp (void) |
Initialize DiarkisUdpBase class. More... | |
bool | ConnectUdp (const char *udpEndpoint, const char *type, struct AuthInfo *auth) |
Connect to UDP server. The status of the connection can be checked with DiarkisUDPBase::IsConnected(). More... | |
bool | ConnectUdp (const char *udpEndpoint) |
Same as ConnectUdp(const char*, const char*, struct AuthInfo*) More... | |
bool | ConnectUdp (const std::string &udpEndpoint) |
Same as ConnectUdp(const char*, const char*, struct AuthInfo*) More... | |
bool | ConnectUdpAsync (const char *udpEndpoint) |
Connect to UDP server. The status of the connection can be checked with DiarkisUDPBase::IsConnected(). More... | |
bool | ConnectUdpAsync (const std::string &udpEndpoint) |
Same as ConnectUdpAsync() More... | |
bool | ConnectUdpDualModeAsync (const char *udpEndpoint) |
Attemps to connect to the server by async using socket dual mode (explicit support for IPv6) turned on. GetConnectedEvent will be invoked if connection is successfully made. When connected to the server with this method, P2P is disabled. More... | |
bool | ConnectUdpDualModeAsync (const std::string &udpEndpoint) |
Same as ConnectUdpDualModeAsync() More... | |
void | GetAuthInfo (struct AuthInfo *auth) |
Retrieves AuthInfo obtained with GetEndpoint(). More... | |
virtual void | SetupP2P (void) |
P2P setup functions. More... | |
void | CloseP2P (void) |
Disconnect all P2P connections. More... | |
virtual void | SetupRoom (bool bRetry=false) |
Setup function for Room function. More... | |
virtual void | SetupSession (bool bRetry=false) |
Setup function for Session features. More... | |
virtual void | SetupRpc () |
Setup function for RPC. More... | |
virtual void | SetupField (void) |
Setup function for Field function. More... | |
virtual void | SetupGroup (bool bRetry) |
Setup function for Group function. More... | |
virtual void | SetupMatchMaker (void) |
Setup function for MatchMaker function. More... | |
virtual void | SetupDirectMessage (void) |
DirectMessage setup functions. More... | |
virtual void | SetupProfile (uint32_t interval, uint32_t buffer, bool p2pRandomStart=true) |
Setup Profile functionality. More... | |
void | SetHost (const char *host) |
Set HTTP server address to connect to. More... | |
void | SetHost (const std::string &host) |
Same as SetHost() More... | |
Diarkis::StdString | GetHost () const |
Obtain the HTTP server address. More... | |
const Diarkis::StdString & | GetClientKey () const |
Obtain the client key of the connection destination. More... | |
void | SetClientKey (const char *clientKey) |
接続先のクライアントキーを設定する More... | |
void | SetClientKey (const std::string &clientKey) |
Same as SetClientKey() More... | |
const Diarkis::StdString & | GetUid () const |
Get user ID. More... | |
Diarkis::StdString | GetSid () const |
Get the SID. More... | |
void | SetSid (const char *sid) |
Set the SID. More... | |
void | SetSid (const std::string &sid) |
Same as SetSid() More... | |
std::shared_ptr< LoggerFactory > | GetLoggerFactory () |
Get loggers. More... | |
std::shared_ptr< ILoggerBackend > | GetConsoleLoggerBackend () |
Get console output log (currently unused) More... | |
std::shared_ptr< ILoggerBackend > | GetDebugLoggerBackend () |
Get debug output log. More... | |
std::shared_ptr< DiarkisUdpBase > | GetUdpBase () |
Obtaining the DiarkisUdpBase class. More... | |
std::shared_ptr< DiarkisTcpBase > | GetTcpBase () |
Obtaining the DiarkisTcpBase class. More... | |
std::shared_ptr< DiarkisP2PBase > | GetP2PBase () |
Get DiarkisP2PBase class. More... | |
std::shared_ptr< DiarkisRoomBase > | GetRoomBase () |
Get DiarkisRoomBase class. More... | |
std::shared_ptr< DiarkisSessionBase > | GetSessionBase () |
Get DiarkisSessionBase class. More... | |
std::shared_ptr< DiarkisGroupBase > | GetGroupBase () |
Get DiarkisGroupBase class. More... | |
std::shared_ptr< DiarkisFieldBase > | GetFieldBase () |
Get DiarkisFieldBase class. More... | |
std::shared_ptr< DiarkisMatchMakerBase > | GetMatchMakerBase () |
Get DiarkisMatchMakerBase class. More... | |
std::shared_ptr< DiarkisRpcBase > | GetRpcBase () |
Get DiarkisRpcBase class. More... | |
std::shared_ptr< DiarkisDirectMessageBase > | GetDirectMessageBase () |
Get DiarkisDirectMessageBase class. More... | |
std::shared_ptr< Diarkis::Network::IDiarkisProfile > | GetProfile () |
Get IDiarkisProfile class, which is an interface for profiling functions. More... | |
void | Stop () |
Stop Update Loop. More... | |
void | Disconnect () |
Disconnect TCP, UDP, and P2P connections. More... | |
void | SendPing (void) |
Send ping to UDP server. More... | |
void | SendEcho (void) |
Send echo to UDP server. More... | |
bool | IsOffline (void) |
Whether the UDP or TCP server is preparing for shutdown. More... | |
void | StartP2P (void) |
Call DiarkisRoomBase::SendStartP2PSync() More... | |
uint16_t | GetP2PConnectedNum (void) |
Get the number of P2P connected clients. More... | |
void | CreateRoom (uint16_t maxMembers, bool allowEmpty, bool join, uint16_t ttl, uint32_t interval) |
Create a new room. More... | |
void | RandomJoinRoom (uint16_t maxMembers, uint16_t ttl, uint32_t interval, bool allowEmpty) |
Join the room if available, otherwise create a new room. More... | |
void | JoinRoom () |
Join a room. More... | |
void | JoinRoom (const char *roomID) |
Join a room. More... | |
void | JoinRoom (const std::string &roomID) |
Same as JoinRoom(const char*) More... | |
void | SendMessageToRoom (const char **memberIDs, size_t memberIDsCount, const uint8_t *payload, size_t payloadSize, bool reliable) |
Sends a message to a specific member who has joined a room. More... | |
void | SendMessageToRoom (const std::vector< std::string > &memberIDs, const std::vector< uint8_t > &payload, bool reliable) |
Same as SendMessageToRoom() More... | |
void | SendLeaveRoom () |
Leaving a room. More... | |
void | FindByTypeRoom (uint32_t roomType, uint32_t limit) |
Searches for rooms of the same type. More... | |
void | RegisterRoom (uint32_t roomType, const char *roomName, const char *roomMetadata) |
Register additional information about the room you are participating in. More... | |
void | RegisterRoom (uint32_t roomType, const std::string &roomName, const std::string &roomMetadata) |
Same as RegisterRoom() More... | |
void | SendMigrateRoom (void) |
Move the room to a different server. More... | |
void | SendGetOwnerID (void) |
Get the room owner's user ID. More... | |
void | SendGetMemberIDs (void) |
Get a list of user IDs of members participating in a room. More... | |
Diarkis::StdString | GetRoomID () |
Get the Room ID of the room you are participating in. More... | |
void | SendCreateGroup (bool allowEmpty, bool join, uint16_t ttl) |
Creates a new group. More... | |
void | SendJoinGroup (const char *groupID, const char *message) |
Join an existing group. More... | |
void | SendJoinGroup (const std::string &groupID, const std::string &message) |
Same as SendJoingGroup() More... | |
void | SendRandomJoinGroup (uint16_t ttl, const char *message, uint32_t interval=200) |
If there is a group you can join, join that group, otherwise create a new group. More... | |
void | SendRandomJoinGroup (uint16_t ttl, const std::string &message, uint32_t interval=200) |
Same as SendRandomJoinGroup() More... | |
void | SendLeaveGroup (const char *groupID, const char *message) |
Leave from the specified group. More... | |
void | SendLeaveGroup (const std::string &groupID, const std::string &message) |
Same as SendLeaveGroup() More... | |
Diarkis::StdString | GetGroupID () |
Retrieve the Group ID of the participating group. More... | |
void | ClearUdpBuffer () |
Clear send and receive buffer of Socket. More... | |
bool | RequestEndpointAsync (const char *host, const char *clientKey, const char *type, DiarkisThreadPolicy policy, int priority, uint32_t affinityMask, uint32_t stackSize) |
Connect to an HTTP server and perform asynchronous processing to obtain TCP/UDP endpoints. More... | |
bool | RequestEndpointAsync (const std::string &host, const std::string &clientKey, const std::string &type, DiarkisThreadPolicy policy, int priority, uint32_t affinityMask, uint32_t stackSize) |
Same as RequestEndpointAsync() More... | |
AsyncGetEndpointStatus | GetEndpointAsyncStatus () const |
Get the progress of the process of getting the server endpoint asynchronous. More... | |
bool | GetAsyncEndpointResult (Diarkis::StdString &endpoint) const |
Get the result of getting the endpoint by asynchronous. More... | |
Static Public Member Functions | |
static bool | DiarkisInit (const char *logDirName, LogOutType out=DEBUG_OUT, bool bLog=true, std::shared_ptr< ILoggerBackend > customLogger=nullptr) |
Diarkis initialization. More... | |
static bool | DiarkisInit (const std::string &logDirName, LogOutType out=DEBUG_OUT, bool bLog=true, std::shared_ptr< ILoggerBackend > customLogger=nullptr) |
Same as DiarkisInit() More... | |
static bool | DiarkisDestroy () |
Diarkis termination process. More... | |
Protected Member Functions | |
void | InitAndStartup (bool bInitBaseClass) |
Initialize logs and classes of each module. More... | |
void | SchedulerAddNotifyEvent () |
An event that is executed when an event has been added to the scheduler of TCP/UDP/P2P. More... | |
void | TerminateGetEndpointAsyncThread () |
Terminate thread for the getting the endpoint async process. More... | |
Static Protected Member Functions | |
static void | CreateLogFolder () |
Create folder for log output destination. More... | |
static Diarkis::System::Result | RuntimeLoop (void *owner) |
Loop function to call Diarkis client library updates. More... | |
static void | InitializeLoggerEnvironment () |
Initialize loggers for the Diarkis depending on the logOutType. More... | |
static bool | IsLogOutputTypeFile () |
Returns whether the log output to a file. More... | |
static Diarkis::System::Result | GetEndpointAsync (void *owner) |
Thread executed by RequestEndpointAsync() More... | |
Protected Attributes | |
std::shared_ptr< DiarkisTcpBase > | tcpBase_ |
Pointer to DiarkisTcpBase class. More... | |
std::shared_ptr< DiarkisUdpBase > | udpBase_ |
Pointer to DiarkisUdpBase class. More... | |
std::shared_ptr< DiarkisP2PBase > | p2pBase_ |
Pointer to DiarkisP2PBase class. More... | |
std::shared_ptr< DiarkisRoomBase > | roomBase_ |
Pointer to DiarkisRoomBase class. More... | |
std::shared_ptr< DiarkisSessionBase > | sessionBase_ |
Pointer to DiarkisSessionBase class. More... | |
std::shared_ptr< DiarkisGroupBase > | groupBase_ |
Pointer to DiarkisGroupBase class. More... | |
std::shared_ptr< DiarkisFieldBase > | fieldBase_ |
Pointer to DiarkisFieldBase class. More... | |
std::shared_ptr< DiarkisMatchMakerBase > | matchMakerBase_ |
Pointer to DiarkisMatchMakerBase class. More... | |
std::shared_ptr< DiarkisRpcBase > | rpcBase_ |
Pointer to DiarkisRpcBase class. More... | |
std::shared_ptr< DiarkisDirectMessageBase > | dmBase_ |
Pointer to DiarkisDirectMessageBase class. More... | |
std::shared_ptr< Diarkis::Network::IDiarkisProfile > | profile_ |
Pointer to IDiarkisProfile class. More... | |
Diarkis::StdString | host_ |
Address of the HTTP server to connect to. More... | |
Diarkis::StdString | clientKey_ |
Client key of the HTTP server to connect to. More... | |
const Diarkis::StdString | uid_ |
My user ID. More... | |
Diarkis::StdString | serverType_ |
Server type. More... | |
Diarkis::StdString | sid_ |
Session ID. More... | |
AuthInfo | authInfo_ |
Authentication information. More... | |
std::shared_ptr< IDiarkisLogger > | logger_ |
Pointer to logger class. More... | |
std::shared_ptr< LoggerFactory > | loggerFactory_ |
Pointer to LoggerFactory. More... | |
std::mutex | connectioninfoMutex_ |
The mutex for the variables that are modified in the GetEndpoint method. More... | |
std::mutex | asyncGetEndpointMutex_ |
The mutex for the whole process of getting the endpoint asynchronously. More... | |
AsyncGetEndpointArgs | asyncGetEndpointArgs_ |
The arguments passing to the asynchronous getting the endpoint process. More... | |
AsyncGetEndpointStatus | asyncGetEndpointStatus_ |
The progress of the process of getting the endpoint asynchronously. More... | |
bool | asyncGetEndpointResult_ |
The result of the process of getting the endpoint asynchronously. More... | |
Diarkis::StdString | asyncEndpointResult_ |
The result of the process of getting the endpoint asynchronously. More... | |
AuthInfo | asyncAuthResult_ |
The result of the process of getting the endpoint asynchronously. More... | |
std::shared_ptr< Diarkis::System::DiarkisThread > | getEndpointAsyncThread_ |
The thread used by the process of getting the endpoint asynchronously. More... | |
std::atomic< bool > | internalSchedulerUpdated_ |
A flag enabled if the scheduler is updated. More... | |
Static Protected Attributes | |
static RuntimeThreadData | runtimeThreadData_ |
A data of the runtime thread. More... | |
static ActiveInstanceList | activeInstances_ |
A list of active instances. More... | |
static std::shared_ptr< LoggerFactory > | globalLoggerFactory_ = nullptr |
A LoggerFactory that will be used for logging of the global process of the DiarkisInterfaceBase. More... | |
static std::shared_ptr< Diarkis::StdString > | logDir_ = nullptr |
Log output directory name. More... | |
static std::shared_ptr< ThreadedLoggerBackend > | threadLoggerBackend_ = nullptr |
Threaded loggers for collective output. More... | |
static std::shared_ptr< ILoggerBackend > | consoleLoggerBackend_ = nullptr |
Logger for console output. More... | |
static std::shared_ptr< ILoggerBackend > | debugLoggerBackend_ = nullptr |
Logger for debug output. More... | |
static std::shared_ptr< ILoggerBackend > | fileLoggerBackend_ = nullptr |
Logger for file output. More... | |
static std::shared_ptr< ILoggerBackend > | customLoggerBackend_ = nullptr |
Custom logger. More... | |
static std::shared_ptr< ILoggerBackend > | aggregatedLoggerBackend_ = nullptr |
A logger interface that is used in the LoggerFactory. More... | |
static LogOutType | logOutType_ = LogOutType::FILE_OUT |
Type of debug output. More... | |
static bool | bOutputLog_ = false |
Whether to log output or not. More... | |
Base class for interfaces that manipulate the Diarkis library.
|
strong |
DiarkisInterfaceBase::DiarkisInterfaceBase | ( | const char * | userId, |
bool | bInitBaseClass = true |
||
) |
Constructor of Diarkis interface class.
[in] | userId | Unique user ID. |
[in] | bInitBaseClass | Initialize various Base classes. |
DiarkisInterfaceBase::DiarkisInterfaceBase | ( | const std::string & | userId, |
bool | bInitBaseClass = true |
||
) |
Same as DiarkisInterfaceBase()
|
virtual |
|
static |
Diarkis initialization.
[in] | logDirName | log output directory name |
[in] | out | Specify the log output destination (FILE_OUT, DEBUG_OUT). |
[in] | bLog | Whether or not output log |
[in] | customLogger | Custom Logger Designation. Used to output Diarkis internal logs to app-side logs. |
|
static |
|
static |
void DiarkisInterfaceBase::UpdateComponents | ( | ) |
Update functions for UDP, TCP, and P2P.
bool DiarkisInterfaceBase::ConnectTcp | ( | void | ) |
Connect to TCP server.
|
virtual |
bool DiarkisInterfaceBase::ConnectTcp | ( | const char * | tcpEndpoint | ) |
Connect to TCP server. The status of the connection can be checked with DiarkisTCPBase::IsConnected().
[in] | tcpEndpoint | Address of TCP server |
bool DiarkisInterfaceBase::ConnectTcp | ( | const std::string & | tcpEndpoint | ) |
bool DiarkisInterfaceBase::ConnectUdp | ( | void | ) |
Connect to UDP server.
bool DiarkisInterfaceBase::GetEndpoint | ( | const char * | host, |
const char * | clientKey, | ||
const char * | serverType, | ||
char * | endpoint, | ||
size_t | endpointBuf | ||
) |
Obtain server connection information from the HTTP server.
[in] | host | HTTP server address |
[in] | clientKey | Client key for HTTP server |
[in] | serverType | Server type |
[in] | endpoint | Obtained server address |
[in] | endpointBuf | Length of the endpoint |
bool DiarkisInterfaceBase::GetEndpoint | ( | const std::string & | host, |
const std::string & | clientKey, | ||
const std::string & | type, | ||
Diarkis::StdString & | endpoint | ||
) |
|
virtual |
bool DiarkisInterfaceBase::ConnectUdp | ( | const char * | udpEndpoint, |
const char * | type, | ||
struct AuthInfo * | auth | ||
) |
Connect to UDP server. The status of the connection can be checked with DiarkisUDPBase::IsConnected().
[in] | udpEndpoint | Address of UDP server |
[in] | type | Server type |
[in] | auth | Authentication information |
bool DiarkisInterfaceBase::ConnectUdp | ( | const char * | udpEndpoint | ) |
Same as ConnectUdp(const char*, const char*, struct AuthInfo*)
bool DiarkisInterfaceBase::ConnectUdp | ( | const std::string & | udpEndpoint | ) |
Same as ConnectUdp(const char*, const char*, struct AuthInfo*)
bool DiarkisInterfaceBase::ConnectUdpAsync | ( | const char * | udpEndpoint | ) |
Connect to UDP server. The status of the connection can be checked with DiarkisUDPBase::IsConnected().
This method will return immediately after launching the asynchronous connecting process. You can observe the progress of the asynchronous process by using DiarkisUdpbase::IsAsyncConnectRunning(). You can get the result of the asynchronous process by using DiarkisUdpbase::GetAsyncConnectResult(). Whether the connection is successful or not is checked by DiarkisUdpBase::IsConnected().
[in] | udpEndpoint | Address of UDP server |
bool DiarkisInterfaceBase::ConnectUdpAsync | ( | const std::string & | udpEndpoint | ) |
bool DiarkisInterfaceBase::ConnectUdpDualModeAsync | ( | const char * | udpEndpoint | ) |
Attemps to connect to the server by async using socket dual mode (explicit support for IPv6) turned on. GetConnectedEvent will be invoked if connection is successfully made. When connected to the server with this method, P2P is disabled.
[in] | udpEndpoint | The remote endpoint address/hostname |
bool DiarkisInterfaceBase::ConnectUdpDualModeAsync | ( | const std::string & | udpEndpoint | ) |
void DiarkisInterfaceBase::GetAuthInfo | ( | struct AuthInfo * | auth | ) |
Retrieves AuthInfo obtained with GetEndpoint().
[in] | auth | Pointer to AuthInfo to store |
|
virtual |
P2P setup functions.
P2P connection is only available when using UDP protocol.
void DiarkisInterfaceBase::CloseP2P | ( | void | ) |
Disconnect all P2P connections.
|
virtual |
Setup function for Room function.
Before calling this function, it is necessary to call SetupUdp or SetupTcp depending on the protocol to be used.
[in] | bRetry | Call with true when reconnecting after failing to join the room. The first time this function is called, it must be called with false. |
|
virtual |
Setup function for Session features.
Before calling this function, it is necessary to call SetupUdp or SetupTcp depending on the protocol to be used.
[in] | bRetry | Call with true when reconnecting after failing to join the session. The first time this function is called, it must be called with false. |
|
virtual |
Setup function for RPC.
|
virtual |
Setup function for Field function.
Before calling this function, it is necessary to call SetupUdp or SetupTcp depending on the protocol to be used.
|
virtual |
Setup function for Group function.
Before calling this function, SetupUdp or SetupTcp must be called depending on the protocol to be used.
[in] | bRetry | Call with true when reconnecting after failing to join a group. The first time this function is called, it must be called with false. |
|
virtual |
Setup function for MatchMaker function.
Before calling this function, SetupUdp or SetupTcp must be called depending on the protocol to be used.
|
virtual |
DirectMessage setup functions.
Before calling this function, SetupUdp or SetupTcp must be called depending on the protocol to be used.
|
virtual |
Setup Profile functionality.
Exchange profiling data between clients connected with P2P or Room
[in] | interval | Interval to send profile packets in ms (Default 5000 ms, Min 300 ms) |
[in] | buffer | The number of stored profiling data (Default is 16, which means store the latest 16 data. Min 8, Max 256) |
[in] | p2pRandomStart | Whether or not to stagger the initial sending timing by a random amount of time to avoid sending profile packets to each connected user on P2P at the same time. |
void DiarkisInterfaceBase::SetHost | ( | const char * | host | ) |
Set HTTP server address to connect to.
void DiarkisInterfaceBase::SetHost | ( | const std::string & | host | ) |
Diarkis::StdString DiarkisInterfaceBase::GetHost | ( | ) | const |
Obtain the HTTP server address.
const Diarkis::StdString & DiarkisInterfaceBase::GetClientKey | ( | ) | const |
Obtain the client key of the connection destination.
void DiarkisInterfaceBase::SetClientKey | ( | const char * | clientKey | ) |
接続先のクライアントキーを設定する
~@japanese
Set the client key of the connection destination
void DiarkisInterfaceBase::SetClientKey | ( | const std::string & | clientKey | ) |
const Diarkis::StdString & DiarkisInterfaceBase::GetUid | ( | ) | const |
Get user ID.
Diarkis::StdString DiarkisInterfaceBase::GetSid | ( | ) | const |
Get the SID.
void DiarkisInterfaceBase::SetSid | ( | const char * | sid | ) |
Set the SID.
void DiarkisInterfaceBase::SetSid | ( | const std::string & | sid | ) |
std::shared_ptr< LoggerFactory > DiarkisInterfaceBase::GetLoggerFactory | ( | ) |
Get loggers.
std::shared_ptr< ILoggerBackend > DiarkisInterfaceBase::GetConsoleLoggerBackend | ( | ) |
Get console output log (currently unused)
std::shared_ptr< ILoggerBackend > DiarkisInterfaceBase::GetDebugLoggerBackend | ( | ) |
Get debug output log.
std::shared_ptr< DiarkisUdpBase > DiarkisInterfaceBase::GetUdpBase | ( | ) |
Obtaining the DiarkisUdpBase class.
std::shared_ptr< DiarkisTcpBase > DiarkisInterfaceBase::GetTcpBase | ( | ) |
Obtaining the DiarkisTcpBase class.
std::shared_ptr< DiarkisP2PBase > DiarkisInterfaceBase::GetP2PBase | ( | ) |
Get DiarkisP2PBase class.
std::shared_ptr< DiarkisRoomBase > DiarkisInterfaceBase::GetRoomBase | ( | ) |
Get DiarkisRoomBase class.
std::shared_ptr< DiarkisSessionBase > DiarkisInterfaceBase::GetSessionBase | ( | ) |
Get DiarkisSessionBase class.
std::shared_ptr< DiarkisGroupBase > DiarkisInterfaceBase::GetGroupBase | ( | ) |
Get DiarkisGroupBase class.
std::shared_ptr< DiarkisFieldBase > DiarkisInterfaceBase::GetFieldBase | ( | ) |
Get DiarkisFieldBase class.
std::shared_ptr< DiarkisMatchMakerBase > DiarkisInterfaceBase::GetMatchMakerBase | ( | ) |
Get DiarkisMatchMakerBase class.
std::shared_ptr< DiarkisRpcBase > DiarkisInterfaceBase::GetRpcBase | ( | ) |
Get DiarkisRpcBase class.
std::shared_ptr< DiarkisDirectMessageBase > DiarkisInterfaceBase::GetDirectMessageBase | ( | ) |
Get DiarkisDirectMessageBase class.
std::shared_ptr< Diarkis::Network::IDiarkisProfile > DiarkisInterfaceBase::GetProfile | ( | ) |
Get IDiarkisProfile class, which is an interface for profiling functions.
void DiarkisInterfaceBase::Stop | ( | ) |
Stop Update Loop.
void DiarkisInterfaceBase::Disconnect | ( | ) |
Disconnect TCP, UDP, and P2P connections.
void DiarkisInterfaceBase::SendPing | ( | void | ) |
Send ping to UDP server.
void DiarkisInterfaceBase::SendEcho | ( | void | ) |
Send echo to UDP server.
bool DiarkisInterfaceBase::IsOffline | ( | void | ) |
Whether the UDP or TCP server is preparing for shutdown.
void DiarkisInterfaceBase::StartP2P | ( | void | ) |
uint16_t DiarkisInterfaceBase::GetP2PConnectedNum | ( | void | ) |
Get the number of P2P connected clients.
void DiarkisInterfaceBase::CreateRoom | ( | uint16_t | maxMembers, |
bool | allowEmpty, | ||
bool | join, | ||
uint16_t | ttl, | ||
uint32_t | interval | ||
) |
Create a new room.
A callback event (e.g. OnRoomCreation) registered with GetCreateEvent() will be triggered.
[in] | maxMembers | Maximum number of clients that can join the room to be created. |
[in] | allowEmpty | Determines if the room will be held even if none of the clients have joined. |
[in] | join | Determines if the room will be joined after it is created. true = join the room after creating it. No Join response is sent from the server. false = only creates the room. If you want to join the room, you must perform a separate Join. |
[in] | ttl | Specifies the duration of the room in seconds after it is empty. Used only when true is specified for allowEmpty. |
[in] | interval | Specifies the interval in milliseconds at which the server processes Broadcast messages, etc. If the value of interval is large, the server load will be reduced, but there will be a delay in receiving messages. If the value of If the value of interval is small, the server load will increase, but the message will be sent immediately from the server. The default value is 200 ms. |
void DiarkisInterfaceBase::RandomJoinRoom | ( | uint16_t | maxMembers, |
uint16_t | ttl, | ||
uint32_t | interval, | ||
bool | allowEmpty | ||
) |
Join the room if available, otherwise create a new room.
When a new room is created, the callback event registered with GetCreateEvent() (e.g. OnRoomCreation) and
callback event registered with GetJoinEvent() (e.g. OnRoomJoin) will be triggered.
Only callback events registered with GetJoinEvent() will be triggered when joining an existing room.
[in] | maxMembers | Maximum number of clients that can join the room to be created. |
[in] | ttl | Duration in seconds after the room is empty, used only when allowEmpty is set to true. |
[in] | interval | Specifies the interval in milliseconds at which the server processes messages. Messages are sent together at the server for the interval time. If the value of interval is large, the server load will be reduced, but there will be a delay in receiving messages. If the value of interval is small, the server load will increase, but the message will be sent immediately from the server. The default value is 200 ms. |
[in] | allowEmpty | Determines whether or not the client will keep the room even when no one is joining. |
void DiarkisInterfaceBase::JoinRoom | ( | ) |
Join a room.
Callback event registered with GetJoinEvent() (e.g. OnRoomJoin) will be triggered.
Callback event registered with GetMemberJoinEvent() (e.g. OnRoomMemberJoin) will be triggered on the member of the room. The user ID specified by uid can be received from the callback event.
void DiarkisInterfaceBase::JoinRoom | ( | const char * | roomID | ) |
Join a room.
Callback event registered with GetJoinEvent() (e.g. OnRoomJoin) will be triggered.
Callback event registered with GetMemberJoinEvent() (e.g. OnRoomMemberJoin) will be triggered on the member of the room. The user ID specified by uid can be received from the callback event.
[in] | roomID | Room ID to join |
void DiarkisInterfaceBase::JoinRoom | ( | const std::string & | roomID | ) |
void DiarkisInterfaceBase::SendMessageToRoom | ( | const char ** | memberIDs, |
size_t | memberIDsCount, | ||
const uint8_t * | payload, | ||
size_t | payloadSize, | ||
bool | reliable | ||
) |
Sends a message to a specific member who has joined a room.
A callback event (e.g. OnRoomMemberMessage) registered with GetMemberMessageEvent() will be triggered.
[in] | memberIDs | List of user IDs of members to send |
[in] | memberIDsCount | Number of memberID |
[in] | payload | Message to be sent |
[in] | payloadSize | Length of the payload |
[in] | reliable | Determines if the message is sent via reliable communication (RUDP); ignored for TCP protocol. |
void DiarkisInterfaceBase::SendMessageToRoom | ( | const std::vector< std::string > & | memberIDs, |
const std::vector< uint8_t > & | payload, | ||
bool | reliable | ||
) |
void DiarkisInterfaceBase::SendLeaveRoom | ( | ) |
Leaving a room.
Callback event (e.g. OnRoomLeave) registered with GetLeaveEvent() will be triggered.
If the exit is successful, a callback event (e.g. OnRoomMemberLeave) registered with GetMemberLeaveEvent()
will be triggered on each member of the room.
void DiarkisInterfaceBase::FindByTypeRoom | ( | uint32_t | roomType, |
uint32_t | limit | ||
) |
Searches for rooms of the same type.
Callback events registered with GetFindByTypeEvnet() (e.g. OnRoomFindByType) will be triggered.
In the callback event, you can receive a list of rooms as a result of the search.
[in] | roomType | Type of room to search |
[in] | limit | Maximum number of rooms in the list of search results |
void DiarkisInterfaceBase::RegisterRoom | ( | uint32_t | roomType, |
const char * | roomName, | ||
const char * | roomMetadata | ||
) |
Register additional information about the room you are participating in.
Affects searching for a type by FindRoomsByType.
[in] | roomType | Room type |
[in] | roomName | Room name |
[in] | roomMetadata | Extended string of room |
void DiarkisInterfaceBase::RegisterRoom | ( | uint32_t | roomType, |
const std::string & | roomName, | ||
const std::string & | roomMetadata | ||
) |
void DiarkisInterfaceBase::SendMigrateRoom | ( | void | ) |
Move the room to a different server.
Only the room owner can call this function.
Upon successful execution, a notification is sent from the server to each member of the room
and the callback event registered with GetMigrateEvent() (e.g. OnRoomMigrate) is triggered.
The library internally leaves from the currently joined room and joins a new room to the server.
void DiarkisInterfaceBase::SendGetOwnerID | ( | void | ) |
Get the room owner's user ID.
The callback event (e.g. OnGetOwnerID) registered with GetOwnerIDEvent() will be triggered.
void DiarkisInterfaceBase::SendGetMemberIDs | ( | void | ) |
Get a list of user IDs of members participating in a room.
Callback events (e.g. OnRoomMemberIDs) registered with GetMemberIDSEvent() will be triggered.
Diarkis::StdString DiarkisInterfaceBase::GetRoomID | ( | ) |
Get the Room ID of the room you are participating in.
void DiarkisInterfaceBase::SendCreateGroup | ( | bool | allowEmpty, |
bool | join, | ||
uint16_t | ttl | ||
) |
Creates a new group.
Callback events registered with GetCreateEvent() (e.g. OnGroupCreation) will be triggered.
[in] | allowEmpty | Determines if the client will keep the group even when no one has joined. true = Keep the group even when no clients are present. false = If the client is gone the group will be destroyed after the time specified by ttl has elapsed. |
[in] | join | Determines whether or not a new group is created and then joined. true = Join the group after it is created. In this case, the server will not respond to the Join request. false = Only creates the group. If you want to join the group, you need to execute Join separately. |
[in] | ttl | Specifies the duration, in seconds, of a group's existence after it becomes empty; used only if allowEmpty is set to true. |
void DiarkisInterfaceBase::SendJoinGroup | ( | const char * | groupID, |
const char * | message | ||
) |
Join an existing group.
A callback event registered with GetJoinEvent() (e.g. OnGroupJoin) will be triggered.
A callback event registered with GetMemberJoinEvent() (e.g. OnGroupMemberJoin) will be triggered for the member of the target group.
[in] | groupID | ID of the group to join |
[in] | message | Sends an message to group members when join. For example, you can include a user ID to notify the user ID of a newly joined member. |
void DiarkisInterfaceBase::SendJoinGroup | ( | const std::string & | groupID, |
const std::string & | message | ||
) |
Same as SendJoingGroup()
void DiarkisInterfaceBase::SendRandomJoinGroup | ( | uint16_t | ttl, |
const char * | message, | ||
uint32_t | interval = 200 |
||
) |
If there is a group you can join, join that group, otherwise create a new group.
If you join an existing group, a callback event registered with GetJoinEvent() (e.g. OnGroupJoin) will be triggered.
When a new group is created, the callback event registered with GetCreateEvent() (e.g. OnGroupCreation ) will be triggered.
[in] | ttl | Duration in seconds since the group became empty, used only when allowEmpty is set to true. |
[in] | message | Sends an optional message to group members when they join. |
[in] | interval | Specifies the interval in milliseconds between when the server processes BroadcastTo. The default value is 200ms. The messages for the time specified by interval are compiled and sent by the server. |
void DiarkisInterfaceBase::SendRandomJoinGroup | ( | uint16_t | ttl, |
const std::string & | message, | ||
uint32_t | interval = 200 |
||
) |
void DiarkisInterfaceBase::SendLeaveGroup | ( | const char * | groupID, |
const char * | message | ||
) |
Leave from the specified group.
Callback event registered with GetMemberLeaveEvent() (e.g. OnGroupMemberLeave) will be triggered.
[in] | groupID | ID of the group to leave |
[in] | message | Sends an message to group members when leaving. |
void DiarkisInterfaceBase::SendLeaveGroup | ( | const std::string & | groupID, |
const std::string & | message | ||
) |
Diarkis::StdString DiarkisInterfaceBase::GetGroupID | ( | ) |
Retrieve the Group ID of the participating group.
void DiarkisInterfaceBase::ClearUdpBuffer | ( | ) |
Clear send and receive buffer of Socket.
bool DiarkisInterfaceBase::RequestEndpointAsync | ( | const char * | host, |
const char * | clientKey, | ||
const char * | type, | ||
DiarkisThreadPolicy | policy, | ||
int | priority, | ||
uint32_t | affinityMask, | ||
uint32_t | stackSize | ||
) |
Connect to an HTTP server and perform asynchronous processing to obtain TCP/UDP endpoints.
Execution status of asynchronous processing can be obtained with GetEndpointAsyncStatus().
The result of the acquisition can be obtained with GetAsyncEndpointResult().
[in] | host | HTTP server address |
[in] | clientKey | client key of HTTP server |
[in] | type | Type of server to be acquired |
[in] | policy | Specification of the policy for scheduling threads that perform HTTP access. (Windows is not affected even if specified.) |
[in] | priority | Priority of the thread that performs HTTP access. Specify by +- increase or decrease from the current (standard) setting. Specify DiarkisThreadPriority when ps5 is used. |
[in] | affinityMask | CPU affinity setting. 1st bit = cpu1, threads are allocated from the CPU core with the smallest number where the bit stands. (PS5 only) |
[in] | stackSize | Stack size of the asyncronous thread |
bool DiarkisInterfaceBase::RequestEndpointAsync | ( | const std::string & | host, |
const std::string & | clientKey, | ||
const std::string & | type, | ||
DiarkisThreadPolicy | policy, | ||
int | priority, | ||
uint32_t | affinityMask, | ||
uint32_t | stackSize | ||
) |
DiarkisInterfaceBase::AsyncGetEndpointStatus DiarkisInterfaceBase::GetEndpointAsyncStatus | ( | ) | const |
Get the progress of the process of getting the server endpoint asynchronous.
bool DiarkisInterfaceBase::GetAsyncEndpointResult | ( | Diarkis::StdString & | endpoint | ) | const |
Get the result of getting the endpoint by asynchronous.
[out] | endpoint | Specified server address |
|
protected |
Initialize logs and classes of each module.
|
staticprotected |
Create folder for log output destination.
|
staticprotected |
Loop function to call Diarkis client library updates.
|
protected |
An event that is executed when an event has been added to the scheduler of TCP/UDP/P2P.
|
staticprotected |
Initialize loggers for the Diarkis depending on the logOutType.
|
staticprotected |
Returns whether the log output to a file.
|
protected |
Terminate thread for the getting the endpoint async process.
|
staticprotected |
|
staticprotected |
A data of the runtime thread.
|
staticprotected |
A list of active instances.
|
staticprotected |
A LoggerFactory that will be used for logging of the global process of the DiarkisInterfaceBase.
|
protected |
Pointer to DiarkisTcpBase class.
|
protected |
Pointer to DiarkisUdpBase class.
|
protected |
Pointer to DiarkisP2PBase class.
|
protected |
Pointer to DiarkisRoomBase class.
|
protected |
Pointer to DiarkisSessionBase class.
|
protected |
Pointer to DiarkisGroupBase class.
|
protected |
Pointer to DiarkisFieldBase class.
|
protected |
Pointer to DiarkisMatchMakerBase class.
|
protected |
Pointer to DiarkisRpcBase class.
|
protected |
Pointer to DiarkisDirectMessageBase class.
|
protected |
Pointer to IDiarkisProfile class.
|
protected |
Address of the HTTP server to connect to.
|
protected |
Client key of the HTTP server to connect to.
|
protected |
My user ID.
|
protected |
Server type.
|
protected |
Session ID.
|
protected |
Authentication information.
|
staticprotected |
Log output directory name.
|
protected |
Pointer to logger class.
|
protected |
Pointer to LoggerFactory.
|
staticprotected |
Threaded loggers for collective output.
|
staticprotected |
Logger for console output.
|
staticprotected |
Logger for debug output.
|
staticprotected |
Logger for file output.
|
staticprotected |
Custom logger.
|
staticprotected |
A logger interface that is used in the LoggerFactory.
|
staticprotected |
Type of debug output.
|
staticprotected |
Whether to log output or not.
|
mutableprotected |
The mutex for the variables that are modified in the GetEndpoint method.
|
mutableprotected |
The mutex for the whole process of getting the endpoint asynchronously.
|
protected |
The arguments passing to the asynchronous getting the endpoint process.
|
protected |
The progress of the process of getting the endpoint asynchronously.
|
protected |
The result of the process of getting the endpoint asynchronously.
|
protected |
The result of the process of getting the endpoint asynchronously.
|
protected |
The result of the process of getting the endpoint asynchronously.
|
protected |
The thread used by the process of getting the endpoint asynchronously.
|
protected |
A flag enabled if the scheduler is updated.