98 std::unique_ptr<Packet> p;
virtual NetworkRecvStatus ReceiveServerCompanyUpdate(Packet &p)
Company information of a specific company: uint8_t ID of the company.
virtual NetworkRecvStatus ReceiveServerError(Packet &p)
An error was caused by this admin connection (connection gets closed).
virtual NetworkRecvStatus ReceiveServerCompanyEconomy(Packet &p)
Economy update of a specific company: uint8_t ID of the company.
virtual NetworkRecvStatus ReceiveServerConsole(Packet &p)
Send what would be printed on the server's console also into the admin network.
virtual NetworkRecvStatus ReceiveAdminPoll(Packet &p)
Poll the server for certain updates, an invalid poll (e.g.
virtual NetworkRecvStatus ReceiveAdminJoinSecure(Packet &p)
Join the admin network using a secure authentication method: string Name of the application being use...
virtual NetworkRecvStatus ReceiveServerPong(Packet &p)
Send a ping-reply (pong) to the admin that sent us the ping packet.
NetworkRecvStatus HandlePacket(Packet &p)
Handle the given packet, i.e.
virtual NetworkRecvStatus ReceiveAdminUpdateFrequency(Packet &p)
Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet): uint16_t Up...
virtual NetworkRecvStatus ReceiveServerCompanyRemove(Packet &p)
Notification about a removed company (e.g.
virtual NetworkRecvStatus ReceiveServerChat(Packet &p)
Send chat from the game into the admin network: uint8_t Action such as NetworkAction::ChatClient (see...
NetworkRecvStatus CloseConnection(bool error=true) override
This will put this socket handler in a close state.
virtual NetworkRecvStatus ReceiveServerCompanyInfo(Packet &p)
Company information on a specific company: uint8_t ID of the company.
virtual NetworkRecvStatus ReceiveServerEnableEncryption(Packet &p)
Indication to the client that authentication is complete and encryption has to be used from here on f...
virtual NetworkRecvStatus ReceiveServerProtocol(Packet &p)
Inform a just joined admin about the protocol specifics: uint8_t Protocol version.
virtual NetworkRecvStatus ReceiveServerClientJoin(Packet &p)
Notification of a new client: uint32_t ID of the new client.
virtual NetworkRecvStatus ReceiveAdminRemoteConsoleCommand(Packet &p)
Execute a command on the servers console: string Command to be executed.
virtual NetworkRecvStatus ReceiveServerCompanyNew(Packet &p)
Notification of a new company: uint8_t ID of the new company.
virtual NetworkRecvStatus ReceiveServerClientError(Packet &p)
Notification about a client error (and thus the clients disconnection).
virtual NetworkRecvStatus ReceiveServerCompanyStatistics(Packet &p)
Company statistics on stations and vehicles: uint8_t ID of the company.
virtual NetworkRecvStatus ReceiveServerCommandLogging(Packet &p)
Send incoming command packets to the admin network.
virtual NetworkRecvStatus ReceiveServerClientInfo(Packet &p)
Client information of a specific client: uint32_t ID of the client.
virtual NetworkRecvStatus ReceiveServerAuthenticationRequest(Packet &p)
Server requests authentication challenge from the admin.
virtual NetworkRecvStatus ReceiveAdminQuit(Packet &p)
Notification to the server that this admin is quitting.
virtual NetworkRecvStatus ReceiveAdminAuthenticationResponse(Packet &p)
Admin responds to PacketAdminType::ServerAuthenticationRequest with the appropriate data given the ag...
virtual NetworkRecvStatus ReceiveServerClientUpdate(Packet &p)
Client update details on a specific client (e.g.
virtual NetworkRecvStatus ReceiveServerRemoteConsoleCommandEnd(Packet &p)
Notify the admin connection that the rcon command has finished.
NetworkRecvStatus ReceiveInvalidPacket(PacketAdminType type)
Helper for logging receiving invalid packets.
NetworkRecvStatus ReceivePackets()
Do the actual receiving of packets.
virtual NetworkRecvStatus ReceiveServerWelcome(Packet &p)
Welcome a connected admin to the game: string Name of the Server.
virtual NetworkRecvStatus ReceiveAdminGameScript(Packet &p)
Send a JSON string to the current active GameScript.
virtual NetworkRecvStatus ReceiveServerNewGame(Packet &p)
Notification about a newgame.
std::string admin_version
Version string of the admin.
virtual NetworkRecvStatus ReceiveServerBanned(Packet &p)
The source IP address is banned (connection gets closed).
virtual NetworkRecvStatus ReceiveServerClientQuit(Packet &p)
Notification about a client leaving the game.
virtual NetworkRecvStatus ReceiveServerFull(Packet &p)
The server is full (connection gets closed).
virtual NetworkRecvStatus ReceiveServerShutdown(Packet &p)
Notification about the server shutting down.
virtual NetworkRecvStatus ReceiveAdminJoin(Packet &p)
Join the admin network using an unsecured password exchange: string Unsecured password the server is ...
virtual NetworkRecvStatus ReceiveAdminPing(Packet &p)
Ping the server, requiring the server to reply with a pong packet.
virtual NetworkRecvStatus ReceiveAdminExternalChat(Packet &p)
Send chat from the external source: string Name of the source this message came from.
virtual NetworkRecvStatus ReceiveServerCommandNames(Packet &p)
Send DoCommand names to the bot upon request only.
virtual NetworkRecvStatus ReceiveAdminChat(Packet &p)
Send chat as the server: uint8_t Action such as NetworkAction::ChatClient (see NetworkAction).
std::string admin_name
Name of the admin.
virtual NetworkRecvStatus ReceiveServerDate(Packet &p)
Send the current date of the game: uint32_t Current game date.
virtual NetworkRecvStatus ReceiveServerRemoteConsoleCommand(Packet &p)
Result of an rcon command: uint16_t Colour as it would be used on the server or a client.
virtual std::unique_ptr< Packet > ReceivePacket()
Receives a packet for the given client.
@ Autoclean
The company is removed due to autoclean.
@ Bankrupt
The company went belly-up.
@ Manual
The company is manually removed.
NetworkRecvStatus
Status of a network client; reasons why a client has quit.
@ NETWORK_RECV_STATUS_CLIENT_QUIT
The connection is lost gracefully. Other clients are already informed of this leaving client.
@ NETWORK_RECV_STATUS_OKAY
Everything is okay.
@ NETWORK_RECV_STATUS_MALFORMED_PACKET
We apparently send a malformed packet.
Functions related to debugging.
#define Debug(category, level, format_string,...)
Output a line of debugging information.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23).
Variables and function used internally.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
uint8_t Recv_uint8()
Read a 8 bits integer from the packet.
Basic functions to receive and send TCP packets to and from the admin network.
PacketAdminType
Enum with types of TCP packets specific to the admin network.
@ ServerCompanyNew
The server tells the admin that a new company has started.
@ ServerDate
The server tells the admin what the current game date is.
@ AdminRemoteConsoleCommand
The admin sends a remote console command.
@ ServerAuthenticationRequest
The server gives the admin the used authentication method and required parameters.
@ ServerClientInfo
The server gives the admin information about a client.
@ ServerShutdown
The server tells the admin its shutting down.
@ ServerCompanyRemove
The server tells the admin that a company was removed.
@ ServerCommandNames
The server sends out the names of the DoCommands to the admins.
@ ServerCompanyEconomy
The server gives the admin some economy related company information.
@ AdminPing
The admin sends a ping to the server, expecting a ping-reply (PONG) packet.
@ ServerClientQuit
The server tells the admin that a client quit.
@ ServerPong
The server replies to a ping request from the admin.
@ ServerClientJoin
The server tells the admin that a client has joined.
@ ServerFull
The server tells the admin it cannot accept the admin.
@ ServerClientError
The server tells the admin that a client caused an error.
@ ServerCompanyInfo
The server gives the admin information about a company.
@ ServerBanned
The server tells the admin it is banned.
@ ServerError
The server tells the admin an error has occurred.
@ AdminJoinSecure
The admin announces and starts a secure authentication handshake.
@ AdminJoin
The admin announces and authenticates itself to the server using an unsecured passwords.
@ AdminGameScript
The admin sends a JSON string for the GameScript.
@ ServerConsole
The server gives the admin the data that got printed to its console.
@ AdminExternalChat
The admin sends a chat message from external source.
@ AdminAuthenticationResponse
The admin responds to the authentication request.
@ ServerCommandLogging
The server gives the admin copies of incoming command packets.
@ ServerClientUpdate
The server gives the admin an information update on a client.
@ ServerCompanyStatistics
The server gives the admin some statistics about a company.
@ ServerRemoteConsoleCommandEnd
The server indicates that the remote console command has completed.
@ ServerRemoteConsoleCommand
The server's reply to a remote console command.
@ ServerWelcome
The server welcomes the admin to a game.
@ ServerCompanyUpdate
The server gives the admin an information update on a company.
@ ServerChat
The server received a chat message and relays it.
@ AdminChat
The admin sends a chat message to be distributed.
@ ServerProtocol
The server tells the admin its protocol version.
@ AdminQuit
The admin tells the server that it is quitting.
@ ServerEnableEncryption
The server tells that authentication has completed and requests to enable encryption with the keys of...
@ AdminPoll
The admin explicitly polls for a piece of information.
@ ServerNewGame
The server tells the admin its going to start a new game.
@ AdminUpdateFrequency
The admin tells the server the update frequency of a particular piece of information.
@ ADMIN_CRR_BANKRUPT
The company went belly-up.
@ ADMIN_CRR_MANUAL
The company is manually removed.
@ ADMIN_CRR_AUTOCLEAN
The company is removed due to autoclean.
@ ADMIN_CRR_END
Sentinel for end.