OpenTTD Source
20240919-master-gdf0233f4c2
|
Go to the documentation of this file.
12 #include "../../stdafx.h"
14 #include "../network_internal.h"
16 #include "../../debug.h"
18 #include "../../safeguards.h"
115 std::unique_ptr<Packet> p;
virtual NetworkRecvStatus Receive_ADMIN_RCON(Packet &p)
Execute a command on the servers console: string Command to be executed.
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.
@ ADMIN_PACKET_SERVER_COMPANY_NEW
The server tells the admin that a new company has started.
@ NETWORK_RECV_STATUS_CLIENT_QUIT
The connection is lost gracefully. Other clients are already informed of this leaving client.
@ ADMIN_PACKET_SERVER_SHUTDOWN
The server tells the admin its shutting down.
std::string admin_version
Version string of the admin.
virtual NetworkRecvStatus Receive_ADMIN_PING(Packet &p)
Ping the server, requiring the server to reply with a pong packet.
NetworkRecvStatus CloseConnection(bool error=true) override
This will put this socket handler in a close state.
std::string admin_name
Name of the admin.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_ECONOMY(Packet &p)
Economy update of a specific company: uint8_t ID of the company.
virtual NetworkRecvStatus Receive_ADMIN_AUTH_RESPONSE(Packet &p)
Admin responds to ADMIN_PACKET_SERVER_AUTH_REQUEST with the appropriate data given the agreed upon Ne...
virtual NetworkRecvStatus Receive_SERVER_CLIENT_QUIT(Packet &p)
Notification about a client leaving the game.
@ ADMIN_PACKET_SERVER_PONG
The server replies to a ping request from the admin.
virtual NetworkRecvStatus Receive_SERVER_CMD_LOGGING(Packet &p)
Send incoming command packets to the admin network.
@ ADMIN_PACKET_SERVER_CMD_NAMES
The server sends out the names of the DoCommands to the admins.
virtual NetworkRecvStatus Receive_SERVER_SHUTDOWN(Packet &p)
Notification about the server shutting down.
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.
SOCKET sock
The socket currently connected to.
virtual NetworkRecvStatus Receive_ADMIN_JOIN_SECURE(Packet &p)
Join the admin network using a secure authentication method: string Name of the application being use...
@ ADMIN_PACKET_ADMIN_QUIT
The admin tells the server that it is quitting.
NetworkRecvStatus ReceivePackets()
Do the actual receiving of packets.
virtual NetworkRecvStatus Receive_SERVER_NEWGAME(Packet &p)
Notification about a newgame.
@ ADMIN_PACKET_SERVER_RCON_END
The server indicates that the remote console command has completed.
@ ADMIN_PACKET_SERVER_RCON
The server's reply to a remove console command.
@ ADMIN_PACKET_SERVER_NEWGAME
The server tells the admin its going to start a new game.
@ ADMIN_PACKET_SERVER_CMD_LOGGING
The server gives the admin copies of incoming command packets.
@ ADMIN_PACKET_SERVER_CLIENT_ERROR
The server tells the admin that a client caused an error.
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
@ ADMIN_PACKET_SERVER_PROTOCOL
The server tells the admin its protocol version.
@ ADMIN_PACKET_ADMIN_POLL
The admin explicitly polls for a piece of information.
@ ADMIN_PACKET_SERVER_CHAT
The server received a chat message and relays it.
@ ADMIN_STATUS_INACTIVE
The admin is not connected nor active.
@ ADMIN_PACKET_SERVER_COMPANY_ECONOMY
The server gives the admin some economy related company information.
virtual NetworkRecvStatus Receive_ADMIN_EXTERNAL_CHAT(Packet &p)
Send chat from the external source: string Name of the source this message came from.
@ ADMIN_PACKET_ADMIN_RCON
The admin sends a remote console command.
@ ADMIN_PACKET_ADMIN_CHAT
The admin sends a chat message to be distributed.
@ ADMIN_PACKET_ADMIN_JOIN
The admin announces and authenticates itself to the server using an unsecured passwords.
virtual NetworkRecvStatus Receive_SERVER_FULL(Packet &p)
The server is full (connection gets closed).
@ ADMIN_PACKET_SERVER_CLIENT_UPDATE
The server gives the admin an information update on a client.
virtual NetworkRecvStatus Receive_SERVER_CLIENT_ERROR(Packet &p)
Notification about a client error (and thus the clients disconnection).
virtual NetworkRecvStatus Receive_SERVER_BANNED(Packet &p)
The source IP address is banned (connection gets closed).
virtual NetworkRecvStatus Receive_SERVER_CONSOLE(Packet &p)
Send what would be printed on the server's console also into the admin network.
@ ADMIN_PACKET_ADMIN_AUTH_RESPONSE
The admin responds to the authentication request.
virtual NetworkRecvStatus Receive_SERVER_CLIENT_UPDATE(Packet &p)
Client update details on a specific client (e.g.
@ ADMIN_PACKET_SERVER_WELCOME
The server welcomes the admin to a game.
@ ADMIN_PACKET_SERVER_CONSOLE
The server gives the admin the data that got printed to its console.
@ ADMIN_PACKET_ADMIN_JOIN_SECURE
The admin announces and starts a secure authentication handshake.
@ CRR_BANKRUPT
The company went belly-up.
virtual NetworkRecvStatus Receive_ADMIN_JOIN(Packet &p)
Join the admin network using an unsecured password exchange: string Unsecured password the server is ...
@ ADMIN_PACKET_SERVER_CLIENT_JOIN
The server tells the admin that a client has joined.
@ ADMIN_PACKET_SERVER_CLIENT_INFO
The server gives the admin information about a client.
@ ADMIN_PACKET_SERVER_BANNED
The server tells the admin it is banned.
Internal entity of a packet.
@ ADMIN_PACKET_SERVER_DATE
The server tells the admin what the current game date is.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_STATS(Packet &p)
Company statistics on stations and vehicles: uint8_t ID of the company.
virtual NetworkRecvStatus Receive_ADMIN_UPDATE_FREQUENCY(Packet &p)
Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet): uint16_t Up...
@ ADMIN_PACKET_ADMIN_GAMESCRIPT
The admin sends a JSON string for the GameScript.
virtual NetworkRecvStatus Receive_SERVER_WELCOME(Packet &p)
Welcome a connected admin to the game: string Name of the Server.
virtual NetworkRecvStatus Receive_SERVER_CLIENT_INFO(Packet &p)
Client information of a specific client: uint32_t ID of the client.
@ ADMIN_CRR_AUTOCLEAN
The company is removed due to autoclean.
@ ADMIN_PACKET_SERVER_CLIENT_QUIT
The server tells the admin that a client quit.
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 (se...
virtual NetworkRecvStatus Receive_SERVER_PROTOCOL(Packet &p)
Inform a just joined admin about the protocol specifics: uint8_t Protocol version.
virtual NetworkRecvStatus Receive_SERVER_CMD_NAMES(Packet &p)
Send DoCommand names to the bot upon request only.
virtual NetworkRecvStatus Receive_SERVER_DATE(Packet &p)
Send the current date of the game: uint32_t Current game date.
bool HasClientQuit() const
Whether the current client connected to the socket has quit.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_INFO(Packet &p)
Company information on a specific company: uint8_t ID of the company.
@ ADMIN_CRR_MANUAL
The company is manually removed.
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 f...
virtual NetworkRecvStatus Receive_ADMIN_QUIT(Packet &p)
Notification to the server that this admin is quitting.
@ ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY
The admin tells the server the update frequency of a particular piece of information.
NetworkRecvStatus
Status of a network client; reasons why a client has quit.
virtual NetworkRecvStatus Receive_SERVER_AUTH_REQUEST(Packet &p)
Server requests authentication challenge from the admin.
virtual std::unique_ptr< Packet > ReceivePacket()
Receives a packet for the given client.
@ ADMIN_PACKET_SERVER_ENABLE_ENCRYPTION
The server tells that authentication has completed and requests to enable encryption with the keys of...
NetworkRecvStatus ReceiveInvalidPacket(PacketAdminType type)
Helper for logging receiving invalid packets.
virtual NetworkRecvStatus Receive_ADMIN_POLL(Packet &p)
Poll the server for certain updates, an invalid poll (e.g.
@ CRR_AUTOCLEAN
The company is removed due to autoclean.
@ ADMIN_PACKET_SERVER_FULL
The server tells the admin it cannot accept the admin.
@ ADMIN_PACKET_SERVER_COMPANY_STATS
The server gives the admin some statistics about a company.
PacketAdminType
Enum with types of TCP packets specific to the admin network.
@ ADMIN_CRR_END
Sentinel for end.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_REMOVE(Packet &p)
Notification about a removed company (e.g.
@ ADMIN_PACKET_SERVER_AUTH_REQUEST
The server gives the admin the used authentication method and required parameters.
@ CRR_END
Sentinel for end.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_NEW(Packet &p)
Notification of a new company: uint8_t ID of the new company.
@ ADMIN_PACKET_SERVER_ERROR
The server tells the admin an error has occurred.
@ NETWORK_RECV_STATUS_OKAY
Everything is okay.
virtual NetworkRecvStatus Receive_SERVER_CLIENT_JOIN(Packet &p)
Notification of a new client: uint32_t ID of the new client.
@ ADMIN_CRR_BANKRUPT
The company went belly-up.
@ ADMIN_PACKET_SERVER_COMPANY_REMOVE
The server tells the admin that a company was removed.
virtual NetworkRecvStatus Receive_SERVER_ERROR(Packet &p)
An error was caused by this admin connection (connection gets closed).
@ ADMIN_PACKET_SERVER_COMPANY_INFO
The server gives the admin information about a company.
virtual NetworkRecvStatus Receive_ADMIN_GAMESCRIPT(Packet &p)
Send a JSON string to the current active GameScript.
@ ADMIN_PACKET_SERVER_COMPANY_UPDATE
The server gives the admin an information update on a company.
virtual NetworkRecvStatus Receive_SERVER_PONG(Packet &p)
Send a ping-reply (pong) to the admin that sent us the ping packet.
@ ADMIN_PACKET_ADMIN_PING
The admin sends a ping to the server, expecting a ping-reply (PONG) packet.
@ CRR_MANUAL
The company is manually removed.
uint8_t Recv_uint8()
Read a 8 bits integer from the packet.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_UPDATE(Packet &p)
Company information of a specific company: uint8_t ID of the company.
@ ADMIN_PACKET_ADMIN_EXTERNAL_CHAT
The admin sends a chat message from external source.
virtual NetworkRecvStatus Receive_ADMIN_CHAT(Packet &p)
Send chat as the server: uint8_t Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction).
NetworkAdminSocketHandler(SOCKET s)
Create the admin handler for the given socket.
@ NETWORK_RECV_STATUS_MALFORMED_PACKET
We apparently send a malformed packet.