ServerNetworkGameSocketHandler Class Reference

Class for handling the server side of the game connection. More...

#include <network_server.h>

Inheritance diagram for ServerNetworkGameSocketHandler:
Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool > NetworkGameSocketHandler TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED > NetworkTCPSocketHandler NetworkSocketHandler

Public Types

enum  ClientStatus {
  STATUS_INACTIVE, STATUS_NEWGRFS_CHECK, STATUS_AUTH_GAME, STATUS_AUTH_COMPANY,
  STATUS_AUTHORIZED, STATUS_MAP_WAIT, STATUS_MAP, STATUS_DONE_MAP,
  STATUS_PRE_ACTIVE, STATUS_ACTIVE, STATUS_END
}
 

Status of a client.

More...

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.
virtual PacketReceivePacket ()
 Receives a packet for the given client.
virtual void SendPacket (Packet *packet)
 This function puts the packet in the send-queue and it is send as soon as possible.
NetworkRecvStatus CloseConnection (NetworkRecvStatus status)
 Close the network connection due to the given status.
void GetClientName (char *client_name, size_t size) const
 Get the name of the client, if the user did not send it yet, Client #<no> is used.
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 colour, const char *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)
 Send an error to the client, and close its connection.
NetworkRecvStatus SendChat (NetworkAction action, ClientID client_id, bool self_send, const char *msg, int64 data)
 Send a chat message.
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 SendCompanyUpdate ()
 Send an update about the company password states.
NetworkRecvStatus SendConfigUpdate ()
 Send an update about the max company/spectator counts.
const char * GetClientIP ()
 Get the IP address/hostname of the connected client.

Static Public Member Functions

static void Send ()
 Send the packets for the server sockets.
static void AcceptConnection (SOCKET s, const NetworkAddress &address)
 Handle the acception 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.

Data Fields

byte lag_test
 Byte used for lag-testing the client.
byte last_token
 The last random token we did send to verify the client is listening.
uint32 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.
int receive_limit
 Amount of bytes that we can receive at this moment.
Packetsavegame_packets
 Packet queue of the savegame; send these "slowly" to the client.
struct PacketWritersavegame
 Writer used to write the savegame.
ThreadMutexsavegame_mutex
 Mutex for making threaded saving safe.
NetworkAddress client_address
 IP-address of the client (so he can be banned).

Protected Member Functions

virtual NetworkRecvStatus Receive_CLIENT_JOIN (Packet *p)
 Try to join the server: string OpenTTD revision (norev000 if no revision).
virtual NetworkRecvStatus Receive_CLIENT_COMPANY_INFO (Packet *p)
 Request company information (in detail).
virtual NetworkRecvStatus Receive_CLIENT_GAME_PASSWORD (Packet *p)
 Send a password to the server to authorize: uint8 Password type (see NetworkPasswordType).
virtual NetworkRecvStatus Receive_CLIENT_COMPANY_PASSWORD (Packet *p)
 Send a password to the server to authorize uint8 Password type (see NetworkPasswordType).
virtual NetworkRecvStatus Receive_CLIENT_GETMAP (Packet *p)
 Request the map from the server.
virtual NetworkRecvStatus Receive_CLIENT_MAP_OK (Packet *p)
 Tell the server that we are done receiving/loading the map.
virtual NetworkRecvStatus Receive_CLIENT_ACK (Packet *p)
 Tell the server we are done with this frame: uint32 Current frame counter of the client.
virtual NetworkRecvStatus Receive_CLIENT_COMMAND (Packet *p)
 The client has done a command and wants us to handle it.
virtual NetworkRecvStatus Receive_CLIENT_CHAT (Packet *p)
 Sends a chat-packet to the server: uint8 ID of the action (see NetworkAction).
virtual NetworkRecvStatus Receive_CLIENT_SET_PASSWORD (Packet *p)
 Set the password for the clients current company: string The password.
virtual NetworkRecvStatus Receive_CLIENT_SET_NAME (Packet *p)
 Gives the client a new name: string New name of the client.
virtual NetworkRecvStatus Receive_CLIENT_QUIT (Packet *p)
 The client is quiting the game.
virtual NetworkRecvStatus Receive_CLIENT_ERROR (Packet *p)
 The client made an error and is quiting the game.
virtual NetworkRecvStatus Receive_CLIENT_RCON (Packet *p)
 Send an RCon command to the server: string RCon password.
virtual NetworkRecvStatus Receive_CLIENT_NEWGRFS_CHECKED (Packet *p)
 Tell the server that we have the required GRFs.
virtual NetworkRecvStatus Receive_CLIENT_MOVE (Packet *p)
 Request the server to move this client into another company: uint8 ID of the company the client wants to join.
NetworkRecvStatus SendCompanyInfo ()
 Send the client information about the companies.
NetworkRecvStatus SendNewGRFCheck ()
 Send the check for the NewGRFs.
NetworkRecvStatus SendWelcome ()
 Send the client a welcome message with some basic information.
NetworkRecvStatus SendWait ()
 Tell the client that its put in a waiting queue.
NetworkRecvStatus SendNeedGamePassword ()
 Request the game password.
NetworkRecvStatus SendNeedCompanyPassword ()
 Request the company password.

Detailed Description

Class for handling the server side of the game connection.

Definition at line 29 of file network_server.h.


Member Enumeration Documentation

Status of a client.

Enumerator:
STATUS_INACTIVE 

The client is not connected nor active.

STATUS_NEWGRFS_CHECK 

The client is checking NewGRFs.

STATUS_AUTH_GAME 

The client is authorizing with game (server) password.

STATUS_AUTH_COMPANY 

The client is authorizing with company password.

STATUS_AUTHORIZED 

The client is authorized.

STATUS_MAP_WAIT 

The client is waiting as someone else is downloading the map.

STATUS_MAP 

The client is downloading the map.

STATUS_DONE_MAP 

The client has downloaded the map.

STATUS_PRE_ACTIVE 

The client is catching up the delayed frames.

STATUS_ACTIVE 

The client is active within in the game.

STATUS_END 

Must ALWAYS be on the end of this list!! (period).

Definition at line 57 of file network_server.h.


Constructor & Destructor Documentation

ServerNetworkGameSocketHandler::ServerNetworkGameSocketHandler ( SOCKET  s  ) 

Member Function Documentation

void ServerNetworkGameSocketHandler::AcceptConnection ( SOCKET  s,
const NetworkAddress address 
) [static]

Handle the acception of a connection to the server.

Parameters:
s The socket of the new connection.
address The address of the peer.

Definition at line 487 of file network.cpp.

References client_address, ServerNetworkGameSocketHandler(), and SetWindowDirty().

bool ServerNetworkGameSocketHandler::AllowConnection (  )  [static]
NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection ( NetworkRecvStatus  status  )  [virtual]
ServerNetworkGameSocketHandler * ServerNetworkGameSocketHandler::GetByClientID ( ClientID  client_id  )  [static]

Return the client state given it's client-identifier.

Parameters:
client_id the ClientID to search for
Returns:
return a pointer to the corresponding NetworkClientSocket struct or NULL when not found

Definition at line 129 of file network.cpp.

References FOR_ALL_CLIENT_SOCKETS.

Referenced by SendCompanyInfo().

const char * ServerNetworkGameSocketHandler::GetClientIP (  ) 

Get the IP address/hostname of the connected client.

Returns:
The IP address.

Definition at line 1893 of file network_server.cpp.

References client_address, and NetworkAddress::GetHostname().

void ServerNetworkGameSocketHandler::GetClientName ( char *  client_name,
size_t  size 
) const

Get the name of the client, if the user did not send it yet, Client #<no> is used.

Parameters:
client_name The variable to write the name to.
size The amount of bytes we can write.

Definition at line 2072 of file network_server.cpp.

References NetworkGameSocketHandler::client_id, NetworkClientInfo::client_name, NetworkGameSocketHandler::GetInfo(), StrEmpty(), and ttd_strlcpy().

Referenced by CloseConnection(), Receive_CLIENT_ERROR(), Receive_CLIENT_MAP_OK(), Receive_CLIENT_QUIT(), and SendError().

static const char* ServerNetworkGameSocketHandler::GetName (  )  [inline, static]

Get the name used by the listener.

Returns:
the name to show in debug logs and the like.

Definition at line 117 of file network_server.h.

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_ACK ( Packet p  )  [protected, virtual]

Tell the server we are done with this frame: uint32 Current frame counter of the client.

uint8 The random token that the server sent in the PACKET_SERVER_FRAME packet.

Parameters:
p The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1181 of file network_server.cpp.

References _frame_counter, DAY_TICKS, 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.

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_CHAT ( Packet p  )  [protected, virtual]

Sends a chat-packet to the server: uint8 ID of the action (see NetworkAction).

uint8 ID of the destination type (see DestType). uint32 ID of the client or company (destination of the chat). string Message (max NETWORK_CHAT_LENGTH). uint64 data (used e.g. for 'give money' actions).

Parameters:
p The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1349 of file network_server.cpp.

References CC_ERROR, NetworkClientInfo::client_id, NetworkGameSocketHandler::client_id, NetworkClientInfo::client_playas, NetworkGameSocketHandler::GetInfo(), IConsolePrintF(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), NETWORK_CHAT_LENGTH, NETWORK_RECV_STATUS_OKAY, NetworkServerSendChat(), Packet::Recv_string(), Packet::Recv_uint32(), Packet::Recv_uint64(), Packet::Recv_uint8(), SendError(), status, and STATUS_AUTHORIZED.

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND ( Packet p  )  [protected, virtual]
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_COMPANY_INFO ( Packet p  )  [protected, virtual]

Request company information (in detail).

Parameters:
p The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 819 of file network_server.cpp.

References SendCompanyInfo().

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_COMPANY_PASSWORD ( Packet p  )  [protected, virtual]

Send a password to the server to authorize uint8 Password type (see NetworkPasswordType).

string The password.

Parameters:
p The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 945 of file network_server.cpp.

References _network_company_states, NetworkClientInfo::client_playas, NetworkGameSocketHandler::GetInfo(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), NETWORK_PASSWORD_LENGTH, Packet::Recv_string(), SendError(), SendWelcome(), status, STATUS_AUTH_COMPANY, and StrEmpty().

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_ERROR ( Packet p  )  [protected, virtual]

The client made an error and is quiting the game.

uint8 Error of the code caused (see NetworkErrorCode).

Parameters:
p The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1120 of file network_server.cpp.

References CC_DEFAULT, NetworkGameSocketHandler::client_id, CloseConnection(), DEBUG, FOR_ALL_CLIENT_SOCKETS, GetClientName(), GetNetworkErrorMsg(), NetworkSocketHandler::HasClientQuit(), lastof, NETWORK_CLIENT_NAME_LENGTH, NETWORK_RECV_STATUS_CONN_LOST, NetworkAdminClientError(), Packet::Recv_uint8(), and STATUS_AUTHORIZED.

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GAME_PASSWORD ( Packet p  )  [protected, virtual]
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GETMAP ( Packet p  )  [protected, virtual]

Request the map from the server.

uint32 NewGRF version (release versions of OpenTTD only).

Parameters:
p The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 967 of file network_server.cpp.

References FOR_ALL_CLIENT_SOCKETS, HasBit(), NetworkSocketHandler::HasClientQuit(), Packet::Recv_uint32(), SendError(), SendMap(), SendWait(), Packet::size, status, STATUS_MAP, and STATUS_MAP_WAIT.

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN ( Packet p  )  [protected, virtual]

Try to join the server: string OpenTTD revision (norev000 if no revision).

string Name of the client (max NETWORK_NAME_LENGTH). uint8 ID of the company to play as (1..MAX_COMPANIES). uint8 ID of the clients Language.

Parameters:
p The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 845 of file network_server.cpp.

References _date, _date_fract, _grfconfig, _network_company_states, _settings_client, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientinfo_pool >::CanAllocateItem(), NetworkGameSocketHandler::client_id, NetworkClientInfo::client_lang, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, COMPANY_NEW_COMPANY, COMPANY_SPECTATOR, DEBUG, 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, IsNetworkCompatibleVersion(), Company::IsValidHumanID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), NetworkClientInfo::join_date, lastof, NetworkSettings::max_companies, NetworkSettings::max_spectators, NetworkCompanyState::months_empty, ClientSettings::network, NETWORK_CLIENT_NAME_LENGTH, NETWORK_RECV_STATUS_CONN_LOST, NETWORK_REVISION_LENGTH, NetworkFindName(), Receive_CLIENT_NEWGRFS_CHECKED(), Packet::Recv_string(), Packet::Recv_uint8(), SendError(), SendNewGRFCheck(), NetworkGameSocketHandler::SetInfo(), status, STATUS_INACTIVE, STATUS_NEWGRFS_CHECK, strecpy(), and StrEmpty().

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_MAP_OK ( Packet p  )  [protected, virtual]
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_MOVE ( Packet p  )  [protected, virtual]

Request the server to move this client into another company: uint8 ID of the company the client wants to join.

string Password, if the company is password protected.

Parameters:
p The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1449 of file network_server.cpp.

References _network_company_states, NetworkGameSocketHandler::client_id, COMPANY_SPECTATOR, DEBUG, Company::IsValidHumanID(), NETWORK_PASSWORD_LENGTH, NETWORK_RECV_STATUS_OKAY, NetworkServerDoMove(), Packet::Recv_string(), Packet::Recv_uint8(), SendError(), status, STATUS_ACTIVE, and StrEmpty().

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_NEWGRFS_CHECKED ( Packet p  )  [protected, virtual]
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_QUIT ( Packet p  )  [protected, virtual]
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_RCON ( Packet p  )  [protected, virtual]
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_SET_NAME ( Packet p  )  [protected, virtual]
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_SET_PASSWORD ( Packet p  )  [protected, virtual]

Set the password for the clients current company: string The password.

Parameters:
p The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1381 of file network_server.cpp.

References NetworkClientInfo::client_playas, NetworkGameSocketHandler::GetInfo(), NETWORK_PASSWORD_LENGTH, NETWORK_RECV_STATUS_OKAY, NetworkServerSetCompanyPassword(), Packet::Recv_string(), SendError(), status, and STATUS_ACTIVE.

Packet * ServerNetworkGameSocketHandler::ReceivePacket (  )  [virtual]

Receives a packet for the given client.

Returns:
The received packet (or NULL when it didn't receive one)

Reimplemented from NetworkTCPSocketHandler.

Definition at line 196 of file network_server.cpp.

References receive_limit, and Packet::size.

void ServerNetworkGameSocketHandler::Send (  )  [static]

Send the packets for the server sockets.

Definition at line 281 of file network_server.cpp.

References FOR_ALL_CLIENT_SOCKETS, SPS_CLOSED, and STATUS_MAP.

NetworkRecvStatus ServerNetworkGameSocketHandler::SendChat ( NetworkAction  action,
ClientID  client_id,
bool  self_send,
const char *  msg,
int64  data 
)

Send a chat message.

Parameters:
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 703 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_CHAT, Packet::Send_bool(), Packet::Send_string(), Packet::Send_uint32(), Packet::Send_uint64(), Packet::Send_uint8(), and SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendClientInfo ( NetworkClientInfo ci  ) 

Send the client information about a client.

Parameters:
ci The client to send information about.

Definition at line 305 of file network_server.cpp.

References NetworkClientInfo::client_id, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, INVALID_CLIENT_ID, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_CLIENT_INFO, Packet::Send_string(), Packet::Send_uint32(), Packet::Send_uint8(), and SendPacket().

Referenced by SendWelcome().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendCommand ( const CommandPacket cp  ) 

Send a command to the client to execute.

Parameters:
cp The command to send.

Definition at line 683 of file network_server.cpp.

References CommandPacket::frame, CommandPacket::my_cmd, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_COMMAND, Packet::Send_bool(), Packet::Send_uint32(), and SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyInfo (  )  [protected]
NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyUpdate (  ) 

Send an update about the company password states.

Definition at line 794 of file network_server.cpp.

References _network_company_passworded, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_COMPANY_UPDATE, Packet::Send_uint16(), and SendPacket().

Referenced by Receive_CLIENT_MAP_OK().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendConfigUpdate (  ) 
NetworkRecvStatus ServerNetworkGameSocketHandler::SendError ( NetworkErrorCode  error  ) 
NetworkRecvStatus ServerNetworkGameSocketHandler::SendErrorQuit ( ClientID  client_id,
NetworkErrorCode  errorno 
)

Tell the client another client quit with an error.

Parameters:
client_id The client that quit.
errorno The reason the client quit.

Definition at line 722 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_ERROR_QUIT, Packet::Send_uint32(), Packet::Send_uint8(), and SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendFrame (  ) 

Tell the client that they may run to a particular frame.

Definition at line 643 of file network_server.cpp.

References _frame_counter, _frame_counter_max, _sync_seed_1, last_token, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_FRAME, Packet::Send_uint32(), Packet::Send_uint8(), and SendPacket().

Referenced by Receive_CLIENT_MAP_OK().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendJoin ( ClientID  client_id  ) 

Tell that a client joined.

Parameters:
client_id The client that joined.

Definition at line 632 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_JOIN, Packet::Send_uint32(), and SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendMove ( ClientID  client_id,
CompanyID  company_id 
)

Tell that a client moved to another company.

Parameters:
client_id The client that moved.
company_id The company the client moved to.

Definition at line 783 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_MOVE, Packet::Send_uint32(), Packet::Send_uint8(), and SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedCompanyPassword (  )  [protected]
NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedGamePassword (  )  [protected]
NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGame (  ) 

Tell the client we're starting a new game.

Definition at line 756 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_NEWGAME, and SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGRFCheck (  )  [protected]
void ServerNetworkGameSocketHandler::SendPacket ( Packet packet  )  [virtual]

This function puts the packet in the send-queue and it is send as soon as possible.

This is the next tick, or maybe one tick later if the OS-network-buffer is full)

Parameters:
packet the packet to send

Reimplemented from NetworkTCPSocketHandler.

Definition at line 209 of file network_server.cpp.

References ThreadMutex::BeginCritical(), ThreadMutex::EndCritical(), and savegame_mutex.

Referenced by SendChat(), SendClientInfo(), SendCommand(), SendCompanyInfo(), SendCompanyUpdate(), SendConfigUpdate(), SendError(), SendErrorQuit(), SendFrame(), SendJoin(), SendMap(), SendMove(), SendNeedCompanyPassword(), SendNeedGamePassword(), SendNewGame(), SendNewGRFCheck(), SendQuit(), SendRConResult(), SendShutdown(), SendSync(), SendWait(), and SendWelcome().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendQuit ( ClientID  client_id  ) 

Tell the client another client quit.

Parameters:
client_id The client that quit.

Definition at line 737 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_QUIT, Packet::Send_uint32(), and SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendRConResult ( uint16  colour,
const char *  command 
)

Send the result of a console action.

Parameters:
colour The colour of the result.
command The command that was executed.

Definition at line 768 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_RCON, Packet::Send_string(), Packet::Send_uint16(), and SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendShutdown (  ) 

Tell the client we're shutting down.

Definition at line 748 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_SHUTDOWN, and SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendSync (  ) 

Request the client to sync.

Definition at line 666 of file network_server.cpp.

References _frame_counter, _sync_seed_1, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_SYNC, Packet::Send_uint32(), and SendPacket().

Referenced by Receive_CLIENT_MAP_OK().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendWait (  )  [protected]
NetworkRecvStatus ServerNetworkGameSocketHandler::SendWelcome (  )  [protected]

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

Generated on Sun Jun 5 04:21:27 2011 for OpenTTD by  doxygen 1.6.1