diff options
Diffstat (limited to 'src/Protocol/Protocol.h')
-rw-r--r-- | src/Protocol/Protocol.h | 10 |
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; |