Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
Servatrice Class Reference

#include <servatrice.h>

Inheritance diagram for Servatrice:
[legend]
Collaboration diagram for Servatrice:
[legend]

Public Types

enum  AuthenticationMethod { AuthenticationNone , AuthenticationSql , AuthenticationPassword }

Public Slots

void scheduleShutdown (const QString &reason, int minutes)
void updateLoginMessage ()
void setRequiredFeatures (const QString &featureList)

Public Member Functions

 Servatrice (QObject *parent=nullptr)
 ~Servatrice () override
bool initServer ()
QMap< QString, bool > getServerRequiredFeatureList () const override
QString getServerName () const
QString getLoginMessage () const override
QString getRequiredFeatures () const override
QString getAuthenticationMethodString () const
QString getDBTypeString () const
QString getDbPrefix () const
QString getEmailBlackList () const
QString getEmailWhiteList () const
AuthenticationMethod getAuthenticationMethod () const
bool permitUnregisteredUsers () const override
bool getGameShouldPing () const override
bool getClientIDRequiredEnabled () const override
bool getRegOnlyServerEnabled () const override
bool getMaxUserLimitEnabled () const override
bool getStoreReplaysEnabled () const override
bool getRegistrationEnabled () const
bool getRequireEmailForRegistrationEnabled () const
bool getRequireEmailActivationEnabled () const
bool getEnableLogQuery () const override
bool getEnableForgotPassword () const
bool getEnableForgotPasswordChallenge () const
bool getEnableAudit () const
bool getEnableRegistrationAudit () const
bool getEnableForgotPasswordAudit () const
int getMinPasswordLength () const
int getIdleClientTimeout () const override
int getServerID () const override
int getMaxGameInactivityTime () const override
int getMaxPlayerInactivityTime () const override
int getClientKeepAlive () const override
int getMaxUsersPerAddress () const
int getMessageCountingInterval () const override
int getMaxMessageCountPerInterval () const override
int getMaxMessageSizePerInterval () const override
int getMaxGamesPerUser () const override
int getCommandCountingInterval () const override
int getMaxCommandCountPerInterval () const override
int getMaxUserTotal () const override
bool permitCreateGameAsJudge () const override
int getMaxTcpUserLimit () const
int getMaxWebSocketUserLimit () const
int getUsersWithAddress (const QHostAddress &address) const
int getMaxAccountsPerEmail () const
int getForgotPasswordTokenLife () const
QList< AbstractServerSocketInterface * > getUsersWithAddressAsList (const QHostAddress &address) const
void incTxBytes (quint64 num)
void incRxBytes (quint64 num)
void addDatabaseInterface (QThread *thread, Servatrice_DatabaseInterface *databaseInterface)
bool islConnectionExists (int _serverId) const
void addIslInterface (int _serverId, IslInterface *interface)
void removeIslInterface (int _serverId)
QList< ServerPropertiesgetServerList () const
Public Member Functions inherited from Server
 Server (QObject *parent=nullptr)
 ~Server () override=default
AuthenticationResult loginUser (Server_ProtocolHandler *session, QString &name, const QString &password, bool passwordNeedsHash, QString &reason, int &secondsLeft, QString &clientid, QString &clientVersion, QString &connectionType)
const QMap< int, Server_Room * > & getRooms ()
Server_AbstractUserInterfacefindUser (const QString &userName) const
const QMap< QString, Server_ProtocolHandler * > & getUsers () const
const QMap< qint64, Server_ProtocolHandler * > & getUsersBySessionId () const
void addClient (Server_ProtocolHandler *player)
void removeClient (Server_ProtocolHandler *player)
QList< QString > getOnlineModeratorList () const
Server_DatabaseInterfacegetDatabaseInterface () const
int getNextLocalGameId ()
void sendIsl_Response (const Response &item, int serverId=-1, qint64 sessionId=-1)
void sendIsl_SessionEvent (const SessionEvent &item, int serverId=-1, qint64 sessionId=-1)
void sendIsl_GameEventContainer (const GameEventContainer &item, int serverId=-1, qint64 sessionId=-1)
void sendIsl_RoomEvent (const RoomEvent &item, int serverId=-1, qint64 sessionId=-1)
void sendIsl_GameCommand (const CommandContainer &item, int serverId, qint64 sessionId, int roomId, int playerId)
void sendIsl_RoomCommand (const CommandContainer &item, int serverId, qint64 sessionId, int roomId)
const QMap< QString, Server_AbstractUserInterface * > & getExternalUsers () const
void addPersistentPlayer (const QString &userName, int roomId, int gameId, int playerId)
void removePersistentPlayer (const QString &userName, int roomId, int gameId, int playerId)
QList< PlayerReferencegetPersistentPlayerReferences (const QString &userName) const
int getUsersCount () const
int getGamesCount () const
int getTCPUserCount () const
int getWebSocketUserCount () const

Public Attributes

QReadWriteLock islLock
Public Attributes inherited from Server
QReadWriteLock clientsLock
QReadWriteLock roomsLock

Protected Member Functions

void doSendIslMessage (const IslMessage &msg, int _serverId) override
Protected Member Functions inherited from Server
void prepareDestroy ()
void setDatabaseInterface (Server_DatabaseInterface *_databaseInterface)
void addRoom (Server_Room *newRoom)

Private Types

enum  DatabaseType { DatabaseNone , DatabaseMySql }

Private Slots

void statusUpdate ()
void shutdownTimeout ()

Private Member Functions

void updateServerList ()
QString getDBPrefixString () const
QString getDBHostNameString () const
QString getDBDatabaseNameString () const
QString getDBUserNameString () const
QString getDBPasswordString () const
QString getRoomsMethodString () const
QString getISLNetworkSSLCertFile () const
QString getISLNetworkSSLKeyFile () const
int getServerStatusUpdateTime () const
int getNumberOfTCPPools () const
int getServerTCPPort () const
int getNumberOfWebSocketPools () const
int getServerWebSocketPort () const
int getISLNetworkPort () const
bool getISLNetworkEnabled () const
bool getEnableInternalSMTPClient () const
QHostAddress getServerTCPHost () const
QHostAddress getServerWebSocketHost () const

Private Attributes

AuthenticationMethod authenticationMethod
DatabaseType databaseType
QTimer * pingClock
QTimer * statusUpdateClock
Servatrice_GameServergameServer
Servatrice_WebsocketGameServerwebsocketGameServer
Servatrice_IslServerislServer
QMutex loginMessageMutex
QString loginMessage
QString dbPrefix
QMap< QString, bool > serverRequiredFeatureList
QString officialWarnings
Servatrice_DatabaseInterfaceservatriceDatabaseInterface
int serverId
int uptime
QMutex txBytesMutex
QMutex rxBytesMutex
quint64 txBytes
quint64 rxBytes
QString shutdownReason
int shutdownMinutes
int nextShutdownMessageMinutes
QTimer * shutdownTimer
QMutex serverListMutex
QList< ServerPropertiesserverList
QMap< int, IslInterface * > islInterfaces

Additional Inherited Members

Signals inherited from Server
void pingClockTimeout ()
void sigSendIslMessage (const IslMessage &message, int serverId)
void endSession (qint64 sessionId)
Protected Slots inherited from Server
void externalUserJoined (const ServerInfo_User &userInfo)
void externalUserLeft (const QString &userName)
void externalRoomUserJoined (int roomId, const ServerInfo_User &userInfo)
void externalRoomUserLeft (int roomId, const QString &userName)
void externalRoomSay (int roomId, const QString &userName, const QString &message)
void externalRoomRemoveMessages (int roomId, const QString &userName, int amount)
void externalRoomGameListChanged (int roomId, const ServerInfo_Game &gameInfo)
void externalJoinGameCommandReceived (const Command_JoinGame &cmd, int cmdId, int roomId, int serverId, qint64 sessionId)
void externalGameCommandContainerReceived (const CommandContainer &cont, int playerId, int serverId, qint64 sessionId)
void externalGameEventContainerReceived (const GameEventContainer &cont, qint64 sessionId)
void externalResponseReceived (const Response &resp, qint64 sessionId)
Protected Attributes inherited from Server
QList< Server_ProtocolHandler * > clients
QMap< qint64, Server_ProtocolHandler * > usersBySessionId
QMap< QString, Server_ProtocolHandler * > users
QMap< qint64, Server_AbstractUserInterface * > externalUsersBySessionId
QMap< QString, Server_AbstractUserInterface * > externalUsers
QMap< int, Server_Room * > rooms
QMap< QThread *, Server_DatabaseInterface * > databaseInterfaces

Member Enumeration Documentation

◆ AuthenticationMethod

Enumerator
AuthenticationNone 
AuthenticationSql 
AuthenticationPassword 

◆ DatabaseType

Enumerator
DatabaseNone 
DatabaseMySql 

Constructor & Destructor Documentation

◆ Servatrice()

Servatrice::Servatrice ( QObject * parent = nullptr)
explicit
Here is the call graph for this function:

◆ ~Servatrice()

Servatrice::~Servatrice ( )
override
Here is the call graph for this function:

Member Function Documentation

◆ addDatabaseInterface()

void Servatrice::addDatabaseInterface ( QThread * thread,
Servatrice_DatabaseInterface * databaseInterface )

◆ addIslInterface()

void Servatrice::addIslInterface ( int _serverId,
IslInterface * interface )
Here is the call graph for this function:

◆ doSendIslMessage()

void Servatrice::doSendIslMessage ( const IslMessage & msg,
int _serverId )
overrideprotectedvirtual

Reimplemented from Server.

Here is the call graph for this function:

◆ getAuthenticationMethod()

AuthenticationMethod Servatrice::getAuthenticationMethod ( ) const
inline

◆ getAuthenticationMethodString()

QString Servatrice::getAuthenticationMethodString ( ) const
Here is the caller graph for this function:

◆ getClientIDRequiredEnabled()

bool Servatrice::getClientIDRequiredEnabled ( ) const
overridevirtual

Reimplemented from Server.

Here is the caller graph for this function:

◆ getClientKeepAlive()

int Servatrice::getClientKeepAlive ( ) const
overridevirtual

Reimplemented from Server.

Here is the caller graph for this function:

◆ getCommandCountingInterval()

int Servatrice::getCommandCountingInterval ( ) const
overridevirtual

Reimplemented from Server.

◆ getDBDatabaseNameString()

QString Servatrice::getDBDatabaseNameString ( ) const
private
Here is the caller graph for this function:

◆ getDBHostNameString()

QString Servatrice::getDBHostNameString ( ) const
private
Here is the caller graph for this function:

◆ getDBPasswordString()

QString Servatrice::getDBPasswordString ( ) const
private
Here is the caller graph for this function:

◆ getDbPrefix()

QString Servatrice::getDbPrefix ( ) const
inline

◆ getDBPrefixString()

QString Servatrice::getDBPrefixString ( ) const
private
Here is the caller graph for this function:

◆ getDBTypeString()

QString Servatrice::getDBTypeString ( ) const
Here is the caller graph for this function:

◆ getDBUserNameString()

QString Servatrice::getDBUserNameString ( ) const
private
Here is the caller graph for this function:

◆ getEmailBlackList()

QString Servatrice::getEmailBlackList ( ) const
Here is the caller graph for this function:

◆ getEmailWhiteList()

QString Servatrice::getEmailWhiteList ( ) const
Here is the caller graph for this function:

◆ getEnableAudit()

bool Servatrice::getEnableAudit ( ) const
Here is the caller graph for this function:

◆ getEnableForgotPassword()

bool Servatrice::getEnableForgotPassword ( ) const
Here is the caller graph for this function:

◆ getEnableForgotPasswordAudit()

bool Servatrice::getEnableForgotPasswordAudit ( ) const
Here is the caller graph for this function:

◆ getEnableForgotPasswordChallenge()

bool Servatrice::getEnableForgotPasswordChallenge ( ) const
Here is the caller graph for this function:

◆ getEnableInternalSMTPClient()

bool Servatrice::getEnableInternalSMTPClient ( ) const
private
Here is the caller graph for this function:

◆ getEnableLogQuery()

bool Servatrice::getEnableLogQuery ( ) const
overridevirtual

Reimplemented from Server.

◆ getEnableRegistrationAudit()

bool Servatrice::getEnableRegistrationAudit ( ) const
Here is the caller graph for this function:

◆ getForgotPasswordTokenLife()

int Servatrice::getForgotPasswordTokenLife ( ) const
Here is the caller graph for this function:

◆ getGameShouldPing()

bool Servatrice::getGameShouldPing ( ) const
inlineoverridevirtual

Reimplemented from Server.

◆ getIdleClientTimeout()

int Servatrice::getIdleClientTimeout ( ) const
overridevirtual

Reimplemented from Server.

Here is the caller graph for this function:

◆ getISLNetworkEnabled()

bool Servatrice::getISLNetworkEnabled ( ) const
private
Here is the caller graph for this function:

◆ getISLNetworkPort()

int Servatrice::getISLNetworkPort ( ) const
private
Here is the caller graph for this function:

◆ getISLNetworkSSLCertFile()

QString Servatrice::getISLNetworkSSLCertFile ( ) const
private
Here is the caller graph for this function:

◆ getISLNetworkSSLKeyFile()

QString Servatrice::getISLNetworkSSLKeyFile ( ) const
private
Here is the caller graph for this function:

◆ getLoginMessage()

QString Servatrice::getLoginMessage ( ) const
inlineoverridevirtual

Reimplemented from Server.

◆ getMaxAccountsPerEmail()

int Servatrice::getMaxAccountsPerEmail ( ) const
Here is the caller graph for this function:

◆ getMaxCommandCountPerInterval()

int Servatrice::getMaxCommandCountPerInterval ( ) const
overridevirtual

Reimplemented from Server.

◆ getMaxGameInactivityTime()

int Servatrice::getMaxGameInactivityTime ( ) const
overridevirtual

Reimplemented from Server.

◆ getMaxGamesPerUser()

int Servatrice::getMaxGamesPerUser ( ) const
overridevirtual

Reimplemented from Server.

◆ getMaxMessageCountPerInterval()

int Servatrice::getMaxMessageCountPerInterval ( ) const
overridevirtual

Reimplemented from Server.

◆ getMaxMessageSizePerInterval()

int Servatrice::getMaxMessageSizePerInterval ( ) const
overridevirtual

Reimplemented from Server.

◆ getMaxPlayerInactivityTime()

int Servatrice::getMaxPlayerInactivityTime ( ) const
overridevirtual

Reimplemented from Server.

◆ getMaxTcpUserLimit()

int Servatrice::getMaxTcpUserLimit ( ) const
Here is the caller graph for this function:

◆ getMaxUserLimitEnabled()

bool Servatrice::getMaxUserLimitEnabled ( ) const
overridevirtual

Reimplemented from Server.

Here is the caller graph for this function:

◆ getMaxUsersPerAddress()

int Servatrice::getMaxUsersPerAddress ( ) const

◆ getMaxUserTotal()

int Servatrice::getMaxUserTotal ( ) const
overridevirtual

Reimplemented from Server.

Here is the caller graph for this function:

◆ getMaxWebSocketUserLimit()

int Servatrice::getMaxWebSocketUserLimit ( ) const
Here is the caller graph for this function:

◆ getMessageCountingInterval()

int Servatrice::getMessageCountingInterval ( ) const
overridevirtual

Reimplemented from Server.

◆ getMinPasswordLength()

int Servatrice::getMinPasswordLength ( ) const

◆ getNumberOfTCPPools()

int Servatrice::getNumberOfTCPPools ( ) const
private
Here is the caller graph for this function:

◆ getNumberOfWebSocketPools()

int Servatrice::getNumberOfWebSocketPools ( ) const
private
Here is the caller graph for this function:

◆ getRegistrationEnabled()

bool Servatrice::getRegistrationEnabled ( ) const
Here is the caller graph for this function:

◆ getRegOnlyServerEnabled()

bool Servatrice::getRegOnlyServerEnabled ( ) const
overridevirtual

Reimplemented from Server.

Here is the caller graph for this function:

◆ getRequiredFeatures()

QString Servatrice::getRequiredFeatures ( ) const
overridevirtual

Reimplemented from Server.

Here is the caller graph for this function:

◆ getRequireEmailActivationEnabled()

bool Servatrice::getRequireEmailActivationEnabled ( ) const
Here is the caller graph for this function:

◆ getRequireEmailForRegistrationEnabled()

bool Servatrice::getRequireEmailForRegistrationEnabled ( ) const
Here is the caller graph for this function:

◆ getRoomsMethodString()

QString Servatrice::getRoomsMethodString ( ) const
private
Here is the caller graph for this function:

◆ getServerID()

int Servatrice::getServerID ( ) const
overridevirtual

Reimplemented from Server.

Here is the caller graph for this function:

◆ getServerList()

QList< ServerProperties > Servatrice::getServerList ( ) const

◆ getServerName()

QString Servatrice::getServerName ( ) const

◆ getServerRequiredFeatureList()

QMap< QString, bool > Servatrice::getServerRequiredFeatureList ( ) const
inlineoverridevirtual

Reimplemented from Server.

◆ getServerStatusUpdateTime()

int Servatrice::getServerStatusUpdateTime ( ) const
private
Here is the caller graph for this function:

◆ getServerTCPHost()

QHostAddress Servatrice::getServerTCPHost ( ) const
private
Here is the caller graph for this function:

◆ getServerTCPPort()

int Servatrice::getServerTCPPort ( ) const
private
Here is the caller graph for this function:

◆ getServerWebSocketHost()

QHostAddress Servatrice::getServerWebSocketHost ( ) const
private
Here is the caller graph for this function:

◆ getServerWebSocketPort()

int Servatrice::getServerWebSocketPort ( ) const
private
Here is the caller graph for this function:

◆ getStoreReplaysEnabled()

bool Servatrice::getStoreReplaysEnabled ( ) const
overridevirtual

Reimplemented from Server.

Here is the caller graph for this function:

◆ getUsersWithAddress()

int Servatrice::getUsersWithAddress ( const QHostAddress & address) const

◆ getUsersWithAddressAsList()

QList< AbstractServerSocketInterface * > Servatrice::getUsersWithAddressAsList ( const QHostAddress & address) const

◆ incRxBytes()

void Servatrice::incRxBytes ( quint64 num)

◆ incTxBytes()

void Servatrice::incTxBytes ( quint64 num)

◆ initServer()

bool Servatrice::initServer ( )

◆ islConnectionExists()

bool Servatrice::islConnectionExists ( int _serverId) const

◆ permitCreateGameAsJudge()

bool Servatrice::permitCreateGameAsJudge ( ) const
overridevirtual

Reimplemented from Server.

◆ permitUnregisteredUsers()

bool Servatrice::permitUnregisteredUsers ( ) const
inlineoverridevirtual

Reimplemented from Server.

◆ removeIslInterface()

void Servatrice::removeIslInterface ( int _serverId)

◆ scheduleShutdown

void Servatrice::scheduleShutdown ( const QString & reason,
int minutes )
slot
Here is the call graph for this function:

◆ setRequiredFeatures

void Servatrice::setRequiredFeatures ( const QString & featureList)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdownTimeout

void Servatrice::shutdownTimeout ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ statusUpdate

void Servatrice::statusUpdate ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateLoginMessage

void Servatrice::updateLoginMessage ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateServerList()

void Servatrice::updateServerList ( )
private
Here is the caller graph for this function:

Member Data Documentation

◆ authenticationMethod

AuthenticationMethod Servatrice::authenticationMethod
private

◆ databaseType

DatabaseType Servatrice::databaseType
private

◆ dbPrefix

QString Servatrice::dbPrefix
private

◆ gameServer

Servatrice_GameServer* Servatrice::gameServer
private

◆ islInterfaces

QMap<int, IslInterface *> Servatrice::islInterfaces
private

◆ islLock

QReadWriteLock Servatrice::islLock

◆ islServer

Servatrice_IslServer* Servatrice::islServer
private

◆ loginMessage

QString Servatrice::loginMessage
private

◆ loginMessageMutex

QMutex Servatrice::loginMessageMutex
mutableprivate

◆ nextShutdownMessageMinutes

int Servatrice::nextShutdownMessageMinutes
private

◆ officialWarnings

QString Servatrice::officialWarnings
private

◆ pingClock

QTimer* Servatrice::pingClock
private

◆ rxBytes

quint64 Servatrice::rxBytes
private

◆ rxBytesMutex

QMutex Servatrice::rxBytesMutex
private

◆ servatriceDatabaseInterface

Servatrice_DatabaseInterface* Servatrice::servatriceDatabaseInterface
private

◆ serverId

int Servatrice::serverId
private

◆ serverList

QList<ServerProperties> Servatrice::serverList
private

◆ serverListMutex

QMutex Servatrice::serverListMutex
mutableprivate

◆ serverRequiredFeatureList

QMap<QString, bool> Servatrice::serverRequiredFeatureList
private

◆ shutdownMinutes

int Servatrice::shutdownMinutes
private

◆ shutdownReason

QString Servatrice::shutdownReason
private

◆ shutdownTimer

QTimer* Servatrice::shutdownTimer
private

◆ statusUpdateClock

QTimer * Servatrice::statusUpdateClock
private

◆ txBytes

quint64 Servatrice::txBytes
private

◆ txBytesMutex

QMutex Servatrice::txBytesMutex
private

◆ uptime

int Servatrice::uptime
private

◆ websocketGameServer

Servatrice_WebsocketGameServer* Servatrice::websocketGameServer
private

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