OpenTTD Source 20260421-master-gc2fbc6fdeb
tcp_admin.h File Reference

Basic functions to receive and send TCP packets to and from the admin network. More...

#include "os_abstraction.h"
#include "tcp.h"
#include "../network_type.h"

Go to the source code of this file.

Data Structures

struct  IsEnumPacketType< PacketAdminType >
 Mark PacketAdminType as a PacketType. More...
class  NetworkAdminSocketHandler
 Main socket handler for admin related connections. More...

Typedefs

using AdminUpdateFrequencies = EnumBitSet<AdminUpdateFrequency, uint8_t>
 Bitset of chosen update frequencies.

Enumerations

enum class  PacketAdminType : uint8_t {
  AdminJoin , AdminQuit , AdminUpdateFrequency , AdminPoll ,
  AdminChat , AdminRemoteConsoleCommand , AdminGameScript , AdminPing ,
  AdminExternalChat , AdminJoinSecure , AdminAuthenticationResponse , ServerFull = 100 ,
  ServerBanned , ServerError , ServerProtocol , ServerWelcome ,
  ServerNewGame , ServerShutdown , ServerDate , ServerClientJoin ,
  ServerClientInfo , ServerClientUpdate , ServerClientQuit , ServerClientError ,
  ServerCompanyNew , ServerCompanyInfo , ServerCompanyUpdate , ServerCompanyRemove ,
  ServerCompanyEconomy , ServerCompanyStatistics , ServerChat , ServerRemoteConsoleCommand ,
  ServerConsole , ServerCommandNames , ServerCommandLoggingOld , ServerGameScript ,
  ServerRemoteConsoleCommandEnd , ServerPong , ServerCommandLogging , ServerAuthenticationRequest ,
  ServerEnableEncryption
}
 Enum with types of TCP packets specific to the admin network. More...
enum  AdminStatus : uint8_t { ADMIN_STATUS_INACTIVE , ADMIN_STATUS_AUTHENTICATE , ADMIN_STATUS_ACTIVE , ADMIN_STATUS_END }
 Status of an admin. More...
enum  AdminUpdateType : uint8_t {
  ADMIN_UPDATE_DATE , ADMIN_UPDATE_CLIENT_INFO , ADMIN_UPDATE_COMPANY_INFO , ADMIN_UPDATE_COMPANY_ECONOMY ,
  ADMIN_UPDATE_COMPANY_STATS , ADMIN_UPDATE_CHAT , ADMIN_UPDATE_CONSOLE , ADMIN_UPDATE_CMD_NAMES ,
  ADMIN_UPDATE_CMD_LOGGING , ADMIN_UPDATE_GAMESCRIPT , ADMIN_UPDATE_END
}
 Update types an admin can register a frequency for. More...
enum class  AdminUpdateFrequency : uint8_t {
  Poll , Daily , Weekly , Monthly ,
  Quarterly , Annually , Automatic
}
 Update frequencies an admin can register. More...
enum  AdminCompanyRemoveReason : uint8_t { ADMIN_CRR_MANUAL , ADMIN_CRR_AUTOCLEAN , ADMIN_CRR_BANKRUPT , ADMIN_CRR_END }
 Reasons for removing a company - communicated to admins. More...

Detailed Description

Basic functions to receive and send TCP packets to and from the admin network.

Definition in file tcp_admin.h.

Typedef Documentation

◆ AdminUpdateFrequencies

Bitset of chosen update frequencies.

Definition at line 105 of file tcp_admin.h.

Enumeration Type Documentation

◆ AdminCompanyRemoveReason

enum AdminCompanyRemoveReason : uint8_t

Reasons for removing a company - communicated to admins.

Enumerator
ADMIN_CRR_MANUAL 

The company is manually removed.

ADMIN_CRR_AUTOCLEAN 

The company is removed due to autoclean.

ADMIN_CRR_BANKRUPT 

The company went belly-up.

ADMIN_CRR_END 

Sentinel for end.

Definition at line 108 of file tcp_admin.h.

◆ AdminStatus

enum AdminStatus : uint8_t

Status of an admin.

Enumerator
ADMIN_STATUS_INACTIVE 

The admin is not connected nor active.

ADMIN_STATUS_AUTHENTICATE 

The admin is connected and working on authentication.

ADMIN_STATUS_ACTIVE 

The admin is active.

ADMIN_STATUS_END 

Must ALWAYS be on the end of this list!! (period).

Definition at line 73 of file tcp_admin.h.

◆ AdminUpdateFrequency

enum class AdminUpdateFrequency : uint8_t
strong

Update frequencies an admin can register.

Enumerator
Poll 

The admin can poll this.

Daily 

The admin gets information about this on a daily basis.

Weekly 

The admin gets information about this on a weekly basis.

Monthly 

The admin gets information about this on a monthly basis.

Quarterly 

The admin gets information about this on a quarterly basis.

Annually 

The admin gets information about this on a yearly basis.

Automatic 

The admin gets information about this when it changes.

Definition at line 96 of file tcp_admin.h.

◆ AdminUpdateType

enum AdminUpdateType : uint8_t

Update types an admin can register a frequency for.

Enumerator
ADMIN_UPDATE_DATE 

Updates about the date of the game.

ADMIN_UPDATE_CLIENT_INFO 

Updates about the information of clients.

ADMIN_UPDATE_COMPANY_INFO 

Updates about the generic information of companies.

ADMIN_UPDATE_COMPANY_ECONOMY 

Updates about the economy of companies.

ADMIN_UPDATE_COMPANY_STATS 

Updates about the statistics of companies.

ADMIN_UPDATE_CHAT 

The admin would like to have chat messages.

ADMIN_UPDATE_CONSOLE 

The admin would like to have console messages.

ADMIN_UPDATE_CMD_NAMES 

The admin would like a list of all DoCommand names.

ADMIN_UPDATE_CMD_LOGGING 

The admin would like to have DoCommand information.

ADMIN_UPDATE_GAMESCRIPT 

The admin would like to have gamescript messages.

ADMIN_UPDATE_END 

Must ALWAYS be on the end of this list!! (period).

Definition at line 81 of file tcp_admin.h.

◆ PacketAdminType

enum class PacketAdminType : uint8_t
strong

Enum with types of TCP packets specific to the admin network.

This protocol may only be extended to ensure stability.

Attention
The order MUST not be changed.
Enumerator
AdminJoin 

The admin announces and authenticates itself to the server using an unsecured passwords.

AdminQuit 

The admin tells the server that it is quitting.

AdminUpdateFrequency 

The admin tells the server the update frequency of a particular piece of information.

AdminPoll 

The admin explicitly polls for a piece of information.

AdminChat 

The admin sends a chat message to be distributed.

AdminRemoteConsoleCommand 

The admin sends a remote console command.

AdminGameScript 

The admin sends a JSON string for the GameScript.

AdminPing 

The admin sends a ping to the server, expecting a ping-reply (PONG) packet.

AdminExternalChat 

The admin sends a chat message from external source.

AdminJoinSecure 

The admin announces and starts a secure authentication handshake.

AdminAuthenticationResponse 

The admin responds to the authentication request.

ServerFull 

The server tells the admin it cannot accept the admin.

ServerBanned 

The server tells the admin it is banned.

ServerError 

The server tells the admin an error has occurred.

ServerProtocol 

The server tells the admin its protocol version.

ServerWelcome 

The server welcomes the admin to a game.

ServerNewGame 

The server tells the admin its going to start a new game.

ServerShutdown 

The server tells the admin its shutting down.

ServerDate 

The server tells the admin what the current game date is.

ServerClientJoin 

The server tells the admin that a client has joined.

ServerClientInfo 

The server gives the admin information about a client.

ServerClientUpdate 

The server gives the admin an information update on a client.

ServerClientQuit 

The server tells the admin that a client quit.

ServerClientError 

The server tells the admin that a client caused an error.

ServerCompanyNew 

The server tells the admin that a new company has started.

ServerCompanyInfo 

The server gives the admin information about a company.

ServerCompanyUpdate 

The server gives the admin an information update on a company.

ServerCompanyRemove 

The server tells the admin that a company was removed.

ServerCompanyEconomy 

The server gives the admin some economy related company information.

ServerCompanyStatistics 

The server gives the admin some statistics about a company.

ServerChat 

The server received a chat message and relays it.

ServerRemoteConsoleCommand 

The server's reply to a remote console command.

ServerConsole 

The server gives the admin the data that got printed to its console.

ServerCommandNames 

The server sends out the names of the DoCommands to the admins.

ServerCommandLoggingOld 

Used to be the type ID of PacketAdminType::ServerCommandLogging in NETWORK_GAME_ADMIN_VERSION 1.

ServerGameScript 

The server gives the admin information from the GameScript in JSON.

ServerRemoteConsoleCommandEnd 

The server indicates that the remote console command has completed.

ServerPong 

The server replies to a ping request from the admin.

ServerCommandLogging 

The server gives the admin copies of incoming command packets.

ServerAuthenticationRequest 

The server gives the admin the used authentication method and required parameters.

ServerEnableEncryption 

The server tells that authentication has completed and requests to enable encryption with the keys of the last PacketAdminType::AdminAuthenticationResponse.

Definition at line 22 of file tcp_admin.h.