• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * nghttp2 - HTTP/2 C Library
3  *
4  * Copyright (c) 2014 Tatsuhiro Tsujikawa
5  *
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:
13  *
14  * The above copyright notice and this permission notice shall be
15  * included in all copies or substantial portions of the Software.
16  *
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.
24  */
25 #ifndef NGHTTP2_CALLBACKS_H
26 #define NGHTTP2_CALLBACKS_H
27 
28 #ifdef HAVE_CONFIG_H
29 #  include <config.h>
30 #endif /* HAVE_CONFIG_H */
31 
32 #include <nghttp2/nghttp2.h>
33 
34 /*
35  * Callback functions.
36  */
37 struct nghttp2_session_callbacks {
38   /**
39    * Deprecated.  Use send_callback2 instead.  Callback function
40    * invoked when the session wants to send data to the remote peer.
41    * This callback is not necessary if the application uses solely
42    * `nghttp2_session_mem_send()` to serialize data to transmit.
43    */
44   nghttp2_send_callback send_callback;
45   /**
46    * Callback function invoked when the session wants to send data to
47    * the remote peer.  This callback is not necessary if the
48    * application uses solely `nghttp2_session_mem_send2()` to
49    * serialize data to transmit.
50    */
51   nghttp2_send_callback2 send_callback2;
52   /**
53    * Deprecated.  Use recv_callback2 instead.  Callback function
54    * invoked when the session wants to receive data from the remote
55    * peer.  This callback is not necessary if the application uses
56    * solely `nghttp2_session_mem_recv()` to process received data.
57    */
58   nghttp2_recv_callback recv_callback;
59   /**
60    * Callback function invoked when the session wants to receive data
61    * from the remote peer.  This callback is not necessary if the
62    * application uses solely `nghttp2_session_mem_recv2()` to process
63    * received data.
64    */
65   nghttp2_recv_callback2 recv_callback2;
66   /**
67    * Callback function invoked by `nghttp2_session_recv()` when a
68    * frame is received.
69    */
70   nghttp2_on_frame_recv_callback on_frame_recv_callback;
71   /**
72    * Callback function invoked by `nghttp2_session_recv()` when an
73    * invalid non-DATA frame is received.
74    */
75   nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback;
76   /**
77    * Callback function invoked when a chunk of data in DATA frame is
78    * received.
79    */
80   nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback;
81   /**
82    * Callback function invoked before a non-DATA frame is sent.
83    */
84   nghttp2_before_frame_send_callback before_frame_send_callback;
85   /**
86    * Callback function invoked after a frame is sent.
87    */
88   nghttp2_on_frame_send_callback on_frame_send_callback;
89   /**
90    * The callback function invoked when a non-DATA frame is not sent
91    * because of an error.
92    */
93   nghttp2_on_frame_not_send_callback on_frame_not_send_callback;
94   /**
95    * Callback function invoked when the stream is closed.
96    */
97   nghttp2_on_stream_close_callback on_stream_close_callback;
98   /**
99    * Callback function invoked when the reception of header block in
100    * HEADERS or PUSH_PROMISE is started.
101    */
102   nghttp2_on_begin_headers_callback on_begin_headers_callback;
103   /**
104    * Callback function invoked when a header name/value pair is
105    * received.
106    */
107   nghttp2_on_header_callback on_header_callback;
108   nghttp2_on_header_callback2 on_header_callback2;
109   /**
110    * Callback function invoked when a invalid header name/value pair
111    * is received which is silently ignored if these callbacks are not
112    * set.
113    */
114   nghttp2_on_invalid_header_callback on_invalid_header_callback;
115   nghttp2_on_invalid_header_callback2 on_invalid_header_callback2;
116   /**
117    * Deprecated.  Use select_padding_callback2 instead.  Callback
118    * function invoked when the library asks application how many
119    * padding bytes are required for the transmission of the given
120    * frame.
121    */
122   nghttp2_select_padding_callback select_padding_callback;
123   /**
124    * Callback function invoked when the library asks application how
125    * many padding bytes are required for the transmission of the given
126    * frame.
127    */
128   nghttp2_select_padding_callback2 select_padding_callback2;
129   /**
130    * Deprecated.  Use read_length_callback2 instead.  The callback
131    * function used to determine the length allowed in
132    * `nghttp2_data_source_read_callback()`
133    */
134   nghttp2_data_source_read_length_callback read_length_callback;
135   /**
136    * The callback function used to determine the length allowed in
137    * `nghttp2_data_source_read_callback2()`
138    */
139   nghttp2_data_source_read_length_callback2 read_length_callback2;
140   /**
141    * Sets callback function invoked when a frame header is received.
142    */
143   nghttp2_on_begin_frame_callback on_begin_frame_callback;
144   nghttp2_send_data_callback send_data_callback;
145   /**
146    * Deprecated.  Use pack_extension_callback2 instead.
147    */
148   nghttp2_pack_extension_callback pack_extension_callback;
149   nghttp2_pack_extension_callback2 pack_extension_callback2;
150   nghttp2_unpack_extension_callback unpack_extension_callback;
151   nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback;
152   nghttp2_error_callback error_callback;
153   nghttp2_error_callback2 error_callback2;
154 };
155 
156 #endif /* NGHTTP2_CALLBACKS_H */
157