Skip to content

Commit

Permalink
add support for tags of 64 bits wide
Browse files Browse the repository at this point in the history
  • Loading branch information
slegouix committed Mar 21, 2024
1 parent acbdd48 commit bf309e0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/nanocbor/nanocbor.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,18 @@ void nanocbor_leave_container(nanocbor_value_t *it,
*/
int nanocbor_get_tag(nanocbor_value_t *cvalue, uint32_t *tag);

/**
* @brief Retrieve a tag as positive uint64_t from the stream
*
* The resulting @p value is undefined if the result is an error condition
*
* @param[in] cvalue CBOR value to decode from
* @param[out] tag returned tag as positive integer
*
* @return NANOCBOR_OK on success
*/
int nanocbor_get_tag64(nanocbor_value_t *cvalue, uint64_t *tag);

/**
* @brief Retrieve a null value from the stream
*
Expand Down
5 changes: 5 additions & 0 deletions src/decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ int nanocbor_get_tag(nanocbor_value_t *cvalue, uint32_t *tag)
return res;
}

int nanocbor_get_tag64(nanocbor_value_t *cvalue, uint64_t *tag)
{
return _get_and_advance_uint64(cvalue, tag, NANOCBOR_TYPE_TAG);
}

int nanocbor_get_decimal_frac(nanocbor_value_t *cvalue, int32_t *e, int32_t *m)
{
int res = NANOCBOR_NOT_FOUND;
Expand Down

0 comments on commit bf309e0

Please sign in to comment.