Flexible Packet
FlexiblePacket is a packet that stores a packed 4 byte header which holds info on how many of what types the packet contains within
Info
| Name | Value |
|---|---|
| Estimated Size | See Estimated Size |
Network Structure
| Name | Type/Size | Notes |
|---|---|---|
| Packed Header | Int (0x04) | See Packed Header Structure |
| Strings | Utf[String Count] | Max of 255 strings |
| Varints | Varint[Varint Count] | Max of 4096 varints |
| Bools | 1 byte (only if any bools in header) | Max of 8 booleans which are packed into one byte |
| Floats | Float[Float count] (0x04 * floatCount) | Max of 15 floats |
Class Structure
| Name | Type | Notes |
|---|---|---|
| Packet | 0x18 (24 bytes) | Base class |
| Strings | std::vector<std::wstring> (24 bytes) | Holds all strings present in the packet |
| Varints | std::vector<int> (24 bytes) | Holds all varints present in the packet |
| Booleans | std::vector<bool> (24 bytes) | Holds all booleans present in the packet |
| Floats | std::vector<float> (24 bytes) | Holds all floats present in the packet |
Packed Header Structure
| Byte 0 | Strings | |
| Byte 1 | Varints | |
| Byte 2 | ||
| Booleans | ||
| Byte 3 | ||
| Floats | ||
Estimated Size
cpp
sizeof(int) // 4 byte packed header
+ (sizeof(int) * mVarints.size() // All varints * size of int
+ strings // Length of all strings
+ (!mBools.empty()) // 1 if there are any bools
+ sizeof(float) * mFloats.size()); // All floats * size of float