1 #ifndef QUICHE_HTTP2_ADAPTER_OGHTTP2_ADAPTER_H_ 2 #define QUICHE_HTTP2_ADAPTER_OGHTTP2_ADAPTER_H_ 3 4 #include <cstdint> 5 #include <memory> 6 7 #include "quiche/http2/adapter/http2_adapter.h" 8 #include "quiche/http2/adapter/http2_session.h" 9 #include "quiche/http2/adapter/oghttp2_session.h" 10 #include "quiche/common/platform/api/quiche_export.h" 11 12 namespace http2 { 13 namespace adapter { 14 15 class QUICHE_EXPORT OgHttp2Adapter : public Http2Adapter { 16 public: 17 using Options = OgHttp2Session::Options; 18 static std::unique_ptr<OgHttp2Adapter> Create(Http2VisitorInterface& visitor, 19 Options options); 20 21 ~OgHttp2Adapter() override; 22 23 // From Http2Adapter. 24 bool IsServerSession() const override; want_read()25 bool want_read() const override { return session_->want_read(); } want_write()26 bool want_write() const override { return session_->want_write(); } 27 int64_t ProcessBytes(absl::string_view bytes) override; 28 void SubmitSettings(absl::Span<const Http2Setting> settings) override; 29 void SubmitPriorityForStream(Http2StreamId stream_id, 30 Http2StreamId parent_stream_id, int weight, 31 bool exclusive) override; 32 void SubmitPing(Http2PingId ping_id) override; 33 void SubmitShutdownNotice() override; 34 void SubmitGoAway(Http2StreamId last_accepted_stream_id, 35 Http2ErrorCode error_code, 36 absl::string_view opaque_data) override; 37 void SubmitWindowUpdate(Http2StreamId stream_id, 38 int window_increment) override; 39 void SubmitMetadata(Http2StreamId stream_id, size_t max_frame_size, 40 std::unique_ptr<MetadataSource> source) override; 41 int Send() override; 42 int GetSendWindowSize() const override; 43 int GetStreamSendWindowSize(Http2StreamId stream_id) const override; 44 int GetStreamReceiveWindowLimit(Http2StreamId stream_id) const override; 45 int GetStreamReceiveWindowSize(Http2StreamId stream_id) const override; 46 int GetReceiveWindowSize() const override; 47 int GetHpackEncoderDynamicTableSize() const override; 48 int GetHpackEncoderDynamicTableCapacity() const; 49 int GetHpackDecoderDynamicTableSize() const override; 50 int GetHpackDecoderSizeLimit() const; 51 Http2StreamId GetHighestReceivedStreamId() const override; 52 void MarkDataConsumedForStream(Http2StreamId stream_id, 53 size_t num_bytes) override; 54 void SubmitRst(Http2StreamId stream_id, Http2ErrorCode error_code) override; 55 int32_t SubmitRequest(absl::Span<const Header> headers, 56 std::unique_ptr<DataFrameSource> data_source, 57 void* user_data) override; 58 int SubmitResponse(Http2StreamId stream_id, absl::Span<const Header> headers, 59 std::unique_ptr<DataFrameSource> data_source) override; 60 61 int SubmitTrailer(Http2StreamId stream_id, 62 absl::Span<const Header> trailers) override; 63 64 void SetStreamUserData(Http2StreamId stream_id, void* user_data) override; 65 void* GetStreamUserData(Http2StreamId stream_id) override; 66 bool ResumeStream(Http2StreamId stream_id) override; 67 68 private: 69 OgHttp2Adapter(Http2VisitorInterface& visitor, Options options); 70 71 std::unique_ptr<OgHttp2Session> session_; 72 }; 73 74 } // namespace adapter 75 } // namespace http2 76 77 #endif // QUICHE_HTTP2_ADAPTER_OGHTTP2_ADAPTER_H_ 78