28 #define HANDLE_READ(ByteBuf, Proc, Type, Var) \
31 if (!ByteBuf.Proc(Var))\
41 #define HANDLE_PACKET_READ(ByteBuf, Proc, Type, Var) \
45 if (!ByteBuf.Proc(Var)) \
47 ByteBuf.CheckValid(); \
50 ByteBuf.CheckValid(); \
66 m_Out(a_Protocol.m_OutPacketBuffer),
67 m_Lock(a_Protocol.m_CSPacket),
std::basic_string_view< std::byte > ContiguousByteBufferView
unsigned long long UInt64
An object that can store incoming bytes and lets its clients read the bytes sequentially The bytes ar...
bool WriteXYZPosition64(Int32 a_BlockX, Int32 a_BlockY, Int32 a_BlockZ)
bool WriteXZYPosition64(Int32 a_BlockX, Int32 a_BlockY, Int32 a_BlockZ)
bool WriteBEUInt32(UInt32 a_Value)
bool WriteBEFloat(float a_Value)
bool WriteBEInt32(Int32 a_Value)
bool WriteBEInt64(Int64 a_Value)
bool WriteBEInt16(Int16 a_Value)
bool WriteBEUInt64(UInt64 a_Value)
bool WriteBool(bool a_Value)
bool WriteVarUTF8String(const AString &a_Value)
bool WriteBEInt8(Int8 a_Value)
bool WriteVarInt32(UInt32 a_Value)
bool Write(const void *a_Bytes, size_t a_Count)
Writes the bytes specified to the ringbuffer.
bool WriteBEUInt16(UInt16 a_Value)
bool WriteBEUInt8(UInt8 a_Value)
bool WriteBEDouble(double a_Value)
RAII for cCriticalSection - locks the CS on creation, unlocks on destruction.
Composes an individual packet in the protocol's m_OutPacketBuffer; sends it just before being destruc...
cProtocol::ePacketType GetPacketType() const
void WriteVarInt32(UInt32 a_Value)
void WriteUUID(const cUUID &a_UUID)
Writes the specified UUID as a 128-bit BigEndian integer.
void WriteBEUInt32(UInt32 a_Value)
void WriteBEInt32(Int32 a_Value)
void WriteXZYPosition64(int a_BlockX, int a_BlockY, int a_BlockZ)
Writes the specified block position as a single encoded 64-bit BigEndian integer.
void WriteBool(bool a_Value)
cProtocol::ePacketType m_PacketType
Type of the contained packet.
cCSLock m_Lock
The RAII lock preventing multithreaded access to the protocol buffer while constructing the packet.
void WriteXZYPosition64(const Vector3i a_Position)
Writes the specified block position as a single encoded 64-bit BigEndian integer.
static AString PacketTypeToStr(cProtocol::ePacketType a_PacketType)
Returns the human-readable representation of the packet type.
cProtocol & m_Protocol
The protocol instance in which the packet is being constructed.
void WriteXYZPosition64(int a_BlockX, int a_BlockY, int a_BlockZ)
Writes the specified block position as a single encoded 64-bit BigEndian integer.
void WriteBEUInt64(UInt64 a_Value)
~cPacketizer()
Sends the packet via the contained protocol's SendPacket() function.
void WriteBEFloat(float a_Value)
void WriteFPInt(double a_Value)
Writes the double value as a 27:5 fixed-point integer.
void WriteXYZPosition64(const Vector3i a_Position)
Writes the specified block position as a single encoded 64-bit BigEndian integer.
void WriteBEInt16(Int16 a_Value)
void WriteString(const AString &a_Value)
void WriteBEUInt8(UInt8 a_Value)
cPacketizer(cProtocol &a_Protocol, cProtocol::ePacketType a_PacketType)
Starts serializing a new packet into the protocol's m_OutPacketBuffer.
void WriteBEDouble(double a_Value)
void WriteBuf(const ContiguousByteBufferView a_Data)
void WriteBEInt64(Int64 a_Value)
void WriteBEUInt16(UInt16 a_Value)
void WriteByteAngle(double a_Angle)
Writes the specified angle using a single byte.
cByteBuffer & m_Out
The protocol's buffer for the constructed packet data.
void WriteBEInt8(Int8 a_Value)
virtual UInt32 GetPacketID(ePacketType a_Packet) const =0
Returns the protocol-specific packet ID given the protocol-agnostic packet enum.
ePacketType
Logical types of outgoing packets.