diff --git a/CMakeLists.txt b/CMakeLists.txt index 27dfda0ee..508033628 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -279,7 +279,7 @@ file(GLOB_RECURSE Sources "src/session/*.c" "src/transport/*.c" "src/utils/*.c" - "src/system/platform-common.c" + "src/system/platform_common.c" ) if(WITH_ZEPHYR) diff --git a/docs/api.rst b/docs/api.rst index ba9d3ef65..b8f368e21 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1,5 +1,5 @@ .. -.. Copyright (c) 2022 ZettaScale Technology +.. Copyright (c) 2024 ZettaScale Technology .. .. This program and the accompanying materials are made available under the .. terms of the Eclipse Public License 2.0 which is available at @@ -16,224 +16,383 @@ API Reference ************* -Zenoh Types ------------ - -Enums -~~~~~ - -.. autocenum:: constants.h::z_whatami_t -.. autocenum:: constants.h::zp_keyexpr_canon_status_t -.. autocenum:: constants.h::z_sample_kind_t -.. autocenum:: constants.h::z_consolidation_mode_t -.. autocenum:: constants.h::z_reliability_t -.. autocenum:: constants.h::z_congestion_control_t -.. autocenum:: constants.h::z_priority_t -.. autocenum:: constants.h::z_query_target_t +Containers +============= -Data Structures -~~~~~~~~~~~~~~~ +Slice +----- + +Represents an array of bytes. -.. autoctype:: types.h::z_zint_t -.. autoctype:: types.h::z_id_t -.. autoctype:: types.h::z_timestamp_t -.. autoctype:: types.h::z_subscriber_options_t -.. autoctype:: types.h::z_query_consolidation_t -.. autoctype:: types.h::z_publisher_options_t -.. autoctype:: types.h::z_queryable_options_t -.. autoctype:: types.h::z_query_reply_options_t -.. autoctype:: types.h::z_put_options_t -.. autoctype:: types.h::z_delete_options_t -.. autoctype:: types.h::z_publisher_put_options_t -.. autoctype:: types.h::z_publisher_delete_options_t -.. autoctype:: types.h::z_get_options_t -.. autoctype:: types.h::zp_task_read_options_t -.. autoctype:: types.h::zp_task_lease_options_t -.. autoctype:: types.h::zp_read_options_t -.. autoctype:: types.h::zp_send_keep_alive_options_t -.. autoctype:: types.h::zp_send_join_options_t -.. autoctype:: types.h::z_bytes_reader_t -.. autoctype:: types.h::z_bytes_slice_iterator_t -.. autoctype:: serialization.h::ze_deserializer_t +Types +^^^^^ +See details at :ref:`owned_types_concept` -Owned Types -~~~~~~~~~~~ +.. c:type:: z_owned_slice_t +.. c:type:: z_view_slice_t +.. c:type:: z_loaned_slice_t +.. c:type:: z_moved_slice_t -See :ref:`owned_types_concept` -.. c:type:: z_owned_slice_t - - Represents an array of bytes. +Functions +^^^^^^^^^ -.. c:type:: z_owned_bytes_t - - Represents an array of bytes container. +.. autocfunction:: primitives.h::z_slice_empty +.. autocfunction:: primitives.h::z_slice_copy_from_buf +.. autocfunction:: primitives.h::z_slice_from_buf +.. autocfunction:: primitives.h::z_slice_data +.. autocfunction:: primitives.h::z_slice_len +.. autocfunction:: primitives.h::z_slice_is_empty -.. c:type:: z_owned_bytes_writer_t +.. autocfunction:: primitives.h::z_view_slice_from_buf +.. c:function:: void z_view_slice_empty(z_view_slice_t * slice) - Represents a payload writer. + See :c:func:`z_slice_empty` -.. c:type:: ze_owned_serializer_t - Represents a data serializer (unstable). +Ownership Functions +^^^^^^^^^^^^^^^^^^^ -.. c:type:: z_owned_string_t +See details at :ref:`owned_types_concept` - Represents a string without null-terminator. +.. c:function:: void z_slice_drop(z_moved_slice_t * slice) +.. c:function:: void z_slice_clone(z_owned_slice_t * dst, const z_loaned_slice_t * slice) +.. c:function:: const z_loaned_slice_t * z_view_slice_loan(const z_view_slice_t * slice) +.. c:function:: z_loaned_slice_t * z_view_slice_loan_mut(z_view_slice_t * slice) +.. c:function:: const z_loaned_slice_t * z_slice_loan(const z_owned_slice_t * slice) +.. c:function:: z_loaned_slice_t * z_slice_loan_mut(z_owned_slice_t * slice) -.. c:type:: z_owned_keyexpr_t - Represents a key expression in Zenoh. +String +------ + +Represents a string without null-terminator. -.. c:type:: z_owned_config_t +Types +^^^^^ - Represents a Zenoh configuration, used to configure Zenoh sessions upon opening. +See details at :ref:`owned_types_concept` -.. c:type:: z_owned_session_t +.. c:type:: z_owned_string_t +.. c:type:: z_view_string_t +.. c:type:: z_loaned_string_t +.. c:type:: z_moved_string_t - Represents a Zenoh Session. +Functions +^^^^^^^^^ -.. c:type:: z_owned_subscriber_t +.. autocfunction:: primitives.h::z_string_empty +.. autocfunction:: primitives.h::z_string_copy_from_str +.. autocfunction:: primitives.h::z_string_copy_from_substr +.. autocfunction:: primitives.h::z_string_from_str +.. autocfunction:: primitives.h::z_string_data +.. autocfunction:: primitives.h::z_string_len +.. autocfunction:: primitives.h::z_string_is_empty +.. autocfunction:: primitives.h::z_string_as_slice - Represents a Zenoh Subscriber entity. +.. autocfunction:: primitives.h::z_view_string_from_str +.. autocfunction:: primitives.h::z_view_string_from_substr +.. c:function:: void z_view_string_empty(z_view_string_t * string) -.. c:type:: z_owned_publisher_t + See :c:func:`z_string_empty` - Represents a Zenoh Publisher entity. +Ownership Functions +^^^^^^^^^^^^^^^^^^^ -.. c:type:: z_owned_queryable_t +See details at :ref:`owned_types_concept` - Represents a Zenoh Queryable entity. +.. c:function:: void z_string_drop(z_moved_string_t * string) +.. c:function:: void z_string_clone(z_owned_string_t * dst, const z_loaned_string_t * string) +.. c:function:: const z_loaned_string_t * z_view_string_loan(const z_view_string_t * string) +.. c:function:: z_loaned_string_t * z_view_string_loan_mut(z_view_string_t * string) +.. c:function:: const z_loaned_string_t * z_string_loan(const z_owned_string_t * string) +.. c:function:: z_loaned_string_t * z_string_loan_mut(z_owned_string_t * string) -.. c:type:: z_owned_query_t - Represents a Zenoh Query entity, received by Zenoh queryable entities. +String Array +------------ -.. c:type:: z_owned_encoding_t +Represents an array of non null-terminated string. - Represents the encoding of a payload, in a MIME-like format. +Types +^^^^^ -.. c:type:: z_owned_reply_err_t +See details at :ref:`owned_types_concept` - Represents a Zenoh reply error value. +.. c:type:: z_owned_string_array_t +.. c:type:: z_loaned_string_array_t +.. c:type:: z_moved_string_array_t -.. c:type:: z_owned_sample_t +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_string_array_new +.. autocfunction:: primitives.h::z_string_array_push_by_alias +.. autocfunction:: primitives.h::z_string_array_push_by_copy +.. autocfunction:: primitives.h::z_string_array_get +.. autocfunction:: primitives.h::z_string_array_len +.. autocfunction:: primitives.h::z_string_array_is_empty - Represents a data sample. +Ownership Functions +^^^^^^^^^^^^^^^^^^^ -.. c:type:: z_owned_hello_t +See details at :ref:`owned_types_concept` - Represents the content of a `hello` message returned by a zenoh entity as a reply to a `scout` message. +.. c:function:: void z_string_array_drop(z_moved_string_array_t * string_array) +.. c:function:: void z_string_array_clone(z_owned_string_array_t * dst, const z_loaned_string_array_t * string_array) +.. c:function:: const z_loaned_string_array_t * z_string_array_loan(const z_owned_string_array_t * string_array) +.. c:function:: z_loaned_string_array_t * z_string_array_loan_mut(z_owned_string_array_t * string_array) -.. c:type:: z_owned_reply_t - Represents the reply to a query. +Common +====== -.. c:type:: z_owned_string_array_t +Key expression +-------------- - Represents an array of non null-terminated string. +Represents a key expression in Zenoh. -Loaned Types -~~~~~~~~~~~ +Types +^^^^^ -See :ref:`loaned_types_concept` +See details at :ref:`owned_types_concept` -.. c:type:: z_loaned_slice_t +.. c:type:: z_owned_keyexpr_t +.. c:type:: z_view_keyexpr_t +.. c:type:: z_loaned_keyexpr_t +.. c:type:: z_moved_keyexpr_t - Represents an array of bytes. +.. autocenum:: constants.h::z_keyexpr_intersection_level_t +.. autocenum:: constants.h::zp_keyexpr_canon_status_t -.. c:type:: z_loaned_bytes_t +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_keyexpr_from_str +.. autocfunction:: primitives.h::z_view_keyexpr_from_str +.. autocfunction:: primitives.h::z_keyexpr_from_str_autocanonize +.. autocfunction:: primitives.h::z_view_keyexpr_from_str_autocanonize +.. autocfunction:: primitives.h::z_view_keyexpr_from_str_unchecked +.. autocfunction:: primitives.h::z_keyexpr_from_substr +.. autocfunction:: primitives.h::z_view_keyexpr_from_substr +.. autocfunction:: primitives.h::z_keyexpr_from_substr_autocanonize +.. autocfunction:: primitives.h::z_view_keyexpr_from_substr_autocanonize +.. autocfunction:: primitives.h::z_view_keyexpr_from_substr_unchecked - Represents an array of bytes container. +.. autocfunction:: primitives.h::z_keyexpr_as_view_string -.. c:type:: z_loaned_bytes_writer_t +.. autocfunction:: primitives.h::z_keyexpr_canonize +.. autocfunction:: primitives.h::z_keyexpr_canonize_null_terminated +.. autocfunction:: primitives.h::z_keyexpr_is_canon - Represents a payload writer. +.. autocfunction:: primitives.h::z_keyexpr_concat +.. autocfunction:: primitives.h::z_keyexpr_join +.. autocfunction:: primitives.h::z_keyexpr_equals +.. autocfunction:: primitives.h::z_keyexpr_includes +.. autocfunction:: primitives.h::z_keyexpr_intersects +.. autocfunction:: primitives.h::z_keyexpr_relation_to -.. c:type:: ze_loaned_serializer_t +.. autocfunction:: primitives.h::z_declare_keyexpr +.. autocfunction:: primitives.h::z_undeclare_keyexpr - Represents a data serializer (unstable). +Ownership Functions +^^^^^^^^^^^^^^^^^^^ -.. c:type:: z_loaned_string_t +See details at :ref:`owned_types_concept` - Represents a string without null-terminator. +.. c:function:: void z_keyexpr_drop(z_moved_keyexpr_t * keyexpr) +.. c:function:: void z_keyexpr_clone(z_owned_keyexpr_t * dst, const z_loaned_keyexpr_t * keyexpr) +.. c:function:: const z_loaned_keyexpr_t * z_view_keyexpr_loan(const z_view_keyexpr_t * keyexpr) +.. c:function:: z_loaned_keyexpr_t * z_view_keyexpr_loan_mut(z_view_keyexpr_t * keyexpr) +.. c:function:: const z_loaned_keyexpr_t * z_keyexpr_loan(const z_owned_keyexpr_t * keyexpr) +.. c:function:: z_loaned_keyexpr_t * z_keyexpr_loan_mut(z_owned_keyexpr_t * keyexpr) -.. c:type:: z_loaned_keyexpr_t - Represents a key expression in Zenoh. +Encoding +-------- + +Represents the encoding of a payload, in a MIME-like format. -.. c:type:: z_loaned_config_t +Types +^^^^^ - Represents a Zenoh configuration, used to configure Zenoh sessions upon opening. +See details at :ref:`owned_types_concept` -.. c:type:: z_loaned_session_t +.. c:type:: z_owned_encoding_t +.. c:type:: z_loaned_encoding_t +.. c:type:: z_moved_encoding_t - Represents a Zenoh Session. +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_encoding_from_str +.. autocfunction:: primitives.h::z_encoding_from_substr +.. autocfunction:: primitives.h::z_encoding_set_schema_from_str +.. autocfunction:: primitives.h::z_encoding_set_schema_from_substr +.. autocfunction:: primitives.h::z_encoding_to_string +.. autocfunction:: primitives.h::z_encoding_equals +.. autocfunction:: encoding.h::z_encoding_loan_default -.. c:type:: z_loaned_subscriber_t +Ownership Functions +^^^^^^^^^^^^^^^^^^^ - Represents a Zenoh Subscriber entity. +See details at :ref:`owned_types_concept` -.. c:type:: z_loaned_publisher_t +.. c:function:: void z_encoding_drop(z_moved_encoding_t * encoding) +.. c:function:: void z_encoding_clone(z_owned_encoding_t * dst, const z_loaned_encoding_t * encoding) +.. c:function:: const z_loaned_encoding_t * z_encoding_loan(const z_owned_encoding_t * encoding) +.. c:function:: z_loaned_encoding_t * z_encoding_loan_mut(z_owned_encoding_t * encoding) - Represents a Zenoh Publisher entity. -.. c:type:: z_loaned_queryable_t +Predefined Encodings +^^^^^^^^^^^^^^^^^^^^ +.. autocfunction:: encoding.h::z_encoding_zenoh_bytes +.. autocfunction:: encoding.h::z_encoding_zenoh_int8 +.. autocfunction:: encoding.h::z_encoding_zenoh_int16 +.. autocfunction:: encoding.h::z_encoding_zenoh_int32 +.. autocfunction:: encoding.h::z_encoding_zenoh_int64 +.. autocfunction:: encoding.h::z_encoding_zenoh_int128 +.. autocfunction:: encoding.h::z_encoding_zenoh_uint8 +.. autocfunction:: encoding.h::z_encoding_zenoh_uint16 +.. autocfunction:: encoding.h::z_encoding_zenoh_uint32 +.. autocfunction:: encoding.h::z_encoding_zenoh_uint64 +.. autocfunction:: encoding.h::z_encoding_zenoh_uint128 +.. autocfunction:: encoding.h::z_encoding_zenoh_float32 +.. autocfunction:: encoding.h::z_encoding_zenoh_float64 +.. autocfunction:: encoding.h::z_encoding_zenoh_bool +.. autocfunction:: encoding.h::z_encoding_zenoh_string +.. autocfunction:: encoding.h::z_encoding_zenoh_error +.. autocfunction:: encoding.h::z_encoding_application_octet_stream +.. autocfunction:: encoding.h::z_encoding_text_plain +.. autocfunction:: encoding.h::z_encoding_application_json +.. autocfunction:: encoding.h::z_encoding_text_json +.. autocfunction:: encoding.h::z_encoding_application_cdr +.. autocfunction:: encoding.h::z_encoding_application_cbor +.. autocfunction:: encoding.h::z_encoding_application_yaml +.. autocfunction:: encoding.h::z_encoding_text_yaml +.. autocfunction:: encoding.h::z_encoding_text_json5 +.. autocfunction:: encoding.h::z_encoding_application_python_serialized_object +.. autocfunction:: encoding.h::z_encoding_application_protobuf +.. autocfunction:: encoding.h::z_encoding_application_java_serialized_object +.. autocfunction:: encoding.h::z_encoding_application_openmetrics_text +.. autocfunction:: encoding.h::z_encoding_image_png +.. autocfunction:: encoding.h::z_encoding_image_jpeg +.. autocfunction:: encoding.h::z_encoding_image_gif +.. autocfunction:: encoding.h::z_encoding_image_bmp +.. autocfunction:: encoding.h::z_encoding_image_webp +.. autocfunction:: encoding.h::z_encoding_application_xml +.. autocfunction:: encoding.h::z_encoding_application_x_www_form_urlencoded +.. autocfunction:: encoding.h::z_encoding_text_html +.. autocfunction:: encoding.h::z_encoding_text_xml +.. autocfunction:: encoding.h::z_encoding_text_css +.. autocfunction:: encoding.h::z_encoding_text_javascript +.. autocfunction:: encoding.h::z_encoding_text_markdown +.. autocfunction:: encoding.h::z_encoding_text_csv +.. autocfunction:: encoding.h::z_encoding_application_sql +.. autocfunction:: encoding.h::z_encoding_application_coap_payload +.. autocfunction:: encoding.h::z_encoding_application_json_patch_json +.. autocfunction:: encoding.h::z_encoding_application_json_seq +.. autocfunction:: encoding.h::z_encoding_application_jsonpath +.. autocfunction:: encoding.h::z_encoding_application_jwt +.. autocfunction:: encoding.h::z_encoding_application_mp4 +.. autocfunction:: encoding.h::z_encoding_application_soap_xml +.. autocfunction:: encoding.h::z_encoding_application_yang +.. autocfunction:: encoding.h::z_encoding_audio_aac +.. autocfunction:: encoding.h::z_encoding_audio_flac +.. autocfunction:: encoding.h::z_encoding_audio_mp4 +.. autocfunction:: encoding.h::z_encoding_audio_ogg +.. autocfunction:: encoding.h::z_encoding_audio_vorbis +.. autocfunction:: encoding.h::z_encoding_video_h261 +.. autocfunction:: encoding.h::z_encoding_video_h263 +.. autocfunction:: encoding.h::z_encoding_video_h264 +.. autocfunction:: encoding.h::z_encoding_video_h265 +.. autocfunction:: encoding.h::z_encoding_video_h266 +.. autocfunction:: encoding.h::z_encoding_video_mp4 +.. autocfunction:: encoding.h::z_encoding_video_ogg +.. autocfunction:: encoding.h::z_encoding_video_raw +.. autocfunction:: encoding.h::z_encoding_video_vp8 +.. autocfunction:: encoding.h::z_encoding_video_vp9 - Represents a Zenoh Queryable entity. - -.. c:type:: z_loaned_query_t +Reply Error +----------- - Represents a Zenoh Query entity, received by Zenoh queryable entities. +Represents a Zenoh reply error value. -.. c:type:: z_loaned_encoding_t +Types +^^^^^ - Represents the encoding of a payload, in a MIME-like format. +See details at :ref:`owned_types_concept` +.. c:type:: z_owned_reply_err_t .. c:type:: z_loaned_reply_err_t +.. c:type:: z_moved_reply_err_t - Represents a Zenoh reply error. - -.. c:type:: z_loaned_sample_t +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_reply_err_payload +.. autocfunction:: primitives.h::z_reply_err_encoding - Represents a data sample. +Ownership Functions +^^^^^^^^^^^^^^^^^^^ -.. c:type:: z_loaned_hello_t +See details at :ref:`owned_types_concept` - Represents the content of a `hello` message returned by a zenoh entity as a reply to a `scout` message. +.. c:function:: void z_reply_err_drop(z_moved_reply_err_t * reply_err) +.. c:function:: void z_reply_err_clone(z_owned_reply_err_t * dst, const z_loaned_reply_err_t * reply_err) +.. c:function:: const z_loaned_reply_err_t * z_reply_err_loan(const z_owned_reply_err_t * reply_err) -.. c:type:: z_loaned_reply_t - Represents the reply to a query. +Sample +------ -.. c:type:: z_loaned_string_array_t +Represents a data sample. - Represents an array of non null-terminated string. +Types +^^^^^ -View Types -~~~~~~~~~~~ +See details at :ref:`owned_types_concept` -See :ref:`view_types_concept` +.. c:type:: z_owned_sample_t +.. c:type:: z_loaned_sample_t +.. c:type:: z_moved_sample_t -.. c:type:: z_view_string_t +.. autocenum:: constants.h::z_sample_kind_t - Represents a string without null-terminator. +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_sample_timestamp +.. autocfunction:: primitives.h::z_sample_attachment +.. autocfunction:: primitives.h::z_sample_encoding +.. autocfunction:: primitives.h::z_sample_payload +.. autocfunction:: primitives.h::z_sample_keyexpr +.. autocfunction:: primitives.h::z_sample_priority +.. autocfunction:: primitives.h::z_sample_congestion_control +.. autocfunction:: primitives.h::z_sample_express +.. autocfunction:: primitives.h::z_sample_reliability +.. autocfunction:: primitives.h::z_sample_kind -.. c:type:: z_view_slice_t +Ownership Functions +^^^^^^^^^^^^^^^^^^^ - Represents an array of bytes. +See details at :ref:`owned_types_concept` -.. c:type:: z_view_keyexpr_t +.. c:function:: void z_sample_drop(z_moved_sample_t * sample) +.. c:function:: void z_sample_clone(z_owned_sample_t * dst, const z_loaned_sample_t * sample) +.. c:function:: const z_loaned_sample_t * z_sample_loan(const z_owned_sample_t * sample) - Represents a key expression in Zenoh. -.. c:type:: z_view_string_array_t +Timestamp +--------- +Types +^^^^^ +.. c:type:: z_timestamp_t - Represents an array of non null-terminated string. +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_timestamp_id +.. autocfunction:: primitives.h::z_timestamp_ntp64_time +.. autocfunction:: primitives.h::z_timestamp_check Closures -~~~~~~~~ +======== A closure is a structure that contains all the elements for stateful, memory-leak-free callbacks: - context: a pointer to an arbitrary state. @@ -247,94 +406,696 @@ It is guaranteed that: - ``drop`` will only be called **once**, and **after every** ``call`` has ended. - The two previous guarantees imply that ``call`` and ``drop`` are never called concurrently. -Represents a `sample` closure. +Sample closure +--------------- +Types +^^^^^ -.. c:type:: types.h::z_owned_closure_sample_t +See details at :ref:`owned_types_concept` -Represents a loaned `sample` closure. +.. c:type:: z_owned_closure_sample_t +.. c:type:: z_loaned_closure_sample_t +.. c:type:: z_moved_closure_sample_t + +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_closure_sample +.. autocfunction:: primitives.h::z_closure_sample_call -.. c:type:: types.h::z_loaned_closure_sample_t +Ownership Functions +^^^^^^^^^^^^^^^^^^^ -Represents a `query` closure. +See details at :ref:`owned_types_concept` -.. c:type:: types.h::z_owned_closure_query_t +.. c:function:: const z_loaned_closure_sample_t * z_closure_sample_loan(const z_owned_closure_sample_t * closure) +.. c:function:: void z_closure_sample_drop(z_moved_closure_sample_t * closure) -Represents a loaned `query` closure. +Query closure +------------- +Types +^^^^^ -.. c:type:: types.h::z_loaned_closure_query_t +See details at :ref:`owned_types_concept` -Represents a `reply` closure. +.. c:type:: z_owned_closure_query_t +.. c:type:: z_loaned_closure_query_t +.. c:type:: z_moved_closure_query_t + +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_closure_query +.. autocfunction:: primitives.h::z_closure_query_call -.. c:type:: types.h::z_owned_closure_reply_t +Ownership Functions +^^^^^^^^^^^^^^^^^^^ -Represents a loaned `reply` closure. +See details at :ref:`owned_types_concept` -.. c:type:: types.h::z_loaned_closure_reply_t +.. c:function:: const z_loaned_closure_query_t * z_closure_query_loan(const z_owned_closure_query_t * closure) +.. c:function:: void z_closure_query_drop(z_moved_closure_query_t * closure) -Represents a `hello` closure. -.. c:type:: types.h::z_owned_closure_hello_t +Reply closure +------------- +Types +^^^^^ -Represents a loaned `hello` closure. +See details at :ref:`owned_types_concept` -.. c:type:: types.h::z_loaned_closure_hello_t +.. c:type:: z_owned_closure_reply_t +.. c:type:: z_loaned_closure_reply_t +.. c:type:: z_moved_closure_reply_t + +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_closure_reply +.. autocfunction:: primitives.h::z_closure_reply_call -Represents a `Zenoh id` closure. +Ownership Functions +^^^^^^^^^^^^^^^^^^^ -.. c:type:: types.h::z_owned_closure_zid_t +See details at :ref:`owned_types_concept` -Represents a loaned `Zenoh id` closure. +.. c:function:: const z_loaned_closure_reply_t * z_closure_reply_loan(const z_owned_closure_reply_t * closure) +.. c:function:: void z_closure_reply_drop(z_moved_closure_reply_t * closure) -.. c:type:: types.h::z_loaned_closure_zid_t +Hello closure +------------- +Types +^^^^^ -Zenoh Functions ---------------- +See details at :ref:`owned_types_concept` -Macros -~~~~~~ -.. autocmacro:: macros.h::z_loan -.. autocmacro:: macros.h::z_move -.. autocmacro:: macros.h::z_clone -.. autocmacro:: macros.h::z_drop -.. autocmacro:: macros.h::z_closure +.. c:type:: z_owned_closure_hello_t +.. c:type:: z_loaned_closure_hello_t +.. c:type:: z_moved_closure_hello_t + +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_closure_hello +.. autocfunction:: primitives.h::z_closure_hello_call -Primitives -~~~~~~~~~~ +Ownership Functions +^^^^^^^^^^^^^^^^^^^ -.. autocfunction:: primitives.h::z_view_string_from_str -.. autocfunction:: primitives.h::z_view_string_from_substr -.. autocfunction:: primitives.h::z_view_keyexpr_from_str -.. autocfunction:: primitives.h::z_view_keyexpr_from_str_unchecked -.. autocfunction:: primitives.h::z_view_keyexpr_from_str_autocanonize -.. autocfunction:: primitives.h::z_keyexpr_as_view_string -.. autocfunction:: primitives.h::z_keyexpr_is_canon -.. autocfunction:: primitives.h::z_keyexpr_canonize -.. autocfunction:: primitives.h::z_keyexpr_canonize_null_terminated -.. autocfunction:: primitives.h::z_keyexpr_includes -.. autocfunction:: primitives.h::z_keyexpr_intersects -.. autocfunction:: primitives.h::z_keyexpr_equals -.. autocfunction:: primitives.h::z_keyexpr_relation_to -.. autocfunction:: primitives.h::z_keyexpr_concat -.. autocfunction:: primitives.h::z_keyexpr_join -.. autocfunction:: primitives.h::z_config_new -.. autocfunction:: primitives.h::z_config_default -.. autocfunction:: primitives.h::zp_config_get -.. autocfunction:: primitives.h::zp_config_insert -.. autocfunction:: primitives.h::z_encoding_from_str -.. autocfunction:: primitives.h::z_encoding_from_substr -.. autocfunction:: primitives.h::z_encoding_set_schema_from_str -.. autocfunction:: primitives.h::z_encoding_set_schema_from_substr -.. autocfunction:: primitives.h::z_encoding_to_string -.. autocfunction:: primitives.h::z_encoding_equals -.. autocfunction:: primitives.h::z_reply_err_payload -.. autocfunction:: primitives.h::z_reply_err_encoding -.. autocfunction:: primitives.h::z_slice_from_buf -.. autocfunction:: primitives.h::z_slice_copy_from_buf -.. autocfunction:: primitives.h::z_slice_data -.. autocfunction:: primitives.h::z_slice_len -.. autocfunction:: primitives.h::z_slice_empty -.. autocfunction:: primitives.h::z_slice_is_empty +See details at :ref:`owned_types_concept` + +.. c:function:: const z_loaned_closure_hello_t * z_closure_hello_loan(const z_owned_closure_hello_t * closure) +.. c:function:: void z_closure_hello_drop(z_moved_closure_hello_t * closure) + + +ID closure +---------- +Types +^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_closure_zid_t +.. c:type:: z_loaned_closure_zid_t +.. c:type:: z_moved_closure_zid_t + +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_closure_zid +.. autocfunction:: primitives.h::z_closure_zid_call + +Ownership Functions +^^^^^^^^^^^^^^^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:function:: const z_loaned_closure_zid_t * z_closure_zid_loan(const z_owned_closure_zid_t * closure) +.. c:function:: void z_closure_zid_drop(z_moved_closure_zid_t * closure) + + +.. _channels_concept: + +Channels +======== + +The concept of channels and handlers revolves around managing communication between different components using two types of channels: FIFO (First-In-First-Out) and Ring Buffers. These channels support handling various item types such as sample, reply, and query, with distinct methods available for each. + +The FIFO channel ensures that data is received in the order it was sent. It supports blocking and non-blocking (try) reception of data. +If the channel is dropped, the handlers transition into a "gravestone" state, signifying that no more data will be sent or received. + +The Ring channel differs from FIFO in that data is overwritten if the buffer is full, but it still supports blocking and non-blocking reception of data. As with the FIFO channel, the handler can be dropped, resetting it to a gravestone state. + +The methods are common for all channles: + +- `z_yyy_channel_xxx_new`: Constructs the send and receive ends of the `yyy` (`fifo` or `ring`) channel for items type `xxx`. +- `z_yyy_handler_xxx_recv`: Receives an item from the channel (blocking). If no more items are available or the channel is dropped, the item transitions to the gravestone state. +- `z_yyy_handler_xxx_try_recv`: Attempts to receive an item immediately (non-blocking). Returns a gravestone state if no data is available. +- `z_yyy_handler_xxx_loan`: Borrows the handler for access. +- `z_yyy_handler_xxx_drop`: Drops the the handler, setting it to a gravestone state. + + +Sample channel +-------------- + +Types +^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_fifo_handler_sample_t +.. c:type:: z_loaned_fifo_handler_sample_t +.. c:type:: z_owned_ring_handler_sample_t +.. c:type:: z_loaned_ring_handler_sample_t + +Methods +^^^^^^^ +.. c:function:: void z_fifo_channel_sample_new(z_owned_closure_sample_t * callback, z_owned_fifo_handler_sample_t * handler, size_t capacity) +.. c:function:: void z_ring_channel_sample_new(z_owned_closure_sample_t * callback, z_owned_ring_handler_sample_t * handler, size_t capacity) + +See details at :ref:`channels_concept` + +.. c:function:: z_result_t z_fifo_handler_sample_recv(const z_loaned_fifo_handler_sample_t * handler, z_owned_sample_t * sample) +.. c:function:: z_result_t z_fifo_handler_sample_try_recv(const z_loaned_fifo_handler_sample_t * handler, z_owned_sample_t * sample) +.. c:function:: z_result_t z_ring_handler_sample_recv(const z_loaned_ring_handler_sample_t * handler, z_owned_sample_t * sample) +.. c:function:: z_result_t z_ring_handler_sample_try_recv(const z_loaned_ring_handler_sample_t * handler, z_owned_sample_t * sample) + +See details at :ref:`channels_concept` + +.. c:function:: const z_loaned_fifo_handler_sample_t * z_fifo_handler_sample_loan(const z_owned_fifo_handler_sample_t * handler) +.. c:function:: void z_fifo_handler_sample_drop(z_moved_fifo_handler_sample_t * handler) +.. c:function:: const z_loaned_ring_handler_sample_t * z_ring_handler_sample_loan(const z_owned_ring_handler_sample_t * handler) +.. c:function:: void z_ring_handler_sample_drop(z_moved_ring_handler_sample_t * handler) + +See details at :ref:`owned_types_concept` + + +Query channel +------------- + +Types +^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_fifo_handler_query_t +.. c:type:: z_loaned_fifo_handler_query_t +.. c:type:: z_owned_ring_handler_query_t +.. c:type:: z_loaned_ring_handler_query_t + +Methods +^^^^^^^ +.. c:function:: void z_fifo_channel_query_new(z_owned_closure_query_t * callback, z_owned_fifo_handler_query_t * handler, size_t capacity) +.. c:function:: void z_ring_channel_query_new(z_owned_closure_query_t * callback, z_owned_ring_handler_query_t * handler, size_t capacity) + +See details at :ref:`channels_concept` + +.. c:function:: z_result_t z_fifo_handler_query_recv(const z_loaned_fifo_handler_query_t * handler, z_owned_query_t * query) +.. c:function:: z_result_t z_fifo_handler_query_try_recv(const z_loaned_fifo_handler_query_t * handler, z_owned_query_t * query) +.. c:function:: z_result_t z_ring_handler_query_recv(const z_loaned_ring_handler_query_t * handler, z_owned_query_t * query) +.. c:function:: z_result_t z_ring_handler_query_try_recv(const z_loaned_ring_handler_query_t * handler, z_owned_query_t * query) + +See details at :ref:`channels_concept` + +.. c:function:: const z_loaned_fifo_handler_query_t * z_fifo_handler_query_loan(const z_owned_fifo_handler_query_t * handler) +.. c:function:: void z_fifo_handler_query_drop(z_moved_fifo_handler_query_t * handler) +.. c:function:: const z_loaned_ring_handler_query_t * z_ring_handler_query_loan(const z_owned_ring_handler_query_t * handler) +.. c:function:: void z_ring_handler_query_drop(z_moved_ring_handler_query_t * handler) + +See details at :ref:`owned_types_concept` + +Reply channel +------------- + +Types +^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_fifo_handler_reply_t +.. c:type:: z_loaned_fifo_handler_reply_t +.. c:type:: z_owned_ring_handler_reply_t +.. c:type:: z_loaned_ring_handler_reply_t + +Methods +^^^^^^^ +.. c:function:: void z_fifo_channel_reply_new(z_owned_closure_reply_t * callback, z_owned_fifo_handler_reply_t * handler, size_t capacity) +.. c:function:: void z_ring_channel_reply_new(z_owned_closure_reply_t * callback, z_owned_ring_handler_reply_t * handler, size_t capacity) + +See details at :ref:`channels_concept` + +.. c:function:: z_result_t z_fifo_handler_reply_recv(const z_loaned_fifo_handler_reply_t * handler, z_owned_reply_t * reply) +.. c:function:: z_result_t z_fifo_handler_reply_try_recv(const z_loaned_fifo_handler_reply_t * handler, z_owned_reply_t * reply) +.. c:function:: z_result_t z_ring_handler_reply_recv(const z_loaned_ring_handler_reply_t * handler, z_owned_reply_t * reply) +.. c:function:: z_result_t z_ring_handler_reply_try_recv(const z_loaned_ring_handler_reply_t * handler, z_owned_reply_t * reply) + +See details at :ref:`channels_concept` + +.. c:function:: const z_loaned_fifo_handler_reply_t * z_fifo_handler_reply_loan(const z_owned_fifo_handler_reply_t * handler) +.. c:function:: void z_fifo_handler_reply_drop(z_moved_fifo_handler_reply_t * handler) +.. c:function:: const z_loaned_ring_handler_reply_t * z_ring_handler_reply_loan(const z_owned_ring_handler_reply_t * handler) +.. c:function:: void z_ring_handler_reply_drop(z_moved_ring_handler_reply_t * handler) + +See details at :ref:`owned_types_concept` + + +System +====== +Random +------ +Functions +^^^^^^^^^ +.. autocfunction:: platform_common.h::z_random_u8 +.. autocfunction:: platform_common.h::z_random_u16 +.. autocfunction:: platform_common.h::z_random_u32 +.. autocfunction:: platform_common.h::z_random_u64 +.. autocfunction:: platform_common.h::z_random_fill + +Sleep +------ +Functions +^^^^^^^^^ +.. autocfunction:: platform_common.h::z_sleep_s +.. autocfunction:: platform_common.h::z_sleep_ms +.. autocfunction:: platform_common.h::z_sleep_us + +Time +---- + +Types +^^^^^ +.. c:type:: z_clock_t +.. c:type:: z_time_t + +Functions +^^^^^^^^^ +.. autocfunction:: platform_common.h::z_clock_now +.. autocfunction:: platform_common.h::z_clock_elapsed_s +.. autocfunction:: platform_common.h::z_clock_elapsed_ms +.. autocfunction:: platform_common.h::z_clock_elapsed_us + +.. autocfunction:: platform_common.h::z_time_now +.. autocfunction:: platform_common.h::z_time_elapsed_s +.. autocfunction:: platform_common.h::z_time_elapsed_ms +.. autocfunction:: platform_common.h::z_time_elapsed_us +.. autocfunction:: platform_common.h::z_time_now_as_str + + +Mutex +----- +Types +^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_mutex_t +.. c:type:: z_loaned_mutex_t +.. c:type:: z_moved_mutex_t + +Functions +^^^^^^^^^ + +.. autocfunction:: platform_common.h::z_mutex_init +.. autocfunction:: platform_common.h::z_mutex_lock +.. autocfunction:: platform_common.h::z_mutex_unlock +.. autocfunction:: platform_common.h::z_mutex_try_lock + +Ownership Functions +^^^^^^^^^^^^^^^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:function:: void z_mutex_drop(z_moved_mutex_t * mutex) +.. c:function:: const z_loaned_mutex_t * z_mutex_loan(const z_owned_mutex_t * mutex) + + +Conditional Variable +-------------------- +Types +^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_condvar_t +.. c:type:: z_loaned_condvar_t +.. c:type:: z_moved_condvar_t + +Functions +^^^^^^^^^ +.. autocfunction:: platform_common.h::z_condvar_init +.. autocfunction:: platform_common.h::z_condvar_wait +.. autocfunction:: platform_common.h::z_condvar_signal + +Ownership Functions +^^^^^^^^^^^^^^^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:function:: void z_condvar_drop(z_moved_condvar_t * condvar) +.. c:function:: const z_loaned_condvar_t * z_condvar_loan(const z_owned_condvar_t * condvar) + + +Task +---- +Types +^^^^^ +.. c:type:: z_owned_task_t +.. c:type:: z_moved_task_t + +Functions +^^^^^^^^^ +.. autocfunction:: platform_common.h::z_task_init +.. autocfunction:: platform_common.h::z_task_join +.. TODO: implement .. autocfunction:: platform_common.h::z_task_detach + +Ownership Functions +^^^^^^^^^^^^^^^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:function:: void z_task_drop(z_moved_task_t * task) + +Session +======= + +Session configuration +--------------------- + +Represents a Zenoh configuration, used to configure Zenoh sessions upon opening. + +Types +^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_config_t +.. c:type:: z_loaned_config_t +.. c:type:: z_moved_config_t + +Functions +^^^^^^^^^ + +.. autocfunction:: primitives.h::z_config_new +.. autocfunction:: primitives.h::z_config_default +.. autocfunction:: primitives.h::zp_config_get +.. autocfunction:: primitives.h::zp_config_insert + +Ownership Functions +^^^^^^^^^^^^^^^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:function:: void z_config_drop(z_moved_config_t * config) +.. c:function:: void z_config_clone(z_owned_config_t * dst, const z_loaned_config_t * config) +.. c:function:: const z_loaned_config_t * z_config_loan(const z_owned_config_t * config) +.. c:function:: z_loaned_config_t * z_config_loan_mut(z_owned_config_t * config) + + +Session management +------------------ + +Represents a Zenoh Session. + +Types +^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_session_t +.. c:type:: z_loaned_session_t +.. c:type:: z_moved_session_t + +.. c:type:: z_id_t + +Functions +^^^^^^^^^ +.. autocfunction:: primitives.h::z_open +.. autocfunction:: primitives.h::z_close + +.. autocfunction:: primitives.h::z_info_zid +.. autocfunction:: primitives.h::z_info_routers_zid +.. autocfunction:: primitives.h::z_info_peers_zid +.. autocfunction:: primitives.h::z_id_to_string + +Ownership Functions +^^^^^^^^^^^^^^^^^^^ + +See details at :ref:`owned_types_concept` + +.. c:function:: const z_loaned_session_t * z_session_loan(const z_owned_session_t * closure) +.. c:function:: void z_session_drop(z_moved_session_t * closure) + + +Publication +=========== + +Represents a Zenoh Publisher entity. + +Types +----- + +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_publisher_t +.. c:type:: z_loaned_publisher_t +.. c:type:: z_moved_publisher_t + +Option Types +------------ + +.. autoctype:: types.h::z_put_options_t +.. autoctype:: types.h::z_delete_options_t +.. autoctype:: types.h::z_publisher_options_t +.. autoctype:: types.h::z_publisher_put_options_t +.. autoctype:: types.h::z_publisher_delete_options_t + +Constants +--------- + +.. autocenum:: constants.h::z_congestion_control_t +.. autocenum:: constants.h::z_priority_t +.. autocenum:: constants.h::z_reliability_t + +Functions +--------- +.. autocfunction:: primitives.h::z_put +.. autocfunction:: primitives.h::z_delete + +.. autocfunction:: primitives.h::z_declare_publisher +.. autocfunction:: primitives.h::z_publisher_put +.. autocfunction:: primitives.h::z_publisher_delete +.. autocfunction:: primitives.h::z_undeclare_publisher +.. autocfunction:: primitives.h::z_publisher_keyexpr + +.. autocfunction:: primitives.h::z_put_options_default +.. autocfunction:: primitives.h::z_delete_options_default +.. autocfunction:: primitives.h::z_publisher_options_default +.. autocfunction:: primitives.h::z_publisher_put_options_default +.. autocfunction:: primitives.h::z_publisher_delete_options_default +.. TODO: implement .. autocfunction:: primitives.h::z_reliability_default + +Ownership Functions +------------------- + +See details at :ref:`owned_types_concept` + +.. c:function:: const z_loaned_publisher_t * z_publisher_loan(const z_owned_publisher_t * closure) +.. c:function:: void z_publisher_drop(z_moved_publisher_t * closure) + + +Subscription +============ + +Types +----- + +Represents a Zenoh Subscriber entity. +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_subscriber_t +.. c:type:: z_loaned_subscriber_t +.. c:type:: z_moved_subscriber_t + +Option Types +------------ + +.. autoctype:: types.h::z_subscriber_options_t + +Functions +--------- + +.. autocfunction:: primitives.h::z_declare_subscriber +.. autocfunction:: primitives.h::z_undeclare_subscriber + +.. autocfunction:: primitives.h::z_subscriber_options_default +.. autocfunction:: primitives.h::z_subscriber_keyexpr + +Ownership Functions +------------------- + +See details at :ref:`owned_types_concept` + +.. c:function:: const z_loaned_subscriber_t * z_subscriber_loan(const z_owned_subscriber_t * closure) +.. c:function:: void z_subscriber_drop(z_moved_subscriber_t * closure) + + +Queryable +========= + +Types +----- + +Represents a Zenoh Queryable entity. +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_queryable_t +.. c:type:: z_loaned_queryable_t +.. c:type:: z_moved_queryable_t + +Represents a Zenoh Query entity, received by Zenoh queryable entities. +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_query_t +.. c:type:: z_loaned_query_t +.. c:type:: z_moved_query_t + +Option Types +------------ + +.. autoctype:: types.h::z_queryable_options_t +.. autoctype:: types.h::z_query_reply_options_t +.. autoctype:: types.h::z_query_reply_err_options_t +.. autoctype:: types.h::z_query_reply_del_options_t + +Functions +--------- +.. autocfunction:: primitives.h::z_declare_queryable +.. autocfunction:: primitives.h::z_undeclare_queryable + +.. autocfunction:: primitives.h::z_queryable_options_default +.. autocfunction:: primitives.h::z_query_reply_options_default +.. autocfunction:: primitives.h::z_query_reply_err_options_default +.. autocfunction:: primitives.h::z_query_reply_del_options_default + +.. autocfunction:: primitives.h::z_query_keyexpr +.. autocfunction:: primitives.h::z_query_parameters +.. autocfunction:: primitives.h::z_query_payload +.. autocfunction:: primitives.h::z_query_encoding +.. autocfunction:: primitives.h::z_query_attachment +.. autocfunction:: primitives.h::z_query_reply +.. autocfunction:: primitives.h::z_query_reply_err +.. autocfunction:: primitives.h::z_query_reply_del + +Ownership Functions +------------------- + +See details at :ref:`owned_types_concept` + +.. c:function:: void z_queryable_drop(z_moved_queryable_t * closure) +.. c:function:: const z_loaned_queryable_t * z_queryable_loan(const z_owned_queryable_t * closure) + +.. c:function:: void z_query_drop(z_moved_query_t * query) +.. c:function:: void z_query_clone(z_owned_query_t * dst, const z_loaned_query_t * query) +.. c:function:: const z_loaned_query_t * z_query_loan(const z_owned_query_t * query) + +Query +===== +Types +----- + +Represents the reply to a query. +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_reply_t +.. c:type:: z_loaned_reply_t +.. c:type:: z_moved_reply_t + +Option Types +------------ + +.. autoctype:: types.h::z_get_options_t +.. autocenum:: constants.h::z_query_target_t +.. autocenum:: constants.h::z_consolidation_mode_t +.. autoctype:: types.h::z_query_consolidation_t + +Functions +--------- + +.. autocfunction:: primitives.h::z_get +.. autocfunction:: primitives.h::z_get_options_default + +.. autocfunction:: primitives.h::z_query_consolidation_default +.. autocfunction:: primitives.h::z_query_consolidation_auto +.. autocfunction:: primitives.h::z_query_consolidation_none +.. autocfunction:: primitives.h::z_query_consolidation_monotonic +.. autocfunction:: primitives.h::z_query_consolidation_latest +.. autocfunction:: primitives.h::z_query_target_default + +.. autocfunction:: primitives.h::z_reply_is_ok +.. autocfunction:: primitives.h::z_reply_ok +.. autocfunction:: primitives.h::z_reply_err + +Ownership Functions +------------------- + +See details at :ref:`owned_types_concept` + +.. c:function:: void z_reply_drop(z_moved_reply_t * reply) +.. c:function:: void z_reply_clone(z_owned_reply_t * dst, const z_loaned_reply_t * reply) +.. c:function:: const z_loaned_reply_t * z_reply_loan(const z_owned_reply_t * reply) + + +Scouting +======== + +Types +----- + +Represents the content of a `hello` message returned by a zenoh entity as a reply to a `scout` message. +See details at :ref:`owned_types_concept` + +.. c:type:: z_owned_hello_t +.. c:type:: z_loaned_hello_t +.. c:type:: z_moved_hello_t + +Option Types +------------ + +.. autoctype:: types.h::z_scout_options_t + +Functions +--------- +.. autocfunction:: primitives.h::z_scout +.. autocfunction:: primitives.h::z_hello_whatami +.. autocfunction:: primitives.h::z_hello_locators +.. autocfunction:: primitives.h::zp_hello_locators +.. autocfunction:: primitives.h::z_hello_zid +.. autocfunction:: primitives.h::z_whatami_to_view_string +.. autocfunction:: primitives.h::z_scout_options_default + +Ownership Functions +------------------- + +See details at :ref:`owned_types_concept` + +.. c:function:: void z_hello_drop(z_moved_hello_t * hello) +.. c:function:: void z_hello_clone(z_owned_hello_t * dst, const z_loaned_hello_t * hello) +.. c:function:: const z_loaned_hello_t * z_hello_loan(const z_owned_hello_t * hello) + + +Serialization (unstable) +======================== + +Types +----- + +Represents a data serializer (unstable). +See details at :ref:`owned_types_concept` + +.. c:type:: ze_owned_serializer_t +.. c:type:: ze_loaned_serializer_t +.. c:type:: ze_moved_serializer_t + +.. autoctype:: serialization.h::ze_deserializer_t + +Functions +--------- .. autocfunction:: serialization.h::ze_deserializer_from_bytes .. autocfunction:: serialization.h::ze_deserializer_deserialize_int8 .. autocfunction:: serialization.h::ze_deserializer_deserialize_int16 @@ -393,190 +1154,58 @@ Primitives .. autocfunction:: serialization.h::ze_serialize_buf .. autocfunction:: serialization.h::ze_serialize_string .. autocfunction:: serialization.h::ze_serialize_str -.. autocfunction:: primitives.h::z_bytes_from_slice -.. autocfunction:: primitives.h::z_bytes_copy_from_slice -.. autocfunction:: primitives.h::z_bytes_from_buf -.. autocfunction:: primitives.h::z_bytes_copy_from_buf -.. autocfunction:: primitives.h::z_bytes_from_static_buf -.. autocfunction:: primitives.h::z_bytes_from_string -.. autocfunction:: primitives.h::z_bytes_copy_from_string -.. autocfunction:: primitives.h::z_bytes_from_str -.. autocfunction:: primitives.h::z_bytes_copy_from_str -.. autocfunction:: primitives.h::z_bytes_from_static_str -.. autocfunction:: primitives.h::z_bytes_empty -.. autocfunction:: primitives.h::z_bytes_len -.. autocfunction:: primitives.h::z_bytes_is_empty -.. autocfunction:: primitives.h::z_bytes_get_slice_iterator -.. autocfunction:: primitives.h::z_bytes_slice_iterator_next -.. autocfunction:: primitives.h::z_bytes_get_reader -.. autocfunction:: primitives.h::z_bytes_reader_read -.. autocfunction:: primitives.h::z_bytes_reader_seek -.. autocfunction:: primitives.h::z_bytes_reader_tell -.. autocfunction:: primitives.h::z_bytes_reader_remaining -.. autocfunction:: primitives.h::z_bytes_writer_empty -.. autocfunction:: primitives.h::z_bytes_writer_finish -.. autocfunction:: primitives.h::z_bytes_writer_write_all -.. autocfunction:: primitives.h::z_bytes_writer_append -.. autocfunction:: primitives.h::z_timestamp_check -.. autocfunction:: primitives.h::z_query_target_default -.. autocfunction:: primitives.h::z_query_consolidation_auto -.. autocfunction:: primitives.h::z_query_consolidation_default -.. autocfunction:: primitives.h::z_query_consolidation_latest -.. autocfunction:: primitives.h::z_query_consolidation_monotonic -.. autocfunction:: primitives.h::z_query_consolidation_none -.. autocfunction:: primitives.h::z_query_parameters -.. autocfunction:: primitives.h::z_query_payload -.. autocfunction:: primitives.h::z_query_encoding -.. autocfunction:: primitives.h::z_query_attachment -.. autocfunction:: primitives.h::z_query_keyexpr -.. autocfunction:: primitives.h::z_closure_sample -.. autocfunction:: primitives.h::z_closure_query -.. autocfunction:: primitives.h::z_closure_reply -.. autocfunction:: primitives.h::z_closure_hello -.. autocfunction:: primitives.h::z_closure_zid -.. autocfunction:: primitives.h::z_sample_loan -.. autocfunction:: primitives.h::z_string_data -.. autocfunction:: primitives.h::z_string_len -.. autocfunction:: primitives.h::z_string_from_str -.. autocfunction:: primitives.h::z_string_copy_from_str -.. autocfunction:: primitives.h::z_string_copy_from_substr -.. autocfunction:: primitives.h::z_string_empty -.. autocfunction:: primitives.h::z_string_is_empty -.. autocfunction:: primitives.h::z_string_as_slice -.. autocfunction:: primitives.h::z_hello_zid -.. autocfunction:: primitives.h::z_hello_whatami -.. autocfunction:: primitives.h::z_hello_locators -.. autocfunction:: primitives.h::zp_hello_locators -.. autocfunction:: primitives.h::z_whatami_to_view_string -.. autocfunction:: primitives.h::z_scout -.. autocfunction:: primitives.h::z_open -.. autocfunction:: primitives.h::z_close -.. autocfunction:: primitives.h::z_info_peers_zid -.. autocfunction:: primitives.h::z_info_routers_zid -.. autocfunction:: primitives.h::z_info_zid -.. autocfunction:: primitives.h::z_sample_keyexpr -.. autocfunction:: primitives.h::z_sample_payload -.. autocfunction:: primitives.h::z_sample_timestamp -.. autocfunction:: primitives.h::z_sample_encoding -.. autocfunction:: primitives.h::z_sample_kind -.. autocfunction:: primitives.h::z_sample_reliability -.. autocfunction:: primitives.h::z_sample_attachment -.. autocfunction:: primitives.h::z_put_options_default -.. autocfunction:: primitives.h::z_delete_options_default -.. autocfunction:: primitives.h::z_put -.. autocfunction:: primitives.h::z_delete -.. autocfunction:: primitives.h::z_publisher_options_default -.. autocfunction:: primitives.h::z_declare_publisher -.. autocfunction:: primitives.h::z_undeclare_publisher -.. autocfunction:: primitives.h::z_publisher_put_options_default -.. autocfunction:: primitives.h::z_publisher_delete_options_default -.. autocfunction:: primitives.h::z_publisher_put -.. autocfunction:: primitives.h::z_publisher_delete -.. autocfunction:: primitives.h::z_get_options_default -.. autocfunction:: primitives.h::z_get -.. autocfunction:: primitives.h::z_reply_is_ok -.. autocfunction:: primitives.h::z_reply_ok -.. autocfunction:: primitives.h::z_reply_err -.. autocfunction:: primitives.h::z_queryable_options_default -.. autocfunction:: primitives.h::z_declare_queryable -.. autocfunction:: primitives.h::z_undeclare_queryable -.. autocfunction:: primitives.h::z_query_reply_options_default -.. autocfunction:: primitives.h::z_query_reply -.. autocfunction:: primitives.h::z_query_reply_del_options_default -.. autocfunction:: primitives.h::z_query_reply_del -.. autocfunction:: primitives.h::z_query_reply_err_options_default -.. autocfunction:: primitives.h::z_query_reply_err -.. autocfunction:: primitives.h::z_keyexpr_from_str -.. autocfunction:: primitives.h::z_keyexpr_from_substr -.. autocfunction:: primitives.h::z_keyexpr_from_str_autocanonize -.. autocfunction:: primitives.h::z_keyexpr_from_substr_autocanonize -.. autocfunction:: primitives.h::z_string_array_new -.. autocfunction:: primitives.h::z_string_array_push_by_alias -.. autocfunction:: primitives.h::z_string_array_push_by_copy -.. autocfunction:: primitives.h::z_string_array_get -.. autocfunction:: primitives.h::z_string_array_len -.. autocfunction:: primitives.h::z_string_array_is_empty -.. autocfunction:: primitives.h::z_declare_keyexpr -.. autocfunction:: primitives.h::z_undeclare_keyexpr -.. autocfunction:: primitives.h::z_subscriber_options_default -.. autocfunction:: primitives.h::z_declare_subscriber -.. autocfunction:: primitives.h::z_undeclare_subscriber -.. autocfunction:: primitives.h::z_subscriber_keyexpr + + +Others +====== + +Data Structures +--------------- + +.. autoctype:: types.h::z_zint_t + +.. autoctype:: types.h::zp_task_read_options_t +.. autoctype:: types.h::zp_task_lease_options_t +.. autoctype:: types.h::zp_read_options_t +.. autoctype:: types.h::zp_send_keep_alive_options_t +.. autoctype:: types.h::zp_send_join_options_t + +Constants +--------- + +.. autocenum:: constants.h::z_whatami_t + +Macros +------ +.. autocmacro:: macros.h::z_loan +.. autocmacro:: macros.h::z_move +.. autocmacro:: macros.h::z_clone +.. autocmacro:: macros.h::z_drop +.. autocmacro:: macros.h::z_closure + +Functions +--------- + .. autocfunction:: primitives.h::zp_task_read_options_default .. autocfunction:: primitives.h::zp_start_read_task .. autocfunction:: primitives.h::zp_stop_read_task + .. autocfunction:: primitives.h::zp_task_lease_options_default .. autocfunction:: primitives.h::zp_start_lease_task .. autocfunction:: primitives.h::zp_stop_lease_task + .. autocfunction:: primitives.h::zp_read_options_default .. autocfunction:: primitives.h::zp_read + .. autocfunction:: primitives.h::zp_send_keep_alive_options_default .. autocfunction:: primitives.h::zp_send_keep_alive .. autocfunction:: primitives.h::zp_send_join_options_default .. autocfunction:: primitives.h::zp_send_join -.. autocfunction:: encoding.h::z_encoding_zenoh_bytes -.. autocfunction:: encoding.h::z_encoding_zenoh_int8 -.. autocfunction:: encoding.h::z_encoding_zenoh_int16 -.. autocfunction:: encoding.h::z_encoding_zenoh_int32 -.. autocfunction:: encoding.h::z_encoding_zenoh_int64 -.. autocfunction:: encoding.h::z_encoding_zenoh_int128 -.. autocfunction:: encoding.h::z_encoding_zenoh_uint8 -.. autocfunction:: encoding.h::z_encoding_zenoh_uint16 -.. autocfunction:: encoding.h::z_encoding_zenoh_uint32 -.. autocfunction:: encoding.h::z_encoding_zenoh_uint64 -.. autocfunction:: encoding.h::z_encoding_zenoh_uint128 -.. autocfunction:: encoding.h::z_encoding_zenoh_float32 -.. autocfunction:: encoding.h::z_encoding_zenoh_float64 -.. autocfunction:: encoding.h::z_encoding_zenoh_bool -.. autocfunction:: encoding.h::z_encoding_zenoh_string -.. autocfunction:: encoding.h::z_encoding_zenoh_error -.. autocfunction:: encoding.h::z_encoding_application_octet_stream -.. autocfunction:: encoding.h::z_encoding_text_plain -.. autocfunction:: encoding.h::z_encoding_application_json -.. autocfunction:: encoding.h::z_encoding_text_json -.. autocfunction:: encoding.h::z_encoding_application_cdr -.. autocfunction:: encoding.h::z_encoding_application_cbor -.. autocfunction:: encoding.h::z_encoding_application_yaml -.. autocfunction:: encoding.h::z_encoding_text_yaml -.. autocfunction:: encoding.h::z_encoding_text_json5 -.. autocfunction:: encoding.h::z_encoding_application_python_serialized_object -.. autocfunction:: encoding.h::z_encoding_application_protobuf -.. autocfunction:: encoding.h::z_encoding_application_java_serialized_object -.. autocfunction:: encoding.h::z_encoding_application_openmetrics_text -.. autocfunction:: encoding.h::z_encoding_image_png -.. autocfunction:: encoding.h::z_encoding_image_jpeg -.. autocfunction:: encoding.h::z_encoding_image_gif -.. autocfunction:: encoding.h::z_encoding_image_bmp -.. autocfunction:: encoding.h::z_encoding_image_webp -.. autocfunction:: encoding.h::z_encoding_application_xml -.. autocfunction:: encoding.h::z_encoding_application_x_www_form_urlencoded -.. autocfunction:: encoding.h::z_encoding_text_html -.. autocfunction:: encoding.h::z_encoding_text_xml -.. autocfunction:: encoding.h::z_encoding_text_css -.. autocfunction:: encoding.h::z_encoding_text_javascript -.. autocfunction:: encoding.h::z_encoding_text_markdown -.. autocfunction:: encoding.h::z_encoding_text_csv -.. autocfunction:: encoding.h::z_encoding_application_sql -.. autocfunction:: encoding.h::z_encoding_application_coap_payload -.. autocfunction:: encoding.h::z_encoding_application_json_patch_json -.. autocfunction:: encoding.h::z_encoding_application_json_seq -.. autocfunction:: encoding.h::z_encoding_application_jsonpath -.. autocfunction:: encoding.h::z_encoding_application_jwt -.. autocfunction:: encoding.h::z_encoding_application_mp4 -.. autocfunction:: encoding.h::z_encoding_application_soap_xml -.. autocfunction:: encoding.h::z_encoding_application_yang -.. autocfunction:: encoding.h::z_encoding_audio_aac -.. autocfunction:: encoding.h::z_encoding_audio_flac -.. autocfunction:: encoding.h::z_encoding_audio_mp4 -.. autocfunction:: encoding.h::z_encoding_audio_ogg -.. autocfunction:: encoding.h::z_encoding_audio_vorbis -.. autocfunction:: encoding.h::z_encoding_video_h261 -.. autocfunction:: encoding.h::z_encoding_video_h263 -.. autocfunction:: encoding.h::z_encoding_video_h264 -.. autocfunction:: encoding.h::z_encoding_video_h265 -.. autocfunction:: encoding.h::z_encoding_video_h266 -.. autocfunction:: encoding.h::z_encoding_video_mp4 -.. autocfunction:: encoding.h::z_encoding_video_ogg -.. autocfunction:: encoding.h::z_encoding_video_raw -.. autocfunction:: encoding.h::z_encoding_video_vp8 -.. autocfunction:: encoding.h::z_encoding_video_vp9 + +.. TODO Logging +.. TODO ======= + + + + + diff --git a/docs/conf.py b/docs/conf.py index 5a788dddf..9b980bcfb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -28,7 +28,7 @@ master_doc = 'index' extensions = ['sphinx_c_autodoc', 'sphinx_c_autodoc.napoleon'] language = 'c' -c_autodoc_roots = ['../include/zenoh-pico/api/'] +c_autodoc_roots = ['../include/zenoh-pico/api/', '../include/zenoh-pico/system/'] c_autodoc_compilation_args = [ "-DSPHINX_DOCS", "-DZ_FEATURE_UNSTABLE_API=1", diff --git a/include/zenoh-pico/api/primitives.h b/include/zenoh-pico/api/primitives.h index 05c6a3dfc..ab2391092 100644 --- a/include/zenoh-pico/api/primitives.h +++ b/include/zenoh-pico/api/primitives.h @@ -983,6 +983,11 @@ const z_loaned_keyexpr_t *z_query_keyexpr(const z_loaned_query_t *query); z_result_t z_closure_sample(z_owned_closure_sample_t *closure, z_data_handler_t call, z_dropper_handler_t drop, void *context); +/** + * Calls sample closure. + */ +void z_closure_sample_call(const z_loaned_closure_sample_t *closure, z_loaned_sample_t *sample); + /** * Builds a new query closure. * It consists on a structure that contains all the elements for stateful, memory-leak-free callbacks. @@ -998,6 +1003,11 @@ z_result_t z_closure_sample(z_owned_closure_sample_t *closure, z_data_handler_t z_result_t z_closure_query(z_owned_closure_query_t *closure, z_queryable_handler_t call, z_dropper_handler_t drop, void *context); +/** + * Calls query closure. + */ +void z_closure_query_call(const z_loaned_closure_query_t *closure, z_loaned_query_t *query); + /** * Builds a new reply closure. * It consists on a structure that contains all the elements for stateful, memory-leak-free callbacks. @@ -1013,6 +1023,11 @@ z_result_t z_closure_query(z_owned_closure_query_t *closure, z_queryable_handler z_result_t z_closure_reply(z_owned_closure_reply_t *closure, z_reply_handler_t call, z_dropper_handler_t drop, void *context); +/** + * Calls reply closure. + */ +void z_closure_reply_call(const z_loaned_closure_reply_t *closure, z_loaned_reply_t *reply); + /** * Builds a new hello closure. * It consists on a structure that contains all the elements for stateful, memory-leak-free callbacks. @@ -1028,6 +1043,11 @@ z_result_t z_closure_reply(z_owned_closure_reply_t *closure, z_reply_handler_t c z_result_t z_closure_hello(z_owned_closure_hello_t *closure, z_loaned_hello_handler_t call, z_dropper_handler_t drop, void *context); +/** + * Calls hello closure. + */ +void z_closure_hello_call(const z_loaned_closure_hello_t *closure, z_loaned_hello_t *hello); + /** * Builds a new zid closure. * It consists on a structure that contains all the elements for stateful, memory-leak-free callbacks. @@ -1038,10 +1058,15 @@ z_result_t z_closure_hello(z_owned_closure_hello_t *closure, z_loaned_hello_hand * context: Pointer to an arbitrary state. * * Return: - * The hello closure. + * The zid closure. */ z_result_t z_closure_zid(z_owned_closure_zid_t *closure, z_id_handler_t call, z_dropper_handler_t drop, void *context); +/** + * Calls zid closure. + */ +void z_closure_zid_call(const z_loaned_closure_zid_t *closure, const z_id_t *id); + /**************** Loans ****************/ _Z_OWNED_FUNCTIONS_DEF(string) _Z_OWNED_FUNCTIONS_DEF(keyexpr) @@ -1364,7 +1389,7 @@ const z_timestamp_t *z_sample_timestamp(const z_loaned_sample_t *sample); * sample: Pointer to a :c:type:`z_loaned_sample_t` to get the encoding from. * * Return: - * The encoding wrapped as a :c:type:`z_loaned_encoding_t*`. + * The encoding wrapped as a :c:type:`z_loaned_encoding_t`. */ const z_loaned_encoding_t *z_sample_encoding(const z_loaned_sample_t *sample); diff --git a/include/zenoh-pico/api/types.h b/include/zenoh-pico/api/types.h index 2e42bcbb4..3377e4f14 100644 --- a/include/zenoh-pico/api/types.h +++ b/include/zenoh-pico/api/types.h @@ -247,7 +247,7 @@ typedef struct { } z_queryable_options_t; /** - * Represents the configuration used to configure a query reply sent via :c:func:`z_query_reply. + * Represents the configuration used to configure a query reply sent via :c:func:`z_query_reply`. * * Members: * z_moved_encoding_t* encoding: The encoding of the payload. @@ -267,7 +267,7 @@ typedef struct { } z_query_reply_options_t; /** - * Represents the configuration used to configure a query reply delete sent via :c:func:`z_query_reply_del. + * Represents the configuration used to configure a query reply delete sent via :c:func:`z_query_reply_del`. * * Members: * z_congestion_control_t congestion_control: The congestion control to apply when routing this message. @@ -285,7 +285,7 @@ typedef struct { } z_query_reply_del_options_t; /** - * Represents the configuration used to configure a query reply error sent via :c:func:`z_query_reply_err. + * Represents the configuration used to configure a query reply error sent via :c:func:`z_query_reply_err`. * * Members: * z_moved_encoding_t* encoding: The encoding of the payload. @@ -502,8 +502,6 @@ typedef struct { */ _Z_OWNED_TYPE_VALUE(_z_closure_sample_t, closure_sample) -void z_closure_sample_call(const z_loaned_closure_sample_t *closure, z_loaned_sample_t *sample); - typedef _z_queryable_handler_t z_queryable_handler_t; typedef struct { @@ -525,8 +523,6 @@ typedef struct { */ _Z_OWNED_TYPE_VALUE(_z_closure_query_t, closure_query) -void z_closure_query_call(const z_loaned_closure_query_t *closure, z_loaned_query_t *query); - typedef _z_reply_handler_t z_reply_handler_t; typedef struct { @@ -548,8 +544,6 @@ typedef struct { */ _Z_OWNED_TYPE_VALUE(_z_closure_reply_t, closure_reply) -void z_closure_reply_call(const z_loaned_closure_reply_t *closure, z_loaned_reply_t *reply); - typedef void (*z_loaned_hello_handler_t)(z_loaned_hello_t *hello, void *arg); typedef struct { @@ -571,8 +565,6 @@ typedef struct { */ _Z_OWNED_TYPE_VALUE(_z_closure_hello_t, closure_hello) -void z_closure_hello_call(const z_loaned_closure_hello_t *closure, z_loaned_hello_t *hello); - typedef void (*z_id_handler_t)(const z_id_t *id, void *arg); typedef struct { @@ -593,8 +585,6 @@ typedef struct { */ _Z_OWNED_TYPE_VALUE(_z_closure_zid_t, closure_zid) -void z_closure_zid_call(const z_loaned_closure_zid_t *closure, const z_id_t *id); - #ifdef __cplusplus } #endif diff --git a/include/zenoh-pico/collections/arc_slice.h b/include/zenoh-pico/collections/arc_slice.h index fa45140cd..ce67d2975 100644 --- a/include/zenoh-pico/collections/arc_slice.h +++ b/include/zenoh-pico/collections/arc_slice.h @@ -22,7 +22,7 @@ #include "refcount.h" #include "slice.h" -#include "zenoh-pico/system/platform-common.h" +#include "zenoh-pico/system/platform_common.h" _Z_REFCOUNT_DEFINE(_z_slice, _z_slice) diff --git a/include/zenoh-pico/system/platform.h b/include/zenoh-pico/system/platform.h index a0bf54990..15e49548e 100644 --- a/include/zenoh-pico/system/platform.h +++ b/include/zenoh-pico/system/platform.h @@ -18,6 +18,6 @@ #include #include "zenoh-pico/config.h" -#include "zenoh-pico/system/platform-common.h" +#include "zenoh-pico/system/platform_common.h" #endif /* ZENOH_PICO_SYSTEM_PLATFORM_H */ diff --git a/include/zenoh-pico/system/platform-common.h b/include/zenoh-pico/system/platform_common.h similarity index 82% rename from include/zenoh-pico/system/platform-common.h rename to include/zenoh-pico/system/platform_common.h index 652b673a1..c2b3b65a2 100644 --- a/include/zenoh-pico/system/platform-common.h +++ b/include/zenoh-pico/system/platform_common.h @@ -15,7 +15,10 @@ #ifndef ZENOH_PICO_SYSTEM_PLATFORM_COMMON_H #define ZENOH_PICO_SYSTEM_PLATFORM_COMMON_H +#ifndef SPHINX_DOCS +// For some reason sphinx/clang doesn't handle bool types correctly if stdbool.h is included #include +#endif #include #include "zenoh-pico/api/olv_macros.h" @@ -65,10 +68,30 @@ void _z_report_system_error(int errcode); } while (false) /*------------------ Random ------------------*/ + +/** + * Generates a random unsigned 8-bit integer. + */ uint8_t z_random_u8(void); + +/** + * Generates a random unsigned 16-bit integer. + */ uint16_t z_random_u16(void); + +/** + * Generates a random unsigned 32-bit integer. + */ uint32_t z_random_u32(void); + +/** + * Generates a random unsigned 64-bit integer. + */ uint64_t z_random_u64(void); + +/** + * Fills buffer with random data. + */ void z_random_fill(void *buf, size_t len); /*------------------ Memory ------------------*/ @@ -85,18 +108,21 @@ typedef void *z_task_attr_t; #endif /*------------------ Thread ------------------*/ +_Z_OWNED_TYPE_VALUE(_z_task_t, task) +_Z_OWNED_FUNCTIONS_SYSTEM_DEF(task) + z_result_t _z_task_init(_z_task_t *task, z_task_attr_t *attr, void *(*fun)(void *), void *arg); z_result_t _z_task_join(_z_task_t *task); z_result_t _z_task_cancel(_z_task_t *task); void _z_task_free(_z_task_t **task); -_Z_OWNED_TYPE_VALUE(_z_task_t, task) -_Z_OWNED_FUNCTIONS_SYSTEM_DEF(task) - z_result_t z_task_init(z_owned_task_t *task, z_task_attr_t *attr, void *(*fun)(void *), void *arg); z_result_t z_task_join(z_owned_task_t *task); /*------------------ Mutex ------------------*/ +_Z_OWNED_TYPE_VALUE(_z_mutex_t, mutex) +_Z_OWNED_FUNCTIONS_SYSTEM_DEF(mutex) + z_result_t _z_mutex_init(_z_mutex_t *m); z_result_t _z_mutex_drop(_z_mutex_t *m); @@ -104,17 +130,50 @@ z_result_t _z_mutex_lock(_z_mutex_t *m); z_result_t _z_mutex_try_lock(_z_mutex_t *m); z_result_t _z_mutex_unlock(_z_mutex_t *m); -_Z_OWNED_TYPE_VALUE(_z_mutex_t, mutex) -_Z_OWNED_FUNCTIONS_SYSTEM_DEF(mutex) - +/** + * Constructs a mutex. + * + * Returns: + * 0 in case of success, negative error code otherwise. + */ z_result_t z_mutex_init(z_owned_mutex_t *m); + +/** + * Drops mutex and resets it to its gravestone state. + * + * Returns: + * 0 in case of success, negative error code otherwise. + */ z_result_t z_mutex_drop(z_moved_mutex_t *m); +/** + * Locks mutex. If mutex is already locked, blocks the thread until it aquires the lock. + * + * Returns: + * 0 in case of success, negative error code otherwise. + */ z_result_t z_mutex_lock(z_loaned_mutex_t *m); + +/** + * Tries to lock mutex. If mutex is already locked, return immediately. + * + * Returns: + * 0 in case of success, negative error code otherwise. + */ z_result_t z_mutex_try_lock(z_loaned_mutex_t *m); + +/** + * Unlocks previously locked mutex. If mutex was not locked by the current thread, the behaviour is undefined. + * + * Returns: + * 0 in case of success, negative error code otherwise. + */ z_result_t z_mutex_unlock(z_loaned_mutex_t *m); /*------------------ CondVar ------------------*/ +_Z_OWNED_TYPE_VALUE(_z_condvar_t, condvar) +_Z_OWNED_FUNCTIONS_SYSTEM_DEF(condvar) + z_result_t _z_condvar_init(_z_condvar_t *cv); z_result_t _z_condvar_drop(_z_condvar_t *cv); @@ -122,9 +181,6 @@ z_result_t _z_condvar_signal(_z_condvar_t *cv); z_result_t _z_condvar_signal_all(_z_condvar_t *cv); z_result_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m); -_Z_OWNED_TYPE_VALUE(_z_condvar_t, condvar) -_Z_OWNED_FUNCTIONS_SYSTEM_DEF(condvar) - z_result_t z_condvar_init(z_owned_condvar_t *cv); z_result_t z_condvar_drop(z_moved_condvar_t *cv); diff --git a/include/zenoh-pico/utils/logging.h b/include/zenoh-pico/utils/logging.h index c440d1774..2c9f3ab0d 100644 --- a/include/zenoh-pico/utils/logging.h +++ b/include/zenoh-pico/utils/logging.h @@ -17,7 +17,7 @@ #include -#include "zenoh-pico/system/platform-common.h" +#include "zenoh-pico/system/platform_common.h" // Logging values #define _Z_LOG_LVL_ERROR 1 diff --git a/src/api/api.c b/src/api/api.c index 13cdb1b56..982fad0a3 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -37,8 +37,8 @@ #include "zenoh-pico/session/resource.h" #include "zenoh-pico/session/subscription.h" #include "zenoh-pico/session/utils.h" -#include "zenoh-pico/system/platform-common.h" #include "zenoh-pico/system/platform.h" +#include "zenoh-pico/system/platform_common.h" #include "zenoh-pico/transport/multicast.h" #include "zenoh-pico/transport/unicast.h" #include "zenoh-pico/utils/endianness.h" diff --git a/src/system/arduino/esp32/system.c b/src/system/arduino/esp32/system.c index 29b81341f..b7c5135d8 100644 --- a/src/system/arduino/esp32/system.c +++ b/src/system/arduino/esp32/system.c @@ -19,8 +19,8 @@ #include #include "zenoh-pico/config.h" -#include "zenoh-pico/system/platform-common.h" #include "zenoh-pico/system/platform.h" +#include "zenoh-pico/system/platform_common.h" #include "zenoh-pico/utils/result.h" /*------------------ Random ------------------*/ diff --git a/src/system/platform-common.c b/src/system/platform_common.c similarity index 97% rename from src/system/platform-common.c rename to src/system/platform_common.c index ba6616658..2270eb390 100644 --- a/src/system/platform-common.c +++ b/src/system/platform_common.c @@ -11,7 +11,7 @@ // Contributors: // ZettaScale Zenoh Team, -#include "zenoh-pico/system/platform-common.h" +#include "zenoh-pico/system/platform_common.h" #include "zenoh-pico/api/olv_macros.h" #include "zenoh-pico/utils/logging.h" diff --git a/src/system/unix/system.c b/src/system/unix/system.c index 2049fba30..c197fed78 100644 --- a/src/system/unix/system.c +++ b/src/system/unix/system.c @@ -17,7 +17,7 @@ #include #include -#include "zenoh-pico/system/platform-common.h" +#include "zenoh-pico/system/platform_common.h" #include "zenoh-pico/utils/result.h" #if defined(ZENOH_LINUX) diff --git a/tests/z_refcount_test.c b/tests/z_refcount_test.c index 82271f48e..27cb84d9a 100644 --- a/tests/z_refcount_test.c +++ b/tests/z_refcount_test.c @@ -18,7 +18,7 @@ #include #include "zenoh-pico/collections/refcount.h" -#include "zenoh-pico/system/platform-common.h" +#include "zenoh-pico/system/platform_common.h" #undef NDEBUG #include