tweak bbnow types
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user