|
| void | nros_platform_network_poll (void) |
| int8_t | nros_platform_socket_accept (const void *sock_in, void *sock_out) |
| void | nros_platform_socket_close (void *sock) |
| int8_t | nros_platform_socket_set_non_blocking (const void *sock) |
| int8_t | nros_platform_socket_wait_event (void *peers, void *mutex) |
| void | nros_platform_tcp_close (void *sock) |
| int8_t | nros_platform_tcp_create_endpoint (void *ep, const uint8_t *address, const uint8_t *port) |
| void | nros_platform_tcp_free_endpoint (void *ep) |
| int8_t | nros_platform_tcp_listen (void *sock, const void *endpoint) |
| int8_t | nros_platform_tcp_open (void *sock, const void *endpoint, uint32_t timeout_ms) |
| size_t | nros_platform_tcp_read (const void *sock, uint8_t *buf, size_t len) |
| size_t | nros_platform_tcp_read_exact (const void *sock, uint8_t *buf, size_t len) |
| size_t | nros_platform_tcp_send (const void *sock, const uint8_t *buf, size_t len) |
| int8_t | nros_platform_tcp_set_rx_notify (const void *sock, void(*notify)(void *ctx), void *ctx) |
| void | nros_platform_udp_close (void *sock) |
| int8_t | nros_platform_udp_create_endpoint (void *ep, const uint8_t *address, const uint8_t *port) |
| void | nros_platform_udp_free_endpoint (void *ep) |
| int8_t | nros_platform_udp_listen (void *sock, const void *endpoint, uint32_t timeout_ms) |
| void | nros_platform_udp_mcast_close (void *sockrecv, void *socksend, const void *rep, const void *lep) |
| int8_t | nros_platform_udp_mcast_listen (void *sock, const void *endpoint, uint32_t timeout_ms, const uint8_t *iface, const uint8_t *join) |
| int8_t | nros_platform_udp_mcast_open (void *sock, const void *endpoint, void *lep, uint32_t timeout_ms, const uint8_t *iface) |
| size_t | nros_platform_udp_mcast_read (const void *sock, uint8_t *buf, size_t len, const void *lep, void *addr) |
| size_t | nros_platform_udp_mcast_read_exact (const void *sock, uint8_t *buf, size_t len, const void *lep, void *addr) |
| size_t | nros_platform_udp_mcast_send (const void *sock, const uint8_t *buf, size_t len, const void *endpoint) |
| int8_t | nros_platform_udp_open (void *sock, const void *endpoint, uint32_t timeout_ms) |
| size_t | nros_platform_udp_read (const void *sock, uint8_t *buf, size_t len) |
| size_t | nros_platform_udp_read_exact (const void *sock, uint8_t *buf, size_t len) |
| int32_t | nros_platform_udp_readiness_handle (const void *sock) |
| size_t | nros_platform_udp_send (const void *sock, const uint8_t *buf, size_t len, const void *endpoint) |
| void | nros_platform_udp_set_recv_timeout (const void *sock, uint32_t timeout_ms) |
| int8_t | nros_platform_udp_set_rx_notify (const void *sock, void(*notify)(void *ctx), void *ctx) |
Canonical C ABI for the nros platform networking surface.
Companion to <nros/platform.h>; sits beside the core 39-symbol platform ABI as the network interface zenoh-pico and the XRCE-DDS transports use. Carved into a separate header because bare-metal targets without a network stack can omit it.
Sockets + endpoints
Sockets and endpoints are opaque storage pointers. The application allocates the bytes (size known to the implementor; matches zenoh-pico's _z_sys_net_socket_t / _z_sys_net_endpoint_t). The implementation writes its handle into the supplied storage. read_* and send return (size_t) -1 on error, otherwise the number of bytes transferred (zero is a valid short-read result).
Timeout semantics
Read functions inherit the socket's recv timeout (set via set_recv_timeout). 0 ms means block indefinitely; non-zero is an upper bound on per-call duration.
Optional capabilities
nros_platform_udp_listen and udp_multicast_* are optional. A platform that doesn't implement them supplies a stub that returns -1 (or (size_t) -1 on the read/send variants); higher layers detect the failure and fall back. network_poll exists for platforms with a non-OS network stack (smoltcp on bare-metal) — POSIX / Zephyr / NuttX / FreeRTOS+lwIP / ThreadX+NetXDuo provide a no-op stub.
| int8_t nros_platform_tcp_set_rx_notify |
( |
const void * | sock, |
|
|
void(* | notify )(void *ctx), |
|
|
void * | ctx ) |
phase-521 W6 (RFC-0113 D4) — install (notify != NULL) or remove the receive notification on a connected TCP socket: the stack calls notify(ctx) each time data is queued on it, from the stack's own context (NetX's IP thread), so notify must only signal. Data already queued at install calls it once before this returns; once a removal returns, the previous notify is never called again. A zenoh session in CALLER mode over sock reports this as NROS_RMW_READINESS_NOTIFY.
Returns 0 when installed (or removed), -1 where the stack offers no such hook (every stack whose zenoh sessions read the link on their own thread needs none).
| int8_t nros_platform_udp_set_rx_notify |
( |
const void * | sock, |
|
|
void(* | notify )(void *ctx), |
|
|
void * | ctx ) |
phase-521 W4 (RFC-0113 D4) — install (notify != NULL) or remove the receive notification on sock: the stack calls notify(ctx) each time a datagram is queued on it, from the stack's own context (lwIP's tcpip thread, NetX's IP thread), so notify must only signal. Data already queued at install calls it once before this returns; once a removal returns, the previous notify is never called again. An RMW session over sock reports this as NROS_RMW_READINESS_NOTIFY.
Returns 0 when installed (or removed), -1 where the stack offers no such hook — POSIX/NuttX, which have nros_platform_udp_readiness_handle instead, and stacks not yet given one.