16 #include "../../stdafx.h" 18 #include "../network_internal.h" 20 #include "../../debug.h" 22 #include "../../safeguards.h" 41 NetworkAdminSocketHandler::~NetworkAdminSocketHandler()
char admin_name[NETWORK_CLIENT_NAME_LENGTH]
Name of the admin.
The admin sends a chat message to be distributed.
virtual NetworkRecvStatus Receive_ADMIN_POLL(Packet *p)
Poll the server for certain updates, an invalid poll (e.g.
virtual NetworkRecvStatus Receive_ADMIN_PING(Packet *p)
Ping the server, requiring the server to reply with a pong packet.
bool HasClientQuit() const
Whether the current client connected to the socket has quit.
SOCKET sock
The socket currently connected to.
Internal entity of a packet.
The server replies to a ping request from the admin.
virtual NetworkRecvStatus Receive_SERVER_PROTOCOL(Packet *p)
Inform a just joined admin about the protocol specifics: uint8 Protocol version.
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.
The admin explicitly polls for a piece of information.
The server tells the admin its going to start a new game.
The server tells the admin its shutting down.
The server received a chat message and relays it.
The server tells the admin that a new company has started.
The server tells the admin its protocol version.
The company is manually removed.
The admin announces and authenticates itself to the server.
The server tells the admin that a client quit.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_STATS(Packet *p)
Company statistics on stations and vehicles: uint8 ID of the company.
An invalid marker for admin packets.
virtual NetworkRecvStatus Receive_SERVER_DATE(Packet *p)
Send the current date of the game: uint32 Current game date.
virtual NetworkRecvStatus Receive_SERVER_ERROR(Packet *p)
An error was caused by this admin connection (connection gets closed).
The server tells the admin an error has occurred.
char admin_version[NETWORK_REVISION_LENGTH]
Version string of the admin.
virtual NetworkRecvStatus Receive_SERVER_SHUTDOWN(Packet *p)
Notification about the server shutting down.
virtual NetworkRecvStatus Receive_SERVER_CLIENT_QUIT(Packet *p)
Notification about a client leaving the game.
The admin sends a JSON string for the GameScript.
NetworkRecvStatus ReceiveInvalidPacket(PacketAdminType type)
Helper for logging receiving invalid packets.
The server tells the admin what the current game date is.
virtual Packet * ReceivePacket()
Receives a packet for the given 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_ERROR(Packet *p)
Notification about a client error (and thus the clients disconnection).
The server gives the admin some statistics about a company.
NetworkRecvStatus ReceivePackets()
Do the actual receiving of packets.
The company is removed due to autoclean.
The server's reply to a remove console command.
virtual NetworkRecvStatus Receive_SERVER_FULL(Packet *p)
The server is full (connection gets closed).
The server gives the admin an information update on a client.
NetworkRecvStatus HandlePacket(Packet *p)
Handle the given packet, i.e.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_UPDATE(Packet *p)
Company information of a specific company: uint8 ID of the company.
The admin is not connected nor active.
The server tells the admin it cannot accept the admin.
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_ADMIN_CHAT(Packet *p)
Send chat as the server: uint8 Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction).
NetworkRecvStatus
Status of a network client; reasons why a client has quit.
The server indicates that the remote console command has completed.
The company is manually removed.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_REMOVE(Packet *p)
Notification about a removed company (e.g.
virtual NetworkRecvStatus Receive_ADMIN_RCON(Packet *p)
Execute a command on the servers console: string Command to be executed.
virtual NetworkRecvStatus Receive_ADMIN_JOIN(Packet *p)
Join the admin network: string Password the server is expecting for this network. ...
The server tells the admin that a company was removed.
The server sends out the names of the DoCommands to the admins.
virtual NetworkRecvStatus Receive_ADMIN_GAMESCRIPT(Packet *p)
Send a JSON string to the current active GameScript.
The server tells the admin that a client caused an error.
virtual NetworkRecvStatus Receive_SERVER_PONG(Packet *p)
Send a ping-reply (pong) to the admin that sent us the ping packet.
The admin tells the server that it is quitting.
The server gives the admin the data that got printed to its console.
The connection is 'just' lost.
#define DEBUG(name, level,...)
Output a line of debugging information.
virtual NetworkRecvStatus Receive_SERVER_CLIENT_UPDATE(Packet *p)
Client update details on a specific client (e.g.
The server gives the admin an information update on a company.
virtual NetworkRecvStatus Receive_SERVER_CMD_NAMES(Packet *p)
Send DoCommand names to the bot upon request only.
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 ...
virtual NetworkRecvStatus Receive_ADMIN_UPDATE_FREQUENCY(Packet *p)
Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet): uint16 Upda...
The company is removed due to autoclean.
PacketAdminType
Enum with types of TCP packets specific to the admin network.
uint8 Recv_uint8()
Read a 8 bits integer from the packet.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_INFO(Packet *p)
Company information on a specific company: uint8 ID of the company.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_NEW(Packet *p)
Notification of a new company: uint8 ID of the new company.
virtual NetworkRecvStatus Receive_ADMIN_QUIT(Packet *p)
Notification to the server that this admin is quitting.
The server tells the admin that a client has joined.
virtual NetworkRecvStatus Receive_SERVER_RCON_END(Packet *p)
Notify the admin connection that the rcon command has finished.
The company went belly-up.
The admin sends a remote console command.
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
The admin sends a ping to the server, expecting a ping-reply (PONG) packet.
virtual NetworkRecvStatus Receive_SERVER_WELCOME(Packet *p)
Welcome a connected admin to the game: string Name of the Server (e.g.
The server gives the admin information about a client.
NetworkAdminSocketHandler(SOCKET s)
Create the admin handler for the given socket.
The server welcomes the admin to a game.
The company went belly-up.
We apparently send a malformed packet.
virtual NetworkRecvStatus Receive_SERVER_COMPANY_ECONOMY(Packet *p)
Economy update of a specific company: uint8 ID of the company.
virtual NetworkRecvStatus Receive_SERVER_BANNED(Packet *p)
The source IP address is banned (connection gets closed).
The server gives the admin copies of incoming command packets.
Basic functions to receive and send TCP packets to and from the admin network.
virtual NetworkRecvStatus Receive_SERVER_CLIENT_JOIN(Packet *p)
Notification of a new client: uint32 ID of the new client.
virtual NetworkRecvStatus Receive_SERVER_NEWGAME(Packet *p)
Notification about a newgame.
The server gives the admin some economy related company information.
The admin tells the server the update frequency of a particular piece of information.
NetworkRecvStatus CloseConnection(bool error=true)
Close the current connection; for TCP this will be mostly equivalent to Close(), but for UDP it just ...
The server tells the admin it is banned.
The server gives the admin information about a company.
virtual NetworkRecvStatus Receive_SERVER_CMD_LOGGING(Packet *p)
Send incoming command packets to the admin network.