QUICHE team | cf9d4ed | 2021-03-08 15:13:32 -0800 | [diff] [blame] | 1 | #ifndef QUICHE_HTTP2_ADAPTER_HTTP2_SESSION_H_ |
| 2 | #define QUICHE_HTTP2_ADAPTER_HTTP2_SESSION_H_ |
| 3 | |
| 4 | #include <cstdint> |
| 5 | |
| 6 | #include "absl/strings/string_view.h" |
| 7 | #include "http2/adapter/http2_protocol.h" |
| 8 | |
| 9 | namespace http2 { |
| 10 | namespace adapter { |
| 11 | |
| 12 | struct Http2SessionCallbacks {}; |
| 13 | |
| 14 | // A class to represent the state of a single HTTP/2 connection. |
| 15 | class Http2Session { |
| 16 | public: |
| 17 | Http2Session() = default; |
| 18 | virtual ~Http2Session() {} |
| 19 | |
| 20 | virtual ssize_t ProcessBytes(absl::string_view bytes) = 0; |
| 21 | |
| 22 | virtual int Consume(Http2StreamId stream_id, size_t num_bytes) = 0; |
| 23 | |
QUICHE team | 7ee21fc | 2021-03-24 07:22:07 -0700 | [diff] [blame] | 24 | virtual bool want_read() const = 0; |
| 25 | virtual bool want_write() const = 0; |
| 26 | virtual int GetRemoteWindowSize() const = 0; |
QUICHE team | cf9d4ed | 2021-03-08 15:13:32 -0800 | [diff] [blame] | 27 | }; |
| 28 | |
QUICHE team | 62eeb20 | 2021-04-08 14:57:00 -0700 | [diff] [blame] | 29 | enum class Perspective { |
| 30 | kClient, |
| 31 | kServer, |
QUICHE team | cf9d4ed | 2021-03-08 15:13:32 -0800 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | } // namespace adapter |
| 35 | } // namespace http2 |
| 36 | |
| 37 | #endif // QUICHE_HTTP2_ADAPTER_HTTP2_SESSION_H_ |