The main parser/codec for our WebSockets implementation.
More...
#include <wsframe.h>
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.
◆ parser()
Constructor.
- Parameters
-
rng | The random number generator to be used with this instance. |
Definition at line 184 of file wsframe.h.
◆ 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
-
s | The 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 |
◆ 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 |
◆ 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()
Retrieves the state of this instance.
- Returns
- true, if this instance is ready.
Definition at line 198 of file wsframe.h.
◆ set_fin()
Set the FIN bit of the current message.
- Parameters
-
fin | The value of the FIN bit. |
Definition at line 345 of file wsframe.h.
Referenced by wsendpoint::send().
◆ set_masked()
void set_masked |
( |
bool |
masked | ) |
|
|
inline |
Set the MASKED bit of the current message.
- Parameters
-
masked | The value of the MASKED bit. If true, generate a masking key. |
Definition at line 386 of file wsframe.h.
Referenced by wsendpoint::send().
◆ set_opcode()
void set_opcode |
( |
opcode::value |
op | ) |
|
|
inline |
Set the opcode of the current message.
- Parameters
-
op | The value of the opcode according to RFC6455. |
Definition at line 365 of file wsframe.h.
Referenced by wsendpoint::send().
◆ set_payload() [1/2]
void set_payload |
( |
const std::string & |
source | ) |
|
|
inline |
Set the payload of the current message.
- Parameters
-
source | The payload for the current message. |
Definition at line 400 of file wsframe.h.
Referenced by wsendpoint::send().
◆ set_payload() [2/2]
void set_payload |
( |
const std::vector< unsigned char > & |
source | ) |
|
|
inline |
Set the payload of the current message.
- Parameters
-
source | The payload for the current message. |
Definition at line 410 of file wsframe.h.
The documentation for this class was generated from the following file: