# Frame.hpp

This File On Github
Ask A Question

API: latest
module: oatpp-websocket
#include "oatpp-websocket/Frame.hpp"

# Frame

WebSocket frame.

namespace oatpp { namespace websocket { 
  class Frame {}
}}

# Fields

Type Name Summary
v_uint8 OPCODE_CONTINUATION Continuation frame.
v_uint8 OPCODE_TEXT Text frame.
v_uint8 OPCODE_BINARY Binary frame.
v_uint8 OPCODE_CLOSE Close frame.
v_uint8 OPCODE_PING Ping frame.
v_uint8 OPCODE_PONG Pong frame.

# Methods

Return Type Name Summary
void packHeaderBits Serialize Frame::Header.
void unpackHeaderBits Deserialize Frame::Header.

# Frame::OPCODE_CONTINUATION

Continuation frame.

static constexpr v_uint8 OPCODE_CONTINUATION = 0x0

# Frame::OPCODE_TEXT

Text frame.

static constexpr v_uint8 OPCODE_TEXT = 0x1

# Frame::OPCODE_BINARY

Binary frame.

static constexpr v_uint8 OPCODE_BINARY = 0x2

# Frame::OPCODE_CLOSE

Close frame.

static constexpr v_uint8 OPCODE_CLOSE = 0x8

# Frame::OPCODE_PING

Ping frame.

static constexpr v_uint8 OPCODE_PING = 0x9

# Frame::OPCODE_PONG

Pong frame.

static constexpr v_uint8 OPCODE_PONG = 0xA

# Frame::packHeaderBits

Serialize Frame::Header.

  • @param bits - out parameter. Two bytes header.
  • @param frameHeader - Frame::Header.
  • @param messageLengthScenario - out parameter. Depending on message length scenario. Message length can be encoded in 1, 2, or 8 bytes.

static void packHeaderBits(v_uint16& bits, const Header& frameHeader, v_uint8& messageLengthScenario)

# Frame::unpackHeaderBits

Deserialize Frame::Header.

  • @param bits - two bytes header.
  • @param frameHeader - out parameter. Frame::Header.
  • @param messageLen1 - first byte of encoded message length.

static void unpackHeaderBits(v_uint16 bits, Header& frameHeader, v_uint8& messageLen1)

# Frame::Header

Frame header.

namespace oatpp { namespace websocket { 
  class Frame {
    struct Header {}
  };
}}

# Fields

Type Name Summary
bool fin FIN bit.
bool rsv1 RSV1 bit. Should be false.
bool rsv2 RSV2 bit. Should be false.
bool rsv3 RSV3 bit. Should be false.
v_uint8 opcode Operation code.
bool hasMask Mask bit. For client-to-server messages should be true. For server-to-client messages should be false.
v_int64 payloadLength Decoded payload length.
v_uint8 mask Payload mask.

# Frame::Header::fin

FIN bit.

bool fin

# Frame::Header::rsv1

RSV1 bit. Should be false.

bool rsv1

# Frame::Header::rsv2

RSV2 bit. Should be false.

bool rsv2

# Frame::Header::rsv3

RSV3 bit. Should be false.

bool rsv3

# Frame::Header::opcode

Operation code.

v_uint8 opcode

# Frame::Header::hasMask

Mask bit. For client-to-server messages should be true. For server-to-client messages should be false.

bool hasMask

# Frame::Header::payloadLength

Decoded payload length.

v_int64 payloadLength

# Frame::Header::mask

Payload mask.

v_uint8 mask[4] =