Skip to main content

NrosRmwVtable

Struct NrosRmwVtable 

Source
#[repr(C)]
pub struct NrosRmwVtable {
Show 36 fields pub open: unsafe extern "C" fn(locator: *const u8, mode: u8, domain_id: u32, node_name: *const u8, out: *mut NrosRmwSession) -> NrosRmwRet, pub close: unsafe extern "C" fn(session: *mut NrosRmwSession) -> NrosRmwRet, pub drive_io: unsafe extern "C" fn(session: *mut NrosRmwSession, timeout_ms: i32) -> NrosRmwRet, pub create_publisher: unsafe extern "C" fn(session: *mut NrosRmwSession, topic_name: *const u8, type_name: *const u8, type_hash: *const u8, domain_id: u32, qos: *const NrosRmwQos, out: *mut NrosRmwPublisher) -> NrosRmwRet, pub destroy_publisher: unsafe extern "C" fn(publisher: *mut NrosRmwPublisher), pub publish_raw: unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, data: *const u8, len: usize) -> NrosRmwRet, pub create_subscriber: unsafe extern "C" fn(session: *mut NrosRmwSession, topic_name: *const u8, type_name: *const u8, type_hash: *const u8, domain_id: u32, qos: *const NrosRmwQos, out: *mut NrosRmwSubscriber) -> NrosRmwRet, pub destroy_subscriber: unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber), pub try_recv_raw: unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, buf: *mut u8, buf_len: usize) -> i32, pub has_data: unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber) -> i32, pub create_service_server: unsafe extern "C" fn(session: *mut NrosRmwSession, service_name: *const u8, type_name: *const u8, type_hash: *const u8, domain_id: u32, qos: *const NrosRmwQos, out: *mut NrosRmwServiceServer) -> NrosRmwRet, pub destroy_service_server: unsafe extern "C" fn(server: *mut NrosRmwServiceServer), pub try_recv_request: unsafe extern "C" fn(server: *mut NrosRmwServiceServer, buf: *mut u8, buf_len: usize, seq_out: *mut i64) -> i32, pub has_request: unsafe extern "C" fn(server: *mut NrosRmwServiceServer) -> i32, pub send_reply: unsafe extern "C" fn(server: *mut NrosRmwServiceServer, seq: i64, data: *const u8, len: usize) -> NrosRmwRet, pub create_service_client: unsafe extern "C" fn(session: *mut NrosRmwSession, service_name: *const u8, type_name: *const u8, type_hash: *const u8, domain_id: u32, qos: *const NrosRmwQos, out: *mut NrosRmwServiceClient) -> NrosRmwRet, pub destroy_service_client: unsafe extern "C" fn(client: *mut NrosRmwServiceClient), pub call_raw: unsafe extern "C" fn(client: *mut NrosRmwServiceClient, request: *const u8, req_len: usize, reply_buf: *mut u8, reply_buf_len: usize) -> i32, pub send_request_raw: Option<unsafe extern "C" fn(client: *mut NrosRmwServiceClient, request: *const u8, req_len: usize) -> NrosRmwRet>, pub try_recv_reply_raw: Option<unsafe extern "C" fn(client: *mut NrosRmwServiceClient, reply_buf: *mut u8, reply_buf_len: usize) -> i32>, pub register_subscriber_event: unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, kind: NrosRmwEventKind, deadline_ms: u32, cb: NrosRmwEventCallback, user_context: *mut c_void) -> NrosRmwRet, pub register_publisher_event: unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, kind: NrosRmwEventKind, deadline_ms: u32, cb: NrosRmwEventCallback, user_context: *mut c_void) -> NrosRmwRet, pub assert_publisher_liveliness: unsafe extern "C" fn(publisher: *mut NrosRmwPublisher) -> NrosRmwRet, pub next_deadline_ms: Option<unsafe extern "C" fn(session: *const NrosRmwSession) -> i32>, pub set_wake_callback: Option<unsafe extern "C" fn(session: *mut NrosRmwSession, cb: Option<unsafe extern "C" fn(ctx: *mut c_void)>, ctx: *mut c_void) -> NrosRmwRet>, pub pub_loan: Option<unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, requested_len: usize, out_buf: *mut *mut u8, out_cap: *mut usize, out_token: *mut *mut c_void) -> NrosRmwRet>, pub pub_commit: Option<unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, token: *mut c_void, actual_len: usize) -> NrosRmwRet>, pub pub_discard: Option<unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, token: *mut c_void)>, pub sub_borrow: Option<unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, out_buf: *mut *const u8, out_len: *mut usize, out_token: *mut *mut c_void) -> i32>, pub sub_release: Option<unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, token: *mut c_void)>, pub service_server_available: Option<unsafe extern "C" fn(client: *mut NrosRmwServiceClient) -> i32>, pub try_recv_sequence: Option<unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, buf: *mut u8, per_msg_cap: usize, max_msgs: usize, out_lens: *mut usize) -> i32>, pub publish_streamed: Option<unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, size_cb: unsafe extern "C" fn(out_total_len: *mut usize, user_ctx: *mut c_void), chunk_cb: unsafe extern "C" fn(out_buf: *mut u8, cap: usize, out_written: *mut usize, user_ctx: *mut c_void), user_ctx: *mut c_void) -> NrosRmwRet>, pub ping_session: Option<unsafe extern "C" fn(session: *mut NrosRmwSession, timeout_ms: i32) -> NrosRmwRet>, pub subscriber_supports_in_place: Option<unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber) -> i32>, pub process_raw_in_place: Option<unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, ctx: *mut c_void, cb: unsafe extern "C" fn(ctx: *mut c_void, ptr: *const u8, len: usize)) -> i32>,
}
Expand description

C function table for an RMW backend.

Mirrors nros_rmw_vtable_t from <nros/rmw_vtable.h>. Phase 102.4 signatures: every entity entry point takes a typed-struct pointer instead of void *; every status-only return is nros_rmw_ret_t (typedef of i32); byte-count returns stay i32 (positive bytes, negative nros_rmw_ret_t).

Fields§

§open: unsafe extern "C" fn(locator: *const u8, mode: u8, domain_id: u32, node_name: *const u8, out: *mut NrosRmwSession) -> NrosRmwRet§close: unsafe extern "C" fn(session: *mut NrosRmwSession) -> NrosRmwRet§drive_io: unsafe extern "C" fn(session: *mut NrosRmwSession, timeout_ms: i32) -> NrosRmwRet§create_publisher: unsafe extern "C" fn(session: *mut NrosRmwSession, topic_name: *const u8, type_name: *const u8, type_hash: *const u8, domain_id: u32, qos: *const NrosRmwQos, out: *mut NrosRmwPublisher) -> NrosRmwRet§destroy_publisher: unsafe extern "C" fn(publisher: *mut NrosRmwPublisher)§publish_raw: unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, data: *const u8, len: usize) -> NrosRmwRet§create_subscriber: unsafe extern "C" fn(session: *mut NrosRmwSession, topic_name: *const u8, type_name: *const u8, type_hash: *const u8, domain_id: u32, qos: *const NrosRmwQos, out: *mut NrosRmwSubscriber) -> NrosRmwRet§destroy_subscriber: unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber)§try_recv_raw: unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, buf: *mut u8, buf_len: usize) -> i32§has_data: unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber) -> i32§create_service_server: unsafe extern "C" fn(session: *mut NrosRmwSession, service_name: *const u8, type_name: *const u8, type_hash: *const u8, domain_id: u32, qos: *const NrosRmwQos, out: *mut NrosRmwServiceServer) -> NrosRmwRet§destroy_service_server: unsafe extern "C" fn(server: *mut NrosRmwServiceServer)§try_recv_request: unsafe extern "C" fn(server: *mut NrosRmwServiceServer, buf: *mut u8, buf_len: usize, seq_out: *mut i64) -> i32§has_request: unsafe extern "C" fn(server: *mut NrosRmwServiceServer) -> i32§send_reply: unsafe extern "C" fn(server: *mut NrosRmwServiceServer, seq: i64, data: *const u8, len: usize) -> NrosRmwRet§create_service_client: unsafe extern "C" fn(session: *mut NrosRmwSession, service_name: *const u8, type_name: *const u8, type_hash: *const u8, domain_id: u32, qos: *const NrosRmwQos, out: *mut NrosRmwServiceClient) -> NrosRmwRet§destroy_service_client: unsafe extern "C" fn(client: *mut NrosRmwServiceClient)§call_raw: unsafe extern "C" fn(client: *mut NrosRmwServiceClient, request: *const u8, req_len: usize, reply_buf: *mut u8, reply_buf_len: usize) -> i32§send_request_raw: Option<unsafe extern "C" fn(client: *mut NrosRmwServiceClient, request: *const u8, req_len: usize) -> NrosRmwRet>§try_recv_reply_raw: Option<unsafe extern "C" fn(client: *mut NrosRmwServiceClient, reply_buf: *mut u8, reply_buf_len: usize) -> i32>§register_subscriber_event: unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, kind: NrosRmwEventKind, deadline_ms: u32, cb: NrosRmwEventCallback, user_context: *mut c_void) -> NrosRmwRet§register_publisher_event: unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, kind: NrosRmwEventKind, deadline_ms: u32, cb: NrosRmwEventCallback, user_context: *mut c_void) -> NrosRmwRet§assert_publisher_liveliness: unsafe extern "C" fn(publisher: *mut NrosRmwPublisher) -> NrosRmwRet§next_deadline_ms: Option<unsafe extern "C" fn(session: *const NrosRmwSession) -> i32>

Returns next deadline in ms (≥ 0) or a negative value for “no deadline”. NULL function pointer = treat as no deadline.

§set_wake_callback: Option<unsafe extern "C" fn(session: *mut NrosRmwSession, cb: Option<unsafe extern "C" fn(ctx: *mut c_void)>, ctx: *mut c_void) -> NrosRmwRet>

Phase 124.B.1 — executor wake callback. Backend stores (cb, ctx) and invokes cb(ctx) on async wake. The runtime-supplied cb does flag-write + condvar-signal atomically, giving sub-poll-period wake latency for spin loops blocked on the executor’s wake condvar.

NULL fn pointer = backend has no async wake path (poll-only: XRCE, bare-metal). The runtime still drains the session on its deadline-bound cv-wait boundary.

§pub_loan: Option<unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, requested_len: usize, out_buf: *mut *mut u8, out_cap: *mut usize, out_token: *mut *mut c_void) -> NrosRmwRet>

Reserve a writable slot of at least requested_len bytes in the backend’s outbound buffer. NULL = arena fallback. See the C header for the full semantics + lifetime contract.

§pub_commit: Option<unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, token: *mut c_void, actual_len: usize) -> NrosRmwRet>

Commit a previously loaned slot. NULL = paired with NULL pub_loan.

§pub_discard: Option<unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, token: *mut c_void)>

Abandon a previously loaned slot. NULL = paired with NULL pub_loan.

§sub_borrow: Option<unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, out_buf: *mut *const u8, out_len: *mut usize, out_token: *mut *mut c_void) -> i32>

Borrow the next message in place. Returns length (≥ 0) or a negative error code. NULL = staging-buffer fallback via try_recv_raw.

§sub_release: Option<unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, token: *mut c_void)>

Release a previously borrowed view. NULL = paired with NULL sub_borrow.

§service_server_available: Option<unsafe extern "C" fn(client: *mut NrosRmwServiceClient) -> i32>

Returns 1 if ≥ 1 matching server has been discovered on the RMW graph, 0 if none yet, or a negative NrosRmwRet constant on backend error. Clients use this to gate the first call_raw so a startup-ordering race doesn’t surface as a request-side timeout.

NULL fn pointer = backend cannot answer; the runtime maps the missing slot to NROS_RMW_RET_UNSUPPORTED.

§try_recv_sequence: Option<unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, buf: *mut u8, per_msg_cap: usize, max_msgs: usize, out_lens: *mut usize) -> i32>

Drains up to max_msgs queued messages into a contiguous caller buffer in a single backend call. The i-th delivered message lives at buf + i * per_msg_cap and has length out_lens[i]. Returns the message count (≥ 0) or a negative NrosRmwRet error code; partial drains MUST report the count, never error out.

NULL fn pointer = backend doesn’t batch; the runtime falls back to a try_recv_raw loop in CffiSubscriber::try_recv_sequence so user code can commit to the batched API regardless of backend support.

§publish_streamed: Option<unsafe extern "C" fn(publisher: *mut NrosRmwPublisher, size_cb: unsafe extern "C" fn(out_total_len: *mut usize, user_ctx: *mut c_void), chunk_cb: unsafe extern "C" fn(out_buf: *mut u8, cap: usize, out_written: *mut usize, user_ctx: *mut c_void), user_ctx: *mut c_void) -> NrosRmwRet>

Caller hands the backend two callbacks. The backend invokes size_cb once to learn the total payload length, then chunk_cb repeatedly to fill the slot in chunks. Lets big messages skip a per-publisher staging buffer on RAM- constrained nodes.

NULL fn pointer = backend doesn’t stream; the runtime falls back to a stack staging buffer (capped at the configured NROS_MAX_STREAM_CHUNK) + publish_raw so user code can commit to the streamed API regardless of backend support.

§ping_session: Option<unsafe extern "C" fn(session: *mut NrosRmwSession, timeout_ms: i32) -> NrosRmwRet>

Wire-level round-trip “is the peer / agent / router still reachable?” probe. Cheaper than the service-availability probe — no discovery state required.

Returns NROS_RMW_RET_OK on reply within timeout_ms, NROS_RMW_RET_TIMEOUT on no reply, or NROS_RMW_RET_UNSUPPORTED when the backend can’t probe. NULL slot = runtime surfaces Unsupported to the caller.

§subscriber_supports_in_place: Option<unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber) -> i32>

Capability query: does this subscriber support process_raw_in_place? Returns 1 if yes, 0 if no. The executor consults this at registration to pick the in-place arena dispatch over the buffered one. NULL slot = treated as unsupported.

§process_raw_in_place: Option<unsafe extern "C" fn(subscriber: *mut NrosRmwSubscriber, ctx: *mut c_void, cb: unsafe extern "C" fn(ctx: *mut c_void, ptr: *const u8, len: usize)) -> i32>

Borrow one ready message in place and hand its raw CDR bytes to cb (along with the opaque ctx) for the duration of the call, then release the slot — no copy into a caller buffer. Returns 1 if a message was processed (cb invoked), NROS_RMW_RET_NO_DATA if none was ready, or a negative error. cb MUST NOT re-enter this subscriber’s receive. NULL slot = unsupported (the runtime uses the buffered path).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.