diff --git a/extra_script.py b/extra_script.py
index 391eb8047..3d4780ca8 100644
--- a/extra_script.py
+++ b/extra_script.py
@@ -57,7 +57,7 @@
"-",
"-",
"-"]
- CPPDEFINES = ["ZENOH_ARDUINO_OPENCR", "ZENOH_C_STANDARD=99", "Z_MULTI_THREAD=0"]
+ CPPDEFINES = ["ZENOH_ARDUINO_OPENCR", "ZENOH_C_STANDARD=99", "Z_FEATURE_MULTI_THREAD=0"]
elif FRAMEWORK == 'espidf':
SRC_FILTER = ["+<*>",
diff --git a/include/zenoh-pico/config.h b/include/zenoh-pico/config.h
index 21fa2063a..fa2a3ff2a 100644
--- a/include/zenoh-pico/config.h
+++ b/include/zenoh-pico/config.h
@@ -102,117 +102,148 @@
#define Z_CONFIG_ADD_TIMESTAMP_KEY 0x4A
#define Z_CONFIG_ADD_TIMESTAMP_DEFAULT "false"
-/*------------------ Compile-time configuration properties ------------------*/
+/*------------------ Compile-time feature configuration ------------------*/
+
/**
- * Default length for Zenoh ID. Maximum size is 16 bytes.
- * This configuration will only be applied to Zenoh IDs generated by Zenoh-Pico.
+ * Enable multi-thread support.
*/
-#ifndef Z_ZID_LENGTH
-#define Z_ZID_LENGTH 16
+#ifndef Z_FEATURE_MULTI_THREAD
+#define Z_FEATURE_MULTI_THREAD 1
#endif
-#ifndef Z_TSID_LENGTH
-#define Z_TSID_LENGTH 16
+/**
+ * Enable dynamic memory allocation.
+ */
+#ifndef Z_FEATURE_DYNAMIC_MEMORY_ALLOCATION
+#define Z_FEATURE_DYNAMIC_MEMORY_ALLOCATION 0
#endif
/**
- * Protocol version identifier.
- * Do not change this value.
+ * Enable TCP links.
*/
-#ifndef Z_PROTO_VERSION
-#define Z_PROTO_VERSION 0x08
+#ifndef Z_FEATURE_LINK_TCP
+#define Z_FEATURE_LINK_TCP 1
#endif
/**
- * Default session lease in milliseconds.
+ * Enable Bluetooth links.
*/
-#ifndef Z_TRANSPORT_LEASE
-#define Z_TRANSPORT_LEASE 10000
+#ifndef Z_FEATURE_LINK_BLUETOOTH
+#define Z_FEATURE_LINK_BLUETOOTH 0
#endif
/**
- * Default session lease expire factor.
+ * Enable WebSocket links.
*/
-#ifndef Z_TRANSPORT_LEASE_EXPIRE_FACTOR
-#define Z_TRANSPORT_LEASE_EXPIRE_FACTOR 3.5
+#ifndef Z_FEATURE_LINK_WS
+#define Z_FEATURE_LINK_WS 0
#endif
/**
- * Default multicast session join interval in milliseconds.
+ * Enable Serial links.
*/
-#ifndef Z_JOIN_INTERVAL
-#define Z_JOIN_INTERVAL 2500
+#ifndef Z_FEATURE_LINK_SERIAL
+#define Z_FEATURE_LINK_SERIAL 0
#endif
/**
- * Default socket timeout in milliseconds.
+ * Enable UDP Scouting.
*/
-#ifndef Z_CONFIG_SOCKET_TIMEOUT
-#define Z_CONFIG_SOCKET_TIMEOUT 100
+#ifndef Z_FEATURE_SCOUTING_UDP
+#define Z_FEATURE_SCOUTING_UDP 1
#endif
-#ifndef Z_SN_RESOLUTION
-#define Z_SN_RESOLUTION 0x02
+/**
+ * Enable UDP Multicast links.
+ */
+#ifndef Z_FEATURE_LINK_UDP_MULTICAST
+#define Z_FEATURE_LINK_UDP_MULTICAST 1
#endif
-#ifndef Z_REQ_RESOLUTION
-#define Z_REQ_RESOLUTION 0x02
+/**
+ * Enable UDP Unicast links.
+ */
+#ifndef Z_FEATURE_LINK_UDP_UNICAST
+#define Z_FEATURE_LINK_UDP_UNICAST 1
#endif
/**
- * Enable multi-thread support.
+ * Enable Multicast Transport.
*/
-#ifndef Z_MULTI_THREAD
-#define Z_MULTI_THREAD 1
+#ifndef Z_FEATURE_MULTICAST_TRANSPORT
+#if Z_FEATURE_SCOUTING_UDP == 0 && Z_FEATURE_LINK_BLUETOOTH == 0 && Z_FEATURE_LINK_UDP_MULTICAST == 0
+#define Z_FEATURE_MULTICAST_TRANSPORT 0
+#else
+#define Z_FEATURE_MULTICAST_TRANSPORT 1
+#endif
#endif
/**
- * Enable TCP links.
+ * Enable Unicast Transport.
*/
-#ifndef Z_LINK_TCP
-#define Z_LINK_TCP 1
+#ifndef Z_FEATURE_UNICAST_TRANSPORT
+#if Z_FEATURE_LINK_TCP == 0 && Z_FEATURE_LINK_UDP_UNICAST == 0 && Z_FEATURE_LINK_SERIAL == 0 && Z_FEATURE_LINK_WS == 0
+#define Z_FEATURE_UNICAST_TRANSPORT 0
+#else
+#define Z_FEATURE_UNICAST_TRANSPORT 1
+#endif
#endif
+/*------------------ Compile-time configuration properties ------------------*/
/**
- * Enable UDP Multicast links.
+ * Default length for Zenoh ID. Maximum size is 16 bytes.
+ * This configuration will only be applied to Zenoh IDs generated by Zenoh-Pico.
*/
-#ifndef Z_LINK_UDP_MULTICAST
-#define Z_LINK_UDP_MULTICAST 1
+#ifndef Z_ZID_LENGTH
+#define Z_ZID_LENGTH 16
+#endif
+
+#ifndef Z_TSID_LENGTH
+#define Z_TSID_LENGTH 16
#endif
/**
- * Enable UDP Unicast links.
+ * Protocol version identifier.
+ * Do not change this value.
*/
-#ifndef Z_LINK_UDP_UNICAST
-#define Z_LINK_UDP_UNICAST 1
+#ifndef Z_PROTO_VERSION
+#define Z_PROTO_VERSION 0x08
#endif
/**
- * Enable Bluetooth links.
+ * Default session lease in milliseconds.
*/
-#ifndef Z_LINK_BLUETOOTH
-#define Z_LINK_BLUETOOTH 0
+#ifndef Z_TRANSPORT_LEASE
+#define Z_TRANSPORT_LEASE 10000
#endif
/**
- * Enable Serial links.
+ * Default session lease expire factor.
*/
-#ifndef Z_LINK_SERIAL
-#define Z_LINK_SERIAL 0
+#ifndef Z_TRANSPORT_LEASE_EXPIRE_FACTOR
+#define Z_TRANSPORT_LEASE_EXPIRE_FACTOR 3.5
#endif
/**
- * Enable WebSocket links.
+ * Default multicast session join interval in milliseconds.
*/
-#ifndef Z_LINK_WS
-#define Z_LINK_WS 0
+#ifndef Z_JOIN_INTERVAL
+#define Z_JOIN_INTERVAL 2500
#endif
/**
- * Enable UDP Scouting.
+ * Default socket timeout in milliseconds.
*/
-#ifndef Z_SCOUTING_UDP
-#define Z_SCOUTING_UDP 1
+#ifndef Z_CONFIG_SOCKET_TIMEOUT
+#define Z_CONFIG_SOCKET_TIMEOUT 100
+#endif
+
+#ifndef Z_SN_RESOLUTION
+#define Z_SN_RESOLUTION 0x02
+#endif
+
+#ifndef Z_REQ_RESOLUTION
+#define Z_REQ_RESOLUTION 0x02
#endif
/**
@@ -242,33 +273,4 @@
#define Z_FRAG_MAX_SIZE 300000
#endif
-/**
- * Enable dynamic memory allocation.
- */
-#ifndef Z_DYNAMIC_MEMORY_ALLOCATION
-#define Z_DYNAMIC_MEMORY_ALLOCATION 0
-#endif
-
-/**
- * Enable Multicast Transport.
- */
-#ifndef Z_MULTICAST_TRANSPORT
-#if Z_SCOUTING_UDP == 0 && Z_LINK_BLUETOOTH == 0 && Z_LINK_UDP_MULTICAST == 0
-#define Z_MULTICAST_TRANSPORT 0
-#else
-#define Z_MULTICAST_TRANSPORT 1
-#endif
-#endif
-
-/**
- * Enable Unicast Transport.
- */
-#ifndef Z_UNICAST_TRANSPORT
-#if Z_LINK_TCP == 0 && Z_LINK_UDP_UNICAST == 0 && Z_LINK_SERIAL == 0 && Z_LINK_WS == 0
-#define Z_UNICAST_TRANSPORT 0
-#else
-#define Z_UNICAST_TRANSPORT 1
-#endif
-#endif
-
#endif /* INCLUDE_ZENOH_PICO_CONFIG_H */
diff --git a/include/zenoh-pico/link/config/bt.h b/include/zenoh-pico/link/config/bt.h
index ae24fa245..40827e76c 100644
--- a/include/zenoh-pico/link/config/bt.h
+++ b/include/zenoh-pico/link/config/bt.h
@@ -19,7 +19,7 @@
#include "zenoh-pico/config.h"
#include "zenoh-pico/system/platform.h"
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#define BT_CONFIG_ARGC 3
diff --git a/include/zenoh-pico/link/config/serial.h b/include/zenoh-pico/link/config/serial.h
index 3b5fd16a6..85270be62 100644
--- a/include/zenoh-pico/link/config/serial.h
+++ b/include/zenoh-pico/link/config/serial.h
@@ -20,7 +20,7 @@
#include "zenoh-pico/config.h"
#include "zenoh-pico/system/platform.h"
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
#define SERIAL_CONFIG_ARGC 1
diff --git a/include/zenoh-pico/link/config/tcp.h b/include/zenoh-pico/link/config/tcp.h
index a5d758544..ed57e7700 100644
--- a/include/zenoh-pico/link/config/tcp.h
+++ b/include/zenoh-pico/link/config/tcp.h
@@ -19,7 +19,7 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/config.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
#define TCP_CONFIG_ARGC 1
diff --git a/include/zenoh-pico/link/config/udp.h b/include/zenoh-pico/link/config/udp.h
index 877896493..ab8875d5e 100644
--- a/include/zenoh-pico/link/config/udp.h
+++ b/include/zenoh-pico/link/config/udp.h
@@ -18,7 +18,7 @@
#include "zenoh-pico/collections/intmap.h"
#include "zenoh-pico/collections/string.h"
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
#define UDP_CONFIG_ARGC 3
diff --git a/include/zenoh-pico/link/config/ws.h b/include/zenoh-pico/link/config/ws.h
index 1551bc31e..82ef8d596 100644
--- a/include/zenoh-pico/link/config/ws.h
+++ b/include/zenoh-pico/link/config/ws.h
@@ -19,7 +19,7 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/config.h"
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
#define WS_CONFIG_TOUT_KEY 0x01
#define WS_CONFIG_TOUT_STR "tout"
diff --git a/include/zenoh-pico/link/endpoint.h b/include/zenoh-pico/link/endpoint.h
index c3cf1b42a..bd7c8cbc3 100644
--- a/include/zenoh-pico/link/endpoint.h
+++ b/include/zenoh-pico/link/endpoint.h
@@ -22,19 +22,19 @@
#include "zenoh-pico/utils/result.h"
/*------------------ Locator ------------------*/
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
#define TCP_SCHEMA "tcp"
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
#define UDP_SCHEMA "udp"
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#define BT_SCHEMA "bt"
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
#define SERIAL_SCHEMA "serial"
#endif
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
#define WS_SCHEMA "ws"
#endif
diff --git a/include/zenoh-pico/link/link.h b/include/zenoh-pico/link/link.h
index 3f0400b20..9a49f2862 100644
--- a/include/zenoh-pico/link/link.h
+++ b/include/zenoh-pico/link/link.h
@@ -20,23 +20,23 @@
#include "zenoh-pico/protocol/iobuf.h"
#include "zenoh-pico/system/platform.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
#include "zenoh-pico/system/link/tcp.h"
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
#include "zenoh-pico/system/link/udp.h"
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#include "zenoh-pico/system/link/bt.h"
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
#include "zenoh-pico/system/link/serial.h"
#endif
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
#include "zenoh-pico/system/link/ws.h"
#endif
@@ -77,19 +77,19 @@ typedef struct _z_link_t {
_z_endpoint_t _endpoint;
union {
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
_z_tcp_socket_t _tcp;
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
_z_udp_socket_t _udp;
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
_z_bt_socket_t _bt;
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
_z_serial_socket_t _serial;
#endif
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
_z_ws_socket_t _ws;
#endif
} _socket;
diff --git a/include/zenoh-pico/link/manager.h b/include/zenoh-pico/link/manager.h
index fefeea002..f494784e4 100644
--- a/include/zenoh-pico/link/manager.h
+++ b/include/zenoh-pico/link/manager.h
@@ -19,27 +19,27 @@
#include "zenoh-pico/config.h"
#include "zenoh-pico/link/link.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
int8_t _z_endpoint_tcp_valid(_z_endpoint_t *ep);
int8_t _z_new_link_tcp(_z_link_t *zl, _z_endpoint_t *ep);
#endif
-#if Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1
int8_t _z_endpoint_udp_unicast_valid(_z_endpoint_t *ep);
int8_t _z_new_link_udp_unicast(_z_link_t *zl, _z_endpoint_t ep);
#endif
-#if Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1
int8_t _z_endpoint_udp_multicast_valid(_z_endpoint_t *ep);
int8_t _z_new_link_udp_multicast(_z_link_t *zl, _z_endpoint_t ep);
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
int8_t _z_endpoint_bt_valid(_z_endpoint_t *ep);
int8_t _z_new_link_bt(_z_link_t *zl, _z_endpoint_t ep);
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
int8_t _z_endpoint_serial_valid(_z_endpoint_t *ep);
int8_t _z_new_link_serial(_z_link_t *zl, _z_endpoint_t ep);
#endif
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
int8_t _z_endpoint_ws_valid(_z_endpoint_t *ep);
int8_t _z_new_link_ws(_z_link_t *zl, _z_endpoint_t *ep);
#endif
diff --git a/include/zenoh-pico/net/session.h b/include/zenoh-pico/net/session.h
index bebe7608c..a23fb84dc 100644
--- a/include/zenoh-pico/net/session.h
+++ b/include/zenoh-pico/net/session.h
@@ -28,9 +28,9 @@
* A zenoh-net session.
*/
typedef struct {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_t _mutex_inner;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Zenoh-pico is considering a single transport per session.
_z_transport_t _tp;
@@ -122,7 +122,7 @@ int8_t _zp_send_keep_alive(_z_session_t *z);
*/
int8_t _zp_send_join(_z_session_t *z);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
/**
* Start a separate task to read from the network and process the messages
* as soon as they are received. Note that the task can be implemented in
@@ -172,6 +172,6 @@ int8_t _zp_start_lease_task(_z_session_t *z);
* ``0`` in case of success, ``-1`` in case of failure.
*/
int8_t _zp_stop_lease_task(_z_session_t *z);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
#endif /* INCLUDE_ZENOH_PICO_NET_SESSION_H */
diff --git a/include/zenoh-pico/session/session.h b/include/zenoh-pico/session/session.h
index 8b394e844..a6102da23 100644
--- a/include/zenoh-pico/session/session.h
+++ b/include/zenoh-pico/session/session.h
@@ -170,10 +170,10 @@ _Z_ELEM_DEFINE(_z_pending_query, _z_pending_query_t, _z_noop_size, _z_pending_qu
_Z_LIST_DEFINE(_z_pending_query, _z_pending_query_t)
typedef struct {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_t _mutex;
_z_condvar_t _cond_var;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_reply_data_list_t *_replies;
} _z_pending_query_collect_t;
diff --git a/include/zenoh-pico/system/link/bt.h b/include/zenoh-pico/system/link/bt.h
index 86fe2bbcf..b155e34b3 100644
--- a/include/zenoh-pico/system/link/bt.h
+++ b/include/zenoh-pico/system/link/bt.h
@@ -19,7 +19,7 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/config.h"
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#ifdef __cplusplus
extern "C" {
diff --git a/include/zenoh-pico/system/link/serial.h b/include/zenoh-pico/system/link/serial.h
index 1fa81c7af..954fd2911 100644
--- a/include/zenoh-pico/system/link/serial.h
+++ b/include/zenoh-pico/system/link/serial.h
@@ -21,7 +21,7 @@
#include "zenoh-pico/config.h"
#include "zenoh-pico/system/platform.h"
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
#define _Z_SERIAL_MTU_SIZE 1500
#define _Z_SERIAL_MFS_SIZE _Z_SERIAL_MTU_SIZE + 2 + 4 // MTU + Serial Len + Serial CRC32
diff --git a/include/zenoh-pico/system/link/tcp.h b/include/zenoh-pico/system/link/tcp.h
index 382b8b7de..e90b688eb 100644
--- a/include/zenoh-pico/system/link/tcp.h
+++ b/include/zenoh-pico/system/link/tcp.h
@@ -20,7 +20,7 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/system/platform.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
typedef struct {
_z_sys_net_socket_t _sock;
diff --git a/include/zenoh-pico/system/link/udp.h b/include/zenoh-pico/system/link/udp.h
index a154c20f0..8b6957812 100644
--- a/include/zenoh-pico/system/link/udp.h
+++ b/include/zenoh-pico/system/link/udp.h
@@ -20,7 +20,7 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/system/platform.h"
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
typedef struct {
_z_sys_net_socket_t _sock;
diff --git a/include/zenoh-pico/system/link/ws.h b/include/zenoh-pico/system/link/ws.h
index feab79328..52edd2f11 100644
--- a/include/zenoh-pico/system/link/ws.h
+++ b/include/zenoh-pico/system/link/ws.h
@@ -20,7 +20,7 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/system/platform.h"
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
typedef struct {
_z_sys_net_socket_t _sock;
diff --git a/include/zenoh-pico/system/platform.h b/include/zenoh-pico/system/platform.h
index 07e1f009e..4a8697800 100644
--- a/include/zenoh-pico/system/platform.h
+++ b/include/zenoh-pico/system/platform.h
@@ -56,7 +56,7 @@ void *z_malloc(size_t size);
void *z_realloc(void *ptr, size_t size);
void z_free(void *ptr);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
/*------------------ Thread ------------------*/
int8_t _z_task_init(_z_task_t *task, _z_task_attr_t *attr, void *(*fun)(void *), void *arg);
int8_t _z_task_join(_z_task_t *task);
@@ -77,7 +77,7 @@ int8_t _z_condvar_free(_z_condvar_t *cv);
int8_t _z_condvar_signal(_z_condvar_t *cv);
int8_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
/*------------------ Sleep ------------------*/
int z_sleep_us(size_t time);
diff --git a/include/zenoh-pico/system/platform/arduino/esp32.h b/include/zenoh-pico/system/platform/arduino/esp32.h
index bac42aa72..569efe46f 100644
--- a/include/zenoh-pico/system/platform/arduino/esp32.h
+++ b/include/zenoh-pico/system/platform/arduino/esp32.h
@@ -19,16 +19,16 @@
#include "zenoh-pico/config.h"
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
#include
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
typedef TaskHandle_t _z_task_t;
typedef void *_z_task_attr_t; // Not used in ESP32
typedef pthread_mutex_t _z_mutex_t;
typedef pthread_cond_t _z_condvar_t;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
typedef struct timespec z_clock_t;
typedef struct timeval z_time_t;
@@ -38,13 +38,13 @@ typedef struct HardwareSerial HardwareSerial; // Forward declaration to be us
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
int _fd;
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
BluetoothSerial *_bts; // As pointer to cross the boundary between C and C++
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
HardwareSerial *_serial; // As pointer to cross the boundary between C and C++
#endif
};
@@ -52,7 +52,7 @@ typedef struct {
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
struct addrinfo *_iptcp;
#endif
};
diff --git a/include/zenoh-pico/system/platform/arduino/opencr.h b/include/zenoh-pico/system/platform/arduino/opencr.h
index 23c43f222..2a7488775 100644
--- a/include/zenoh-pico/system/platform/arduino/opencr.h
+++ b/include/zenoh-pico/system/platform/arduino/opencr.h
@@ -20,12 +20,12 @@
#include "zenoh-pico/config.h"
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
typedef void *_z_task_t;
typedef void *_z_task_attr_t;
typedef void *_z_mutex_t;
typedef void *_z_condvar_t;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
typedef struct timespec z_clock_t;
typedef struct timeval z_time_t;
@@ -36,10 +36,10 @@ typedef struct WiFiUDP WiFiUDP; // Forward declaration to be used in _z_s
typedef struct {
union {
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
WiFiClient *_tcp; // As pointer to cross the boundary between C and C++
#endif
-#if Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
WiFiUDP *_udp; // As pointer to cross the boundary between C and C++
#endif
_Bool _err;
@@ -53,7 +53,7 @@ typedef struct {
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
__z_net_iptcp_addr_t _iptcp;
#endif
};
diff --git a/include/zenoh-pico/system/platform/emscripten.h b/include/zenoh-pico/system/platform/emscripten.h
index a2f340921..fcb732aab 100644
--- a/include/zenoh-pico/system/platform/emscripten.h
+++ b/include/zenoh-pico/system/platform/emscripten.h
@@ -20,19 +20,19 @@
#include "zenoh-pico/config.h"
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
typedef pthread_t _z_task_t;
typedef pthread_attr_t _z_task_attr_t;
typedef pthread_mutex_t _z_mutex_t;
typedef pthread_cond_t _z_condvar_t;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
typedef double z_clock_t;
typedef double z_time_t;
typedef struct {
union {
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
struct {
int _fd;
uint32_t _tout;
@@ -43,7 +43,7 @@ typedef struct {
typedef struct {
union {
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
struct addrinfo *_iptcp;
#endif
};
diff --git a/include/zenoh-pico/system/platform/espidf.h b/include/zenoh-pico/system/platform/espidf.h
index 6c35dd1f0..2ba7773d7 100644
--- a/include/zenoh-pico/system/platform/espidf.h
+++ b/include/zenoh-pico/system/platform/espidf.h
@@ -22,22 +22,22 @@
#include "zenoh-pico/config.h"
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
typedef TaskHandle_t _z_task_t;
typedef void *_z_task_attr_t; // Not used in ESP32
typedef pthread_mutex_t _z_mutex_t;
typedef pthread_cond_t _z_condvar_t;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
typedef struct timespec z_clock_t;
typedef struct timeval z_time_t;
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
int _fd;
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
uart_port_t _serial;
#endif
};
@@ -45,7 +45,7 @@ typedef struct {
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
struct addrinfo *_iptcp;
#endif
};
diff --git a/include/zenoh-pico/system/platform/mbed.h b/include/zenoh-pico/system/platform/mbed.h
index ca10d0459..ba18844e8 100644
--- a/include/zenoh-pico/system/platform/mbed.h
+++ b/include/zenoh-pico/system/platform/mbed.h
@@ -22,12 +22,12 @@
typedef int _z_socket_t;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
typedef void *_z_task_t; // Workaround as MBED is a C++ library
typedef void *_z_task_attr_t; // Workaround as MBED is a C++ library
typedef void *_z_mutex_t; // Workaround as MBED is a C++ library
typedef void *_z_condvar_t; // Workaround as MBED is a C++ library
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
typedef void *z_clock_t; // Not defined
typedef struct timeval z_time_t;
@@ -40,13 +40,13 @@ typedef struct SocketAddress SocketAddress; // Forward declaration to be used
typedef struct {
_Bool _err;
union {
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
TCPSocket *_tcp; // As pointer to cross the boundary between C and C++
#endif
-#if Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
UDPSocket *_udp; // As pointer to cross the boundary between C and C++
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
BufferedSerial *_serial; // As pointer to cross the boundary between C and C++
#endif
};
@@ -55,7 +55,7 @@ typedef struct {
typedef struct {
_Bool _err;
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
SocketAddress *_iptcp; // As pointer to cross the boundary between C and C++
#endif
};
diff --git a/include/zenoh-pico/system/platform/unix.h b/include/zenoh-pico/system/platform/unix.h
index 3faa48333..8084e22db 100644
--- a/include/zenoh-pico/system/platform/unix.h
+++ b/include/zenoh-pico/system/platform/unix.h
@@ -23,19 +23,19 @@
#include "zenoh-pico/config.h"
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
typedef pthread_t _z_task_t;
typedef pthread_attr_t _z_task_attr_t;
typedef pthread_mutex_t _z_mutex_t;
typedef pthread_cond_t _z_condvar_t;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
typedef struct timespec z_clock_t;
typedef struct timeval z_time_t;
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
int _fd;
#endif
};
@@ -43,7 +43,7 @@ typedef struct {
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
struct addrinfo *_iptcp;
#endif
};
diff --git a/include/zenoh-pico/system/platform/void.h b/include/zenoh-pico/system/platform/void.h
index 26197d375..8bebe22f2 100644
--- a/include/zenoh-pico/system/platform/void.h
+++ b/include/zenoh-pico/system/platform/void.h
@@ -17,12 +17,12 @@
#include "zenoh-pico/config.h"
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
typedef void *_z_task_t;
typedef void *_z_task_attr_t;
typedef void *_z_mutex_t;
typedef void *_z_condvar_t;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
typedef void *z_clock_t;
typedef void *z_time_t;
diff --git a/include/zenoh-pico/system/platform/windows.h b/include/zenoh-pico/system/platform/windows.h
index f7c7d1ccb..fa5aff62d 100644
--- a/include/zenoh-pico/system/platform/windows.h
+++ b/include/zenoh-pico/system/platform/windows.h
@@ -20,19 +20,19 @@
#include "zenoh-pico/config.h"
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
typedef HANDLE *_z_task_t;
typedef void *_z_task_attr_t; // Not used in Windows
typedef SRWLOCK _z_mutex_t;
typedef CONDITION_VARIABLE _z_condvar_t;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
typedef struct timeb z_clock_t;
typedef struct timeb z_time_t;
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
SOCKET _fd;
#endif
} _sock;
@@ -40,7 +40,7 @@ typedef struct {
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
struct addrinfo *_iptcp;
#endif
} _ep;
diff --git a/include/zenoh-pico/system/platform/zephyr.h b/include/zenoh-pico/system/platform/zephyr.h
index 4b318c9d9..c0ad3c378 100644
--- a/include/zenoh-pico/system/platform/zephyr.h
+++ b/include/zenoh-pico/system/platform/zephyr.h
@@ -30,22 +30,22 @@
#include "zenoh-pico/config.h"
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
typedef pthread_t _z_task_t;
typedef pthread_attr_t _z_task_attr_t;
typedef pthread_mutex_t _z_mutex_t;
typedef pthread_cond_t _z_condvar_t;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
typedef struct timespec z_clock_t;
typedef struct timeval z_time_t;
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
int _fd;
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
const struct device *_serial;
#endif
};
@@ -53,7 +53,7 @@ typedef struct {
typedef struct {
union {
-#if Z_LINK_TCP == 1 || Z_LINK_UDP_MULTICAST == 1 || Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_TCP == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 || Z_FEATURE_LINK_UDP_UNICAST == 1
struct addrinfo *_iptcp;
#endif
};
diff --git a/include/zenoh-pico/transport/transport.h b/include/zenoh-pico/transport/transport.h
index 1982b1b92..6996f4b5a 100644
--- a/include/zenoh-pico/transport/transport.h
+++ b/include/zenoh-pico/transport/transport.h
@@ -56,11 +56,11 @@ _z_transport_peer_entry_list_t *_z_transport_peer_entry_list_insert(_z_transport
typedef struct {
// Session associated to the transport
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// TX and RX mutexes
_z_mutex_t _mutex_rx;
_z_mutex_t _mutex_tx;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_link_t _link;
@@ -82,12 +82,12 @@ typedef struct {
void *_session;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_task_t *_read_task;
_z_task_t *_lease_task;
volatile _Bool _read_task_running;
volatile _Bool _lease_task_running;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
volatile _Bool _received;
volatile _Bool _transmitted;
@@ -97,14 +97,14 @@ typedef struct {
// Session associated to the transport
void *_session;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// TX and RX mutexes
_z_mutex_t _mutex_rx;
_z_mutex_t _mutex_tx;
// Peer list mutex
_z_mutex_t _mutex_peer;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_link_t _link;
@@ -121,12 +121,12 @@ typedef struct {
// Known valid peers
_z_transport_peer_entry_list_t *_peers;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_task_t *_read_task;
_z_task_t *_lease_task;
volatile _Bool _read_task_running;
volatile _Bool _lease_task_running;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
volatile _Bool _transmitted;
} _z_transport_multicast_t;
diff --git a/src/api/api.c b/src/api/api.c
index db8d725e9..b673e3659 100644
--- a/src/api/api.c
+++ b/src/api/api.c
@@ -561,7 +561,7 @@ int8_t z_info_peers_zid(const z_session_t zs, z_owned_closure_zid_t *callback) {
void *ctx = callback->context;
callback->context = NULL;
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zs._val->_tp._type == _Z_TRANSPORT_MULTICAST_TYPE) {
_z_transport_peer_entry_list_t *l = zs._val->_tp._transport._multicast._peers;
for (; l != NULL; l = _z_transport_peer_entry_list_tail(l)) {
@@ -573,7 +573,7 @@ int8_t z_info_peers_zid(const z_session_t zs, z_owned_closure_zid_t *callback) {
}
#else
(void)zs;
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
if (callback->drop != NULL) {
callback->drop(ctx);
@@ -586,12 +586,12 @@ int8_t z_info_routers_zid(const z_session_t zs, z_owned_closure_zid_t *callback)
void *ctx = callback->context;
callback->context = NULL;
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zs._val->_tp._type == _Z_TRANSPORT_UNICAST_TYPE) {
z_id_t id = zs._val->_tp._transport._unicast._remote_zid;
callback->call(&id, ctx);
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
if (callback->drop != NULL) {
callback->drop(ctx);
@@ -739,17 +739,17 @@ z_owned_publisher_t z_declare_publisher(z_session_t zs, z_keyexpr_t keyexpr, con
// TODO: Currently, if resource declarations are done over multicast transports, the current protocol definition
// lacks a way to convey them to later-joining nodes. Thus, in the current version automatic
// resource declarations are only performed on unicast transports.
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zs._val->_tp._type != _Z_TRANSPORT_MULTICAST_TYPE) {
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
_z_resource_t *r = _z_get_resource_by_key(zs._val, &keyexpr);
if (r == NULL) {
uint16_t id = _z_declare_resource(zs._val, keyexpr);
key = _z_rid_with_suffix(id, NULL);
}
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
z_publisher_options_t opt = z_publisher_options_default();
if (options != NULL) {
@@ -815,9 +815,9 @@ z_owned_subscriber_t z_declare_subscriber(z_session_t zs, z_keyexpr_t keyexpr, z
// TODO: Currently, if resource declarations are done over multicast transports, the current protocol definition
// lacks a way to convey them to later-joining nodes. Thus, in the current version automatic
// resource declarations are only performed on unicast transports.
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zs._val->_tp._type != _Z_TRANSPORT_MULTICAST_TYPE) {
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
_z_resource_t *r = _z_get_resource_by_key(zs._val, &keyexpr);
if (r == NULL) {
char *wild = strpbrk(keyexpr._suffix, "*$");
@@ -833,9 +833,9 @@ z_owned_subscriber_t z_declare_subscriber(z_session_t zs, z_keyexpr_t keyexpr, z
uint16_t id = _z_declare_resource(zs._val, keyexpr);
key = _z_rid_with_suffix(id, wild);
}
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
_z_subinfo_t subinfo = _z_subinfo_push_default();
if (options != NULL) {
@@ -904,17 +904,17 @@ z_owned_queryable_t z_declare_queryable(z_session_t zs, z_keyexpr_t keyexpr, z_o
// TODO: Currently, if resource declarations are done over multicast transports, the current protocol definition
// lacks a way to convey them to later-joining nodes. Thus, in the current version automatic
// resource declarations are only performed on unicast transports.
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zs._val->_tp._type != _Z_TRANSPORT_MULTICAST_TYPE) {
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
_z_resource_t *r = _z_get_resource_by_key(zs._val, &keyexpr);
if (r == NULL) {
uint16_t id = _z_declare_resource(zs._val, keyexpr);
key = _z_rid_with_suffix(id, NULL);
}
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
z_queryable_options_t opt = z_queryable_options_default();
if (options != NULL) {
@@ -970,7 +970,7 @@ zp_task_read_options_t zp_task_read_options_default(void) { return (zp_task_read
int8_t zp_start_read_task(z_session_t zs, const zp_task_read_options_t *options) {
(void)(options);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
return _zp_start_read_task(zs._val);
#else
(void)(zs);
@@ -979,7 +979,7 @@ int8_t zp_start_read_task(z_session_t zs, const zp_task_read_options_t *options)
}
int8_t zp_stop_read_task(z_session_t zs) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
return _zp_stop_read_task(zs._val);
#else
(void)(zs);
@@ -991,7 +991,7 @@ zp_task_lease_options_t zp_task_lease_options_default(void) { return (zp_task_le
int8_t zp_start_lease_task(z_session_t zs, const zp_task_lease_options_t *options) {
(void)(options);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
return _zp_start_lease_task(zs._val);
#else
(void)(zs);
@@ -1000,7 +1000,7 @@ int8_t zp_start_lease_task(z_session_t zs, const zp_task_lease_options_t *option
}
int8_t zp_stop_lease_task(z_session_t zs) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
return _zp_stop_lease_task(zs._val);
#else
(void)(zs);
diff --git a/src/link/config/bt.c b/src/link/config/bt.c
index 989817cac..0c633b7cc 100644
--- a/src/link/config/bt.c
+++ b/src/link/config/bt.c
@@ -15,7 +15,7 @@
#include
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
size_t _z_bt_config_strlen(const _z_str_intmap_t *s) {
BT_CONFIG_MAPPING_BUILD
diff --git a/src/link/config/serial.c b/src/link/config/serial.c
index c0608195d..876174f79 100644
--- a/src/link/config/serial.c
+++ b/src/link/config/serial.c
@@ -16,7 +16,7 @@
#include
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
size_t _z_serial_config_strlen(const _z_str_intmap_t *s) {
SERIAL_CONFIG_MAPPING_BUILD
diff --git a/src/link/config/tcp.c b/src/link/config/tcp.c
index e5ad017ae..0da276204 100644
--- a/src/link/config/tcp.c
+++ b/src/link/config/tcp.c
@@ -18,7 +18,7 @@
#include "zenoh-pico/config.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
size_t _z_tcp_config_strlen(const _z_str_intmap_t *s) {
TCP_CONFIG_MAPPING_BUILD
diff --git a/src/link/config/udp.c b/src/link/config/udp.c
index 3629f25be..3dc5f06c6 100644
--- a/src/link/config/udp.c
+++ b/src/link/config/udp.c
@@ -18,7 +18,7 @@
#include "zenoh-pico/config.h"
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
size_t _z_udp_config_strlen(const _z_str_intmap_t *s) {
UDP_CONFIG_MAPPING_BUILD
diff --git a/src/link/config/ws.c b/src/link/config/ws.c
index ae876596b..14e4c113c 100644
--- a/src/link/config/ws.c
+++ b/src/link/config/ws.c
@@ -18,7 +18,7 @@
#include "zenoh-pico/config.h"
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
size_t _z_ws_config_strlen(const _z_str_intmap_t *s) {
WS_CONFIG_MAPPING_BUILD
diff --git a/src/link/endpoint.c b/src/link/endpoint.c
index a4348db71..d06a67158 100644
--- a/src/link/endpoint.c
+++ b/src/link/endpoint.c
@@ -20,19 +20,19 @@
#include "zenoh-pico/config.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
#include "zenoh-pico/link/config/tcp.h"
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
#include "zenoh-pico/link/config/udp.h"
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#include "zenoh-pico/link/config/bt.h"
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
#include "zenoh-pico/link/config/serial.h"
#endif
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
#include "zenoh-pico/link/config/ws.h"
#endif
/*------------------ Locator ------------------*/
@@ -292,27 +292,27 @@ int8_t _z_endpoint_config_from_str(_z_str_intmap_t *strint, const char *str, con
p_start = _z_ptr_char_offset(p_start, 1);
// Call the right configuration parser depending on the protocol
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
if (_z_str_eq(proto, TCP_SCHEMA) == true) {
ret = _z_tcp_config_from_str(strint, p_start);
} else
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
if (_z_str_eq(proto, UDP_SCHEMA) == true) {
ret = _z_udp_config_from_str(strint, p_start);
} else
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
if (_z_str_eq(proto, BT_SCHEMA) == true) {
ret = _z_bt_config_from_str(strint, p_start);
} else
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
if (_z_str_eq(proto, SERIAL_SCHEMA) == true) {
ret = _z_serial_config_from_str(strint, p_start);
} else
#endif
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
if (_z_str_eq(proto, WS_SCHEMA) == true) {
ret = _z_ws_config_from_str(strint, p_start);
} else
@@ -329,27 +329,27 @@ size_t _z_endpoint_config_strlen(const _z_str_intmap_t *s, const char *proto) {
size_t len = 0;
// Call the right configuration parser depending on the protocol
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
if (_z_str_eq(proto, TCP_SCHEMA) == true) {
len = _z_tcp_config_strlen(s);
} else
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
if (_z_str_eq(proto, UDP_SCHEMA) == true) {
len = _z_udp_config_strlen(s);
} else
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
if (_z_str_eq(proto, BT_SCHEMA) == true) {
len = _z_bt_config_strlen(s);
} else
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
if (_z_str_eq(proto, SERIAL_SCHEMA) == true) {
len = _z_serial_config_strlen(s);
} else
#endif
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
if (_z_str_eq(proto, WS_SCHEMA) == true) {
len = _z_ws_config_strlen(s);
} else
@@ -365,27 +365,27 @@ char *_z_endpoint_config_to_str(const _z_str_intmap_t *s, const char *proto) {
char *res = NULL;
// Call the right configuration parser depending on the protocol
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
if (_z_str_eq(proto, TCP_SCHEMA) == true) {
res = _z_tcp_config_to_str(s);
} else
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
if (_z_str_eq(proto, UDP_SCHEMA) == true) {
res = _z_udp_config_to_str(s);
} else
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
if (_z_str_eq(proto, BT_SCHEMA) == true) {
res = _z_bt_config_to_str(s);
} else
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
if (_z_str_eq(proto, SERIAL_SCHEMA) == true) {
res = _z_serial_config_to_str(s);
} else
#endif
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
if (_z_str_eq(proto, WS_SCHEMA) == true) {
res = _z_ws_config_to_str(s);
} else
diff --git a/src/link/link.c b/src/link/link.c
index 5c409e353..1a5f89925 100644
--- a/src/link/link.c
+++ b/src/link/link.c
@@ -28,27 +28,27 @@ int8_t _z_open_link(_z_link_t *zl, const char *locator) {
if (ret == _Z_RES_OK) {
// TODO[peer]: when peer unicast mode is supported, this must be revisited
// Create transport link
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
if (_z_endpoint_tcp_valid(&ep) == _Z_RES_OK) {
ret = _z_new_link_tcp(zl, &ep);
} else
#endif
-#if Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1
if (_z_endpoint_udp_unicast_valid(&ep) == _Z_RES_OK) {
ret = _z_new_link_udp_unicast(zl, ep);
} else
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
if (_z_endpoint_bt_valid(&ep) == _Z_RES_OK) {
ret = _z_new_link_bt(zl, ep);
} else
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
if (_z_endpoint_serial_valid(&ep) == _Z_RES_OK) {
ret = _z_new_link_serial(zl, ep);
} else
#endif
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
if (_z_endpoint_ws_valid(&ep) == _Z_RES_OK) {
ret = _z_new_link_ws(zl, &ep);
} else
@@ -82,12 +82,12 @@ int8_t _z_listen_link(_z_link_t *zl, const char *locator) {
if (ret == _Z_RES_OK) {
// TODO[peer]: when peer unicast mode is supported, this must be revisited
// Create transport link
-#if Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1
if (_z_endpoint_udp_multicast_valid(&ep) == _Z_RES_OK) {
ret = _z_new_link_udp_multicast(zl, ep);
} else
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
if (_z_endpoint_bt_valid(&ep) == _Z_RES_OK) {
ret = _z_new_link_bt(zl, ep);
} else
diff --git a/src/link/multicast/bt.c b/src/link/multicast/bt.c
index e269d420e..332e5f9fa 100644
--- a/src/link/multicast/bt.c
+++ b/src/link/multicast/bt.c
@@ -20,7 +20,7 @@
#include "zenoh-pico/link/manager.h"
#include "zenoh-pico/system/link/bt.h"
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#define SPP_MAXIMUM_PAYLOAD 128
diff --git a/src/link/multicast/udp.c b/src/link/multicast/udp.c
index 981b1a37f..bcb2a4dc8 100644
--- a/src/link/multicast/udp.c
+++ b/src/link/multicast/udp.c
@@ -23,7 +23,7 @@
#include "zenoh-pico/system/link/udp.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1
char *__z_parse_port_segment_udp_multicast(const char *address) {
char *ret = NULL;
diff --git a/src/link/unicast/serial.c b/src/link/unicast/serial.c
index 40cdbf349..eebbff12a 100644
--- a/src/link/unicast/serial.c
+++ b/src/link/unicast/serial.c
@@ -23,7 +23,7 @@
#include "zenoh-pico/system/link/serial.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
#define SPP_MAXIMUM_PAYLOAD 128
diff --git a/src/link/unicast/tcp.c b/src/link/unicast/tcp.c
index c6af264d2..b7b78fa43 100644
--- a/src/link/unicast/tcp.c
+++ b/src/link/unicast/tcp.c
@@ -23,7 +23,7 @@
#include "zenoh-pico/system/link/tcp.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
char *__z_parse_port_segment_tcp(char *address) {
char *ret = NULL;
diff --git a/src/link/unicast/udp.c b/src/link/unicast/udp.c
index 63ae5de04..c87441709 100644
--- a/src/link/unicast/udp.c
+++ b/src/link/unicast/udp.c
@@ -23,7 +23,7 @@
#include "zenoh-pico/system/link/udp.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1
char *__z_parse_port_segment_udp_unicast(char *address) {
char *ret = NULL;
diff --git a/src/link/unicast/ws.c b/src/link/unicast/ws.c
index cd7edd673..426e5fa96 100644
--- a/src/link/unicast/ws.c
+++ b/src/link/unicast/ws.c
@@ -24,7 +24,7 @@
#include "zenoh-pico/system/link/ws.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
char *__z_parse_port_segment_ws(char *address) {
char *ret = NULL;
diff --git a/src/net/session.c b/src/net/session.c
index 2f2b0c93e..24d66dea6 100644
--- a/src/net/session.c
+++ b/src/net/session.c
@@ -33,7 +33,7 @@ int8_t __z_open_inner(_z_session_t *zn, char *locator, z_whatami_t mode) {
int8_t ret = _Z_RES_OK;
_z_id_t local_zid = _z_id_empty();
-#if Z_UNICAST_TRANSPORT == 1 || Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1 || Z_FEATURE_MULTICAST_TRANSPORT == 1
ret = _z_session_generate_zid(&local_zid, Z_ZID_LENGTH);
if (ret == _Z_RES_OK) {
ret = _z_new_transport(&zn->_tp, &local_zid, locator, mode);
@@ -154,14 +154,14 @@ _z_config_t *_z_info(const _z_session_t *zn) {
_z_bytes_t local_zid = _z_bytes_wrap(zn->_local_zid.id, _z_id_len(zn->_local_zid));
_zp_config_insert(ps, Z_INFO_PID_KEY, _z_string_from_bytes(&local_zid));
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_UNICAST_TYPE) {
_z_id_t remote_zid = zn->_tp._transport._unicast._remote_zid;
_z_bytes_t remote_zidbytes = _z_bytes_wrap(remote_zid.id, _z_id_len(remote_zid));
_zp_config_insert(ps, Z_INFO_ROUTER_PID_KEY, _z_string_from_bytes(&remote_zidbytes));
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_MULTICAST_TYPE) {
_z_transport_peer_entry_list_t *xs = zn->_tp._transport._multicast._peers;
while (xs != NULL) {
@@ -172,7 +172,7 @@ _z_config_t *_z_info(const _z_session_t *zn) {
xs = _z_transport_peer_entry_list_tail(xs);
}
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
__asm__("nop");
}
@@ -187,7 +187,7 @@ int8_t _zp_send_keep_alive(_z_session_t *zn) { return _z_send_keep_alive(&zn->_t
int8_t _zp_send_join(_z_session_t *zn) { return _z_send_join(&zn->_tp); }
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
int8_t _zp_start_read_task(_z_session_t *zn) {
int8_t ret = _Z_RES_OK;
@@ -195,7 +195,7 @@ int8_t _zp_start_read_task(_z_session_t *zn) {
if (task != NULL) {
(void)memset(task, 0, sizeof(_z_task_t));
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_UNICAST_TYPE) {
zn->_tp._transport._unicast._read_task = task;
zn->_tp._transport._unicast._read_task_running = true;
@@ -205,8 +205,8 @@ int8_t _zp_start_read_task(_z_session_t *zn) {
z_free(task);
}
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_MULTICAST_TYPE) {
zn->_tp._transport._multicast._read_task = task;
zn->_tp._transport._multicast._read_task_running = true;
@@ -216,7 +216,7 @@ int8_t _zp_start_read_task(_z_session_t *zn) {
z_free(task);
}
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
z_free(task);
@@ -229,16 +229,16 @@ int8_t _zp_start_read_task(_z_session_t *zn) {
int8_t _zp_stop_read_task(_z_session_t *zn) {
int8_t ret = _Z_RES_OK;
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_UNICAST_TYPE) {
zn->_tp._transport._unicast._read_task_running = false;
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_MULTICAST_TYPE) {
zn->_tp._transport._multicast._read_task_running = false;
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
}
@@ -253,7 +253,7 @@ int8_t _zp_start_lease_task(_z_session_t *zn) {
if (task != NULL) {
(void)memset(task, 0, sizeof(_z_task_t));
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_UNICAST_TYPE) {
zn->_tp._transport._unicast._lease_task = task;
zn->_tp._transport._unicast._lease_task_running = true;
@@ -263,8 +263,8 @@ int8_t _zp_start_lease_task(_z_session_t *zn) {
z_free(task);
}
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_MULTICAST_TYPE) {
zn->_tp._transport._multicast._lease_task = task;
zn->_tp._transport._multicast._lease_task_running = true;
@@ -274,7 +274,7 @@ int8_t _zp_start_lease_task(_z_session_t *zn) {
z_free(task);
}
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
z_free(task);
@@ -287,20 +287,20 @@ int8_t _zp_start_lease_task(_z_session_t *zn) {
int8_t _zp_stop_lease_task(_z_session_t *zn) {
int8_t ret = _Z_RES_OK;
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_UNICAST_TYPE) {
zn->_tp._transport._unicast._lease_task_running = false;
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_MULTICAST_TYPE) {
zn->_tp._transport._multicast._lease_task_running = false;
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
}
return ret;
}
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
diff --git a/src/session/query.c b/src/session/query.c
index 52caa9beb..ec976c7e3 100644
--- a/src/session/query.c
+++ b/src/session/query.c
@@ -102,15 +102,15 @@ _z_pending_query_t *__unsafe__z_get_pending_query_by_id(_z_session_t *zn, const
}
_z_pending_query_t *_z_get_pending_query_by_id(_z_session_t *zn, const _z_zint_t id) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_pending_query_t *pql = __unsafe__z_get_pending_query_by_id(zn, id);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return pql;
}
@@ -120,9 +120,9 @@ int8_t _z_register_pending_query(_z_session_t *zn, _z_pending_query_t *pen_qry)
_Z_DEBUG(">>> Allocating query for (%ju:%s,%s)\n", (uintmax_t)pen_qry->_key._id, pen_qry->_key._suffix,
pen_qry->_parameters);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_pending_query_t *pql = __unsafe__z_get_pending_query_by_id(zn, pen_qry->_id);
if (pql == NULL) { // Register query only if a pending one with the same ID does not exist
@@ -131,9 +131,9 @@ int8_t _z_register_pending_query(_z_session_t *zn, _z_pending_query_t *pen_qry)
ret = _Z_ERR_ENTITY_DECLARATION_FAILED;
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return ret;
}
@@ -143,9 +143,9 @@ int8_t _z_trigger_query_reply_partial(_z_session_t *zn, const _z_zint_t id, cons
const _z_timestamp_t timestamp) {
int8_t ret = _Z_RES_OK;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_pending_query_t *pen_qry = __unsafe__z_get_pending_query_by_id(zn, id);
if ((ret == _Z_RES_OK) && (pen_qry == NULL)) {
@@ -215,9 +215,9 @@ int8_t _z_trigger_query_reply_partial(_z_session_t *zn, const _z_zint_t id, cons
}
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Trigger the user callback
if ((ret == _Z_RES_OK) && (pen_qry->_consolidation != Z_CONSOLIDATION_MODE_LATEST)) {
@@ -234,9 +234,9 @@ int8_t _z_trigger_query_reply_partial(_z_session_t *zn, const _z_zint_t id, cons
int8_t _z_trigger_query_reply_final(_z_session_t *zn, _z_zint_t id) {
int8_t ret = _Z_RES_OK;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Final reply received for unknown query id
_z_pending_query_t *pen_qry = __unsafe__z_get_pending_query_by_id(zn, id);
@@ -260,33 +260,33 @@ int8_t _z_trigger_query_reply_final(_z_session_t *zn, _z_zint_t id) {
zn->_pending_queries = _z_pending_query_list_drop_filter(zn->_pending_queries, _z_pending_query_eq, pen_qry);
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return ret;
}
void _z_unregister_pending_query(_z_session_t *zn, _z_pending_query_t *pen_qry) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
zn->_pending_queries = _z_pending_query_list_drop_filter(zn->_pending_queries, _z_pending_query_eq, pen_qry);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
void _z_flush_pending_queries(_z_session_t *zn) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_pending_query_list_free(&zn->_pending_queries);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
diff --git a/src/session/queryable.c b/src/session/queryable.c
index d18c5705e..7431712b4 100644
--- a/src/session/queryable.c
+++ b/src/session/queryable.c
@@ -89,30 +89,30 @@ _z_questionable_sptr_list_t *__unsafe_z_get_questionable_by_key(_z_session_t *zn
}
_z_questionable_sptr_t *_z_get_questionable_by_id(_z_session_t *zn, const _z_zint_t id) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_questionable_sptr_t *qle = __unsafe_z_get_questionable_by_id(zn, id);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return qle;
}
_z_questionable_sptr_list_t *_z_get_questionable_by_key(_z_session_t *zn, const _z_keyexpr_t *keyexpr) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_keyexpr_t key = __unsafe_z_get_expanded_key_from_key(zn, keyexpr);
_z_questionable_sptr_list_t *qles = __unsafe_z_get_questionable_by_key(zn, key);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return qles;
}
@@ -121,9 +121,9 @@ _z_questionable_sptr_t *_z_register_questionable(_z_session_t *zn, _z_questionab
_Z_DEBUG(">>> Allocating queryable for (%ju:%s)\n", (uintmax_t)q->_key._id, q->_key._suffix);
_z_questionable_sptr_t *ret = NULL;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
ret = (_z_questionable_sptr_t *)z_malloc(sizeof(_z_questionable_sptr_t));
if (ret != NULL) {
@@ -131,9 +131,9 @@ _z_questionable_sptr_t *_z_register_questionable(_z_session_t *zn, _z_questionab
zn->_local_questionable = _z_questionable_sptr_list_push(zn->_local_questionable, ret);
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return ret;
}
@@ -141,17 +141,17 @@ _z_questionable_sptr_t *_z_register_questionable(_z_session_t *zn, _z_questionab
int8_t _z_trigger_queryables(_z_session_t *zn, const _z_msg_query_t *query, const _z_keyexpr_t q_key, uint32_t qid) {
int8_t ret = _Z_RES_OK;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_keyexpr_t key = __unsafe_z_get_expanded_key_from_key(zn, &q_key);
if (key._suffix != NULL) {
_z_questionable_sptr_list_t *qles = __unsafe_z_get_questionable_by_key(zn, key);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Build the query
z_query_t q;
@@ -190,9 +190,9 @@ int8_t _z_trigger_queryables(_z_session_t *zn, const _z_msg_query_t *query, cons
}
_z_msg_clear(&z_msg);
} else {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
ret = _Z_ERR_KEYEXPR_UNKNOWN;
}
@@ -201,26 +201,26 @@ int8_t _z_trigger_queryables(_z_session_t *zn, const _z_msg_query_t *query, cons
}
void _z_unregister_questionable(_z_session_t *zn, _z_questionable_sptr_t *qle) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
zn->_local_questionable =
_z_questionable_sptr_list_drop_filter(zn->_local_questionable, _z_questionable_sptr_eq, qle);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
void _z_flush_questionables(_z_session_t *zn) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_questionable_sptr_list_free(&zn->_local_questionable);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
diff --git a/src/session/resource.c b/src/session/resource.c
index 30c29702e..8a36ef951 100644
--- a/src/session/resource.c
+++ b/src/session/resource.c
@@ -174,15 +174,15 @@ _z_keyexpr_t __unsafe_z_get_expanded_key_from_key(_z_session_t *zn, const _z_key
}
_z_resource_t *_z_get_resource_by_id(_z_session_t *zn, uint16_t mapping, _z_zint_t rid) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_resource_t *res = __unsafe_z_get_resource_by_id(zn, mapping, rid);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return res;
}
@@ -191,28 +191,28 @@ _z_resource_t *_z_get_resource_by_key(_z_session_t *zn, const _z_keyexpr_t *keye
if (keyexpr->_suffix == NULL) {
return _z_get_resource_by_id(zn, _z_keyexpr_mapping_id(keyexpr), keyexpr->_id);
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_resource_t *res = __unsafe_z_get_resource_by_key(zn, keyexpr);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return res;
}
_z_keyexpr_t _z_get_expanded_key_from_key(_z_session_t *zn, const _z_keyexpr_t *keyexpr) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_keyexpr_t res = __unsafe_z_get_expanded_key_from_key(zn, keyexpr);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return res;
}
@@ -224,9 +224,9 @@ int16_t _z_register_resource(_z_session_t *zn, _z_keyexpr_t key, uint16_t id, ui
uint16_t mapping = register_to_mapping;
uint16_t parent_mapping = _z_keyexpr_mapping_id(&key);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
if (key._id != Z_RESOURCE_ID_NONE) {
if (parent_mapping == mapping) {
@@ -255,9 +255,9 @@ int16_t _z_register_resource(_z_session_t *zn, _z_keyexpr_t key, uint16_t id, ui
}
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return ret;
}
@@ -265,9 +265,9 @@ int16_t _z_register_resource(_z_session_t *zn, _z_keyexpr_t key, uint16_t id, ui
void _z_unregister_resource(_z_session_t *zn, uint16_t id, uint16_t mapping) {
_Bool is_local = mapping == _Z_KEYEXPR_MAPPING_LOCAL;
_Z_DEBUG("unregistering: id %d, mapping: %d\n", id, mapping);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_resource_list_t **parent_mut = is_local ? &zn->_local_resources : &zn->_remote_resources;
while (id != 0) {
_z_resource_list_t *parent = *parent_mut;
@@ -289,9 +289,9 @@ void _z_unregister_resource(_z_session_t *zn, uint16_t id, uint16_t mapping) {
parent = *parent_mut;
}
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
_Bool _z_unregister_resource_for_peer_filter(const _z_resource_t *candidate, const _z_resource_t *ctx) {
@@ -299,27 +299,27 @@ _Bool _z_unregister_resource_for_peer_filter(const _z_resource_t *candidate, con
return _z_keyexpr_mapping_id(&candidate->_key) == mapping;
}
void _z_unregister_resources_for_peer(_z_session_t *zn, uint16_t mapping) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_resource_t ctx = {._id = mapping, ._refcount = 0, ._key = {0}};
zn->_remote_resources =
_z_resource_list_drop_filter(zn->_remote_resources, _z_unregister_resource_for_peer_filter, &ctx);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
void _z_flush_resources(_z_session_t *zn) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_resource_list_free(&zn->_local_resources);
_z_resource_list_free(&zn->_remote_resources);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
diff --git a/src/session/scout.c b/src/session/scout.c
index 7a45a3ecc..e9191da07 100644
--- a/src/session/scout.c
+++ b/src/session/scout.c
@@ -20,8 +20,8 @@
#include "zenoh-pico/protocol/core.h"
#include "zenoh-pico/utils/logging.h"
-#if Z_SCOUTING_UDP == 1 && Z_LINK_UDP_UNICAST == 0
-#error "Scouting UDP requires UDP unicast links to be enabled (Z_LINK_UDP_UNICAST = 1 in config.h)"
+#if Z_FEATURE_SCOUTING_UDP == 1 && Z_FEATURE_LINK_UDP_UNICAST == 0
+#error "Scouting UDP requires UDP unicast links to be enabled (Z_FEATURE_LINK_UDP_UNICAST = 1 in config.h)"
#endif
_z_hello_list_t *__z_scout_loop(const _z_wbuf_t *wbf, const char *locator, unsigned long period, _Bool exit_on_first) {
@@ -32,7 +32,7 @@ _z_hello_list_t *__z_scout_loop(const _z_wbuf_t *wbf, const char *locator, unsig
_z_endpoint_t ep;
err = _z_endpoint_from_str(&ep, locator);
-#if Z_SCOUTING_UDP == 1
+#if Z_FEATURE_SCOUTING_UDP == 1
if ((err == _Z_RES_OK) && (_z_str_eq(ep._locator._protocol, UDP_SCHEMA) == true)) {
_z_endpoint_clear(&ep);
} else
@@ -140,13 +140,13 @@ _z_hello_list_t *_z_scout_inner(const z_what_t what, _z_id_t zid, const char *lo
_z_scouting_message_encode(&wbf, &scout);
// Scout on multicast
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
ret = __z_scout_loop(&wbf, locator, timeout, exit_on_first);
#else
(void)(locator);
(void)(timeout);
(void)(exit_on_first);
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
_z_wbuf_clear(&wbf);
diff --git a/src/session/subscription.c b/src/session/subscription.c
index fd057aac3..e3e0833f3 100644
--- a/src/session/subscription.c
+++ b/src/session/subscription.c
@@ -96,29 +96,29 @@ _z_subscription_sptr_list_t *__unsafe_z_get_subscriptions_by_key(_z_session_t *z
}
_z_subscription_sptr_t *_z_get_subscription_by_id(_z_session_t *zn, uint8_t is_local, const _z_zint_t id) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_subscription_sptr_t *sub = __unsafe_z_get_subscription_by_id(zn, is_local, id);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return sub;
}
_z_subscription_sptr_list_t *_z_get_subscriptions_by_key(_z_session_t *zn, uint8_t is_local, const _z_keyexpr_t *key) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_subscription_sptr_list_t *subs = __unsafe_z_get_subscriptions_by_key(zn, is_local, *key);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return subs;
}
@@ -127,9 +127,9 @@ _z_subscription_sptr_t *_z_register_subscription(_z_session_t *zn, uint8_t is_lo
_Z_DEBUG(">>> Allocating sub decl for (%ju:%s)\n", (uintmax_t)s->_key._id, s->_key._suffix);
_z_subscription_sptr_t *ret = NULL;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_subscription_sptr_list_t *subs = __unsafe_z_get_subscriptions_by_key(zn, is_local, s->_key);
if (subs == NULL) { // A subscription for this name does not yet exists
@@ -144,9 +144,9 @@ _z_subscription_sptr_t *_z_register_subscription(_z_session_t *zn, uint8_t is_lo
}
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return ret;
}
@@ -155,9 +155,9 @@ int8_t _z_trigger_subscriptions(_z_session_t *zn, const _z_keyexpr_t keyexpr, co
const _z_encoding_t encoding, const _z_zint_t kind, const _z_timestamp_t timestamp) {
int8_t ret = _Z_RES_OK;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_Z_DEBUG("Resolving %d - %s on mapping 0x%x\n", keyexpr._id, keyexpr._suffix, _z_keyexpr_mapping_id(&keyexpr));
_z_keyexpr_t key = __unsafe_z_get_expanded_key_from_key(zn, &keyexpr);
@@ -165,9 +165,9 @@ int8_t _z_trigger_subscriptions(_z_session_t *zn, const _z_keyexpr_t keyexpr, co
if (key._suffix != NULL) {
_z_subscription_sptr_list_t *subs = __unsafe_z_get_subscriptions_by_key(zn, _Z_RESOURCE_IS_LOCAL, key);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Build the sample
_z_sample_t s;
@@ -187,9 +187,9 @@ int8_t _z_trigger_subscriptions(_z_session_t *zn, const _z_keyexpr_t keyexpr, co
_z_keyexpr_clear(&key);
_z_subscription_sptr_list_free(&subs);
} else {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
ret = _Z_ERR_KEYEXPR_UNKNOWN;
}
@@ -197,9 +197,9 @@ int8_t _z_trigger_subscriptions(_z_session_t *zn, const _z_keyexpr_t keyexpr, co
}
void _z_unregister_subscription(_z_session_t *zn, uint8_t is_local, _z_subscription_sptr_t *sub) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
if (is_local == _Z_RESOURCE_IS_LOCAL) {
zn->_local_subscriptions =
@@ -209,20 +209,20 @@ void _z_unregister_subscription(_z_session_t *zn, uint8_t is_local, _z_subscript
_z_subscription_sptr_list_drop_filter(zn->_remote_subscriptions, _z_subscription_sptr_eq, sub);
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
void _z_flush_subscriptions(_z_session_t *zn) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_subscription_sptr_list_free(&zn->_local_subscriptions);
_z_subscription_sptr_list_free(&zn->_remote_subscriptions);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
diff --git a/src/session/tx.c b/src/session/tx.c
index ae3697b42..409f5d402 100644
--- a/src/session/tx.c
+++ b/src/session/tx.c
@@ -21,16 +21,16 @@ int8_t _z_send_n_msg(_z_session_t *zn, const _z_network_message_t *z_msg, z_reli
int8_t ret = _Z_RES_OK;
_Z_DEBUG(">> send network message\n");
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_UNICAST_TYPE) {
ret = _z_unicast_send_n_msg(zn, z_msg, reliability, cong_ctrl);
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_MULTICAST_TYPE) {
ret = _z_multicast_send_n_msg(zn, z_msg, reliability, cong_ctrl);
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
}
diff --git a/src/session/utils.c b/src/session/utils.c
index 215c2717f..494cb7a5d 100644
--- a/src/session/utils.c
+++ b/src/session/utils.c
@@ -66,21 +66,21 @@ int8_t _z_session_init(_z_session_t *zn, _z_id_t *zid) {
zn->_local_questionable = NULL;
zn->_pending_queries = NULL;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
ret = _z_mutex_init(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
if (ret == _Z_RES_OK) {
zn->_local_zid = *zid;
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_UNICAST_TYPE) {
zn->_tp._transport._unicast._session = zn;
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zn->_tp._type == _Z_TRANSPORT_MULTICAST_TYPE) {
zn->_tp._transport._multicast._session = zn;
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
// Do nothing. Required to be here because of the #if directive
}
@@ -103,9 +103,9 @@ void _z_session_clear(_z_session_t *zn) {
_z_flush_questionables(zn);
_z_flush_pending_queries(zn);
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_free(&zn->_mutex_inner);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
void _z_session_free(_z_session_t **zn) {
diff --git a/src/system/arduino/esp32/network.cpp b/src/system/arduino/esp32/network.cpp
index c85ea7d07..c02557fac 100644
--- a/src/system/arduino/esp32/network.cpp
+++ b/src/system/arduino/esp32/network.cpp
@@ -32,7 +32,7 @@ extern "C" {
#include "zenoh-pico/utils/logging.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
/*------------------ TCP sockets ------------------*/
int8_t _z_create_endpoint_tcp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
int8_t ret = _Z_RES_OK;
@@ -143,7 +143,7 @@ size_t _z_send_tcp(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t le
}
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
/*------------------ UDP sockets ------------------*/
int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
int8_t ret = _Z_RES_OK;
@@ -165,7 +165,7 @@ int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address,
void _z_free_endpoint_udp(_z_sys_net_endpoint_t *ep) { freeaddrinfo(ep->_iptcp); }
#endif
-#if Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1
int8_t _z_open_udp_unicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, uint32_t tout) {
int8_t ret = _Z_RES_OK;
@@ -238,7 +238,7 @@ size_t _z_send_udp_unicast(const _z_sys_net_socket_t sock, const uint8_t *ptr, s
}
#endif
-#if Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1
int8_t _z_open_udp_multicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, _z_sys_net_endpoint_t *lep,
uint32_t tout, const char *iface) {
int8_t ret = _Z_RES_OK;
@@ -544,7 +544,7 @@ size_t _z_send_udp_multicast(const _z_sys_net_socket_t sock, const uint8_t *ptr,
}
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
/*------------------ Bluetooth sockets ------------------*/
int8_t _z_open_bt(_z_sys_net_socket_t *sock, const char *gname, uint8_t mode, uint8_t profile, uint32_t tout) {
int8_t ret = _Z_RES_OK;
@@ -641,7 +641,7 @@ size_t _z_send_bt(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t len
}
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
/*------------------ Serial sockets ------------------*/
int8_t _z_open_serial_from_pins(_z_sys_net_socket_t *sock, uint32_t txpin, uint32_t rxpin, uint32_t baudrate) {
int8_t ret = _Z_RES_OK;
diff --git a/src/system/arduino/esp32/system.c b/src/system/arduino/esp32/system.c
index 1d823c14c..a9eab813c 100644
--- a/src/system/arduino/esp32/system.c
+++ b/src/system/arduino/esp32/system.c
@@ -44,7 +44,7 @@ void *z_realloc(void *ptr, size_t size) { return heap_caps_realloc(ptr, size, MA
void z_free(void *ptr) { heap_caps_free(ptr); }
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// This wrapper is only used for ESP32.
// In FreeRTOS, tasks created using xTaskCreate must end with vTaskDelete.
// A task function should __not__ simply return.
@@ -112,7 +112,7 @@ int8_t _z_condvar_free(_z_condvar_t *cv) { return pthread_cond_destroy(cv); }
int8_t _z_condvar_signal(_z_condvar_t *cv) { return pthread_cond_signal(cv); }
int8_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m) { return pthread_cond_wait(cv, m); }
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
/*------------------ Sleep ------------------*/
int z_sleep_us(size_t time) { return usleep(time); }
diff --git a/src/system/arduino/opencr/network.cpp b/src/system/arduino/opencr/network.cpp
index 1912d7cfb..bdbb9939a 100644
--- a/src/system/arduino/opencr/network.cpp
+++ b/src/system/arduino/opencr/network.cpp
@@ -26,7 +26,7 @@ extern "C" {
#include "zenoh-pico/utils/logging.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
/*------------------ UDP sockets ------------------*/
int8_t _z_create_endpoint_tcp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
@@ -118,7 +118,7 @@ size_t _z_send_tcp(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t le
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
/*------------------ UDP sockets ------------------*/
int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
@@ -147,7 +147,7 @@ int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address,
void _z_free_endpoint_udp(_z_sys_net_endpoint_t *ep) { delete ep->_iptcp._addr; }
#endif
-#if Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1
int8_t _z_open_udp_unicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, uint32_t tout) {
int8_t ret = _Z_RES_OK;
@@ -229,7 +229,7 @@ size_t _z_send_udp_unicast(const _z_sys_net_socket_t sock, const uint8_t *ptr, s
}
#endif
-#if Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1
int8_t _z_open_udp_multicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, _z_sys_net_endpoint_t *lep,
uint32_t tout, const char *iface) {
int8_t ret = _Z_RES_OK;
@@ -340,11 +340,11 @@ size_t _z_send_udp_multicast(const _z_sys_net_socket_t sock, const uint8_t *ptr,
}
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#error "Bluetooth not supported yet on OpenCR port of Zenoh-Pico"
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
#error "Serial not supported yet on OpenCR port of Zenoh-Pico"
#endif
}
diff --git a/src/system/arduino/opencr/system.c b/src/system/arduino/opencr/system.c
index 946392bb3..9ad314b5c 100644
--- a/src/system/arduino/opencr/system.c
+++ b/src/system/arduino/opencr/system.c
@@ -59,8 +59,8 @@ void z_free(void *ptr) {
return free(ptr);
}
-#if Z_MULTI_THREAD == 1
-#error "Multi-threading not supported yet on OpenCR port. Disable it by defining Z_MULTI_THREAD=0"
+#if Z_FEATURE_MULTI_THREAD == 1
+#error "Multi-threading not supported yet on OpenCR port. Disable it by defining Z_FEATURE_MULTI_THREAD=0"
/*------------------ Task ------------------*/
int8_t _z_task_init(_z_task_t *task, _z_task_attr_t *attr, void *(*fun)(void *), void *arg) { return -1; }
@@ -94,7 +94,7 @@ int8_t _z_condvar_free(_z_condvar_t *cv) { return -1; }
int8_t _z_condvar_signal(_z_condvar_t *cv) { return -1; }
int8_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m) { return -1; }
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
/*------------------ Sleep ------------------*/
int z_sleep_us(size_t time) {
diff --git a/src/system/emscripten/network.c b/src/system/emscripten/network.c
index 56a67714a..8b2f14caf 100644
--- a/src/system/emscripten/network.c
+++ b/src/system/emscripten/network.c
@@ -28,7 +28,7 @@
#include "zenoh-pico/utils/logging.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_WS == 1
+#if Z_FEATURE_LINK_WS == 1
#define WS_LINK_SLEEP 1
@@ -158,18 +158,18 @@ size_t _z_send_ws(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t len
#endif
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
#error "TCP not supported yet on Emscripten port of Zenoh-Pico"
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
#error "UDP not supported yet on Emscripten port of Zenoh-Pico"
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#error "Bluetooth not supported yet on Emscripten port of Zenoh-Pico"
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
#error "Serial not supported yet on Emscripten port of Zenoh-Pico"
#endif
diff --git a/src/system/emscripten/system.c b/src/system/emscripten/system.c
index 89242bd72..0654898b3 100644
--- a/src/system/emscripten/system.c
+++ b/src/system/emscripten/system.c
@@ -42,7 +42,7 @@ void *z_realloc(void *ptr, size_t size) { return realloc(ptr, size); }
void z_free(void *ptr) { free(ptr); }
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
/*------------------ Task ------------------*/
int8_t _z_task_init(_z_task_t *task, pthread_attr_t *attr, void *(*fun)(void *), void *arg) {
return pthread_create(task, attr, fun, arg);
@@ -77,7 +77,7 @@ int8_t _z_condvar_free(_z_condvar_t *cv) { return pthread_cond_destroy(cv); }
int8_t _z_condvar_signal(_z_condvar_t *cv) { return pthread_cond_signal(cv); }
int8_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m) { return pthread_cond_wait(cv, m); }
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
/*------------------ Sleep ------------------*/
int z_sleep_us(size_t time) {
diff --git a/src/system/espidf/network.c b/src/system/espidf/network.c
index 55b3e7036..9a49bf157 100644
--- a/src/system/espidf/network.c
+++ b/src/system/espidf/network.c
@@ -28,7 +28,7 @@
#include "zenoh-pico/utils/logging.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
/*------------------ TCP sockets ------------------*/
int8_t _z_create_endpoint_tcp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
int8_t ret = _Z_RES_OK;
@@ -139,7 +139,7 @@ size_t _z_send_tcp(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t le
}
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
/*------------------ UDP sockets ------------------*/
int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
int8_t ret = _Z_RES_OK;
@@ -161,7 +161,7 @@ int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address,
void _z_free_endpoint_udp(_z_sys_net_endpoint_t *ep) { freeaddrinfo(ep->_iptcp); }
#endif
-#if Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1
int8_t _z_open_udp_unicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, uint32_t tout) {
int8_t ret = _Z_RES_OK;
@@ -234,7 +234,7 @@ size_t _z_send_udp_unicast(const _z_sys_net_socket_t sock, const uint8_t *ptr, s
}
#endif
-#if Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1
int8_t _z_open_udp_multicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, _z_sys_net_endpoint_t *lep,
uint32_t tout, const char *iface) {
int8_t ret = _Z_RES_OK;
@@ -540,7 +540,7 @@ size_t _z_send_udp_multicast(const _z_sys_net_socket_t sock, const uint8_t *ptr,
}
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
/*------------------ Serial sockets ------------------*/
int8_t _z_open_serial_from_pins(_z_sys_net_socket_t *sock, uint32_t txpin, uint32_t rxpin, uint32_t baudrate) {
int8_t ret = _Z_RES_OK;
@@ -736,6 +736,6 @@ size_t _z_send_serial(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t
}
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#error "Bluetooth not supported yet on ESP-IDF port of Zenoh-Pico"
#endif
diff --git a/src/system/espidf/system.c b/src/system/espidf/system.c
index a3a4dd472..8a655cf0d 100644
--- a/src/system/espidf/system.c
+++ b/src/system/espidf/system.c
@@ -45,7 +45,7 @@ void *z_realloc(void *ptr, size_t size) { return heap_caps_realloc(ptr, size, MA
void z_free(void *ptr) { heap_caps_free(ptr); }
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// This wrapper is only used for ESP32.
// In FreeRTOS, tasks created using xTaskCreate must end with vTaskDelete.
// A task function should __not__ simply return.
@@ -113,7 +113,7 @@ int8_t _z_condvar_free(_z_condvar_t *cv) { return pthread_cond_destroy(cv); }
int8_t _z_condvar_signal(_z_condvar_t *cv) { return pthread_cond_signal(cv); }
int8_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m) { return pthread_cond_wait(cv, m); }
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
/*------------------ Sleep ------------------*/
int z_sleep_us(size_t time) { return usleep(time); }
diff --git a/src/system/mbed/network.cpp b/src/system/mbed/network.cpp
index 6653fceea..744b92df0 100644
--- a/src/system/mbed/network.cpp
+++ b/src/system/mbed/network.cpp
@@ -31,7 +31,7 @@ extern "C" {
#include "zenoh-pico/utils/logging.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
/*------------------ TCP sockets ------------------*/
int8_t _z_create_endpoint_tcp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
int8_t ret = _Z_RES_OK;
@@ -115,7 +115,7 @@ size_t _z_read_exact_tcp(const _z_sys_net_socket_t sock, uint8_t *ptr, size_t le
size_t _z_send_tcp(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t len) { return sock._tcp->send(ptr, len); }
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
/*------------------ UDP sockets ------------------*/
int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
int8_t ret = _Z_RES_OK;
@@ -134,7 +134,7 @@ int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address,
void _z_free_endpoint_udp(_z_sys_net_endpoint_t *ep) { delete ep->_iptcp; }
#endif
-#if Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1
int8_t _z_open_udp_unicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, uint32_t tout) {
int8_t ret = _Z_RES_OK;
(void)sock;
@@ -205,7 +205,7 @@ size_t _z_send_udp_unicast(const _z_sys_net_socket_t sock, const uint8_t *ptr, s
}
#endif
-#if Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1
int8_t _z_open_udp_multicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, _z_sys_net_endpoint_t *lep,
uint32_t tout, const char *iface) {
int8_t ret = _Z_RES_OK;
@@ -317,7 +317,7 @@ size_t _z_send_udp_multicast(const _z_sys_net_socket_t sock, const uint8_t *ptr,
}
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
int8_t _z_open_serial_from_pins(_z_sys_net_socket_t *sock, uint32_t txpin, uint32_t rxpin, uint32_t baudrate) {
int8_t ret = _Z_RES_OK;
@@ -479,7 +479,7 @@ size_t _z_send_serial(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t
}
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#error "Bluetooth not supported yet on MBED port of Zenoh-Pico"
#endif
diff --git a/src/system/mbed/system.cpp b/src/system/mbed/system.cpp
index 68dc20b01..2adeec297 100644
--- a/src/system/mbed/system.cpp
+++ b/src/system/mbed/system.cpp
@@ -39,7 +39,7 @@ void *z_realloc(void *ptr, size_t size) { return realloc(ptr, size); }
void z_free(void *ptr) { free(ptr); }
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
/*------------------ Task ------------------*/
int8_t _z_task_init(_z_task_t *task, _z_task_attr_t *attr, void *(*fun)(void *), void *arg) {
*task = new Thread();
@@ -106,7 +106,7 @@ int8_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m) {
((ConditionVariable *)*cv)->wait();
return 0;
}
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
/*------------------ Sleep ------------------*/
int z_sleep_us(size_t time) {
diff --git a/src/system/unix/network.c b/src/system/unix/network.c
index 917e9a4be..b7e899e23 100644
--- a/src/system/unix/network.c
+++ b/src/system/unix/network.c
@@ -31,7 +31,7 @@
#include "zenoh-pico/utils/logging.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
/*------------------ TCP sockets ------------------*/
int8_t _z_create_endpoint_tcp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
@@ -158,7 +158,7 @@ size_t _z_send_tcp(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t le
}
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
/*------------------ UDP sockets ------------------*/
int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
int8_t ret = _Z_RES_OK;
@@ -180,7 +180,7 @@ int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address,
void _z_free_endpoint_udp(_z_sys_net_endpoint_t *ep) { freeaddrinfo(ep->_iptcp); }
#endif
-#if Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1
int8_t _z_open_udp_unicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, uint32_t tout) {
int8_t ret = _Z_RES_OK;
@@ -253,7 +253,7 @@ size_t _z_send_udp_unicast(const _z_sys_net_socket_t sock, const uint8_t *ptr, s
}
#endif
-#if Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1
unsigned int __get_ip_from_iface(const char *iface, int sa_family, struct sockaddr **lsockaddr) {
unsigned int addrlen = 0U;
@@ -584,10 +584,10 @@ size_t _z_send_udp_multicast(const _z_sys_net_socket_t sock, const uint8_t *ptr,
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#error "Bluetooth not supported yet on Unix port of Zenoh-Pico"
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
#error "Serial not supported yet on Unix port of Zenoh-Pico"
#endif
diff --git a/src/system/unix/system.c b/src/system/unix/system.c
index e5dca90e9..875bc5f2b 100644
--- a/src/system/unix/system.c
+++ b/src/system/unix/system.c
@@ -98,7 +98,7 @@ void *z_realloc(void *ptr, size_t size) { return realloc(ptr, size); }
void z_free(void *ptr) { free(ptr); }
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
/*------------------ Task ------------------*/
int8_t _z_task_init(_z_task_t *task, _z_task_attr_t *attr, void *(*fun)(void *), void *arg) {
return pthread_create(task, attr, fun, arg);
@@ -133,7 +133,7 @@ int8_t _z_condvar_free(_z_condvar_t *cv) { return pthread_cond_destroy(cv); }
int8_t _z_condvar_signal(_z_condvar_t *cv) { return pthread_cond_signal(cv); }
int8_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m) { return pthread_cond_wait(cv, m); }
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
/*------------------ Sleep ------------------*/
int z_sleep_us(size_t time) { return usleep(time); }
diff --git a/src/system/windows/network.c b/src/system/windows/network.c
index 6ce0eb5ab..76d37027c 100644
--- a/src/system/windows/network.c
+++ b/src/system/windows/network.c
@@ -25,7 +25,7 @@
WSADATA wsaData;
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
/*------------------ TCP sockets ------------------*/
int8_t _z_create_endpoint_tcp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
@@ -161,7 +161,7 @@ size_t _z_send_tcp(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t le
}
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
/*------------------ UDP sockets ------------------*/
int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
int8_t ret = _Z_RES_OK;
@@ -190,7 +190,7 @@ void _z_free_endpoint_udp(_z_sys_net_endpoint_t *ep) {
}
#endif
-#if Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1
int8_t _z_open_udp_unicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, uint32_t tout) {
int8_t ret = _Z_RES_OK;
@@ -272,7 +272,7 @@ size_t _z_send_udp_unicast(const _z_sys_net_socket_t sock, const uint8_t *ptr, s
}
#endif
-#if Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1
unsigned int __get_ip_from_iface(const char *iface, int sa_family, SOCKADDR **lsockaddr) {
unsigned int addrlen = 0U;
@@ -603,10 +603,10 @@ size_t _z_send_udp_multicast(const _z_sys_net_socket_t sock, const uint8_t *ptr,
}
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#error "Bluetooth not supported yet on Windows port of Zenoh-Pico"
#endif
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
#error "Serial not supported yet on Windows port of Zenoh-Pico"
#endif
diff --git a/src/system/windows/system.c b/src/system/windows/system.c
index b813d6627..581b42291 100644
--- a/src/system/windows/system.c
+++ b/src/system/windows/system.c
@@ -58,7 +58,7 @@ void *z_realloc(void *ptr, size_t size) { return realloc(ptr, size); }
void z_free(void *ptr) { free(ptr); }
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
/*------------------ Task ------------------*/
int8_t _z_task_init(_z_task_t *task, _z_task_attr_t *attr, void *(*fun)(void *), void *arg) {
(void)(attr);
@@ -146,7 +146,7 @@ int8_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m) {
SleepConditionVariableSRW(cv, m, INFINITE, 0);
return ret;
}
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
/*------------------ Sleep ------------------*/
int z_sleep_us(size_t time) { return z_sleep_ms((time / 1000) + (time % 1000 == 0 ? 0 : 1)); }
diff --git a/src/system/zephyr/network.c b/src/system/zephyr/network.c
index 49978b49c..e07381914 100644
--- a/src/system/zephyr/network.c
+++ b/src/system/zephyr/network.c
@@ -34,7 +34,7 @@
#include "zenoh-pico/utils/logging.h"
#include "zenoh-pico/utils/pointers.h"
-#if Z_LINK_TCP == 1
+#if Z_FEATURE_LINK_TCP == 1
/*------------------ TCP sockets ------------------*/
int8_t _z_create_endpoint_tcp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
int8_t ret = _Z_RES_OK;
@@ -147,7 +147,7 @@ size_t _z_send_tcp(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t le
}
#endif
-#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
/*------------------ UDP sockets ------------------*/
int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address, const char *s_port) {
int8_t ret = _Z_RES_OK;
@@ -169,7 +169,7 @@ int8_t _z_create_endpoint_udp(_z_sys_net_endpoint_t *ep, const char *s_address,
void _z_free_endpoint_udp(_z_sys_net_endpoint_t *ep) { freeaddrinfo(ep->_iptcp); }
#endif
-#if Z_LINK_UDP_UNICAST == 1
+#if Z_FEATURE_LINK_UDP_UNICAST == 1
int8_t _z_open_udp_unicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, uint32_t tout) {
int8_t ret = _Z_RES_OK;
@@ -243,7 +243,7 @@ size_t _z_send_udp_unicast(const _z_sys_net_socket_t sock, const uint8_t *ptr, s
}
#endif
-#if Z_LINK_UDP_MULTICAST == 1
+#if Z_FEATURE_LINK_UDP_MULTICAST == 1
int8_t _z_open_udp_multicast(_z_sys_net_socket_t *sock, const _z_sys_net_endpoint_t rep, _z_sys_net_endpoint_t *lep,
uint32_t tout, const char *iface) {
int8_t ret = _Z_RES_OK;
@@ -550,9 +550,9 @@ size_t _z_send_udp_multicast(const _z_sys_net_socket_t sock, const uint8_t *ptr,
_z_sys_net_endpoint_t rep) {
return sendto(sock._fd, ptr, len, 0, rep._iptcp->ai_addr, rep._iptcp->ai_addrlen);
}
-#endif // Z_LINK_UDP_MULTICAST == 1
+#endif // Z_FEATURE_LINK_UDP_MULTICAST == 1
-#if Z_LINK_SERIAL == 1
+#if Z_FEATURE_LINK_SERIAL == 1
int8_t _z_open_serial_from_pins(_z_sys_net_socket_t *sock, uint32_t txpin, uint32_t rxpin, uint32_t baudrate) {
int8_t ret = _Z_RES_OK;
(void)(sock);
@@ -725,6 +725,6 @@ size_t _z_send_serial(const _z_sys_net_socket_t sock, const uint8_t *ptr, size_t
}
#endif
-#if Z_LINK_BLUETOOTH == 1
+#if Z_FEATURE_LINK_BLUETOOTH == 1
#error "Bluetooth not supported yet on Zephyr port of Zenoh-Pico"
#endif
diff --git a/src/system/zephyr/system.c b/src/system/zephyr/system.c
index 2670ae9cb..28ce1d303 100644
--- a/src/system/zephyr/system.c
+++ b/src/system/zephyr/system.c
@@ -55,7 +55,7 @@ void *z_realloc(void *ptr, size_t size) {
void z_free(void *ptr) { k_free(ptr); }
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
#define Z_THREADS_NUM 4
@@ -112,7 +112,7 @@ int8_t _z_condvar_free(_z_condvar_t *cv) { return pthread_cond_destroy(cv); }
int8_t _z_condvar_signal(_z_condvar_t *cv) { return pthread_cond_signal(cv); }
int8_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m) { return pthread_cond_wait(cv, m); }
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
/*------------------ Sleep ------------------*/
int z_sleep_us(size_t time) {
diff --git a/src/transport/common/join.c b/src/transport/common/join.c
index b896dac2e..5c9d6819b 100644
--- a/src/transport/common/join.c
+++ b/src/transport/common/join.c
@@ -17,12 +17,12 @@
int8_t _z_send_join(_z_transport_t *zt) {
int8_t ret = _Z_RES_OK;
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
// Join task only applies to multicast transports
if (zt->_type == _Z_TRANSPORT_MULTICAST_TYPE) {
ret = _zp_multicast_send_join(&zt->_transport._multicast);
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
(void)zt;
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
diff --git a/src/transport/common/lease.c b/src/transport/common/lease.c
index dcf2d908d..bf32a5884 100644
--- a/src/transport/common/lease.c
+++ b/src/transport/common/lease.c
@@ -18,16 +18,16 @@
int8_t _z_send_keep_alive(_z_transport_t *zt) {
int8_t ret = _Z_RES_OK;
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_UNICAST_TYPE) {
ret = _zp_unicast_send_keep_alive(&zt->_transport._unicast);
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_MULTICAST_TYPE) {
ret = _zp_multicast_send_keep_alive(&zt->_transport._multicast);
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
}
@@ -39,16 +39,16 @@ void *_zp_lease_task(void *zt_arg) {
void *ret = NULL;
_z_transport_t *zt = (_z_transport_t *)zt_arg;
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_UNICAST_TYPE) {
ret = _zp_unicast_lease_task(&zt->_transport._unicast);
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_MULTICAST_TYPE) {
ret = _zp_multicast_lease_task(&zt->_transport._multicast);
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = NULL;
}
diff --git a/src/transport/common/read.c b/src/transport/common/read.c
index bf0f20381..e1bcdcee8 100644
--- a/src/transport/common/read.c
+++ b/src/transport/common/read.c
@@ -19,16 +19,16 @@
int8_t _z_read(_z_transport_t *zt) {
int8_t ret = _Z_RES_OK;
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_UNICAST_TYPE) {
ret = _zp_unicast_read(&zt->_transport._unicast);
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_MULTICAST_TYPE) {
ret = _zp_multicast_read(&zt->_transport._multicast);
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
}
@@ -40,16 +40,16 @@ void *_zp_read_task(void *zt_arg) {
void *ret = NULL;
_z_transport_t *zt = (_z_transport_t *)zt_arg;
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_UNICAST_TYPE) {
ret = _zp_unicast_read_task(&zt->_transport._unicast);
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_MULTICAST_TYPE) {
ret = _zp_multicast_read_task(&zt->_transport._multicast);
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = NULL;
}
diff --git a/src/transport/common/tx.c b/src/transport/common/tx.c
index f3625250e..811cf7a2d 100644
--- a/src/transport/common/tx.c
+++ b/src/transport/common/tx.c
@@ -54,16 +54,16 @@ void __unsafe_z_finalize_wbuf(_z_wbuf_t *buf, _Bool is_streamed) {
int8_t _z_send_t_msg(_z_transport_t *zt, const _z_transport_message_t *t_msg) {
int8_t ret = _Z_RES_OK;
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_UNICAST_TYPE) {
ret = _z_unicast_send_t_msg(&zt->_transport._unicast, t_msg);
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_MULTICAST_TYPE) {
ret = _z_multicast_send_t_msg(&zt->_transport._multicast, t_msg);
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
}
@@ -71,7 +71,7 @@ int8_t _z_send_t_msg(_z_transport_t *zt, const _z_transport_message_t *t_msg) {
return ret;
}
-#if Z_UNICAST_TRANSPORT == 1 || Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1 || Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t _z_link_send_t_msg(const _z_link_t *zl, const _z_transport_message_t *t_msg) {
int8_t ret = _Z_RES_OK;
@@ -103,7 +103,7 @@ int8_t _z_link_send_t_msg(const _z_link_t *zl, const _z_transport_message_t *t_m
return ret;
}
-#endif // Z_UNICAST_TRANSPORT == 1 || Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1 || Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t __unsafe_z_serialize_zenoh_fragment(_z_wbuf_t *dst, _z_wbuf_t *src, z_reliability_t reliability, size_t sn) {
int8_t ret = _Z_RES_OK;
diff --git a/src/transport/manager.c b/src/transport/manager.c
index f365a399e..c7e868ed1 100644
--- a/src/transport/manager.c
+++ b/src/transport/manager.c
@@ -25,7 +25,7 @@ int8_t _z_new_transport_client(_z_transport_t *zt, char *locator, _z_id_t *local
ret = _z_open_link(&zl, locator);
if (ret == _Z_RES_OK) {
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (_Z_LINK_IS_MULTICAST(zl._capabilities) == false) {
_z_transport_unicast_establish_param_t tp_param;
ret = _z_transport_unicast_open_client(&tp_param, &zl, local_zid);
@@ -35,8 +35,8 @@ int8_t _z_new_transport_client(_z_transport_t *zt, char *locator, _z_id_t *local
_z_link_clear(&zl);
}
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (_Z_LINK_IS_MULTICAST(zl._capabilities) == true) {
_z_transport_multicast_establish_param_t tp_param;
ret = _z_transport_multicast_open_client(&tp_param, &zl, local_zid);
@@ -46,7 +46,7 @@ int8_t _z_new_transport_client(_z_transport_t *zt, char *locator, _z_id_t *local
_z_link_clear(&zl);
}
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
_z_link_clear(&zl);
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
@@ -64,7 +64,7 @@ int8_t _z_new_transport_peer(_z_transport_t *zt, char *locator, _z_id_t *local_z
ret = _z_listen_link(&zl, locator);
if (ret == _Z_RES_OK) {
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (_Z_LINK_IS_MULTICAST(zl._capabilities) == false) {
_z_transport_unicast_establish_param_t tp_param;
ret = _z_transport_unicast_open_peer(&tp_param, &zl, local_zid);
@@ -74,8 +74,8 @@ int8_t _z_new_transport_peer(_z_transport_t *zt, char *locator, _z_id_t *local_z
_z_link_clear(&zl);
}
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (_Z_LINK_IS_MULTICAST(zl._capabilities) == true) {
_z_transport_multicast_establish_param_t tp_param;
ret = _z_transport_multicast_open_peer(&tp_param, &zl, local_zid);
@@ -85,7 +85,7 @@ int8_t _z_new_transport_peer(_z_transport_t *zt, char *locator, _z_id_t *local_z
_z_link_clear(&zl);
}
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
_z_link_clear(&zl);
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
diff --git a/src/transport/multicast/link/rx.c b/src/transport/multicast/link/rx.c
index b5d50e030..cb585503c 100644
--- a/src/transport/multicast/link/rx.c
+++ b/src/transport/multicast/link/rx.c
@@ -27,7 +27,7 @@
#include "zenoh-pico/transport/utils.h"
#include "zenoh-pico/utils/logging.h"
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
_z_transport_peer_entry_t *_z_find_peer_entry(_z_transport_peer_entry_list_t *l, _z_bytes_t *remote_addr) {
_z_transport_peer_entry_t *ret = NULL;
@@ -52,10 +52,10 @@ int8_t _z_multicast_recv_t_msg_na(_z_transport_multicast_t *ztm, _z_transport_me
_Z_DEBUG(">> recv session msg\n");
int8_t ret = _Z_RES_OK;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Acquire the lock
_z_mutex_lock(&ztm->_mutex_rx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
size_t to_read = 0;
do {
@@ -96,9 +96,9 @@ int8_t _z_multicast_recv_t_msg_na(_z_transport_multicast_t *ztm, _z_transport_me
ret = _z_transport_message_decode(t_msg, &ztm->_zbuf);
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&ztm->_mutex_rx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return ret;
}
@@ -110,10 +110,10 @@ int8_t _z_multicast_recv_t_msg(_z_transport_multicast_t *ztm, _z_transport_messa
int8_t _z_multicast_handle_transport_message(_z_transport_multicast_t *ztm, _z_transport_message_t *t_msg,
_z_bytes_t *addr) {
int8_t ret = _Z_RES_OK;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Acquire and keep the lock
_z_mutex_lock(&ztm->_mutex_peer);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Mark the session that we have received data from this peer
_z_transport_peer_entry_t *entry = _z_find_peer_entry(ztm->_peers, addr);
@@ -254,7 +254,7 @@ int8_t _z_multicast_handle_transport_message(_z_transport_multicast_t *ztm, _z_t
_z_conduit_sn_list_copy(&entry->_sn_rx_sns, &t_msg->_body._join._next_sn);
_z_conduit_sn_list_decrement(entry->_sn_res, &entry->_sn_rx_sns);
-#if Z_DYNAMIC_MEMORY_ALLOCATION == 1
+#if Z_FEATURE_DYNAMIC_MEMORY_ALLOCATION == 1
entry->_dbuf_reliable = _z_wbuf_make(0, true);
entry->_dbuf_best_effort = _z_wbuf_make(0, true);
#else
@@ -313,11 +313,11 @@ int8_t _z_multicast_handle_transport_message(_z_transport_multicast_t *ztm, _z_t
}
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&ztm->_mutex_peer);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return ret;
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
diff --git a/src/transport/multicast/link/task/join.c b/src/transport/multicast/link/task/join.c
index 345ab689c..45ce08aaa 100644
--- a/src/transport/multicast/link/task/join.c
+++ b/src/transport/multicast/link/task/join.c
@@ -17,7 +17,7 @@
#include "zenoh-pico/session/utils.h"
#include "zenoh-pico/transport/link/tx.h"
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t _zp_multicast_send_join(_z_transport_multicast_t *ztm) {
_z_conduit_sn_list_t next_sn;
@@ -31,4 +31,4 @@ int8_t _zp_multicast_send_join(_z_transport_multicast_t *ztm) {
return _z_multicast_send_t_msg(ztm, &jsm);
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
diff --git a/src/transport/multicast/link/task/lease.c b/src/transport/multicast/link/task/lease.c
index c653d2dea..91a594c4b 100644
--- a/src/transport/multicast/link/task/lease.c
+++ b/src/transport/multicast/link/task/lease.c
@@ -22,7 +22,7 @@
#include "zenoh-pico/transport/link/tx.h"
#include "zenoh-pico/utils/logging.h"
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
_z_zint_t _z_get_minimum_lease(_z_transport_peer_entry_list_t *peers, _z_zint_t local_lease) {
_z_zint_t ret = local_lease;
@@ -68,7 +68,7 @@ int8_t _zp_multicast_send_keep_alive(_z_transport_multicast_t *ztm) {
}
void *_zp_multicast_lease_task(void *ztm_arg) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_transport_multicast_t *ztm = (_z_transport_multicast_t *)ztm_arg;
ztm->_transmitted = false;
@@ -158,9 +158,9 @@ void *_zp_multicast_lease_task(void *ztm_arg) {
_z_mutex_unlock(&ztm->_mutex_peer);
}
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return 0;
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
diff --git a/src/transport/multicast/link/task/read.c b/src/transport/multicast/link/task/read.c
index 2c4278426..606f2a8c1 100644
--- a/src/transport/multicast/link/task/read.c
+++ b/src/transport/multicast/link/task/read.c
@@ -22,7 +22,7 @@
#include "zenoh-pico/transport/link/rx.h"
#include "zenoh-pico/utils/logging.h"
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t _zp_multicast_read(_z_transport_multicast_t *ztm) {
int8_t ret = _Z_RES_OK;
@@ -39,7 +39,7 @@ int8_t _zp_multicast_read(_z_transport_multicast_t *ztm) {
}
void *_zp_multicast_read_task(void *ztm_arg) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_transport_multicast_t *ztm = (_z_transport_multicast_t *)ztm_arg;
// Acquire and keep the lock
@@ -113,9 +113,9 @@ void *_zp_multicast_read_task(void *ztm_arg) {
}
_z_mutex_unlock(&ztm->_mutex_rx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return NULL;
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
diff --git a/src/transport/multicast/link/tx.c b/src/transport/multicast/link/tx.c
index 991f878f3..81197bf12 100644
--- a/src/transport/multicast/link/tx.c
+++ b/src/transport/multicast/link/tx.c
@@ -20,7 +20,7 @@
#include "zenoh-pico/transport/utils.h"
#include "zenoh-pico/utils/logging.h"
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
/**
* This function is unsafe because it operates in potentially concurrent data.
@@ -43,10 +43,10 @@ int8_t _z_multicast_send_t_msg(_z_transport_multicast_t *ztm, const _z_transport
int8_t ret = _Z_RES_OK;
_Z_DEBUG(">> send session message\n");
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Acquire the lock
_z_mutex_lock(&ztm->_mutex_tx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Prepare the buffer eventually reserving space for the message length
__unsafe_z_prepare_wbuf(&ztm->_wbuf, _Z_LINK_IS_STREAMED(ztm->_link._capabilities));
@@ -63,9 +63,9 @@ int8_t _z_multicast_send_t_msg(_z_transport_multicast_t *ztm, const _z_transport
}
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&ztm->_mutex_tx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return ret;
}
@@ -80,18 +80,18 @@ int8_t _z_multicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_m
// Acquire the lock and drop the message if needed
_Bool drop = false;
if (cong_ctrl == Z_CONGESTION_CONTROL_BLOCK) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&ztm->_mutex_tx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
} else {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
int8_t locked = _z_mutex_trylock(&ztm->_mutex_tx);
if (locked != (int8_t)0) {
_Z_INFO("Dropping zenoh message because of congestion control\n");
// We failed to acquire the lock, drop the message
drop = true;
}
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
if (drop == false) {
@@ -145,12 +145,12 @@ int8_t _z_multicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_m
}
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&ztm->_mutex_tx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
return ret;
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
diff --git a/src/transport/transport.c b/src/transport/transport.c
index af71c2016..0019be34e 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -26,7 +26,7 @@
#include "zenoh-pico/transport/utils.h"
#include "zenoh-pico/utils/logging.h"
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
int8_t _z_unicast_send_close(_z_transport_unicast_t *ztu, uint8_t reason, _Bool link_only) {
int8_t ret = _Z_RES_OK;
@@ -37,9 +37,9 @@ int8_t _z_unicast_send_close(_z_transport_unicast_t *ztu, uint8_t reason, _Bool
return ret;
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t _z_multicast_send_close(_z_transport_multicast_t *ztm, uint8_t reason, _Bool link_only) {
int8_t ret = _Z_RES_OK;
@@ -50,21 +50,21 @@ int8_t _z_multicast_send_close(_z_transport_multicast_t *ztm, uint8_t reason, _B
return ret;
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t _z_send_close(_z_transport_t *zt, uint8_t reason, _Bool link_only) {
int8_t ret = _Z_RES_OK;
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_UNICAST_TYPE) {
ret = _z_unicast_send_close(&zt->_transport._unicast, reason, link_only);
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_MULTICAST_TYPE) {
ret = _z_multicast_send_close(&zt->_transport._multicast, reason, link_only);
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE;
}
@@ -72,13 +72,13 @@ int8_t _z_send_close(_z_transport_t *zt, uint8_t reason, _Bool link_only) {
return ret;
}
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
int8_t _z_transport_unicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_unicast_establish_param_t *param) {
int8_t ret = _Z_RES_OK;
zt->_type = _Z_TRANSPORT_UNICAST_TYPE;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Initialize the mutexes
ret = _z_mutex_init(&zt->_transport._unicast._mutex_tx);
if (ret == _Z_RES_OK) {
@@ -87,7 +87,7 @@ int8_t _z_transport_unicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_unic
_z_mutex_free(&zt->_transport._unicast._mutex_tx);
}
}
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Initialize the read and write buffers
if (ret == _Z_RES_OK) {
@@ -95,7 +95,7 @@ int8_t _z_transport_unicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_unic
_Bool expandable = _Z_LINK_IS_STREAMED(zl->_capabilities);
size_t dbuf_size = 0;
-#if Z_DYNAMIC_MEMORY_ALLOCATION == 0
+#if Z_FEATURE_DYNAMIC_MEMORY_ALLOCATION == 0
expandable = false;
dbuf_size = Z_FRAG_MAX_SIZE;
#endif
@@ -109,7 +109,7 @@ int8_t _z_transport_unicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_unic
// Clean up the buffers if one of them failed to be allocated
if ((_z_wbuf_capacity(&zt->_transport._unicast._wbuf) != mtu) ||
(_z_zbuf_capacity(&zt->_transport._unicast._zbuf) != Z_BATCH_UNICAST_SIZE) ||
-#if Z_DYNAMIC_MEMORY_ALLOCATION == 0
+#if Z_FEATURE_DYNAMIC_MEMORY_ALLOCATION == 0
(_z_wbuf_capacity(&zt->_transport._unicast._dbuf_reliable) != dbuf_size) ||
(_z_wbuf_capacity(&zt->_transport._unicast._dbuf_best_effort) != dbuf_size)) {
#else
@@ -118,10 +118,10 @@ int8_t _z_transport_unicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_unic
#endif
ret = _Z_ERR_SYSTEM_OUT_OF_MEMORY;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_free(&zt->_transport._unicast._mutex_tx);
_z_mutex_free(&zt->_transport._unicast._mutex_rx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_wbuf_clear(&zt->_transport._unicast._wbuf);
_z_zbuf_clear(&zt->_transport._unicast._zbuf);
@@ -143,13 +143,13 @@ int8_t _z_transport_unicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_unic
zt->_transport._unicast._sn_rx_reliable = initial_sn_rx;
zt->_transport._unicast._sn_rx_best_effort = initial_sn_rx;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Tasks
zt->_transport._unicast._read_task_running = false;
zt->_transport._unicast._read_task = NULL;
zt->_transport._unicast._lease_task_running = false;
zt->_transport._unicast._lease_task = NULL;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Notifiers
zt->_transport._unicast._received = 0;
@@ -169,15 +169,15 @@ int8_t _z_transport_unicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_unic
return ret;
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t _z_transport_multicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_multicast_establish_param_t *param) {
int8_t ret = _Z_RES_OK;
zt->_type = _Z_TRANSPORT_MULTICAST_TYPE;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Initialize the mutexes
ret = _z_mutex_init(&zt->_transport._multicast._mutex_tx);
if (ret == _Z_RES_OK) {
@@ -192,7 +192,7 @@ int8_t _z_transport_multicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_mu
_z_mutex_free(&zt->_transport._multicast._mutex_tx);
}
}
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Initialize the read and write buffers
if (ret == _Z_RES_OK) {
@@ -205,11 +205,11 @@ int8_t _z_transport_multicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_mu
(_z_zbuf_capacity(&zt->_transport._multicast._zbuf) != Z_BATCH_MULTICAST_SIZE)) {
ret = _Z_ERR_SYSTEM_OUT_OF_MEMORY;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_free(&zt->_transport._multicast._mutex_tx);
_z_mutex_free(&zt->_transport._multicast._mutex_rx);
_z_mutex_free(&zt->_transport._multicast._mutex_peer);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
_z_wbuf_clear(&zt->_transport._multicast._wbuf);
_z_zbuf_clear(&zt->_transport._multicast._zbuf);
@@ -227,13 +227,13 @@ int8_t _z_transport_multicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_mu
// Initialize peer list
zt->_transport._multicast._peers = _z_transport_peer_entry_list_new();
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Tasks
zt->_transport._multicast._read_task_running = false;
zt->_transport._multicast._read_task = NULL;
zt->_transport._multicast._lease_task_running = false;
zt->_transport._multicast._lease_task = NULL;
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
zt->_transport._multicast._lease = Z_TRANSPORT_LEASE;
@@ -246,9 +246,9 @@ int8_t _z_transport_multicast(_z_transport_t *zt, _z_link_t *zl, _z_transport_mu
return ret;
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
int8_t _z_transport_unicast_open_client(_z_transport_unicast_establish_param_t *param, const _z_link_t *zl,
const _z_id_t *local_zid) {
int8_t ret = _Z_RES_OK;
@@ -343,9 +343,9 @@ int8_t _z_transport_unicast_open_client(_z_transport_unicast_establish_param_t *
return ret;
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t _z_transport_multicast_open_client(_z_transport_multicast_establish_param_t *param, const _z_link_t *zl,
const _z_id_t *local_zid) {
(void)(param);
@@ -357,9 +357,9 @@ int8_t _z_transport_multicast_open_client(_z_transport_multicast_establish_param
return ret;
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
int8_t _z_transport_unicast_open_peer(_z_transport_unicast_establish_param_t *param, const _z_link_t *zl,
const _z_id_t *local_zid) {
(void)(param);
@@ -371,9 +371,9 @@ int8_t _z_transport_unicast_open_peer(_z_transport_unicast_establish_param_t *pa
return ret;
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t _z_transport_multicast_open_peer(_z_transport_multicast_establish_param_t *param, const _z_link_t *zl,
const _z_id_t *local_zid) {
int8_t ret = _Z_RES_OK;
@@ -402,25 +402,25 @@ int8_t _z_transport_multicast_open_peer(_z_transport_multicast_establish_param_t
return ret;
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
int8_t _z_transport_unicast_close(_z_transport_unicast_t *ztu, uint8_t reason) {
return _z_unicast_send_close(ztu, reason, false);
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t _z_transport_multicast_close(_z_transport_multicast_t *ztm, uint8_t reason) {
return _z_multicast_send_close(ztm, reason, false);
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
int8_t _z_transport_close(_z_transport_t *zt, uint8_t reason) { return _z_send_close(zt, reason, false); }
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
void _z_transport_unicast_clear(_z_transport_unicast_t *ztu) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Clean up tasks
if (ztu->_read_task != NULL) {
_z_task_join(ztu->_read_task);
@@ -434,7 +434,7 @@ void _z_transport_unicast_clear(_z_transport_unicast_t *ztu) {
// Clean up the mutexes
_z_mutex_free(&ztu->_mutex_tx);
_z_mutex_free(&ztu->_mutex_rx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Clean up the buffers
_z_wbuf_clear(&ztu->_wbuf);
@@ -446,11 +446,11 @@ void _z_transport_unicast_clear(_z_transport_unicast_t *ztu) {
ztu->_remote_zid = _z_id_empty();
_z_link_clear(&ztu->_link);
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
void _z_transport_multicast_clear(_z_transport_multicast_t *ztm) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Clean up tasks
if (ztm->_read_task != NULL) {
_z_task_join(ztm->_read_task);
@@ -465,7 +465,7 @@ void _z_transport_multicast_clear(_z_transport_multicast_t *ztm) {
_z_mutex_free(&ztm->_mutex_tx);
_z_mutex_free(&ztm->_mutex_rx);
_z_mutex_free(&ztm->_mutex_peer);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Clean up the buffers
_z_wbuf_clear(&ztm->_wbuf);
@@ -475,19 +475,19 @@ void _z_transport_multicast_clear(_z_transport_multicast_t *ztm) {
_z_transport_peer_entry_list_free(&ztm->_peers);
_z_link_clear(&ztm->_link);
}
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
void _z_transport_clear(_z_transport_t *zt) {
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_UNICAST_TYPE) {
_z_transport_unicast_clear(&zt->_transport._unicast);
} else
-#endif // Z_UNICAST_TRANSPORT == 1
-#if Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_MULTICAST_TRANSPORT == 1
if (zt->_type == _Z_TRANSPORT_MULTICAST_TYPE) {
_z_transport_multicast_clear(&zt->_transport._multicast);
} else
-#endif // Z_MULTICAST_TRANSPORT == 1
+#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1
{
__asm__("nop");
}
diff --git a/src/transport/unicast/link/rx.c b/src/transport/unicast/link/rx.c
index 6604e71ea..dfc580e4d 100644
--- a/src/transport/unicast/link/rx.c
+++ b/src/transport/unicast/link/rx.c
@@ -25,15 +25,15 @@
#include "zenoh-pico/transport/utils.h"
#include "zenoh-pico/utils/logging.h"
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
int8_t _z_unicast_recv_t_msg_na(_z_transport_unicast_t *ztu, _z_transport_message_t *t_msg) {
_Z_DEBUG(">> recv session msg\n");
int8_t ret = _Z_RES_OK;
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Acquire the lock
_z_mutex_lock(&ztu->_mutex_rx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
size_t to_read = 0;
do {
@@ -79,9 +79,9 @@ int8_t _z_unicast_recv_t_msg_na(_z_transport_unicast_t *ztu, _z_transport_messag
}
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&ztu->_mutex_rx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return ret;
}
@@ -197,4 +197,4 @@ int8_t _z_unicast_handle_transport_message(_z_transport_unicast_t *ztu, _z_trans
return _Z_RES_OK;
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
diff --git a/src/transport/unicast/link/task/lease.c b/src/transport/unicast/link/task/lease.c
index 5d9e0a2f2..02ff178db 100644
--- a/src/transport/unicast/link/task/lease.c
+++ b/src/transport/unicast/link/task/lease.c
@@ -17,7 +17,7 @@
#include "zenoh-pico/transport/link/tx.h"
#include "zenoh-pico/utils/logging.h"
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
int8_t _zp_unicast_send_keep_alive(_z_transport_unicast_t *ztu) {
int8_t ret = _Z_RES_OK;
@@ -29,7 +29,7 @@ int8_t _zp_unicast_send_keep_alive(_z_transport_unicast_t *ztu) {
}
void *_zp_unicast_lease_task(void *ztu_arg) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_transport_unicast_t *ztu = (_z_transport_unicast_t *)ztu_arg;
ztu->_received = false;
@@ -83,9 +83,9 @@ void *_zp_unicast_lease_task(void *ztu_arg) {
next_lease = next_lease - interval;
next_keep_alive = next_keep_alive - interval;
}
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return 0;
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
diff --git a/src/transport/unicast/link/task/read.c b/src/transport/unicast/link/task/read.c
index 31bc35609..bf27b1c70 100644
--- a/src/transport/unicast/link/task/read.c
+++ b/src/transport/unicast/link/task/read.c
@@ -21,7 +21,7 @@
#include "zenoh-pico/transport/link/rx.h"
#include "zenoh-pico/utils/logging.h"
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
int8_t _zp_unicast_read(_z_transport_unicast_t *ztu) {
int8_t ret = _Z_RES_OK;
@@ -37,7 +37,7 @@ int8_t _zp_unicast_read(_z_transport_unicast_t *ztu) {
}
void *_zp_unicast_read_task(void *ztu_arg) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_transport_unicast_t *ztu = (_z_transport_unicast_t *)ztu_arg;
// Acquire and keep the lock
@@ -107,9 +107,9 @@ void *_zp_unicast_read_task(void *ztu_arg) {
}
_z_mutex_unlock(&ztu->_mutex_rx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return NULL;
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1
diff --git a/src/transport/unicast/link/tx.c b/src/transport/unicast/link/tx.c
index 8f825b7e4..eb43c769d 100644
--- a/src/transport/unicast/link/tx.c
+++ b/src/transport/unicast/link/tx.c
@@ -23,7 +23,7 @@
#include "zenoh-pico/transport/utils.h"
#include "zenoh-pico/utils/logging.h"
-#if Z_UNICAST_TRANSPORT == 1
+#if Z_FEATURE_UNICAST_TRANSPORT == 1
/**
* This function is unsafe because it operates in potentially concurrent data.
@@ -46,10 +46,10 @@ int8_t _z_unicast_send_t_msg(_z_transport_unicast_t *ztu, const _z_transport_mes
int8_t ret = _Z_RES_OK;
_Z_DEBUG(">> send session message\n");
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
// Acquire the lock
_z_mutex_lock(&ztu->_mutex_tx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
// Prepare the buffer eventually reserving space for the message length
__unsafe_z_prepare_wbuf(&ztu->_wbuf, _Z_LINK_IS_STREAMED(ztu->_link._capabilities));
@@ -66,9 +66,9 @@ int8_t _z_unicast_send_t_msg(_z_transport_unicast_t *ztu, const _z_transport_mes
}
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&ztu->_mutex_tx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
return ret;
}
@@ -83,18 +83,18 @@ int8_t _z_unicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_msg
// Acquire the lock and drop the message if needed
_Bool drop = false;
if (cong_ctrl == Z_CONGESTION_CONTROL_BLOCK) {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&ztu->_mutex_tx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
} else {
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
int8_t locked = _z_mutex_trylock(&ztu->_mutex_tx);
if (locked != (int8_t)0) {
_Z_INFO("Dropping zenoh message because of congestion control\n");
// We failed to acquire the lock, drop the message
drop = true;
}
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
if (drop == false) {
@@ -154,12 +154,12 @@ int8_t _z_unicast_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_msg
}
}
-#if Z_MULTI_THREAD == 1
+#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_unlock(&ztu->_mutex_tx);
-#endif // Z_MULTI_THREAD == 1
+#endif // Z_FEATURE_MULTI_THREAD == 1
}
return ret;
}
-#endif // Z_UNICAST_TRANSPORT == 1
+#endif // Z_FEATURE_UNICAST_TRANSPORT == 1