libcbor 0.12.0
libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.
Loading...
Searching...
No Matches
cbor_decoder_result Struct Reference

Streaming decoder result. More...

#include <data.h>

Data Fields

size_t read
 Input bytes read/consumed.
 
enum cbor_decoder_status status
 The decoding status.
 
size_t required
 Number of bytes in the input buffer needed to resume parsing.
 

Detailed Description

Streaming decoder result.

Definition at line 230 of file data.h.

Field Documentation

◆ read

size_t cbor_decoder_result::read

Input bytes read/consumed.

If this is less than the size of input buffer, the client will likely resume parsing starting at the next byte (e.g. buffer + result.read).

Set to 0 if the status is not CBOR_DECODER_FINISHED.

Definition at line 238 of file data.h.

◆ required

size_t cbor_decoder_result::required

Number of bytes in the input buffer needed to resume parsing.

Set to 0 unless the result status is CBOR_DECODER_NEDATA. If it is, then:

  • If at least one byte was passed, required will be set to the minimum number of bytes needed to invoke a decoded callback on the current prefix.

    For example: Attempting to decode a 1B buffer containing 0x19 will set required to 3 as 0x19 signals a 2B integer item, so we need at least 3B to continue (the 0x19 MTB byte and two bytes of data needed to invoke cbor_callbacks.uint16).

  • If there was no data at all, read will always be set to 1

Definition at line 257 of file data.h.

◆ status

enum cbor_decoder_status cbor_decoder_result::status

The decoding status.

Definition at line 241 of file data.h.


The documentation for this struct was generated from the following file: