From: Daniel Karbach Date: Sat, 5 Sep 2015 12:56:40 +0000 (+0200) Subject: documented packet structure X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=1812e1a29378526a59a346caa2348df3e7522049;p=blank.git documented packet structure --- diff --git a/doc/protocol b/doc/protocol index 63055a2..a20d8d6 100644 --- a/doc/protocol +++ b/doc/protocol @@ -1,3 +1,23 @@ +Structure +========= + +Offset Size Type Description + 0 4 data protocol tag, must be 0xFB1AB1AF + 4 2 uint sequence number + 6 2 uint sequence ack + 8 4 data bitfield with previous acks +12 1 uint type code for the payload +13 3 none padding, reserved for future use +16 0-484 data payload, contents and length vary, + mostly depending on the type code + +all multibyte values are in LE +the current code does no conversion, so only works on machines +with native LE (or BE if the server and all clients are on that, +but that's by accident and will break if conversion code is ever +added) + + Packets ======= diff --git a/src/net/Packet.hpp b/src/net/Packet.hpp index af2f872..5e9751c 100644 --- a/src/net/Packet.hpp +++ b/src/net/Packet.hpp @@ -27,6 +27,9 @@ struct Packet { std::uint32_t tag; TControl ctrl; std::uint8_t type; + std::uint8_t reserved1; + std::uint8_t reserved2; + std::uint8_t reserved3; } header; static constexpr std::size_t MAX_PAYLOAD_LEN = 500 - sizeof(Header);