2 * nghttp2 - HTTP/2 C Library
4 * Copyright (c) 2014 Tatsuhiro Tsujikawa
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef NGHTTP2_CALLBACKS_H
26 #define NGHTTP2_CALLBACKS_H
30 #endif /* HAVE_CONFIG_H */
32 #include <nghttp2/nghttp2.h>
37 struct nghttp2_session_callbacks {
39 * Callback function invoked when the session wants to send data to
40 * the remote peer. This callback is not necessary if the
41 * application uses solely `nghttp2_session_mem_send()` to serialize
44 nghttp2_send_callback send_callback;
46 * Callback function invoked when the session wants to receive data
47 * from the remote peer. This callback is not necessary if the
48 * application uses solely `nghttp2_session_mem_recv()` to process
51 nghttp2_recv_callback recv_callback;
53 * Callback function invoked by `nghttp2_session_recv()` when a
56 nghttp2_on_frame_recv_callback on_frame_recv_callback;
58 * Callback function invoked by `nghttp2_session_recv()` when an
59 * invalid non-DATA frame is received.
61 nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback;
63 * Callback function invoked when a chunk of data in DATA frame is
66 nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback;
68 * Callback function invoked before a non-DATA frame is sent.
70 nghttp2_before_frame_send_callback before_frame_send_callback;
72 * Callback function invoked after a frame is sent.
74 nghttp2_on_frame_send_callback on_frame_send_callback;
76 * The callback function invoked when a non-DATA frame is not sent
77 * because of an error.
79 nghttp2_on_frame_not_send_callback on_frame_not_send_callback;
81 * Callback function invoked when the stream is closed.
83 nghttp2_on_stream_close_callback on_stream_close_callback;
85 * Callback function invoked when the reception of header block in
86 * HEADERS or PUSH_PROMISE is started.
88 nghttp2_on_begin_headers_callback on_begin_headers_callback;
90 * Callback function invoked when a header name/value pair is
93 nghttp2_on_header_callback on_header_callback;
95 * Callback function invoked when the library asks application how
96 * many padding bytes are required for the transmission of the given
99 nghttp2_select_padding_callback select_padding_callback;
101 * The callback function used to determine the length allowed in
102 * `nghttp2_data_source_read_callback()`
104 nghttp2_data_source_read_length_callback read_length_callback;
106 * Sets callback function invoked when a frame header is received.
108 nghttp2_on_begin_frame_callback on_begin_frame_callback;
109 nghttp2_send_data_callback send_data_callback;
112 #endif /* NGHTTP2_CALLBACKS_H */