Luanti 5.16.0-dev
Loading...
Searching...
No Matches
ClientInterface Class Reference

#include <clientiface.h>

Collaboration diagram for ClientInterface:

Classes

class  AutoLock

Public Member Functions

 ClientInterface (const std::shared_ptr< con::IConnection > &con)
 ~ClientInterface ()
void step (float dtime)
std::vector< session_tgetClientIDs (ClientState min_state=CS_Active)
void markBlocksNotSent (const std::vector< v3s16 > &positions, bool low_priority=false)
bool isUserLimitReached ()
const std::vector< std::string > & getPlayerNames () const
void send (session_t peer_id, NetworkPacket *pkt)
void sendCustom (session_t peer_id, u8 channel, NetworkPacket *pkt, bool reliable)
void sendToAll (NetworkPacket *pkt, ClientState state_min=CS_Active)
void DeleteClient (session_t peer_id)
void CreateClient (session_t peer_id)
RemoteClientgetClientNoEx (session_t peer_id, ClientState state_min=CS_Active)
RemoteClientlockedGetClientNoEx (session_t peer_id, ClientState state_min=CS_Active)
ClientState getClientState (session_t peer_id)
u16 getProtocolVersion (session_t peer_id)
void event (session_t peer_id, ClientStateEvent event)
void setEnv (ServerEnvironment *env)

Static Public Member Functions

static const char * state2Name (ClientState state)

Protected Member Functions

RemoteClientMapgetClientList ()

Private Member Functions

void UpdatePlayerList ()

Private Attributes

std::shared_ptr< con::IConnectionm_con
std::recursive_mutex m_clients_mutex
RemoteClientMap m_clients
std::vector< std::string > m_clients_names
ServerEnvironmentm_env = nullptr
float m_print_info_timer = 0
float m_check_linger_timer = 0

Static Private Attributes

static const char * statenames []
static constexpr int LINGER_TIMEOUT = 12

Friends

class Server

Constructor & Destructor Documentation

◆ ClientInterface()

ClientInterface::ClientInterface ( const std::shared_ptr< con::IConnection > & con)

References m_con, and m_env.

Referenced by ClientInterface::AutoLock::AutoLock().

Here is the caller graph for this function:

◆ ~ClientInterface()

ClientInterface::~ClientInterface ( )

References m_clients, and m_clients_mutex.

Member Function Documentation

◆ CreateClient()

void ClientInterface::CreateClient ( session_t peer_id)

References m_clients, and m_clients_mutex.

◆ DeleteClient()

void ClientInterface::DeleteClient ( session_t peer_id)

◆ event()

void ClientInterface::event ( session_t peer_id,
ClientStateEvent event )

References CSE_Disconnect, CSE_SetClientReady, CSE_SetDenied, event(), m_clients, m_clients_mutex, and UpdatePlayerList().

Referenced by event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getClientIDs()

std::vector< session_t > ClientInterface::getClientIDs ( ClientState min_state = CS_Active)

References m_clients, and m_clients_mutex.

Referenced by isUserLimitReached(), and UpdatePlayerList().

Here is the caller graph for this function:

◆ getClientList()

RemoteClientMap & ClientInterface::getClientList ( )
inlineprotected

References m_clients.

◆ getClientNoEx()

RemoteClient * ClientInterface::getClientNoEx ( session_t peer_id,
ClientState state_min = CS_Active )

References lockedGetClientNoEx(), and m_clients_mutex.

Here is the call graph for this function:

◆ getClientState()

ClientState ClientInterface::getClientState ( session_t peer_id)

◆ getPlayerNames()

const std::vector< std::string > & ClientInterface::getPlayerNames ( ) const
inline

References m_clients_names.

◆ getProtocolVersion()

u16 ClientInterface::getProtocolVersion ( session_t peer_id)

References m_clients, and m_clients_mutex.

◆ isUserLimitReached()

bool ClientInterface::isUserLimitReached ( )

References g_settings, and getClientIDs().

Here is the call graph for this function:

◆ lockedGetClientNoEx()

RemoteClient * ClientInterface::lockedGetClientNoEx ( session_t peer_id,
ClientState state_min = CS_Active )

References m_clients.

Referenced by getClientNoEx(), and UpdatePlayerList().

Here is the caller graph for this function:

◆ markBlocksNotSent()

void ClientInterface::markBlocksNotSent ( const std::vector< v3s16 > & positions,
bool low_priority = false )

References CS_Active, m_clients, and m_clients_mutex.

◆ send()

void ClientInterface::send ( session_t peer_id,
NetworkPacket * pkt )

References clientCommandFactoryTable, FATAL_ERROR_IF, NetworkPacket::getCommand(), and m_con.

Here is the call graph for this function:

◆ sendCustom()

void ClientInterface::sendCustom ( session_t peer_id,
u8 channel,
NetworkPacket * pkt,
bool reliable )

References clientCommandFactoryTable, FATAL_ERROR_IF, NetworkPacket::getCommand(), and m_con.

Here is the call graph for this function:

◆ sendToAll()

void ClientInterface::sendToAll ( NetworkPacket * pkt,
ClientState state_min = CS_Active )

References clientCommandFactoryTable, FATAL_ERROR_IF, NetworkPacket::getCommand(), m_clients, m_clients_mutex, and m_con.

Here is the call graph for this function:

◆ setEnv()

void ClientInterface::setEnv ( ServerEnvironment * env)
inline

References m_env.

◆ state2Name()

const char * ClientInterface::state2Name ( ClientState state)
static

References statenames.

Referenced by ModApiServer::l_get_player_information(), and step().

Here is the caller graph for this function:

◆ step()

void ClientInterface::step ( float dtime)

References CS_Denied, CS_Disconnecting, CS_InitDone, infostream, LINGER_TIMEOUT, m_check_linger_timer, m_clients, m_clients_mutex, m_con, m_print_info_timer, Address::serializeString(), state2Name(), UpdatePlayerList(), and warningstream.

Here is the call graph for this function:

◆ UpdatePlayerList()

void ClientInterface::UpdatePlayerList ( )
private

References getClientIDs(), Player::getName(), infostream, lockedGetClientNoEx(), m_clients_mutex, m_clients_names, and m_env.

Referenced by event(), and step().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Server

friend class Server
friend

References CS_Active, and Server.

Referenced by Server.

Member Data Documentation

◆ LINGER_TIMEOUT

int ClientInterface::LINGER_TIMEOUT = 12
staticconstexprprivate

Referenced by step().

◆ m_check_linger_timer

float ClientInterface::m_check_linger_timer = 0
private

Referenced by step().

◆ m_clients

◆ m_clients_mutex

◆ m_clients_names

std::vector<std::string> ClientInterface::m_clients_names
private

Referenced by getPlayerNames(), and UpdatePlayerList().

◆ m_con

std::shared_ptr<con::IConnection> ClientInterface::m_con
private

◆ m_env

ServerEnvironment* ClientInterface::m_env = nullptr
private

◆ m_print_info_timer

float ClientInterface::m_print_info_timer = 0
private

Referenced by step().

◆ statenames

const char * ClientInterface::statenames
staticprivate
Initial value:
= {
"Invalid",
"Disconnecting",
"Denied",
"Created",
"HelloSent",
"AwaitingInit2",
"InitDone",
"DefinitionsSent",
"Active",
"SudoMode",
}

Referenced by state2Name().


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