Skip to content

Commit

Permalink
fix: missing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Nov 28, 2023
1 parent 85af6b0 commit 788eb07
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/zenoh-pico/transport/raweth/transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

#include "zenoh-pico/api/types.h"

void _zp_raweth_fetch_zid(const _z_transport_t *zt, z_owned_closure_zid_t *callback);
void _zp_raweth_info_session(const _z_transport_t *zt, _z_config_t *ps);

int8_t _z_raweth_transport_create(_z_transport_t *zt, _z_link_t *zl, _z_transport_multicast_establish_param_t *param);
int8_t _z_raweth_open_peer(_z_transport_multicast_establish_param_t *param, const _z_link_t *zl,
const _z_id_t *local_zid);
Expand Down
24 changes: 24 additions & 0 deletions src/transport/raweth/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>

#include "zenoh-pico/transport/raweth/transport.h"

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Expand All @@ -28,6 +30,28 @@

#if Z_FEATURE_RAWETH_TRANSPORT == 1

void _zp_raweth_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_raweth_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);
}
}

int8_t _z_raweth_transport_create(_z_transport_t *zt, _z_link_t *zl, _z_transport_multicast_establish_param_t *param) {
int8_t ret = _Z_RES_OK;

Expand Down

0 comments on commit 788eb07

Please sign in to comment.