#[repr(C)]pub struct aws_channel_handler_vtable {
pub process_read_message: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler, slot: *mut aws_channel_slot, message: *mut aws_io_message) -> c_int>,
pub process_write_message: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler, slot: *mut aws_channel_slot, message: *mut aws_io_message) -> c_int>,
pub increment_read_window: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler, slot: *mut aws_channel_slot, size: usize) -> c_int>,
pub shutdown: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler, slot: *mut aws_channel_slot, dir: aws_channel_direction, error_code: c_int, free_scarce_resources_immediately: bool) -> c_int>,
pub initial_window_size: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler) -> usize>,
pub message_overhead: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler) -> usize>,
pub destroy: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler)>,
pub reset_statistics: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler)>,
pub gather_statistics: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler, stats_list: *mut aws_array_list)>,
pub trigger_read: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler)>,
}
Fields
process_read_message: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler, slot: *mut aws_channel_slot, message: *mut aws_io_message) -> c_int>
Called by the channel when a message is available for processing in the read direction. It is your responsibility to call aws_mem_release(message->allocator, message); on message when you are finished with it.
Also keep in mind that your slot’s internal window has been decremented. You’ll want to call aws_channel_slot_increment_read_window() at some point in the future if you want to keep receiving data.
process_write_message: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler, slot: *mut aws_channel_slot, message: *mut aws_io_message) -> c_int>
Called by the channel when a message is available for processing in the write direction. It is your responsibility to call aws_mem_release(message->allocator, message); on message when you are finished with it.
increment_read_window: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler, slot: *mut aws_channel_slot, size: usize) -> c_int>
Called by the channel when a downstream handler has issued a window increment. You’ll want to update your internal state and likely propagate a window increment message of your own by calling ‘aws_channel_slot_increment_read_window()’
shutdown: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler, slot: *mut aws_channel_slot, dir: aws_channel_direction, error_code: c_int, free_scarce_resources_immediately: bool) -> c_int>
The channel calls shutdown on all handlers twice, once to shut down reading, and once to shut down writing. Shutdown always begins with the left-most handler, and proceeds to the right with dir set to AWS_CHANNEL_DIR_READ. Then shutdown is called on handlers from right to left with dir set to AWS_CHANNEL_DIR_WRITE.
The shutdown process does not need to complete immediately and may rely on scheduled tasks. The handler must call aws_channel_slot_on_handler_shutdown_complete() when it is finished, which propagates shutdown to the next handler. If ‘free_scarce_resources_immediately’ is true, then resources vulnerable to denial-of-service attacks (such as sockets and file handles) must be closed immediately before the shutdown() call returns.
initial_window_size: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler) -> usize>
Called by the channel when the handler is added to a slot, to get the initial window size.
message_overhead: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler) -> usize>
Called by the channel anytime a handler is added or removed, provides a hint for downstream handlers to avoid message fragmentation due to message overhead.
destroy: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler)>
Clean up any resources and deallocate yourself. The shutdown process will already be completed before this function is called.
reset_statistics: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler)>
Directs the channel handler to reset all of the internal statistics it tracks about itself.
gather_statistics: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler, stats_list: *mut aws_array_list)>
Adds a pointer to the handler’s internal statistics (if they exist) to a list of statistics structures associated with the channel’s handler chain.
trigger_read: Option<unsafe extern "C" fn(handler: *mut aws_channel_handler)>
Trait Implementations
sourceimpl Clone for aws_channel_handler_vtable
impl Clone for aws_channel_handler_vtable
sourcefn clone(&self) -> aws_channel_handler_vtable
fn clone(&self) -> aws_channel_handler_vtable
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more