|
BCNP 3.2.1
Batched Command Network Protocol
|
BCNP packet structures, encoding, and decoding utilities. More...
#include <bcnp/message_types.h>#include "bcnp/static_vector.h"#include "bcnp/packet_storage.h"#include <cstddef>#include <cstdint>#include <optional>#include <vector>Go to the source code of this file.
Classes | |
| struct | bcnp::PacketHeader |
| Parsed packet header structure. More... | |
| class | bcnp::MessageIterator< MsgType > |
| Forward iterator for zero-copy message access from packet payload. More... | |
| struct | bcnp::PacketView |
| Zero-copy view into a decoded packet buffer. More... | |
| struct | bcnp::TypedPacket< MsgType, Storage > |
| Generic packet containing messages of a specific type. More... | |
| struct | bcnp::DecodeViewResult |
| Result of decoding a packet from raw bytes. More... | |
Namespaces | |
| namespace | bcnp |
Typedefs | |
| template<typename MsgType , std::size_t Capacity = 64> | |
| using | bcnp::StaticTypedPacket = TypedPacket<MsgType, StaticVector<MsgType, Capacity>> |
| Convenience alias for stack-allocated real-time packets (default 64 messages) | |
| template<typename MsgType > | |
| using | bcnp::DynamicTypedPacket = TypedPacket<MsgType, std::vector<MsgType>> |
| Convenience alias for heap-allocated packets (backward compatible). | |
Enumerations | |
| enum class | bcnp::PacketError { bcnp::None , bcnp::TooSmall , bcnp::UnsupportedVersion , bcnp::TooManyMessages , bcnp::TooManyCommands = TooManyMessages , bcnp::Truncated , bcnp::InvalidFloat , bcnp::ChecksumMismatch , bcnp::UnknownMessageType , bcnp::HandshakeRequired , bcnp::SchemaMismatch } |
| Error codes returned by packet decoding operations. More... | |
Functions | |
| uint32_t | bcnp::ComputeCrc32 (const uint8_t *data, std::size_t length) |
| Compute CRC32 checksum for data integrity verification. | |
| template<typename MsgType , typename Storage > | |
| bool | bcnp::EncodeTypedPacket (const TypedPacket< MsgType, Storage > &packet, uint8_t *output, std::size_t capacity, std::size_t &bytesWritten) |
| Encode a typed packet to a pre-allocated buffer. | |
| template<typename MsgType , typename Storage > | |
| bool | bcnp::EncodeTypedPacket (const TypedPacket< MsgType, Storage > &packet, std::vector< uint8_t > &output) |
| Encode a typed packet to a dynamically-sized vector. | |
| template<typename MsgType > | |
| std::optional< TypedPacket< MsgType > > | bcnp::DecodeTypedPacket (const PacketView &view) |
| Decode messages from a PacketView into a typed packet. | |
| template<typename MsgType , typename Storage > | |
| std::optional< TypedPacket< MsgType, Storage > > | bcnp::DecodeTypedPacketAs (const PacketView &view) |
| Decode messages from a PacketView with custom storage type. | |
| DecodeViewResult | bcnp::DecodePacketViewWithSize (const uint8_t *data, std::size_t length, std::size_t wireSize) |
| Decode a packet with explicitly provided message wire size. | |
| DecodeViewResult | bcnp::DecodePacketView (const uint8_t *data, std::size_t length) |
| Decode a packet using the global message type registry. | |
| template<typename MsgType > | |
| DecodeViewResult | bcnp::DecodePacketViewAs (const uint8_t *data, std::size_t length) |
| Type-safe packet view decode using compile-time message type. | |
Variables | |
| constexpr std::size_t | bcnp::kChecksumSize = 4 |
| Size of CRC32 checksum in bytes. | |
| constexpr std::size_t | bcnp::kMaxMessagesPerPacket = 65535 |
| Maximum number of messages allowed in a single packet. | |
| constexpr uint8_t | bcnp::kFlagClearQueue = 0x01 |
| Packet flag: Clear command queue before processing this packet. | |
| constexpr uint8_t | bcnp::kProtocolMajor = kProtocolMajorV3 |
| Current protocol major version. | |
| constexpr uint8_t | bcnp::kProtocolMinor = kProtocolMinorV3 |
| Current protocol minor version. | |
| constexpr std::size_t | bcnp::kHeaderSize = kHeaderSizeV3 |
| Size of packet header in bytes. | |
| constexpr std::size_t | bcnp::kHeaderMajorIndex = 0 |
| Byte offset of major version in header. | |
| constexpr std::size_t | bcnp::kHeaderMinorIndex = 1 |
| Byte offset of minor version in header. | |
| constexpr std::size_t | bcnp::kHeaderFlagsIndex = 2 |
| Byte offset of flags byte in header. | |
BCNP packet structures, encoding, and decoding utilities.
This header defines the core packet format for the BCNP (Binary Control Network Protocol) including packet headers, typed packet containers, message iterators, and encoding/decoding functions. Supports both heap-allocated and stack-allocated (real-time safe) storage.
Definition in file packet.h.