Orbit Framework
An ultra-modern, asynchronous, cross-platform C++ Web Framework.
Loading...
Searching...
No Matches
http::websocket::detail Namespace Reference

Classes

struct  FrameHeader
 A decoded RFC 6455 frame header. 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.
 
void unmask_payload (std::string &payload, const uint8_t mask_key[4])
 Unmasks a frame payload in place using the frame's masking key.
 

Function Documentation

◆ parse_frame_header()

bool 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.

Parameters
bufferThe raw bytes received so far.
headerPopulated on success.
Returns
True if a complete frame is available at the front of the buffer.

◆ unmask_payload()

void 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.

Parameters
payloadThe masked payload bytes.
mask_keyThe 4-byte masking key from the frame header.