ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
codec.h File Reference

One binary codec interface; a wire encoding is an instance of it. More...

#include "spatium/spatium.h"
#include "protocore_config.h"

Go to the source code of this file.

Classes

struct  protocore_codec
 A wire encoding: the ten writes, the peek, and the nine reads. More...
 

Typedefs

typedef PROTOCORE_BEGIN_DECLS enum PROTO_ENUM_PACKED protocore_codec_type
 The next item's type, reported by protocore_codec::peek without consuming it.
 

Enumerations

enum  PROTO_ENUM_PACKED {
  PROTOCORE_CODEC_UINT = 0 , PROTOCORE_CODEC_INT , PROTOCORE_CODEC_BYTES , PROTOCORE_CODEC_STR ,
  PROTOCORE_CODEC_ARRAY , PROTOCORE_CODEC_MAP , PROTOCORE_CODEC_BOOL , PROTOCORE_CODEC_NULL ,
  PROTOCORE_CODEC_FLOAT , PROTOCORE_CODEC_INVALID
}
 The next item's type, reported by protocore_codec::peek without consuming it. More...
 

Detailed Description

One binary codec interface; a wire encoding is an instance of it.

The interface fixes the operations, their order, and their signatures; a format supplies the function pointers. The order is the field order of the table, so a format whose operations drift out of order fails to compile.

Dispatch is a static const table of function pointers in rodata.

The region types come from spatium.h and the byte verbs from octetus_introitus_exitus.h. A codec allocates nothing and owns no buffer: it writes into a mmgr_span the caller bound and reads from a mmgr_cspan.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file codec.h.

Typedef Documentation

◆ protocore_codec_type

The next item's type, reported by protocore_codec::peek without consuming it.

One set of names across every format: CBOR calls a byte string "bytes" and MessagePack calls it "bin"; CBOR has "null" and MessagePack "nil". They are the same item, so they get one name here and the format maps its own tag onto it.

Enumeration Type Documentation

◆ PROTO_ENUM_PACKED

The next item's type, reported by protocore_codec::peek without consuming it.

One set of names across every format: CBOR calls a byte string "bytes" and MessagePack calls it "bin"; CBOR has "null" and MessagePack "nil". They are the same item, so they get one name here and the format maps its own tag onto it.

Enumerator
PROTOCORE_CODEC_UINT 
PROTOCORE_CODEC_INT 
PROTOCORE_CODEC_BYTES 
PROTOCORE_CODEC_STR 
PROTOCORE_CODEC_ARRAY 
PROTOCORE_CODEC_MAP 
PROTOCORE_CODEC_BOOL 
PROTOCORE_CODEC_NULL 
PROTOCORE_CODEC_FLOAT 
PROTOCORE_CODEC_INVALID 

end of buffer, a prior error, or an item this format does not carry

Definition at line 38 of file codec.h.