Public Member Functions | Protected Member Functions | Protected Attributes

# NetworkAdminSocketHandler Class Reference

Main socket handler for admin related connections. More...

`#include <tcp_admin.h>`

Inheritance diagram for NetworkAdminSocketHandler:

## 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.
## 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_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.
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.

## Detailed Description

Main socket handler for admin related connections.

Definition at line 111 of file tcp_admin.h.

## Constructor & Destructor Documentation

NetworkAdminSocketHandler::NetworkAdminSocketHandler | ( | SOCKET | s | ) |

Create the admin handler for the given socket.

Parameters:

  | s | The socket to communicate over.

Definition at line 32 of file tcp_admin.cpp.

References NetworkTCPSocketHandler::sock.

## Member Function Documentation

NetworkRecvStatus NetworkAdminSocketHandler::CloseConnection | ( | bool | error = `true` | ) | `[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.

Parameters:

  | error | Whether we quit under an error condition or not.

Returns:
  new status of the connection.

Reimplemented from NetworkTCPSocketHandler.

Definition at line 41 of file tcp_admin.cpp.

Referenced by HandlePacket(), NetworkClose(), ServerNetworkAdminSocketHandler::Send(), and ServerNetworkAdminSocketHandler::SendError().

AdminStatus NetworkAdminSocketHandler::GetAdminStatus | ( |  | ) | const`[inline]`

Get the status of the admin.

Returns:
  The status of the admin.

Definition at line 470 of file tcp_admin.h.

References status.

NetworkRecvStatus NetworkAdminSocketHandler::HandlePacket | ( | Packet * | p | ) | `[protected]`

Handle the given packet, i.e.

pass it to the right parser receive command.

Parameters:

  | p | the packet to handle.

Returns:
  NetworkRecvStatus of handling.

Definition at line 52 of file tcp_admin.cpp.

References admin_name, ADMIN_PACKET_ADMIN_CHAT, ADMIN_PACKET_ADMIN_GAMESCRIPT, ADMIN_PACKET_ADMIN_JOIN, 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_PROTOCOL, ADMIN_PACKET_SERVER_RCON, ADMIN_PACKET_SERVER_SHUTDOWN, ADMIN_PACKET_SERVER_WELCOME, admin_version, CloseConnection(), DEBUG, NetworkSocketHandler::HasClientQuit(), INVALID_ADMIN_PACKET, Receive_ADMIN_CHAT(), Receive_ADMIN_GAMESCRIPT(), Receive_ADMIN_JOIN(), 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_PROTOCOL(), Receive_SERVER_RCON(), Receive_SERVER_SHUTDOWN(), Receive_SERVER_WELCOME(), and Packet::Recv_uint8().

Referenced by ReceivePackets().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_CHAT | ( | Packet * | p | ) | `[protected, virtual]`

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.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 136 of file tcp_admin.cpp.

References ADMIN_PACKET_ADMIN_CHAT, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_GAMESCRIPT | ( | Packet * | p | ) | `[protected, virtual]`

Send a JSON string to the current active GameScript.

json JSON string for the GameScript.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 138 of file tcp_admin.cpp.

References ADMIN_PACKET_ADMIN_GAMESCRIPT, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_JOIN | ( | Packet * | p | ) | `[protected, virtual]`

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.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 132 of file tcp_admin.cpp.

References ADMIN_PACKET_ADMIN_JOIN, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_POLL | ( | Packet * | p | ) | `[protected, virtual]`

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.

- the client ID for ADMIN_UPDATE_CLIENT_INFO. Use UINT32_MAX to show all clients.
- the company ID for ADMIN_UPDATE_COMPANY_INFO. Use UINT32_MAX to show all companies.
  Parameters:

    | p | The packet that was just received.

  Returns:
    The state the network should have.

Definition at line 135 of file tcp_admin.cpp.

References ADMIN_PACKET_ADMIN_POLL, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_QUIT | ( | Packet * | p | ) | `[protected, virtual]`

Notification to the server that this admin is quitting.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 133 of file tcp_admin.cpp.

References ADMIN_PACKET_ADMIN_QUIT, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_RCON | ( | Packet * | p | ) | `[protected, virtual]`

Execute a command on the servers console: string Command to be executed.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 137 of file tcp_admin.cpp.

References ADMIN_PACKET_ADMIN_RCON, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_UPDATE_FREQUENCY | ( | Packet * | p | ) | `[protected, virtual]`

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.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 134 of file tcp_admin.cpp.

References ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_BANNED | ( | Packet * | p | ) | `[protected, virtual]`

The source IP address is banned (connection gets closed).

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 141 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_BANNED, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CHAT | ( | Packet * | p | ) | `[protected, virtual]`

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

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 160 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_CHAT, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_ERROR | ( | Packet * | p | ) | `[protected, virtual]`

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

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 153 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_CLIENT_ERROR, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_INFO | ( | Packet * | p | ) | `[protected, virtual]`

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

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 150 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_CLIENT_INFO, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_JOIN | ( | Packet * | p | ) | `[protected, virtual]`

Notification of a new client: uint32 ID of the new client.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 149 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_CLIENT_JOIN, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_QUIT | ( | Packet * | p | ) | `[protected, virtual]`

Notification about a client leaving the game.

uint32 ID of the client that just left.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 152 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_CLIENT_QUIT, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_UPDATE | ( | Packet * | p | ) | `[protected, virtual]`

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

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 151 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_CLIENT_UPDATE, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_LOGGING | ( | Packet * | p | ) | `[protected, virtual]`

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.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 164 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_CMD_LOGGING, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_NAMES | ( | Packet * | p | ) | `[protected, virtual]`

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.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 163 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_CMD_NAMES, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_ECONOMY | ( | Packet * | p | ) | `[protected, virtual]`

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

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 158 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_COMPANY_ECONOMY, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_INFO | ( | Packet * | p | ) | `[protected, virtual]`

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.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 155 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_COMPANY_INFO, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_NEW | ( | Packet * | p | ) | `[protected, virtual]`

Notification of a new company: uint8 ID of the new company.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 154 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_COMPANY_NEW, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_REMOVE | ( | Packet * | p | ) | `[protected, virtual]`

Notification about a removed company (e.g.

due to banrkuptcy). uint8 ID of the company. uint8 Reason for being removed (see AdminCompanyRemoveReason).

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 157 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_COMPANY_REMOVE, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_STATS | ( | Packet * | p | ) | `[protected, virtual]`

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.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 159 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_COMPANY_STATS, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_UPDATE | ( | Packet * | p | ) | `[protected, virtual]`

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.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 156 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_COMPANY_UPDATE, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CONSOLE | ( | Packet * | p | ) | `[protected, virtual]`

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.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 162 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_CONSOLE, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_DATE | ( | Packet * | p | ) | `[protected, virtual]`

Send the current date of the game: uint32 Current game date.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 148 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_DATE, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_ERROR | ( | Packet * | p | ) | `[protected, virtual]`

An error was caused by this admin connection (connection gets closed).

uint8 NetworkErrorCode the error caused.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 142 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_ERROR, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_FULL | ( | Packet * | p | ) | `[protected, virtual]`

The server is full (connection gets closed).

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 140 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_FULL, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_NEWGAME | ( | Packet * | p | ) | `[protected, virtual]`

Notification about a newgame.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 145 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_NEWGAME, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PROTOCOL | ( | Packet * | p | ) | `[protected, virtual]`

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

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 143 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_PROTOCOL, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON | ( | Packet * | p | ) | `[protected, virtual]`

Result of an rcon command: uint16 Colour as it would be used on the server or a client.

string Output of the executed command.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 161 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_RCON, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_SHUTDOWN | ( | Packet * | p | ) | `[protected, virtual]`

Notification about the server shutting down.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 146 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_SHUTDOWN, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_WELCOME | ( | Packet * | p | ) | `[protected, virtual]`

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.

Parameters:

  | p | The packet that was just received.

Returns:
  The state the network should have.

Definition at line 144 of file tcp_admin.cpp.

References ADMIN_PACKET_SERVER_WELCOME, and ReceiveInvalidPacket().

Referenced by HandlePacket().

NetworkRecvStatus NetworkAdminSocketHandler::ReceiveInvalidPacket | ( | PacketAdminType | type | ) | `[protected]`

Helper for logging receiving invalid packets.

Parameters:

  | type | The received packet type.

Returns:
  The status the network should have, in this case: "malformed packet error".

Definition at line 126 of file tcp_admin.cpp.

References admin_name, admin_version, and DEBUG.

Referenced by Receive_ADMIN_CHAT(), Receive_ADMIN_GAMESCRIPT(), Receive_ADMIN_JOIN(), 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_PROTOCOL(), Receive_SERVER_RCON(), 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.

Returns:
  NetworkRecvStatus of the last handled packet.

Definition at line 110 of file tcp_admin.cpp.

References HandlePacket(), NETWORK_RECV_STATUS_OKAY, and NetworkTCPSocketHandler::ReceivePacket().

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

- src/network/core/tcp_admin.h
- src/network/core/tcp_admin.cpp