[][src]Type Definition libnghttp2_sys::nghttp2_pack_extension_callback

type nghttp2_pack_extension_callback = Option<unsafe extern "C" fn(session: *mut nghttp2_session, buf: *mut u8, len: usize, frame: *const nghttp2_frame, user_data: *mut c_void) -> isize>;

@functypedef

Callback function invoked when library asks the application to pack extension payload in its wire format. The frame header will be packed by library. Application must pack payload only. frame->ext.payload is the object passed to nghttp2_submit_extension() as payload parameter. Application must pack extension payload to the |buf| of its capacity |len| bytes. The |len| is at least 16KiB.

The implementation of this function should return the number of bytes written into |buf| when it succeeds.

To abort processing this extension frame, return :enum:NGHTTP2_ERR_CANCEL, and :type:nghttp2_on_frame_not_send_callback will be invoked.

If fatal error occurred, application should return :enum:NGHTTP2_ERR_CALLBACK_FAILURE. In this case, nghttp2_session_send() and nghttp2_session_mem_send() functions immediately return :enum:NGHTTP2_ERR_CALLBACK_FAILURE. If the other values are returned, currently they are treated as :enum:NGHTTP2_ERR_CALLBACK_FAILURE. If the return value is strictly larger than |len|, it is treated as :enum:NGHTTP2_ERR_CALLBACK_FAILURE.