From d13fd0bfed0e6f13e0073d6cb964543a88fdbd1c Mon Sep 17 00:00:00 2001 From: Alexander Bushnev Date: Tue, 10 Sep 2024 16:08:27 +0200 Subject: [PATCH] Add dummy options parameter to z_open/z_close --- examples/arduino/z_get.ino | 2 +- examples/arduino/z_pub.ino | 2 +- examples/arduino/z_pull.ino | 4 ++-- examples/arduino/z_queryable.ino | 2 +- examples/arduino/z_sub.ino | 2 +- examples/espidf/z_get.c | 4 ++-- examples/espidf/z_pub.c | 4 ++-- examples/espidf/z_pull.c | 6 +++--- examples/espidf/z_queryable.c | 4 ++-- examples/espidf/z_sub.c | 4 ++-- examples/freertos_plus_tcp/z_get.c | 6 +++--- examples/freertos_plus_tcp/z_pub.c | 6 +++--- examples/freertos_plus_tcp/z_pub_st.c | 4 ++-- examples/freertos_plus_tcp/z_pull.c | 6 +++--- examples/freertos_plus_tcp/z_put.c | 8 ++++---- examples/freertos_plus_tcp/z_queryable.c | 6 +++--- examples/freertos_plus_tcp/z_sub.c | 6 +++--- examples/freertos_plus_tcp/z_sub_st.c | 4 ++-- examples/mbed/z_get.cpp | 4 ++-- examples/mbed/z_pub.cpp | 4 ++-- examples/mbed/z_pull.cpp | 6 +++--- examples/mbed/z_queryable.cpp | 4 ++-- examples/mbed/z_sub.cpp | 4 ++-- examples/unix/c11/z_get.c | 6 +++--- examples/unix/c11/z_get_attachment.c | 6 +++--- examples/unix/c11/z_get_channel.c | 6 +++--- examples/unix/c11/z_info.c | 6 +++--- examples/unix/c11/z_ping.c | 6 +++--- examples/unix/c11/z_pong.c | 6 +++--- examples/unix/c11/z_pub.c | 6 +++--- examples/unix/c11/z_pub_attachment.c | 6 +++--- examples/unix/c11/z_pub_st.c | 4 ++-- examples/unix/c11/z_pub_thr.c | 6 +++--- examples/unix/c11/z_pull.c | 6 +++--- examples/unix/c11/z_put.c | 8 ++++---- examples/unix/c11/z_queryable.c | 6 +++--- examples/unix/c11/z_queryable_attachment.c | 6 +++--- examples/unix/c11/z_queryable_channel.c | 6 +++--- examples/unix/c11/z_sub.c | 6 +++--- examples/unix/c11/z_sub_attachment.c | 6 +++--- examples/unix/c11/z_sub_channel.c | 6 +++--- examples/unix/c11/z_sub_st.c | 4 ++-- examples/unix/c11/z_sub_thr.c | 6 +++--- examples/unix/c99/z_get.c | 6 +++--- examples/unix/c99/z_info.c | 6 +++--- examples/unix/c99/z_ping.c | 6 +++--- examples/unix/c99/z_pong.c | 6 +++--- examples/unix/c99/z_pub.c | 6 +++--- examples/unix/c99/z_pub_st.c | 4 ++-- examples/unix/c99/z_pull.c | 6 +++--- examples/unix/c99/z_put.c | 8 ++++---- examples/unix/c99/z_queryable.c | 6 +++--- examples/unix/c99/z_sub.c | 6 +++--- examples/unix/c99/z_sub_st.c | 4 ++-- examples/windows/z_get.c | 6 +++--- examples/windows/z_info.c | 6 +++--- examples/windows/z_ping.c | 6 +++--- examples/windows/z_pong.c | 6 +++--- examples/windows/z_pub.c | 6 +++--- examples/windows/z_pub_st.c | 4 ++-- examples/windows/z_pull.c | 6 +++--- examples/windows/z_put.c | 8 ++++---- examples/windows/z_queryable.c | 6 +++--- examples/windows/z_sub.c | 6 +++--- examples/windows/z_sub_st.c | 4 ++-- examples/zephyr/z_get.c | 4 ++-- examples/zephyr/z_pub.c | 4 ++-- examples/zephyr/z_pull.c | 6 +++--- examples/zephyr/z_queryable.c | 4 ++-- examples/zephyr/z_sub.c | 4 ++-- include/zenoh-pico/api/primitives.h | 4 ++-- include/zenoh-pico/api/types.h | 16 ++++++++++++++++ include/zenoh-pico/config.h | 6 +++--- src/api/api.c | 10 ++++++++-- tests/z_api_alignment_test.c | 8 ++++---- tests/z_client_test.c | 8 ++++---- tests/z_peer_multicast_test.c | 8 ++++---- tests/z_perf_rx.c | 6 +++--- tests/z_perf_tx.c | 6 +++--- tests/z_session_test.c | 6 +++--- tests/z_test_fragment_rx.c | 6 +++--- tests/z_test_fragment_tx.c | 6 +++--- 82 files changed, 241 insertions(+), 219 deletions(-) diff --git a/examples/arduino/z_get.ino b/examples/arduino/z_get.ino index a7689a76f..5ac8bc113 100644 --- a/examples/arduino/z_get.ino +++ b/examples/arduino/z_get.ino @@ -89,7 +89,7 @@ void setup() { // Open Zenoh session Serial.print("Opening Zenoh Session..."); - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { Serial.println("Unable to open session!"); while (1) { ; diff --git a/examples/arduino/z_pub.ino b/examples/arduino/z_pub.ino index 490ce04c1..17bc36529 100644 --- a/examples/arduino/z_pub.ino +++ b/examples/arduino/z_pub.ino @@ -65,7 +65,7 @@ void setup() { // Open Zenoh session Serial.print("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { Serial.println("Unable to open session!"); while (1) { ; diff --git a/examples/arduino/z_pull.ino b/examples/arduino/z_pull.ino index 4e0a19624..0403cf4e1 100644 --- a/examples/arduino/z_pull.ino +++ b/examples/arduino/z_pull.ino @@ -66,7 +66,7 @@ void setup() { // Open Zenoh session Serial.print("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { Serial.println("Unable to open session!"); while (1) { ; @@ -76,7 +76,7 @@ void setup() { if (zp_start_read_task(z_session_loan_mut(&s), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return; } diff --git a/examples/arduino/z_queryable.ino b/examples/arduino/z_queryable.ino index b1ee9ab8f..30e758849 100644 --- a/examples/arduino/z_queryable.ino +++ b/examples/arduino/z_queryable.ino @@ -89,7 +89,7 @@ void setup() { // Open Zenoh session Serial.print("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { Serial.println("Unable to open session!"); while (1) { ; diff --git a/examples/arduino/z_sub.ino b/examples/arduino/z_sub.ino index c538a5eca..5f098840a 100644 --- a/examples/arduino/z_sub.ino +++ b/examples/arduino/z_sub.ino @@ -76,7 +76,7 @@ void setup() { // Open Zenoh session Serial.print("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { Serial.println("Unable to open session!"); while (1) { ; diff --git a/examples/espidf/z_get.c b/examples/espidf/z_get.c index ec200e8a2..fdc04e30d 100644 --- a/examples/espidf/z_get.c +++ b/examples/espidf/z_get.c @@ -147,7 +147,7 @@ void app_main() { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -180,7 +180,7 @@ void app_main() { printf("Closing Zenoh Session..."); - z_close(z_move(s)); + z_close(z_move(s), NULL); printf("OK!\n"); } #else diff --git a/examples/espidf/z_pub.c b/examples/espidf/z_pub.c index df5bc7def..88cb419cd 100644 --- a/examples/espidf/z_pub.c +++ b/examples/espidf/z_pub.c @@ -129,7 +129,7 @@ void app_main() { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -165,7 +165,7 @@ void app_main() { printf("Closing Zenoh Session..."); z_undeclare_publisher(z_move(pub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); printf("OK!\n"); } #else diff --git a/examples/espidf/z_pull.c b/examples/espidf/z_pull.c index 573d8cf50..ba07d4b5a 100644 --- a/examples/espidf/z_pull.c +++ b/examples/espidf/z_pull.c @@ -131,7 +131,7 @@ void app_main() { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -140,7 +140,7 @@ void app_main() { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); exit(-1); } @@ -181,7 +181,7 @@ void app_main() { z_undeclare_subscriber(z_move(sub)); z_drop(z_move(handler)); - z_close(z_move(s)); + z_close(z_move(s), NULL); printf("OK!\n"); } #else diff --git a/examples/espidf/z_queryable.c b/examples/espidf/z_queryable.c index 41fe2b642..b7a11e26a 100644 --- a/examples/espidf/z_queryable.c +++ b/examples/espidf/z_queryable.c @@ -156,7 +156,7 @@ void app_main() { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -187,7 +187,7 @@ void app_main() { printf("Closing Zenoh Session..."); z_undeclare_queryable(z_move(qable)); - z_close(z_move(s)); + z_close(z_move(s), NULL); printf("OK!\n"); } #else diff --git a/examples/espidf/z_sub.c b/examples/espidf/z_sub.c index fa9e8eeef..735096158 100644 --- a/examples/espidf/z_sub.c +++ b/examples/espidf/z_sub.c @@ -139,7 +139,7 @@ void app_main() { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -168,7 +168,7 @@ void app_main() { printf("Closing Zenoh Session..."); z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); printf("OK!\n"); } #else diff --git a/examples/freertos_plus_tcp/z_get.c b/examples/freertos_plus_tcp/z_get.c index 63407ab48..dc1056046 100644 --- a/examples/freertos_plus_tcp/z_get.c +++ b/examples/freertos_plus_tcp/z_get.c @@ -63,7 +63,7 @@ void app_main(void) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return; } @@ -71,7 +71,7 @@ void app_main(void) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return; } @@ -100,7 +100,7 @@ void app_main(void) { } } - z_close(z_move(s)); + z_close(z_move(s), NULL); } #else void app_main(void) { diff --git a/examples/freertos_plus_tcp/z_pub.c b/examples/freertos_plus_tcp/z_pub.c index 886d309db..36c006bed 100644 --- a/examples/freertos_plus_tcp/z_pub.c +++ b/examples/freertos_plus_tcp/z_pub.c @@ -41,7 +41,7 @@ void app_main(void) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return; } @@ -78,7 +78,7 @@ void app_main(void) { if (zp_start_read_task(z_loan_mut(s), &read_task_opt) < 0 || zp_start_lease_task(z_loan_mut(s), &lease_task_opt) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return; } @@ -108,7 +108,7 @@ void app_main(void) { // Clean-up z_undeclare_publisher(z_move(pub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); } #else void app_main(void) { diff --git a/examples/freertos_plus_tcp/z_pub_st.c b/examples/freertos_plus_tcp/z_pub_st.c index d485fb2b3..21d6b33ec 100644 --- a/examples/freertos_plus_tcp/z_pub_st.c +++ b/examples/freertos_plus_tcp/z_pub_st.c @@ -42,7 +42,7 @@ void app_main(void) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return; } @@ -80,7 +80,7 @@ void app_main(void) { z_undeclare_publisher(z_move(pub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); } #else void app_main(void) { diff --git a/examples/freertos_plus_tcp/z_pull.c b/examples/freertos_plus_tcp/z_pull.c index abd9fb89e..dfca1d6df 100644 --- a/examples/freertos_plus_tcp/z_pull.c +++ b/examples/freertos_plus_tcp/z_pull.c @@ -41,7 +41,7 @@ void app_main(void) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return; } @@ -49,7 +49,7 @@ void app_main(void) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return; } @@ -90,7 +90,7 @@ void app_main(void) { z_undeclare_subscriber(z_move(sub)); z_drop(z_move(handler)); - z_close(z_move(s)); + z_close(z_move(s), NULL); } #else void app_main(void) { diff --git a/examples/freertos_plus_tcp/z_put.c b/examples/freertos_plus_tcp/z_put.c index f7ef2714c..48d3607c9 100644 --- a/examples/freertos_plus_tcp/z_put.c +++ b/examples/freertos_plus_tcp/z_put.c @@ -39,7 +39,7 @@ void app_main(void) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return; } @@ -47,7 +47,7 @@ void app_main(void) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return; } @@ -57,7 +57,7 @@ void app_main(void) { z_view_keyexpr_from_str_unchecked(&vke, KEYEXPR); if (z_declare_keyexpr(&ke, z_loan(s), z_loan(vke)) < 0) { printf("Unable to declare key expression!\n"); - z_close(z_move(s)); + z_close(z_move(s), NULL); return; } @@ -79,7 +79,7 @@ void app_main(void) { // Clean up z_undeclare_keyexpr(z_move(ke), z_loan(s)); - z_close(z_move(s)); + z_close(z_move(s), NULL); } #else void app_main(void) { diff --git a/examples/freertos_plus_tcp/z_queryable.c b/examples/freertos_plus_tcp/z_queryable.c index 94122b262..5cb3bb420 100644 --- a/examples/freertos_plus_tcp/z_queryable.c +++ b/examples/freertos_plus_tcp/z_queryable.c @@ -65,7 +65,7 @@ void app_main(void) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return; } @@ -73,7 +73,7 @@ void app_main(void) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return; } @@ -98,7 +98,7 @@ void app_main(void) { z_undeclare_queryable(z_move(qable)); - z_close(z_move(s)); + z_close(z_move(s), NULL); } #else void app_main(void) { diff --git a/examples/freertos_plus_tcp/z_sub.c b/examples/freertos_plus_tcp/z_sub.c index e3a226313..af24f128a 100644 --- a/examples/freertos_plus_tcp/z_sub.c +++ b/examples/freertos_plus_tcp/z_sub.c @@ -49,7 +49,7 @@ void app_main(void) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return; } @@ -57,7 +57,7 @@ void app_main(void) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return; } @@ -78,7 +78,7 @@ void app_main(void) { z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); } #else void app_main(void) { diff --git a/examples/freertos_plus_tcp/z_sub_st.c b/examples/freertos_plus_tcp/z_sub_st.c index e05bc45cd..d2ec34047 100644 --- a/examples/freertos_plus_tcp/z_sub_st.c +++ b/examples/freertos_plus_tcp/z_sub_st.c @@ -53,7 +53,7 @@ void app_main(void) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return; } @@ -78,7 +78,7 @@ void app_main(void) { z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); } #else void app_main(void) { diff --git a/examples/mbed/z_get.cpp b/examples/mbed/z_get.cpp index aa61ae937..1e4c89580 100644 --- a/examples/mbed/z_get.cpp +++ b/examples/mbed/z_get.cpp @@ -68,7 +68,7 @@ int main(int argc, char **argv) { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -101,7 +101,7 @@ int main(int argc, char **argv) { printf("Closing Zenoh Session..."); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); printf("OK!\n"); return 0; diff --git a/examples/mbed/z_pub.cpp b/examples/mbed/z_pub.cpp index eb8e3edc6..c3515eb28 100644 --- a/examples/mbed/z_pub.cpp +++ b/examples/mbed/z_pub.cpp @@ -49,7 +49,7 @@ int main(int argc, char **argv) { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -85,7 +85,7 @@ int main(int argc, char **argv) { printf("Closing Zenoh Session..."); z_undeclare_publisher(z_publisher_move(&pub)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); printf("OK!\n"); return 0; diff --git a/examples/mbed/z_pull.cpp b/examples/mbed/z_pull.cpp index 9b86f0347..39b30b61b 100644 --- a/examples/mbed/z_pull.cpp +++ b/examples/mbed/z_pull.cpp @@ -51,7 +51,7 @@ int main(int argc, char **argv) { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -60,7 +60,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_session_loan_mut(&s), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -104,7 +104,7 @@ int main(int argc, char **argv) { z_undeclare_subscriber(z_subscriber_move(&sub)); z_ring_handler_sample_drop(z_ring_handler_sample_move(&handler)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); printf("OK!\n"); return 0; diff --git a/examples/mbed/z_queryable.cpp b/examples/mbed/z_queryable.cpp index d9bba3d52..fc5427443 100644 --- a/examples/mbed/z_queryable.cpp +++ b/examples/mbed/z_queryable.cpp @@ -74,7 +74,7 @@ int main(int argc, char **argv) { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -106,7 +106,7 @@ int main(int argc, char **argv) { printf("Closing Zenoh Session..."); z_undeclare_queryable(z_queryable_move(&qable)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); printf("OK!\n"); return 0; diff --git a/examples/mbed/z_sub.cpp b/examples/mbed/z_sub.cpp index 78edd365c..fe58c2d12 100644 --- a/examples/mbed/z_sub.cpp +++ b/examples/mbed/z_sub.cpp @@ -59,7 +59,7 @@ int main(int argc, char **argv) { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -89,7 +89,7 @@ int main(int argc, char **argv) { printf("Closing Zenoh Session..."); z_undeclare_subscriber(z_subscriber_move(&sub)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); printf("OK!\n"); return 0; diff --git a/examples/unix/c11/z_get.c b/examples/unix/c11/z_get.c index fc0fb0900..f06217a6b 100644 --- a/examples/unix/c11/z_get.c +++ b/examples/unix/c11/z_get.c @@ -105,7 +105,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -113,7 +113,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -143,7 +143,7 @@ int main(int argc, char **argv) { z_condvar_wait(z_loan_mut(cond), z_loan_mut(mutex)); z_mutex_unlock(z_loan_mut(mutex)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/unix/c11/z_get_attachment.c b/examples/unix/c11/z_get_attachment.c index 022b70d7d..b3a5f0e51 100644 --- a/examples/unix/c11/z_get_attachment.c +++ b/examples/unix/c11/z_get_attachment.c @@ -182,7 +182,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -190,7 +190,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -233,7 +233,7 @@ int main(int argc, char **argv) { z_condvar_wait(z_loan_mut(cond), z_loan_mut(mutex)); z_mutex_unlock(z_loan_mut(mutex)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } #else diff --git a/examples/unix/c11/z_get_channel.c b/examples/unix/c11/z_get_channel.c index 156e917a2..2871a4527 100644 --- a/examples/unix/c11/z_get_channel.c +++ b/examples/unix/c11/z_get_channel.c @@ -69,7 +69,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -77,7 +77,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -123,7 +123,7 @@ int main(int argc, char **argv) { z_drop(z_move(handler)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/unix/c11/z_info.c b/examples/unix/c11/z_info.c index 5b0fa48c6..303a134ef 100644 --- a/examples/unix/c11/z_info.c +++ b/examples/unix/c11/z_info.c @@ -68,7 +68,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -76,7 +76,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -96,5 +96,5 @@ int main(int argc, char **argv) { z_closure(&callback2, print_zid); z_info_peers_zid(z_loan(s), z_move(callback2)); - z_close(z_move(s)); + z_close(z_move(s), NULL); } diff --git a/examples/unix/c11/z_ping.c b/examples/unix/c11/z_ping.c index cc1bd5de1..071133278 100644 --- a/examples/unix/c11/z_ping.c +++ b/examples/unix/c11/z_ping.c @@ -66,14 +66,14 @@ int main(int argc, char** argv) { z_owned_config_t config; z_config_default(&config); z_owned_session_t session; - if (z_open(&session, z_move(config)) < 0) { + if (z_open(&session, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } if (zp_start_read_task(z_loan_mut(session), NULL) < 0 || zp_start_lease_task(z_loan_mut(session), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&session)); + z_close(z_session_move(&session), NULL); return -1; } @@ -135,7 +135,7 @@ int main(int argc, char** argv) { z_drop(z_move(pub)); z_drop(z_move(sub)); - z_close(z_move(session)); + z_close(z_move(session), NULL); } char* getopt(int argc, char** argv, char option) { diff --git a/examples/unix/c11/z_pong.c b/examples/unix/c11/z_pong.c index 7bcc970ff..9da0d51fe 100644 --- a/examples/unix/c11/z_pong.c +++ b/examples/unix/c11/z_pong.c @@ -37,14 +37,14 @@ int main(int argc, char** argv) { z_owned_config_t config; z_config_default(&config); z_owned_session_t session; - if (z_open(&session, z_move(config)) < 0) { + if (z_open(&session, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } if (zp_start_read_task(z_loan_mut(session), NULL) < 0 || zp_start_lease_task(z_loan_mut(session), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&session)); + z_close(z_session_move(&session), NULL); return -1; } @@ -71,7 +71,7 @@ int main(int argc, char** argv) { z_drop(z_move(sub)); - z_close(z_move(session)); + z_close(z_move(session), NULL); } #else int main(void) { diff --git a/examples/unix/c11/z_pub.c b/examples/unix/c11/z_pub.c index 55ae68745..16a98e880 100644 --- a/examples/unix/c11/z_pub.c +++ b/examples/unix/c11/z_pub.c @@ -78,7 +78,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -86,7 +86,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_move(s)); + z_close(z_move(s), NULL); return -1; } // Wait for joins in peer mode @@ -120,7 +120,7 @@ int main(int argc, char **argv) { } // Clean up z_undeclare_publisher(z_move(pub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } #else diff --git a/examples/unix/c11/z_pub_attachment.c b/examples/unix/c11/z_pub_attachment.c index d143af387..ad5f96875 100644 --- a/examples/unix/c11/z_pub_attachment.c +++ b/examples/unix/c11/z_pub_attachment.c @@ -105,7 +105,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -113,7 +113,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_move(s)); + z_close(z_move(s), NULL); return -1; } // Wait for joins in peer mode @@ -179,7 +179,7 @@ int main(int argc, char **argv) { } // Clean up z_undeclare_publisher(z_move(pub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } #else diff --git a/examples/unix/c11/z_pub_st.c b/examples/unix/c11/z_pub_st.c index be0de263a..8b9c71191 100644 --- a/examples/unix/c11/z_pub_st.c +++ b/examples/unix/c11/z_pub_st.c @@ -75,7 +75,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -107,7 +107,7 @@ int main(int argc, char **argv) { zp_send_join(z_loan(s), NULL); } z_undeclare_publisher(z_move(pub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } #else diff --git a/examples/unix/c11/z_pub_thr.c b/examples/unix/c11/z_pub_thr.c index 056983410..17acf6dda 100644 --- a/examples/unix/c11/z_pub_thr.c +++ b/examples/unix/c11/z_pub_thr.c @@ -46,14 +46,14 @@ int main(int argc, char **argv) { } // Open session z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); exit(-1); } // Declare publisher @@ -76,7 +76,7 @@ int main(int argc, char **argv) { } // Clean up z_undeclare_publisher(z_move(pub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); z_drop(z_move(payload)); exit(0); } diff --git a/examples/unix/c11/z_pull.c b/examples/unix/c11/z_pull.c index 34de6bed2..1c7be30d0 100644 --- a/examples/unix/c11/z_pull.c +++ b/examples/unix/c11/z_pull.c @@ -60,7 +60,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -68,7 +68,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -109,7 +109,7 @@ int main(int argc, char **argv) { z_undeclare_subscriber(z_move(sub)); z_drop(z_move(handler)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/unix/c11/z_put.c b/examples/unix/c11/z_put.c index 628870f09..ded159ced 100644 --- a/examples/unix/c11/z_put.c +++ b/examples/unix/c11/z_put.c @@ -73,7 +73,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -81,7 +81,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -90,7 +90,7 @@ int main(int argc, char **argv) { z_view_keyexpr_from_str(&vke, keyexpr); z_owned_keyexpr_t ke; if (z_declare_keyexpr(&ke, z_loan(s), z_loan(vke)) < 0) { - z_close(z_move(s)); + z_close(z_move(s), NULL); return -1; } @@ -104,7 +104,7 @@ int main(int argc, char **argv) { } // Clean up z_undeclare_keyexpr(z_move(ke), z_loan(s)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } #else diff --git a/examples/unix/c11/z_queryable.c b/examples/unix/c11/z_queryable.c index 77a6c1fc3..7c1eb3c39 100644 --- a/examples/unix/c11/z_queryable.c +++ b/examples/unix/c11/z_queryable.c @@ -126,7 +126,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -134,7 +134,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -163,7 +163,7 @@ int main(int argc, char **argv) { z_undeclare_queryable(z_move(qable)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/unix/c11/z_queryable_attachment.c b/examples/unix/c11/z_queryable_attachment.c index 0f9a54184..4601aa68c 100644 --- a/examples/unix/c11/z_queryable_attachment.c +++ b/examples/unix/c11/z_queryable_attachment.c @@ -211,7 +211,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -219,7 +219,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -248,7 +248,7 @@ int main(int argc, char **argv) { z_undeclare_queryable(z_move(qable)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/unix/c11/z_queryable_channel.c b/examples/unix/c11/z_queryable_channel.c index 1073bbda9..295ea09f3 100644 --- a/examples/unix/c11/z_queryable_channel.c +++ b/examples/unix/c11/z_queryable_channel.c @@ -69,7 +69,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -77,7 +77,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -128,7 +128,7 @@ int main(int argc, char **argv) { z_drop(z_move(handler)); z_undeclare_queryable(z_move(qable)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/unix/c11/z_sub.c b/examples/unix/c11/z_sub.c index a2fd5ba3f..95845e6e4 100644 --- a/examples/unix/c11/z_sub.c +++ b/examples/unix/c11/z_sub.c @@ -85,7 +85,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -93,7 +93,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -117,7 +117,7 @@ int main(int argc, char **argv) { } // Clean up z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } #else diff --git a/examples/unix/c11/z_sub_attachment.c b/examples/unix/c11/z_sub_attachment.c index 1e826d210..84a351941 100644 --- a/examples/unix/c11/z_sub_attachment.c +++ b/examples/unix/c11/z_sub_attachment.c @@ -149,7 +149,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -157,7 +157,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -181,7 +181,7 @@ int main(int argc, char **argv) { } // Clean up z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } #else diff --git a/examples/unix/c11/z_sub_channel.c b/examples/unix/c11/z_sub_channel.c index 96ef9da44..fa09b0f42 100644 --- a/examples/unix/c11/z_sub_channel.c +++ b/examples/unix/c11/z_sub_channel.c @@ -52,7 +52,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -60,7 +60,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -92,7 +92,7 @@ int main(int argc, char **argv) { z_undeclare_subscriber(z_move(sub)); z_drop(z_move(handler)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/unix/c11/z_sub_st.c b/examples/unix/c11/z_sub_st.c index 1f138911c..5ce01d3fe 100644 --- a/examples/unix/c11/z_sub_st.c +++ b/examples/unix/c11/z_sub_st.c @@ -84,7 +84,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -107,7 +107,7 @@ int main(int argc, char **argv) { zp_send_join(z_loan(s), NULL); } z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } #else diff --git a/examples/unix/c11/z_sub_thr.c b/examples/unix/c11/z_sub_thr.c index 8c9941451..9fbda3059 100644 --- a/examples/unix/c11/z_sub_thr.c +++ b/examples/unix/c11/z_sub_thr.c @@ -81,14 +81,14 @@ int main(int argc, char **argv) { } // Open session z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); exit(-1); } // Declare Subscriber/resource @@ -110,7 +110,7 @@ int main(int argc, char **argv) { // Clean up z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); exit(0); } #else diff --git a/examples/unix/c99/z_get.c b/examples/unix/c99/z_get.c index 9b039855d..717ccc341 100644 --- a/examples/unix/c99/z_get.c +++ b/examples/unix/c99/z_get.c @@ -99,7 +99,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -107,7 +107,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_session_loan_mut(&s), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -136,7 +136,7 @@ int main(int argc, char **argv) { z_condvar_wait(z_condvar_loan_mut(&cond), z_mutex_loan_mut(&mutex)); z_mutex_unlock(z_mutex_loan_mut(&mutex)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return 0; } diff --git a/examples/unix/c99/z_info.c b/examples/unix/c99/z_info.c index b19a2dfae..4474b1467 100644 --- a/examples/unix/c99/z_info.c +++ b/examples/unix/c99/z_info.c @@ -68,7 +68,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -76,7 +76,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_session_loan_mut(&s), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -96,5 +96,5 @@ int main(int argc, char **argv) { z_closure_zid(&callback2, print_zid, NULL, NULL); z_info_peers_zid(z_session_loan(&s), z_closure_zid_move(&callback2)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); } diff --git a/examples/unix/c99/z_ping.c b/examples/unix/c99/z_ping.c index f001c3a60..4ae767e74 100644 --- a/examples/unix/c99/z_ping.c +++ b/examples/unix/c99/z_ping.c @@ -67,7 +67,7 @@ int main(int argc, char** argv) { z_owned_config_t config; z_config_default(&config); z_owned_session_t session; - if (z_open(&session, z_config_move(&config)) < 0) { + if (z_open(&session, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -75,7 +75,7 @@ int main(int argc, char** argv) { if (zp_start_read_task(z_session_loan_mut(&session), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&session), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&session)); + z_close(z_session_move(&session), NULL); return -1; } @@ -138,7 +138,7 @@ int main(int argc, char** argv) { z_undeclare_subscriber(z_subscriber_move(&sub)); z_undeclare_publisher(z_publisher_move(&pub)); - z_close(z_session_move(&session)); + z_close(z_session_move(&session), NULL); } char* getopt(int argc, char** argv, char option) { diff --git a/examples/unix/c99/z_pong.c b/examples/unix/c99/z_pong.c index d5c51e616..81ef5daaa 100644 --- a/examples/unix/c99/z_pong.c +++ b/examples/unix/c99/z_pong.c @@ -39,7 +39,7 @@ int main(int argc, char** argv) { z_owned_config_t config; z_config_default(&config); z_owned_session_t session; - if (z_open(&session, z_config_move(&config)) < 0) { + if (z_open(&session, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -47,7 +47,7 @@ int main(int argc, char** argv) { if (zp_start_read_task(z_session_loan_mut(&session), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&session), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&session)); + z_close(z_session_move(&session), NULL); return -1; } @@ -75,7 +75,7 @@ int main(int argc, char** argv) { z_undeclare_subscriber(z_subscriber_move(&sub)); - z_close(z_session_move(&session)); + z_close(z_session_move(&session), NULL); } #else int main(void) { diff --git a/examples/unix/c99/z_pub.c b/examples/unix/c99/z_pub.c index e2e8fd2c9..10fb6d570 100644 --- a/examples/unix/c99/z_pub.c +++ b/examples/unix/c99/z_pub.c @@ -74,7 +74,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -82,7 +82,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_session_loan_mut(&s), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -110,7 +110,7 @@ int main(int argc, char **argv) { } // Clean up z_undeclare_publisher(z_publisher_move(&pub)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return 0; } #else diff --git a/examples/unix/c99/z_pub_st.c b/examples/unix/c99/z_pub_st.c index a5c514e1a..ed22d29e5 100644 --- a/examples/unix/c99/z_pub_st.c +++ b/examples/unix/c99/z_pub_st.c @@ -74,7 +74,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -112,7 +112,7 @@ int main(int argc, char **argv) { } z_undeclare_publisher(z_publisher_move(&pub)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); free(buf); return 0; } diff --git a/examples/unix/c99/z_pull.c b/examples/unix/c99/z_pull.c index 5250a8ce4..283752d27 100644 --- a/examples/unix/c99/z_pull.c +++ b/examples/unix/c99/z_pull.c @@ -62,7 +62,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -70,7 +70,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_session_loan_mut(&s), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -114,7 +114,7 @@ int main(int argc, char **argv) { z_undeclare_subscriber(z_subscriber_move(&sub)); z_ring_handler_sample_drop(z_ring_handler_sample_move(&handler)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return 0; } diff --git a/examples/unix/c99/z_put.c b/examples/unix/c99/z_put.c index ce9daad7e..58663f538 100644 --- a/examples/unix/c99/z_put.c +++ b/examples/unix/c99/z_put.c @@ -69,7 +69,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -77,7 +77,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_session_loan_mut(&s), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -87,7 +87,7 @@ int main(int argc, char **argv) { z_owned_keyexpr_t ke; if (z_declare_keyexpr(&ke, z_session_loan(&s), z_view_keyexpr_loan(&vke)) < 0) { printf("Unable to declare key expression!\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -102,7 +102,7 @@ int main(int argc, char **argv) { // Clean up z_undeclare_keyexpr(z_keyexpr_move(&ke), z_session_loan(&s)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return 0; } #else diff --git a/examples/unix/c99/z_queryable.c b/examples/unix/c99/z_queryable.c index b22ba98e5..43b6ca35e 100644 --- a/examples/unix/c99/z_queryable.c +++ b/examples/unix/c99/z_queryable.c @@ -94,7 +94,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -102,7 +102,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_session_loan_mut(&s), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -130,7 +130,7 @@ int main(int argc, char **argv) { z_undeclare_queryable(z_queryable_move(&qable)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return 0; } diff --git a/examples/unix/c99/z_sub.c b/examples/unix/c99/z_sub.c index 6bfbddf86..998ab0e93 100644 --- a/examples/unix/c99/z_sub.c +++ b/examples/unix/c99/z_sub.c @@ -77,7 +77,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -85,7 +85,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_session_loan_mut(&s), NULL) < 0 || zp_start_lease_task(z_session_loan_mut(&s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -109,7 +109,7 @@ int main(int argc, char **argv) { z_undeclare_subscriber(z_subscriber_move(&sub)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return 0; } diff --git a/examples/unix/c99/z_sub_st.c b/examples/unix/c99/z_sub_st.c index 4335308a7..17e30a088 100644 --- a/examples/unix/c99/z_sub_st.c +++ b/examples/unix/c99/z_sub_st.c @@ -85,7 +85,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_config_move(&config)) < 0) { + if (z_open(&s, z_config_move(&config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -110,7 +110,7 @@ int main(int argc, char **argv) { zp_send_join(z_session_loan(&s), NULL); } z_undeclare_subscriber(z_subscriber_move(&sub)); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return 0; } #else diff --git a/examples/windows/z_get.c b/examples/windows/z_get.c index c6032e470..4f54fb19b 100644 --- a/examples/windows/z_get.c +++ b/examples/windows/z_get.c @@ -63,7 +63,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -71,7 +71,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -100,7 +100,7 @@ int main(int argc, char **argv) { z_condvar_wait(z_loan_mut(cond), z_loan_mut(mutex)); z_mutex_unlock(z_loan_mut(mutex)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/windows/z_info.c b/examples/windows/z_info.c index c560d0248..2cb405257 100644 --- a/examples/windows/z_info.c +++ b/examples/windows/z_info.c @@ -41,7 +41,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -49,7 +49,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -69,5 +69,5 @@ int main(int argc, char **argv) { z_closure(&callback2, print_zid); z_info_peers_zid(z_loan(s), z_move(callback2)); - z_close(z_move(s)); + z_close(z_move(s), NULL); } diff --git a/examples/windows/z_ping.c b/examples/windows/z_ping.c index acc807324..922f03c0c 100644 --- a/examples/windows/z_ping.c +++ b/examples/windows/z_ping.c @@ -66,14 +66,14 @@ int main(int argc, char** argv) { z_owned_config_t config; z_config_default(&config); z_owned_session_t session; - if (z_open(&session, z_move(config)) < 0) { + if (z_open(&session, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } if (zp_start_read_task(z_loan_mut(session), NULL) < 0 || zp_start_lease_task(z_loan_mut(session), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&session)); + z_close(z_session_move(&session), NULL); return -1; } @@ -135,7 +135,7 @@ int main(int argc, char** argv) { z_drop(z_move(pub)); z_drop(z_move(sub)); - z_close(z_move(session)); + z_close(z_move(session), NULL); } char* getopt(int argc, char** argv, char option) { diff --git a/examples/windows/z_pong.c b/examples/windows/z_pong.c index 7bcc970ff..9da0d51fe 100644 --- a/examples/windows/z_pong.c +++ b/examples/windows/z_pong.c @@ -37,14 +37,14 @@ int main(int argc, char** argv) { z_owned_config_t config; z_config_default(&config); z_owned_session_t session; - if (z_open(&session, z_move(config)) < 0) { + if (z_open(&session, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } if (zp_start_read_task(z_loan_mut(session), NULL) < 0 || zp_start_lease_task(z_loan_mut(session), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&session)); + z_close(z_session_move(&session), NULL); return -1; } @@ -71,7 +71,7 @@ int main(int argc, char** argv) { z_drop(z_move(sub)); - z_close(z_move(session)); + z_close(z_move(session), NULL); } #else int main(void) { diff --git a/examples/windows/z_pub.c b/examples/windows/z_pub.c index 4c1413d7f..5022393a0 100644 --- a/examples/windows/z_pub.c +++ b/examples/windows/z_pub.c @@ -36,7 +36,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -44,7 +44,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_move(s)); + z_close(z_move(s), NULL); return -1; } @@ -75,7 +75,7 @@ int main(int argc, char **argv) { z_undeclare_publisher(z_move(pub)); zp_stop_read_task(z_loan_mut(s)); zp_stop_lease_task(z_loan_mut(s)); - z_close(z_move(s)); + z_close(z_move(s), NULL); free(buf); return 0; } diff --git a/examples/windows/z_pub_st.c b/examples/windows/z_pub_st.c index b459a3874..8f85bccab 100644 --- a/examples/windows/z_pub_st.c +++ b/examples/windows/z_pub_st.c @@ -38,7 +38,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -77,7 +77,7 @@ int main(int argc, char **argv) { z_undeclare_publisher(z_move(pub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); free(buf); return 0; diff --git a/examples/windows/z_pull.c b/examples/windows/z_pull.c index 4c4e9a22b..41f8298b9 100644 --- a/examples/windows/z_pull.c +++ b/examples/windows/z_pull.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -42,7 +42,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -83,7 +83,7 @@ int main(int argc, char **argv) { z_undeclare_subscriber(z_move(sub)); z_drop(z_move(handler)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/windows/z_put.c b/examples/windows/z_put.c index 44f9bba1d..9e47b0094 100644 --- a/examples/windows/z_put.c +++ b/examples/windows/z_put.c @@ -36,7 +36,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -44,7 +44,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -54,7 +54,7 @@ int main(int argc, char **argv) { z_owned_keyexpr_t ke; if (z_declare_keyexpr(&ke, z_loan(s), z_loan(vke)) < 0) { printf("Unable to declare key expression!\n"); - z_close(z_move(s)); + z_close(z_move(s), NULL); return -1; } @@ -69,7 +69,7 @@ int main(int argc, char **argv) { // Clean up z_undeclare_keyexpr(z_move(ke), z_loan(s)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } #else diff --git a/examples/windows/z_queryable.c b/examples/windows/z_queryable.c index 897254a35..b4e59cd31 100644 --- a/examples/windows/z_queryable.c +++ b/examples/windows/z_queryable.c @@ -59,7 +59,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -67,7 +67,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -93,7 +93,7 @@ int main(int argc, char **argv) { z_undeclare_queryable(z_move(qable)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/windows/z_sub.c b/examples/windows/z_sub.c index 87b2ed556..252d10b6d 100644 --- a/examples/windows/z_sub.c +++ b/examples/windows/z_sub.c @@ -46,7 +46,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -54,7 +54,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -76,7 +76,7 @@ int main(int argc, char **argv) { z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/windows/z_sub_st.c b/examples/windows/z_sub_st.c index 3519f1fb6..99186aaa6 100644 --- a/examples/windows/z_sub_st.c +++ b/examples/windows/z_sub_st.c @@ -50,7 +50,7 @@ int main(int argc, char **argv) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -75,7 +75,7 @@ int main(int argc, char **argv) { z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } diff --git a/examples/zephyr/z_get.c b/examples/zephyr/z_get.c index 585ba5cc0..2164d10dc 100644 --- a/examples/zephyr/z_get.c +++ b/examples/zephyr/z_get.c @@ -64,7 +64,7 @@ int main(int argc, char **argv) { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -98,7 +98,7 @@ int main(int argc, char **argv) { printf("Closing Zenoh Session..."); - z_close(z_move(s)); + z_close(z_move(s), NULL); printf("OK!\n"); return 0; diff --git a/examples/zephyr/z_pub.c b/examples/zephyr/z_pub.c index 5ef9b5166..7a4cf120e 100644 --- a/examples/zephyr/z_pub.c +++ b/examples/zephyr/z_pub.c @@ -46,7 +46,7 @@ int main(int argc, char **argv) { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -82,7 +82,7 @@ int main(int argc, char **argv) { printf("Closing Zenoh Session..."); z_undeclare_publisher(z_move(pub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); printf("OK!\n"); return 0; diff --git a/examples/zephyr/z_pull.c b/examples/zephyr/z_pull.c index 08912026f..335c2fcc8 100644 --- a/examples/zephyr/z_pull.c +++ b/examples/zephyr/z_pull.c @@ -46,7 +46,7 @@ int main(int argc, char **argv) { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -55,7 +55,7 @@ int main(int argc, char **argv) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); exit(-1); } @@ -96,7 +96,7 @@ int main(int argc, char **argv) { z_undeclare_subscriber(z_move(sub)); z_drop(z_move(handler)); - z_close(z_move(s)); + z_close(z_move(s), NULL); printf("OK!\n"); return 0; diff --git a/examples/zephyr/z_queryable.c b/examples/zephyr/z_queryable.c index 02deecc9f..bb9a80f1b 100644 --- a/examples/zephyr/z_queryable.c +++ b/examples/zephyr/z_queryable.c @@ -69,7 +69,7 @@ int main(int argc, char **argv) { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -100,7 +100,7 @@ int main(int argc, char **argv) { printf("Closing Zenoh Session..."); z_undeclare_queryable(z_move(qable)); - z_close(z_move(s)); + z_close(z_move(s), NULL); printf("OK!\n"); return 0; diff --git a/examples/zephyr/z_sub.c b/examples/zephyr/z_sub.c index d792b4979..fc37d91f4 100644 --- a/examples/zephyr/z_sub.c +++ b/examples/zephyr/z_sub.c @@ -53,7 +53,7 @@ int main(int argc, char **argv) { // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } @@ -82,7 +82,7 @@ int main(int argc, char **argv) { printf("Closing Zenoh Session..."); z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); printf("OK!\n"); return 0; diff --git a/include/zenoh-pico/api/primitives.h b/include/zenoh-pico/api/primitives.h index 74b235388..05c56ad31 100644 --- a/include/zenoh-pico/api/primitives.h +++ b/include/zenoh-pico/api/primitives.h @@ -1551,7 +1551,7 @@ int8_t z_scout(z_moved_config_t *config, z_moved_closure_hello_t *callback, cons * Return: * ``0`` if open successful, ``negative value`` otherwise. */ -int8_t z_open(z_owned_session_t *zs, z_moved_config_t *config); +int8_t z_open(z_owned_session_t *zs, z_moved_config_t *config, const z_open_options_t *options); /** * Closes a Zenoh session. @@ -1562,7 +1562,7 @@ int8_t z_open(z_owned_session_t *zs, z_moved_config_t *config); * Return: * ``0`` if close successful, ``negative value`` otherwise. */ -int8_t z_close(z_moved_session_t *zs); +int8_t z_close(z_moved_session_t *zs, const z_close_options_t *options); /** * Fetches Zenoh IDs of all connected peers. diff --git a/include/zenoh-pico/api/types.h b/include/zenoh-pico/api/types.h index 77d32423b..1c1784d6e 100644 --- a/include/zenoh-pico/api/types.h +++ b/include/zenoh-pico/api/types.h @@ -196,6 +196,22 @@ typedef struct { uint8_t __dummy; // Just to avoid empty structures that might cause undefined behavior } z_subscriber_options_t; +/** + * Represents the configuration used to configure a zenoh upon opening :c:func:`z_open`. + *. + */ +typedef struct { + uint8_t __dummy; // Just to avoid empty structures that might cause undefined behavior +} z_open_options_t; + +/** + * Represents the configuration used to configure a zenoh upon closing :c:func:`z_close`. + *. + */ +typedef struct { + uint8_t __dummy; // Just to avoid empty structures that might cause undefined behavior +} z_close_options_t; + /** * Represents the reply consolidation mode to apply on replies to a :c:func:`z_get`. * diff --git a/include/zenoh-pico/config.h b/include/zenoh-pico/config.h index 1230a0a4b..82b1b155b 100644 --- a/include/zenoh-pico/config.h +++ b/include/zenoh-pico/config.h @@ -16,9 +16,9 @@ #define INCLUDE_ZENOH_PICO_CONFIG_H /*--- CMake generated config; pass values to CMake to change the following tokens ---*/ -#define Z_FRAG_MAX_SIZE 4096 -#define Z_BATCH_UNICAST_SIZE 2048 -#define Z_BATCH_MULTICAST_SIZE 2048 +#define Z_FRAG_MAX_SIZE 300000 +#define Z_BATCH_UNICAST_SIZE 65535 +#define Z_BATCH_MULTICAST_SIZE 8096 #define Z_CONFIG_SOCKET_TIMEOUT 100 #define Z_FEATURE_UNSTABLE_API 0 diff --git a/src/api/api.c b/src/api/api.c index f49ca2f7d..c65564d58 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -919,7 +919,10 @@ int8_t z_scout(z_moved_config_t *config, z_moved_closure_hello_t *callback, cons return ret; } -int8_t z_open(z_owned_session_t *zs, z_moved_config_t *config) { +void z_open_options_default(z_open_options_t *options) { options->__dummy = 0; } + +int8_t z_open(z_owned_session_t *zs, z_moved_config_t *config, const z_open_options_t *options) { + _ZP_UNUSED(options); z_internal_session_null(zs); _z_session_t *s = z_malloc(sizeof(_z_session_t)); if (s == NULL) { @@ -948,7 +951,10 @@ int8_t z_open(z_owned_session_t *zs, z_moved_config_t *config) { return _Z_RES_OK; } -int8_t z_close(z_moved_session_t *zs) { +void z_close_options_default(z_close_options_t *options) { options->__dummy = 0; } + +int8_t z_close(z_moved_session_t *zs, const z_close_options_t *options) { + _ZP_UNUSED(options); if (zs == NULL || !z_internal_session_check(&zs->_this)) { return _Z_RES_OK; } diff --git a/tests/z_api_alignment_test.c b/tests/z_api_alignment_test.c index c90a27238..cd4279fce 100644 --- a/tests/z_api_alignment_test.c +++ b/tests/z_api_alignment_test.c @@ -196,7 +196,7 @@ int main(int argc, char **argv) { z_sleep_s(SLEEP); z_owned_session_t s1; - z_open(&s1, z_move(_ret_config)); + z_open(&s1, z_move(_ret_config), NULL); assert(z_internal_check(s1)); z_id_t _ret_zid = z_info_zid(z_loan(s1)); printf("Session 1 with PID: 0x"); @@ -240,7 +240,7 @@ int main(int argc, char **argv) { #endif z_owned_session_t s2; - z_open(&s2, z_move(_ret_config)); + z_open(&s2, z_move(_ret_config), NULL); assert(z_internal_check(s2)); _ret_zid = z_info_zid(z_loan(s2)); printf("Session 2 with PID: 0x"); @@ -423,14 +423,14 @@ int main(int argc, char **argv) { #endif printf("Close sessions..."); - _ret_int8 = z_close(z_move(s1)); + _ret_int8 = z_close(z_move(s1), NULL); assert_eq(_ret_int8, 0); #ifdef ZENOH_PICO zp_stop_read_task(z_loan_mut(s2)); zp_stop_lease_task(z_loan_mut(s2)); #endif - _ret_int8 = z_close(z_move(s2)); + _ret_int8 = z_close(z_move(s2), NULL); assert_eq(_ret_int8, 0); printf("Ok\n"); diff --git a/tests/z_client_test.c b/tests/z_client_test.c index 9713163cd..0f6c1e4d1 100644 --- a/tests/z_client_test.c +++ b/tests/z_client_test.c @@ -136,7 +136,7 @@ int main(int argc, char **argv) { for (unsigned int i = 0; i < SET; i++) idx[i] = i; z_owned_session_t s1; - assert(z_open(&s1, z_move(config)) == Z_OK); + assert(z_open(&s1, z_move(config), NULL) == Z_OK); _z_string_t zid1 = format_id(&(_Z_RC_IN_VAL(z_loan(s1))->_local_zid)); printf("Session 1 with PID: %s\n", _z_string_data(&zid1)); _z_string_clear(&zid1); @@ -151,7 +151,7 @@ int main(int argc, char **argv) { zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, argv[1]); z_owned_session_t s2; - assert(z_open(&s2, z_move(config)) == Z_OK); + assert(z_open(&s2, z_move(config), NULL) == Z_OK); assert(z_internal_check(s2)); _z_string_t zid2 = format_id(&(_Z_RC_IN_VAL(z_loan(s2))->_local_zid)); printf("Session 2 with PID: %s\n", _z_string_data(&zid2)); @@ -401,12 +401,12 @@ int main(int argc, char **argv) { // Close both sessions printf("Closing session 1\n"); - z_close(z_move(s1)); + z_close(z_move(s1), NULL); z_sleep_s(SLEEP); printf("Closing session 2\n"); - z_close(z_move(s2)); + z_close(z_move(s2), NULL); z_free((uint8_t *)value); value = NULL; diff --git a/tests/z_peer_multicast_test.c b/tests/z_peer_multicast_test.c index 25fa2d72b..1bd5ff9fb 100644 --- a/tests/z_peer_multicast_test.c +++ b/tests/z_peer_multicast_test.c @@ -75,7 +75,7 @@ int main(int argc, char **argv) { for (unsigned int i = 0; i < SET; i++) idx[i] = i; z_owned_session_t s1; - assert(z_open(&s1, z_move(config)) == Z_OK); + assert(z_open(&s1, z_move(config), NULL) == Z_OK); _z_slice_t id_as_bytes = _z_slice_alias_buf(_Z_RC_IN_VAL(z_loan(s1))->_local_zid.id, _z_id_len(_Z_RC_IN_VAL(z_loan(s1))->_local_zid)); _z_string_t zid1 = _z_string_convert_bytes(&id_as_bytes); @@ -93,7 +93,7 @@ int main(int argc, char **argv) { zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, argv[1]); z_owned_session_t s2; - assert(z_open(&s2, z_move(config)) == Z_OK); + assert(z_open(&s2, z_move(config), NULL) == Z_OK); id_as_bytes = _z_slice_alias_buf(_Z_RC_IN_VAL(z_loan(s2))->_local_zid.id, _z_id_len(_Z_RC_IN_VAL(z_loan(s2))->_local_zid)); @@ -185,12 +185,12 @@ int main(int argc, char **argv) { // Close both sessions printf("Closing session 1\n"); - z_close(z_move(s1)); + z_close(z_move(s1), NULL); z_sleep_s(SLEEP); printf("Closing session 2\n"); - z_close(z_move(s2)); + z_close(z_move(s2), NULL); z_free((uint8_t *)value); value = NULL; diff --git a/tests/z_perf_rx.c b/tests/z_perf_rx.c index b46feb136..52c309f56 100644 --- a/tests/z_perf_rx.c +++ b/tests/z_perf_rx.c @@ -91,14 +91,14 @@ int main(int argc, char **argv) { } // Open session z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); exit(-1); } // Declare Subscriber/resource @@ -120,7 +120,7 @@ int main(int argc, char **argv) { z_sleep_s(1); // Clean up z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); exit(0); } #else diff --git a/tests/z_perf_tx.c b/tests/z_perf_tx.c index 4c8c7cd0a..9c02cd433 100644 --- a/tests/z_perf_tx.c +++ b/tests/z_perf_tx.c @@ -69,14 +69,14 @@ int main(int argc, char **argv) { } // Open session z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); exit(-1); } // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); exit(-1); } // Declare publisher @@ -113,7 +113,7 @@ int main(int argc, char **argv) { // Clean up z_undeclare_publisher(z_move(pub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); free(value); exit(0); } diff --git a/tests/z_session_test.c b/tests/z_session_test.c index 15ca0f6b3..989628d09 100644 --- a/tests/z_session_test.c +++ b/tests/z_session_test.c @@ -29,7 +29,7 @@ int main(void) { printf("Opening session...\n"); z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } @@ -37,7 +37,7 @@ int main(void) { // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } @@ -49,5 +49,5 @@ int main(void) { zp_stop_lease_task(z_loan_mut(s)); // Immediately close the session - z_close(z_move(s)); + z_close(z_move(s), NULL); } diff --git a/tests/z_test_fragment_rx.c b/tests/z_test_fragment_rx.c index 056b9f5ba..76eff0767 100644 --- a/tests/z_test_fragment_rx.c +++ b/tests/z_test_fragment_rx.c @@ -68,14 +68,14 @@ int main(int argc, char **argv) { } // Open session z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } // Declare subscriber @@ -97,7 +97,7 @@ int main(int argc, char **argv) { } // Clean up z_undeclare_subscriber(z_move(sub)); - z_close(z_move(s)); + z_close(z_move(s), NULL); return 0; } #else diff --git a/tests/z_test_fragment_tx.c b/tests/z_test_fragment_tx.c index bf12b18dc..6b8eb63cf 100644 --- a/tests/z_test_fragment_tx.c +++ b/tests/z_test_fragment_tx.c @@ -59,14 +59,14 @@ int main(int argc, char **argv) { } // Open session z_owned_session_t s; - if (z_open(&s, z_move(config)) < 0) { + if (z_open(&s, z_move(config), NULL) < 0) { printf("Unable to open session!\n"); return -1; } // Start read and lease tasks for zenoh-pico if (zp_start_read_task(z_loan_mut(s), NULL) < 0 || zp_start_lease_task(z_loan_mut(s), NULL) < 0) { printf("Unable to start read and lease tasks\n"); - z_close(z_session_move(&s)); + z_close(z_session_move(&s), NULL); return -1; } // Wait for joins @@ -95,7 +95,7 @@ int main(int argc, char **argv) { z_sleep_s(1); } // Clean up - z_close(z_move(s)); + z_close(z_move(s), NULL); free(value); return 0; }