summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/tcp_admin.cpp4
-rw-r--r--src/network/core/tcp_admin.h41
2 files changed, 45 insertions, 0 deletions
diff --git a/src/network/core/tcp_admin.cpp b/src/network/core/tcp_admin.cpp
index aaa3c425a..3765b070c 100644
--- a/src/network/core/tcp_admin.cpp
+++ b/src/network/core/tcp_admin.cpp
@@ -80,6 +80,8 @@ NetworkRecvStatus NetworkAdminSocketHandler::HandlePacket(Packet *p)
ADMIN_COMMAND(ADMIN_PACKET_SERVER_CHAT)
ADMIN_COMMAND(ADMIN_PACKET_SERVER_RCON)
ADMIN_COMMAND(ADMIN_PACKET_SERVER_CONSOLE)
+ ADMIN_COMMAND(ADMIN_PACKET_SERVER_CMD_NAMES)
+ ADMIN_COMMAND(ADMIN_PACKET_SERVER_CMD_LOGGING)
default:
if (this->HasClientQuit()) {
@@ -155,5 +157,7 @@ DEFINE_UNAVAILABLE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_COMPANY_STATS)
DEFINE_UNAVAILABLE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CHAT)
DEFINE_UNAVAILABLE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_RCON)
DEFINE_UNAVAILABLE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CONSOLE)
+DEFINE_UNAVAILABLE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CMD_NAMES)
+DEFINE_UNAVAILABLE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CMD_LOGGING)
#endif /* ENABLE_NETWORK */
diff --git a/src/network/core/tcp_admin.h b/src/network/core/tcp_admin.h
index ee1e6f2db..1d15f398a 100644
--- a/src/network/core/tcp_admin.h
+++ b/src/network/core/tcp_admin.h
@@ -56,6 +56,8 @@ enum PacketAdminType {
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, ///< The server gives the admin copies of incoming command packets.
INVALID_ADMIN_PACKET = 0xFF, ///< An invalid marker for admin packets.
};
@@ -76,6 +78,8 @@ enum AdminUpdateType {
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_END ///< Must ALWAYS be on the end of this list!! (period)
};
@@ -340,6 +344,43 @@ protected:
*/
DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CONSOLE);
+ /**
+ * Send DoCommand names to the bot upon request only.
+ * Multiple of these packets can follow each other in order to provide
+ * all known DoCommand names.
+ *
+ * NOTICE: Data provided with this packet is not stable and will not be
+ * treated as such. Do not rely on IDs or names to be constant
+ * across different versions / revisions of OpenTTD.
+ * Data provided in this packet is for logging purposes only.
+ *
+ * These three fields are repeated until the packet is full:
+ * bool Data to follow.
+ * uint16 ID of the DoCommand.
+ * string Name of DoCommand.
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CMD_NAMES);
+
+ /**
+ * Send incoming command packets to the admin network.
+ * This is for logging purposes only.
+ *
+ * NOTICE: Data provided with this packet is not stable and will not be
+ * treated as such. Do not rely on IDs or names to be constant
+ * across different versions / revisions of OpenTTD.
+ * Data provided in this packet is for logging purposes only.
+ *
+ * uint32 ID of the client sending the command.
+ * uint8 ID of the company (0..MAX_COMPANIES-1).
+ * uint16 ID of the command.
+ * uint32 P1 (variable data passed to the command).
+ * uint32 P2 (variable data passed to the command).
+ * uint32 Tile where this is taking place.
+ * string Text passed to the command.
+ * uint32 Frame of execution.
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CMD_LOGGING);
+
NetworkRecvStatus HandlePacket(Packet *p);
public:
NetworkRecvStatus CloseConnection(bool error = true);