NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
frame.hpp File Reference
#include <algorithm>
#include <string>
#include <websocketpp/common/system_error.hpp>
#include <websocketpp/common/network.hpp>
#include <websocketpp/utilities.hpp>
Include dependency graph for frame.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  websocketpp::frame::uint16_converter
 Two byte conversion union. More...
 
union  websocketpp::frame::uint32_converter
 Four byte conversion union. More...
 
union  websocketpp::frame::uint64_converter
 Eight byte conversion union. More...
 
struct  websocketpp::frame::basic_header
 The constant size component of a WebSocket frame header. More...
 
struct  websocketpp::frame::extended_header
 The variable size component of a WebSocket frame header. More...
 

Namespaces

 websocketpp
 Namespace for the WebSocket++ project.
 
 websocketpp::frame
 Data structures and utility functions for manipulating WebSocket frames.
 
 websocketpp::frame::opcode
 Constants and utility functions related to WebSocket opcodes.
 
 websocketpp::frame::limits
 Constants related to frame and payload limits.
 

Typedefs

typedef uint32_converter websocketpp::frame::masking_key_type
 

Enumerations

enum  websocketpp::frame::opcode::value {
  websocketpp::frame::opcode::continuation = 0x0, websocketpp::frame::opcode::text = 0x1, websocketpp::frame::opcode::binary = 0x2, websocketpp::frame::opcode::rsv3 = 0x3,
  websocketpp::frame::opcode::rsv4 = 0x4, websocketpp::frame::opcode::rsv5 = 0x5, websocketpp::frame::opcode::rsv6 = 0x6, websocketpp::frame::opcode::rsv7 = 0x7,
  websocketpp::frame::opcode::close = 0x8, websocketpp::frame::opcode::ping = 0x9, websocketpp::frame::opcode::pong = 0xA, websocketpp::frame::opcode::control_rsvb = 0xB,
  websocketpp::frame::opcode::control_rsvc = 0xC, websocketpp::frame::opcode::control_rsvd = 0xD, websocketpp::frame::opcode::control_rsve = 0xE, websocketpp::frame::opcode::control_rsvf = 0xF,
  websocketpp::frame::opcode::CONTINUATION = 0x0, websocketpp::frame::opcode::TEXT = 0x1, websocketpp::frame::opcode::BINARY = 0x2, websocketpp::frame::opcode::RSV3 = 0x3,
  websocketpp::frame::opcode::RSV4 = 0x4, websocketpp::frame::opcode::RSV5 = 0x5, websocketpp::frame::opcode::RSV6 = 0x6, websocketpp::frame::opcode::RSV7 = 0x7,
  websocketpp::frame::opcode::CLOSE = 0x8, websocketpp::frame::opcode::PING = 0x9, websocketpp::frame::opcode::PONG = 0xA, websocketpp::frame::opcode::CONTROL_RSVB = 0xB,
  websocketpp::frame::opcode::CONTROL_RSVC = 0xC, websocketpp::frame::opcode::CONTROL_RSVD = 0xD, websocketpp::frame::opcode::CONTROL_RSVE = 0xE, websocketpp::frame::opcode::CONTROL_RSVF = 0xF
}
 

Functions

bool websocketpp::frame::opcode::reserved (value v)
 Check if an opcode is reserved. More...
 
bool websocketpp::frame::opcode::invalid (value v)
 Check if an opcode is invalid. More...
 
bool websocketpp::frame::opcode::is_control (value v)
 Check if an opcode is for a control frame. More...
 
bool websocketpp::frame::get_fin (basic_header const &h)
 Check whether the frame's FIN bit is set. More...
 
void websocketpp::frame::set_fin (basic_header &h, bool value)
 Set the frame's FIN bit. More...
 
bool websocketpp::frame::get_rsv1 (const basic_header &h)
 check whether the frame's RSV1 bit is set More...
 
void websocketpp::frame::set_rsv1 (basic_header &h, bool value)
 Set the frame's RSV1 bit. More...
 
bool websocketpp::frame::get_rsv2 (const basic_header &h)
 check whether the frame's RSV2 bit is set More...
 
void websocketpp::frame::set_rsv2 (basic_header &h, bool value)
 Set the frame's RSV2 bit. More...
 
bool websocketpp::frame::get_rsv3 (const basic_header &h)
 check whether the frame's RSV3 bit is set More...
 
void websocketpp::frame::set_rsv3 (basic_header &h, bool value)
 Set the frame's RSV3 bit. More...
 
opcode::value websocketpp::frame::get_opcode (const basic_header &h)
 Extract opcode from basic header. More...
 
bool websocketpp::frame::get_masked (basic_header const &h)
 check whether the frame is masked More...
 
void websocketpp::frame::set_masked (basic_header &h, bool value)
 Set the frame's MASK bit. More...
 
uint8_t websocketpp::frame::get_basic_size (const basic_header &h)
 Extracts the raw payload length specified in the basic header. More...
 
size_t websocketpp::frame::get_header_len (basic_header const &h)
 Calculates the full length of the header based on the first bytes. More...
 
unsigned int websocketpp::frame::get_masking_key_offset (const basic_header &h)
 Calculate the offset location of the masking key within the extended header. More...
 
std::string websocketpp::frame::write_header (basic_header const &, extended_header const &)
 
masking_key_type websocketpp::frame::get_masking_key (const basic_header &h, const extended_header &e)
 Extract the masking key from a frame header. More...
 
uint16_t websocketpp::frame::get_extended_size (const extended_header &e)
 Extract the extended size field from an extended header. More...
 
uint64_t websocketpp::frame::get_jumbo_size (const extended_header &e)
 Extract the jumbo size field from an extended header. More...
 
uint64_t websocketpp::frame::get_payload_size (const basic_header &h, const extended_header &e)
 Extract the full payload size field from a WebSocket header. More...
 
size_t websocketpp::frame::prepare_masking_key (const masking_key_type &key)
 Extract a masking key into a value the size of a machine word. More...
 
size_t websocketpp::frame::circshift_prepared_key (size_t prepared_key, size_t offset)
 circularly shifts the supplied prepared masking key by offset bytes More...
 
template<typename input_iter , typename output_iter >
void websocketpp::frame::byte_mask (input_iter first, input_iter last, output_iter result, masking_key_type const &key, size_t key_offset)
 Byte by byte mask/unmask. More...
 
template<typename iter_type >
void websocketpp::frame::byte_mask (iter_type b, iter_type e, masking_key_type const &key, size_t key_offset)
 Byte by byte mask/unmask (in place) More...
 
void websocketpp::frame::word_mask_exact (uint8_t *input, uint8_t *output, size_t length, const masking_key_type &key)
 Exact word aligned mask/unmask. More...
 
void websocketpp::frame::word_mask_exact (uint8_t *data, size_t length, const masking_key_type &key)
 Exact word aligned mask/unmask (in place) More...
 
size_t websocketpp::frame::word_mask_circ (uint8_t *input, uint8_t *output, size_t length, size_t prepared_key)
 Circular word aligned mask/unmask. More...
 
size_t websocketpp::frame::word_mask_circ (uint8_t *data, size_t length, size_t prepared_key)
 Circular word aligned mask/unmask (in place) More...
 
std::string websocketpp::frame::prepare_header (const basic_header &h, const extended_header &e)
 Generate a properly sized contiguous string that encodes a full frame header. More...
 
size_t websocketpp::frame::byte_mask_circ (uint8_t *input, uint8_t *output, size_t length, size_t prepared_key)
 Circular byte aligned mask/unmask. More...
 
size_t websocketpp::frame::byte_mask_circ (uint8_t *data, size_t length, size_t prepared_key)
 Circular byte aligned mask/unmask (in place) More...
 

Variables

static unsigned int const websocketpp::frame::BASIC_HEADER_LENGTH = 2
 Minimum length of a WebSocket frame header. More...
 
static unsigned int const websocketpp::frame::MAX_HEADER_LENGTH = 14
 Maximum length of a WebSocket header. More...
 
static unsigned int const websocketpp::frame::MAX_EXTENDED_HEADER_LENGTH = 12
 Maximum length of the variable portion of the WebSocket header. More...
 
static unsigned int const websocketpp::frame::limits::basic_header_length = 2
 Minimum length of a WebSocket frame header. More...
 
static unsigned int const websocketpp::frame::limits::max_header_length = 14
 Maximum length of a WebSocket header. More...
 
static unsigned int const websocketpp::frame::limits::max_extended_header_length = 12
 Maximum length of the variable portion of the WebSocket header. More...
 
static uint8_t const websocketpp::frame::limits::payload_size_basic = 125
 Maximum size of a basic WebSocket payload. More...
 
static uint16_t const websocketpp::frame::limits::payload_size_extended = 0xFFFF
 Maximum size of an extended WebSocket payload (basic payload = 126) More...
 
static uint64_t const websocketpp::frame::limits::payload_size_jumbo = 0x7FFFFFFFFFFFFFFFLL
 Maximum size of a jumbo WebSocket payload (basic payload = 127) More...
 
static uint8_t const websocketpp::frame::limits::close_reason_size = 123
 Maximum size of close frame reason. More...
 
static uint8_t const websocketpp::frame::BHB0_OPCODE = 0x0F
 
static uint8_t const websocketpp::frame::BHB0_RSV3 = 0x10
 
static uint8_t const websocketpp::frame::BHB0_RSV2 = 0x20
 
static uint8_t const websocketpp::frame::BHB0_RSV1 = 0x40
 
static uint8_t const websocketpp::frame::BHB0_FIN = 0x80
 
static uint8_t const websocketpp::frame::BHB1_PAYLOAD = 0x7F
 
static uint8_t const websocketpp::frame::BHB1_MASK = 0x80
 
static uint8_t const websocketpp::frame::payload_size_code_16bit = 0x7E
 
static uint8_t const websocketpp::frame::payload_size_code_64bit = 0x7F