OpenTTD Source 20241224-master-gf74b0cf984
|
Class for handling the server side of the game connection. More...
#include <network_server.h>
Public Types | |
enum | ClientStatus { STATUS_INACTIVE , STATUS_AUTH_GAME , STATUS_IDENTIFY , STATUS_NEWGRFS_CHECK , STATUS_AUTHORIZED , STATUS_MAP_WAIT , STATUS_MAP , STATUS_DONE_MAP , STATUS_PRE_ACTIVE , STATUS_ACTIVE , STATUS_END } |
Status of a client. More... | |
Public Types inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool > | |
typedef struct Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero > | Pool |
Type of the pool this item is going to be part of. | |
Public Member Functions | |
ServerNetworkGameSocketHandler (SOCKET s) | |
Create a new socket for the server side of the game connection. | |
~ServerNetworkGameSocketHandler () | |
Clear everything related to this client. | |
std::unique_ptr< Packet > | ReceivePacket () override |
Receives a packet for the given client. | |
NetworkRecvStatus | CloseConnection (NetworkRecvStatus status) override |
Close the network connection due to the given status. | |
std::string | GetClientName () const |
Get the name of the client, if the user did not send it yet, Client ID is used. | |
void | CheckNextClientToSendMap (NetworkClientSocket *ignore_cs=nullptr) |
NetworkRecvStatus | SendWait () |
Tell the client that its put in a waiting queue. | |
NetworkRecvStatus | SendMap () |
This sends the map to the client. | |
NetworkRecvStatus | SendErrorQuit (ClientID client_id, NetworkErrorCode errorno) |
Tell the client another client quit with an error. | |
NetworkRecvStatus | SendQuit (ClientID client_id) |
Tell the client another client quit. | |
NetworkRecvStatus | SendShutdown () |
Tell the client we're shutting down. | |
NetworkRecvStatus | SendNewGame () |
Tell the client we're starting a new game. | |
NetworkRecvStatus | SendRConResult (uint16_t colour, const std::string &command) |
Send the result of a console action. | |
NetworkRecvStatus | SendMove (ClientID client_id, CompanyID company_id) |
Tell that a client moved to another company. | |
NetworkRecvStatus | SendClientInfo (NetworkClientInfo *ci) |
Send the client information about a client. | |
NetworkRecvStatus | SendError (NetworkErrorCode error, const std::string &reason={}) |
Send an error to the client, and close its connection. | |
NetworkRecvStatus | SendChat (NetworkAction action, ClientID client_id, bool self_send, const std::string &msg, int64_t data) |
Send a chat message. | |
NetworkRecvStatus | SendExternalChat (const std::string &source, TextColour colour, const std::string &user, const std::string &msg) |
Send a chat message from external source. | |
NetworkRecvStatus | SendJoin (ClientID client_id) |
Tell that a client joined. | |
NetworkRecvStatus | SendFrame () |
Tell the client that they may run to a particular frame. | |
NetworkRecvStatus | SendSync () |
Request the client to sync. | |
NetworkRecvStatus | SendCommand (const CommandPacket &cp) |
Send a command to the client to execute. | |
NetworkRecvStatus | SendConfigUpdate () |
Send an update about the max company/spectator counts. | |
const std::string & | GetClientIP () |
Get the IP address/hostname of the connected client. | |
std::string_view | GetPeerPublicKey () const |
Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool > | |
void * | operator new (size_t size) |
Allocates space for new Titem. | |
void * | operator new (size_t size, size_t index) |
Allocates space for new Titem with given index. | |
void * | operator new (size_t, void *ptr) |
Allocates space for new Titem at given memory address. | |
void | operator delete (void *p) |
Marks Titem as free. | |
Public Member Functions inherited from NetworkGameSocketHandler | |
NetworkRecvStatus | CloseConnection (bool error=true) override |
Functions to help ReceivePacket/SendPacket a bit A socket can make errors. | |
void | SetInfo (NetworkClientInfo *info) |
Sets the client info for this socket handler. | |
NetworkClientInfo * | GetInfo () const |
Gets the client info of this socket handler. | |
NetworkRecvStatus | ReceivePackets () |
Do the actual receiving of packets. | |
const char * | ReceiveCommand (Packet &p, CommandPacket &cp) |
Receives a command from the network. | |
void | SendCommand (Packet &p, const CommandPacket &cp) |
Sends a command over the network. | |
bool | IsPendingDeletion () const |
void | DeferDeletion () |
Public Member Functions inherited from NetworkTCPSocketHandler | |
bool | IsConnected () const |
Whether this socket is currently bound to a socket. | |
void | CloseSocket () |
Close the actual socket of the connection. | |
virtual void | SendPacket (std::unique_ptr< Packet > &&packet) |
This function puts the packet in the send-queue and it is send as soon as possible. | |
SendPacketsState | SendPackets (bool closing_down=false) |
Sends all the buffered packets out for this client. | |
bool | CanSendReceive () |
Check whether this socket can send or receive something. | |
bool | HasSendQueue () |
Whether there is something pending in the send queue. | |
NetworkTCPSocketHandler (SOCKET s=INVALID_SOCKET) | |
Construct a socket handler for a TCP connection. | |
Public Member Functions inherited from NetworkSocketHandler | |
NetworkSocketHandler () | |
Create a new unbound socket. | |
virtual | ~NetworkSocketHandler ()=default |
Close the socket when destructing the socket handler. | |
void | MarkClosed () |
Mark the connection as closed. | |
bool | HasClientQuit () const |
Whether the current client connected to the socket has quit. | |
void | Reopen () |
Reopen the socket so we can send/receive stuff again. | |
Static Public Member Functions | |
static void | Send () |
Send the packets for the server sockets. | |
static void | AcceptConnection (SOCKET s, const NetworkAddress &address) |
Handle the accepting of a connection to the server. | |
static bool | AllowConnection () |
Whether an connection is allowed or not at this moment. | |
static const char * | GetName () |
Get the name used by the listener. | |
static ServerNetworkGameSocketHandler * | GetByClientID (ClientID client_id) |
Return the client state given it's client-identifier. | |
Static Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool > | |
static bool | CanAllocateItem (size_t n=1) |
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() | |
static bool | CleaningPool () |
Returns current state of pool cleaning - yes or no. | |
static bool | IsValidID (size_t index) |
Tests whether given index can be used to get valid (non-nullptr) Titem. | |
static Titem * | Get (size_t index) |
Returns Titem with given index. | |
static Titem * | GetIfValid (size_t index) |
Returns Titem with given index. | |
static size_t | GetPoolSize () |
Returns first unused index. | |
static size_t | GetNumItems () |
Returns number of valid items in the pool. | |
static void | PostDestructor (size_t index) |
Dummy function called after destructor of each member. | |
static Pool::IterateWrapper< Titem > | Iterate (size_t from=0) |
Returns an iterable ensemble of all valid Titem. | |
Static Public Member Functions inherited from NetworkGameSocketHandler | |
static void | ProcessDeferredDeletions () |
Static Public Member Functions inherited from TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED > | |
static bool | ValidateClient (SOCKET s, NetworkAddress &address) |
static void | AcceptClient (SOCKET ls) |
Accepts clients from the sockets. | |
static bool | Receive () |
Handle the receiving of packets. | |
static bool | Listen (uint16_t port) |
Listen on a particular port. | |
static void | CloseListeners () |
Close the sockets we're listening on. | |
Data Fields | |
uint8_t | lag_test |
Byte used for lag-testing the client. | |
uint8_t | last_token |
The last random token we did send to verify the client is listening. | |
uint32_t | last_token_frame |
The last frame we received the right token. | |
ClientStatus | status |
Status of this client. | |
CommandQueue | outgoing_queue |
The command-queue awaiting delivery; conceptually more a bucket to gather commands in, after which the whole bucket is sent to the client. | |
size_t | receive_limit |
Amount of bytes that we can receive at this moment. | |
std::shared_ptr< struct PacketWriter > | savegame |
Writer used to write the savegame. | |
NetworkAddress | client_address |
IP-address of the client (so they can be banned) | |
Data Fields inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool > | |
Tindex | index |
Index of this pool item. | |
Data Fields inherited from NetworkGameSocketHandler | |
ClientID | client_id |
Client identifier. | |
uint32_t | last_frame |
Last frame we have executed. | |
uint32_t | last_frame_server |
Last frame the server has executed. | |
CommandQueue | incoming_queue |
The command-queue awaiting handling. | |
std::chrono::steady_clock::time_point | last_packet |
Time we received the last frame. | |
Data Fields inherited from NetworkTCPSocketHandler | |
SOCKET | sock |
The socket currently connected to. | |
bool | writable |
Can we write to this socket? | |
Protected Member Functions | |
NetworkRecvStatus | Receive_CLIENT_JOIN (Packet &p) override |
Try to join the server: string OpenTTD revision (norev0000 if no revision). | |
NetworkRecvStatus | Receive_CLIENT_IDENTIFY (Packet &p) override |
The client tells the server about the identity of the client: string Name of the client (max NETWORK_NAME_LENGTH). | |
NetworkRecvStatus | Receive_CLIENT_GAME_INFO (Packet &p) override |
Request game information. | |
NetworkRecvStatus | Receive_CLIENT_AUTH_RESPONSE (Packet &p) override |
Send the response to the authentication request: 32 * uint8_t Public key of the client. | |
NetworkRecvStatus | Receive_CLIENT_GETMAP (Packet &p) override |
Request the map from the server. | |
NetworkRecvStatus | Receive_CLIENT_MAP_OK (Packet &p) override |
Tell the server that we are done receiving/loading the map. | |
NetworkRecvStatus | Receive_CLIENT_ACK (Packet &p) override |
Tell the server we are done with this frame: uint32_t Current frame counter of the client. | |
NetworkRecvStatus | Receive_CLIENT_COMMAND (Packet &p) override |
The client has done a command and wants us to handle it. | |
NetworkRecvStatus | Receive_CLIENT_CHAT (Packet &p) override |
Sends a chat-packet to the server: uint8_t ID of the action (see NetworkAction). | |
NetworkRecvStatus | Receive_CLIENT_SET_NAME (Packet &p) override |
Gives the client a new name: string New name of the client. | |
NetworkRecvStatus | Receive_CLIENT_QUIT (Packet &p) override |
The client is quitting the game. | |
NetworkRecvStatus | Receive_CLIENT_ERROR (Packet &p) override |
The client made an error and is quitting the game. | |
NetworkRecvStatus | Receive_CLIENT_RCON (Packet &p) override |
Send an RCon command to the server: string RCon password. | |
NetworkRecvStatus | Receive_CLIENT_NEWGRFS_CHECKED (Packet &p) override |
Tell the server that we have the required GRFs. | |
NetworkRecvStatus | Receive_CLIENT_MOVE (Packet &p) override |
Request the server to move this client into another company: uint8_t ID of the company the client wants to join. | |
NetworkRecvStatus | SendGameInfo () |
Send the client information about the server. | |
NetworkRecvStatus | SendNewGRFCheck () |
Send the check for the NewGRFs. | |
NetworkRecvStatus | SendWelcome () |
Send the client a welcome message with some basic information. | |
NetworkRecvStatus | SendAuthRequest () |
Request the game password. | |
NetworkRecvStatus | SendEnableEncryption () |
Notify the client that the authentication has completed and tell that for the remainder of this socket encryption is enabled. | |
Protected Member Functions inherited from NetworkGameSocketHandler | |
NetworkRecvStatus | ReceiveInvalidPacket (PacketGameType type) |
Helper for logging receiving invalid packets. | |
virtual NetworkRecvStatus | Receive_SERVER_FULL (Packet &p) |
Notification that the server is full. | |
virtual NetworkRecvStatus | Receive_SERVER_BANNED (Packet &p) |
Notification that the client trying to join is banned. | |
virtual NetworkRecvStatus | Receive_SERVER_ERROR (Packet &p) |
The client made an error: uint8_t Error code caused (see NetworkErrorCode). | |
virtual NetworkRecvStatus | Receive_SERVER_GAME_INFO (Packet &p) |
Sends information about the game. | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_INFO (Packet &p) |
Send information about a client: uint32_t ID of the client (always unique on a server. | |
virtual NetworkRecvStatus | Receive_SERVER_AUTH_REQUEST (Packet &p) |
Indication to the client that it needs to authenticate: uint8_t The NetworkAuthenticationMethod to use. | |
virtual NetworkRecvStatus | Receive_SERVER_ENABLE_ENCRYPTION (Packet &p) |
Indication to the client that authentication is complete and encryption has to be used from here on forward. | |
virtual NetworkRecvStatus | Receive_SERVER_WELCOME (Packet &p) |
The client is joined and ready to receive their map: uint32_t Own client ID. | |
virtual NetworkRecvStatus | Receive_SERVER_WAIT (Packet &p) |
Notification that another client is currently receiving the map: uint8_t Number of clients waiting in front of you. | |
virtual NetworkRecvStatus | Receive_SERVER_MAP_BEGIN (Packet &p) |
Sends that the server will begin with sending the map to the client: uint32_t Current frame. | |
virtual NetworkRecvStatus | Receive_SERVER_MAP_SIZE (Packet &p) |
Sends the size of the map to the client. | |
virtual NetworkRecvStatus | Receive_SERVER_MAP_DATA (Packet &p) |
Sends the data of the map to the client: Contains a part of the map (until max size of packet). | |
virtual NetworkRecvStatus | Receive_SERVER_MAP_DONE (Packet &p) |
Sends that all data of the map are sent to the client: | |
virtual NetworkRecvStatus | Receive_SERVER_JOIN (Packet &p) |
A client joined (PACKET_CLIENT_MAP_OK), what usually directly follows is a PACKET_SERVER_CLIENT_INFO: uint32_t ID of the client that just joined the game. | |
virtual NetworkRecvStatus | Receive_SERVER_FRAME (Packet &p) |
Sends the current frame counter to the client: uint32_t Frame counter uint32_t Frame counter max (how far may the client walk before the server?) uint32_t General seed 1 (dependent on compile settings, not default). | |
virtual NetworkRecvStatus | Receive_SERVER_SYNC (Packet &p) |
Sends a sync-check to the client: uint32_t Frame counter. | |
virtual NetworkRecvStatus | Receive_SERVER_COMMAND (Packet &p) |
Sends a DoCommand to the client: uint8_t ID of the company (0..MAX_COMPANIES-1). | |
virtual NetworkRecvStatus | Receive_SERVER_CHAT (Packet &p) |
Sends a chat-packet to the client: uint8_t ID of the action (see NetworkAction). | |
virtual NetworkRecvStatus | Receive_SERVER_EXTERNAL_CHAT (Packet &p) |
Sends a chat-packet for external source to the client: string Name of the source this message came from. | |
virtual NetworkRecvStatus | Receive_SERVER_QUIT (Packet &p) |
Notification that a client left the game: uint32_t ID of the client. | |
virtual NetworkRecvStatus | Receive_SERVER_ERROR_QUIT (Packet &p) |
Inform all clients that one client made an error and thus has quit/been disconnected: uint32_t ID of the client that caused the error. | |
virtual NetworkRecvStatus | Receive_SERVER_SHUTDOWN (Packet &p) |
Let the clients know that the server is closing. | |
virtual NetworkRecvStatus | Receive_SERVER_NEWGAME (Packet &p) |
Let the clients know that the server is loading a new map. | |
virtual NetworkRecvStatus | Receive_SERVER_RCON (Packet &p) |
Send the result of an issues RCon command back to the client: uint16_t Colour code. | |
virtual NetworkRecvStatus | Receive_SERVER_CHECK_NEWGRFS (Packet &p) |
Sends information about all used GRFs to the client: uint8_t Amount of GRFs (the following data is repeated this many times, i.e. | |
virtual NetworkRecvStatus | Receive_SERVER_MOVE (Packet &p) |
Move a client from one company into another: uint32_t ID of the client. | |
virtual NetworkRecvStatus | Receive_SERVER_CONFIG_UPDATE (Packet &p) |
Update the clients knowledge of the max settings: uint8_t Maximum number of companies allowed. | |
NetworkRecvStatus | HandlePacket (Packet &p) |
Handle the given packet, i.e. | |
NetworkGameSocketHandler (SOCKET s) | |
Create a new socket for the game connection. | |
Protected Attributes | |
std::unique_ptr< class NetworkAuthenticationServerHandler > | authentication_handler |
The handler for the authentication. | |
std::string | peer_public_key |
The public key of our client. | |
Protected Attributes inherited from NetworkSocketHandler | |
std::unique_ptr< class NetworkEncryptionHandler > | receive_encryption_handler |
The handler for decrypting received packets. | |
std::unique_ptr< class NetworkEncryptionHandler > | send_encryption_handler |
The handler for encrypting sent packets. | |
Class for handling the server side of the game connection.
Definition at line 24 of file network_server.h.
Status of a client.
Definition at line 53 of file network_server.h.
ServerNetworkGameSocketHandler::ServerNetworkGameSocketHandler | ( | SOCKET | s | ) |
Create a new socket for the server side of the game connection.
s | The socket to connect with. |
Definition at line 191 of file network_server.cpp.
References _network_client_id, _settings_client, NetworkSettings::bytes_per_frame_burst, NetworkGameSocketHandler::client_id, Debug, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::MAX_SIZE, ClientSettings::network, receive_limit, status, and STATUS_INACTIVE.
ServerNetworkGameSocketHandler::~ServerNetworkGameSocketHandler | ( | ) |
Clear everything related to this client.
Definition at line 208 of file network_server.cpp.
References _redirect_console_to_client, NetworkGameSocketHandler::client_id, NetworkGameSocketHandler::GetInfo(), INVALID_CLIENT_ID, InvalidateWindowData(), OrderBackup::ResetUser(), savegame, and WC_CLIENT_LIST.
|
static |
Handle the accepting of a connection to the server.
s | The socket of the new connection. |
address | The address of the peer. |
Definition at line 568 of file network.cpp.
References _network_clients_connected, client_address, InvalidateWindowData(), and WC_CLIENT_LIST.
Referenced by ClientNetworkCoordinatorSocketHandler::ConnectSuccess().
|
static |
Whether an connection is allowed or not at this moment.
Definition at line 291 of file network_server.cpp.
References _network_clients_connected, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::CanAllocateItem(), MAX_CLIENTS, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::MAX_SIZE.
void ServerNetworkGameSocketHandler::CheckNextClientToSendMap | ( | NetworkClientSocket * | ignore_cs = nullptr | ) |
Definition at line 525 of file network_server.cpp.
|
overridevirtual |
Close the network connection due to the given status.
status | The reason the connection got closed. |
Implements NetworkGameSocketHandler.
Definition at line 236 of file network_server.cpp.
References _network_clients_connected, CC_DEFAULT, NetworkGameSocketHandler::client_id, NetworkServerGameInfo::clients_on, Debug, GetClientName(), GetName(), NetworkSocketHandler::HasClientQuit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::Iterate(), NETWORK_RECV_STATUS_CLIENT_QUIT, NETWORK_RECV_STATUS_OKAY, NETWORK_RECV_STATUS_SERVER_ERROR, NetworkAdminClientError(), savegame, NetworkTCPSocketHandler::SendPackets(), NetworkTCPSocketHandler::sock, status, STATUS_AUTHORIZED, and STATUS_MAP.
Referenced by Receive_CLIENT_ERROR(), Receive_CLIENT_QUIT(), SendAuthRequest(), SendEnableEncryption(), SendError(), SendNewGRFCheck(), and SendWelcome().
|
static |
Return the client state given it's client-identifier.
client_id | the ClientID to search for |
Definition at line 152 of file network.cpp.
References NetworkGameSocketHandler::client_id, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::Iterate().
const std::string & ServerNetworkGameSocketHandler::GetClientIP | ( | ) |
Get the IP address/hostname of the connected client.
Definition at line 1925 of file network_server.cpp.
References client_address, and NetworkAddress::GetHostname().
Referenced by Receive_CLIENT_MAP_OK().
std::string ServerNetworkGameSocketHandler::GetClientName | ( | ) | const |
Get the name of the client, if the user did not send it yet, Client ID is used.
client_name | The variable to write the name to. |
last | The pointer to the last element of the destination buffer |
Definition at line 2105 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, NetworkClientInfo::client_name, and NetworkGameSocketHandler::GetInfo().
Referenced by CloseConnection(), Receive_CLIENT_ERROR(), Receive_CLIENT_MAP_OK(), Receive_CLIENT_QUIT(), and SendError().
|
inlinestatic |
Get the name used by the listener.
Definition at line 113 of file network_server.h.
Referenced by CloseConnection(), ClientNetworkCoordinatorSocketHandler::ConnectSuccess(), and Receive_CLIENT_MAP_OK().
|
inline |
Definition at line 119 of file network_server.h.
|
overrideprotectedvirtual |
Tell the server we are done with this frame: uint32_t Current frame counter of the client.
uint8_t The random token that the server sent in the PACKET_SERVER_FRAME packet.
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 1199 of file network_server.cpp.
References _frame_counter, NetworkGameSocketHandler::client_id, Ticks::DAY_TICKS, Debug, IConsoleCmdExec(), NetworkGameSocketHandler::last_frame, NetworkGameSocketHandler::last_frame_server, last_token, last_token_frame, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint32(), Packet::Recv_uint8(), SendError(), status, STATUS_ACTIVE, STATUS_AUTHORIZED, and STATUS_PRE_ACTIVE.
|
overrideprotectedvirtual |
Send the response to the authentication request: 32 * uint8_t Public key of the client.
16 * uint8_t Message authentication code. 8 * uint8_t Random message that got encoded and signed.
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 950 of file network_server.cpp.
References _frame_counter, NetworkAuthenticationServerHandler::AUTHENTICATED, authentication_handler, NetworkGameSocketHandler::client_id, Debug, NetworkGameSocketHandler::last_frame, NetworkGameSocketHandler::last_frame_server, NETWORK_RECV_STATUS_OKAY, NetworkAuthenticationServerHandler::NOT_AUTHENTICATED, peer_public_key, NetworkSocketHandler::receive_encryption_handler, NetworkAuthenticationServerHandler::RETRY_NEXT_METHOD, NetworkSocketHandler::send_encryption_handler, SendAuthRequest(), SendEnableEncryption(), SendError(), status, STATUS_AUTH_GAME, and STATUS_IDENTIFY.
|
overrideprotectedvirtual |
Sends a chat-packet to the server: uint8_t ID of the action (see NetworkAction).
uint8_t ID of the destination type (see DestType). uint32_t ID of the client or company (destination of the chat). string Message (max NETWORK_CHAT_LENGTH). uint64_t data (used e.g. for 'give money' actions).
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 1384 of file network_server.cpp.
References CC_WARNING, NetworkGameSocketHandler::client_id, NetworkClientInfo::client_id, Debug, NetworkGameSocketHandler::GetInfo(), IConsolePrint(), NETWORK_CHAT_LENGTH, NETWORK_RECV_STATUS_OKAY, NetworkServerSendChat(), Packet::Recv_string(), Packet::Recv_uint32(), Packet::Recv_uint64(), Packet::Recv_uint8(), SendError(), status, and STATUS_PRE_ACTIVE.
|
overrideprotectedvirtual |
The client has done a command and wants us to handle it.
p | the packet in which the command was sent |
Only CMD_COMPANY_CTRL is always allowed, for the rest, playas needs to match the company in the packet. If it doesn't, the client has done something pretty naughty (or a bug), and will be kicked
Reimplemented from NetworkGameSocketHandler.
Definition at line 1059 of file network_server.cpp.
References _settings_client, CC_WARNING, CCA_NEW, NetworkGameSocketHandler::client_id, NetworkClientInfo::client_id, CLIENT_ID_SERVER, NetworkClientInfo::client_playas, CommandPacket::cmd, CMD_CLIENT_ID, CMD_COMPANY_ALLOW_LIST_CTRL, CMD_COMPANY_CTRL, CMD_SERVER, CMD_SPECTATOR, CommandPacket::company, COMPANY_NEW_COMPANY, COMPANY_SPECTATOR, CommandPacket::data, Debug, DESTTYPE_CLIENT, GetCommandFlags(), NetworkGameSocketHandler::GetInfo(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetNumItems(), NetworkSocketHandler::HasClientQuit(), IConsolePrint(), NetworkGameSocketHandler::incoming_queue, NetworkGameSocketHandler::info, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientinfo_pool >::Iterate(), NetworkSettings::max_commands_in_queue, NetworkSettings::max_companies, ClientSettings::network, NETWORK_RECV_STATUS_CLIENT_QUIT, NETWORK_RECV_STATUS_OKAY, NetworkReplaceCommandClientId(), NetworkServerSendChat(), NetworkClientInfo::public_key, NetworkGameSocketHandler::ReceiveCommand(), and SendError().
|
overrideprotectedvirtual |
The client made an error and is quitting the game.
uint8_t Error of the code caused (see NetworkErrorCode).
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 1144 of file network_server.cpp.
References CC_DEFAULT, NetworkGameSocketHandler::client_id, CloseConnection(), Debug, GetClientName(), GetNetworkErrorMsg(), GetString(), NetworkSocketHandler::HasClientQuit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::Iterate(), NETWORK_RECV_STATUS_CLIENT_QUIT, NetworkAdminClientError(), Packet::Recv_uint8(), and STATUS_AUTHORIZED.
|
overrideprotectedvirtual |
Request game information.
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 832 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, and SendGameInfo().
|
overrideprotectedvirtual |
Request the map from the server.
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 988 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NetworkSocketHandler::HasClientQuit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::Iterate(), SendError(), SendMap(), SendWait(), status, STATUS_MAP, and STATUS_MAP_WAIT.
|
overrideprotectedvirtual |
The client tells the server about the identity of the client: string Name of the client (max NETWORK_NAME_LENGTH).
uint8_t ID of the company to play as (1..MAX_COMPANIES, or COMPANY_SPECTATOR).
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 877 of file network_server.cpp.
References _settings_client, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientinfo_pool >::CanAllocateItem(), NetworkGameSocketHandler::client_id, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, COMPANY_NEW_COMPANY, COMPANY_SPECTATOR, TimerGameEconomy::date, TimerGameEconomy::date_fract, Debug, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetNumItems(), NetworkSocketHandler::HasClientQuit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::IsValidHumanID(), NetworkClientInfo::join_date, NetworkSettings::max_companies, CompanyProperties::months_empty, ClientSettings::network, NETWORK_CLIENT_NAME_LENGTH, NETWORK_RECV_STATUS_CLIENT_QUIT, NetworkIsValidClientName(), NetworkMakeClientNameUnique(), peer_public_key, NetworkClientInfo::public_key, Packet::Recv_string(), Packet::Recv_uint8(), SendError(), SendNewGRFCheck(), NetworkGameSocketHandler::SetInfo(), status, and STATUS_IDENTIFY.
|
overrideprotectedvirtual |
Try to join the server: string OpenTTD revision (norev0000 if no revision).
uint32_t NewGRF version (added in 1.2). string Name of the client (max NETWORK_NAME_LENGTH) (removed in 15). uint8_t ID of the company to play as (1..MAX_COMPANIES) (removed in 15). uint8_t ID of the clients Language (removed in 15). string Client's unique identifier (removed in 1.0).
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 851 of file network_server.cpp.
References _settings_client, NetworkGameSocketHandler::client_id, NetworkServerGameInfo::clients_on, Debug, NetworkSettings::max_clients, ClientSettings::network, NETWORK_REVISION_LENGTH, Packet::Recv_string(), Packet::Recv_uint32(), SendAuthRequest(), SendError(), status, and STATUS_INACTIVE.
|
overrideprotectedvirtual |
Tell the server that we are done receiving/loading the map.
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 1012 of file network_server.cpp.
References _frame_counter, CC_DEFAULT, NetworkGameSocketHandler::client_id, Debug, GetClientIP(), GetClientName(), NetworkGameSocketHandler::GetInfo(), GetName(), NetworkSocketHandler::HasClientQuit(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::Iterate(), NetworkGameSocketHandler::last_frame, NetworkGameSocketHandler::last_frame_server, NetworkAdminClientInfo(), NetworkHandleCommandQueue(), SendConfigUpdate(), SendError(), SendFrame(), SendSync(), status, STATUS_AUTHORIZED, STATUS_DONE_MAP, STATUS_PRE_ACTIVE, and WC_CLIENT_LIST.
|
overrideprotectedvirtual |
Request the server to move this client into another company: uint8_t ID of the company the client wants to join.
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 1474 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, COMPANY_SPECTATOR, Debug, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Company::IsValidHumanID(), NETWORK_RECV_STATUS_OKAY, NetworkServerDoMove(), Packet::Recv_uint8(), SendError(), status, and STATUS_ACTIVE.
|
overrideprotectedvirtual |
Tell the server that we have the required GRFs.
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 839 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, SendError(), SendWelcome(), status, and STATUS_NEWGRFS_CHECK.
|
overrideprotectedvirtual |
The client is quitting the game.
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 1175 of file network_server.cpp.
References CC_DEFAULT, NetworkGameSocketHandler::client_id, CloseConnection(), Debug, GetClientName(), NetworkSocketHandler::HasClientQuit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::Iterate(), NETWORK_RECV_STATUS_CLIENT_QUIT, NetworkAdminClientQuit(), and STATUS_AUTHORIZED.
|
overrideprotectedvirtual |
Send an RCon command to the server: string RCon password.
string Command to be executed.
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 1448 of file network_server.cpp.
References _rcon_authorized_key_handler(), _redirect_console_to_client, _settings_client, NetworkGameSocketHandler::client_id, Debug, IConsoleCmdExec(), INVALID_CLIENT_ID, NetworkAuthenticationDefaultAuthorizedKeyHandler::IsAllowed(), ClientSettings::network, NETWORK_PASSWORD_LENGTH, NETWORK_RCONCOMMAND_LENGTH, NETWORK_RECV_STATUS_OKAY, NetworkSettings::rcon_password, Packet::Recv_string(), SendError(), status, and STATUS_ACTIVE.
|
overrideprotectedvirtual |
Gives the client a new name: string New name of the client.
p | The packet that was just received. |
Reimplemented from NetworkGameSocketHandler.
Definition at line 1414 of file network_server.cpp.
References CC_DEFAULT, NetworkGameSocketHandler::client_id, NetworkClientInfo::client_id, NetworkClientInfo::client_name, Debug, NetworkGameSocketHandler::GetInfo(), NetworkSocketHandler::HasClientQuit(), NETWORK_CLIENT_NAME_LENGTH, NETWORK_RECV_STATUS_CLIENT_QUIT, NETWORK_RECV_STATUS_OKAY, NetworkIsValidClientName(), NetworkMakeClientNameUnique(), NetworkUpdateClientInfo(), Packet::Recv_string(), SendError(), status, and STATUS_ACTIVE.
|
overridevirtual |
Receives a packet for the given client.
Reimplemented from NetworkTCPSocketHandler.
Definition at line 223 of file network_server.cpp.
References receive_limit, and NetworkTCPSocketHandler::ReceivePacket().
|
static |
Send the packets for the server sockets.
Definition at line 304 of file network_server.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::Iterate(), SPS_CLOSED, and STATUS_MAP.
|
protected |
Request the game password.
Definition at line 438 of file network_server.cpp.
References _authorized_key_handler(), _frame_counter, _password_provider(), authentication_handler, NetworkGameSocketHandler::client_id, CloseConnection(), NetworkAuthenticationServerHandler::Create(), Debug, NetworkGameSocketHandler::last_frame, NetworkGameSocketHandler::last_frame_server, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_AUTH_REQUEST, NetworkTCPSocketHandler::SendPacket(), status, STATUS_AUTH_GAME, and STATUS_INACTIVE.
Referenced by Receive_CLIENT_AUTH_RESPONSE(), and Receive_CLIENT_JOIN().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendChat | ( | NetworkAction | action, |
ClientID | client_id, | ||
bool | self_send, | ||
const std::string & | msg, | ||
int64_t | data | ||
) |
Send a chat message.
action | The action associated with the message. |
client_id | The origin of the chat message. |
self_send | Whether we did send the message. |
msg | The actual message. |
data | Arbitrary extra data. |
Definition at line 685 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_CHAT, NetworkTCPSocketHandler::SendPacket(), status, and STATUS_PRE_ACTIVE.
NetworkRecvStatus ServerNetworkGameSocketHandler::SendClientInfo | ( | NetworkClientInfo * | ci | ) |
Send the client information about a client.
ci | The client to send information about. |
Definition at line 326 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, NetworkClientInfo::client_id, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, Debug, INVALID_CLIENT_ID, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_CLIENT_INFO, NetworkClientInfo::public_key, and NetworkTCPSocketHandler::SendPacket().
Referenced by SendWelcome().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendCommand | ( | const CommandPacket & | cp | ) |
Send a command to the client to execute.
cp | The command to send. |
Definition at line 663 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, CommandPacket::cmd, Debug, CommandPacket::frame, CommandPacket::my_cmd, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_COMMAND, NetworkGameSocketHandler::SendCommand(), and NetworkTCPSocketHandler::SendPacket().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendConfigUpdate | ( | ) |
Send an update about the max company/spectator counts.
Definition at line 816 of file network_server.cpp.
References _settings_client, NetworkGameSocketHandler::client_id, Debug, NetworkSettings::max_companies, ClientSettings::network, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_CONFIG_UPDATE, NetworkTCPSocketHandler::SendPacket(), and NetworkSettings::server_name.
Referenced by Receive_CLIENT_MAP_OK().
|
protected |
Notify the client that the authentication has completed and tell that for the remainder of this socket encryption is enabled.
Definition at line 463 of file network_server.cpp.
References authentication_handler, NetworkGameSocketHandler::client_id, CloseConnection(), Debug, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_ENABLE_ENCRYPTION, NetworkTCPSocketHandler::SendPacket(), status, and STATUS_AUTH_GAME.
Referenced by Receive_CLIENT_AUTH_RESPONSE().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendError | ( | NetworkErrorCode | error, |
const std::string & | reason = {} |
||
) |
Send an error to the client, and close its connection.
error | The error to disconnect for. |
reason | In case of kicking a client, specifies the reason for kicking the client. |
Definition at line 360 of file network_server.cpp.
References CC_DEFAULT, NetworkGameSocketHandler::client_id, CloseConnection(), Debug, GetClientName(), GetNetworkErrorMsg(), GetString(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::Iterate(), NETWORK_RECV_STATUS_SERVER_ERROR, NetworkAdminClientError(), PACKET_SERVER_ERROR, NetworkTCPSocketHandler::SendPacket(), status, and STATUS_AUTHORIZED.
Referenced by Receive_CLIENT_ACK(), Receive_CLIENT_AUTH_RESPONSE(), Receive_CLIENT_CHAT(), Receive_CLIENT_COMMAND(), Receive_CLIENT_GETMAP(), Receive_CLIENT_IDENTIFY(), Receive_CLIENT_JOIN(), Receive_CLIENT_MAP_OK(), Receive_CLIENT_MOVE(), Receive_CLIENT_NEWGRFS_CHECKED(), Receive_CLIENT_RCON(), Receive_CLIENT_SET_NAME(), and SendMap().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendErrorQuit | ( | ClientID | client_id, |
NetworkErrorCode | errorno | ||
) |
Tell the client another client quit with an error.
client_id | The client that quit. |
errorno | The reason the client quit. |
Definition at line 732 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_ERROR_QUIT, and NetworkTCPSocketHandler::SendPacket().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendExternalChat | ( | const std::string & | source, |
TextColour | colour, | ||
const std::string & | user, | ||
const std::string & | msg | ||
) |
Send a chat message from external source.
source | Name of the source this message came from. |
colour | TextColour to use for the message. |
user | Name of the user who sent the messsage. |
msg | The actual message. |
Definition at line 710 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_EXTERNAL_CHAT, NetworkTCPSocketHandler::SendPacket(), status, and STATUS_PRE_ACTIVE.
NetworkRecvStatus ServerNetworkGameSocketHandler::SendFrame | ( | ) |
Tell the client that they may run to a particular frame.
Definition at line 621 of file network_server.cpp.
References _frame_counter, _frame_counter_max, _sync_seed_1, last_token, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_FRAME, and NetworkTCPSocketHandler::SendPacket().
Referenced by Receive_CLIENT_MAP_OK().
|
protected |
Send the client information about the server.
Definition at line 343 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_GAME_INFO, NetworkTCPSocketHandler::SendPacket(), and TCP_MTU.
Referenced by Receive_CLIENT_GAME_INFO().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendJoin | ( | ClientID | client_id | ) |
Tell that a client joined.
client_id | The client that joined. |
Definition at line 608 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_JOIN, and NetworkTCPSocketHandler::SendPacket().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap | ( | ) |
This sends the map to the client.
Definition at line 555 of file network_server.cpp.
References _frame_counter, NetworkGameSocketHandler::client_id, Debug, NetworkGameSocketHandler::last_frame, NetworkGameSocketHandler::last_frame_server, NetworkGameSocketHandler::last_packet, NETWORK_RECV_STATUS_OKAY, NetworkSyncCommandQueue(), PACKET_SERVER_MAP_BEGIN, savegame, SaveWithFilter(), SendError(), NetworkTCPSocketHandler::SendPacket(), SL_OK, status, STATUS_AUTHORIZED, STATUS_DONE_MAP, and STATUS_MAP.
Referenced by Receive_CLIENT_GETMAP().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendMove | ( | ClientID | client_id, |
CompanyID | company_id | ||
) |
Tell that a client moved to another company.
client_id | The client that moved. |
company_id | The company the client moved to. |
Definition at line 803 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_MOVE, and NetworkTCPSocketHandler::SendPacket().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGame | ( | ) |
Tell the client we're starting a new game.
Definition at line 772 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_NEWGAME, and NetworkTCPSocketHandler::SendPacket().
|
protected |
Send the check for the NewGRFs.
Definition at line 405 of file network_server.cpp.
References _grfconfig, NetworkGameSocketHandler::client_id, CloseConnection(), Debug, GRFConfig::flags, GCF_STATIC, HasBit(), GRFConfig::ident, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, GRFConfig::next, PACKET_SERVER_CHECK_NEWGRFS, NetworkTCPSocketHandler::SendPacket(), SendWelcome(), status, STATUS_IDENTIFY, STATUS_NEWGRFS_CHECK, and TCP_MTU.
Referenced by Receive_CLIENT_IDENTIFY().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendQuit | ( | ClientID | client_id | ) |
Tell the client another client quit.
client_id | The client that quit. |
Definition at line 749 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_QUIT, and NetworkTCPSocketHandler::SendPacket().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendRConResult | ( | uint16_t | colour, |
const std::string & | command | ||
) |
Send the result of a console action.
colour | The colour of the result. |
command | The command that was executed. |
Definition at line 786 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_RCON, and NetworkTCPSocketHandler::SendPacket().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendShutdown | ( | ) |
Tell the client we're shutting down.
Definition at line 762 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_SHUTDOWN, and NetworkTCPSocketHandler::SendPacket().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendSync | ( | ) |
Request the client to sync.
Definition at line 644 of file network_server.cpp.
References _frame_counter, _sync_seed_1, NetworkGameSocketHandler::client_id, Debug, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_SYNC, and NetworkTCPSocketHandler::SendPacket().
Referenced by Receive_CLIENT_MAP_OK().
NetworkRecvStatus ServerNetworkGameSocketHandler::SendWait | ( | ) |
Tell the client that its put in a waiting queue.
Definition at line 507 of file network_server.cpp.
References NetworkGameSocketHandler::client_id, Debug, NetworkGameSocketHandler::GetInfo(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::Iterate(), NetworkClientInfo::join_date, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_WAIT, NetworkTCPSocketHandler::SendPacket(), and STATUS_MAP_WAIT.
Referenced by Receive_CLIENT_GETMAP().
|
protected |
Send the client a welcome message with some basic information.
Definition at line 477 of file network_server.cpp.
References _frame_counter, NetworkGameSocketHandler::client_id, CLIENT_ID_SERVER, NetworkServerGameInfo::clients_on, CloseConnection(), Debug, NetworkClientInfo::GetByClientID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::Iterate(), NetworkGameSocketHandler::last_frame, NetworkGameSocketHandler::last_frame_server, NETWORK_RECV_STATUS_MALFORMED_PACKET, PACKET_SERVER_WELCOME, SendClientInfo(), NetworkTCPSocketHandler::SendPacket(), status, STATUS_AUTHORIZED, and STATUS_NEWGRFS_CHECK.
Referenced by Receive_CLIENT_NEWGRFS_CHECKED(), and SendNewGRFCheck().
|
protected |
The handler for the authentication.
Definition at line 26 of file network_server.h.
Referenced by Receive_CLIENT_AUTH_RESPONSE(), SendAuthRequest(), and SendEnableEncryption().
NetworkAddress ServerNetworkGameSocketHandler::client_address |
IP-address of the client (so they can be banned)
Definition at line 75 of file network_server.h.
Referenced by AcceptConnection(), and GetClientIP().
uint8_t ServerNetworkGameSocketHandler::lag_test |
Byte used for lag-testing the client.
Definition at line 67 of file network_server.h.
uint8_t ServerNetworkGameSocketHandler::last_token |
The last random token we did send to verify the client is listening.
Definition at line 68 of file network_server.h.
Referenced by Receive_CLIENT_ACK(), and SendFrame().
uint32_t ServerNetworkGameSocketHandler::last_token_frame |
The last frame we received the right token.
Definition at line 69 of file network_server.h.
Referenced by Receive_CLIENT_ACK().
CommandQueue ServerNetworkGameSocketHandler::outgoing_queue |
The command-queue awaiting delivery; conceptually more a bucket to gather commands in, after which the whole bucket is sent to the client.
Definition at line 71 of file network_server.h.
|
protected |
The public key of our client.
Definition at line 27 of file network_server.h.
Referenced by Receive_CLIENT_AUTH_RESPONSE(), and Receive_CLIENT_IDENTIFY().
size_t ServerNetworkGameSocketHandler::receive_limit |
Amount of bytes that we can receive at this moment.
Definition at line 72 of file network_server.h.
Referenced by ReceivePacket(), and ServerNetworkGameSocketHandler().
std::shared_ptr<struct PacketWriter> ServerNetworkGameSocketHandler::savegame |
Writer used to write the savegame.
Definition at line 74 of file network_server.h.
Referenced by CloseConnection(), SendMap(), and ~ServerNetworkGameSocketHandler().
ClientStatus ServerNetworkGameSocketHandler::status |
Status of this client.
Definition at line 70 of file network_server.h.
Referenced by CloseConnection(), Receive_CLIENT_ACK(), Receive_CLIENT_AUTH_RESPONSE(), Receive_CLIENT_CHAT(), Receive_CLIENT_GETMAP(), Receive_CLIENT_IDENTIFY(), Receive_CLIENT_JOIN(), Receive_CLIENT_MAP_OK(), Receive_CLIENT_MOVE(), Receive_CLIENT_NEWGRFS_CHECKED(), Receive_CLIENT_RCON(), Receive_CLIENT_SET_NAME(), SendAuthRequest(), SendChat(), SendEnableEncryption(), SendError(), SendExternalChat(), SendMap(), SendNewGRFCheck(), SendWelcome(), and ServerNetworkGameSocketHandler().