diff --git a/include/zenoh-pico/transport/common/join.h b/include/zenoh-pico/transport/common/join.h deleted file mode 100644 index 8b8d5fc8b..000000000 --- a/include/zenoh-pico/transport/common/join.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) 2022 ZettaScale Technology -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License 2.0 which is available at -// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// -// Contributors: -// ZettaScale Zenoh Team, -// - -#ifndef ZENOH_PICO_TRANSPORT_JOIN_H -#define ZENOH_PICO_TRANSPORT_JOIN_H - -#include "zenoh-pico/transport/transport.h" - -int8_t _z_send_join(_z_transport_t *zt); - -#endif /* ZENOH_PICO_TRANSPORT_JOIN_H */ diff --git a/include/zenoh-pico/transport/common/lease.h b/include/zenoh-pico/transport/common/lease.h index f35ab2f09..8d85e7c17 100644 --- a/include/zenoh-pico/transport/common/lease.h +++ b/include/zenoh-pico/transport/common/lease.h @@ -17,7 +17,7 @@ #include "zenoh-pico/transport/transport.h" +int8_t _z_send_join(_z_transport_t *zt); int8_t _z_send_keep_alive(_z_transport_t *zt); -void *_zp_lease_task(void *zt_arg); // The argument is void* to avoid incompatible pointer types in tasks #endif /* ZENOH_PICO_TRANSPORT_LEASE_H */ diff --git a/include/zenoh-pico/transport/multicast/join.h b/include/zenoh-pico/transport/multicast/join.h deleted file mode 100644 index b7caaadd3..000000000 --- a/include/zenoh-pico/transport/multicast/join.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) 2022 ZettaScale Technology -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License 2.0 which is available at -// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// -// Contributors: -// ZettaScale Zenoh Team, -// - -#ifndef ZENOH_MULTICAST_JOIN_H -#define ZENOH_MULTICAST_JOIN_H - -#include "zenoh-pico/transport/transport.h" - -int8_t _zp_multicast_send_join(_z_transport_multicast_t *ztm); - -#endif /* ZENOH_MULTICAST_JOIN_H */ diff --git a/include/zenoh-pico/transport/multicast/lease.h b/include/zenoh-pico/transport/multicast/lease.h index aef7701ed..38c51e494 100644 --- a/include/zenoh-pico/transport/multicast/lease.h +++ b/include/zenoh-pico/transport/multicast/lease.h @@ -17,6 +17,7 @@ #include "zenoh-pico/transport/transport.h" +int8_t _zp_multicast_send_join(_z_transport_multicast_t *ztm); int8_t _zp_multicast_send_keep_alive(_z_transport_multicast_t *ztm); int8_t _zp_multicast_start_lease_task(_z_transport_t *zt, _z_task_attr_t *attr, _z_task_t *task); int8_t _zp_multicast_stop_lease_task(_z_transport_t *zt); diff --git a/include/zenoh-pico/transport/raweth/join.h b/include/zenoh-pico/transport/raweth/join.h deleted file mode 100644 index da8f875d9..000000000 --- a/include/zenoh-pico/transport/raweth/join.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) 2022 ZettaScale Technology -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License 2.0 which is available at -// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// -// Contributors: -// ZettaScale Zenoh Team, -// - -#ifndef ZENOH_RAWETH_JOIN_H -#define ZENOH_RAWETH_JOIN_H - -#include "zenoh-pico/transport/transport.h" - -int8_t _zp_raweth_send_join(_z_transport_multicast_t *ztm); - -#endif /* ZENOH_RAWETH_JOIN_H */ diff --git a/include/zenoh-pico/transport/raweth/lease.h b/include/zenoh-pico/transport/raweth/lease.h index 924fd38a0..3a60ee852 100644 --- a/include/zenoh-pico/transport/raweth/lease.h +++ b/include/zenoh-pico/transport/raweth/lease.h @@ -17,6 +17,7 @@ #include "zenoh-pico/transport/transport.h" +int8_t _zp_raweth_send_join(_z_transport_multicast_t *ztm); int8_t _zp_raweth_send_keep_alive(_z_transport_multicast_t *ztm); int8_t _zp_raweth_start_lease_task(_z_transport_t *zt, _z_task_attr_t *attr, _z_task_t *task); int8_t _zp_raweth_stop_lease_task(_z_transport_t *zt); diff --git a/src/net/session.c b/src/net/session.c index 97a322606..f5dcbc341 100644 --- a/src/net/session.c +++ b/src/net/session.c @@ -24,7 +24,6 @@ #include "zenoh-pico/net/memory.h" #include "zenoh-pico/protocol/core.h" #include "zenoh-pico/session/utils.h" -#include "zenoh-pico/transport/common/join.h" #include "zenoh-pico/transport/common/lease.h" #include "zenoh-pico/transport/common/read.h" #include "zenoh-pico/transport/multicast.h" diff --git a/src/transport/common/join.c b/src/transport/common/join.c deleted file mode 100644 index 72bfac0e0..000000000 --- a/src/transport/common/join.c +++ /dev/null @@ -1,36 +0,0 @@ -// -// Copyright (c) 2022 ZettaScale Technology -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License 2.0 which is available at -// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// -// Contributors: -// ZettaScale Zenoh Team, -// - -#include "zenoh-pico/transport/common/join.h" - -#include "zenoh-pico/transport/multicast/join.h" -#include "zenoh-pico/transport/raweth/join.h" - -int8_t _z_send_join(_z_transport_t *zt) { - int8_t ret = _Z_RES_OK; - // Join task only applies to multicast transports - switch (zt->_type) { - case _Z_TRANSPORT_MULTICAST_TYPE: - ret = _zp_multicast_send_join(&zt->_transport._multicast); - break; - case _Z_TRANSPORT_RAWETH_TYPE: - ret = _zp_raweth_send_join(&zt->_transport._raweth); - break; - default: - (void)zt; - ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE; - break; - } - return ret; -} diff --git a/src/transport/common/lease.c b/src/transport/common/lease.c index 5c2baa712..d37f56f14 100644 --- a/src/transport/common/lease.c +++ b/src/transport/common/lease.c @@ -39,21 +39,19 @@ int8_t _z_send_keep_alive(_z_transport_t *zt) { return ret; } -void *_zp_lease_task(void *zt_arg) { - void *ret = NULL; - _z_transport_t *zt = (_z_transport_t *)zt_arg; +int8_t _z_send_join(_z_transport_t *zt) { + int8_t ret = _Z_RES_OK; + // Join task only applies to multicast transports switch (zt->_type) { - case _Z_TRANSPORT_UNICAST_TYPE: - ret = _zp_unicast_lease_task(&zt->_transport._unicast); - break; case _Z_TRANSPORT_MULTICAST_TYPE: - ret = _zp_multicast_lease_task(&zt->_transport._multicast); + ret = _zp_multicast_send_join(&zt->_transport._multicast); break; case _Z_TRANSPORT_RAWETH_TYPE: - ret = _zp_raweth_lease_task(&zt->_transport._raweth); + ret = _zp_raweth_send_join(&zt->_transport._raweth); break; default: - ret = NULL; + (void)zt; + ret = _Z_ERR_TRANSPORT_NOT_AVAILABLE; break; } return ret; diff --git a/src/transport/multicast/join.c b/src/transport/multicast/join.c deleted file mode 100644 index d577db1da..000000000 --- a/src/transport/multicast/join.c +++ /dev/null @@ -1,38 +0,0 @@ -// -// Copyright (c) 2022 ZettaScale Technology -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License 2.0 which is available at -// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// -// Contributors: -// ZettaScale Zenoh Team, -// - -#include "zenoh-pico/transport/multicast/join.h" - -#include "zenoh-pico/session/utils.h" -#include "zenoh-pico/transport/multicast/tx.h" - -#if Z_FEATURE_MULTICAST_TRANSPORT == 1 - -int8_t _zp_multicast_send_join(_z_transport_multicast_t *ztm) { - _z_conduit_sn_list_t next_sn; - next_sn._is_qos = false; - next_sn._val._plain._best_effort = ztm->_sn_tx_best_effort; - next_sn._val._plain._reliable = ztm->_sn_tx_reliable; - - _z_id_t zid = ((_z_session_t *)ztm->_session)->_local_zid; - _z_transport_message_t jsm = _z_t_msg_make_join(Z_WHATAMI_PEER, Z_TRANSPORT_LEASE, zid, next_sn); - - return _z_multicast_send_t_msg(ztm, &jsm); -} -#else -int8_t _zp_multicast_send_join(_z_transport_multicast_t *ztm) { - _ZP_UNUSED(ztm); - return _Z_ERR_TRANSPORT_NOT_AVAILABLE; -} -#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1 diff --git a/src/transport/multicast/lease.c b/src/transport/multicast/lease.c index c30fe4c7a..c7192f130 100644 --- a/src/transport/multicast/lease.c +++ b/src/transport/multicast/lease.c @@ -18,8 +18,7 @@ #include "zenoh-pico/config.h" #include "zenoh-pico/session/utils.h" -#include "zenoh-pico/transport/common/join.h" -#include "zenoh-pico/transport/multicast/join.h" +#include "zenoh-pico/transport/common/lease.h" #include "zenoh-pico/transport/multicast/transport.h" #include "zenoh-pico/transport/multicast/tx.h" #include "zenoh-pico/utils/logging.h" @@ -60,6 +59,19 @@ static _z_zint_t _z_get_next_lease(_z_transport_peer_entry_list_t *peers) { return ret; } + +int8_t _zp_multicast_send_join(_z_transport_multicast_t *ztm) { + _z_conduit_sn_list_t next_sn; + next_sn._is_qos = false; + next_sn._val._plain._best_effort = ztm->_sn_tx_best_effort; + next_sn._val._plain._reliable = ztm->_sn_tx_reliable; + + _z_id_t zid = ((_z_session_t *)ztm->_session)->_local_zid; + _z_transport_message_t jsm = _z_t_msg_make_join(Z_WHATAMI_PEER, Z_TRANSPORT_LEASE, zid, next_sn); + + return _z_multicast_send_t_msg(ztm, &jsm); +} + int8_t _zp_multicast_send_keep_alive(_z_transport_multicast_t *ztm) { int8_t ret = _Z_RES_OK; @@ -184,6 +196,11 @@ void *_zp_multicast_lease_task(void *ztm_arg) { return 0; } #else +int8_t _zp_multicast_send_join(_z_transport_multicast_t *ztm) { + _ZP_UNUSED(ztm); + return _Z_ERR_TRANSPORT_NOT_AVAILABLE; +} + int8_t _zp_multicast_send_keep_alive(_z_transport_multicast_t *ztm) { _ZP_UNUSED(ztm); return _Z_ERR_TRANSPORT_NOT_AVAILABLE; diff --git a/src/transport/raweth/join.c b/src/transport/raweth/join.c deleted file mode 100644 index 7ac9e7506..000000000 --- a/src/transport/raweth/join.c +++ /dev/null @@ -1,38 +0,0 @@ -// -// Copyright (c) 2022 ZettaScale Technology -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License 2.0 which is available at -// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// -// Contributors: -// ZettaScale Zenoh Team, -// - -#include "zenoh-pico/transport/raweth/join.h" - -#include "zenoh-pico/session/utils.h" -#include "zenoh-pico/transport/raweth/tx.h" - -#if Z_FEATURE_RAWETH_TRANSPORT == 1 - -int8_t _zp_raweth_send_join(_z_transport_multicast_t *ztm) { - _z_conduit_sn_list_t next_sn; - next_sn._is_qos = false; - next_sn._val._plain._best_effort = ztm->_sn_tx_best_effort; - next_sn._val._plain._reliable = ztm->_sn_tx_reliable; - - _z_id_t zid = ((_z_session_t *)ztm->_session)->_local_zid; - _z_transport_message_t jsm = _z_t_msg_make_join(Z_WHATAMI_PEER, Z_TRANSPORT_LEASE, zid, next_sn); - - return _z_raweth_send_t_msg(ztm, &jsm); -} -#else -int8_t _zp_raweth_send_join(_z_transport_multicast_t *ztm) { - _ZP_UNUSED(ztm); - return _Z_ERR_TRANSPORT_NOT_AVAILABLE; -} -#endif // Z_FEATURE_RAWETH_TRANSPORT == 1 diff --git a/src/transport/raweth/lease.c b/src/transport/raweth/lease.c index 10fa08a8f..f3fc827c6 100644 --- a/src/transport/raweth/lease.c +++ b/src/transport/raweth/lease.c @@ -18,8 +18,7 @@ #include "zenoh-pico/config.h" #include "zenoh-pico/session/utils.h" -#include "zenoh-pico/transport/common/join.h" -#include "zenoh-pico/transport/raweth/join.h" +#include "zenoh-pico/transport/common/lease.h" #include "zenoh-pico/transport/raweth/transport.h" #include "zenoh-pico/transport/raweth/tx.h" #include "zenoh-pico/utils/logging.h" @@ -60,6 +59,18 @@ static _z_zint_t _z_get_next_lease(_z_transport_peer_entry_list_t *peers) { return ret; } +int8_t _zp_raweth_send_join(_z_transport_multicast_t *ztm) { + _z_conduit_sn_list_t next_sn; + next_sn._is_qos = false; + next_sn._val._plain._best_effort = ztm->_sn_tx_best_effort; + next_sn._val._plain._reliable = ztm->_sn_tx_reliable; + + _z_id_t zid = ((_z_session_t *)ztm->_session)->_local_zid; + _z_transport_message_t jsm = _z_t_msg_make_join(Z_WHATAMI_PEER, Z_TRANSPORT_LEASE, zid, next_sn); + + return _z_raweth_send_t_msg(ztm, &jsm); +} + int8_t _zp_raweth_send_keep_alive(_z_transport_multicast_t *ztm) { int8_t ret = _Z_RES_OK; @@ -184,6 +195,11 @@ void *_zp_raweth_lease_task(void *ztm_arg) { return 0; } #else +int8_t _zp_raweth_send_join(_z_transport_multicast_t *ztm) { + _ZP_UNUSED(ztm); + return _Z_ERR_TRANSPORT_NOT_AVAILABLE; +} + int8_t _zp_raweth_send_keep_alive(_z_transport_multicast_t *ztm) { _ZP_UNUSED(ztm); return _Z_ERR_TRANSPORT_NOT_AVAILABLE;