CallbackConnector

Undocumented in source.
class CallbackConnector : Connector {}

Members

Functions

maxFrameSize
int maxFrameSize(FrameType frame_type, int stream_id, int session_remote_window_size, int stream_remote_window_size, uint remote_max_frame_size)
Undocumented in source. Be warned that the author may not have intended to support it.
onDataChunk
bool onDataChunk(FrameFlags flags, int stream_id, ubyte[] data, bool pause)
Undocumented in source. Be warned that the author may not have intended to support it.
onFrame
bool onFrame(Frame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onFrameFailure
bool onFrameFailure(Frame frame, ErrorCode error_code)
Undocumented in source. Be warned that the author may not have intended to support it.
onFrameHeader
bool onFrameHeader(FrameHeader hd)
Undocumented in source. Be warned that the author may not have intended to support it.
onFrameReady
bool onFrameReady(Frame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onFrameSent
bool onFrameSent(Frame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onHeaderField
bool onHeaderField(Frame frame, HeaderField hf, bool pause, bool rst_stream)
Undocumented in source. Be warned that the author may not have intended to support it.
onHeaders
bool onHeaders(Frame frame)
Undocumented in source. Be warned that the author may not have intended to support it.
onInvalidFrame
bool onInvalidFrame(Frame frame, FrameError error_code, string reason)
Undocumented in source. Be warned that the author may not have intended to support it.
onStreamExit
bool onStreamExit(int stream_id, FrameError error_code)
Undocumented in source. Be warned that the author may not have intended to support it.
read
int read(ubyte[] data)
Undocumented in source. Be warned that the author may not have intended to support it.
selectPaddingLength
int selectPaddingLength(Frame frame, int max_payloadlen)
Undocumented in source. Be warned that the author may not have intended to support it.
write
int write(ubyte[] data)

////////////// Derived //////////////////

writeData
ErrorCode writeData(Frame frame, ubyte[] frame_hd, uint length)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

max_frame_size_cb
int delegate(FrameType, int, int, int, uint) max_frame_size_cb;

The callback function used to determine the length allowed in DataProvider

on_data_chunk_cb
bool delegate(FrameFlags, int, in ubyte[], ref bool) on_data_chunk_cb;

Callback function invoked when a chunk of data in DATA frame is received.

on_frame_cb
bool delegate(in Frame) on_frame_cb;

Callback function invoked by Session.recv when a frame is received.

on_frame_failure_cb
bool delegate(in Frame, ErrorCode) on_frame_failure_cb;

The callback function invoked when a non-DATA frame is not sent because of an error.

on_frame_header_cb
bool delegate(in FrameHeader) on_frame_header_cb;

Sets callback function invoked when a frame header is received.

on_frame_ready_cb
bool delegate(in Frame) on_frame_ready_cb;

Callback function invoked before a non-DATA frame is sent.

on_frame_sent_cb
bool delegate(in Frame) on_frame_sent_cb;

Callback function invoked after a frame is sent.

on_header_field_cb
bool delegate(in Frame, in HeaderField, ref bool, ref bool) on_header_field_cb;

Callback function invoked when a header name/value pair is received.

on_headers_cb
bool delegate(in Frame) on_headers_cb;

Callback function invoked when the reception of header block in HEADERS or PUSH_PROMISE is started.

on_invalid_frame_cb
bool delegate(in Frame, FrameError) on_invalid_frame_cb;

Callback function invoked by Session.recv when an invalid non-DATA frame is received.

on_stream_exit_cb
bool delegate(int, FrameError) on_stream_exit_cb;

Callback function invoked when the stream is closed.

read_cb
int delegate(ubyte[]) read_cb;

Callback function invoked when the session wants to receive data from the remote peer. This callback is not necessary if the application uses solely nghttp2_session_mem_recv() to process received data.

select_padding_length_cb
int delegate(in Frame, int) select_padding_length_cb;

Callback function invoked when the library asks application how many padding bytes are required for the transmission of the given frame.

write_cb
int delegate(in ubyte[]) write_cb;

Callback function invoked when the session wants to send data to the remote peer. This callback is not necessary if the application uses solely Session.memSend to serialize data to transmit.

write_data_cb
ErrorCode delegate(in Frame, ubyte[], uint) write_data_cb;

Callback function invoked when DataFlags.NO_COPY is used in DataProvider to avoid data copy.

Inherited Members

From Connector

write
int write(ubyte[] data)

Callback function invoked when Session wants to send data to the remote peer. The implementation of this function must send at most |data.length| bytes of data stored in |data|. It must return the number of bytes sent if it succeeds. If it cannot send any single byte without blocking, it must return ErrorCode.WOULDBLOCK. For other errors, it must return ErrorCode.CALLBACK_FAILURE.

writeData
ErrorCode writeData(Frame frame, ubyte[] frame_hd, uint length)

Callback function invoked when DataFlags.NO_COPY is used in DataProvider to send complete DATA frame.

read
int read(ubyte[] data)

Callback function invoked when Session wants to receive data from the remote peer. The implementation of this function must read at most |data.length| bytes of data and store it in |data|.

onStreamExit
bool onStreamExit(int stream_id, FrameError error_code)

Callback function invoked when the stream |stream_id| is closed. The reason of closure is indicated by the |error_code|. The |error_code| is usually one of FrameError, but that is not guaranteed.

onFrame
bool onFrame(Frame frame)

Callback function invoked by Session.recv when a frame is received. The |user_data| pointer is the third argument passed in to the call to http2_session_client_new() or http2_session_server_new().

onFrameHeader
bool onFrameHeader(FrameHeader hd)

Callback function invoked when a frame header is received. The |hd| points to received frame header.

onHeaders
bool onHeaders(Frame frame)

Callback function invoked when the reception of header block in HEADERS or PUSH_PROMISE is started. Each header header field will be emitted by Connector.onHeaderField`.

onHeaderField
bool onHeaderField(Frame frame, HeaderField hf, bool pause, bool rst_stream)

Callback function invoked when a header header field is received for the |frame|. The |hf.name| of length |hf.name.length| is header name. The |hf.value| of length |hf.value.length| is header value. The |hf.flags| is a HeaderFlag.

onDataChunk
bool onDataChunk(FrameFlags flags, int stream_id, ubyte[] data, bool pause)

Callback function invoked when a chunk of data in DATA frame is received. The |stream_id| is the stream this DATA frame belongs to. The |flags| is the flags of DATA frame which this data chunk is contained. `(flags & FrameFlags.END_STREAM) != 0` does not necessarily mean this chunk of data is the last one in the stream. You should use Connector.onFrame to determine that all data frames are received.

onInvalidFrame
bool onInvalidFrame(Frame frame, FrameError error_code, string reason)

Callback function invoked by Session.recv when an invalid non-DATA frame is received. The |error_code| indicates the error. It is usually one of the FrameError but that is not guaranteed. When this callback function is invoked, the library automatically submits either RST_STREAM or GOAWAY frame.

onFrameFailure
bool onFrameFailure(Frame frame, ErrorCode error_code)

Callback function invoked after the non-DATA frame |frame| is not sent because of the error. The error is indicated by the |error_code|, which is one of the values defined in ErrorCode.

onFrameReady
bool onFrameReady(Frame frame)

Callback function invoked just before the non-DATA frame |frame| is sent.

onFrameSent
bool onFrameSent(Frame frame)

Callback function invoked after the frame |frame| is sent.

selectPaddingLength
int selectPaddingLength(Frame frame, int max_payloadlen)

Callback function invoked when the library asks application how many padding bytes are required for the transmission of the |frame|. The application must choose the total length of payload including padded bytes in range [frame.hd.length, max_payloadlen], inclusive. Choosing number not in this range will be treated as ErrorCode.CALLBACK_FAILURE. Returning `frame.hd.length` means no padding is added. Returning ErrorCode.CALLBACK_FAILURE will make Session.send() function immediately return ErrorCode.CALLBACK_FAILURE.

maxFrameSize
int maxFrameSize(FrameType frame_type, int stream_id, int session_remote_window_size, int stream_remote_window_size, uint remote_max_frame_size)

Callback function invoked when library wants to get max length of data to send data to the remote peer. The implementation of this function should return a value in the following range. [1, min(|session_remote_window_size|, |stream_remote_window_size|, |remote_max_frame_size|)]. If a value greater than this range is returned than the max allow value will be used. Returning a value smaller than this range is treated as ErrorCode.CALLBACK_FAILURE. The |frame_type| is provided for future extensibility and identifies the type of frame (see FrameType) for which to get the length for. Currently supported frame types are: HTTP2_DATA.

Meta