OpenTTD
|
Main socket handler for admin related connections. More...
#include <tcp_admin.h>
Public Member Functions | |
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. |
Protected Member Functions | |
NetworkRecvStatus | ReceiveInvalidPacket (PacketAdminType type) |
Helper for logging receiving invalid packets. | |
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. | |
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. |
Protected Attributes | |
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. |
Additional Inherited Members | |
![]() | |
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 114 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 34 of file tcp_admin.cpp.
References admin_name, admin_version, and NetworkTCPSocketHandler::sock.
|
virtual |
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.
error | Whether we quit under an error condition or not. |
Reimplemented from NetworkTCPSocketHandler.
Definition at line 45 of file tcp_admin.cpp.
References NETWORK_RECV_STATUS_CONN_LOST.
Referenced by HandlePacket(), NetworkClose(), ServerNetworkAdminSocketHandler::Receive_ADMIN_QUIT(), ServerNetworkAdminSocketHandler::Send(), and ServerNetworkAdminSocketHandler::SendError().
|
inline |
Get the status of the admin.
Definition at line 497 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 56 of file tcp_admin.cpp.
References admin_name, ADMIN_PACKET_ADMIN_CHAT, ADMIN_PACKET_ADMIN_GAMESCRIPT, ADMIN_PACKET_ADMIN_JOIN, ADMIN_PACKET_ADMIN_PING, ADMIN_PACKET_ADMIN_POLL, ADMIN_PACKET_ADMIN_QUIT, ADMIN_PACKET_ADMIN_RCON, ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY, 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_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(), INVALID_ADMIN_PACKET, NETWORK_RECV_STATUS_MALFORMED_PACKET, Receive_ADMIN_CHAT(), Receive_ADMIN_GAMESCRIPT(), Receive_ADMIN_JOIN(), Receive_ADMIN_PING(), Receive_ADMIN_POLL(), Receive_ADMIN_QUIT(), Receive_ADMIN_RCON(), Receive_ADMIN_UPDATE_FREQUENCY(), 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_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 |
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 in ServerNetworkAdminSocketHandler.
Definition at line 143 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_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 145 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_GAMESCRIPT, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
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 in ServerNetworkAdminSocketHandler.
Definition at line 139 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_JOIN, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
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 in ServerNetworkAdminSocketHandler.
Definition at line 146 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 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 in ServerNetworkAdminSocketHandler.
Definition at line 142 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 140 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 144 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 Update type (see AdminUpdateType).
uint16 Update frequency (see AdminUpdateFrequency), setting ADMIN_FREQUENCY_POLL is always ignored.
p | The packet that was just received. |
Reimplemented in ServerNetworkAdminSocketHandler.
Definition at line 141 of file tcp_admin.cpp.
References ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY, 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 149 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 Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction).
uint8 Destination type such as DESTTYPE_BROADCAST (see DestType). uint32 ID of the client who sent this message. string Message. uint64 Money (only when it is a 'give money' action).
p | The packet that was just received. |
Definition at line 168 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 ID of the client that made the error. uint8 Error the client made (see NetworkErrorCode).
p | The packet that was just received. |
Definition at line 161 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CLIENT_ERROR, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Client information of a specific client: uint32 ID of the client.
string Network address of the client. string Name of the client. uint8 Language of the client. uint32 Date the client joined the game. uint8 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_INFO, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notification of a new client: uint32 ID of the new client.
p | The packet that was just received. |
Definition at line 157 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 ID of the client that just left.
p | The packet that was just received. |
Definition at line 160 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 ID of the client. string Name of the client. uint8 ID of the company the client is playing as (255 for spectators).
p | The packet that was just received. |
Definition at line 159 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 ID of the client sending the command. uint8 ID of the company (0..MAX_COMPANIES-1). uint16 ID of the command. uint32 P1 (variable data passed to the command). uint32 P2 (variable data passed to the command). uint32 Tile where this is taking place. string Text passed to the command. uint32 Frame of execution.
p | The packet that was just received. |
Definition at line 172 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 ID of the DoCommand. string Name of DoCommand.
p | The packet that was just received. |
Definition at line 171 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CMD_NAMES, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Economy update of a specific company: uint8 ID of the company.
uint64 Money. uint64 Loan. uint64 Income. uint16 Delivered cargo (this quarter). uint64 Company value (last quarter). uint16 Performance (last quarter). uint16 Delivered cargo (last quarter). uint64 Company value (previous quarter). uint16 Performance (previous quarter). uint16 Delivered cargo (previous quarter).
p | The packet that was just received. |
Definition at line 166 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_ECONOMY, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Company information on a specific company: uint8 ID of the company.
string Name of the company. string Name of the companies manager. uint8 Main company colour. bool Company is password protected. uint32 Year the company was inaugurated. bool Company is an AI.
p | The packet that was just received. |
Definition at line 163 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_INFO, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Notification of a new company: uint8 ID of the new company.
p | The packet that was just received. |
Definition at line 162 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 ID of the company. uint8 Reason for being removed (see AdminCompanyRemoveReason).
p | The packet that was just received. |
Definition at line 165 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_REMOVE, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Company statistics on stations and vehicles: uint8 ID of the company.
uint16 Number of trains. uint16 Number of lorries. uint16 Number of busses. uint16 Number of planes. uint16 Number of ships. uint16 Number of train stations. uint16 Number of lorry stations. uint16 Number of bus stops. uint16 Number of airports and heliports. uint16 Number of harbours.
p | The packet that was just received. |
Definition at line 167 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_COMPANY_STATS, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Company information of a specific company: uint8 ID of the company.
string Name of the company. string Name of the companies manager. uint8 Main company colour. bool Company is password protected. uint8 Quarters of bankruptcy. uint8 Owner of share 1. uint8 Owner of share 2. uint8 Owner of share 3. uint8 Owner of share 4.
p | The packet that was just received. |
Definition at line 164 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 170 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_CONSOLE, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Send the current date of the game: uint32 Current game date.
p | The packet that was just received. |
Definition at line 156 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_DATE, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
An error was caused by this admin connection (connection gets closed).
uint8 NetworkErrorCode the error caused.
p | The packet that was just received. |
Definition at line 150 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 148 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 153 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 Integer identifier - should be the same as read from the admins ping packet.
p | The packet that was just received. |
Definition at line 174 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 Protocol version.
bool Further protocol data follows (repeats through all update packet types). uint16 Update packet type. uint16 Frequencies allowed for this update packet (bitwise).
p | The packet that was just received. |
Definition at line 151 of file tcp_admin.cpp.
References ADMIN_PACKET_SERVER_PROTOCOL, and ReceiveInvalidPacket().
Referenced by HandlePacket().
|
protectedvirtual |
Result of an rcon command: uint16 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 169 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 173 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 154 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 (e.g.
as advertised to master server). string OpenTTD version string. bool Server is dedicated. string Name of the Map. uint32 Random seed of the Map. uint8 Landscape of the Map. uint32 Start date of the Map. uint16 Map width. uint16 Map height.
p | The packet that was just received. |
Definition at line 152 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 133 of file tcp_admin.cpp.
References admin_name, admin_version, DEBUG, and NETWORK_RECV_STATUS_MALFORMED_PACKET.
Referenced by Receive_ADMIN_CHAT(), Receive_ADMIN_GAMESCRIPT(), Receive_ADMIN_JOIN(), Receive_ADMIN_PING(), Receive_ADMIN_POLL(), Receive_ADMIN_QUIT(), Receive_ADMIN_RCON(), Receive_ADMIN_UPDATE_FREQUENCY(), 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_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 117 of file tcp_admin.cpp.
References HandlePacket(), NETWORK_RECV_STATUS_OKAY, and NetworkTCPSocketHandler::ReceivePacket().