OpenTTD Source 20260621-master-g720d10536d
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 class  AdminStatus : uint8_t { Inactive , Authenticate , Active }
 Status of an admin. More...
enum class  AdminUpdateType : uint8_t {
  Date , ClientInfo , CompanyInfo , CompanyEconomy ,
  CompanyStats , Chat , Console , CmdNames ,
  CmdLogging , Gamescript , 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 class  AdminCompanyRemoveReason : uint8_t { Manual , Autoclean , Bankrupt , 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 104 of file tcp_admin.h.

Enumeration Type Documentation

◆ AdminCompanyRemoveReason

enum class AdminCompanyRemoveReason : uint8_t
strong

Reasons for removing a company - communicated to admins.

Enumerator
Manual 

The company is manually removed.

Autoclean 

The company is removed due to autoclean.

Bankrupt 

The company went belly-up.

End 

Sentinel for end.

Definition at line 107 of file tcp_admin.h.

◆ AdminStatus

enum class AdminStatus : uint8_t
strong

Status of an admin.

Enumerator
Inactive 

The admin is not connected nor active.

Authenticate 

The admin is connected and working on authentication.

Active 

The admin is active.

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 95 of file tcp_admin.h.

◆ AdminUpdateType

enum class AdminUpdateType : uint8_t
strong

Update types an admin can register a frequency for.

Enumerator
Date 

Updates about the date of the game.

ClientInfo 

Updates about the information of clients.

CompanyInfo 

Updates about the generic information of companies.

CompanyEconomy 

Updates about the economy of companies.

CompanyStats 

Updates about the statistics of companies.

Chat 

The admin would like to have chat messages.

Console 

The admin would like to have console messages.

CmdNames 

The admin would like a list of all DoCommand names.

CmdLogging 

The admin would like to have DoCommand information.

Gamescript 

The admin would like to have gamescript messages.

End 

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

Definition at line 80 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.