xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/http2/adapter/nghttp2_data_provider.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 #ifndef QUICHE_HTTP2_ADAPTER_NGHTTP2_DATA_PROVIDER_H_
2 #define QUICHE_HTTP2_ADAPTER_NGHTTP2_DATA_PROVIDER_H_
3 
4 #include <cstdint>
5 #include <memory>
6 
7 #include "quiche/http2/adapter/data_source.h"
8 #include "quiche/http2/adapter/nghttp2.h"
9 
10 namespace http2 {
11 namespace adapter {
12 namespace callbacks {
13 
14 // Assumes |source| is a DataFrameSource.
15 ssize_t DataFrameSourceReadCallback(nghttp2_session* /*session */,
16                                     int32_t /* stream_id */, uint8_t* /* buf */,
17                                     size_t length, uint32_t* data_flags,
18                                     nghttp2_data_source* source,
19                                     void* /* user_data */);
20 
21 int DataFrameSourceSendCallback(nghttp2_session* /* session */,
22                                 nghttp2_frame* /* frame */,
23                                 const uint8_t* framehd, size_t length,
24                                 nghttp2_data_source* source,
25                                 void* /* user_data */);
26 
27 }  // namespace callbacks
28 
29 // Transforms a DataFrameSource into a nghttp2_data_provider. Does not take
30 // ownership of |source|. Returns nullptr if |source| is nullptr.
31 std::unique_ptr<nghttp2_data_provider> MakeDataProvider(
32     DataFrameSource* source);
33 
34 }  // namespace adapter
35 }  // namespace http2
36 
37 #endif  // QUICHE_HTTP2_ADAPTER_NGHTTP2_DATA_PROVIDER_H_
38