Skip to content

Commit 459ab5c

Browse files
clearly specify where key expression might be declared and where it is not
1 parent 9befaac commit 459ab5c

37 files changed

+546
-474
lines changed

include/zenoh-pico.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#ifndef ZENOH_PICO_H
1818
#define ZENOH_PICO_H
1919

20-
#define ZENOH_PICO "1.5.0"
20+
#define ZENOH_PICO "1.7.2"
2121
#define ZENOH_PICO_MAJOR 1
22-
#define ZENOH_PICO_MINOR 5
23-
#define ZENOH_PICO_PATCH 0
22+
#define ZENOH_PICO_MINOR 7
23+
#define ZENOH_PICO_PATCH 2
2424
#define ZENOH_PICO_TWEAK
2525

2626
#include "zenoh-pico/api/advanced_publisher.h"

include/zenoh-pico/api/liveliness.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ extern "C" {
2727

2828
typedef struct {
2929
uint32_t _id;
30-
_z_keyexpr_t _key;
3130
_z_session_weak_t _zn;
3231
} _z_liveliness_token_t;
3332

include/zenoh-pico/api/types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ _Z_VIEW_TYPE(_z_string_t, string)
9595
/**
9696
* Represents a key expression in Zenoh.
9797
*/
98-
_Z_OWNED_TYPE_VALUE(_z_keyexpr_t, keyexpr)
99-
_Z_VIEW_TYPE(_z_keyexpr_t, keyexpr)
98+
_Z_OWNED_TYPE_VALUE(_z_declared_keyexpr_t, keyexpr)
99+
_Z_VIEW_TYPE(_z_declared_keyexpr_t, keyexpr)
100100

101101
/**
102102
* Represents a Zenoh configuration, used to configure Zenoh sessions upon opening.

include/zenoh-pico/config.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
#define Z_TRANSPORT_LEASE_EXPIRE_FACTOR 3
2929
#define ZP_PERIODIC_SCHEDULER_MAX_TASKS 64
3030

31-
/* #undef Z_FEATURE_UNSTABLE_API */
31+
#define Z_FEATURE_UNSTABLE_API
3232
#define Z_FEATURE_MULTI_THREAD 1
3333
#define Z_FEATURE_PUBLICATION 1
34-
#define Z_FEATURE_ADVANCED_PUBLICATION 0
34+
#define Z_FEATURE_ADVANCED_PUBLICATION 1
3535
#define Z_FEATURE_SUBSCRIPTION 1
36-
#define Z_FEATURE_ADVANCED_SUBSCRIPTION 0
36+
#define Z_FEATURE_ADVANCED_SUBSCRIPTION 1
3737
#define Z_FEATURE_QUERY 1
3838
#define Z_FEATURE_QUERYABLE 1
3939
#define Z_FEATURE_LIVELINESS 1
@@ -53,8 +53,8 @@
5353
#define Z_FEATURE_FRAGMENTATION 1
5454
#define Z_FEATURE_ENCODING_VALUES 1
5555
#define Z_FEATURE_TCP_NODELAY 1
56-
#define Z_FEATURE_LOCAL_SUBSCRIBER 0
57-
#define Z_FEATURE_LOCAL_QUERYABLE 0
56+
#define Z_FEATURE_LOCAL_SUBSCRIBER 1
57+
#define Z_FEATURE_LOCAL_QUERYABLE 1
5858
#define Z_FEATURE_SESSION_CHECK 1
5959
#define Z_FEATURE_BATCHING 1
6060
#define Z_FEATURE_BATCH_TX_MUTEX 0
@@ -64,7 +64,7 @@
6464
#define Z_FEATURE_UNICAST_PEER 1
6565
#define Z_FEATURE_AUTO_RECONNECT 1
6666
#define Z_FEATURE_MULTICAST_DECLARATIONS 0
67-
#define Z_FEATURE_PERIODIC_TASKS 0
67+
#define Z_FEATURE_PERIODIC_TASKS 1
6868

6969
// End of CMake generation
7070

include/zenoh-pico/net/filtering.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ typedef struct _z_write_filter_t {
8080
_z_write_filter_ctx_rc_t ctx;
8181
} _z_write_filter_t;
8282

83-
z_result_t _z_write_filter_create(const _z_session_rc_t *zn, _z_write_filter_t *filter, const _z_keyexpr_t *keyexpr,
84-
uint8_t interest_flag, bool complete, z_locality_t locality);
83+
z_result_t _z_write_filter_create(const _z_session_rc_t *zn, _z_write_filter_t *filter,
84+
const _z_declared_keyexpr_t *keyexpr, uint8_t interest_flag, bool complete,
85+
z_locality_t locality);
8586
z_result_t _z_write_filter_clear(_z_write_filter_t *filter);
8687
void _z_write_filter_notify_subscriber(struct _z_session_t *session, const _z_keyexpr_t *key,
8788
z_locality_t allowed_origin, bool add);

include/zenoh-pico/net/liveliness.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extern "C" {
2626
#if Z_FEATURE_LIVELINESS == 1
2727

2828
z_result_t _z_declare_liveliness_token(const _z_session_rc_t *zn, _z_liveliness_token_t *ret_token,
29-
const _z_keyexpr_t *keyexpr);
29+
const _z_declared_keyexpr_t *keyexpr);
3030
z_result_t _z_undeclare_liveliness_token(_z_liveliness_token_t *token);
3131

3232
#if Z_FEATURE_SUBSCRIPTION == 1
@@ -45,7 +45,7 @@ z_result_t _z_undeclare_liveliness_token(_z_liveliness_token_t *token);
4545
* 0 in case of success, negative error code otherwise.
4646
*/
4747
z_result_t _z_declare_liveliness_subscriber(_z_subscriber_t *subscriber, const _z_session_rc_t *zn,
48-
const _z_keyexpr_t *keyexpr, _z_closure_sample_callback_t callback,
48+
const _z_declared_keyexpr_t *keyexpr, _z_closure_sample_callback_t callback,
4949
_z_drop_handler_t dropper, bool history, void *arg);
5050

5151
/**
@@ -73,7 +73,7 @@ z_result_t _z_undeclare_liveliness_subscriber(_z_subscriber_t *sub);
7373
* timeout_ms: The timeout value of this query.
7474
* opt_cancellation_token: Optional cancellation token, can be NULL.
7575
*/
76-
z_result_t _z_liveliness_query(const _z_session_rc_t *session, const _z_keyexpr_t *keyexpr,
76+
z_result_t _z_liveliness_query(const _z_session_rc_t *session, const _z_declared_keyexpr_t *keyexpr,
7777
_z_closure_reply_callback_t callback, _z_drop_handler_t dropper, void *arg,
7878
uint64_t timeout_ms, _z_cancellation_token_rc_t *opt_cancellation_token);
7979
#endif // Z_FEATURE_QUERY == 1

include/zenoh-pico/net/primitives.h

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ _z_keyexpr_t _z_update_keyexpr_to_declared(_z_session_t *zs, _z_keyexpr_t keyexp
108108
* Returns:
109109
* 0 in case of success, negative error code otherwise.
110110
*/
111-
z_result_t _z_declare_publisher(_z_publisher_t *publisher, const _z_session_rc_t *zn, const _z_keyexpr_t *keyexpr,
112-
_z_encoding_t *encoding, z_congestion_control_t congestion_control,
113-
z_priority_t priority, bool is_express, z_reliability_t reliability,
114-
z_locality_t allowed_destination);
111+
z_result_t _z_declare_publisher(_z_publisher_t *publisher, const _z_session_rc_t *zn,
112+
const _z_declared_keyexpr_t *keyexpr, _z_encoding_t *encoding,
113+
z_congestion_control_t congestion_control, z_priority_t priority, bool is_express,
114+
z_reliability_t reliability, z_locality_t allowed_destination);
115115

116116
/**
117117
* Undeclare a :c:type:`_z_publisher_t`.
@@ -146,9 +146,9 @@ z_result_t _z_undeclare_publisher(_z_publisher_t *pub);
146146
* Returns:
147147
* ``0`` in case of success, ``-1`` in case of failure.
148148
*/
149-
z_result_t _z_write(_z_session_t *zn, const _z_keyexpr_t *keyexpr, _z_bytes_t *payload, _z_encoding_t *encoding,
150-
const z_sample_kind_t kind, const z_congestion_control_t cong_ctrl, z_priority_t priority,
151-
bool is_express, const _z_timestamp_t *timestamp, _z_bytes_t *attachment,
149+
z_result_t _z_write(_z_session_t *zn, const _z_declared_keyexpr_t *keyexpr, _z_bytes_t *payload,
150+
_z_encoding_t *encoding, const z_sample_kind_t kind, const z_congestion_control_t cong_ctrl,
151+
z_priority_t priority, bool is_express, const _z_timestamp_t *timestamp, _z_bytes_t *attachment,
152152
z_reliability_t reliability, const _z_source_info_t *source_info, z_locality_t allowed_destination);
153153
#endif
154154

@@ -166,9 +166,9 @@ z_result_t _z_write(_z_session_t *zn, const _z_keyexpr_t *keyexpr, _z_bytes_t *p
166166
* Returns:
167167
* 0 in case of success, negative error code otherwise.
168168
*/
169-
z_result_t _z_declare_subscriber(_z_subscriber_t *subscriber, const _z_session_rc_t *zn, const _z_keyexpr_t *keyexpr,
170-
_z_closure_sample_callback_t callback, _z_drop_handler_t dropper, void *arg,
171-
z_locality_t allowed_origin);
169+
z_result_t _z_declare_subscriber(_z_subscriber_t *subscriber, const _z_session_rc_t *zn,
170+
const _z_declared_keyexpr_t *keyexpr, _z_closure_sample_callback_t callback,
171+
_z_drop_handler_t dropper, void *arg, z_locality_t allowed_origin);
172172

173173
/**
174174
* Undeclare a :c:type:`_z_subscriber_t`.
@@ -197,9 +197,10 @@ z_result_t _z_undeclare_subscriber(_z_subscriber_t *sub);
197197
* Returns:
198198
* 0 in case of success, negative error code otherwise.
199199
*/
200-
z_result_t _z_declare_queryable(_z_queryable_t *queryable, const _z_session_rc_t *zn, const _z_keyexpr_t *keyexpr,
201-
bool complete, _z_closure_query_callback_t callback, _z_drop_handler_t dropper,
202-
void *arg, z_locality_t allowed_origin);
200+
z_result_t _z_declare_queryable(_z_queryable_t *queryable, const _z_session_rc_t *zn,
201+
const _z_declared_keyexpr_t *keyexpr, bool complete,
202+
_z_closure_query_callback_t callback, _z_drop_handler_t dropper, void *arg,
203+
z_locality_t allowed_origin);
203204

204205
/**
205206
* Undeclare a :c:type:`_z_queryable_t`.
@@ -232,7 +233,7 @@ z_result_t _z_undeclare_queryable(_z_queryable_t *qle);
232233
* timestamp: The timestamp of this reply. The API level timestamp (e.g. of the data when it was created).
233234
* source_info: The message source info.
234235
*/
235-
z_result_t _z_send_reply(const _z_query_t *query, const _z_session_rc_t *zsrc, const _z_keyexpr_t *keyexpr,
236+
z_result_t _z_send_reply(const _z_query_t *query, const _z_session_rc_t *zsrc, const _z_declared_keyexpr_t *keyexpr,
236237
_z_bytes_t *payload, _z_encoding_t *encoding, const z_sample_kind_t kind,
237238
const z_congestion_control_t cong_ctrl, z_priority_t priority, bool is_express,
238239
const _z_timestamp_t *timestamp, _z_bytes_t *attachment, _z_source_info_t *source_info);
@@ -270,7 +271,7 @@ z_result_t _z_send_reply_err(const _z_query_t *query, const _z_session_rc_t *zsr
270271
* Returns:
271272
* 0 in case of success, negative error code otherwise.
272273
*/
273-
z_result_t _z_declare_querier(_z_querier_t *querier, const _z_session_rc_t *zn, const _z_keyexpr_t *keyexpr,
274+
z_result_t _z_declare_querier(_z_querier_t *querier, const _z_session_rc_t *zn, const _z_declared_keyexpr_t *keyexpr,
274275
z_consolidation_mode_t consolidation_mode, z_congestion_control_t congestion_control,
275276
z_query_target_t target, z_priority_t priority, bool is_express, uint64_t timeout_ms,
276277
_z_encoding_t *encoding, z_reliability_t reliability, z_locality_t allowed_destination);
@@ -308,7 +309,7 @@ z_result_t _z_undeclare_querier(_z_querier_t *querier);
308309
* opt_cancellation_token: Optional cancellation token to cancel the query, can be null.
309310
*
310311
*/
311-
z_result_t _z_query(const _z_session_rc_t *session, const _z_keyexpr_t *keyexpr, const char *parameters,
312+
z_result_t _z_query(const _z_session_rc_t *session, const _z_declared_keyexpr_t *keyexpr, const char *parameters,
312313
size_t parameters_len, z_query_target_t target, z_consolidation_mode_t consolidation,
313314
_z_bytes_t *payload, _z_encoding_t *encoding, _z_closure_reply_callback_t callback,
314315
_z_drop_handler_t dropper, void *arg, uint64_t timeout_ms, _z_bytes_t *attachment, _z_n_qos_t qos,
@@ -317,8 +318,8 @@ z_result_t _z_query(const _z_session_rc_t *session, const _z_keyexpr_t *keyexpr,
317318
#endif
318319

319320
#if Z_FEATURE_INTEREST == 1
320-
uint32_t _z_add_interest(_z_session_t *zn, const _z_keyexpr_t *keyexpr, _z_interest_handler_t callback, uint8_t flags,
321-
_z_void_rc_t *arg);
321+
uint32_t _z_add_interest(_z_session_t *zn, const _z_declared_keyexpr_t *keyexpr, _z_interest_handler_t callback,
322+
uint8_t flags, _z_void_rc_t *arg);
322323
z_result_t _z_remove_interest(_z_session_t *zn, uint32_t interest_id);
323324
#endif
324325

include/zenoh-pico/net/publish.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern "C" {
2828
* Return type when declaring a publisher.
2929
*/
3030
typedef struct _z_publisher_t {
31-
_z_keyexpr_t _key;
31+
_z_declared_keyexpr_t _key;
3232
_z_zint_t _id;
3333
_z_session_weak_t _zn;
3434
_z_encoding_t _encoding;

include/zenoh-pico/net/query.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern "C" {
3131
* The query to be answered by a queryable.
3232
*/
3333
typedef struct _z_query_t {
34-
_z_keyexpr_t _key;
34+
_z_declared_keyexpr_t _key;
3535
_z_value_t _value;
3636
uint32_t _request_id;
3737
_z_session_weak_t _zn;
@@ -45,8 +45,8 @@ typedef struct _z_query_t {
4545
// Warning: None of the sub-types require a non-0 initialization. Add a init function if it changes.
4646
static inline _z_query_t _z_query_null(void) { return (_z_query_t){0}; }
4747
static inline bool _z_query_check(const _z_query_t *query) {
48-
return _z_keyexpr_check(&query->_key) || _z_value_check(&query->_value) || _z_bytes_check(&query->_attachment) ||
49-
_z_string_check(&query->_parameters);
48+
return _z_declared_keyexpr_check(&query->_key) || _z_value_check(&query->_value) ||
49+
_z_bytes_check(&query->_attachment) || _z_string_check(&query->_parameters);
5050
}
5151
z_result_t _z_query_send_reply_final(_z_query_t *q);
5252
z_result_t _z_session_send_reply_final(_z_session_t *session, uint32_t query_id, bool is_local);
@@ -59,7 +59,7 @@ _Z_REFCOUNT_DEFINE(_z_query, _z_query)
5959
* Return type when declaring a querier.
6060
*/
6161
typedef struct _z_querier_t {
62-
_z_keyexpr_t _key;
62+
_z_declared_keyexpr_t _key;
6363
_z_zint_t _id;
6464
_z_session_weak_t _zn;
6565
_z_encoding_t _encoding;
@@ -96,7 +96,7 @@ static inline z_result_t _z_query_move_data(_z_query_t *dst, _z_value_t *value,
9696
_z_slice_t *parameters, const _z_session_weak_t *zn, uint32_t request_id,
9797
_z_bytes_t *attachment, bool anyke, const _z_source_info_t *source_info) {
9898
*dst = _z_query_null();
99-
_Z_CLEAN_RETURN_IF_ERR(_z_keyexpr_move(&dst->_key, key), _z_query_clear(dst));
99+
_Z_CLEAN_RETURN_IF_ERR(_z_keyexpr_move(&dst->_key._inner, key), _z_query_clear(dst));
100100
_Z_CLEAN_RETURN_IF_ERR(_z_value_move(&dst->_value, value), _z_query_clear(dst));
101101
_Z_CLEAN_RETURN_IF_ERR(_z_bytes_move(&dst->_attachment, attachment), _z_query_clear(dst));
102102
_Z_CLEAN_RETURN_IF_ERR(_z_slice_move(&dst->_parameters._slice, parameters), _z_query_clear(dst));

include/zenoh-pico/net/sample.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extern "C" {
3636
* _z_source_info_t source_info: The source info for this data sample (unstable).
3737
*/
3838
typedef struct _z_sample_t {
39-
_z_keyexpr_t keyexpr;
39+
_z_declared_keyexpr_t keyexpr;
4040
_z_bytes_t payload;
4141
_z_timestamp_t timestamp;
4242
_z_encoding_t encoding;
@@ -51,7 +51,7 @@ void _z_sample_clear(_z_sample_t *sample);
5151
// Warning: None of the sub-types require a non-0 initialization. Add a init function if it changes.
5252
static inline _z_sample_t _z_sample_null(void) { return (_z_sample_t){0}; }
5353
static inline bool _z_sample_check(const _z_sample_t *sample) {
54-
return _z_keyexpr_check(&sample->keyexpr) || _z_encoding_check(&sample->encoding) ||
54+
return _z_declared_keyexpr_check(&sample->keyexpr) || _z_encoding_check(&sample->encoding) ||
5555
_z_bytes_check(&sample->payload) || _z_bytes_check(&sample->attachment);
5656
}
5757
static inline size_t _z_sample_size(const _z_sample_t *s) {
@@ -62,7 +62,7 @@ static inline size_t _z_sample_size(const _z_sample_t *s) {
6262
void _z_sample_steal_data(_z_sample_t *dst, _z_keyexpr_t *key, _z_bytes_t *payload, const _z_timestamp_t *timestamp,
6363
_z_encoding_t *encoding, z_sample_kind_t kind, _z_qos_t qos, _z_bytes_t *attachment,
6464
z_reliability_t reliability, _z_source_info_t *source_info);
65-
z_result_t _z_sample_copy_data(_z_sample_t *dst, const _z_keyexpr_t *key, const _z_bytes_t *payload,
65+
z_result_t _z_sample_copy_data(_z_sample_t *dst, const _z_declared_keyexpr_t *key, const _z_bytes_t *payload,
6666
const _z_timestamp_t *timestamp, const _z_encoding_t *encoding, z_sample_kind_t kind,
6767
_z_qos_t qos, const _z_bytes_t *attachment, z_reliability_t reliability,
6868
const _z_source_info_t *source_info);

0 commit comments

Comments
 (0)