NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
websocketpp::message_buffer::message< con_msg_manager > Class Template Reference

Represents a buffer for a single WebSocket message. More...

#include <message.hpp>

Public Types

typedef lib::shared_ptr< messageptr
 
typedef con_msg_manager< messagecon_msg_man_type
 
typedef con_msg_man_type::ptr con_msg_man_ptr
 
typedef con_msg_man_type::weak_ptr con_msg_man_weak_ptr
 
typedef lib::shared_ptr< messageptr
 
typedef con_msg_manager::weak_ptr con_msg_man_ptr
 

Public Member Functions

 message (const con_msg_man_ptr manager)
 Construct an empty message. More...
 
 message (const con_msg_man_ptr manager, frame::opcode::value op, size_t size=128)
 Construct a message and fill in some values. More...
 
bool get_prepared () const
 Return whether or not the message has been prepared for sending. More...
 
void set_prepared (bool value)
 Set or clear the flag that indicates that the message has been prepared. More...
 
bool get_compressed () const
 Return whether or not the message is flagged as compressed. More...
 
void set_compressed (bool value)
 Set or clear the compression flag. More...
 
bool get_terminal () const
 Get whether or not the message is terminal. More...
 
void set_terminal (bool value)
 Set the terminal flag. More...
 
bool get_fin () const
 Read the fin bit. More...
 
void set_fin (bool value)
 Set the fin bit. More...
 
frame::opcode::value get_opcode () const
 Return the message opcode. More...
 
void set_opcode (frame::opcode::value op)
 Set the opcode. More...
 
std::string const & get_header () const
 Return the prepared frame header. More...
 
void set_header (std::string const &header)
 Set prepared frame header. More...
 
std::string const & get_extension_data () const
 
std::string const & get_payload () const
 Get a reference to the payload string. More...
 
std::string & get_raw_payload ()
 Get a non-const reference to the payload string. More...
 
void set_payload (std::string const &payload)
 Set payload data. More...
 
void set_payload (void const *payload, size_t len)
 Set payload data. More...
 
void append_payload (std::string const &payload)
 Append payload data. More...
 
void append_payload (void const *payload, size_t len)
 Append payload data. More...
 
bool recycle ()
 Recycle the message. More...
 
 message (con_msg_man_ptr manager, size_t size=128)
 
frame::opcode::value get_opcode () const
 
const std::string & get_header () const
 
const std::string & get_extension_data () const
 
const std::string & get_payload () const
 
bool recycle ()
 Recycle the message. More...
 

Detailed Description

template<template< class > class con_msg_manager>
class websocketpp::message_buffer::message< con_msg_manager >

Represents a buffer for a single WebSocket message.

Definition at line 84 of file message.hpp.

Member Typedef Documentation

◆ ptr [1/2]

template<template< class > class con_msg_manager>
typedef lib::shared_ptr<message> websocketpp::message_buffer::message< con_msg_manager >::ptr

Definition at line 86 of file message.hpp.

◆ con_msg_man_type

template<template< class > class con_msg_manager>
typedef con_msg_manager<message> websocketpp::message_buffer::message< con_msg_manager >::con_msg_man_type

Definition at line 88 of file message.hpp.

◆ con_msg_man_ptr [1/2]

template<template< class > class con_msg_manager>
typedef con_msg_man_type::ptr websocketpp::message_buffer::message< con_msg_manager >::con_msg_man_ptr

Definition at line 89 of file message.hpp.

◆ con_msg_man_weak_ptr

template<template< class > class con_msg_manager>
typedef con_msg_man_type::weak_ptr websocketpp::message_buffer::message< con_msg_manager >::con_msg_man_weak_ptr

Definition at line 90 of file message.hpp.

◆ ptr [2/2]

template<template< class > class con_msg_manager>
typedef lib::shared_ptr<message> websocketpp::message_buffer::message< con_msg_manager >::ptr

Definition at line 103 of file pool.hpp.

◆ con_msg_man_ptr [2/2]

template<template< class > class con_msg_manager>
typedef con_msg_manager::weak_ptr websocketpp::message_buffer::message< con_msg_manager >::con_msg_man_ptr

Definition at line 105 of file pool.hpp.

Constructor & Destructor Documentation

◆ message() [1/3]

template<template< class > class con_msg_manager>
websocketpp::message_buffer::message< con_msg_manager >::message ( const con_msg_man_ptr  manager)
inline

Construct an empty message.

Construct an empty message

Definition at line 96 of file message.hpp.

◆ message() [2/3]

template<template< class > class con_msg_manager>
websocketpp::message_buffer::message< con_msg_manager >::message ( const con_msg_man_ptr  manager,
frame::opcode::value  op,
size_t  size = 128 
)
inline

Construct a message and fill in some values.

Definition at line 107 of file message.hpp.

References nonstd::span_lite::size().

◆ message() [3/3]

template<template< class > class con_msg_manager>
websocketpp::message_buffer::message< con_msg_manager >::message ( con_msg_man_ptr  manager,
size_t  size = 128 
)
inline

Definition at line 107 of file pool.hpp.

Member Function Documentation

◆ get_prepared()

template<template< class > class con_msg_manager>
bool websocketpp::message_buffer::message< con_msg_manager >::get_prepared ( ) const
inline

Return whether or not the message has been prepared for sending.

The prepared flag indicates that the message has been prepared by a websocket protocol processor and is ready to be written to the wire.

Returns
whether or not the message has been prepared for sending

Definition at line 125 of file message.hpp.

◆ set_prepared()

template<template< class > class con_msg_manager>
void websocketpp::message_buffer::message< con_msg_manager >::set_prepared ( bool  value)
inline

Set or clear the flag that indicates that the message has been prepared.

This flag should not be set by end user code without a very good reason.

Parameters
valueThe value to set the prepared flag to

Definition at line 135 of file message.hpp.

◆ get_compressed()

template<template< class > class con_msg_manager>
bool websocketpp::message_buffer::message< con_msg_manager >::get_compressed ( ) const
inline

Return whether or not the message is flagged as compressed.

Returns
whether or not the message is/should be compressed

Definition at line 143 of file message.hpp.

◆ set_compressed()

template<template< class > class con_msg_manager>
void websocketpp::message_buffer::message< con_msg_manager >::set_compressed ( bool  value)
inline

Set or clear the compression flag.

Setting the compression flag indicates that the data in this message would benefit from compression. If both endpoints negotiate a compression extension WebSocket++ will attempt to compress messages with this flag. Setting this flag does not guarantee that the message will be compressed.

Parameters
valueThe value to set the compressed flag to

Definition at line 156 of file message.hpp.

◆ get_terminal()

template<template< class > class con_msg_manager>
bool websocketpp::message_buffer::message< con_msg_manager >::get_terminal ( ) const
inline

Get whether or not the message is terminal.

Messages can be flagged as terminal, which results in the connection being close after they are written rather than the implementation going on to the next message in the queue. This is typically used internally for close messages only.

Returns
Whether or not this message is marked terminal

Definition at line 169 of file message.hpp.

◆ set_terminal()

template<template< class > class con_msg_manager>
void websocketpp::message_buffer::message< con_msg_manager >::set_terminal ( bool  value)
inline

Set the terminal flag.

This flag should not be set by end user code without a very good reason.

See also
get_terminal()
Parameters
valueThe value to set the terminal flag to.

Definition at line 181 of file message.hpp.

◆ get_fin()

template<template< class > class con_msg_manager>
bool websocketpp::message_buffer::message< con_msg_manager >::get_fin ( ) const
inline

Read the fin bit.

A message with the fin bit set will be sent as the last message of its sequence. A message with the fin bit cleared will require subsequent frames of opcode continuation until one of them has the fin bit set.

The remote end likely will not deliver any bytes until the frame with the fin bit set has been received.

Returns
Whether or not the fin bit is set

Definition at line 195 of file message.hpp.

◆ set_fin()

template<template< class > class con_msg_manager>
void websocketpp::message_buffer::message< con_msg_manager >::set_fin ( bool  value)
inline

Set the fin bit.

See also
get_fin for a more detailed explaination of the fin bit
Parameters
valueThe value to set the fin bit to.

Definition at line 205 of file message.hpp.

◆ get_opcode() [1/2]

template<template< class > class con_msg_manager>
frame::opcode::value websocketpp::message_buffer::message< con_msg_manager >::get_opcode ( ) const
inline

Return the message opcode.

Definition at line 210 of file message.hpp.

◆ set_opcode()

template<template< class > class con_msg_manager>
void websocketpp::message_buffer::message< con_msg_manager >::set_opcode ( frame::opcode::value  op)
inline

Set the opcode.

Definition at line 215 of file message.hpp.

◆ get_header() [1/2]

template<template< class > class con_msg_manager>
std::string const& websocketpp::message_buffer::message< con_msg_manager >::get_header ( ) const
inline

Return the prepared frame header.

This value is typically set by a websocket protocol processor and shouldn't be tampered with.

Definition at line 224 of file message.hpp.

◆ set_header()

template<template< class > class con_msg_manager>
void websocketpp::message_buffer::message< con_msg_manager >::set_header ( std::string const &  header)
inline

Set prepared frame header.

Under normal circumstances this should not be called by end users

Parameters
headerA string to set the header to.

Definition at line 234 of file message.hpp.

◆ get_extension_data() [1/2]

template<template< class > class con_msg_manager>
std::string const& websocketpp::message_buffer::message< con_msg_manager >::get_extension_data ( ) const
inline

Definition at line 238 of file message.hpp.

◆ get_payload() [1/2]

template<template< class > class con_msg_manager>
std::string const& websocketpp::message_buffer::message< con_msg_manager >::get_payload ( ) const
inline

Get a reference to the payload string.

Returns
A const reference to the message's payload string

Definition at line 246 of file message.hpp.

◆ get_raw_payload()

template<template< class > class con_msg_manager>
std::string& websocketpp::message_buffer::message< con_msg_manager >::get_raw_payload ( )
inline

Get a non-const reference to the payload string.

Returns
A reference to the message's payload string

Definition at line 254 of file message.hpp.

◆ set_payload() [1/2]

template<template< class > class con_msg_manager>
void websocketpp::message_buffer::message< con_msg_manager >::set_payload ( std::string const &  payload)
inline

Set payload data.

Set the message buffer's payload to the given value.

Parameters
payloadA string to set the payload to.

Definition at line 264 of file message.hpp.

◆ set_payload() [2/2]

template<template< class > class con_msg_manager>
void websocketpp::message_buffer::message< con_msg_manager >::set_payload ( void const *  payload,
size_t  len 
)
inline

Set payload data.

Set the message buffer's payload to the given value.

Parameters
payloadA pointer to a data array to set to.
lenThe length of new payload in bytes.

Definition at line 275 of file message.hpp.

◆ append_payload() [1/2]

template<template< class > class con_msg_manager>
void websocketpp::message_buffer::message< con_msg_manager >::append_payload ( std::string const &  payload)
inline

Append payload data.

Append data to the message buffer's payload.

Parameters
payloadA string containing the data array to append.

Definition at line 287 of file message.hpp.

◆ append_payload() [2/2]

template<template< class > class con_msg_manager>
void websocketpp::message_buffer::message< con_msg_manager >::append_payload ( void const *  payload,
size_t  len 
)
inline

Append payload data.

Append data to the message buffer's payload.

Parameters
payloadA pointer to a data array to append
lenThe length of payload in bytes

Definition at line 298 of file message.hpp.

◆ recycle() [1/2]

template<template< class > class con_msg_manager>
bool websocketpp::message_buffer::message< con_msg_manager >::recycle ( )
inline

Recycle the message.

A request to recycle this message was received. Forward that request to the connection message manager for processing. Errors and exceptions from the manager's recycle member function should be passed back up the call chain. The caller to message::recycle will deal with them.

Recycle must only be called by the message shared_ptr's destructor. Once recycled successfully, ownership of the memory has been passed to another system and must not be accessed again.

Returns
true if the message was successfully recycled, false otherwise.

Definition at line 316 of file message.hpp.

◆ get_opcode() [2/2]

template<template< class > class con_msg_manager>
frame::opcode::value websocketpp::message_buffer::message< con_msg_manager >::get_opcode ( ) const
inline

Definition at line 111 of file pool.hpp.

◆ get_header() [2/2]

template<template< class > class con_msg_manager>
const std::string& websocketpp::message_buffer::message< con_msg_manager >::get_header ( ) const
inline

Definition at line 114 of file pool.hpp.

◆ get_extension_data() [2/2]

template<template< class > class con_msg_manager>
const std::string& websocketpp::message_buffer::message< con_msg_manager >::get_extension_data ( ) const
inline

Definition at line 117 of file pool.hpp.

◆ get_payload() [2/2]

template<template< class > class con_msg_manager>
const std::string& websocketpp::message_buffer::message< con_msg_manager >::get_payload ( ) const
inline

Definition at line 120 of file pool.hpp.

◆ recycle() [2/2]

template<template< class > class con_msg_manager>
bool websocketpp::message_buffer::message< con_msg_manager >::recycle ( )
inline

Recycle the message.

A request to recycle this message was received. Forward that request to the connection message manager for processing. Errors and exceptions from the manager's recycle member function should be passed back up the call chain. The caller to message::recycle will deal with them.

Recycle must only be called by the message shared_ptr's destructor. Once recycled successfully, ownership of the memory has been passed to another system and must not be accessed again.

Returns
true if the message was successfully recycled, false otherwise.

Definition at line 137 of file pool.hpp.


The documentation for this class was generated from the following files: