UNISTDX_BASE_WEBSOCKET
enum opcode_type: u8

WebSocket Opcode numbers.

  • cont_frame = 0x0
  • text_frame = 0x1
  • binary_frame = 0x2
  • conn_close = 0x8
  • ping = 0x9
  • pong = 0xa
union sys::websocket_frame

WebSocket frame.

Types
  • using opcodes = ::sys::opcode_type
  • using length64_type = u64

    8-byte length type.

  • using length16_type = u16

    2-byte length type.

  • using mask_type = u32

    4-byte mask type.

Fields
  • u64 footer
  • u8 __pad3__
  • u32 extlen2
  • u8 __pad2__
  • u16 extlen
  • u8 __pad1__
  • u16 maskbit
  • u16 len
  • u8 __pad0__
  • u16 fin
  • u16 rsv1
  • u16 rsv2
  • u16 rsv3
  • u16 opcode
  • const size_t base_size

    Minimal number of bytes used by a frame.

  • const size_t mask_size

    The number of bytes used by payload mask.

  • const u16 length64_tag

    Tag indicating that frame length is encoded using 8 bytes.

  • const u16 length16_tag

    Tag indicating that frame length is encoded using 2 bytes.

Methods
  • min_size() -> constexpr size_t

    Minimum frame header size.

  • max_size() -> constexpr size_t

    Maximum frame header size.

  • clear() -> void

    Reset frame header contents.

  • mask_payload(char * first, char * last) const -> void

    Mask payload between first and last pointers. The payload is changed in-place.

  • mask(mask_type rhs) -> void

    Set frame mask.

  • mask() const -> mask_type

    Get frame mask.

  • size() const -> size_t

    Full size of frame header.

  • base() const -> const char *

    Pointer to the beginning of extended payload length field.

  • base() -> char *

    Pointer to the beginning of extended payload length field.

  • end() const -> const char *

    Pointer to the end of frame header.

  • end() -> char *

    Pointer to the beginning of frame header.

  • begin() const -> const char *

    Pointer to the beginning of frame header.

  • begin() -> char *

    Pointer to the beginning of frame header.

  • payload_size(length64_type rhs) -> void

    Set payload size in bytes.

  • payload_size() const -> length64_type

    Returns payload size in bytes.

  • maskbit(u16 rhs) -> void

    Set MASK header field, that determines whether the payload is masked or not.

  • len(u16 rhs) -> void

    Set payload len header field.

  • extlen_size() const -> size_t

    Returns extended payload size in bytes.

  • has_valid_opcode() const -> bool

    Returns true, if opcode number is within valid range (as defined by the standard).

  • is_binary() const -> bool

    Returns true, if the payload is binary.

  • is_masked() const -> bool

    Returns true, if the payload is masked.

  • opcode() const -> opcode_type

    Get opcode header field.

  • opcode(opcode_type rhs) -> void

    Set opcode header field, indicating the type of the payload.

  • fin(int rhs) -> void

    Set FIN header field, indicating that this frame is the final fragment of the message.

Friends
  • operator<<

    Output WebSocket frame header field for debugging.

operator<<(std::ostream & out, const websocket_frame & rhs) -> std::ostream &

Output WebSocket frame header field for debugging.