OpenTTD Source: src/network/core/tcp_admin.h Source File

OpenTTD Source 13.1

tcp_admin.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
12 #ifndef NETWORK_CORE_TCP_ADMIN_H
13 #define NETWORK_CORE_TCP_ADMIN_H
14
15 #include "os_abstraction.h"
16 #include "tcp.h"
17 #include "../network_type.h"
18 #include "../../core/pool_type.hpp"
19
24 enum PacketAdminType {
25 ADMIN_PACKET_ADMIN_JOIN,
26 ADMIN_PACKET_ADMIN_QUIT,
27 ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY,
28 ADMIN_PACKET_ADMIN_POLL,
29 ADMIN_PACKET_ADMIN_CHAT,
30 ADMIN_PACKET_ADMIN_RCON,
31 ADMIN_PACKET_ADMIN_GAMESCRIPT,
32 ADMIN_PACKET_ADMIN_PING,
33 ADMIN_PACKET_ADMIN_EXTERNAL_CHAT,
34
35 ADMIN_PACKET_SERVER_FULL = 100,
36 ADMIN_PACKET_SERVER_BANNED,
37 ADMIN_PACKET_SERVER_ERROR,
38 ADMIN_PACKET_SERVER_PROTOCOL,
39 ADMIN_PACKET_SERVER_WELCOME,
40 ADMIN_PACKET_SERVER_NEWGAME,
41 ADMIN_PACKET_SERVER_SHUTDOWN,
42
43 ADMIN_PACKET_SERVER_DATE,
44 ADMIN_PACKET_SERVER_CLIENT_JOIN,
45 ADMIN_PACKET_SERVER_CLIENT_INFO,
46 ADMIN_PACKET_SERVER_CLIENT_UPDATE,
47 ADMIN_PACKET_SERVER_CLIENT_QUIT,
48 ADMIN_PACKET_SERVER_CLIENT_ERROR,
49 ADMIN_PACKET_SERVER_COMPANY_NEW,
50 ADMIN_PACKET_SERVER_COMPANY_INFO,
51 ADMIN_PACKET_SERVER_COMPANY_UPDATE,
52 ADMIN_PACKET_SERVER_COMPANY_REMOVE,
53 ADMIN_PACKET_SERVER_COMPANY_ECONOMY,
54 ADMIN_PACKET_SERVER_COMPANY_STATS,
55 ADMIN_PACKET_SERVER_CHAT,
56 ADMIN_PACKET_SERVER_RCON,
57 ADMIN_PACKET_SERVER_CONSOLE,
58 ADMIN_PACKET_SERVER_CMD_NAMES,
59 ADMIN_PACKET_SERVER_CMD_LOGGING_OLD,
60 ADMIN_PACKET_SERVER_GAMESCRIPT,
61 ADMIN_PACKET_SERVER_RCON_END,
62 ADMIN_PACKET_SERVER_PONG,
63 ADMIN_PACKET_SERVER_CMD_LOGGING,
64
65 INVALID_ADMIN_PACKET = 0xFF,
66 };
67
69 enum AdminStatus {
70 ADMIN_STATUS_INACTIVE,
71 ADMIN_STATUS_ACTIVE,
72 ADMIN_STATUS_END,
73 };
74
76 enum AdminUpdateType {
77 ADMIN_UPDATE_DATE,
78 ADMIN_UPDATE_CLIENT_INFO,
79 ADMIN_UPDATE_COMPANY_INFO,
80 ADMIN_UPDATE_COMPANY_ECONOMY,
81 ADMIN_UPDATE_COMPANY_STATS,
82 ADMIN_UPDATE_CHAT,
83 ADMIN_UPDATE_CONSOLE,
84 ADMIN_UPDATE_CMD_NAMES,
85 ADMIN_UPDATE_CMD_LOGGING,
86 ADMIN_UPDATE_GAMESCRIPT,
87 ADMIN_UPDATE_END,
88 };
89
91 enum AdminUpdateFrequency {
92 ADMIN_FREQUENCY_POLL = 0x01,
93 ADMIN_FREQUENCY_DAILY = 0x02,
94 ADMIN_FREQUENCY_WEEKLY = 0x04,
95 ADMIN_FREQUENCY_MONTHLY = 0x08,
96 ADMIN_FREQUENCY_QUARTERLY = 0x10,
97 ADMIN_FREQUENCY_ANUALLY = 0x20,
98 ADMIN_FREQUENCY_AUTOMATIC = 0x40,
99 };
100 DECLARE_ENUM_AS_BIT_SET(AdminUpdateFrequency)
101
102
103 enum AdminCompanyRemoveReason {
104 ADMIN_CRR_MANUAL,
105 ADMIN_CRR_AUTOCLEAN,
106 ADMIN_CRR_BANKRUPT,
107
108 ADMIN_CRR_END,
109 };
110
112 class NetworkAdminSocketHandler : public NetworkTCPSocketHandler {
113 protected:
114 std::string admin_name;
115 std::string admin_version;
116 AdminStatus status;
117
118 NetworkRecvStatus ReceiveInvalidPacket(PacketAdminType type);
119
128 virtual NetworkRecvStatus Receive_ADMIN_JOIN(Packet *p);
129
135 virtual NetworkRecvStatus Receive_ADMIN_QUIT(Packet *p);
136
144 virtual NetworkRecvStatus Receive_ADMIN_UPDATE_FREQUENCY(Packet *p);
145
155 virtual NetworkRecvStatus Receive_ADMIN_POLL(Packet *p);
156
166 virtual NetworkRecvStatus Receive_ADMIN_CHAT(Packet *p);
167
177 virtual NetworkRecvStatus Receive_ADMIN_EXTERNAL_CHAT(Packet *p);
178
185 virtual NetworkRecvStatus Receive_ADMIN_RCON(Packet *p);
186
193 virtual NetworkRecvStatus Receive_ADMIN_GAMESCRIPT(Packet *p);
194
201 virtual NetworkRecvStatus Receive_ADMIN_PING(Packet *p);
202
208 virtual NetworkRecvStatus Receive_SERVER_FULL(Packet *p);
209
215 virtual NetworkRecvStatus Receive_SERVER_BANNED(Packet *p);
216
223 virtual NetworkRecvStatus Receive_SERVER_ERROR(Packet *p);
224
234 virtual NetworkRecvStatus Receive_SERVER_PROTOCOL(Packet *p);
235
250 virtual NetworkRecvStatus Receive_SERVER_WELCOME(Packet *p);
251
257 virtual NetworkRecvStatus Receive_SERVER_NEWGAME(Packet *p);
258
264 virtual NetworkRecvStatus Receive_SERVER_SHUTDOWN(Packet *p);
265
272 virtual NetworkRecvStatus Receive_SERVER_DATE(Packet *p);
273
280 virtual NetworkRecvStatus Receive_SERVER_CLIENT_JOIN(Packet *p);
281
293 virtual NetworkRecvStatus Receive_SERVER_CLIENT_INFO(Packet *p);
294
303 virtual NetworkRecvStatus Receive_SERVER_CLIENT_UPDATE(Packet *p);
304
311 virtual NetworkRecvStatus Receive_SERVER_CLIENT_QUIT(Packet *p);
312
320 virtual NetworkRecvStatus Receive_SERVER_CLIENT_ERROR(Packet *p);
321
328 virtual NetworkRecvStatus Receive_SERVER_COMPANY_NEW(Packet *p);
329
342 virtual NetworkRecvStatus Receive_SERVER_COMPANY_INFO(Packet *p);
343
359 virtual NetworkRecvStatus Receive_SERVER_COMPANY_UPDATE(Packet *p);
360
368 virtual NetworkRecvStatus Receive_SERVER_COMPANY_REMOVE(Packet *p);
369
386 virtual NetworkRecvStatus Receive_SERVER_COMPANY_ECONOMY(Packet *p);
387
404 virtual NetworkRecvStatus Receive_SERVER_COMPANY_STATS(Packet *p);
405
416 virtual NetworkRecvStatus Receive_SERVER_CHAT(Packet *p);
417
425 virtual NetworkRecvStatus Receive_SERVER_RCON(Packet *p);
426
434 virtual NetworkRecvStatus Receive_SERVER_CONSOLE(Packet *p);
435
453 virtual NetworkRecvStatus Receive_SERVER_CMD_NAMES(Packet *p);
454
475 virtual NetworkRecvStatus Receive_SERVER_CMD_LOGGING(Packet *p);
476
483 virtual NetworkRecvStatus Receive_SERVER_PONG(Packet *p);
484
491 virtual NetworkRecvStatus Receive_SERVER_RCON_END(Packet *p);
492
493 NetworkRecvStatus HandlePacket(Packet *p);
494 public:
495 NetworkRecvStatus CloseConnection(bool error = true) override;
496
497 NetworkAdminSocketHandler(SOCKET s);
498
499 NetworkRecvStatus ReceivePackets();
500
505 AdminStatus GetAdminStatus() const
506 {
507 return this->status;
508 }
509 };
510
511 #endif /* NETWORK_CORE_TCP_ADMIN_H */
NetworkAdminSocketHandler::Receive_SERVER_BANNED
virtual NetworkRecvStatus Receive_SERVER_BANNED(Packet *p)
The source IP address is banned (connection gets closed).
Definition: tcp_admin.cpp:142
NetworkAdminSocketHandler::Receive_SERVER_PROTOCOL
virtual NetworkRecvStatus Receive_SERVER_PROTOCOL(Packet *p)
Inform a just joined admin about the protocol specifics: uint8 Protocol version.
Definition: tcp_admin.cpp:144
ADMIN_PACKET_SERVER_GAMESCRIPT
@ ADMIN_PACKET_SERVER_GAMESCRIPT
The server gives the admin information from the GameScript in JSON.
Definition: tcp_admin.h:60
ADMIN_UPDATE_CMD_NAMES
@ ADMIN_UPDATE_CMD_NAMES
The admin would like a list of all DoCommand names.
Definition: tcp_admin.h:84
ADMIN_UPDATE_COMPANY_INFO
@ ADMIN_UPDATE_COMPANY_INFO
Updates about the generic information of companies.
Definition: tcp_admin.h:79
NetworkAdminSocketHandler::admin_version
std::string admin_version
Version string of the admin.
Definition: tcp_admin.h:115
INVALID_ADMIN_PACKET
@ INVALID_ADMIN_PACKET
An invalid marker for admin packets.
Definition: tcp_admin.h:65
NetworkAdminSocketHandler::Receive_SERVER_DATE
virtual NetworkRecvStatus Receive_SERVER_DATE(Packet *p)
Send the current date of the game: uint32 Current game date.
Definition: tcp_admin.cpp:149
NetworkAdminSocketHandler::status
AdminStatus status
Status of this admin.
Definition: tcp_admin.h:116
NetworkAdminSocketHandler::CloseConnection
NetworkRecvStatus CloseConnection(bool error=true) override
This will put this socket handler in a close state.
Definition: tcp_admin.cpp:35
ADMIN_PACKET_SERVER_CMD_LOGGING_OLD
@ ADMIN_PACKET_SERVER_CMD_LOGGING_OLD
Used to be the type ID of ADMIN_PACKET_SERVER_CMD_LOGGING in NETWORK_GAME_ADMIN_VERSION 1.
Definition: tcp_admin.h:59
NetworkAdminSocketHandler::Receive_SERVER_CONSOLE
virtual NetworkRecvStatus Receive_SERVER_CONSOLE(Packet *p)
Send what would be printed on the server's console also into the admin network.
Definition: tcp_admin.cpp:163
ADMIN_PACKET_SERVER_CLIENT_QUIT
@ ADMIN_PACKET_SERVER_CLIENT_QUIT
The server tells the admin that a client quit.
Definition: tcp_admin.h:47
NetworkAdminSocketHandler::Receive_SERVER_CMD_LOGGING
virtual NetworkRecvStatus Receive_SERVER_CMD_LOGGING(Packet *p)
Send incoming command packets to the admin network.
Definition: tcp_admin.cpp:165
ADMIN_UPDATE_CLIENT_INFO
@ ADMIN_UPDATE_CLIENT_INFO
Updates about the information of clients.
Definition: tcp_admin.h:78
ADMIN_PACKET_SERVER_COMPANY_INFO
@ ADMIN_PACKET_SERVER_COMPANY_INFO
The server gives the admin information about a company.
Definition: tcp_admin.h:50
NetworkAdminSocketHandler::admin_name
std::string admin_name
Name of the admin.
Definition: tcp_admin.h:114
NetworkAdminSocketHandler::Receive_ADMIN_POLL
virtual NetworkRecvStatus Receive_ADMIN_POLL(Packet *p)
Poll the server for certain updates, an invalid poll (e.g.
Definition: tcp_admin.cpp:134
ADMIN_UPDATE_CONSOLE
@ ADMIN_UPDATE_CONSOLE
The admin would like to have console messages.
Definition: tcp_admin.h:83
ADMIN_PACKET_ADMIN_CHAT
@ ADMIN_PACKET_ADMIN_CHAT
The admin sends a chat message to be distributed.
Definition: tcp_admin.h:29
ADMIN_PACKET_SERVER_PONG
@ ADMIN_PACKET_SERVER_PONG
The server replies to a ping request from the admin.
Definition: tcp_admin.h:62
ADMIN_UPDATE_CHAT
@ ADMIN_UPDATE_CHAT
The admin would like to have chat messages.
Definition: tcp_admin.h:82
ADMIN_PACKET_ADMIN_EXTERNAL_CHAT
@ ADMIN_PACKET_ADMIN_EXTERNAL_CHAT
The admin sends a chat message from external source.
Definition: tcp_admin.h:33
NetworkAdminSocketHandler::Receive_SERVER_RCON_END
virtual NetworkRecvStatus Receive_SERVER_RCON_END(Packet *p)
Notify the admin connection that the rcon command has finished.
Definition: tcp_admin.cpp:166
ADMIN_PACKET_SERVER_NEWGAME
@ ADMIN_PACKET_SERVER_NEWGAME
The server tells the admin its going to start a new game.
Definition: tcp_admin.h:40
ADMIN_PACKET_ADMIN_GAMESCRIPT
@ ADMIN_PACKET_ADMIN_GAMESCRIPT
The admin sends a JSON string for the GameScript.
Definition: tcp_admin.h:31
ADMIN_FREQUENCY_DAILY
@ ADMIN_FREQUENCY_DAILY
The admin gets information about this on a daily basis.
Definition: tcp_admin.h:93
NetworkAdminSocketHandler::Receive_SERVER_COMPANY_NEW
virtual NetworkRecvStatus Receive_SERVER_COMPANY_NEW(Packet *p)
Notification of a new company: uint8 ID of the new company.
Definition: tcp_admin.cpp:155
NetworkAdminSocketHandler::Receive_SERVER_ERROR
virtual NetworkRecvStatus Receive_SERVER_ERROR(Packet *p)
An error was caused by this admin connection (connection gets closed).
Definition: tcp_admin.cpp:143
ADMIN_PACKET_SERVER_CHAT
@ ADMIN_PACKET_SERVER_CHAT
The server received a chat message and relays it.
Definition: tcp_admin.h:55
ADMIN_PACKET_SERVER_COMPANY_NEW
@ ADMIN_PACKET_SERVER_COMPANY_NEW
The server tells the admin that a new company has started.
Definition: tcp_admin.h:49
ADMIN_PACKET_SERVER_PROTOCOL
@ ADMIN_PACKET_SERVER_PROTOCOL
The server tells the admin its protocol version.
Definition: tcp_admin.h:38
NetworkAdminSocketHandler::ReceivePackets
NetworkRecvStatus ReceivePackets()
Do the actual receiving of packets.
Definition: tcp_admin.cpp:108
ADMIN_UPDATE_CMD_LOGGING
@ ADMIN_UPDATE_CMD_LOGGING
The admin would like to have DoCommand information.
Definition: tcp_admin.h:85
ADMIN_FREQUENCY_MONTHLY
@ ADMIN_FREQUENCY_MONTHLY
The admin gets information about this on a monthly basis.
Definition: tcp_admin.h:95
NetworkAdminSocketHandler::Receive_SERVER_CLIENT_ERROR
virtual NetworkRecvStatus Receive_SERVER_CLIENT_ERROR(Packet *p)
Notification about a client error (and thus the clients disconnection).
Definition: tcp_admin.cpp:154
NetworkAdminSocketHandler::Receive_ADMIN_RCON
virtual NetworkRecvStatus Receive_ADMIN_RCON(Packet *p)
Execute a command on the servers console: string Command to be executed.
Definition: tcp_admin.cpp:137
ADMIN_PACKET_SERVER_COMPANY_STATS
@ ADMIN_PACKET_SERVER_COMPANY_STATS
The server gives the admin some statistics about a company.
Definition: tcp_admin.h:54
ADMIN_PACKET_ADMIN_JOIN
@ ADMIN_PACKET_ADMIN_JOIN
The admin announces and authenticates itself to the server.
Definition: tcp_admin.h:25
AdminStatus
AdminStatus
Status of an admin.
Definition: tcp_admin.h:69
NetworkAdminSocketHandler::Receive_SERVER_CMD_NAMES
virtual NetworkRecvStatus Receive_SERVER_CMD_NAMES(Packet *p)
Send DoCommand names to the bot upon request only.
Definition: tcp_admin.cpp:164
NetworkAdminSocketHandler::Receive_SERVER_CLIENT_QUIT
virtual NetworkRecvStatus Receive_SERVER_CLIENT_QUIT(Packet *p)
Notification about a client leaving the game.
Definition: tcp_admin.cpp:153
NetworkAdminSocketHandler::Receive_SERVER_COMPANY_REMOVE
virtual NetworkRecvStatus Receive_SERVER_COMPANY_REMOVE(Packet *p)
Notification about a removed company (e.g.
Definition: tcp_admin.cpp:158
NetworkAdminSocketHandler::Receive_ADMIN_EXTERNAL_CHAT
virtual NetworkRecvStatus Receive_ADMIN_EXTERNAL_CHAT(Packet *p)
Send chat from the external source: string Name of the source this message came from.
Definition: tcp_admin.cpp:136
NetworkAdminSocketHandler::Receive_SERVER_WELCOME
virtual NetworkRecvStatus Receive_SERVER_WELCOME(Packet *p)
Welcome a connected admin to the game: string Name of the Server.
Definition: tcp_admin.cpp:145
NetworkAdminSocketHandler::Receive_SERVER_FULL
virtual NetworkRecvStatus Receive_SERVER_FULL(Packet *p)
The server is full (connection gets closed).
Definition: tcp_admin.cpp:141
ADMIN_FREQUENCY_QUARTERLY
@ ADMIN_FREQUENCY_QUARTERLY
The admin gets information about this on a quarterly basis.
Definition: tcp_admin.h:96
ADMIN_STATUS_INACTIVE
@ ADMIN_STATUS_INACTIVE
The admin is not connected nor active.
Definition: tcp_admin.h:70
NetworkAdminSocketHandler::Receive_SERVER_CLIENT_UPDATE
virtual NetworkRecvStatus Receive_SERVER_CLIENT_UPDATE(Packet *p)
Client update details on a specific client (e.g.
Definition: tcp_admin.cpp:152
ADMIN_PACKET_SERVER_DATE
@ ADMIN_PACKET_SERVER_DATE
The server tells the admin what the current game date is.
Definition: tcp_admin.h:43
ADMIN_PACKET_SERVER_ERROR
@ ADMIN_PACKET_SERVER_ERROR
The server tells the admin an error has occurred.
Definition: tcp_admin.h:37
NetworkAdminSocketHandler::Receive_SERVER_CHAT
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 ...
Definition: tcp_admin.cpp:161
NetworkAdminSocketHandler::Receive_SERVER_NEWGAME
virtual NetworkRecvStatus Receive_SERVER_NEWGAME(Packet *p)
Notification about a newgame.
Definition: tcp_admin.cpp:146
NetworkAdminSocketHandler
Main socket handler for admin related connections.
Definition: tcp_admin.h:112
ADMIN_PACKET_SERVER_COMPANY_REMOVE
@ ADMIN_PACKET_SERVER_COMPANY_REMOVE
The server tells the admin that a company was removed.
Definition: tcp_admin.h:52
ADMIN_FREQUENCY_POLL
@ ADMIN_FREQUENCY_POLL
The admin can poll this.
Definition: tcp_admin.h:92
ADMIN_PACKET_SERVER_CLIENT_ERROR
@ ADMIN_PACKET_SERVER_CLIENT_ERROR
The server tells the admin that a client caused an error.
Definition: tcp_admin.h:48
ADMIN_UPDATE_DATE
@ ADMIN_UPDATE_DATE
Updates about the date of the game.
Definition: tcp_admin.h:77
NetworkAdminSocketHandler::Receive_ADMIN_CHAT
virtual NetworkRecvStatus Receive_ADMIN_CHAT(Packet *p)
Send chat as the server: uint8 Action such as NETWORK_ACTION_CHAT_CLIENT (see NetworkAction).
Definition: tcp_admin.cpp:135
ADMIN_UPDATE_COMPANY_STATS
@ ADMIN_UPDATE_COMPANY_STATS
Updates about the statistics of companies.
Definition: tcp_admin.h:81
ADMIN_UPDATE_COMPANY_ECONOMY
@ ADMIN_UPDATE_COMPANY_ECONOMY
Updates about the economy of companies.
Definition: tcp_admin.h:80
NetworkAdminSocketHandler::HandlePacket
NetworkRecvStatus HandlePacket(Packet *p)
Handle the given packet, i.e.
Definition: tcp_admin.cpp:46
ADMIN_PACKET_SERVER_RCON
@ ADMIN_PACKET_SERVER_RCON
The server's reply to a remove console command.
Definition: tcp_admin.h:56
AdminCompanyRemoveReason
AdminCompanyRemoveReason
Reasons for removing a company - communicated to admins.
Definition: tcp_admin.h:103
ADMIN_PACKET_SERVER_CONSOLE
@ ADMIN_PACKET_SERVER_CONSOLE
The server gives the admin the data that got printed to its console.
Definition: tcp_admin.h:57
ADMIN_PACKET_SERVER_CLIENT_UPDATE
@ ADMIN_PACKET_SERVER_CLIENT_UPDATE
The server gives the admin an information update on a client.
Definition: tcp_admin.h:46
NetworkAdminSocketHandler::Receive_ADMIN_UPDATE_FREQUENCY
virtual NetworkRecvStatus Receive_ADMIN_UPDATE_FREQUENCY(Packet *p)
Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet): uint16 Upda...
Definition: tcp_admin.cpp:133
ADMIN_UPDATE_GAMESCRIPT
@ ADMIN_UPDATE_GAMESCRIPT
The admin would like to have gamescript messages.
Definition: tcp_admin.h:86
Packet
Internal entity of a packet.
Definition: packet.h:44
ADMIN_FREQUENCY_ANUALLY
@ ADMIN_FREQUENCY_ANUALLY
The admin gets information about this on a yearly basis.
Definition: tcp_admin.h:97
AdminUpdateType
AdminUpdateType
Update types an admin can register a frequency for.
Definition: tcp_admin.h:76
ADMIN_PACKET_SERVER_RCON_END
@ ADMIN_PACKET_SERVER_RCON_END
The server indicates that the remote console command has completed.
Definition: tcp_admin.h:61
ADMIN_CRR_AUTOCLEAN
@ ADMIN_CRR_AUTOCLEAN
The company is removed due to autoclean.
Definition: tcp_admin.h:105
ADMIN_PACKET_SERVER_FULL
@ ADMIN_PACKET_SERVER_FULL
The server tells the admin it cannot accept the admin.
Definition: tcp_admin.h:35
NetworkAdminSocketHandler::Receive_SERVER_COMPANY_UPDATE
virtual NetworkRecvStatus Receive_SERVER_COMPANY_UPDATE(Packet *p)
Company information of a specific company: uint8 ID of the company.
Definition: tcp_admin.cpp:157
ADMIN_PACKET_SERVER_CLIENT_JOIN
@ ADMIN_PACKET_SERVER_CLIENT_JOIN
The server tells the admin that a client has joined.
Definition: tcp_admin.h:44
NetworkAdminSocketHandler::GetAdminStatus
AdminStatus GetAdminStatus() const
Get the status of the admin.
Definition: tcp_admin.h:505
NetworkAdminSocketHandler::Receive_SERVER_CLIENT_INFO
virtual NetworkRecvStatus Receive_SERVER_CLIENT_INFO(Packet *p)
Client information of a specific client: uint32 ID of the client.
Definition: tcp_admin.cpp:151
ADMIN_CRR_MANUAL
@ ADMIN_CRR_MANUAL
The company is manually removed.
Definition: tcp_admin.h:104
ADMIN_PACKET_SERVER_CMD_NAMES
@ ADMIN_PACKET_SERVER_CMD_NAMES
The server sends out the names of the DoCommands to the admins.
Definition: tcp_admin.h:58
ADMIN_PACKET_SERVER_CLIENT_INFO
@ ADMIN_PACKET_SERVER_CLIENT_INFO
The server gives the admin information about a client.
Definition: tcp_admin.h:45
ADMIN_PACKET_ADMIN_PING
@ ADMIN_PACKET_ADMIN_PING
The admin sends a ping to the server, expecting a ping-reply (PONG) packet.
Definition: tcp_admin.h:32
NetworkRecvStatus
NetworkRecvStatus
Status of a network client; reasons why a client has quit.
Definition: core.h:22
tcp.h
ADMIN_FREQUENCY_AUTOMATIC
@ ADMIN_FREQUENCY_AUTOMATIC
The admin gets information about this when it changes.
Definition: tcp_admin.h:98
ADMIN_STATUS_ACTIVE
@ ADMIN_STATUS_ACTIVE
The admin is active.
Definition: tcp_admin.h:71
ADMIN_PACKET_SERVER_COMPANY_UPDATE
@ ADMIN_PACKET_SERVER_COMPANY_UPDATE
The server gives the admin an information update on a company.
Definition: tcp_admin.h:51
ADMIN_PACKET_ADMIN_QUIT
@ ADMIN_PACKET_ADMIN_QUIT
The admin tells the server that it is quitting.
Definition: tcp_admin.h:26
ADMIN_PACKET_SERVER_WELCOME
@ ADMIN_PACKET_SERVER_WELCOME
The server welcomes the admin to a game.
Definition: tcp_admin.h:39
NetworkAdminSocketHandler::Receive_ADMIN_GAMESCRIPT
virtual NetworkRecvStatus Receive_ADMIN_GAMESCRIPT(Packet *p)
Send a JSON string to the current active GameScript.
Definition: tcp_admin.cpp:138
NetworkAdminSocketHandler::Receive_SERVER_COMPANY_INFO
virtual NetworkRecvStatus Receive_SERVER_COMPANY_INFO(Packet *p)
Company information on a specific company: uint8 ID of the company.
Definition: tcp_admin.cpp:156
NetworkAdminSocketHandler::Receive_ADMIN_PING
virtual NetworkRecvStatus Receive_ADMIN_PING(Packet *p)
Ping the server, requiring the server to reply with a pong packet.
Definition: tcp_admin.cpp:139
PacketAdminType
PacketAdminType
Enum with types of TCP packets specific to the admin network.
Definition: tcp_admin.h:24
ADMIN_PACKET_SERVER_COMPANY_ECONOMY
@ ADMIN_PACKET_SERVER_COMPANY_ECONOMY
The server gives the admin some economy related company information.
Definition: tcp_admin.h:53
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
NetworkAdminSocketHandler::ReceiveInvalidPacket
NetworkRecvStatus ReceiveInvalidPacket(PacketAdminType type)
Helper for logging receiving invalid packets.
Definition: tcp_admin.cpp:125
error
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
Definition: openttd.cpp:134
ADMIN_PACKET_SERVER_CMD_LOGGING
@ ADMIN_PACKET_SERVER_CMD_LOGGING
The server gives the admin copies of incoming command packets.
Definition: tcp_admin.h:63
NetworkAdminSocketHandler::Receive_SERVER_CLIENT_JOIN
virtual NetworkRecvStatus Receive_SERVER_CLIENT_JOIN(Packet *p)
Notification of a new client: uint32 ID of the new client.
Definition: tcp_admin.cpp:150
os_abstraction.h
ADMIN_CRR_END
@ ADMIN_CRR_END
Sentinel for end.
Definition: tcp_admin.h:108
ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY
@ ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY
The admin tells the server the update frequency of a particular piece of information.
Definition: tcp_admin.h:27
NetworkAdminSocketHandler::Receive_SERVER_COMPANY_STATS
virtual NetworkRecvStatus Receive_SERVER_COMPANY_STATS(Packet *p)
Company statistics on stations and vehicles: uint8 ID of the company.
Definition: tcp_admin.cpp:160
ADMIN_PACKET_SERVER_BANNED
@ ADMIN_PACKET_SERVER_BANNED
The server tells the admin it is banned.
Definition: tcp_admin.h:36
ADMIN_FREQUENCY_WEEKLY
@ ADMIN_FREQUENCY_WEEKLY
The admin gets information about this on a weekly basis.
Definition: tcp_admin.h:94
NetworkAdminSocketHandler::Receive_ADMIN_JOIN
virtual NetworkRecvStatus Receive_ADMIN_JOIN(Packet *p)
Join the admin network: string Password the server is expecting for this network.
Definition: tcp_admin.cpp:131
ADMIN_PACKET_ADMIN_RCON
@ ADMIN_PACKET_ADMIN_RCON
The admin sends a remote console command.
Definition: tcp_admin.h:30
NetworkAdminSocketHandler::Receive_SERVER_COMPANY_ECONOMY
virtual NetworkRecvStatus Receive_SERVER_COMPANY_ECONOMY(Packet *p)
Economy update of a specific company: uint8 ID of the company.
Definition: tcp_admin.cpp:159
NetworkAdminSocketHandler::Receive_SERVER_RCON
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.
Definition: tcp_admin.cpp:162
ADMIN_CRR_BANKRUPT
@ ADMIN_CRR_BANKRUPT
The company went belly-up.
Definition: tcp_admin.h:106
ADMIN_UPDATE_END
@ ADMIN_UPDATE_END
Must ALWAYS be on the end of this list!! (period)
Definition: tcp_admin.h:87
ADMIN_STATUS_END
@ ADMIN_STATUS_END
Must ALWAYS be on the end of this list!! (period)
Definition: tcp_admin.h:72
AdminUpdateFrequency
AdminUpdateFrequency
Update frequencies an admin can register.
Definition: tcp_admin.h:91
NetworkAdminSocketHandler::Receive_SERVER_PONG
virtual NetworkRecvStatus Receive_SERVER_PONG(Packet *p)
Send a ping-reply (pong) to the admin that sent us the ping packet.
Definition: tcp_admin.cpp:167
NetworkAdminSocketHandler::Receive_ADMIN_QUIT
virtual NetworkRecvStatus Receive_ADMIN_QUIT(Packet *p)
Notification to the server that this admin is quitting.
Definition: tcp_admin.cpp:132
ADMIN_PACKET_ADMIN_POLL
@ ADMIN_PACKET_ADMIN_POLL
The admin explicitly polls for a piece of information.
Definition: tcp_admin.h:28
NetworkAdminSocketHandler::Receive_SERVER_SHUTDOWN
virtual NetworkRecvStatus Receive_SERVER_SHUTDOWN(Packet *p)
Notification about the server shutting down.
Definition: tcp_admin.cpp:147
NetworkTCPSocketHandler
Base socket handler for all TCP sockets.
Definition: tcp.h:32
NetworkAdminSocketHandler::NetworkAdminSocketHandler
NetworkAdminSocketHandler(SOCKET s)
Create the admin handler for the given socket.
Definition: tcp_admin.cpp:30
ADMIN_PACKET_SERVER_SHUTDOWN
@ ADMIN_PACKET_SERVER_SHUTDOWN
The server tells the admin its shutting down.
Definition: tcp_admin.h:41