pub type nghttp2_on_data_chunk_recv_callback = Option<unsafe extern "C" fn(session: *mut nghttp2_session, flags: u8, stream_id: i32, data: *const u8, len: usize, user_data: *mut c_void) -> c_int>;
Expand description

@functypedef

Callback function invoked when a chunk of data in DATA frame is received. The |stream_id| is the stream ID this DATA frame belongs to. The |flags| is the flags of DATA frame which this data chunk is contained. (flags & NGHTTP2_FLAG_END_STREAM) != 0 does not necessarily mean this chunk of data is the last one in the stream. You should use :type:nghttp2_on_frame_recv_callback to know all data frames are received. The |user_data| pointer is the third argument passed in to the call to nghttp2_session_client_new() or nghttp2_session_server_new().

If the application uses nghttp2_session_mem_recv(), it can return :enum:NGHTTP2_ERR_PAUSE to make nghttp2_session_mem_recv() return without processing further input bytes. The memory by pointed by the |data| is retained until nghttp2_session_mem_recv() or nghttp2_session_recv() is called. The application must retain the input bytes which was used to produce the |data| parameter, because it may refer to the memory region included in the input bytes.

The implementation of this function must return 0 if it succeeds. If nonzero is returned, it is treated as fatal error, and nghttp2_session_recv() and nghttp2_session_mem_recv() functions immediately return :enum:NGHTTP2_ERR_CALLBACK_FAILURE.

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