summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-06-28 23:12:01 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2021-07-06 22:33:03 +0200
commite735faf7558aff457432a14bdfde893b33d4d311 (patch)
tree35c76c2849b160c4fa112de6fce7a793ed670b9c /src/Protocol/Protocol.h
parentRemove outdated comment and redundant check (diff)
downloadcuberite-e735faf7558aff457432a14bdfde893b33d4d311.tar
cuberite-e735faf7558aff457432a14bdfde893b33d4d311.tar.gz
cuberite-e735faf7558aff457432a14bdfde893b33d4d311.tar.bz2
cuberite-e735faf7558aff457432a14bdfde893b33d4d311.tar.lz
cuberite-e735faf7558aff457432a14bdfde893b33d4d311.tar.xz
cuberite-e735faf7558aff457432a14bdfde893b33d4d311.tar.zst
cuberite-e735faf7558aff457432a14bdfde893b33d4d311.zip
Diffstat (limited to 'src/Protocol/Protocol.h')
-rw-r--r--src/Protocol/Protocol.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h
index 334d8d56b..de420308b 100644
--- a/src/Protocol/Protocol.h
+++ b/src/Protocol/Protocol.h
@@ -346,10 +346,15 @@ public:
Game = 3,
};
- /** Called to process them, when client sends some data.
+ /** Called by cClientHandle to process data, when the client sends some.
The protocol uses the provided buffers for storage and processing, and must have exclusive access to them. */
virtual void DataReceived(cByteBuffer & a_Buffer, ContiguousByteBuffer && a_Data) = 0;
+ /** Called by cClientHandle to finalise a buffer of prepared data before they are sent to the client.
+ Descendants may for example, encrypt the data if needed.
+ The protocol modifies the provided buffer in-place. */
+ virtual void DataPrepared(ContiguousByteBuffer & a_Data) = 0;
+
// Sending stuff to clients (alphabetically sorted):
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle) = 0;
virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) = 0;
@@ -466,9 +471,6 @@ protected:
/** Returns the current protocol's version, for handling status requests. */
virtual Version GetProtocolVersion() const = 0;
- /** A generic data-sending routine, all outgoing packet data needs to be routed through this so that descendants may override it. */
- virtual void SendData(ContiguousByteBufferView a_Data) = 0;
-
/** Sends a single packet contained within the cPacketizer class.
The cPacketizer's destructor calls this to send the contained packet; protocol may transform the data (compression in 1.8 etc). */
virtual void SendPacket(cPacketizer & a_Packet) = 0;