Anjay Lite
Loading...
Searching...
No Matches
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

Representation of a string or opaque value (full or partial).

Used when the resource type is ANJ_DATA_TYPE_BYTES or ANJ_DATA_TYPE_STRING.

Field Documentation

◆ chunk_length

size_t chunk_length

Length (in bytes) of valid data at data.

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

◆ data

const void* data

Pointer to the data buffer.

  • In output contexts, this points to the data to be sent to the server.
  • In input contexts, this points to the data received from the server.

◆ full_length_hint

size_t full_length_hint

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

  • If offset, chunk_length and full_length_hint are all 0, the resource is treated as empty.
  • In output contexts, this must be either 0 or equal to chunk_length. Any other value is considered invalid.
  • In input contexts, this is 0 when receiving formats without length metadata (e.g., Plain Text). When the final fragment is received, it will be set to offset + chunk_length.

◆ offset

size_t offset

Absolute offset (in bytes) from the beginning of the resource value represented by this chunk.

  • In output contexts, this must always be 0.
  • In input contexts, this may be non-zero when the value is received in multiple fragments (e.g., blockwise transfer).

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