Skip to content
Struct Frame Logo

Struct Frame

Cross-platform code generation from Protocol Buffer definitions

Why Struct Frame

Zero-copy C/C++

Uses packed structs that map directly to memory. No encoding or decoding step required.

Flexible framing

Multiple frame profiles for different scenarios, from zero-overhead trusted links to robust multi-node networks.

Nested messages & arrays

Unlike Mavlink, supports complex message structures with nested messages and variable-length packing for arrays.

Cross-platform

Generate code for embedded C, server Python, and frontend TypeScript from a single proto definition.

Installation

Terminal window
pip install struct-frame

Quick Start

Create a schema, status.sf:

package example;
message Status {
option msgid = 1;
uint32 id = 1;
float value = 2;
}

Generate code:

Terminal window
# Python and C into generated/py and generated/c
struct-frame status.sf --lang py,c
# Every language, under build/gen/<lang>
struct-frame status.sf --lang all --out build/gen

Quick Language Reference

#include "example.structframe.hpp"
#include "frame_profiles.hpp"
structframe::example::Status msg{};
msg.id = 42;
msg.value = 3.14f;
// Fixed messages are packed structs; the writer frames them with a checksum
uint8_t buffer[64];
structframe::ProfileStandardWriter writer(buffer, sizeof(buffer));
writer.write(msg);