8 : m_dispatcher(dispatcher), m_adapter(adapter) {
10 m_rxScratch.resize(8192);
15 constexpr std::size_t kMaxChunksPerPoll = 10;
16 for (std::size_t i = 0; i < kMaxChunksPerPoll; ++i) {
17 const std::size_t received = m_adapter.
ReceiveChunk(m_rxScratch.data(), m_rxScratch.size());
21 m_dispatcher.
PushBytes(m_rxScratch.data(), received);
virtual std::size_t ReceiveChunk(uint8_t *buffer, std::size_t maxLength)=0
Receive available bytes from the transport (non-blocking).
virtual bool SendBytes(const uint8_t *data, std::size_t length)=0
Send bytes over the transport.
DispatcherDriver(PacketDispatcher &dispatcher, DuplexAdapter &adapter)
bool SendBytes(const uint8_t *data, std::size_t length)
Send raw bytes through the adapter.
void PollOnce()
Poll transport and feed data to dispatcher.
Combined send/receive interface for bidirectional transports.
Parses BCNP stream and dispatches packets to registered handlers.
void PushBytes(const uint8_t *data, std::size_t length)
Feed raw bytes from transport (thread-safe)
BCNP packet structures, encoding, and decoding utilities.