OpenTTD Source
20241121-master-g67a0fccfad
|
Main socket handler for admin related connections. More...
#include <tcp_admin.h>
Public Member Functions | |
NetworkRecvStatus | CloseConnection (bool error=true) override |
This will put this socket handler in a close state. More... | |
NetworkAdminSocketHandler (SOCKET s) | |
Create the admin handler for the given socket. More... | |
NetworkRecvStatus | ReceivePackets () |
Do the actual receiving of packets. More... | |
AdminStatus | GetAdminStatus () const |
Get the status of the admin. More... | |
Public Member Functions inherited from NetworkTCPSocketHandler | |
bool | IsConnected () const |
Whether this socket is currently bound to a socket. More... | |
void | CloseSocket () |
Close the actual socket of the connection. More... | |
virtual void | SendPacket (std::unique_ptr< Packet > &&packet) |
This function puts the packet in the send-queue and it is send as soon as possible. More... | |
SendPacketsState | SendPackets (bool closing_down=false) |
Sends all the buffered packets out for this client. More... | |
virtual std::unique_ptr< Packet > | ReceivePacket () |
Receives a packet for the given client. More... | |
bool | CanSendReceive () |
Check whether this socket can send or receive something. More... | |
bool | HasSendQueue () |
Whether there is something pending in the send queue. More... | |
NetworkTCPSocketHandler (SOCKET s=INVALID_SOCKET) | |
Construct a socket handler for a TCP connection. More... | |
Public Member Functions inherited from NetworkSocketHandler | |
NetworkSocketHandler () | |
Create a new unbound socket. | |
virtual | ~NetworkSocketHandler ()=default |
Close the socket when destructing the socket handler. | |
void | MarkClosed () |
Mark the connection as closed. More... | |
bool | HasClientQuit () const |
Whether the current client connected to the socket has quit. More... | |
void | Reopen () |
Reopen the socket so we can send/receive stuff again. | |
Protected Member Functions | |
NetworkRecvStatus | ReceiveInvalidPacket (PacketAdminType type) |
Helper for logging receiving invalid packets. More... | |
virtual NetworkRecvStatus | Receive_ADMIN_JOIN (Packet &p) |
Join the admin network using an unsecured password exchange: string Unsecured password the server is expecting for this network. More... | |
virtual NetworkRecvStatus | Receive_ADMIN_QUIT (Packet &p) |
Notification to the server that this admin is quitting. More... | |
virtual NetworkRecvStatus | Receive_ADMIN_UPDATE_FREQUENCY (Packet &p) |
Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet): uint16_t Update type (see AdminUpdateType). More... | |
virtual NetworkRecvStatus | Receive_ADMIN_POLL (Packet &p) |
Poll the server for certain updates, an invalid poll (e.g. More... | |
virtual NetworkRecvStatus | Receive_ADMIN_CHAT (Packet &p) |
Send chat as the server: uint8_t Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction). More... | |
virtual NetworkRecvStatus | Receive_ADMIN_EXTERNAL_CHAT (Packet &p) |
Send chat from the external source: string Name of the source this message came from. More... | |
virtual NetworkRecvStatus | Receive_ADMIN_RCON (Packet &p) |
Execute a command on the servers console: string Command to be executed. More... | |
virtual NetworkRecvStatus | Receive_ADMIN_GAMESCRIPT (Packet &p) |
Send a JSON string to the current active GameScript. More... | |
virtual NetworkRecvStatus | Receive_ADMIN_PING (Packet &p) |
Ping the server, requiring the server to reply with a pong packet. More... | |
virtual NetworkRecvStatus | Receive_ADMIN_JOIN_SECURE (Packet &p) |
Join the admin network using a secure authentication method: string Name of the application being used to connect. More... | |
virtual NetworkRecvStatus | Receive_ADMIN_AUTH_RESPONSE (Packet &p) |
Admin responds to ADMIN_PACKET_SERVER_AUTH_REQUEST with the appropriate data given the agreed upon NetworkAuthenticationMethod . More... | |
virtual NetworkRecvStatus | Receive_SERVER_FULL (Packet &p) |
The server is full (connection gets closed). More... | |
virtual NetworkRecvStatus | Receive_SERVER_BANNED (Packet &p) |
The source IP address is banned (connection gets closed). More... | |
virtual NetworkRecvStatus | Receive_SERVER_ERROR (Packet &p) |
An error was caused by this admin connection (connection gets closed). More... | |
virtual NetworkRecvStatus | Receive_SERVER_PROTOCOL (Packet &p) |
Inform a just joined admin about the protocol specifics: uint8_t Protocol version. More... | |
virtual NetworkRecvStatus | Receive_SERVER_WELCOME (Packet &p) |
Welcome a connected admin to the game: string Name of the Server. More... | |
virtual NetworkRecvStatus | Receive_SERVER_NEWGAME (Packet &p) |
Notification about a newgame. More... | |
virtual NetworkRecvStatus | Receive_SERVER_SHUTDOWN (Packet &p) |
Notification about the server shutting down. More... | |
virtual NetworkRecvStatus | Receive_SERVER_DATE (Packet &p) |
Send the current date of the game: uint32_t Current game date. More... | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_JOIN (Packet &p) |
Notification of a new client: uint32_t ID of the new client. More... | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_INFO (Packet &p) |
Client information of a specific client: uint32_t ID of the client. More... | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_UPDATE (Packet &p) |
Client update details on a specific client (e.g. More... | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_QUIT (Packet &p) |
Notification about a client leaving the game. More... | |
virtual NetworkRecvStatus | Receive_SERVER_CLIENT_ERROR (Packet &p) |
Notification about a client error (and thus the clients disconnection). More... | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_NEW (Packet &p) |
Notification of a new company: uint8_t ID of the new company. More... | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_INFO (Packet &p) |
Company information on a specific company: uint8_t ID of the company. More... | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_UPDATE (Packet &p) |
Company information of a specific company: uint8_t ID of the company. More... | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_REMOVE (Packet &p) |
Notification about a removed company (e.g. More... | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_ECONOMY (Packet &p) |
Economy update of a specific company: uint8_t ID of the company. More... | |
virtual NetworkRecvStatus | Receive_SERVER_COMPANY_STATS (Packet &p) |
Company statistics on stations and vehicles: uint8_t ID of the company. More... | |
virtual NetworkRecvStatus | Receive_SERVER_CHAT (Packet &p) |
Send chat from the game into the admin network: uint8_t Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction). More... | |
virtual NetworkRecvStatus | Receive_SERVER_RCON (Packet &p) |
Result of an rcon command: uint16_t Colour as it would be used on the server or a client. More... | |
virtual NetworkRecvStatus | Receive_SERVER_CONSOLE (Packet &p) |
Send what would be printed on the server's console also into the admin network. More... | |
virtual NetworkRecvStatus | Receive_SERVER_CMD_NAMES (Packet &p) |
Send DoCommand names to the bot upon request only. More... | |
virtual NetworkRecvStatus | Receive_SERVER_CMD_LOGGING (Packet &p) |
Send incoming command packets to the admin network. More... | |
virtual NetworkRecvStatus | Receive_SERVER_AUTH_REQUEST (Packet &p) |
Server requests authentication challenge from the admin. More... | |
virtual NetworkRecvStatus | Receive_SERVER_ENABLE_ENCRYPTION (Packet &p) |
Indication to the client that authentication is complete and encryption has to be used from here on forward. More... | |
virtual NetworkRecvStatus | Receive_SERVER_PONG (Packet &p) |
Send a ping-reply (pong) to the admin that sent us the ping packet. More... | |
virtual NetworkRecvStatus | Receive_SERVER_RCON_END (Packet &p) |
Notify the admin connection that the rcon command has finished. More... | |
NetworkRecvStatus | HandlePacket (Packet &p) |
Handle the given packet, i.e. More... | |
Protected Attributes | |
std::string | admin_name |
Name of the admin. | |
std::string | admin_version |
Version string of the admin. | |
AdminStatus | status |
Status of this admin. | |
Protected Attributes inherited from NetworkSocketHandler | |
std::unique_ptr< class NetworkEncryptionHandler > | receive_encryption_handler |
The handler for decrypting received packets. | |
std::unique_ptr< class NetworkEncryptionHandler > | send_encryption_handler |
The handler for encrypting sent packets. | |
Additional Inherited Members | |
Data Fields inherited from NetworkTCPSocketHandler | |
SOCKET | sock |
The socket currently connected to. | |
bool | writable |
Can we write to this socket? | |
Main socket handler for admin related connections.
Definition at line 117 of file tcp_admin.h.
NetworkAdminSocketHandler::NetworkAdminSocketHandler | ( | SOCKET | s | ) |
Create the admin handler for the given socket.
s | The socket to communicate over. |
Definition at line 30 of file tcp_admin.cpp.
References NetworkTCPSocketHandler::sock.
|
overridevirtual |
This will put this socket handler in a close state.
It will not actually close the OS socket; use CloseSocket for this.
error | Whether we quit under an error condition or not. |
Reimplemented from NetworkTCPSocketHandler.
Definition at line 35 of file tcp_admin.cpp.
References NETWORK_RECV_STATUS_CLIENT_QUIT.
Referenced by HandlePacket(), ServerNetworkAdminSocketHandler::Receive_ADMIN_QUIT(), and ServerNetworkAdminSocketHandler::SendError().
|
inline |
Get the status of the admin.
Definition at line 553 of file tcp_admin.h.
References status.
|
protected |
Handle the given packet, i.e.
pass it to the right parser receive command.
p | the packet to handle. |
Definition at line 46 of file tcp_admin.cpp.
References admin_name, ADMIN_PACKET_ADMIN_AUTH_RESPONSE, ADMIN_PACKET_ADMIN_CHAT, ADMIN_PACKET_ADMIN_EXTERNAL_CHAT, ADMIN_PACKET_ADMIN_GAMESCRIPT, ADMIN_PACKET_ADMIN_JOIN, ADMIN_PACKET_ADMIN_JOIN_SECURE, ADMIN_PACKET_ADMIN_PING, ADMIN_PACKET_ADMIN_POLL, ADMIN_PACKET_ADMIN_QUIT, ADMIN_PACKET_ADMIN_RCON, ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY, ADMIN_PACKET_SERVER_AUTH_REQUEST, ADMIN_PACKET_SERVER_BANNED, ADMIN_PACKET_SERVER_CHAT, ADMIN_PACKET_SERVER_CLIENT_ERROR, ADMIN_PACKET_SERVER_CLIENT_INFO, ADMIN_PACKET_SERVER_CLIENT_JOIN, ADMIN_PACKET_SERVER_CLIENT_QUIT, ADMIN_PACKET_SERVER_CLIENT_UPDATE, ADMIN_PACKET_SERVER_CMD_LOGGING, ADMIN_PACKET_SERVER_CMD_NAMES, ADMIN_PACKET_SERVER_COMPANY_ECONOMY, ADMIN_PACKET_SERVER_COMPANY_INFO, ADMIN_PACKET_SERVER_COMPANY_NEW, ADMIN_PACKET_SERVER_COMPANY_REMOVE, ADMIN_PACKET_SERVER_COMPANY_STATS, ADMIN_PACKET_SERVER_COMPANY_UPDATE, ADMIN_PACKET_SERVER_CONSOLE, ADMIN_PACKET_SERVER_DATE, ADMIN_PACKET_SERVER_ENABLE_ENCRYPTION, ADMIN_PACKET_SERVER_ERROR, ADMIN_PACKET_SERVER_FULL, ADMIN_PACKET_SERVER_NEWGAME, ADMIN_PACKET_SERVER_PONG, ADMIN_PACKET_SERVER_PROTOCOL, ADMIN_PACKET_SERVER_RCON, ADMIN_PACKET_SERVER_RCON_END, ADMIN_PACKET_SERVER_SHUTDOWN, ADMIN_PACKET_SERVER_WELCOME, admin_version, CloseConnection(), Debug, NetworkSocketHandler::HasClientQuit(), NETWORK_RECV_STATUS_MALFORMED_PACKET, Receive_ADMIN_AUTH_RESPONSE(), Receive_ADMIN_CHAT(), Receive_ADMIN_EXTERNAL_CHAT(), Receive_ADMIN_GAMESCRIPT(), Receive_ADMIN_JOIN(), Receive_ADMIN_JOIN_SECURE(), Receive_ADMIN_PING(), Receive_ADMIN_POLL(), Receive_ADMIN_QUIT(), Receive_ADMIN_RCON(), Receive_ADMIN_UPDATE_FREQUENCY(), Receive_SERVER_AUTH_REQUEST(), Receive_SERVER_BANNED(), Receive_SERVER_CHAT(), Receive_SERVER_CLIENT_ERROR(), Receive_SERVER_CLIENT_INFO(), Receive_SERVER_CLIENT_JOIN(), Receive_SERVER_CLIENT_QUIT(), Receive_SERVER_CLIENT_UPDATE(), Receive_SERVER_CMD_LOGGING(), Receive_SERVER_CMD_NAMES(), Receive_SERVER_COMPANY_ECONOMY(), Receive_SERVER_COMPANY_INFO(), Receive_SERVER_COMPANY_NEW(), Receive_SERVER_COMPANY_REMOVE(), Receive_SERVER_COMPANY_STATS(), Receive_SERVER_COMPANY_UPDATE(), Receive_SERVER_CONSOLE(), Receive_SERVER_DATE(), Receive_SERVER_ENABLE_ENCRYPTION(), Receive_SERVER_ERROR(), Receive_SERVER_FULL(), Receive_SERVER_NEWGAME(), Receive_SERVER_PONG(), Receive_SERVER_PROTOCOL(), Receive_SERVER_RCON(), Receive_SERVER_RCON_END(), Receive_SERVER_SHUTDOWN(), Receive_SERVER_WELCOME(), and Packet::Recv_uint8().
Referenced by ReceivePackets().
|
protectedvirtual |
Admin responds to ADMIN_PACKET_SERVER_AUTH_REQUEST
with the appropriate data given the agreed upon NetworkAuthenticationMethod
.
With NETWORK_AUTH_METHOD_X25519_PAKE
and NETWORK_AUTH_METHOD_X25519_AUTHORIZED_KEY:
32 * uint8_t Public key of the client. 16 * uint8_t Message authentication code (mac). 8 * uint8_t Encrypted message of the authentication (just random bytes).
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 145 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_AUTH_RESPONSE, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Send chat as the server: uint8_t Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction).
uint8_t Destination type such as DESTTYPE_BROADCAST (see DestType). uint32_t ID of the destination such as company or client id. string Message.
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 139 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_CHAT, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Send chat from the external source: string Name of the source this message came from.
uint16_t TextColour to use for the message. string Name of the user who sent the messsage. string Message.
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 140 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_EXTERNAL_CHAT, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Send a JSON string to the current active GameScript.
json JSON string for the GameScript.
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 142 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_GAMESCRIPT, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Join the admin network using an unsecured password exchange: string Unsecured 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 in ServerNetworkAdminSocketHandler.
Definition at line 135 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_JOIN, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Join the admin network using a secure authentication method: string Name of the application being used to connect.
string Version string of the application being used to connect. uint16_t Bitmask of supported authentication methods. See NetworkAuthenticationMethod
for the supported methods.
The server will determine which of the authentication methods supplied by the client will be used. When there is no supported authentication method, an ADMIN_PACKET_SERVER_ERROR
packet will be sent with NETWORK_ERROR_NO_AUTHENTICATION_METHOD_AVAILABLE
as error.
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 144 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_JOIN_SECURE, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Ping the server, requiring the server to reply with a pong packet.
uint32_t Integer value to pass to the server, which is quoted in the reply.
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 143 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_PING, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Poll the server for certain updates, an invalid poll (e.g.
not existent id) gets silently dropped: uint8_t AdminUpdateType the server should answer for, only if AdminUpdateFrequency ADMIN_FREQUENCY_POLL is advertised in the PROTOCOL packet. Note integer type - see "Certain Packet Information" in docs/admin_network.md. uint32_t ID relevant to the packet type, e.g.
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 138 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_POLL, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notification to the server that this admin is quitting.
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 136 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_QUIT, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Execute a command on the servers console: string Command to be executed.
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 141 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_RCON, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet): uint16_t Update type (see AdminUpdateType).
Note integer type - see "Certain Packet Information" in docs/admin_network.md. uint16_t Update frequency (see AdminUpdateFrequency), setting ADMIN_FREQUENCY_POLL is always ignored.
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 137 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Server requests authentication challenge from the admin.
uint8_t The chosen authentication method from NetworkAuthenticationMethod
. With NETWORK_AUTH_METHOD_X25519_PAKE
and NETWORK_AUTH_METHOD_X25519_AUTHORIZED_KEY:
32 * uint8_t Public key of the server. 24 * uint8_t Nonce to use for the encryption.
p | The packet that was just received. |
Definition at line 174 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_AUTH_REQUEST, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
The source IP address is banned (connection gets closed).
p | The packet that was just received. |
Definition at line 148 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_BANNED, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Send chat from the game into the admin network: uint8_t Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction).
uint8_t Destination type such as DESTTYPE_BROADCAST (see DestType). uint32_t ID of the client who sent this message. string Message. uint64_t Money (only when it is a 'give money' action).
p | The packet that was just received. |
Definition at line 167 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CHAT, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notification about a client error (and thus the clients disconnection).
uint32_t ID of the client that made the error. uint8_t Error the client made (see NetworkErrorCode).
p | The packet that was just received. |
Definition at line 160 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_ERROR, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Client information of a specific client: uint32_t ID of the client.
string Network address of the client. string Name of the client. uint8_t Language of the client. uint32_t Date the client joined the game. uint8_t ID of the company the client is playing as (255 for spectators).
p | The packet that was just received. |
Definition at line 157 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_INFO, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notification of a new client: uint32_t ID of the new client.
p | The packet that was just received. |
Definition at line 156 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_JOIN, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notification about a client leaving the game.
uint32_t ID of the client that just left.
p | The packet that was just received. |
Definition at line 159 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_QUIT, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Client update details on a specific client (e.g.
after rename or move): uint32_t ID of the client. string Name of the client. uint8_t ID of the company the client is playing as (255 for spectators).
p | The packet that was just received. |
Definition at line 158 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_UPDATE, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Send incoming command packets to the admin network.
This is for logging purposes only.
NOTICE: Data provided with this packet is not stable and will not be treated as such. Do not rely on IDs or names to be constant across different versions / revisions of OpenTTD. Data provided in this packet is for logging purposes only.
uint32_t ID of the client sending the command. uint8_t ID of the company (0..MAX_COMPANIES-1). uint16_t ID of the command. Command specific buffer with encoded parameters of variable length. The content differs per command and can change without notification. uint32_t Frame of execution.
p | The packet that was just received. |
Definition at line 171 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CMD_LOGGING, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Send DoCommand names to the bot upon request only.
Multiple of these packets can follow each other in order to provide all known DoCommand names.
NOTICE: Data provided with this packet is not stable and will not be treated as such. Do not rely on IDs or names to be constant across different versions / revisions of OpenTTD. Data provided in this packet is for logging purposes only.
These three fields are repeated until the packet is full: bool Data to follow. uint16_t ID of the DoCommand. string Name of DoCommand.
p | The packet that was just received. |
Definition at line 170 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CMD_NAMES, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Economy update of a specific company: uint8_t ID of the company.
uint64_t Money. uint64_t Loan. int64_t Income. uint16_t Delivered cargo (this quarter). uint64_t Company value (last quarter). uint16_t Performance (last quarter). uint16_t Delivered cargo (last quarter). uint64_t Company value (previous quarter). uint16_t Performance (previous quarter). uint16_t Delivered cargo (previous quarter).
p | The packet that was just received. |
Definition at line 165 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_ECONOMY, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Company information on a specific company: uint8_t ID of the company.
string Name of the company. string Name of the companies manager. uint8_t Main company colour. bool Company is protected. uint32_t Year the company was inaugurated. bool Company is an AI.
p | The packet that was just received. |
Definition at line 162 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_INFO, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notification of a new company: uint8_t ID of the new company.
p | The packet that was just received. |
Definition at line 161 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_NEW, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notification about a removed company (e.g.
due to bankruptcy). uint8_t ID of the company. uint8_t Reason for being removed (see AdminCompanyRemoveReason).
p | The packet that was just received. |
Definition at line 164 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_REMOVE, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Company statistics on stations and vehicles: uint8_t ID of the company.
uint16_t Number of trains. uint16_t Number of lorries. uint16_t Number of busses. uint16_t Number of planes. uint16_t Number of ships. uint16_t Number of train stations. uint16_t Number of lorry stations. uint16_t Number of bus stops. uint16_t Number of airports and heliports. uint16_t Number of harbours.
p | The packet that was just received. |
Definition at line 166 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_STATS, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Company information of a specific company: uint8_t ID of the company.
string Name of the company. string Name of the companies manager. uint8_t Main company colour. bool Company is protected. uint8_t Quarters of bankruptcy. uint8_t Owner of share 1. uint8_t Owner of share 2. uint8_t Owner of share 3. uint8_t Owner of share 4.
p | The packet that was just received. |
Definition at line 163 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_UPDATE, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Send what would be printed on the server's console also into the admin network.
string The origin of the text, e.g. "console" for console, or "net" for network related (debug) messages. string Text as found on the console of the server.
p | The packet that was just received. |
Definition at line 169 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CONSOLE, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Send the current date of the game: uint32_t Current game date.
p | The packet that was just received. |
Definition at line 155 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_DATE, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Indication to the client that authentication is complete and encryption has to be used from here on forward.
The encryption uses the shared keys generated by the last AUTH_REQUEST key exchange. 24 * uint8_t Nonce for encrypted connection.
p | The packet that was just received. |
Definition at line 175 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_ENABLE_ENCRYPTION, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
An error was caused by this admin connection (connection gets closed).
uint8_t NetworkErrorCode the error caused.
p | The packet that was just received. |
Definition at line 149 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_ERROR, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
The server is full (connection gets closed).
p | The packet that was just received. |
Definition at line 147 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_FULL, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notification about a newgame.
p | The packet that was just received. |
Definition at line 152 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_NEWGAME, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Send a ping-reply (pong) to the admin that sent us the ping packet.
uint32_t Integer identifier - should be the same as read from the admins ping packet.
p | The packet that was just received. |
Definition at line 173 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_PONG, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Inform a just joined admin about the protocol specifics: uint8_t Protocol version.
bool Further protocol data follows (repeats through all update packet types). uint16_t Update packet type. uint16_t Frequencies allowed for this update packet (bitwise).
p | The packet that was just received. |
Definition at line 150 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_PROTOCOL, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Result of an rcon command: uint16_t Colour as it would be used on the server or a client.
string Output of the executed command.
p | The packet that was just received. |
Definition at line 168 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_RCON, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notify the admin connection that the rcon command has finished.
string The command as requested by the admin connection.
p | The packet that was just received. |
Definition at line 172 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_RCON_END, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notification about the server shutting down.
p | The packet that was just received. |
Definition at line 153 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_SHUTDOWN, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Welcome a connected admin to the game: string Name of the Server.
string OpenTTD version string. bool Server is dedicated. string Name of the Map. uint32_t Random seed of the Map. uint8_t Landscape of the Map. uint32_t Start date of the Map. uint16_t Map width. uint16_t Map height.
p | The packet that was just received. |
Definition at line 151 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_WELCOME, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protected |
Helper for logging receiving invalid packets.
type | The received packet type. |
Definition at line 129 of file tcp_admin.cpp.
References admin_name, admin_version, Debug, and NETWORK_RECV_STATUS_MALFORMED_PACKET.
Referenced by Receive_ADMIN_AUTH_RESPONSE(), Receive_ADMIN_CHAT(), Receive_ADMIN_EXTERNAL_CHAT(), Receive_ADMIN_GAMESCRIPT(), Receive_ADMIN_JOIN(), Receive_ADMIN_JOIN_SECURE(), Receive_ADMIN_PING(), Receive_ADMIN_POLL(), Receive_ADMIN_QUIT(), Receive_ADMIN_RCON(), Receive_ADMIN_UPDATE_FREQUENCY(), Receive_SERVER_AUTH_REQUEST(), Receive_SERVER_BANNED(), Receive_SERVER_CHAT(), Receive_SERVER_CLIENT_ERROR(), Receive_SERVER_CLIENT_INFO(), Receive_SERVER_CLIENT_JOIN(), Receive_SERVER_CLIENT_QUIT(), Receive_SERVER_CLIENT_UPDATE(), Receive_SERVER_CMD_LOGGING(), Receive_SERVER_CMD_NAMES(), Receive_SERVER_COMPANY_ECONOMY(), Receive_SERVER_COMPANY_INFO(), Receive_SERVER_COMPANY_NEW(), Receive_SERVER_COMPANY_REMOVE(), Receive_SERVER_COMPANY_STATS(), Receive_SERVER_COMPANY_UPDATE(), Receive_SERVER_CONSOLE(), Receive_SERVER_DATE(), Receive_SERVER_ENABLE_ENCRYPTION(), Receive_SERVER_ERROR(), Receive_SERVER_FULL(), Receive_SERVER_NEWGAME(), Receive_SERVER_PONG(), Receive_SERVER_PROTOCOL(), Receive_SERVER_RCON(), Receive_SERVER_RCON_END(), Receive_SERVER_SHUTDOWN(), and Receive_SERVER_WELCOME().
NetworkRecvStatus NetworkAdminSocketHandler::ReceivePackets | ( | ) |
Do the actual receiving of packets.
As long as HandlePacket returns OKAY packets are handled. Upon failure, or no more packets to process the last result of HandlePacket is returned.
Definition at line 113 of file tcp_admin.cpp.
References HandlePacket(), NETWORK_RECV_STATUS_OKAY, and NetworkTCPSocketHandler::ReceivePacket().