Skip to main content

fdf_token_t

Type Alias fdf_token_t 

Source
pub type fdf_token_t = fdf_token;
Expand description

Tokens provide a mechanism for transferring FDF handles between drivers in the same process when a driver FIDL transport is not available. This is necessary as FDF handles cannot be transferred using the Zircon channel FIDL transport.

A token is represented as a Zircon channel pair.

§Example

// Child driver

void my_function() { zx_channel_t token_local, token_remote; zx_status_t status = zx_channel_create(0, &token_local, &token_remote); … // Transfer |token_remote| to parent driver, perhaps over FIDL. … fdf_handle_t channel_local, channel_remote; status = fdf_channel_create(0, &channel_local, &channel_remote); … zx_status_t status = fdf_token_transfer(token_local, channel_remote); // The FDF handle |channel_remote| can be received by the parent // driver who has the other side of the token. }

// Parent driver

void my_function() { zx_handle_t token; // Token received from child driver. … // Receive the driver handle for the token fdf_handle_t channel; zx_status_t status = fdf_token_receive(token, &channel); … }

Aliased Type§

#[repr(C)]
pub struct fdf_token_t { pub handler: Option<unsafe extern "C" fn(*mut fdf_dispatcher, *mut fdf_token, i32, u32)>, }

Fields§

§handler: Option<unsafe extern "C" fn(*mut fdf_dispatcher, *mut fdf_token, i32, u32)>