|
Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
|
Classes | |
| struct | FrameHeader |
| A decoded RFC 6455 frame header. More... | |
Enumerations | |
| enum class | FrameStatus { NeedHeader , NeedPayload , Complete , Invalid } |
| Progress of parsing the frame at the front of a buffer. More... | |
Functions | |
| bool | parse_frame_header (const std::vector< char > &buffer, FrameHeader &header) |
| Decodes an RFC 6455 frame header from the front of a buffer. | |
| FrameStatus | inspect_frame (const std::vector< char > &buffer, FrameHeader &header) |
Parses the frame header at the front of buffer. | |
| void | unmask_payload (std::string &payload, const uint8_t mask_key[4]) |
| Unmasks a frame payload in place using the frame's masking key. | |
| bool | is_valid_utf8 (std::string_view data) |
| bool | is_valid_close_code (uint16_t code) |
| True if a close frame may carry this status code (RFC 6455 section 7.4). | |
|
strong |
Progress of parsing the frame at the front of a buffer.
| FrameStatus orbit::http::websocket::detail::inspect_frame | ( | const std::vector< char > & | buffer, |
| FrameHeader & | header | ||
| ) |
Parses the frame header at the front of buffer.
Unlike parse_frame_header(), this distinguishes a protocol violation from a frame that is still arriving, and reports the payload length as soon as the header is available so callers can reject oversized frames without buffering them.
| bool orbit::http::websocket::detail::is_valid_close_code | ( | uint16_t | code | ) |
True if a close frame may carry this status code (RFC 6455 section 7.4).
| bool orbit::http::websocket::detail::is_valid_utf8 | ( | std::string_view | data | ) |
True if data is well-formed UTF-8 (no overlong forms, surrogates, or code points above U+10FFFF), as RFC 6455 requires of text messages and close reasons.
| bool orbit::http::websocket::detail::parse_frame_header | ( | const std::vector< char > & | buffer, |
| FrameHeader & | header | ||
| ) |
Decodes an RFC 6455 frame header from the front of a buffer.
Returns false when the buffer does not yet hold the complete header and payload, so the caller can wait for more data. On success, header_length is the number of bytes preceding the payload, including the extended length and masking key when present.
| buffer | The raw bytes received so far. |
| header | Populated on success. |
| void orbit::http::websocket::detail::unmask_payload | ( | std::string & | payload, |
| const uint8_t | mask_key[4] | ||
| ) |
Unmasks a frame payload in place using the frame's masking key.
| payload | The masked payload bytes. |
| mask_key | The 4-byte masking key from the frame header. |