Type Definition libnghttp2_sys::nghttp2_unpack_extension_callback [−][src]
type nghttp2_unpack_extension_callback = Option<unsafe extern "C" fn(session: *mut nghttp2_session, payload: *mut *mut c_void, hd: *const nghttp2_frame_hd, user_data: *mut c_void) -> c_int>;
@functypedef
Callback function invoked when library asks the application to
unpack extension payload from its wire format. The extension
payload has been passed to the application using
:type:nghttp2_on_extension_chunk_recv_callback
. The frame header
is already unpacked by the library and provided as |hd|.
To receive extension frames, the application must tell desired
extension frame type to the library using
nghttp2_option_set_user_recv_extension_type()
.
The implementation of this function may store the pointer to the
created object as a result of unpacking in |*payload|, and returns
0. The pointer stored in |*payload| is opaque to the library, and
the library does not own its pointer. |*payload| is initialized as
NULL
. The |*payload| is available as frame->ext.payload
in
:type:nghttp2_on_frame_recv_callback
. Therefore if application
can free that memory inside :type:nghttp2_on_frame_recv_callback
callback. Of course, application has a liberty not ot use
|*payload|, and do its own mechanism to process extension frames.
To abort processing this extension frame, return
:enum:NGHTTP2_ERR_CANCEL
.
If fatal error occurred, application should return
:enum:NGHTTP2_ERR_CALLBACK_FAILURE
. In this case,
nghttp2_session_recv()
and nghttp2_session_mem_recv()
functions
immediately return :enum:NGHTTP2_ERR_CALLBACK_FAILURE
. If the
other values are returned, currently they are treated as
:enum:NGHTTP2_ERR_CALLBACK_FAILURE
.