DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
protobuf.h File Reference

Protocol Buffers wire codec (DETWS_ENABLE_PROTOBUF) - zero-heap streaming writer. More...

#include "ServerConfig.h"

Go to the source code of this file.

Detailed Description

Protocol Buffers wire codec (DETWS_ENABLE_PROTOBUF) - zero-heap streaming writer.

  • cursor reader over caller buffers, the same shape as the shipped CBOR / MessagePack codecs. This is the standalone Protobuf deliverable; gRPC (framed Protobuf over HTTP/2) is gated on the HTTP/2 roadmap item.

Wire format (https://protobuf.dev/programming-guides/encoding/):

  • A field is a tag varint (field_number << 3) | wire_type then the value.
  • Varints are little-endian base-128 with the high bit as a continuation flag.
  • Wire types: 0 VARINT (int/uint/sint/bool/enum), 1 I64 (fixed64/double, 8 bytes LE), 2 LEN (string/bytes/embedded message), 5 I32 (fixed32/float, 4 bytes LE). Groups (3/4) are deprecated and rejected by the reader.
  • sint32/sint64 use ZigZag: (n << 1) ^ (n >> 31|63).

The writer encodes one field at a time into a caller buffer (fail-closed on overflow); embedded messages are built into a separate buffer and added with pb_bytes. The reader is a cursor: it decodes the field at the buffer head and reports bytes consumed.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file protobuf.h.