From ed613b72c30f9dca6249c3e2623c0cbefc3a2e32 Mon Sep 17 00:00:00 2001 From: Jean-Roland Date: Tue, 11 Jun 2024 10:37:34 +0200 Subject: [PATCH] feat: use _z_bytes_t in value and sample --- include/zenoh-pico/api/primitives.h | 32 ++++++++++++++++++++---- include/zenoh-pico/api/types.h | 2 +- include/zenoh-pico/collections/slice.h | 7 +++++- include/zenoh-pico/net/sample.h | 2 +- include/zenoh-pico/protocol/codec/core.h | 2 ++ include/zenoh-pico/protocol/core.h | 4 +-- src/api/api.c | 30 +++++++++++----------- src/collections/slice.c | 26 ++++++++++++++++--- src/net/memory.c | 2 +- src/net/primitives.c | 2 +- src/net/reply.c | 2 +- src/net/sample.c | 12 ++++----- src/protocol/codec.c | 4 +++ src/protocol/codec/message.c | 6 ++--- src/protocol/core.c | 2 +- src/protocol/definitions/message.c | 2 +- 16 files changed, 95 insertions(+), 42 deletions(-) diff --git a/include/zenoh-pico/api/primitives.h b/include/zenoh-pico/api/primitives.h index 1c7a253ed..a301f93cf 100644 --- a/include/zenoh-pico/api/primitives.h +++ b/include/zenoh-pico/api/primitives.h @@ -414,9 +414,9 @@ int8_t z_encoding_null(z_owned_encoding_t *encoding); * value: Pointer to a :c:type:`z_loaned_value_t` to get data from. * * Return: - * Pointer to the data as a :c:type:`z_loaned_slice_t`. + * Pointer to the data as a :c:type:`z_loaned_bytes_t`. */ -const z_loaned_slice_t *z_value_payload(const z_loaned_value_t *value); +const z_loaned_bytes_t *z_value_payload(const z_loaned_value_t *value); /** * Gets date pointer of a bytes array. @@ -440,6 +440,28 @@ const uint8_t *z_slice_data(const z_loaned_slice_t *slice); */ size_t z_slice_len(const z_loaned_slice_t *slice); +/** + * Gets date pointer of a bytes array. + * + * Parameters: + * bytes: Pointer to a :c:type:`z_loaned_slice_t` to get data from. + * + * Return: + * The data pointer. + */ +const uint8_t *z_bytes_data(const z_loaned_bytes_t *bytes); + +/** + * Gets total number of bytes in a bytes array. + * + * Parameters: + * bytes: Pointer to a :c:type:`z_loaned_slice_t` to get length from. + * + * Return: + * The number of bytes. + */ +size_t z_bytes_len(const z_loaned_bytes_t *bytes); + /** * Decodes data into a :c:type:`z_owned_string_t` * @@ -872,9 +894,9 @@ const z_loaned_keyexpr_t *z_sample_keyexpr(const z_loaned_sample_t *sample); * sample: Pointer to a :c:type:`z_loaned_sample_t` to get the payload from. * * Return: - * The payload wrapped as a :c:type:`z_loaned_slice_t`. + * The payload wrapped as a :c:type:`z_loaned_bytes_t`. */ -const z_loaned_slice_t *z_sample_payload(const z_loaned_sample_t *sample); +const z_loaned_bytes_t *z_sample_payload(const z_loaned_sample_t *sample); /** * Gets the timestamp of a sample by aliasing it. @@ -1184,7 +1206,7 @@ void z_query_reply_options_default(z_query_reply_options_t *options); * Return: * ``0`` if reply operation successful, ``negative value`` otherwise. */ -int8_t z_query_reply(const z_loaned_query_t *query, const z_loaned_keyexpr_t *keyexpr, z_owned_slice_t *payload, +int8_t z_query_reply(const z_loaned_query_t *query, const z_loaned_keyexpr_t *keyexpr, z_owned_bytes_t *payload, const z_query_reply_options_t *options); #endif diff --git a/include/zenoh-pico/api/types.h b/include/zenoh-pico/api/types.h index 740aba6a1..db5ed490b 100644 --- a/include/zenoh-pico/api/types.h +++ b/include/zenoh-pico/api/types.h @@ -329,7 +329,7 @@ typedef struct { * z_owned_encoding_t *encoding: Payload encoding. */ typedef struct { - z_owned_slice_t *payload; + z_owned_bytes_t *payload; z_owned_encoding_t *encoding; z_query_consolidation_t consolidation; z_query_target_t target; diff --git a/include/zenoh-pico/collections/slice.h b/include/zenoh-pico/collections/slice.h index c2e8e651a..14bdc6a26 100644 --- a/include/zenoh-pico/collections/slice.h +++ b/include/zenoh-pico/collections/slice.h @@ -58,10 +58,15 @@ void _z_slice_free(_z_slice_t **bs); * _z_slice_t slice: content of the container. */ typedef struct { - _z_slice_t slice; + _z_slice_t _slice; } _z_bytes_t; +_Bool _z_bytes_check(_z_bytes_t bytes); +_z_bytes_t _z_bytes_null(void); void _z_bytes_copy(_z_bytes_t *dst, const _z_bytes_t *src); +_z_bytes_t _z_bytes_duplicate(const _z_bytes_t *src); +void _z_bytes_move(_z_bytes_t *dst, _z_bytes_t *src); +void _z_bytes_clear(_z_bytes_t *bytes); void _z_bytes_free(_z_bytes_t **bs); #endif /* ZENOH_PICO_COLLECTIONS_SLICE_H */ diff --git a/include/zenoh-pico/net/sample.h b/include/zenoh-pico/net/sample.h index 7fce5ed64..30e7ac97a 100644 --- a/include/zenoh-pico/net/sample.h +++ b/include/zenoh-pico/net/sample.h @@ -30,7 +30,7 @@ */ typedef struct _z_sample_t { _z_keyexpr_t keyexpr; - _z_slice_t payload; + _z_bytes_t payload; _z_timestamp_t timestamp; _z_encoding_t encoding; z_sample_kind_t kind; diff --git a/include/zenoh-pico/protocol/codec/core.h b/include/zenoh-pico/protocol/codec/core.h index 4d213e9d8..cfa32cbad 100644 --- a/include/zenoh-pico/protocol/codec/core.h +++ b/include/zenoh-pico/protocol/codec/core.h @@ -70,6 +70,8 @@ int8_t _z_slice_val_decode_na(_z_slice_t *bs, _z_zbuf_t *zbf); int8_t _z_slice_encode(_z_wbuf_t *buf, const _z_slice_t *bs); size_t _z_slice_encode_len(const _z_slice_t *bs); int8_t _z_slice_decode(_z_slice_t *bs, _z_zbuf_t *buf); +int8_t _z_bytes_decode(_z_bytes_t *bs, _z_zbuf_t *zbf); +int8_t _z_bytes_encode(_z_wbuf_t *wbf, const _z_bytes_t *bs); int8_t _z_zbuf_read_exact(_z_zbuf_t *zbf, uint8_t *dest, size_t length); int8_t _z_str_encode(_z_wbuf_t *buf, const char *s); diff --git a/include/zenoh-pico/protocol/core.h b/include/zenoh-pico/protocol/core.h index 57cbdf83a..5354dc2e4 100644 --- a/include/zenoh-pico/protocol/core.h +++ b/include/zenoh-pico/protocol/core.h @@ -223,11 +223,11 @@ typedef struct { * Represents a Zenoh value. * * Members: + * _z_bytes_t payload: The payload of this zenoh value. * _z_encoding_t encoding: The encoding of the `payload`. - * _z_slice_t payload: The payload of this zenoh value. */ typedef struct { - _z_slice_t payload; + _z_bytes_t payload; _z_encoding_t encoding; } _z_value_t; _z_value_t _z_value_null(void); diff --git a/src/api/api.c b/src/api/api.c index 885fa5ba4..a8a85342a 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -258,13 +258,15 @@ static _z_encoding_t _z_encoding_from_owned(const z_owned_encoding_t *encoding) return *encoding->_val; } -const z_loaned_slice_t *z_value_payload(const z_loaned_value_t *value) { return &value->payload; } +const z_loaned_bytes_t *z_value_payload(const z_loaned_value_t *value) { return &value->payload; } const uint8_t *z_slice_data(const z_loaned_slice_t *slice) { return slice->start; } size_t z_slice_len(const z_loaned_slice_t *slice) { return slice->len; } -int8_t z_slice_decode_into_string(const z_loaned_slice_t *slice, z_owned_string_t *s) { +const uint8_t *z_bytes_data(const z_loaned_bytes_t *bytes) { return bytes->_slice.start; } + +size_t z_bytes_len(const z_loaned_bytes_t *bytes) { return bytes->_slice.len; } int8_t z_bytes_decode_into_string(const z_loaned_bytes_t *bytes, z_owned_string_t *s) { // Init owned string @@ -274,7 +276,7 @@ int8_t z_bytes_decode_into_string(const z_loaned_bytes_t *bytes, z_owned_string_ return _Z_ERR_SYSTEM_OUT_OF_MEMORY; } // Convert slice to string - *s->_val = _z_string_from_bytes(&bytes->slice); + *s->_val = _z_string_from_bytes(&bytes->_slice); return _Z_RES_OK; } @@ -286,7 +288,7 @@ int8_t z_bytes_encode_from_string(z_owned_bytes_t *buffer, const z_loaned_string return _Z_ERR_SYSTEM_OUT_OF_MEMORY; } // Encode data - buffer->_val->slice = _z_slice_wrap((uint8_t *)s->val, s->len); + buffer->_val->_slice = _z_slice_wrap((uint8_t *)s->val, s->len); return _Z_RES_OK; } @@ -443,10 +445,10 @@ VIEW_FUNCTIONS_PTR(_z_string_vec_t, string_array) OWNED_FUNCTIONS_PTR(_z_slice_t, slice, _z_slice_copy, _z_slice_free) OWNED_FUNCTIONS_PTR(_z_bytes_t, bytes, _z_bytes_copy, _z_bytes_free) -static _z_slice_t _z_slice_from_owned_bytes(z_owned_slice_t *bytes) { - _z_slice_t b = _z_slice_empty(); +static _z_bytes_t _z_bytes_from_owned_bytes(z_owned_bytes_t *bytes) { + _z_bytes_t b = _z_bytes_null(); if ((bytes != NULL) && (bytes->_val != NULL)) { - b = _z_slice_wrap(bytes->_val->start, bytes->_val->len); + b._slice = _z_slice_wrap(bytes->_val->_slice.start, bytes->_val->_slice.len); } return b; } @@ -624,7 +626,7 @@ z_id_t z_info_zid(const z_loaned_session_t *zs) { return _Z_RC_IN_VAL(zs)._local const z_loaned_keyexpr_t *z_sample_keyexpr(const z_loaned_sample_t *sample) { return &_Z_RC_IN_VAL(sample).keyexpr; } z_sample_kind_t z_sample_kind(const z_loaned_sample_t *sample) { return _Z_RC_IN_VAL(sample).kind; } -const z_loaned_slice_t *z_sample_payload(const z_loaned_sample_t *sample) { return &_Z_RC_IN_VAL(sample).payload; } +const z_loaned_bytes_t *z_sample_payload(const z_loaned_sample_t *sample) { return &_Z_RC_IN_VAL(sample).payload; } z_timestamp_t z_sample_timestamp(const z_loaned_sample_t *sample) { return _Z_RC_IN_VAL(sample).timestamp; } const z_loaned_encoding_t *z_sample_encoding(const z_loaned_sample_t *sample) { return &_Z_RC_IN_VAL(sample).encoding; } z_qos_t z_sample_qos(const z_loaned_sample_t *sample) { return _Z_RC_IN_VAL(sample).qos; } @@ -860,7 +862,7 @@ int8_t z_get(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr, co opt.consolidation = options->consolidation; opt.target = options->target; opt.encoding = options->encoding; - opt.payload = z_slice_move(options->payload); + opt.payload = z_bytes_move(options->payload); #if Z_FEATURE_ATTACHMENT == 1 opt.attachment = options->attachment; #endif @@ -875,7 +877,7 @@ int8_t z_get(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr, co } } // Set value - _z_value_t value = {.payload = _z_slice_from_owned_bytes(opt.payload), + _z_value_t value = {.payload = _z_bytes_from_owned_bytes(opt.payload), .encoding = _z_encoding_from_owned(opt.encoding)}; ret = _z_query(&_Z_RC_IN_VAL(zs), *keyexpr, parameters, opt.target, opt.consolidation.mode, value, callback->call, @@ -886,7 +888,7 @@ int8_t z_get(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr, co #endif ); if (opt.payload != NULL) { - z_slice_drop(opt.payload); + z_bytes_drop(opt.payload); } // Clean-up z_encoding_drop(opt.encoding); @@ -956,7 +958,7 @@ int8_t z_undeclare_queryable(z_owned_queryable_t *queryable) { return _z_queryab void z_query_reply_options_default(z_query_reply_options_t *options) { options->encoding = NULL; } -int8_t z_query_reply(const z_loaned_query_t *query, const z_loaned_keyexpr_t *keyexpr, z_owned_slice_t *payload, +int8_t z_query_reply(const z_loaned_query_t *query, const z_loaned_keyexpr_t *keyexpr, z_owned_bytes_t *payload, const z_query_reply_options_t *options) { z_query_reply_options_t opts; if (options == NULL) { @@ -965,12 +967,12 @@ int8_t z_query_reply(const z_loaned_query_t *query, const z_loaned_keyexpr_t *ke opts = *options; } // Set value - _z_value_t value = {.payload = _z_slice_from_owned_bytes(payload), + _z_value_t value = {.payload = _z_bytes_from_owned_bytes(payload), .encoding = _z_encoding_from_owned(opts.encoding)}; int8_t ret = _z_send_reply(&query->in->val, *keyexpr, value, Z_SAMPLE_KIND_PUT, opts.attachment); if (payload != NULL) { - z_slice_drop(payload); + z_bytes_drop(payload); } // Clean-up z_encoding_drop(opts.encoding); diff --git a/src/collections/slice.c b/src/collections/slice.c index 3e29e78b2..57fea24c0 100644 --- a/src/collections/slice.c +++ b/src/collections/slice.c @@ -110,21 +110,39 @@ _Bool _z_slice_eq(const _z_slice_t *left, const _z_slice_t *right) { } /*-------- Bytes --------*/ +_Bool _z_bytes_check(_z_bytes_t bytes) { return _z_slice_check(bytes._slice); } + +_z_bytes_t _z_bytes_null(void) { + return (_z_bytes_t){ + ._slice = _z_slice_empty(), + }; +} + void _z_bytes_copy(_z_bytes_t *dst, const _z_bytes_t *src) { // Init only if needed - if (!_z_slice_check(dst->slice)) { - if (_z_slice_init(&dst->slice, src->slice.len) != _Z_RES_OK) { + if (!_z_slice_check(dst->_slice)) { + if (_z_slice_init(&dst->_slice, src->_slice.len) != _Z_RES_OK) { return; } } - (void)memcpy((uint8_t *)dst->slice.start, src->slice.start, src->slice.len); + (void)memcpy((uint8_t *)dst->_slice.start, src->_slice.start, src->_slice.len); +} + +_z_bytes_t _z_bytes_duplicate(const _z_bytes_t *src) { + _z_bytes_t dst = _z_bytes_null(); + _z_bytes_copy(&dst, src); + return dst; } +void _z_bytes_move(_z_bytes_t *dst, _z_bytes_t *src) { _z_slice_move(&dst->_slice, &src->_slice); } + +void _z_bytes_clear(_z_bytes_t *bytes) { _z_slice_clear(&bytes->_slice); } + void _z_bytes_free(_z_bytes_t **bs) { _z_bytes_t *ptr = *bs; if (ptr != NULL) { - _z_slice_clear(&ptr->slice); + _z_bytes_clear(ptr); z_free(ptr); *bs = NULL; diff --git a/src/net/memory.c b/src/net/memory.c index 5a41e38dd..1d60c338f 100644 --- a/src/net/memory.c +++ b/src/net/memory.c @@ -35,7 +35,7 @@ void _z_hello_free(_z_hello_t **hello) { void _z_value_clear(_z_value_t *value) { _z_encoding_clear(&value->encoding); - _z_slice_clear(&value->payload); + _z_bytes_clear(&value->payload); } void _z_value_free(_z_value_t **value) { diff --git a/src/net/primitives.c b/src/net/primitives.c index dc1867971..c19ae7824 100644 --- a/src/net/primitives.c +++ b/src/net/primitives.c @@ -359,7 +359,7 @@ int8_t _z_send_reply(const _z_query_t *query, _z_keyexpr_t keyexpr, const _z_val z_msg._body._response._tag = _Z_RESPONSE_BODY_REPLY; z_msg._body._response._body._reply._consolidation = Z_CONSOLIDATION_MODE_DEFAULT; z_msg._body._response._body._reply._body._is_put = true; - z_msg._body._response._body._reply._body._body._put._payload = payload.payload; + z_msg._body._response._body._reply._body._body._put._payload = payload.payload._slice; z_msg._body._response._body._reply._body._body._put._encoding = payload.encoding; z_msg._body._response._body._reply._body._body._put._commons._timestamp = _z_timestamp_null(); z_msg._body._response._body._reply._body._body._put._commons._source_info = _z_source_info_null(); diff --git a/src/net/reply.c b/src/net/reply.c index f9c5d953c..36866ff90 100644 --- a/src/net/reply.c +++ b/src/net/reply.c @@ -95,7 +95,7 @@ _z_reply_t _z_reply_create(_z_keyexpr_t keyexpr, z_reply_tag_t tag, _z_id_t id, _z_sample_t sample = _z_sample_null(); sample.keyexpr = keyexpr; // FIXME: call z_keyexpr_move or copy sample.encoding = encoding; // FIXME: call z_encoding_move or copy - _z_slice_copy(&sample.payload, payload); + _z_slice_copy(&sample.payload._slice, payload); sample.kind = kind; sample.timestamp = _z_timestamp_duplicate(timestamp); #if Z_FEATURE_ATTACHMENT == 1 diff --git a/src/net/sample.c b/src/net/sample.c index 04ffb8fbb..7d8ec345f 100644 --- a/src/net/sample.c +++ b/src/net/sample.c @@ -19,7 +19,7 @@ _z_sample_t _z_sample_null(void) { _z_sample_t s = { .keyexpr = _z_keyexpr_null(), - .payload = _z_slice_empty(), + .payload = _z_bytes_null(), .encoding = _z_encoding_null(), .timestamp = _z_timestamp_null(), .kind = 0, @@ -32,7 +32,7 @@ _z_sample_t _z_sample_null(void) { } _Bool _z_sample_check(const _z_sample_t *sample) { - return _z_keyexpr_check(sample->keyexpr) && _z_slice_check(sample->payload); + return _z_keyexpr_check(sample->keyexpr) && _z_bytes_check(sample->payload); } void _z_sample_move(_z_sample_t *dst, _z_sample_t *src) { @@ -40,7 +40,7 @@ void _z_sample_move(_z_sample_t *dst, _z_sample_t *src) { dst->keyexpr._suffix = src->keyexpr._suffix; // FIXME: call the z_keyexpr_move src->keyexpr._suffix = NULL; // FIXME: call the z_keyexpr_move - _z_slice_move(&dst->payload, &src->payload); + _z_bytes_move(&dst->payload, &src->payload); _z_encoding_move(&dst->encoding, &src->encoding); dst->timestamp.time = src->timestamp.time; // FIXME: call the z_timestamp_move @@ -49,7 +49,7 @@ void _z_sample_move(_z_sample_t *dst, _z_sample_t *src) { void _z_sample_clear(_z_sample_t *sample) { _z_keyexpr_clear(&sample->keyexpr); - _z_slice_clear(&sample->payload); + _z_bytes_clear(&sample->payload); _z_encoding_clear(&sample->encoding); _z_timestamp_clear(&sample->timestamp); #if Z_FEATURE_ATTACHMENT == 1 @@ -68,7 +68,7 @@ void _z_sample_free(_z_sample_t **sample) { void _z_sample_copy(_z_sample_t *dst, const _z_sample_t *src) { dst->keyexpr = _z_keyexpr_duplicate(src->keyexpr); - dst->payload = _z_slice_duplicate(&src->payload); + dst->payload = _z_bytes_duplicate(&src->payload); dst->timestamp = _z_timestamp_duplicate(&src->timestamp); _z_encoding_copy(&dst->encoding, &src->encoding); @@ -90,7 +90,7 @@ _z_sample_t _z_sample_create(const _z_keyexpr_t *key, const _z_slice_t *payload, const z_attachment_t att) { _z_sample_t s = _z_sample_null(); _z_keyexpr_copy(&s.keyexpr, key); - _z_slice_copy(&s.payload, payload); + _z_slice_copy(&s.payload._slice, payload); _z_encoding_copy(&s.encoding, &encoding); s.kind = kind; s.timestamp = timestamp; diff --git a/src/protocol/codec.c b/src/protocol/codec.c index c41789136..9ad0b9f2c 100644 --- a/src/protocol/codec.c +++ b/src/protocol/codec.c @@ -251,6 +251,10 @@ int8_t _z_slice_val_decode(_z_slice_t *bs, _z_zbuf_t *zbf) { return _z_slice_val int8_t _z_slice_decode(_z_slice_t *bs, _z_zbuf_t *zbf) { return _z_slice_decode_na(bs, zbf); } +int8_t _z_bytes_decode(_z_bytes_t *bs, _z_zbuf_t *zbf) { return _z_slice_decode_na(&bs->_slice, zbf); } + +int8_t _z_bytes_encode(_z_wbuf_t *wbf, const _z_bytes_t *bs) { return _z_slice_encode(wbf, &bs->_slice); } + /*------------------ string with null terminator ------------------*/ int8_t _z_str_encode(_z_wbuf_t *wbf, const char *s) { size_t len = strlen(s); diff --git a/src/protocol/codec/message.c b/src/protocol/codec/message.c index 361e6d75e..f52362677 100644 --- a/src/protocol/codec/message.c +++ b/src/protocol/codec/message.c @@ -435,9 +435,9 @@ int8_t _z_query_encode(_z_wbuf_t *wbf, const _z_msg_query_t *msg) { } _Z_RETURN_IF_ERR(_z_uint8_encode(wbf, extheader)); _Z_RETURN_IF_ERR( - _z_zsize_encode(wbf, _z_encoding_len(&msg->_ext_value.encoding) + msg->_ext_value.payload.len)); + _z_zsize_encode(wbf, _z_encoding_len(&msg->_ext_value.encoding) + msg->_ext_value.payload._slice.len)); _Z_RETURN_IF_ERR(_z_encoding_encode(wbf, &msg->_ext_value.encoding)); - _Z_RETURN_IF_ERR(_z_slice_val_encode(wbf, &msg->_ext_value.payload)); + _Z_RETURN_IF_ERR(_z_slice_val_encode(wbf, &msg->_ext_value.payload._slice)); } if (required_exts.info) { uint8_t extheader = _Z_MSG_EXT_ENC_ZBUF | 0x01; @@ -471,7 +471,7 @@ int8_t _z_query_decode_extensions(_z_msg_ext_t *extension, void *ctx) { _z_zbuf_t zbf = _z_slice_as_zbuf(extension->_body._zbuf._val); ret = _z_encoding_decode(&msg->_ext_value.encoding, &zbf); _z_slice_t bytes = _z_slice_wrap((uint8_t *)_z_zbuf_start(&zbf), _z_zbuf_len(&zbf)); - _z_slice_copy(&msg->_ext_value.payload, &bytes); + _z_slice_copy(&msg->_ext_value.payload._slice, &bytes); break; } #if Z_FEATURE_ATTACHMENT == 1 diff --git a/src/protocol/core.c b/src/protocol/core.c index a6e73d134..bfac0c69a 100644 --- a/src/protocol/core.c +++ b/src/protocol/core.c @@ -74,7 +74,7 @@ _z_value_t _z_value_steal(_z_value_t *value) { } void _z_value_copy(_z_value_t *dst, const _z_value_t *src) { _z_encoding_copy(&dst->encoding, &src->encoding); - _z_slice_copy(&dst->payload, &src->payload); + _z_bytes_copy(&dst->payload, &src->payload); } z_attachment_t z_attachment_null(void) { return (z_attachment_t){.data = NULL, .iteration_driver = NULL}; } diff --git a/src/protocol/definitions/message.c b/src/protocol/definitions/message.c index 947a0ec44..b9bb3ecb1 100644 --- a/src/protocol/definitions/message.c +++ b/src/protocol/definitions/message.c @@ -33,7 +33,7 @@ _z_msg_query_reqexts_t _z_msg_query_required_extensions(const _z_msg_query_t *ms z_attachment_t att = _z_encoded_as_attachment(&msg->_ext_attachment); #endif return (_z_msg_query_reqexts_t) { - .body = msg->_ext_value.payload.start != NULL || _z_encoding_check(&msg->_ext_value.encoding), + .body = msg->_ext_value.payload._slice.start != NULL || _z_encoding_check(&msg->_ext_value.encoding), .info = _z_id_check(msg->_ext_info._id) || msg->_ext_info._entity_id != 0 || msg->_ext_info._source_sn != 0, #if Z_FEATURE_ATTACHMENT == 1 .attachment = z_attachment_check(&att)