Struct anj_bytes_or_string_value_t

Struct Documentation

struct anj_bytes_or_string_value_t

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.

Public Members

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.

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).

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().

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.