OpenTTD Source  20240919-master-gdf0233f4c2
tcp_admin.h File Reference
#include "os_abstraction.h"
#include "tcp.h"
#include "../network_type.h"
#include "../../core/pool_type.hpp"

Go to the source code of this file.

Data Structures

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

Enumerations

enum  PacketAdminType : uint8_t {
  ADMIN_PACKET_ADMIN_JOIN, ADMIN_PACKET_ADMIN_QUIT, ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY, ADMIN_PACKET_ADMIN_POLL,
  ADMIN_PACKET_ADMIN_CHAT, ADMIN_PACKET_ADMIN_RCON, ADMIN_PACKET_ADMIN_GAMESCRIPT, ADMIN_PACKET_ADMIN_PING,
  ADMIN_PACKET_ADMIN_EXTERNAL_CHAT, ADMIN_PACKET_ADMIN_JOIN_SECURE, ADMIN_PACKET_ADMIN_AUTH_RESPONSE, ADMIN_PACKET_SERVER_FULL = 100,
  ADMIN_PACKET_SERVER_BANNED, ADMIN_PACKET_SERVER_ERROR, ADMIN_PACKET_SERVER_PROTOCOL, ADMIN_PACKET_SERVER_WELCOME,
  ADMIN_PACKET_SERVER_NEWGAME, ADMIN_PACKET_SERVER_SHUTDOWN, ADMIN_PACKET_SERVER_DATE, ADMIN_PACKET_SERVER_CLIENT_JOIN,
  ADMIN_PACKET_SERVER_CLIENT_INFO, ADMIN_PACKET_SERVER_CLIENT_UPDATE, ADMIN_PACKET_SERVER_CLIENT_QUIT, ADMIN_PACKET_SERVER_CLIENT_ERROR,
  ADMIN_PACKET_SERVER_COMPANY_NEW, ADMIN_PACKET_SERVER_COMPANY_INFO, ADMIN_PACKET_SERVER_COMPANY_UPDATE, ADMIN_PACKET_SERVER_COMPANY_REMOVE,
  ADMIN_PACKET_SERVER_COMPANY_ECONOMY, ADMIN_PACKET_SERVER_COMPANY_STATS, ADMIN_PACKET_SERVER_CHAT, ADMIN_PACKET_SERVER_RCON,
  ADMIN_PACKET_SERVER_CONSOLE, ADMIN_PACKET_SERVER_CMD_NAMES, ADMIN_PACKET_SERVER_CMD_LOGGING_OLD, ADMIN_PACKET_SERVER_GAMESCRIPT,
  ADMIN_PACKET_SERVER_RCON_END, ADMIN_PACKET_SERVER_PONG, ADMIN_PACKET_SERVER_CMD_LOGGING, ADMIN_PACKET_SERVER_AUTH_REQUEST,
  ADMIN_PACKET_SERVER_ENABLE_ENCRYPTION, INVALID_ADMIN_PACKET = 0xFF
}
 Enum with types of TCP packets specific to the admin network. More...
 
enum  AdminStatus { ADMIN_STATUS_INACTIVE, ADMIN_STATUS_AUTHENTICATE, ADMIN_STATUS_ACTIVE, ADMIN_STATUS_END }
 Status of an admin. More...
 
enum  AdminUpdateType {
  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  AdminUpdateFrequency {
  ADMIN_FREQUENCY_POLL = 0x01, ADMIN_FREQUENCY_DAILY = 0x02, ADMIN_FREQUENCY_WEEKLY = 0x04, ADMIN_FREQUENCY_MONTHLY = 0x08,
  ADMIN_FREQUENCY_QUARTERLY = 0x10, ADMIN_FREQUENCY_ANUALLY = 0x20, ADMIN_FREQUENCY_AUTOMATIC = 0x40
}
 Update frequencies an admin can register. More...
 
enum  AdminCompanyRemoveReason { 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.

Enumeration Type Documentation

◆ AdminCompanyRemoveReason

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

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

Update frequencies an admin can register.

Enumerator
ADMIN_FREQUENCY_POLL 

The admin can poll this.

ADMIN_FREQUENCY_DAILY 

The admin gets information about this on a daily basis.

ADMIN_FREQUENCY_WEEKLY 

The admin gets information about this on a weekly basis.

ADMIN_FREQUENCY_MONTHLY 

The admin gets information about this on a monthly basis.

ADMIN_FREQUENCY_QUARTERLY 

The admin gets information about this on a quarterly basis.

ADMIN_FREQUENCY_ANUALLY 

The admin gets information about this on a yearly basis.

ADMIN_FREQUENCY_AUTOMATIC 

The admin gets information about this when it changes.

Definition at line 96 of file tcp_admin.h.

◆ AdminUpdateType

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 PacketAdminType : uint8_t

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

This protocol may only be extended to ensure stability.

Enumerator
ADMIN_PACKET_ADMIN_JOIN 

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

ADMIN_PACKET_ADMIN_QUIT 

The admin tells the server that it is quitting.

ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY 

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

ADMIN_PACKET_ADMIN_POLL 

The admin explicitly polls for a piece of information.

ADMIN_PACKET_ADMIN_CHAT 

The admin sends a chat message to be distributed.

ADMIN_PACKET_ADMIN_RCON 

The admin sends a remote console command.

ADMIN_PACKET_ADMIN_GAMESCRIPT 

The admin sends a JSON string for the GameScript.

ADMIN_PACKET_ADMIN_PING 

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

ADMIN_PACKET_ADMIN_EXTERNAL_CHAT 

The admin sends a chat message from external source.

ADMIN_PACKET_ADMIN_JOIN_SECURE 

The admin announces and starts a secure authentication handshake.

ADMIN_PACKET_ADMIN_AUTH_RESPONSE 

The admin responds to the authentication request.

ADMIN_PACKET_SERVER_FULL 

The server tells the admin it cannot accept the admin.

ADMIN_PACKET_SERVER_BANNED 

The server tells the admin it is banned.

ADMIN_PACKET_SERVER_ERROR 

The server tells the admin an error has occurred.

ADMIN_PACKET_SERVER_PROTOCOL 

The server tells the admin its protocol version.

ADMIN_PACKET_SERVER_WELCOME 

The server welcomes the admin to a game.

ADMIN_PACKET_SERVER_NEWGAME 

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

ADMIN_PACKET_SERVER_SHUTDOWN 

The server tells the admin its shutting down.

ADMIN_PACKET_SERVER_DATE 

The server tells the admin what the current game date 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_CLIENT_UPDATE 

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

ADMIN_PACKET_SERVER_CLIENT_QUIT 

The server tells the admin that a client quit.

ADMIN_PACKET_SERVER_CLIENT_ERROR 

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

ADMIN_PACKET_SERVER_COMPANY_NEW 

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

ADMIN_PACKET_SERVER_COMPANY_INFO 

The server gives the admin information about a company.

ADMIN_PACKET_SERVER_COMPANY_UPDATE 

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

ADMIN_PACKET_SERVER_COMPANY_REMOVE 

The server tells the admin that a company was removed.

ADMIN_PACKET_SERVER_COMPANY_ECONOMY 

The server gives the admin some economy related company information.

ADMIN_PACKET_SERVER_COMPANY_STATS 

The server gives the admin some statistics about a company.

ADMIN_PACKET_SERVER_CHAT 

The server received a chat message and relays it.

ADMIN_PACKET_SERVER_RCON 

The server's reply to a remove console command.

ADMIN_PACKET_SERVER_CONSOLE 

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

ADMIN_PACKET_SERVER_CMD_NAMES 

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

ADMIN_PACKET_SERVER_CMD_LOGGING_OLD 

Used to be the type ID of ADMIN_PACKET_SERVER_CMD_LOGGING in NETWORK_GAME_ADMIN_VERSION 1.

ADMIN_PACKET_SERVER_GAMESCRIPT 

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

ADMIN_PACKET_SERVER_RCON_END 

The server indicates that the remote console command has completed.

ADMIN_PACKET_SERVER_PONG 

The server replies to a ping request from the admin.

ADMIN_PACKET_SERVER_CMD_LOGGING 

The server gives the admin copies of incoming command packets.

ADMIN_PACKET_SERVER_AUTH_REQUEST 

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

ADMIN_PACKET_SERVER_ENABLE_ENCRYPTION 

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

INVALID_ADMIN_PACKET 

An invalid marker for admin packets.

Definition at line 24 of file tcp_admin.h.