ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
protocore_codec Struct Reference

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

#include <codec.h>

Public Attributes

void(* put_uint )(mmgr_span *w, uint64_t v)
void(* put_int )(mmgr_span *w, int64_t v)
void(* put_bytes )(mmgr_span *w, const uint8_t *data, size_t len)
void(* put_str )(mmgr_span *w, const char *s)
void(* put_str_n )(mmgr_span *w, const char *s, size_t len)
void(* put_bool )(mmgr_span *w, embed_bool b)
void(* put_null )(mmgr_span *w)
void(* put_float )(mmgr_span *w, float f)
void(* put_array )(mmgr_span *w, size_t count)
void(* put_map )(mmgr_span *w, size_t count)
void(* put_label )(mmgr_span *w, const char *name, int64_t num)
 Emit a map key, given both spellings of it.
protocore_codec_type(* peek )(mmgr_cspan *r)
embed_bool(* get_uint )(mmgr_cspan *r, uint64_t *out)
embed_bool(* get_int )(mmgr_cspan *r, int64_t *out)
embed_bool(* get_bytes )(mmgr_cspan *r, const uint8_t **out, size_t *len)
embed_bool(* get_str )(mmgr_cspan *r, const char **out, size_t *len)
embed_bool(* get_array )(mmgr_cspan *r, size_t *count)
embed_bool(* get_map )(mmgr_cspan *r, size_t *count)
embed_bool(* get_bool )(mmgr_cspan *r, embed_bool *out)
embed_bool(* get_null )(mmgr_cspan *r)
embed_bool(* get_float )(mmgr_cspan *r, float *out)

Detailed Description

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

Field order is the operation order every format declares and implements in. int, bool and float are keywords, so the members carry the put_ / get_ prefix that says which direction they run in.

Definition at line 51 of file codec.h.

Member Data Documentation

◆ put_uint

void(* protocore_codec::put_uint) (mmgr_span *w, uint64_t v)

Definition at line 54 of file codec.h.

◆ put_int

void(* protocore_codec::put_int) (mmgr_span *w, int64_t v)

Definition at line 55 of file codec.h.

◆ put_bytes

void(* protocore_codec::put_bytes) (mmgr_span *w, const uint8_t *data, size_t len)

Definition at line 56 of file codec.h.

◆ put_str

void(* protocore_codec::put_str) (mmgr_span *w, const char *s)

Definition at line 57 of file codec.h.

◆ put_str_n

void(* protocore_codec::put_str_n) (mmgr_span *w, const char *s, size_t len)

Definition at line 58 of file codec.h.

◆ put_bool

void(* protocore_codec::put_bool) (mmgr_span *w, embed_bool b)

Definition at line 59 of file codec.h.

◆ put_null

void(* protocore_codec::put_null) (mmgr_span *w)

Definition at line 60 of file codec.h.

◆ put_float

void(* protocore_codec::put_float) (mmgr_span *w, float f)

Definition at line 61 of file codec.h.

◆ put_array

void(* protocore_codec::put_array) (mmgr_span *w, size_t count)

Definition at line 62 of file codec.h.

◆ put_map

void(* protocore_codec::put_map) (mmgr_span *w, size_t count)

Definition at line 63 of file codec.h.

◆ put_label

void(* protocore_codec::put_label) (mmgr_span *w, const char *name, int64_t num)

Emit a map key, given both spellings of it.

A spec often names the same field differently per encoding: RFC 8428 labels a SenML base name "bn" in JSON and -2 in CBOR. That is the encoding's business, not the caller's, so the caller hands over both and the format picks the one it is specified to write. Without this the difference leaks upward and every producer keeps one walk per encoding.

Definition at line 73 of file codec.h.

◆ peek

protocore_codec_type(* protocore_codec::peek) (mmgr_cspan *r)

Definition at line 76 of file codec.h.

◆ get_uint

embed_bool(* protocore_codec::get_uint) (mmgr_cspan *r, uint64_t *out)

Definition at line 77 of file codec.h.

◆ get_int

embed_bool(* protocore_codec::get_int) (mmgr_cspan *r, int64_t *out)

Definition at line 78 of file codec.h.

◆ get_bytes

embed_bool(* protocore_codec::get_bytes) (mmgr_cspan *r, const uint8_t **out, size_t *len)

Definition at line 79 of file codec.h.

◆ get_str

embed_bool(* protocore_codec::get_str) (mmgr_cspan *r, const char **out, size_t *len)

Definition at line 80 of file codec.h.

◆ get_array

embed_bool(* protocore_codec::get_array) (mmgr_cspan *r, size_t *count)

Definition at line 81 of file codec.h.

◆ get_map

embed_bool(* protocore_codec::get_map) (mmgr_cspan *r, size_t *count)

Definition at line 82 of file codec.h.

◆ get_bool

embed_bool(* protocore_codec::get_bool) (mmgr_cspan *r, embed_bool *out)

Definition at line 83 of file codec.h.

◆ get_null

embed_bool(* protocore_codec::get_null) (mmgr_cspan *r)

Definition at line 84 of file codec.h.

◆ get_float

embed_bool(* protocore_codec::get_float) (mmgr_cspan *r, float *out)

Definition at line 85 of file codec.h.


The documentation for this struct was generated from the following file:
  • src/network_drivers/presentation/codec/codec.h