#ifndef QUICHE_HTTP2_ADAPTER_HTTP2_PROTOCOL_H_ #define QUICHE_HTTP2_ADAPTER_HTTP2_PROTOCOL_H_ #include <cstdint> #include <string> #include <utility> #include "absl/base/attributes.h" #include "absl/strings/string_view.h" #include "absl/types/variant.h" #include "quiche/common/platform/api/quiche_export.h" namespace http2 { namespace adapter { // Represents an HTTP/2 stream ID, consistent with nghttp2. Http2StreamId; // Represents an HTTP/2 SETTINGS parameter as specified in RFC 7540 Section 6.5. Http2SettingsId; // Represents the payload of an HTTP/2 PING frame. Http2PingId; // Represents a single header name or value. HeaderRep; // Boolean return value is true if |rep| holds a string_view, which is assumed // to have an indefinite lifetime. std::pair<absl::string_view, bool> GetStringView(const HeaderRep& rep); // Represents an HTTP/2 header field. A header field is a key-value pair with // lowercase keys (as specified in RFC 7540 Section 8.1.2). Header; // Represents an HTTP/2 SETTINGS key-value parameter. struct QUICHE_EXPORT Http2Setting { … }; QUICHE_EXPORT bool operator==(const Http2Setting& a, const Http2Setting& b); // The maximum possible stream ID. inline constexpr Http2StreamId kMaxStreamId = …; // The stream ID that represents the connection (e.g., for connection-level flow // control updates). inline constexpr Http2StreamId kConnectionStreamId = …; // The default value for the size of the largest frame payload, according to RFC // 7540 Section 6.5.2 (SETTINGS_MAX_FRAME_SIZE). inline constexpr uint32_t kDefaultFramePayloadSizeLimit = …; // The maximum value for the size of the largest frame payload, according to RFC // 7540 Section 6.5.2 (SETTINGS_MAX_FRAME_SIZE). inline constexpr uint32_t kMaximumFramePayloadSizeLimit = …; // The default value for the initial stream and connection flow control window // size, according to RFC 7540 Section 6.9.2. inline constexpr int kInitialFlowControlWindowSize = …; // The pseudo-header fields as specified in RFC 7540 Section 8.1.2.3 (request) // and Section 8.1.2.4 (response). inline constexpr absl::string_view kHttp2MethodPseudoHeader = …; inline constexpr absl::string_view kHttp2SchemePseudoHeader = …; inline constexpr absl::string_view kHttp2AuthorityPseudoHeader = …; inline constexpr absl::string_view kHttp2PathPseudoHeader = …; inline constexpr absl::string_view kHttp2StatusPseudoHeader = …; inline constexpr uint8_t kMetadataFrameType = …; inline constexpr uint8_t kMetadataEndFlag = …; inline constexpr uint16_t kMetadataExtensionId = …; enum class FrameType : uint8_t { … }; enum FrameFlags : uint8_t { … }; // HTTP/2 error codes as specified in RFC 7540 Section 7. enum class Http2ErrorCode { … }; // The SETTINGS parameters defined in RFC 7540 Section 6.5.2. Endpoints may send // SETTINGS parameters outside of these definitions as per RFC 7540 Section 5.5. // This is explicitly an enum instead of an enum class for ease of implicit // conversion to the underlying Http2SettingsId type and use with non-standard // extension SETTINGS parameters. enum Http2KnownSettingsId : Http2SettingsId { … }; // Returns a human-readable string representation of the given SETTINGS |id| for // logging/debugging. Returns "SETTINGS_UNKNOWN" for IDs outside of the RFC 7540 // Section 6.5.2 definitions. QUICHE_EXPORT absl::string_view Http2SettingsIdToString(uint16_t id); // Returns a human-readable string representation of the given |error_code| for // logging/debugging. Returns "UNKNOWN_ERROR" for errors outside of RFC 7540 // Section 7 definitions. QUICHE_EXPORT absl::string_view Http2ErrorCodeToString( Http2ErrorCode error_code); enum class Perspective { … }; } // namespace adapter } // namespace http2 #endif // QUICHE_HTTP2_ADAPTER_HTTP2_PROTOCOL_H_