From 1812e1a29378526a59a346caa2348df3e7522049 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Sat, 5 Sep 2015 14:56:40 +0200 Subject: [PATCH] documented packet structure --- doc/protocol | 20 ++++++++++++++++++++ src/net/Packet.hpp | 3 +++ 2 files changed, 23 insertions(+) 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); -- 2.39.2