xref: /aosp_15_r20/external/cn-cbor/README.md (revision 254b1274ba1d768fbd68f5671e61c44001b5d4a8)
1*254b1274SAndroid Build Coastguard Worker[![Build Status](https://travis-ci.org/cabo/cn-cbor.png?branch=master)](https://travis-ci.org/cabo/cn-cbor)
2*254b1274SAndroid Build Coastguard Worker
3*254b1274SAndroid Build Coastguard Worker# cn-cbor: A constrained node implementation of CBOR in C
4*254b1274SAndroid Build Coastguard Worker
5*254b1274SAndroid Build Coastguard WorkerBelow is the original README for cn-cbor, a Proof of Concept
6*254b1274SAndroid Build Coastguard Workerimplementation of [CBOR](https://cbor.io) that I wrote in 2013.
7*254b1274SAndroid Build Coastguard WorkerPeople have been sending me fixes and updates to make this
8*254b1274SAndroid Build Coastguard Workerimplementation more useful for actual use, and for a while I have
9*254b1274SAndroid Build Coastguard Workeroccasionally integrated them.  Jim Schaad now is so far ahead of this
10*254b1274SAndroid Build Coastguard Workerrepo that you are most likely better off using [his
11*254b1274SAndroid Build Coastguard Workerrepo](https://github.com/jimsch/cn-cbor) as your upstream.
12*254b1274SAndroid Build Coastguard Worker
13*254b1274SAndroid Build Coastguard WorkerIf you *are* here looking for experimental CBOR implementations for
14*254b1274SAndroid Build Coastguard Workerconstrained nodes, there are many, some of which are listed at
15*254b1274SAndroid Build Coastguard Worker[cbor.io](https://cbor.io/impls.html).  One more: I have recently
16*254b1274SAndroid Build Coastguard Worker[extracted](https://github.com/cabo/bm_cbor) the implementation from
17*254b1274SAndroid Build Coastguard WorkerARM-mbed's [SUIT manifest
18*254b1274SAndroid Build Coastguard Workergenerator](https://github.com/ARMmbed/suit-manifest-generator) (Apache
19*254b1274SAndroid Build Coastguard Worker2.0).  SUIT implementers report (CBOR-specific) code sizes in the low
20*254b1274SAndroid Build Coastguard Workerhundreds of bytes.  Thank you, [ARM](https://github.com/bremoran).
21*254b1274SAndroid Build Coastguard Worker
22*254b1274SAndroid Build Coastguard Worker# cn-cbor: A constrained node implementation of CBOR in C
23*254b1274SAndroid Build Coastguard Worker
24*254b1274SAndroid Build Coastguard WorkerThis is a constrained node implementation of [CBOR](http://cbor.io) in
25*254b1274SAndroid Build Coastguard WorkerC that I threw together in 2013, before the publication of
26*254b1274SAndroid Build Coastguard Worker[RFC 7049](http://tools.ietf.org/html/rfc7049), to validate certain
27*254b1274SAndroid Build Coastguard Workerimplementability considerations.
28*254b1274SAndroid Build Coastguard Worker
29*254b1274SAndroid Build Coastguard WorkerIts API model was inspired by
30*254b1274SAndroid Build Coastguard Worker[nxjson](https://bitbucket.org/yarosla/nxjson).  It turns out that
31*254b1274SAndroid Build Coastguard Workerthis API model actually works even better with the advantages of the
32*254b1274SAndroid Build Coastguard WorkerCBOR format.
33*254b1274SAndroid Build Coastguard Worker
34*254b1274SAndroid Build Coastguard WorkerThis code has been used in a number of research implementations on
35*254b1274SAndroid Build Coastguard Workerconstrained nodes, with resulting code sizes appreciably under 1 KiB
36*254b1274SAndroid Build Coastguard Workeron ARM platforms.
37*254b1274SAndroid Build Coastguard Worker
38*254b1274SAndroid Build Coastguard WorkerI always meant to improve the interface some more with certain API
39*254b1274SAndroid Build Coastguard Workerchanges, in order to get even closer to 0.5 KiB, but I ran out of
40*254b1274SAndroid Build Coastguard Workertime.  So here it is.  If I do get around to making these changes, the
41*254b1274SAndroid Build Coastguard WorkerAPI will indeed change a bit, so please be forewarned.
42*254b1274SAndroid Build Coastguard Worker
43*254b1274SAndroid Build Coastguard Worker## Building
44*254b1274SAndroid Build Coastguard Worker
45*254b1274SAndroid Build Coastguard WorkerThere is a `Simple-Makefile` for playing around, as well as a complete
46*254b1274SAndroid Build Coastguard Worker[`cmake`](http://www.cmake.org)-based build environment.
47*254b1274SAndroid Build Coastguard Worker(You can choose what fits your needs better.)
48*254b1274SAndroid Build Coastguard Worker
49*254b1274SAndroid Build Coastguard WorkerBuilding with `cmake`:
50*254b1274SAndroid Build Coastguard Worker
51*254b1274SAndroid Build Coastguard Worker    ./build.sh
52*254b1274SAndroid Build Coastguard Worker
53*254b1274SAndroid Build Coastguard WorkerBuilding including testing:
54*254b1274SAndroid Build Coastguard Worker
55*254b1274SAndroid Build Coastguard Worker    ./build.sh all test
56*254b1274SAndroid Build Coastguard Worker
57*254b1274SAndroid Build Coastguard WorkerGenerating a test coverage report (requires lcov[^1]; result in `build/lcov/index.html`):
58*254b1274SAndroid Build Coastguard Worker
59*254b1274SAndroid Build Coastguard Worker    ./build.sh all coveralls coverage_report
60*254b1274SAndroid Build Coastguard Worker
61*254b1274SAndroid Build Coastguard WorkerLicense: MIT
62*254b1274SAndroid Build Coastguard Worker
63*254b1274SAndroid Build Coastguard Worker[^1]: Installation with homebrew: `brew install lcov`
64