summaryrefslogtreecommitdiff
path: root/src/network/core/tcp_admin.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-10-17 17:36:23 +0000
committerrubidium <rubidium@openttd.org>2010-10-17 17:36:23 +0000
commitb4ce7fad7f79f100ef1aae22f9f79aa0b6a7d743 (patch)
tree6c14df857e98a982add7813a800c121297510642 /src/network/core/tcp_admin.h
parent7cc8a363d84fe013406703ae324bf5c22383fb2a (diff)
downloadopenttd-b4ce7fad7f79f100ef1aae22f9f79aa0b6a7d743.tar.xz
(svn r20967) -Add: infrastructure to send information to remote admins at specific intervals (dihedral)
Diffstat (limited to 'src/network/core/tcp_admin.h')
-rw-r--r--src/network/core/tcp_admin.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/network/core/tcp_admin.h b/src/network/core/tcp_admin.h
index dae41c5f5..3ed444257 100644
--- a/src/network/core/tcp_admin.h
+++ b/src/network/core/tcp_admin.h
@@ -28,6 +28,8 @@
enum PacketAdminType {
ADMIN_PACKET_ADMIN_JOIN, ///< The admin announces and authenticates itself to the server.
ADMIN_PACKET_ADMIN_QUIT, ///< The admin tells the server that it is quitting.
+ ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY, ///< The admin tells the server the update frequency of a particular piece of information.
+ ADMIN_PACKET_ADMIN_POLL, ///< The admin explicitly polls for a piece of information.
ADMIN_PACKET_SERVER_FULL = 100, ///< The server tells the admin it cannot accept the admin.
ADMIN_PACKET_SERVER_BANNED, ///< The server tells the admin it is banned.
@@ -47,6 +49,23 @@ enum AdminStatus {
ADMIN_STATUS_END ///< Must ALWAYS be on the end of this list!! (period)
};
+/** Update types an admin can register a frequency for */
+enum AdminUpdateType {
+ ADMIN_UPDATE_END ///< Must ALWAYS be on the end of this list!! (period)
+};
+
+/** Update frequencies an admin can register. */
+enum AdminUpdateFrequency {
+ ADMIN_FREQUENCY_POLL = 0x01, ///< The admin can poll this.
+ ADMIN_FREQUENCY_DAILY = 0x02, ///< The admin gets information about this on a daily basis.
+ ADMIN_FREQUENCY_WEEKLY = 0x04, ///< The admin gets information about this on a weekly basis.
+ ADMIN_FREQUENCY_MONTHLY = 0x08, ///< The admin gets information about this on a monthly basis.
+ ADMIN_FREQUENCY_QUARTERLY = 0x10, ///< The admin gets information about this on a quarterly basis.
+ ADMIN_FREQUENCY_ANUALLY = 0x20, ///< The admin gets information about this on a yearly basis.
+ ADMIN_FREQUENCY_AUTOMATIC = 0x40, ///< The admin gets information about this when it changes.
+};
+DECLARE_ENUM_AS_BIT_SET(AdminUpdateFrequency);
+
#define DECLARE_ADMIN_RECEIVE_COMMAND(type) virtual NetworkRecvStatus NetworkPacketReceive_## type ##_command(Packet *p)
#define DEF_ADMIN_RECEIVE_COMMAND(cls, type) NetworkRecvStatus cls ##NetworkAdminSocketHandler::NetworkPacketReceive_ ## type ## _command(Packet *p)
@@ -71,6 +90,20 @@ protected:
DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_ADMIN_QUIT);
/**
+ * Register updates to be sent at certain frequencies (as announced in the PROTOCOL packet):
+ * uint16 Update type (see #AdminUpdateType).
+ * uint16 Update frequency (see #AdminUpdateFrequency), setting #ADMIN_FREQUENCY_POLL is always ignored.
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY);
+
+ /**
+ * 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.
+ */
+ DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_ADMIN_POLL);
+
+ /**
* The server is full (connection gets closed).
*/
DECLARE_ADMIN_RECEIVE_COMMAND(ADMIN_PACKET_SERVER_FULL);