Closed zephyrbot closed 6 years ago
by Leandro Pereira:
What's this story about? Implementing CBOR? If so, I'd just use [TinyCBOR|https://github.com/01org/tinycbor]. I've used it before, and it's well implemented, and it would fit Zephyr environment.
by Anas Nashif:
just import tinyCBOR, no implement anything from scratch
by Leandro Pereira:
I had some discussions with Thiago Macieira (TinyCBOR author) today about this and some of the required changes so that the library would work with fragmented buffers such as struct net_buf. We have a solution for the encoder but we're still unsure about the parser yet.
by Leandro Pereira:
About the parser: the plan is to convert the parser to work with scattered buffers (such as struct iovec from POSIX). This will require some surgery in the parser, by providing macros and/or inline functions to manipulate the parser iterator pointer. The changes can be performed with minimal impact (if any) on the common case (contiguous buffer) performance.
Once these changes have been merged upstream, the library can then be imported to Zephyr. A simple shim that will convert a struct net_buf to the iovec struct used by TinyCBOR will be provided, so that values can be parsed directly from the network, without requiring buffer linearization.
by ethan gao:
It's planned to check it within use case such as in iotivity and no dedicated test to develop for it
by Mark Linkmeyer:
Leandro Pereira , is this high priority story in progress yet?
by Leandro Pereira:
After ethan gao 's comment, I don't know if we need this library in Zephyr -- if it's going to be used only as a dependency for IoTivity Constrained, it's already part of their library, and importing it in Zephyr wouldn't help at all.
If there are plans or users for TinyCBOR in Zephyr, I can import the library as-is, and then work to make it work with fragmented data structures as I discussed with Thiago Macieira; however, I haven't started working on that yet. It'll require a little bit of surgery in TinyCBOR, and it's quite tricky to get right.
Reported by Anas Nashif:
from RFC7049:
The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation. These design goals make it different from earlier binary serializations such as ASN.1 and MessagePack.
(Imported from Jira ZEP-1620)