Skip to main content

moq_origin_dynamic

Function moq_origin_dynamic 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn moq_origin_dynamic( origin: u32, prefix: *const c_char, prefix_len: usize, route: *const moq_route, on_request: moq_status_callback, user_data: *mut c_void, ) -> i32
Expand description

Advertise prefix and serve the requests beneath it.

A route claims prefix and every path beneath it (the empty prefix claims every path). A service that only serves some of them advertises the covering prefix and rejects the rest as they are requested. on_request is required: a NULL callback is refused before the route is advertised. It is invoked with a positive request handle for each pending broadcast, then exactly once more with a terminal code: 0 (stopped cleanly, including after moq_origin_dynamic_cancel) or a negative error. After the terminal (<= 0) callback, user_data is never touched again.

Returns a non-zero handle on success, or a negative code on failure.

ยงSafety

  • The caller must ensure that prefix is a valid pointer to prefix_len bytes of data.
  • route may be NULL, or must point at a readable moq_route.
  • on_request must be non-NULL; a missing callback is refused before the route is advertised.
  • The caller must keep user_data valid until the terminal (<= 0) on_request callback.