Anjay Lite
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
anj_bytes_or_string_value_t Struct Reference

#include <defs.h>

Data Fields

const void * data
 
size_t offset
 
size_t chunk_length
 
size_t full_length_hint
 

Detailed Description

Represents a (possibly partial) string or opaque value.

Field Documentation

◆ chunk_length

size_t chunk_length

Length (in bytes) of valid data available at data.

  • In output contexts, if both chunk_length and full_length_hint are set to 0 and data is non-NULL, then the buffer is assumed to contain a null-terminated string, and its length will be determined using strlen().

◆ data

const void* data

Pointer to the data buffer.

In output contexts (e.g., responding to a Read), this points to the data that will be sent to the LwM2M server. In input contexts (e.g., handling a Write), this points to the data received from the server.

◆ full_length_hint

size_t full_length_hint

Full size (in bytes) of the entire resource, if known.

  • If all of offset, chunk_length and full_length_hint are 0, this is treated as a zero-length resource.
  • In output contexts, this must be either 0 or equal to chunk_length. Any other value will be considered an error.
  • In input contexts, this will remain 0 when receiving content formats that do not include length metadata (e.g., Plain Text). Once the last chunk is received, the field will be set to offset + chunk_length to indicate completion.

◆ offset

size_t offset

Offset (in bytes) from the beginning of the full resource value that the current data chunk represents.

  • In output contexts, this must always be set to 0.
  • In input contexts, this value may be non-zero when parsing a large resource split across multiple incoming packets.

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