diff options
| author | Joe Hildebrand <joe-github@cursive.net> | 2015-04-01 00:04:32 -0600 |
|---|---|---|
| committer | Joe Hildebrand <joe-github@cursive.net> | 2015-04-01 00:04:32 -0600 |
| commit | be754341be643c83c7f7bccd34a8bb4f2824744e (patch) | |
| tree | d06173da69488a5d53f365a349bd740741d23568 /include | |
| parent | 086317455574684ee2923e3b7bab9cb51ef03531 (diff) | |
| download | platform_external_cn-cbor-be754341be643c83c7f7bccd34a8bb4f2824744e.tar.gz platform_external_cn-cbor-be754341be643c83c7f7bccd34a8bb4f2824744e.tar.bz2 platform_external_cn-cbor-be754341be643c83c7f7bccd34a8bb4f2824744e.zip | |
Add creation routines
Diffstat (limited to 'include')
| -rw-r--r-- | include/cn-cbor/cn-cbor.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/include/cn-cbor/cn-cbor.h b/include/cn-cbor/cn-cbor.h index 247da17..161d28c 100644 --- a/include/cn-cbor/cn-cbor.h +++ b/include/cn-cbor/cn-cbor.h @@ -14,6 +14,8 @@ extern "C" { } /* Duh. */ #endif +#include <stdint.h> + /** * All of the different kinds of CBOR values. */ @@ -209,7 +211,7 @@ typedef struct cn_cbor_context { * @param[out] errp Error, if NULL is returned * @return The parsed CBOR structure, or NULL on error */ -const cn_cbor* cn_cbor_decode(const unsigned char* buf, size_t len CBOR_CONTEXT, cn_cbor_errback *errp); +const cn_cbor* cn_cbor_decode(const uint8_t *buf, size_t len CBOR_CONTEXT, cn_cbor_errback *errp); /** * Get a value from a CBOR map that has the given string as a key. @@ -308,6 +310,36 @@ ssize_t cbor_encoder_write(uint8_t *buf, size_t buf_size, const cn_cbor *cb); +cn_cbor* cn_cbor_map_create(CBOR_CONTEXT_COMMA cn_cbor_errback *errp); + +cn_cbor* cn_cbor_data_create(const char* data, int len + CBOR_CONTEXT, + cn_cbor_errback *errp); + +cn_cbor* cn_cbor_string_create(const char* data + CBOR_CONTEXT, + cn_cbor_errback *errp); + +cn_cbor* cn_cbor_int_create(int64_t value + CBOR_CONTEXT, + cn_cbor_errback *errp); + +void cn_cbor_mapput_int(cn_cbor* cb_map, + int64_t key, cn_cbor* cb_value + CBOR_CONTEXT, + cn_cbor_errback *errp); + +void cn_cbor_mapput_string(cn_cbor* cb_map, + char* key, cn_cbor* cb_value + CBOR_CONTEXT, + cn_cbor_errback *errp); + +cn_cbor* cn_cbor_array_create(CBOR_CONTEXT_COMMA cn_cbor_errback *errp); + +void cn_cbor_array_append(cn_cbor* cb_array, + cn_cbor* cb_value, + cn_cbor_errback *errp); + #ifdef __cplusplus } #endif |
