EHS Embedded HTTP Server  1.5.0.132
parser Class Reference

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

#include <wsframe.h>

List of all members.

Public Member Functions

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

Detailed Description

The main parser/codec for our WebSockets implementation.


Constructor & Destructor Documentation

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

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.

Referenced by wsendpoint::AddRxData().

+ Here is the caller graph for this function:

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.

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.

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:

opcode::value get_opcode ( ) const [inline]

Retrieve message opcode.

Returns:
The opcode of the current message.

Definition at line 357 of file wsframe.h.

Referenced by parser< simple_rng >::is_control().

+ Here is the caller graph for this function:

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

Retrieves payload.

Returns:
The current payload data.

Definition at line 329 of file wsframe.h.

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(), and parser< simple_rng >::get_close_reason().

+ Here is the caller graph for this function:

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.

Referenced by wsendpoint::AddRxData(), and parser< simple_rng >::set_opcode().

+ Here is the caller graph for this function:

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.

Referenced by wsendpoint::AddRxData().

+ Here is the caller graph for this function:

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:

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:

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:

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:

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: