pub type nghttp2_data_source_read_length_callback = Option<unsafe extern "C" fn(session: *mut nghttp2_session, frame_type: u8, stream_id: i32, session_remote_window_size: i32, stream_remote_window_size: i32, remote_max_frame_size: u32, user_data: *mut c_void) -> isize>;
Expand description

@functypedef

Callback function invoked when library wants to get max length of data to send data to the remote peer. The implementation of this function should return a value in the following range. [1, min(|session_remote_window_size|, |stream_remote_window_size|, |remote_max_frame_size|)]. If a value greater than this range is returned than the max allow value will be used. Returning a value smaller than this range is treated as :enum:NGHTTP2_ERR_CALLBACK_FAILURE. The |frame_type| is provided for future extensibility and identifies the type of frame (see :type:nghttp2_frame_type) for which to get the length for. Currently supported frame types are: :enum:NGHTTP2_DATA.

This callback can be used to control the length in bytes for which :type:nghttp2_data_source_read_callback is allowed to send to the remote endpoint. This callback is optional. Returning :enum:NGHTTP2_ERR_CALLBACK_FAILURE will signal the entire session failure.

To set this callback to :type:nghttp2_session_callbacks, use nghttp2_session_callbacks_set_data_source_read_length_callback().