nghttp2_on_frame_recv_callback

Type Alias nghttp2_on_frame_recv_callback 

Source
pub type nghttp2_on_frame_recv_callback = Option<unsafe extern "C" fn(session: *mut nghttp2_session, frame: *const nghttp2_frame, user_data: *mut c_void) -> c_int>;
Expand description

@functypedef

Callback function invoked by nghttp2_session_recv() and nghttp2_session_mem_recv2() when a frame is 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 frame is HEADERS or PUSH_PROMISE, the nva and nvlen member of their data structure are always NULL and 0 respectively. The header name/value pairs are emitted via :type:nghttp2_on_header_callback.

Only HEADERS and DATA frame can signal the end of incoming data. If frame->hd.flags & NGHTTP2_FLAG_END_STREAM is nonzero, the |frame| is the last frame from the remote peer in this stream.

This callback won’t be called for CONTINUATION frames. HEADERS/PUSH_PROMISE + CONTINUATIONs are treated as single frame.

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

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

Aliased Type§

pub enum nghttp2_on_frame_recv_callback {
    None,
    Some(unsafe extern "C" fn(*mut nghttp2_session, *const nghttp2_frame, *mut c_void) -> i32),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(*mut nghttp2_session, *const nghttp2_frame, *mut c_void) -> i32)

Some value of type T.