OpenTTD
|
Class for handling the server side of the game connection. More...
#include <network_admin.h>
Public Member Functions | |
ServerNetworkAdminSocketHandler (SOCKET s) | |
Create a new socket for the server side of the admin network. | |
~ServerNetworkAdminSocketHandler () | |
Clear everything related to this admin. | |
NetworkRecvStatus | SendError (NetworkErrorCode error) |
Send an error to the admin. | |
NetworkRecvStatus | SendWelcome () |
Send a welcome message to the admin. | |
NetworkRecvStatus | SendNewGame () |
Tell the admin we started a new game. | |
NetworkRecvStatus | SendShutdown () |
Tell the admin we're shutting down. | |
NetworkRecvStatus | SendDate () |
Tell the admin the date. | |
NetworkRecvStatus | SendClientJoin (ClientID client_id) |
Tell the admin that a client joined. | |
NetworkRecvStatus | SendClientInfo (const NetworkClientSocket *cs, const NetworkClientInfo *ci) |
Send an initial set of data from some client's information. | |
NetworkRecvStatus | SendClientUpdate (const NetworkClientInfo *ci) |
Send an update for some client's information. | |
NetworkRecvStatus | SendClientQuit (ClientID client_id) |
Tell the admin that a client quit. | |
NetworkRecvStatus | SendClientError (ClientID client_id, NetworkErrorCode error) |
Tell the admin that a client made an error. | |
NetworkRecvStatus | SendCompanyNew (CompanyID company_id) |
Tell the admin that a new company was founded. | |
NetworkRecvStatus | SendCompanyInfo (const Company *c) |
Send the admin some information about a company. | |
NetworkRecvStatus | SendCompanyUpdate (const Company *c) |
Send an update about a company. | |
NetworkRecvStatus | SendCompanyRemove (CompanyID company_id, AdminCompanyRemoveReason bcrr) |
Tell the admin that a company got removed. | |
NetworkRecvStatus | SendCompanyEconomy () |
Send economic information of all companies. | |
NetworkRecvStatus | SendCompanyStats () |
Send statistics about the companies. | |
NetworkRecvStatus | SendChat (NetworkAction action, DestType desttype, ClientID client_id, const char *msg, int64 data) |
Send a chat message. | |
NetworkRecvStatus | SendRcon (uint16 colour, const char *command) |
Send the reply of an rcon command. | |
NetworkRecvStatus | SendConsole (const char *origin, const char *command) |
Send console output of other clients. | |
NetworkRecvStatus | SendGameScript (const char *json) |
Send GameScript JSON output. | |
NetworkRecvStatus | SendCmdNames () |
Send the names of the commands. | |
NetworkRecvStatus | SendCmdLogging (ClientID client_id, const CommandPacket *cp) |
Send a command for logging purposes. | |
NetworkRecvStatus | SendRconEnd (const char *command) |
Send a notification indicating the rcon command has completed. | |
![]() | |
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. | |
![]() | |
NetworkRecvStatus | CloseConnection (bool error=true) |
Close the current connection; for TCP this will be mostly equivalent to Close(), but for UDP it just means the packet has to be dropped. | |
NetworkAdminSocketHandler (SOCKET s) | |
Create the admin handler for the given socket. | |
NetworkRecvStatus | ReceivePackets () |
Do the actual receiving of packets. | |
AdminStatus | GetAdminStatus () const |
Get the status of the admin. | |
![]() | |
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. | |
virtual Packet * | ReceivePacket () |
Receives a packet for the given 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. | |
![]() | |
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 acception of a connection. | |
static bool | AllowConnection () |
Whether a connection is allowed or not at this moment. | |
static void | WelcomeAll () |
Send a Welcome packet to all connected admins. | |
static const char * | GetName () |
Get the name used by the listener. | |
![]() | |
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 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 | |
AdminUpdateFrequency | update_frequency [ADMIN_UPDATE_END] |
Admin requested update intervals. | |
uint32 | realtime_connect |
Time of connection. | |
NetworkAddress | address |
Address of the admin. | |
![]() | |
Tindex | index |
Index of this pool item. |
Protected Member Functions | |
virtual NetworkRecvStatus | Receive_ADMIN_JOIN (Packet *p) |
Join the admin network: string Password the server is expecting for this network. | |
virtual NetworkRecvStatus | Receive_ADMIN_QUIT (Packet *p) |
Notification to the server that this admin is quitting. | |
virtual NetworkRecvStatus | Receive_ADMIN_UPDATE_FREQUENCY (Packet *p) |
Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet): uint16 Update type (see AdminUpdateType). | |
virtual NetworkRecvStatus | Receive_ADMIN_POLL (Packet *p) |
Poll the server for certain updates, an invalid poll (e.g. | |
virtual NetworkRecvStatus | Receive_ADMIN_CHAT (Packet *p) |
Send chat as the server: uint8 Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction). | |
virtual NetworkRecvStatus | Receive_ADMIN_RCON (Packet *p) |
Execute a command on the servers console: string Command to be executed. | |
virtual NetworkRecvStatus | Receive_ADMIN_GAMESCRIPT (Packet *p) |
Send a JSON string to the current active GameScript. | |
virtual NetworkRecvStatus | Receive_ADMIN_PING (Packet *p) |
Ping the server, requiring the server to reply with a pong packet. | |
NetworkRecvStatus | SendProtocol () |
Send the protocol version to the admin. | |
NetworkRecvStatus | SendPong (uint32 d1) |
Send ping-reply (pong) to admin. | |
![]() | |
NetworkRecvStatus | ReceiveInvalidPacket (PacketAdminType type) |
Helper for logging receiving invalid packets. | |
virtual NetworkRecvStatus | Receive_SERVER_FULL (Packet *p) |
The server is full (connection gets closed). | |
virtual NetworkRecvStatus | Receive_SERVER_BANNED (Packet *p) |
The source IP address is banned (connection gets closed). | |
virtual NetworkRecvStatus | Receive_SERVER_ERROR (Packet *p) |
An error was caused by this admin connection (connection gets closed). | |
virtual NetworkRecvStatus | Receive_SERVER_PROTOCOL (Packet *p) |
Inform a just joined admin about the protocol specifics: uint8 Protocol version. | |
virtual NetworkRecvStatus | Receive_SERVER_WELCOME (Packet *p) |
Welcome a connected admin to the game: string Name of the Server (e.g. | |
virtual NetworkRecvStatus | Receive_SERVER_NEWGAME (Packet *p) |
Notification about a newgame. | |
virtual NetworkRecvStatus | Receive_SERVER_SHUTDOWN (Packet *p) |
Notification about the server shutting down. | |
virtual NetworkRecvStatus | Receive_SERVER_DATE (Packet *p) |
Send the current date of the game: uint32 Current game date. | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_JOIN (Packet *p) |
Notification of a new client: uint32 ID of the new client. | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_INFO (Packet *p) |
Client information of a specific client: uint32 ID of the client. | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_UPDATE (Packet *p) |
Client update details on a specific client (e.g. | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_QUIT (Packet *p) |
Notification about a client leaving the game. | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_ERROR (Packet *p) |
Notification about a client error (and thus the clients disconnection). | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_NEW (Packet *p) |
Notification of a new company: uint8 ID of the new company. | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_INFO (Packet *p) |
Company information on a specific company: uint8 ID of the company. | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_UPDATE (Packet *p) |
Company information of a specific company: uint8 ID of the company. | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_REMOVE (Packet *p) |
Notification about a removed company (e.g. | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_ECONOMY (Packet *p) |
Economy update of a specific company: uint8 ID of the company. | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_STATS (Packet *p) |
Company statistics on stations and vehicles: uint8 ID of the company. | |
virtual NetworkRecvStatus | Receive_SERVER_CHAT (Packet *p) |
Send chat from the game into the admin network: uint8 Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction). | |
virtual NetworkRecvStatus | Receive_SERVER_RCON (Packet *p) |
Result of an rcon command: uint16 Colour as it would be used on the server or a client. | |
virtual NetworkRecvStatus | Receive_SERVER_CONSOLE (Packet *p) |
Send what would be printed on the server's console also into the admin network. | |
virtual NetworkRecvStatus | Receive_SERVER_CMD_NAMES (Packet *p) |
Send DoCommand names to the bot upon request only. | |
virtual NetworkRecvStatus | Receive_SERVER_CMD_LOGGING (Packet *p) |
Send incoming command packets to the admin network. | |
virtual NetworkRecvStatus | Receive_SERVER_PONG (Packet *p) |
Send a ping-reply (pong) to the admin that sent us the ping packet. | |
virtual NetworkRecvStatus | Receive_SERVER_RCON_END (Packet *p) |
Notify the admin connection that the rcon command has finished. | |
NetworkRecvStatus | HandlePacket (Packet *p) |
Handle the given packet, i.e. |
Additional Inherited Members | |
![]() | |
char | admin_name [NETWORK_CLIENT_NAME_LENGTH] |
Name of the admin. | |
char | admin_version [NETWORK_REVISION_LENGTH] |
Version string of the admin. | |
AdminStatus | status |
Status of this admin. |
Class for handling the server side of the game connection.
Definition at line 29 of file network_admin.h.
ServerNetworkAdminSocketHandler::ServerNetworkAdminSocketHandler | ( | SOCKET | s | ) |
Create a new socket for the server side of the admin network.
s | The socket to connect with. |
Definition at line 67 of file network_admin.cpp.
References _network_admins_connected, _realtime_tick, ADMIN_STATUS_INACTIVE, realtime_connect, and NetworkAdminSocketHandler::status.
Referenced by AcceptConnection().
|
static |
Handle the acception of a connection.
s | The socket of the new connection. |
address | The address of the peer. |
Definition at line 119 of file network_admin.cpp.
References address, and ServerNetworkAdminSocketHandler().
|
static |
Whether a connection is allowed or not at this moment.
Definition at line 88 of file network_admin.cpp.
References _network_admins_connected, _settings_client, NetworkSettings::admin_password, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkadminsocket_pool >::CanAllocateItem(), MAX_ADMINS, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::MAX_SIZE, ClientSettings::network, and StrEmpty().
|
inlinestatic |
Get the name used by the listener.
Definition at line 85 of file network_admin.h.
|
protectedvirtual |
Send chat as the server: uint8 Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction).
uint8 Destination type such as DESTTYPE_BROADCAST (see DestType). uint32 ID of the destination such as company or client id. string Message.
p | The packet that was just received. |
Reimplemented from NetworkAdminSocketHandler.
Definition at line 790 of file network_admin.cpp.
References _network_own_client_id, NetworkAdminSocketHandler::admin_name, ADMIN_STATUS_INACTIVE, NetworkAdminSocketHandler::admin_version, DEBUG, NETWORK_CHAT_LENGTH, NETWORK_RECV_STATUS_OKAY, NetworkServerSendChat(), Packet::Recv_string(), Packet::Recv_uint32(), Packet::Recv_uint8(), SendError(), and NetworkAdminSocketHandler::status.
|
protectedvirtual |
Send a JSON string to the current active GameScript.
json JSON string for the GameScript.
p | The packet that was just received. |
Reimplemented from NetworkAdminSocketHandler.
Definition at line 536 of file network_admin.cpp.
References NetworkAdminSocketHandler::admin_name, ADMIN_STATUS_INACTIVE, NetworkAdminSocketHandler::admin_version, DEBUG, NETWORK_GAMESCRIPT_JSON_LENGTH, NETWORK_RECV_STATUS_OKAY, Game::NewEvent(), Packet::Recv_string(), SendError(), and NetworkAdminSocketHandler::status.
|
protectedvirtual |
Join the admin network: string Password the server is expecting for this network.
string Name of the application being used to connect. string Version string of the application being used to connect.
p | The packet that was just received. |
Reimplemented from NetworkAdminSocketHandler.
Definition at line 670 of file network_admin.cpp.
References _settings_client, NetworkAdminSocketHandler::admin_name, NetworkSettings::admin_password, ADMIN_STATUS_ACTIVE, ADMIN_STATUS_INACTIVE, NetworkAdminSocketHandler::admin_version, DEBUG, ClientSettings::network, NETWORK_PASSWORD_LENGTH, Packet::Recv_string(), SendError(), SendProtocol(), NetworkAdminSocketHandler::status, and StrEmpty().
|
protectedvirtual |
Ping the server, requiring the server to reply with a pong packet.
uint32 Integer value to pass to the server, which is quoted in the reply.
p | The packet that was just received. |
Reimplemented from NetworkAdminSocketHandler.
Definition at line 550 of file network_admin.cpp.
References NetworkAdminSocketHandler::admin_name, ADMIN_STATUS_INACTIVE, NetworkAdminSocketHandler::admin_version, DEBUG, Packet::Recv_uint32(), SendError(), SendPong(), and NetworkAdminSocketHandler::status.
|
protectedvirtual |
Poll the server for certain updates, an invalid poll (e.g.
not existent id) gets silently dropped: uint8 AdminUpdateType the server should answer for, only if AdminUpdateFrequency ADMIN_FREQUENCY_POLL is advertised in the PROTOCOL packet. uint32 ID relevant to the packet type, e.g.
p | The packet that was just received. |
Reimplemented from NetworkAdminSocketHandler.
Definition at line 722 of file network_admin.cpp.
References NetworkAdminSocketHandler::admin_name, ADMIN_STATUS_INACTIVE, ADMIN_UPDATE_CLIENT_INFO, ADMIN_UPDATE_CMD_NAMES, ADMIN_UPDATE_COMPANY_ECONOMY, ADMIN_UPDATE_COMPANY_INFO, ADMIN_UPDATE_COMPANY_STATS, ADMIN_UPDATE_DATE, NetworkAdminSocketHandler::admin_version, CLIENT_ID_SERVER, DEBUG, FOR_ALL_CLIENT_SOCKETS, NetworkClientInfo::GetByClientID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkadminsocket_pool >::GetIfValid(), NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint32(), Packet::Recv_uint8(), SendClientInfo(), SendCmdNames(), SendCompanyEconomy(), SendCompanyInfo(), SendCompanyStats(), SendDate(), SendError(), and NetworkAdminSocketHandler::status.
|
protectedvirtual |
Notification to the server that this admin is quitting.
p | The packet that was just received. |
Reimplemented from NetworkAdminSocketHandler.
Definition at line 698 of file network_admin.cpp.
References NetworkAdminSocketHandler::CloseConnection().
|
protectedvirtual |
Execute a command on the servers console: string Command to be executed.
p | The packet that was just received. |
Reimplemented from NetworkAdminSocketHandler.
Definition at line 520 of file network_admin.cpp.
References _redirect_console_to_admin, NetworkAdminSocketHandler::admin_name, ADMIN_STATUS_INACTIVE, NetworkAdminSocketHandler::admin_version, DEBUG, IConsoleCmdExec(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_networkadminsocket_pool >::index, INVALID_ADMIN_ID, NETWORK_RCONCOMMAND_LENGTH, Packet::Recv_string(), SendError(), SendRconEnd(), and NetworkAdminSocketHandler::status.
|
protectedvirtual |
Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet): uint16 Update type (see AdminUpdateType).
uint16 Update frequency (see AdminUpdateFrequency), setting ADMIN_FREQUENCY_POLL is always ignored.
p | The packet that was just received. |
Reimplemented from NetworkAdminSocketHandler.
Definition at line 704 of file network_admin.cpp.
References _admin_update_type_frequencies, NetworkAdminSocketHandler::admin_name, ADMIN_STATUS_INACTIVE, ADMIN_UPDATE_END, NetworkAdminSocketHandler::admin_version, DEBUG, NETWORK_RECV_STATUS_OKAY, Packet::Recv_uint16(), SendError(), NetworkAdminSocketHandler::status, and update_frequency.
|
static |
Send the packets for the server sockets.
Definition at line 99 of file network_admin.cpp.
References _realtime_tick, ADMIN_AUTHORISATION_TIMEOUT, ADMIN_STATUS_INACTIVE, NetworkAdminSocketHandler::CloseConnection(), DEBUG, FOR_ALL_ADMIN_SOCKETS, realtime_connect, NetworkTCPSocketHandler::SendPackets(), NetworkAdminSocketHandler::status, and NetworkTCPSocketHandler::writable.
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendChat | ( | NetworkAction | action, |
DestType | desttype, | ||
ClientID | client_id, | ||
const char * | msg, | ||
int64 | data | ||
) |
Send a chat message.
action | The action associated with the message. |
desttype | The destination type. |
client_id | The origin of the chat message. |
msg | The actual message. |
data | Arbitrary extra data. |
Definition at line 476 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_CHAT, NETWORK_RECV_STATUS_OKAY, Packet::Send_string(), Packet::Send_uint32(), Packet::Send_uint64(), Packet::Send_uint8(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminChat().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientError | ( | ClientID | client_id, |
NetworkErrorCode | error | ||
) |
Tell the admin that a client made an error.
client_id | The client that made the error. |
error | The error that was made. |
Definition at line 292 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_ERROR, NETWORK_RECV_STATUS_OKAY, Packet::Send_uint32(), Packet::Send_uint8(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminClientError().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo | ( | const NetworkClientSocket * | cs, |
const NetworkClientInfo * | ci | ||
) |
Send an initial set of data from some client's information.
cs | The socket of the client. |
ci | The information about the client. |
Definition at line 236 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_INFO, NetworkClientInfo::client_id, NetworkClientInfo::client_lang, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, NetworkClientInfo::join_date, NETWORK_RECV_STATUS_OKAY, Packet::Send_string(), Packet::Send_uint32(), Packet::Send_uint8(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminClientInfo(), and Receive_ADMIN_POLL().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientJoin | ( | ClientID | client_id | ) |
Tell the admin that a client joined.
client_id | The client that joined. |
Definition at line 221 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_JOIN, NETWORK_RECV_STATUS_OKAY, Packet::Send_uint32(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminClientInfo().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientQuit | ( | ClientID | client_id | ) |
Tell the admin that a client quit.
client_id | The client that quit. |
Definition at line 277 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_QUIT, NETWORK_RECV_STATUS_OKAY, Packet::Send_uint32(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminClientQuit().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientUpdate | ( | const NetworkClientInfo * | ci | ) |
Send an update for some client's information.
ci | The information about a client. |
Definition at line 260 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_UPDATE, NetworkClientInfo::client_id, NetworkClientInfo::client_name, NetworkClientInfo::client_playas, NETWORK_RECV_STATUS_OKAY, Packet::Send_string(), Packet::Send_uint32(), Packet::Send_uint8(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminClientUpdate().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCmdLogging | ( | ClientID | client_id, |
const CommandPacket * | cp | ||
) |
Send a command for logging purposes.
client_id | The client executing the command. |
cp | The command that would be executed. |
Definition at line 648 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_CMD_LOGGING, CommandContainer::cmd, CMD_ID_MASK, CommandPacket::company, CommandPacket::frame, NETWORK_RECV_STATUS_OKAY, CommandContainer::p1, CommandContainer::p2, Packet::Send_string(), Packet::Send_uint16(), Packet::Send_uint32(), Packet::Send_uint8(), NetworkTCPSocketHandler::SendPacket(), CommandContainer::text, and CommandContainer::tile.
Referenced by NetworkAdminCmdLogging().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCmdNames | ( | ) |
Send the names of the commands.
Definition at line 614 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_CMD_NAMES, CMD_END, GetCommandName(), NETWORK_RECV_STATUS_OKAY, Packet::Send_bool(), SEND_MTU, Packet::Send_string(), Packet::Send_uint16(), NetworkTCPSocketHandler::SendPacket(), and Packet::size.
Referenced by Receive_ADMIN_POLL().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyEconomy | ( | ) |
Send economic information of all companies.
Definition at line 404 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_ECONOMY, CompanyEconomyEntry::company_value, CompanyProperties::cur_economy, CompanyProperties::current_loan, CompanyEconomyEntry::delivered_cargo, CargoArray::GetSum(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, lengthof, min(), CompanyProperties::money, NETWORK_RECV_STATUS_OKAY, CompanyProperties::old_economy, CompanyEconomyEntry::performance_history, Packet::Send_uint16(), Packet::Send_uint64(), Packet::Send_uint8(), NetworkTCPSocketHandler::SendPacket(), and CompanyProperties::yearly_expenses.
Referenced by NetworkAdminUpdate(), and Receive_ADMIN_POLL().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyInfo | ( | const Company * | c | ) |
Send the admin some information about a company.
c | The company to send the information about. |
Definition at line 321 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_INFO, CeilDiv(), CompanyProperties::colour, CompanyProperties::inaugurated_year, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, CompanyProperties::is_ai, lastof, lengthof, CompanyProperties::months_of_bankruptcy, NETWORK_COMPANY_NAME_LENGTH, NETWORK_RECV_STATUS_OKAY, NetworkCompanyIsPassworded(), Packet::Send_bool(), Packet::Send_string(), Packet::Send_uint32(), Packet::Send_uint8(), NetworkTCPSocketHandler::SendPacket(), SetDParam(), and CompanyProperties::share_owners.
Referenced by NetworkAdminCompanyInfo(), and Receive_ADMIN_POLL().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyNew | ( | CompanyID | company_id | ) |
Tell the admin that a new company was founded.
company_id | The company that was founded. |
Definition at line 307 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_NEW, NETWORK_RECV_STATUS_OKAY, Packet::Send_uint8(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminCompanyInfo().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyRemove | ( | CompanyID | company_id, |
AdminCompanyRemoveReason | acrr | ||
) |
Tell the admin that a company got removed.
company_id | The company that got removed. |
acrr | The reason for removal, e.g. bankruptcy or merger. |
Definition at line 391 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_REMOVE, NETWORK_RECV_STATUS_OKAY, Packet::Send_uint8(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminCompanyRemove().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyStats | ( | ) |
Send statistics about the companies.
Definition at line 439 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_STATS, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, MAX_COMPANIES, NETWORK_RECV_STATUS_OKAY, NetworkPopulateCompanyStats(), NetworkCompanyStats::num_station, NetworkCompanyStats::num_vehicle, Packet::Send_uint16(), Packet::Send_uint8(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminUpdate(), and Receive_ADMIN_POLL().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyUpdate | ( | const Company * | c | ) |
Send an update about a company.
c | The company to send the update of. |
Definition at line 357 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_UPDATE, CeilDiv(), CompanyProperties::colour, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, lastof, lengthof, CompanyProperties::months_of_bankruptcy, NETWORK_COMPANY_NAME_LENGTH, NETWORK_RECV_STATUS_OKAY, NetworkCompanyIsPassworded(), Packet::Send_bool(), Packet::Send_string(), Packet::Send_uint8(), NetworkTCPSocketHandler::SendPacket(), SetDParam(), and CompanyProperties::share_owners.
Referenced by NetworkAdminCompanyUpdate().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendConsole | ( | const char * | origin, |
const char * | string | ||
) |
Send console output of other clients.
origin | The origin of the string. |
string | The string that's put on the console. |
Definition at line 566 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_CONSOLE, NETWORK_RECV_STATUS_OKAY, SEND_MTU, Packet::Send_string(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminConsole().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendDate | ( | ) |
Tell the admin the date.
Definition at line 207 of file network_admin.cpp.
References _date, ADMIN_PACKET_SERVER_DATE, NETWORK_RECV_STATUS_OKAY, Packet::Send_uint32(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminUpdate(), and Receive_ADMIN_POLL().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendError | ( | NetworkErrorCode | error | ) |
Send an error to the admin.
error | The error to send. |
Definition at line 133 of file network_admin.cpp.
References NetworkAdminSocketHandler::admin_name, ADMIN_PACKET_SERVER_ERROR, NetworkAdminSocketHandler::admin_version, NetworkAdminSocketHandler::CloseConnection(), DEBUG, GetNetworkErrorMsg(), lastof, Packet::Send_uint8(), and NetworkTCPSocketHandler::SendPacket().
Referenced by Receive_ADMIN_CHAT(), Receive_ADMIN_GAMESCRIPT(), Receive_ADMIN_JOIN(), Receive_ADMIN_PING(), Receive_ADMIN_POLL(), Receive_ADMIN_RCON(), and Receive_ADMIN_UPDATE_FREQUENCY().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendGameScript | ( | const char * | json | ) |
Send GameScript JSON output.
json | The JSON string. |
Definition at line 587 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_GAMESCRIPT, NETWORK_GAMESCRIPT_JSON_LENGTH, NETWORK_RECV_STATUS_OKAY, Packet::Send_string(), and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkAdminGameScript().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendNewGame | ( | ) |
Tell the admin we started a new game.
Definition at line 191 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_NEWGAME, NETWORK_RECV_STATUS_OKAY, and NetworkTCPSocketHandler::SendPacket().
|
protected |
Send the protocol version to the admin.
Definition at line 150 of file network_admin.cpp.
References _admin_update_type_frequencies, ADMIN_PACKET_SERVER_PROTOCOL, ADMIN_UPDATE_END, NETWORK_GAME_ADMIN_VERSION, Packet::Send_bool(), Packet::Send_uint16(), Packet::Send_uint8(), NetworkTCPSocketHandler::SendPacket(), and SendWelcome().
Referenced by Receive_ADMIN_JOIN().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendRcon | ( | uint16 | colour, |
const char * | result | ||
) |
Send the reply of an rcon command.
colour | The colour of the text. |
result | The result of the command. |
Definition at line 509 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_RCON, NETWORK_RECV_STATUS_OKAY, Packet::Send_string(), Packet::Send_uint16(), and NetworkTCPSocketHandler::SendPacket().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendRconEnd | ( | const char * | command | ) |
Send a notification indicating the rcon command has completed.
command | The original command sent. |
Definition at line 494 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_RCON_END, NETWORK_RECV_STATUS_OKAY, Packet::Send_string(), and NetworkTCPSocketHandler::SendPacket().
Referenced by Receive_ADMIN_RCON().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendShutdown | ( | ) |
Tell the admin we're shutting down.
Definition at line 199 of file network_admin.cpp.
References ADMIN_PACKET_SERVER_SHUTDOWN, NETWORK_RECV_STATUS_OKAY, and NetworkTCPSocketHandler::SendPacket().
Referenced by NetworkDisconnect().
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendWelcome | ( | ) |
Send a welcome message to the admin.
Definition at line 170 of file network_admin.cpp.
References _network_dedicated, _network_game_info, _settings_client, _settings_game, ADMIN_PACKET_SERVER_WELCOME, ConvertYMDToDate(), GameSettings::game_creation, GameCreationSettings::generation_seed, GameCreationSettings::landscape, NetworkServerGameInfo::map_name, MapSizeX(), MapSizeY(), ClientSettings::network, NETWORK_RECV_STATUS_OKAY, Packet::Send_bool(), Packet::Send_string(), Packet::Send_uint16(), Packet::Send_uint32(), Packet::Send_uint8(), NetworkTCPSocketHandler::SendPacket(), NetworkSettings::server_name, and GameCreationSettings::starting_year.
Referenced by SendProtocol(), and WelcomeAll().