Skip to content

Commit

Permalink
rename zz_bytes -> z_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Jun 24, 2024
1 parent ed88be7 commit 38cbee0
Show file tree
Hide file tree
Showing 31 changed files with 389 additions and 389 deletions.
6 changes: 3 additions & 3 deletions include/zenoh-pico/api/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ _Z_LOANED_TYPE(_z_slice_t, slice)
* Members:
* _z_slice_t slice: content of the container.
*/
_Z_OWNED_TYPE_PTR(_zz_bytes_t, bytes)
_Z_LOANED_TYPE(_zz_bytes_t, bytes)
_Z_OWNED_TYPE_PTR(_z_bytes_t, bytes)
_Z_LOANED_TYPE(_z_bytes_t, bytes)

/**
* An iterator over multi-element serialized data
*/
typedef _zz_bytes_iterator_t z_bytes_iterator_t;
typedef _z_bytes_iterator_t z_bytes_iterator_t;

/**
* Represents a string without null-terminator.
Expand Down
90 changes: 45 additions & 45 deletions include/zenoh-pico/collections/bytes.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,60 +43,60 @@ _Z_SVEC_DEFINE(_z_arc_slice, _z_arc_slice_t)

typedef struct {
_z_arc_slice_svec_t _slices;
} _zz_bytes_t;
} _z_bytes_t;

_Bool _zz_bytes_check(const _zz_bytes_t *bytes);
_zz_bytes_t _zz_bytes_null(void);
int8_t _zz_bytes_append(_zz_bytes_t *dst, _zz_bytes_t *src);
int8_t _zz_bytes_append_slice(_zz_bytes_t *dst, _z_arc_slice_t *s);
int8_t _zz_bytes_copy(_zz_bytes_t *dst, const _zz_bytes_t *src);
_zz_bytes_t _zz_bytes_duplicate(const _zz_bytes_t *src);
void _zz_bytes_move(_zz_bytes_t *dst, _zz_bytes_t *src);
void _zz_bytes_drop(_zz_bytes_t *bytes);
void _zz_bytes_free(_zz_bytes_t **bs);
size_t _zz_bytes_num_slices(const _zz_bytes_t *bs);
_z_arc_slice_t *_zz_bytes_get_slice(const _zz_bytes_t *bs, size_t i);
size_t _zz_bytes_len(const _zz_bytes_t *bs);
_Bool _zz_bytes_is_empty(const _zz_bytes_t *bs);
int8_t _zz_bytes_to_uint8(const _zz_bytes_t *bs, uint8_t *u);
int8_t _zz_bytes_to_uint16(const _zz_bytes_t *bs, uint16_t *u);
int8_t _zz_bytes_to_uint32(const _zz_bytes_t *bs, uint32_t *u);
int8_t _zz_bytes_to_uint64(const _zz_bytes_t *bs, uint64_t *u);
int8_t _zz_bytes_to_float(const _zz_bytes_t *bs, float *f);
int8_t _zz_bytes_to_double(const _zz_bytes_t *bs, double *d);
int8_t _zz_bytes_to_slice(const _zz_bytes_t *bytes, _z_slice_t *s);
int8_t _zz_bytes_from_slice(_zz_bytes_t *b, _z_slice_t s);
int8_t _zz_bytes_from_uint8(_zz_bytes_t *b, uint8_t val);
int8_t _zz_bytes_from_uint16(_zz_bytes_t *b, uint16_t val);
int8_t _zz_bytes_from_uint32(_zz_bytes_t *b, uint32_t val);
int8_t _zz_bytes_from_uint64(_zz_bytes_t *b, uint64_t val);
int8_t _zz_bytes_from_float(_zz_bytes_t *b, float val);
int8_t _zz_bytes_from_double(_zz_bytes_t *b, double val);
size_t _zz_bytes_to_buf(const _zz_bytes_t *bytes, uint8_t *dst, size_t len);
int8_t _zz_bytes_from_buf(_zz_bytes_t *b, uint8_t *src, size_t len);
int8_t _zz_bytes_serialize_from_pair(_zz_bytes_t *out, _zz_bytes_t *first, _zz_bytes_t *second);
int8_t _zz_bytes_deserialize_into_pair(const _zz_bytes_t *bs, _zz_bytes_t *first_out, _zz_bytes_t *second_out);
_z_slice_t _zz_bytes_try_get_contiguous(const _zz_bytes_t *bs);
_Bool _z_bytes_check(const _z_bytes_t *bytes);
_z_bytes_t _z_bytes_null(void);
int8_t _z_bytes_append(_z_bytes_t *dst, _z_bytes_t *src);
int8_t _z_bytes_append_slice(_z_bytes_t *dst, _z_arc_slice_t *s);
int8_t _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_drop(_z_bytes_t *bytes);
void _z_bytes_free(_z_bytes_t **bs);
size_t _z_bytes_num_slices(const _z_bytes_t *bs);
_z_arc_slice_t *_z_bytes_get_slice(const _z_bytes_t *bs, size_t i);
size_t _z_bytes_len(const _z_bytes_t *bs);
_Bool _z_bytes_is_empty(const _z_bytes_t *bs);
int8_t _z_bytes_to_uint8(const _z_bytes_t *bs, uint8_t *u);
int8_t _z_bytes_to_uint16(const _z_bytes_t *bs, uint16_t *u);
int8_t _z_bytes_to_uint32(const _z_bytes_t *bs, uint32_t *u);
int8_t _z_bytes_to_uint64(const _z_bytes_t *bs, uint64_t *u);
int8_t _z_bytes_to_float(const _z_bytes_t *bs, float *f);
int8_t _z_bytes_to_double(const _z_bytes_t *bs, double *d);
int8_t _z_bytes_to_slice(const _z_bytes_t *bytes, _z_slice_t *s);
int8_t _z_bytes_from_slice(_z_bytes_t *b, _z_slice_t s);
int8_t _z_bytes_from_uint8(_z_bytes_t *b, uint8_t val);
int8_t _z_bytes_from_uint16(_z_bytes_t *b, uint16_t val);
int8_t _z_bytes_from_uint32(_z_bytes_t *b, uint32_t val);
int8_t _z_bytes_from_uint64(_z_bytes_t *b, uint64_t val);
int8_t _z_bytes_from_float(_z_bytes_t *b, float val);
int8_t _z_bytes_from_double(_z_bytes_t *b, double val);
size_t _z_bytes_to_buf(const _z_bytes_t *bytes, uint8_t *dst, size_t len);
int8_t _z_bytes_from_buf(_z_bytes_t *b, uint8_t *src, size_t len);
int8_t _z_bytes_serialize_from_pair(_z_bytes_t *out, _z_bytes_t *first, _z_bytes_t *second);
int8_t _z_bytes_deserialize_into_pair(const _z_bytes_t *bs, _z_bytes_t *first_out, _z_bytes_t *second_out);
_z_slice_t _z_bytes_try_get_contiguous(const _z_bytes_t *bs);

typedef struct {
size_t slice_idx;
size_t in_slice_idx;
size_t byte_idx;
const _zz_bytes_t *bytes;
} _zz_bytes_reader_t;
const _z_bytes_t *bytes;
} _z_bytes_reader_t;

_zz_bytes_reader_t _zz_bytes_get_reader(const _zz_bytes_t *bytes);
int8_t _zz_bytes_reader_seek(_zz_bytes_reader_t *reader, int64_t offset, int origin);
int64_t _zz_bytes_reader_tell(const _zz_bytes_reader_t *reader);
int8_t _zz_bytes_reader_read_slices(_zz_bytes_reader_t *reader, size_t len, _zz_bytes_t *out);
int8_t _zz_bytes_reader_read(_zz_bytes_reader_t *reader, uint8_t *buf, size_t len);
int8_t _zz_bytes_reader_read_next(_zz_bytes_reader_t *reader, _zz_bytes_t *out);
_z_bytes_reader_t _z_bytes_get_reader(const _z_bytes_t *bytes);
int8_t _z_bytes_reader_seek(_z_bytes_reader_t *reader, int64_t offset, int origin);
int64_t _z_bytes_reader_tell(const _z_bytes_reader_t *reader);
int8_t _z_bytes_reader_read_slices(_z_bytes_reader_t *reader, size_t len, _z_bytes_t *out);
int8_t _z_bytes_reader_read(_z_bytes_reader_t *reader, uint8_t *buf, size_t len);
int8_t _z_bytes_reader_read_next(_z_bytes_reader_t *reader, _z_bytes_t *out);

typedef struct {
_zz_bytes_reader_t _reader;
} _zz_bytes_iterator_t;
_z_bytes_reader_t _reader;
} _z_bytes_iterator_t;

_zz_bytes_iterator_t _zz_bytes_get_iterator(const _zz_bytes_t *bytes);
_Bool _zz_bytes_iterator_next(_zz_bytes_iterator_t *iter, _zz_bytes_t *b);
_z_bytes_iterator_t _z_bytes_get_iterator(const _z_bytes_t *bytes);
_Bool _z_bytes_iterator_next(_z_bytes_iterator_t *iter, _z_bytes_t *b);

#endif /* ZENOH_PICO_COLLECTIONS_BYTES_H */
8 changes: 4 additions & 4 deletions include/zenoh-pico/net/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ int8_t _z_undeclare_publisher(_z_publisher_t *pub);
* Returns:
* ``0`` in case of success, ``-1`` in case of failure.
*/
int8_t _z_write(_z_session_t *zn, const _z_keyexpr_t keyexpr, _zz_bytes_t payload, const _z_encoding_t encoding,
int8_t _z_write(_z_session_t *zn, const _z_keyexpr_t keyexpr, _z_bytes_t payload, const _z_encoding_t encoding,
const z_sample_kind_t kind, const z_congestion_control_t cong_ctrl, z_priority_t priority,
const _zz_bytes_t attachment);
const _z_bytes_t attachment);
#endif

#if Z_FEATURE_SUBSCRIPTION == 1
Expand Down Expand Up @@ -199,7 +199,7 @@ int8_t _z_undeclare_queryable(_z_queryable_t *qle);
* attachment: An optional attachment to the reply.
*/
int8_t _z_send_reply(const _z_query_t *query, const _z_keyexpr_t keyexpr, const _z_value_t payload,
const z_sample_kind_t kind, const _zz_bytes_t attachment);
const z_sample_kind_t kind, const _z_bytes_t attachment);
#endif

#if Z_FEATURE_QUERY == 1
Expand All @@ -224,7 +224,7 @@ int8_t _z_send_reply(const _z_query_t *query, const _z_keyexpr_t keyexpr, const
*/
int8_t _z_query(_z_session_t *zn, _z_keyexpr_t keyexpr, const char *parameters, const z_query_target_t target,
const z_consolidation_mode_t consolidation, const _z_value_t value, _z_reply_handler_t callback,
_z_drop_handler_t dropper, void *arg, uint32_t timeout_ms, const _zz_bytes_t attachment);
_z_drop_handler_t dropper, void *arg, uint32_t timeout_ms, const _z_bytes_t attachment);
#endif

#if Z_FEATURE_INTEREST == 1
Expand Down
4 changes: 2 additions & 2 deletions include/zenoh-pico/net/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct _z_query_t {
_z_keyexpr_t _key;
uint32_t _request_id;
_z_session_t *_zn;
_zz_bytes_t attachment;
_z_bytes_t attachment;
char *_parameters;
_Bool _anyke;
} _z_query_t;
Expand All @@ -48,7 +48,7 @@ typedef struct {

#if Z_FEATURE_QUERYABLE == 1
_z_query_t _z_query_create(const _z_value_t *value, const _z_keyexpr_t *key, const _z_slice_t *parameters,
_z_session_t *zn, uint32_t request_id, const _zz_bytes_t attachment);
_z_session_t *zn, uint32_t request_id, const _z_bytes_t attachment);
void _z_queryable_clear(_z_queryable_t *qbl);
void _z_queryable_free(_z_queryable_t **qbl);
#endif
Expand Down
4 changes: 2 additions & 2 deletions include/zenoh-pico/net/reply.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ _z_reply_t _z_reply_null(void);
void _z_reply_clear(_z_reply_t *src);
void _z_reply_free(_z_reply_t **hello);
void _z_reply_copy(_z_reply_t *dst, _z_reply_t *src);
_z_reply_t _z_reply_create(_z_keyexpr_t keyexpr, z_reply_tag_t tag, _z_id_t id, const _zz_bytes_t payload,
_z_reply_t _z_reply_create(_z_keyexpr_t keyexpr, z_reply_tag_t tag, _z_id_t id, const _z_bytes_t payload,
const _z_timestamp_t *timestamp, _z_encoding_t encoding, z_sample_kind_t kind,
const _zz_bytes_t attachment);
const _z_bytes_t attachment);

_Z_REFCOUNT_DEFINE(_z_reply, _z_reply)

Expand Down
8 changes: 4 additions & 4 deletions include/zenoh-pico/net/sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
*/
typedef struct _z_sample_t {
_z_keyexpr_t keyexpr;
_zz_bytes_t payload;
_z_bytes_t payload;
_z_timestamp_t timestamp;
_z_encoding_t encoding;
z_sample_kind_t kind;
_z_qos_t qos;
_zz_bytes_t attachment;
_z_bytes_t attachment;
} _z_sample_t;
void _z_sample_clear(_z_sample_t *sample);

Expand All @@ -56,8 +56,8 @@ void _z_sample_free(_z_sample_t **sample);
void _z_sample_copy(_z_sample_t *dst, const _z_sample_t *src);
_z_sample_t _z_sample_duplicate(const _z_sample_t *src);

_z_sample_t _z_sample_create(const _z_keyexpr_t *key, const _zz_bytes_t, _z_timestamp_t timestamp,
_z_sample_t _z_sample_create(const _z_keyexpr_t *key, const _z_bytes_t, _z_timestamp_t timestamp,
const _z_encoding_t encoding, const z_sample_kind_t kind, const _z_qos_t qos,
const _zz_bytes_t attachment);
const _z_bytes_t attachment);

#endif /* ZENOH_PICO_SAMPLE_NETAPI_H */
4 changes: 2 additions & 2 deletions include/zenoh-pico/protocol/codec/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,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 _zz_bytes_decode(_zz_bytes_t *bs, _z_zbuf_t *zbf);
int8_t _zz_bytes_encode(_z_wbuf_t *wbf, const _zz_bytes_t *bs);
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);
Expand Down
4 changes: 2 additions & 2 deletions include/zenoh-pico/protocol/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ typedef struct {
* Represents a Zenoh value.
*
* Members:
* _zz_bytes_t payload: The payload of this zenoh value.
* _z_bytes_t payload: The payload of this zenoh value.
* _z_encoding_t encoding: The encoding of the `payload`.
*/
typedef struct {
_zz_bytes_t payload;
_z_bytes_t payload;
_z_encoding_t encoding;
} _z_value_t;
_z_value_t _z_value_null(void);
Expand Down
8 changes: 4 additions & 4 deletions include/zenoh-pico/protocol/definitions/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
typedef struct {
_z_encoding_t encoding;
_z_source_info_t _ext_source_info;
_zz_bytes_t _payload;
_z_bytes_t _payload;
} _z_msg_err_t;
void _z_msg_err_clear(_z_msg_err_t *err);

Expand All @@ -73,9 +73,9 @@ static inline void _z_msg_del_clear(_z_msg_del_t *del) { (void)del; }

typedef struct {
_z_m_push_commons_t _commons;
_zz_bytes_t _payload;
_z_bytes_t _payload;
_z_encoding_t _encoding;
_zz_bytes_t _attachment;
_z_bytes_t _attachment;
} _z_msg_put_t;
void _z_msg_put_clear(_z_msg_put_t *);
#define _Z_M_PUT_ID 0x01
Expand All @@ -100,7 +100,7 @@ typedef struct {
_z_source_info_t _ext_info;
_z_value_t _ext_value;
z_consolidation_mode_t _consolidation;
_zz_bytes_t _ext_attachment;
_z_bytes_t _ext_attachment;
} _z_msg_query_t;
typedef struct {
_Bool info;
Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/protocol/definitions/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ _Z_VEC_DEFINE(_z_network_message, _z_network_message_t)
void _z_msg_fix_mapping(_z_zenoh_message_t *msg, uint16_t mapping);
_z_network_message_t _z_msg_make_query(_Z_MOVE(_z_keyexpr_t) key, _Z_MOVE(_z_slice_t) parameters, _z_zint_t qid,
z_consolidation_mode_t consolidation, _Z_MOVE(_z_value_t) value,
uint32_t timeout_ms, _zz_bytes_t attachment);
uint32_t timeout_ms, _z_bytes_t attachment);
_z_network_message_t _z_n_msg_make_reply(_z_zint_t rid, _Z_MOVE(_z_keyexpr_t) key, _Z_MOVE(_z_push_body_t) body);
_z_network_message_t _z_n_msg_make_response_final(_z_zint_t rid);
_z_network_message_t _z_n_msg_make_declare(_z_declaration_t declaration, _Bool has_interest_id, uint32_t interest_id);
Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/session/queryable.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ _z_session_queryable_rc_list_t *_z_get_session_queryable_by_key(_z_session_t *zn

_z_session_queryable_rc_t *_z_register_session_queryable(_z_session_t *zn, _z_session_queryable_t *q);
int8_t _z_trigger_queryables(_z_session_t *zn, const _z_msg_query_t *query, const _z_keyexpr_t q_key, uint32_t qid,
const _zz_bytes_t attachment);
const _z_bytes_t attachment);
void _z_unregister_session_queryable(_z_session_t *zn, _z_session_queryable_rc_t *q);
void _z_flush_session_queryable(_z_session_t *zn);
#endif
Expand Down
8 changes: 4 additions & 4 deletions include/zenoh-pico/session/subscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
#include "zenoh-pico/net/session.h"

/*------------------ Subscription ------------------*/
void _z_trigger_local_subscriptions(_z_session_t *zn, const _z_keyexpr_t keyexpr, const _zz_bytes_t payload,
const _z_n_qos_t qos, const _zz_bytes_t attachment);
void _z_trigger_local_subscriptions(_z_session_t *zn, const _z_keyexpr_t keyexpr, const _z_bytes_t payload,
const _z_n_qos_t qos, const _z_bytes_t attachment);

#if Z_FEATURE_SUBSCRIPTION == 1
_z_subscription_rc_t *_z_get_subscription_by_id(_z_session_t *zn, uint8_t is_local, const _z_zint_t id);
_z_subscription_rc_list_t *_z_get_subscriptions_by_key(_z_session_t *zn, uint8_t is_local, const _z_keyexpr_t *keyexpr);

_z_subscription_rc_t *_z_register_subscription(_z_session_t *zn, uint8_t is_local, _z_subscription_t *sub);
int8_t _z_trigger_subscriptions(_z_session_t *zn, const _z_keyexpr_t keyexpr, const _zz_bytes_t payload,
int8_t _z_trigger_subscriptions(_z_session_t *zn, const _z_keyexpr_t keyexpr, const _z_bytes_t payload,
const _z_encoding_t encoding, const _z_zint_t kind, const _z_timestamp_t timestamp,
const _z_n_qos_t qos, const _zz_bytes_t attachment);
const _z_n_qos_t qos, const _z_bytes_t attachment);
void _z_unregister_subscription(_z_session_t *zn, uint8_t is_local, _z_subscription_rc_t *sub);
void _z_flush_subscriptions(_z_session_t *zn);
#endif
Expand Down
Loading

0 comments on commit 38cbee0

Please sign in to comment.