tweak bbnow types

This commit is contained in:
2026-08-13 14:23:05 -05:00
parent de3572385b
commit 885a133080
3 changed files with 9 additions and 7 deletions
+4 -3
View File
@@ -36,6 +36,7 @@ union BlkBoxNowPubPacketData {
};
struct BBNowPubPacket {
// "bbnp" in ascii
const static uint32_t PUB_MAGIC_NUMBER = 0x6262'6E70;
// DISCOVERY packet size
const static size_t DISCOVERY_PACKET_SIZE = sizeof(PUB_MAGIC_NUMBER) + sizeof(BBNowPubPacketType) + sizeof(BlkBoxNowPubDiscoveryData);
@@ -47,13 +48,13 @@ struct BBNowPubPacket {
BlkBoxNowPubPacketData packet_data{};
/// The size of the serialized packet (in bytes).
size_t serialize_size();
size_t serialize_size() const;
/// Serializes the packet to a vector.
std::vector<uint8_t> serialize();
std::vector<uint8_t> serialize() const;
/// Serializes the packet into the given vector.
///
/// Returns the number of bytes written into the buffer.
size_t serialize_into(std::vector<uint8_t>& buf);
size_t serialize_into(std::vector<uint8_t>& buf) const;
/// Deserializes a packet from the given bytes.
static std::optional<BBNowPubPacket> deserialize(std::span<const uint8_t> bytes);