summaryrefslogtreecommitdiff
path: root/src/network/core/tcp_admin.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-10-17 17:37:26 +0000
committerrubidium <rubidium@openttd.org>2010-10-17 17:37:26 +0000
commitfe44944f326b08e6b005aef8bfcf546467b5b136 (patch)
tree5cfe8965da332f4d7299a4f11b86dfe4779a9aa7 /src/network/core/tcp_admin.h
parent901c4a56bd29b687bee0cd7ffa49e8c9a08b9bf9 (diff)
downloadopenttd-fe44944f326b08e6b005aef8bfcf546467b5b136.tar.xz
(svn r20969) -Add: client info change notification to remote admins (dihedral)
Diffstat (limited to 'src/network/core/tcp_admin.h')
-rw-r--r--src/network/core/tcp_admin.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/network/core/tcp_admin.h b/src/network/core/tcp_admin.h
index f93b5c388..656fa9503 100644
--- a/src/network/core/tcp_admin.h
+++ b/src/network/core/tcp_admin.h
@@ -40,6 +40,11 @@ enum PacketAdminType {
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.
INVALID_ADMIN_PACKET = 0xFF, ///< An invalid marker for admin packets.
};
@@ -54,6 +59,7 @@ enum AdminStatus {
/** Update types an admin can register a frequency for */
enum AdminUpdateType {
ADMIN_UPDATE_DATE, ///< Updates about the date of the game.
+ ADMIN_UPDATE_CLIENT_INFO, ///< Updates about the information of clients.
ADMIN_UPDATE_END ///< Must ALWAYS be on the end of this list!! (period)
};
@@ -102,7 +108,8 @@ protected:
/**
* Poll the server for certain updates, an invalid poll (e.g. not existent id) gets silently dropped:
* uint8 #AdminUpdateType the server should answer for, only if #AdminUpdateFrequency #ADMIN_FREQUENCY_POLL is advertised in the PROTOCOL packet.
- * uint32 ID relevant to the packet type.
+ * uint32 ID relevant to the packet type, e.g.
+ * - the client ID for #ADMIN_UPDATE_CLIENT_INFO. Use UINT32_MAX to show all clients.
*/
DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_ADMIN_POLL);
@@ -161,6 +168,44 @@ protected:
*/
DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_DATE);
+ /**
+ * Notification of a new client:
+ * uint32 ID of the new client.
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CLIENT_JOIN);
+
+ /**
+ * Client information of a specific client:
+ * uint32 ID of the client.
+ * string Network address of the client.
+ * string Name of the client.
+ * uint8 Language of the client.
+ * uint32 Date the client joined the game.
+ * uint8 ID of the company the client is playing as (255 for spectators).
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CLIENT_INFO);
+
+ /**
+ * Client update details on a specific client (e.g. after rename or move):
+ * uint32 ID of the client.
+ * string Name of the client.
+ * uint8 ID of the company the client is playing as (255 for spectators).
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CLIENT_UPDATE);
+
+ /**
+ * Notification about a client leaving the game.
+ * uint32 ID of the client that just left.
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CLIENT_QUIT);
+
+ /**
+ * Notification about a client error (and thus the clients disconnection).
+ * uint32 ID of the client that made the error.
+ * uint8 Error the client made (see NetworkErrorCode).
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_CLIENT_ERROR);
+
NetworkRecvStatus HandlePacket(Packet *p);
public:
NetworkRecvStatus CloseConnection(bool error = true);