Skip to content
Minimal Zero-Footprint CBOR Decoder in C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
bin
samples
src
test
.gitignore
.travis.yml
Makefile
README.md
UNLICENSE

README.md

cb0r - Minimal Zero-Footprint CBOR Decoder in C

A one-pass minimal malloc-free walk of the raw bytes using a fast jump table to determine state transitions and decode a result.

  • public domain, single cb0r.c file with one ~200 line function
  • easy to use, just returns a given type, value, and offset locations in the bytes
  • no dependencies, designed for embedded use
  • requires no memory/malloc or copying, uses only what is passed in
  • safely stops on anything invalid

For other CBOR implementations check http://cbor.io/impls.html.

Usage

uint8_t *cb0r(uint8_t *start, uint8_t *stop, uint32_t skip, cb0r_t result)

  • processes one item by default into result (if provided)
  • returns end pointer to byte following the item value (may be == stop for complete, > stop for item value length overflow)
  • can very efficiently skip any number of leading items of any type
  • see header for result structure and types
  • fully supports maps, arrays, and indefinite length types
You can’t perform that action at this time.