summaryrefslogtreecommitdiff
path: root/src/server.h
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-09-26 00:11:20 +0200
committerGitHub <noreply@github.com>2017-09-26 00:11:20 +0200
commit6f1c90720402415b62fb4d5e809ec7dbc1cd7f96 (patch)
tree6f94c2bbc2d343be50945a0074bc16da282a4bc1 /src/server.h
parent6df312a608912b3cb21d04532151e29e8b0c7301 (diff)
downloadminetest-6f1c90720402415b62fb4d5e809ec7dbc1cd7f96.tar.gz
minetest-6f1c90720402415b62fb4d5e809ec7dbc1cd7f96.tar.bz2
minetest-6f1c90720402415b62fb4d5e809ec7dbc1cd7f96.zip
Implement mod communication channels (#6351)
Implement network communication for channels * Implement ModChannel manager server side to route incoming messages from clients to other clients * Add signal handler switch on client & ModChannelMgr on client to handle channels * Add Lua API bindings + client packet sending + unittests * Implement server message sending * Add callback from received message handler to Lua API using registration method
Diffstat (limited to 'src/server.h')
-rw-r--r--src/server.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/server.h b/src/server.h
index 551bd2787..097be32c4 100644
--- a/src/server.h
+++ b/src/server.h
@@ -50,6 +50,7 @@ class IWritableCraftDefManager;
class BanManager;
class EventManager;
class Inventory;
+class ModChannelMgr;
class RemotePlayer;
class PlayerSAO;
class IRollbackManager;
@@ -144,6 +145,9 @@ public:
void handleCommand_Deprecated(NetworkPacket* pkt);
void handleCommand_Init(NetworkPacket* pkt);
void handleCommand_Init2(NetworkPacket* pkt);
+ void handleCommand_ModChannelJoin(NetworkPacket *pkt);
+ void handleCommand_ModChannelLeave(NetworkPacket *pkt);
+ void handleCommand_ModChannelMsg(NetworkPacket *pkt);
void handleCommand_RequestMedia(NetworkPacket* pkt);
void handleCommand_ClientReady(NetworkPacket* pkt);
void handleCommand_GotBlocks(NetworkPacket* pkt);
@@ -165,7 +169,8 @@ public:
void ProcessData(NetworkPacket *pkt);
- void Send(NetworkPacket* pkt);
+ void Send(NetworkPacket *pkt);
+ void Send(u16 peer_id, NetworkPacket *pkt);
// Helper for handleCommand_PlayerPos and handleCommand_Interact
void process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao,
@@ -319,6 +324,7 @@ public:
void DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason="");
void acceptAuth(u16 peer_id, bool forSudoMode);
void DenyAccess_Legacy(u16 peer_id, const std::wstring &reason);
+ void DisconnectPeer(u16 peer_id);
bool getClientConInfo(u16 peer_id, con::rtt_stat_type type, float* retval);
bool getClientInfo(u16 peer_id,ClientState* state, u32* uptime,
u8* ser_vers, u16* prot_vers, u8* major, u8* minor, u8* patch,
@@ -334,6 +340,11 @@ public:
virtual bool registerModStorage(ModMetadata *storage);
virtual void unregisterModStorage(const std::string &name);
+ bool joinModChannel(const std::string &channel);
+ bool leaveModChannel(const std::string &channel);
+ bool sendModChannelMessage(const std::string &channel, const std::string &message);
+ ModChannel *getModChannel(const std::string &channel);
+
// Bind address
Address m_bind_addr;
@@ -383,6 +394,8 @@ private:
float thickness,
const v2f &speed);
void SendOverrideDayNightRatio(u16 peer_id, bool do_override, float ratio);
+ void broadcastModChannelMessage(const std::string &channel,
+ const std::string &message, u16 from_peer);
/*
Send a node removal/addition event to all clients except ignore_id.
@@ -640,6 +653,9 @@ private:
// CSM flavour limits byteflag
u64 m_csm_flavour_limits = CSMFlavourLimit::CSM_FL_NONE;
u32 m_csm_noderange_limit = 8;
+
+ // ModChannel manager
+ std::unique_ptr<ModChannelMgr> m_modchannel_mgr;
};
/*