From 79f19b8369a0120fbf0bd0ee3739989fbbbca50e Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Tue, 18 Jul 2017 21:39:55 +0200 Subject: [CSM] Add flavour limits controlled by server (#5930) * [CSM] Add flavour limits controlled by server Server send flavour limits to client permitting to disable or limit some Lua calls * Add limits for reading nodedefs and itemdefs * flavour: Add lookup node limits * Merge get_node_or_nil into get_node. Sending fake node doesn't make sense in CSM, just return nil if node is not available for any reason * Add node range customization when noderange flavour is enabled (default 8 nodes) * Limit nodes range & disable chat message sending by default * Bump protocol version --- src/network/networkprotocol.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/network/networkprotocol.h') diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h index 759334839..b210d3d2e 100644 --- a/src/network/networkprotocol.h +++ b/src/network/networkprotocol.h @@ -17,8 +17,8 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef NETWORKPROTOCOL_HEADER -#define NETWORKPROTOCOL_HEADER +#pragma once + #include "util/string.h" /* @@ -168,6 +168,7 @@ with this program; if not, write to the Free Software Foundation, Inc., * sender * type (RAW, NORMAL, ANNOUNCE, SYSTEM) * content + Add TOCLIENT_CSM_FLAVOUR_LIMITS to define which CSM flavour should be limited */ #define LATEST_PROTOCOL_VERSION 35 @@ -313,6 +314,11 @@ enum ToClientCommand f1000 time_speed */ + TOCLIENT_CSM_FLAVOUR_LIMITS = 0x2A, + /* + u32 CSMFlavourLimits byteflag + */ + // (oops, there is some gap here) TOCLIENT_CHAT_MESSAGE = 0x2F, @@ -1003,5 +1009,12 @@ enum PlayerListModifer: u8 PLAYER_LIST_REMOVE, }; +enum CSMFlavourLimit : u64 { + CSM_FL_NONE = 0x00000000, + CSM_FL_LOOKUP_NODES = 0x00000001, // Limit node lookups + CSM_FL_CHAT_MESSAGES = 0x00000002, // Disable chat message sending from CSM + CSM_FL_READ_ITEMDEFS = 0x00000004, // Disable itemdef lookups + CSM_FL_READ_NODEDEFS = 0x00000008, // Disable nodedef lookups + CSM_FL_ALL = 0xFFFFFFFF, +}; -#endif -- cgit v1.2.3