summaryrefslogtreecommitdiff
path: root/chromium/net/third_party/quiche/src/quiche/http2/adapter/nghttp2_data_provider.h
blob: a3f095773440316929f600cba6a0be765f7f41c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef QUICHE_HTTP2_ADAPTER_NGHTTP2_DATA_PROVIDER_H_
#define QUICHE_HTTP2_ADAPTER_NGHTTP2_DATA_PROVIDER_H_

#include <cstdint>
#include <memory>

#include "quiche/http2/adapter/data_source.h"
#include "quiche/http2/adapter/nghttp2.h"

namespace http2 {
namespace adapter {
namespace callbacks {

// Assumes |source| is a DataFrameSource.
ssize_t DataFrameSourceReadCallback(nghttp2_session* /*session */,
                                    int32_t /* stream_id */, uint8_t* /* buf */,
                                    size_t length, uint32_t* data_flags,
                                    nghttp2_data_source* source,
                                    void* /* user_data */);

int DataFrameSourceSendCallback(nghttp2_session* /* session */,
                                nghttp2_frame* /* frame */,
                                const uint8_t* framehd, size_t length,
                                nghttp2_data_source* source,
                                void* /* user_data */);

}  // namespace callbacks

// Transforms a DataFrameSource into a nghttp2_data_provider. Does not take
// ownership of |source|. Returns nullptr if |source| is nullptr.
std::unique_ptr<nghttp2_data_provider> MakeDataProvider(
    DataFrameSource* source);

}  // namespace adapter
}  // namespace http2

#endif  // QUICHE_HTTP2_ADAPTER_NGHTTP2_DATA_PROVIDER_H_