-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: apply header changes to source files
- Loading branch information
1 parent
7bb8d16
commit da7c330
Showing
22 changed files
with
323 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,9 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "zenoh-pico/transport/link/tx.h" | ||
#include "zenoh-pico/transport/multicast/tx.h" | ||
|
||
#include "zenoh-pico/transport/unicast/tx.h" | ||
#include "zenoh-pico/utils/logging.h" | ||
|
||
int8_t _z_send_n_msg(_z_session_t *zn, const _z_network_message_t *z_msg, z_reliability_t reliability, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,9 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "zenoh-pico/transport/link/task/join.h" | ||
#include "zenoh-pico/transport/common/join.h" | ||
|
||
#include "zenoh-pico/transport/multicast/join.h" | ||
|
||
int8_t _z_send_join(_z_transport_t *zt) { | ||
int8_t ret = _Z_RES_OK; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,13 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "zenoh-pico/transport/link/task/lease.h" | ||
#include "zenoh-pico/transport/common/lease.h" | ||
|
||
#include <stddef.h> | ||
|
||
#include "zenoh-pico/transport/multicast/lease.h" | ||
#include "zenoh-pico/transport/unicast/lease.h" | ||
|
||
int8_t _z_send_keep_alive(_z_transport_t *zt) { | ||
int8_t ret = _Z_RES_OK; | ||
switch (zt->_type) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,13 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "zenoh-pico/transport/link/task/read.h" | ||
#include "zenoh-pico/transport/common/read.h" | ||
|
||
#include <stddef.h> | ||
|
||
#include "zenoh-pico/transport/multicast/read.h" | ||
#include "zenoh-pico/transport/unicast/read.h" | ||
|
||
int8_t _z_read(_z_transport_t *zt) { | ||
int8_t ret = _Z_RES_OK; | ||
switch (zt->_type) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,12 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "zenoh-pico/transport/link/rx.h" | ||
#include "zenoh-pico/transport/multicast/rx.h" | ||
|
||
#include <stddef.h> | ||
|
||
#include "zenoh-pico/protocol/codec/transport.h" | ||
#include "zenoh-pico/transport/unicast/rx.h" | ||
#include "zenoh-pico/utils/logging.h" | ||
|
||
/*------------------ Reception helper ------------------*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,13 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "zenoh-pico/transport/link/tx.h" | ||
#include "zenoh-pico/transport/multicast/tx.h" | ||
|
||
#include "zenoh-pico/api/constants.h" | ||
#include "zenoh-pico/protocol/codec/core.h" | ||
#include "zenoh-pico/protocol/codec/transport.h" | ||
#include "zenoh-pico/protocol/definitions/transport.h" | ||
#include "zenoh-pico/transport/unicast/tx.h" | ||
#include "zenoh-pico/utils/logging.h" | ||
|
||
/*------------------ Transmission helper ------------------*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// | ||
// 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, <[email protected]> | ||
|
||
#include "zenoh-pico/transport/multicast.h" | ||
|
||
#include <stdbool.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
#include "zenoh-pico/link/link.h" | ||
#include "zenoh-pico/transport/common/lease.h" | ||
#include "zenoh-pico/transport/common/read.h" | ||
#include "zenoh-pico/transport/common/tx.h" | ||
#include "zenoh-pico/transport/multicast/rx.h" | ||
#include "zenoh-pico/transport/multicast/tx.h" | ||
#include "zenoh-pico/transport/unicast/rx.h" | ||
#include "zenoh-pico/transport/utils.h" | ||
#include "zenoh-pico/utils/logging.h" | ||
|
||
#if Z_FEATURE_MULTICAST_TRANSPORT == 1 | ||
bool _zp_is_multicast_here(void) { return true; } | ||
|
||
void _zp_multicast_fetch_zid(const _z_transport_t *zt, z_owned_closure_zid_t *callback) { | ||
void *ctx = callback->context; | ||
_z_transport_peer_entry_list_t *l = zt->_transport._multicast._peers; | ||
for (; l != NULL; l = _z_transport_peer_entry_list_tail(l)) { | ||
_z_transport_peer_entry_t *val = _z_transport_peer_entry_list_head(l); | ||
z_id_t id = val->_remote_zid; | ||
|
||
callback->call(&id, ctx); | ||
} | ||
} | ||
|
||
void _zp_multicast_info_session(const _z_transport_t *zt, _z_config_t *ps) { | ||
_z_transport_peer_entry_list_t *xs = zt->_transport._multicast._peers; | ||
while (xs != NULL) { | ||
_z_transport_peer_entry_t *peer = _z_transport_peer_entry_list_head(xs); | ||
_z_bytes_t remote_zid = _z_bytes_wrap(peer->_remote_zid.id, _z_id_len(peer->_remote_zid)); | ||
_zp_config_insert(ps, Z_INFO_PEER_PID_KEY, _z_string_from_bytes(&remote_zid)); | ||
|
||
xs = _z_transport_peer_entry_list_tail(xs); | ||
} | ||
} | ||
|
||
#else | ||
bool _zp_is_multicast_here(void) { return false; } | ||
|
||
void _zp_multicast_fetch_zid(const _z_transport_t *zt, z_owned_closure_zid_t *callback) { | ||
_ZP_UNUSED(zt); | ||
_ZP_UNUSED(callback); | ||
} | ||
|
||
void _zp_multicast_info_session(const _z_transport_t *zt, _z_config_t *ps) { | ||
_ZP_UNUSED(zt); | ||
_ZP_UNUSED(ps); | ||
} | ||
#endif // Z_FEATURE_MULTICAST_TRANSPORT == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,10 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "zenoh-pico/transport/link/task/join.h" | ||
#include "zenoh-pico/transport/multicast/join.h" | ||
|
||
#include "zenoh-pico/session/utils.h" | ||
#include "zenoh-pico/transport/link/tx.h" | ||
#include "zenoh-pico/transport/multicast/tx.h" | ||
|
||
#if Z_FEATURE_MULTICAST_TRANSPORT == 1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,20 +12,21 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "zenoh-pico/transport/link/task/lease.h" | ||
#include "zenoh-pico/transport/multicast/lease.h" | ||
|
||
#include <stddef.h> | ||
|
||
#include "zenoh-pico/config.h" | ||
#include "zenoh-pico/session/utils.h" | ||
#include "zenoh-pico/transport/link/task/join.h" | ||
#include "zenoh-pico/transport/link/tx.h" | ||
#include "zenoh-pico/transport/multicast.h" | ||
#include "zenoh-pico/transport/common/join.h" | ||
#include "zenoh-pico/transport/multicast/join.h" | ||
#include "zenoh-pico/transport/multicast/transport.h" | ||
#include "zenoh-pico/transport/multicast/tx.h" | ||
#include "zenoh-pico/utils/logging.h" | ||
|
||
#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) { | ||
static _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; | ||
|
||
_z_transport_peer_entry_list_t *it = peers; | ||
|
@@ -42,7 +43,7 @@ _z_zint_t _z_get_minimum_lease(_z_transport_peer_entry_list_t *peers, _z_zint_t | |
return ret; | ||
} | ||
|
||
_z_zint_t _z_get_next_lease(_z_transport_peer_entry_list_t *peers) { | ||
static _z_zint_t _z_get_next_lease(_z_transport_peer_entry_list_t *peers) { | ||
_z_zint_t ret = SIZE_MAX; | ||
|
||
_z_transport_peer_entry_list_t *it = peers; | ||
|
@@ -68,6 +69,25 @@ int8_t _zp_multicast_send_keep_alive(_z_transport_multicast_t *ztm) { | |
return ret; | ||
} | ||
|
||
int _zp_multicast_start_lease_task(_z_transport_t *zt, _z_task_attr_t *attr, _z_task_t *task) { | ||
// Init memory | ||
(void)memset(task, 0, sizeof(_z_task_t)); | ||
// Attach task | ||
zt->_transport._multicast._lease_task = task; | ||
zt->_transport._multicast._lease_task_running = true; | ||
// Init task | ||
if (_z_task_init(task, attr, _zp_multicast_lease_task, &zt->_transport._multicast) != _Z_RES_OK) { | ||
zt->_transport._multicast._lease_task_running = false; | ||
return _Z_ERR_SYSTEM_TASK_FAILED; | ||
} | ||
return _Z_RES_OK; | ||
} | ||
|
||
int _zp_multicast_stop_lease_task(_z_transport_t *zt) { | ||
zt->_transport._multicast._lease_task_running = false; | ||
return _Z_RES_OK; | ||
} | ||
|
||
void *_zp_multicast_lease_task(void *ztm_arg) { | ||
#if Z_FEATURE_MULTI_THREAD == 1 | ||
_z_transport_multicast_t *ztm = (_z_transport_multicast_t *)ztm_arg; | ||
|
@@ -169,6 +189,18 @@ int8_t _zp_multicast_send_keep_alive(_z_transport_multicast_t *ztm) { | |
return _Z_ERR_TRANSPORT_NOT_AVAILABLE; | ||
} | ||
|
||
int _zp_multicast_start_lease_task(_z_transport_t *zt, _z_task_attr_t *attr, _z_task_t *task) { | ||
_ZP_UNUSED(zt); | ||
_ZP_UNUSED(attr); | ||
_ZP_UNUSED(task); | ||
return _Z_ERR_TRANSPORT_NOT_AVAILABLE; | ||
} | ||
|
||
int _zp_multicast_stop_lease_task(_z_transport_t *zt) { | ||
_ZP_UNUSED(zt); | ||
return _Z_ERR_TRANSPORT_NOT_AVAILABLE; | ||
} | ||
|
||
void *_zp_multicast_lease_task(void *ztm_arg) { | ||
_ZP_UNUSED(ztm_arg); | ||
return NULL; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,15 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "zenoh-pico/transport/link/task/read.h" | ||
#include "zenoh-pico/transport/multicast/read.h" | ||
|
||
#include <stddef.h> | ||
|
||
#include "zenoh-pico/config.h" | ||
#include "zenoh-pico/protocol/codec/transport.h" | ||
#include "zenoh-pico/protocol/iobuf.h" | ||
#include "zenoh-pico/transport/link/rx.h" | ||
#include "zenoh-pico/transport/multicast/rx.h" | ||
#include "zenoh-pico/transport/unicast/rx.h" | ||
#include "zenoh-pico/utils/logging.h" | ||
|
||
#if Z_FEATURE_MULTICAST_TRANSPORT == 1 | ||
|
@@ -38,6 +39,25 @@ int8_t _zp_multicast_read(_z_transport_multicast_t *ztm) { | |
return ret; | ||
} | ||
|
||
int _zp_multicast_start_read_task(_z_transport_t *zt, _z_task_attr_t *attr, _z_task_t *task) { | ||
// Init memory | ||
(void)memset(task, 0, sizeof(_z_task_t)); | ||
// Attach task | ||
zt->_transport._multicast._read_task = task; | ||
zt->_transport._multicast._read_task_running = true; | ||
// Init task | ||
if (_z_task_init(task, attr, _zp_multicast_read_task, &zt->_transport._multicast) != _Z_RES_OK) { | ||
zt->_transport._multicast._read_task_running = false; | ||
return _Z_ERR_SYSTEM_TASK_FAILED; | ||
} | ||
return _Z_RES_OK; | ||
} | ||
|
||
int _zp_multicast_stop_read_task(_z_transport_t *zt) { | ||
zt->_transport._multicast._read_task_running = false; | ||
return _Z_RES_OK; | ||
} | ||
|
||
void *_zp_multicast_read_task(void *ztm_arg) { | ||
#if Z_FEATURE_MULTI_THREAD == 1 | ||
_z_transport_multicast_t *ztm = (_z_transport_multicast_t *)ztm_arg; | ||
|
@@ -123,6 +143,18 @@ int8_t _zp_multicast_read(_z_transport_multicast_t *ztm) { | |
return _Z_ERR_TRANSPORT_NOT_AVAILABLE; | ||
} | ||
|
||
int _zp_multicast_start_read_task(_z_transport_t *zt, _z_task_attr_t *attr, _z_task_t *task) { | ||
_ZP_UNUSED(zt); | ||
_ZP_UNUSED(attr); | ||
_ZP_UNUSED(task); | ||
return _Z_ERR_TRANSPORT_NOT_AVAILABLE; | ||
} | ||
|
||
int _zp_multicast_stop_read_task(_z_transport_t *zt) { | ||
_ZP_UNUSED(zt); | ||
return _Z_ERR_TRANSPORT_NOT_AVAILABLE; | ||
} | ||
|
||
void *_zp_multicast_read_task(void *ztm_arg) { | ||
_ZP_UNUSED(ztm_arg); | ||
return NULL; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include "zenoh-pico/transport/link/rx.h" | ||
#include "zenoh-pico/transport/multicast/rx.h" | ||
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
Oops, something went wrong.