EHS Embedded HTTP Server  1.5.1.0
parser< rng_policy > Class Template Reference

The main parser/codec for our WebSockets implementation. More...

#include <wsframe.h>

Public Member Functions

 parser (rng_policy &rng)
 Constructor. More...
 
bool ready () const
 Retrieves the state of this instance. More...
 
void reset ()
 Resets this endpoint to its initial state.
 
void consume (std::istream &s)
 Reads incoming data and decodes it. More...
 
std::string get_header_str ()
 Retrieves header. More...
 
std::string get_payload_str () const
 Retrieves payload. More...
 
std::vector< unsigned char > & get_payload ()
 Retrieves payload. More...
 
bool is_control () const
 Check for control message. More...
 
void set_fin (bool fin)
 Set the FIN bit of the current message. More...
 
opcode::value get_opcode () const
 Retrieve message opcode. More...
 
void set_opcode (opcode::value op)
 Set the opcode of the current message. More...
 
void set_masked (bool masked)
 Set the MASKED bit of the current message. More...
 
void set_payload (const std::string &source)
 Set the payload of the current message. More...
 
void set_payload (const std::vector< unsigned char > &source)
 Set the payload of the current message. More...
 
close::status::value get_close_code () const
 Retrieve the close code (reason) of a CLOSE message. More...
 
std::string get_close_reason () const
 Retrieve the textual reason of a CLOSE message. More...
 

Detailed Description

template<class rng_policy>
class wspp::frame::parser< rng_policy >

The main parser/codec for our WebSockets implementation.

Definition at line 160 of file wsframe.h.

Constructor & Destructor Documentation

◆ parser()

parser ( rng_policy &  rng)
inline

Constructor.

Parameters
rngThe random number generator to be used with this instance.

Definition at line 184 of file wsframe.h.

Member Function Documentation

◆ consume()

void consume ( std::istream &  s)
inline

Reads incoming data and decodes it.

Method invariant: One of the following must always be true even in the case of exceptions.

  • m_bytes_needed > 0
  • m-state = STATE_READY
Parameters
sThe stream of incoming data.

Definition at line 222 of file wsframe.h.

◆ get_close_code()

close::status::value get_close_code ( ) const
inline

Retrieve the close code (reason) of a CLOSE message.

Returns
The close code according to RFC6455.

Definition at line 420 of file wsframe.h.

◆ get_close_reason()

std::string get_close_reason ( ) const
inline

Retrieve the textual reason of a CLOSE message.

Returns
The textual reason (my be empty).

Definition at line 432 of file wsframe.h.

◆ get_header_str()

std::string get_header_str ( )
inline

Retrieves header.

Returns
The current header data.

Definition at line 313 of file wsframe.h.

Referenced by wsendpoint::send().

+ Here is the caller graph for this function:

◆ get_opcode()

opcode::value get_opcode ( ) const
inline

Retrieve message opcode.

Returns
The opcode of the current message.

Definition at line 357 of file wsframe.h.

◆ get_payload()

std::vector<unsigned char>& get_payload ( )
inline

Retrieves payload.

Returns
The current payload data.

Definition at line 329 of file wsframe.h.

◆ get_payload_str()

std::string get_payload_str ( ) const
inline

Retrieves payload.

Returns
The current payload data.

Definition at line 321 of file wsframe.h.

Referenced by wsendpoint::send().

+ Here is the caller graph for this function:

◆ is_control()

bool is_control ( ) const
inline

Check for control message.

Returns
true, if the current message is a control message.

Definition at line 337 of file wsframe.h.

◆ ready()

bool ready ( ) const
inline

Retrieves the state of this instance.

Returns
true, if this instance is ready.

Definition at line 198 of file wsframe.h.

◆ set_fin()

void set_fin ( bool  fin)
inline

Set the FIN bit of the current message.

Parameters
finThe value of the FIN bit.

Definition at line 345 of file wsframe.h.

Referenced by wsendpoint::send().

+ Here is the caller graph for this function:

◆ set_masked()

void set_masked ( bool  masked)
inline

Set the MASKED bit of the current message.

Parameters
maskedThe value of the MASKED bit. If true, generate a masking key.

Definition at line 386 of file wsframe.h.

Referenced by wsendpoint::send().

+ Here is the caller graph for this function:

◆ set_opcode()

void set_opcode ( opcode::value  op)
inline

Set the opcode of the current message.

Parameters
opThe value of the opcode according to RFC6455.

Definition at line 365 of file wsframe.h.

Referenced by wsendpoint::send().

+ Here is the caller graph for this function:

◆ set_payload() [1/2]

void set_payload ( const std::string &  source)
inline

Set the payload of the current message.

Parameters
sourceThe payload for the current message.

Definition at line 400 of file wsframe.h.

Referenced by wsendpoint::send().

+ Here is the caller graph for this function:

◆ set_payload() [2/2]

void set_payload ( const std::vector< unsigned char > &  source)
inline

Set the payload of the current message.

Parameters
sourceThe payload for the current message.

Definition at line 410 of file wsframe.h.


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