pub type nghttp2_recv_callback = Option<unsafe extern "C" fn(session: *mut nghttp2_session, buf: *mut u8, length: usize, flags: c_int, user_data: *mut c_void) -> isize>;
Expand description

@functypedef

Callback function invoked when |session| wants to receive data from the remote peer. The implementation of this function must read at most |length| bytes of data and store it in |buf|. The |flags| is currently not used and always 0. It must return the number of bytes written in |buf| if it succeeds. If it cannot read any single byte without blocking, it must return :enum:NGHTTP2_ERR_WOULDBLOCK. If it gets EOF before it reads any single byte, it must return :enum:NGHTTP2_ERR_EOF. For other errors, it must return :enum:NGHTTP2_ERR_CALLBACK_FAILURE. Returning 0 is treated as :enum:NGHTTP2_ERR_WOULDBLOCK. The |user_data| pointer is the third argument passed in to the call to nghttp2_session_client_new() or nghttp2_session_server_new().

This callback is required if the application uses nghttp2_session_recv() to receive data from the remote endpoint. If the application uses solely nghttp2_session_mem_recv() instead, this callback function is unnecessary.

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