OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions
ServerNetworkGameSocketHandler Class Reference

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

`#include <network_server.h>`

Inheritance diagram for ServerNetworkGameSocketHandler:

## 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 Packet * | ReceivePacket ()
| Receives a packet for the given client.
NetworkRecvStatus | CloseConnection (NetworkRecvStatus status)
| Close the network connection due to the given status.
void | GetClientName (char *client_name, const char *last) 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.
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 size, 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)
| 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.
Public Member Functions inherited from NetworkTCPSocketHandler
bool | IsConnected () const
| Whether this socket is currently bound to a socket.
virtual void | SendPacket (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 ()
| Close the socket when destructing the socket handler.
virtual void | Close ()
| Really close the socket.
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.
void | SendGRFIdentifier (Packet *p, const GRFIdentifier *grf)
| Serializes the GRFIdentifier (GRF ID and MD5 checksum) to the packet.
void | ReceiveGRFIdentifier (Packet *p, GRFIdentifier *grf)
| Deserializes the GRFIdentifier (GRF ID and MD5 checksum) from the packet.
void | SendCompanyInformation (Packet *p, const struct Company *c, const struct NetworkCompanyStats *stats, uint max_len=NETWORK_COMPANY_NAME_LENGTH)
| Package some generic company information into a packet.

## 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-NULL) 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 Public Member Functions inherited from TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >
static void | AcceptClient (SOCKET ls)
| Accepts clients from the sockets.
static bool | Receive ()
| Handle the receiving of packets.
static bool | Listen (uint16 port)
| Listen on a particular port.
static void | CloseListeners ()
| Close the sockets we're listening on.

## 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.
struct PacketWriter * | savegame
| Writer used to write the savegame.
NetworkAddress | client_address
| IP-address of the client (so he 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 | last_frame
| Last frame we have executed.
uint32 | last_frame_server
| Last frame the server has executed.
CommandQueue | incoming_queue
| The command-queue awaiting handling.
uint | 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
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 quitting the game.
virtual NetworkRecvStatus | Receive_CLIENT_ERROR (Packet *p)
| The client made an error and is quitting 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.
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 Error code caused (see NetworkErrorCode).
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_INFO (Packet *p)
| Sends information about the companies (one packet per company): uint8 Version of the structure of this packet (NETWORK_COMPANY_INFO_VERSION).
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_INFO (Packet *p)
| Send information about a client: uint32 ID of the client (always unique on a server.
virtual NetworkRecvStatus | Receive_SERVER_NEED_GAME_PASSWORD (Packet *p)
| Indication to the client that the server needs a game password.
virtual NetworkRecvStatus | Receive_SERVER_NEED_COMPANY_PASSWORD (Packet *p)
| Indication to the client that the server needs a company password: uint32 Generation seed.
virtual NetworkRecvStatus | Receive_SERVER_WELCOME (Packet *p)
| The client is joined and ready to receive his map: uint32 Own client ID.
virtual NetworkRecvStatus | Receive_SERVER_WAIT (Packet *p)
| Notification that another client is currently receiving the map: uint8 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 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 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 Frame counter uint32 Frame counter max (how far may the client walk before the server?) uint32 General seed 1 (dependent on compile settings, not default).
virtual NetworkRecvStatus | Receive_SERVER_SYNC (Packet *p)
| Sends a sync-check to the client: uint32 Frame counter.
virtual NetworkRecvStatus | Receive_SERVER_COMMAND (Packet *p)
| Sends a DoCommand to the client: uint8 ID of the company (0..MAX_COMPANIES-1).
virtual NetworkRecvStatus | Receive_SERVER_CHAT (Packet *p)
| Sends a chat-packet to the client: uint8 ID of the action (see NetworkAction).
virtual NetworkRecvStatus | Receive_SERVER_QUIT (Packet *p)
| Notification that a client left the game: uint32 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 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 Colour code.
virtual NetworkRecvStatus | Receive_SERVER_CHECK_NEWGRFS (Packet *p)
| Sends information about all used GRFs to the client: uint8 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 ID of the client.
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_UPDATE (Packet *p)
| Update the clients knowledge of which company is password protected: uint16 Bitwise representation of each company.
virtual NetworkRecvStatus | Receive_SERVER_CONFIG_UPDATE (Packet *p)
| Update the clients knowledge of the max settings: uint8 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.

## Detailed Description

Class for handling the server side of the game connection.

Definition at line 29 of file network_server.h.

## Member Enumeration Documentation

enum ServerNetworkGameSocketHandler::ClientStatus

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 | ) |

Create a new socket for the server side of the game connection.

Parameters

  s | The socket to connect with.

Definition at line 223 of file network_server.cpp.

References _network_client_id, _settings_client, NetworkSettings::bytes_per_frame_burst, NetworkGameSocketHandler::client_id, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::MAX_SIZE, ClientSettings::network, receive_limit, status, and STATUS_INACTIVE.

Referenced by AcceptConnection().

## Member Function Documentation

void ServerNetworkGameSocketHandler::AcceptConnection | ( | SOCKET | s,
|  | const NetworkAddress & | address
| ) |  |
| static

Handle the accepting of a connection to the server.

Parameters

  s | The socket of the new connection.
  address | The address of the peer.

Definition at line 507 of file network.cpp.

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

bool ServerNetworkGameSocketHandler::AllowConnection | ( |  | ) |
| static

Whether an connection is allowed or not at this moment.

Returns
  true if the connection is allowed.

Definition at line 314 of file network_server.cpp.

References _network_clients_connected, _network_game_info, _settings_client, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkclientsocket_pool >::CanAllocateItem(), NetworkServerGameInfo::clients_on, MAX_CLIENTS, NetworkSettings::max_clients, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::MAX_SIZE, and ClientSettings::network.

NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection | ( | NetworkRecvStatus | status | ) |
| virtual

Close the network connection due to the given status.

Parameters

  status | The reason the connection got closed.

Implements NetworkGameSocketHandler.

Definition at line 262 of file network_server.cpp.

References _network_clients_connected, _network_game_info, CC_DEFAULT, NetworkGameSocketHandler::client_id, NetworkServerGameInfo::clients_on, DEBUG, DeleteWindowById(), FOR_ALL_CLIENT_SOCKETS, GetClientName(), NetworkGameSocketHandler::GetInfo(), NetworkSocketHandler::HasClientQuit(), lastof, NETWORK_CLIENT_NAME_LENGTH, NETWORK_RECV_STATUS_CONN_LOST, NETWORK_RECV_STATUS_OKAY, NetworkAdminClientError(), NetworkTCPSocketHandler::SendPackets(), SetWindowDirty(), NetworkTCPSocketHandler::sock, status, STATUS_AUTHORIZED, WC_CLIENT_LIST, and WC_CLIENT_LIST_POPUP.

Referenced by Receive_CLIENT_ERROR(), Receive_CLIENT_QUIT(), SendError(), SendNeedCompanyPassword(), SendNeedGamePassword(), and SendWelcome().

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 142 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 1956 of file network_server.cpp.

References client_address, and NetworkAddress::GetHostname().

void ServerNetworkGameSocketHandler::GetClientName | ( | char * | client_name,
|  | const char * | last
| ) |  | 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.
  last | The pointer to the last element of the destination buffer

Definition at line 2144 of file network_server.cpp.

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

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 114 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 1212 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 1381 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_PRE_ACTIVE.

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND | ( | Packet * | p | ) |
| protected virtual

The client has done a command and wants us to handle it.

Parameters

  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 1087 of file network_server.cpp.

References _settings_client, CommandQueue::Append(), CC_ERROR, NetworkClientInfo::client_id, NetworkGameSocketHandler::client_id, CLIENT_ID_SERVER, NetworkClientInfo::client_playas, CommandContainer::cmd, CMD_CLIENT_ID, CMD_COMPANY_CTRL, CMD_SERVER, CMD_SPECTATOR, CommandPacket::company, COMPANY_NEW_COMPANY, COMPANY_SPECTATOR, CommandQueue::Count(), DESTTYPE_CLIENT, GetCommandFlags(), NetworkGameSocketHandler::GetInfo(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetNumItems(), NetworkSocketHandler::HasClientQuit(), IConsolePrintF(), NetworkGameSocketHandler::incoming_queue, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), NetworkSettings::max_commands_in_queue, NetworkSettings::max_companies, ClientSettings::network, NETWORK_RECV_STATUS_CONN_LOST, NETWORK_RECV_STATUS_OKAY, NetworkServerSendChat(), CommandContainer::p1, CommandContainer::p2, NetworkGameSocketHandler::ReceiveCommand(), and SendError().

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 869 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 996 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 quitting the game.

uint8 Error of the code caused (see NetworkErrorCode).

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1151 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

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 971 of file network_server.cpp.

References _network_company_states, _settings_client, NetworkClientInfo::client_playas, NetworkGameSocketHandler::GetInfo(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), ClientSettings::network, NETWORK_PASSWORD_LENGTH, NetworkCompanyState::password, Packet::Recv_string(), SendError(), SendNeedCompanyPassword(), SendWelcome(), NetworkSettings::server_password, status, STATUS_AUTH_GAME, and StrEmpty().

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 1018 of file network_server.cpp.

References FOR_ALL_CLIENT_SOCKETS, NetworkSocketHandler::HasClientQuit(), SendError(), SendMap(), SendWait(), 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 895 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_uint32(), 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

Tell the server that we are done receiving/loading the map.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1040 of file network_server.cpp.

References _frame_counter, CC_DEFAULT, NetworkGameSocketHandler::client_id, FOR_ALL_CLIENT_SOCKETS, GetClientName(), NetworkGameSocketHandler::GetInfo(), NetworkSocketHandler::HasClientQuit(), NetworkGameSocketHandler::last_frame, NetworkGameSocketHandler::last_frame_server, lastof, NETWORK_CLIENT_NAME_LENGTH, NetworkAdminClientInfo(), NetworkHandleCommandQueue(), SendCompanyUpdate(), SendConfigUpdate(), SendError(), SendFrame(), SendSync(), status, STATUS_AUTHORIZED, STATUS_DONE_MAP, and STATUS_PRE_ACTIVE.

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 1481 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

Tell the server that we have the required GRFs.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 874 of file network_server.cpp.

References _network_company_states, _settings_client, NetworkClientInfo::client_playas, NetworkGameSocketHandler::GetInfo(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), ClientSettings::network, NetworkCompanyState::password, SendError(), SendNeedCompanyPassword(), SendNeedGamePassword(), SendWelcome(), NetworkSettings::server_password, status, STATUS_NEWGRFS_CHECK, and StrEmpty().

Referenced by Receive_CLIENT_JOIN().

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_QUIT | ( | Packet * | p | ) |
| protected virtual

The client is quitting the game.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1185 of file network_server.cpp.

References CC_DEFAULT, NetworkGameSocketHandler::client_id, CloseConnection(), FOR_ALL_CLIENT_SOCKETS, GetClientName(), NetworkSocketHandler::HasClientQuit(), lastof, NETWORK_CLIENT_NAME_LENGTH, NETWORK_RECV_STATUS_CONN_LOST, NetworkAdminClientQuit(), and STATUS_AUTHORIZED.

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_RCON | ( | Packet * | p | ) |
| protected virtual

Send an RCon command to the server: string RCon password.

string Command to be executed.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1456 of file network_server.cpp.

References _redirect_console_to_client, _settings_client, NetworkGameSocketHandler::client_id, DEBUG, IConsoleCmdExec(), INVALID_CLIENT_ID, ClientSettings::network, NETWORK_PASSWORD_LENGTH, NETWORK_RCONCOMMAND_LENGTH, NETWORK_RECV_STATUS_OKAY, NetworkSettings::rcon_password, Packet::Recv_string(), SendError(), status, STATUS_ACTIVE, and StrEmpty().

NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_SET_NAME | ( | Packet * | p | ) |
| protected virtual

Gives the client a new name: string New name of the client.

Parameters

  p | The packet that was just received.

Reimplemented from NetworkGameSocketHandler.

Definition at line 1430 of file network_server.cpp.

References CC_DEFAULT, NetworkClientInfo::client_id, NetworkClientInfo::client_name, NetworkGameSocketHandler::GetInfo(), NetworkSocketHandler::HasClientQuit(), lastof, NETWORK_CLIENT_NAME_LENGTH, NETWORK_RECV_STATUS_CONN_LOST, NETWORK_RECV_STATUS_OKAY, NetworkFindName(), NetworkUpdateClientInfo(), Packet::Recv_string(), SendError(), status, STATUS_ACTIVE, and strecpy().

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 1413 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 249 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 327 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 751 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(), NetworkTCPSocketHandler::SendPacket(), status, and STATUS_PRE_ACTIVE.

NetworkRecvStatus ServerNetworkGameSocketHandler::SendClientInfo | ( | NetworkClientInfo * | ci | ) |

Send the client information about a client.

Parameters

  ci | The client to send information about.

Definition at line 351 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 NetworkTCPSocketHandler::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 731 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 NetworkTCPSocketHandler::SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyInfo | ( |  | ) |
| protected

Send the client information about the companies.

Definition at line 365 of file network_server.cpp.

References CLIENT_ID_SERVER, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, FOR_ALL_CLIENT_SOCKETS, GetByClientID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), lastof, MAX_COMPANIES, NETWORK_CLIENT_NAME_LENGTH, NETWORK_CLIENTS_LENGTH, NETWORK_COMPANY_INFO_VERSION, NETWORK_RECV_STATUS_OKAY, NetworkPopulateCompanyStats(), PACKET_SERVER_COMPANY_INFO, Packet::Send_bool(), Packet::Send_string(), Packet::Send_uint8(), NetworkSocketHandler::SendCompanyInformation(), NetworkTCPSocketHandler::SendPacket(), strecat(), strecpy(), and StrEmpty().

Referenced by Receive_CLIENT_COMPANY_INFO().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyUpdate | ( |  | ) |

Send an update about the company password states.

Definition at line 844 of file network_server.cpp.

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

Referenced by Receive_CLIENT_MAP_OK().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendConfigUpdate | ( |  | ) |

Send an update about the max company/spectator counts.

Definition at line 854 of file network_server.cpp.

References _settings_client, NetworkSettings::max_companies, NetworkSettings::max_spectators, ClientSettings::network, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_CONFIG_UPDATE, Packet::Send_uint8(), and NetworkTCPSocketHandler::SendPacket().

Referenced by Receive_CLIENT_MAP_OK().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendError | ( | NetworkErrorCode | error | ) |

Send an error to the client, and close its connection.

Parameters

  error | The error to disconnect for.

Definition at line 431 of file network_server.cpp.

References CC_DEFAULT, NetworkGameSocketHandler::client_id, CloseConnection(), DEBUG, FOR_ALL_CLIENT_SOCKETS, GetClientName(), GetNetworkErrorMsg(), lastof, NETWORK_CLIENT_NAME_LENGTH, NETWORK_RECV_STATUS_SERVER_ERROR, NetworkAdminClientError(), PACKET_SERVER_ERROR, Packet::Send_uint8(), NetworkTCPSocketHandler::SendPacket(), status, and STATUS_AUTHORIZED.

Referenced by Receive_CLIENT_ACK(), Receive_CLIENT_CHAT(), Receive_CLIENT_COMMAND(), Receive_CLIENT_COMPANY_PASSWORD(), Receive_CLIENT_GAME_PASSWORD(), Receive_CLIENT_GETMAP(), Receive_CLIENT_JOIN(), Receive_CLIENT_MAP_OK(), Receive_CLIENT_MOVE(), Receive_CLIENT_NEWGRFS_CHECKED(), Receive_CLIENT_RCON(), Receive_CLIENT_SET_NAME(), Receive_CLIENT_SET_PASSWORD(), and SendMap().

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 772 of file network_server.cpp.

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

NetworkRecvStatus ServerNetworkGameSocketHandler::SendFrame | ( |  | ) |

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

Definition at line 691 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 NetworkTCPSocketHandler::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 680 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_JOIN, Packet::Send_uint32(), and NetworkTCPSocketHandler::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 833 of file network_server.cpp.

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

NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedCompanyPassword | ( |  | ) |
| protected

Request the company password.

Definition at line 509 of file network_server.cpp.

References _frame_counter, _settings_client, _settings_game, CloseConnection(), GameSettings::game_creation, GameCreationSettings::generation_seed, NetworkGameSocketHandler::last_frame, NetworkGameSocketHandler::last_frame_server, ClientSettings::network, NetworkSettings::network_id, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_NEED_COMPANY_PASSWORD, Packet::Send_string(), Packet::Send_uint32(), NetworkTCPSocketHandler::SendPacket(), status, and STATUS_AUTH_COMPANY.

Referenced by Receive_CLIENT_GAME_PASSWORD(), and Receive_CLIENT_NEWGRFS_CHECKED().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedGamePassword | ( |  | ) |
| protected

Request the game password.

Definition at line 494 of file network_server.cpp.

References _frame_counter, CloseConnection(), NetworkGameSocketHandler::last_frame, NetworkGameSocketHandler::last_frame_server, NETWORK_RECV_STATUS_MALFORMED_PACKET, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_NEED_GAME_PASSWORD, NetworkTCPSocketHandler::SendPacket(), status, and STATUS_AUTH_GAME.

Referenced by Receive_CLIENT_NEWGRFS_CHECKED().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGame | ( |  | ) |

Tell the client we're starting a new game.

Definition at line 806 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_NEWGAME, and NetworkTCPSocketHandler::SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGRFCheck | ( |  | ) |
| protected

Send the check for the NewGRFs.

Definition at line 474 of file network_server.cpp.

References _grfconfig, GRFConfig::flags, GCF_STATIC, HasBit(), GRFConfig::ident, NETWORK_RECV_STATUS_OKAY, GRFConfig::next, PACKET_SERVER_CHECK_NEWGRFS, Packet::Send_uint8(), NetworkSocketHandler::SendGRFIdentifier(), and NetworkTCPSocketHandler::SendPacket().

Referenced by Receive_CLIENT_JOIN().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendQuit | ( | ClientID | client_id | ) |

Tell the client another client quit.

Parameters

  client_id | The client that quit.

Definition at line 787 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_QUIT, Packet::Send_uint32(), and NetworkTCPSocketHandler::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 818 of file network_server.cpp.

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

NetworkRecvStatus ServerNetworkGameSocketHandler::SendShutdown | ( |  | ) |

Tell the client we're shutting down.

Definition at line 798 of file network_server.cpp.

References NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_SHUTDOWN, and NetworkTCPSocketHandler::SendPacket().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendSync | ( |  | ) |

Request the client to sync.

Definition at line 714 of file network_server.cpp.

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

Referenced by Receive_CLIENT_MAP_OK().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendWait | ( |  | ) |
| protected

Tell the client that its put in a waiting queue.

Definition at line 557 of file network_server.cpp.

References NetworkGameSocketHandler::client_id, FOR_ALL_CLIENT_SOCKETS, NetworkGameSocketHandler::GetInfo(), NetworkClientInfo::join_date, NETWORK_RECV_STATUS_OKAY, PACKET_SERVER_WAIT, Packet::Send_uint8(), NetworkTCPSocketHandler::SendPacket(), and STATUS_MAP_WAIT.

Referenced by Receive_CLIENT_GETMAP().

NetworkRecvStatus ServerNetworkGameSocketHandler::SendWelcome | ( |  | ) |
| protected

Send the client a welcome message with some basic information.

Definition at line 526 of file network_server.cpp.

References _frame_counter, _network_game_info, _settings_client, _settings_game, NetworkGameSocketHandler::client_id, CLIENT_ID_SERVER, NetworkServerGameInfo::clients_on, CloseConnection(), FOR_ALL_CLIENT_SOCKETS, GameSettings::game_creation, GameCreationSettings::generation_seed, NetworkClientInfo::GetByClientID(), NetworkGameSocketHandler::last_frame, NetworkGameSocketHandler::last_frame_server, ClientSettings::network, NetworkSettings::network_id, NETWORK_RECV_STATUS_MALFORMED_PACKET, PACKET_SERVER_WELCOME, Packet::Send_string(), Packet::Send_uint32(), SendClientInfo(), NetworkTCPSocketHandler::SendPacket(), status, and STATUS_AUTHORIZED.

Referenced by Receive_CLIENT_COMPANY_PASSWORD(), Receive_CLIENT_GAME_PASSWORD(), and Receive_CLIENT_NEWGRFS_CHECKED().

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

- src/network/network_server.h
- src/network/network.cpp
- src/network/network_server.cpp