diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index a70ba4ae5..a50e81976 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -2261,6 +2261,24 @@ z_error_t z_publisher_put(const struct z_loaned_publisher_t *this_, * Constructs the default value for `z_publisher_put_options_t`. */ ZENOHC_API void z_publisher_put_options_default(struct z_publisher_put_options_t *this_); +/** + * Sets allowed destination for the publisher + */ +ZENOHC_API +void z_publisher_set_allowed_destination(struct z_loaned_publisher_t *publisher, + enum zcu_locality_t destination); +/** + * Sets congestion control for the publisher + */ +ZENOHC_API +void z_publisher_set_congestion_control(struct z_loaned_publisher_t *publisher, + enum z_congestion_control_t congestion_control); +/** + * Sets priority for the publisher + */ +ZENOHC_API +void z_publisher_set_priority(struct z_loaned_publisher_t *publisher, + enum z_priority_t priority); /** * Publishes data on specified key expression. * diff --git a/src/publisher.rs b/src/publisher.rs index 31cf73cb9..f324f5e33 100644 --- a/src/publisher.rs +++ b/src/publisher.rs @@ -270,12 +270,41 @@ pub extern "C" fn z_publisher_delete( /// Returns the key expression of the publisher. #[no_mangle] -#[allow(clippy::missing_safety_doc)] pub extern "C" fn z_publisher_keyexpr(publisher: &z_loaned_publisher_t) -> &z_loaned_keyexpr_t { let publisher = publisher.transmute_ref(); publisher.key_expr().transmute_handle() } +/// Sets congestion control for the publisher +#[no_mangle] +pub extern "C" fn z_publisher_set_congestion_control( + publisher: &mut z_loaned_publisher_t, + congestion_control: z_congestion_control_t, +) { + let publisher = publisher.transmute_mut(); + publisher.set_congestion_control(congestion_control.into()) +} + +/// Sets priority for the publisher +#[no_mangle] +pub extern "C" fn z_publisher_set_priority( + publisher: &mut z_loaned_publisher_t, + priority: z_priority_t, +) { + let publisher = publisher.transmute_mut(); + publisher.set_priority(priority.into()) +} + +/// Sets allowed destination for the publisher +#[no_mangle] +pub extern "C" fn z_publisher_set_allowed_destination( + publisher: &mut z_loaned_publisher_t, + destination: zcu_locality_t, +) { + let publisher = publisher.transmute_mut(); + publisher.set_allowed_destination(destination.into()) +} + pub use crate::opaque_types::zcu_owned_matching_listener_t; decl_transmute_owned!( Option>,