Make C struct match the binary API more closely

Also make the internal conversion function return errors properly
This commit is contained in:
2025-04-26 10:01:56 -04:00
parent a1b3c07f0e
commit c490d4eec6
2 changed files with 24 additions and 26 deletions

View File

@@ -20,13 +20,12 @@ struct SaprusMessage* zaprus_connect(const char* payload, size_t len);
struct SaprusMessage {
uint16_t packet_type;
uint16_t payload_len;
union {
struct {
struct {
char dest[4];
};
size_t payload_len;
char *payload;
} relay;
struct {
struct {
@@ -37,10 +36,10 @@ struct SaprusMessage {
char _reserved;
char options;
};
size_t payload_len;
char *payload;
} connection;
};
} headers;
char *payload;
};
// ptr should be freed by the caller.