websocketpp
0.3.0
C++/Boost Asio based websocket client/server library
|
Processor for Hybi Draft version 00. More...
#include <hybi00.hpp>
Public Types | |
typedef processor< config > | base |
typedef config::request_type | request_type |
typedef config::response_type | response_type |
typedef config::message_type | message_type |
typedef message_type::ptr | message_ptr |
typedef config::con_msg_manager_type::ptr | msg_manager_ptr |
![]() | |
typedef processor< config > | type |
typedef config::request_type | request_type |
typedef config::response_type | response_type |
typedef config::message_type::ptr | message_ptr |
typedef std::pair < lib::error_code, std::string > | err_str_pair |
Public Member Functions | |
hybi00 (bool secure, bool p_is_server, msg_manager_ptr manager) | |
int | get_version () const |
Get the protocol version of this processor. | |
lib::error_code | validate_handshake (request_type const &r) const |
validate a WebSocket handshake request for this version More... | |
lib::error_code | process_handshake (request_type const &req, std::string const &subprotocol, response_type &res) const |
Calculate the appropriate response for this websocket request. More... | |
lib::error_code | client_handshake_request (request_type &req, uri_ptr uri, std::vector< std::string > const &subprotocols) const |
Fill in an HTTP request for an outgoing connection handshake. More... | |
lib::error_code | validate_server_handshake_response (request_type const &req, response_type &res) const |
Validate the server's response to an outgoing handshake request. More... | |
std::string | get_raw (response_type const &res) const |
Given a completed response, get the raw bytes to put on the wire. | |
std::string const & | get_origin (request_type const &r) const |
Return the value of the header containing the CORS origin. | |
lib::error_code | extract_subprotocols (request_type const &req, std::vector< std::string > &subprotocol_list) |
Extracts requested subprotocols from a handshake request. More... | |
uri_ptr | get_uri (request_type const &request) const |
Extracts client uri from a handshake request. | |
std::string | get_key3 () const |
Get hybi00 handshake key3. More... | |
size_t | consume (uint8_t *buf, size_t len, lib::error_code &ec) |
Process new websocket connection bytes. | |
bool | ready () const |
Checks if there is a message ready. More... | |
bool | get_error () const |
Tests whether the processor is in a fatal error state. | |
message_ptr | get_message () |
Retrieves the most recently processed message. More... | |
virtual lib::error_code | prepare_data_frame (message_ptr in, message_ptr out) |
Prepare a message for writing. More... | |
lib::error_code | prepare_ping (std::string const &in, message_ptr out) const |
lib::error_code | prepare_pong (const std::string &in, message_ptr out) const |
lib::error_code | prepare_close (close::status::value code, std::string const &reason, message_ptr out) const |
![]() | |
processor (bool secure, bool p_is_server) | |
size_t | get_max_message_size () const |
Get maximum message size. More... | |
void | set_max_message_size (size_t new_value) |
Set maximum message size. More... | |
virtual bool | has_permessage_compress () const |
Returns whether or not the permessage_compress extension is implemented. More... | |
virtual err_str_pair | negotiate_extensions (request_type const &request) |
Initializes extensions based on the Sec-WebSocket-Extensions header. More... | |
virtual size_t | get_bytes_needed () const |
virtual lib::error_code | prepare_data_frame (message_ptr in, message_ptr out)=0 |
Prepare a data message for writing. More... | |
virtual lib::error_code | prepare_ping (std::string const &in, message_ptr out) const =0 |
Prepare a ping frame. More... | |
virtual lib::error_code | prepare_pong (std::string const &in, message_ptr out) const =0 |
Prepare a pong frame. More... | |
virtual lib::error_code | prepare_close (close::status::value code, std::string const &reason, message_ptr out) const =0 |
Prepare a close frame. More... | |
Additional Inherited Members | |
![]() | |
bool const | m_secure |
bool const | m_server |
size_t | m_max_message_size |
Processor for Hybi Draft version 00.
There are many differences between Hybi 00 and Hybi 13
Definition at line 49 of file hybi00.hpp.
|
inlinevirtual |
Fill in an HTTP request for an outgoing connection handshake.
req | The request to process. |
Implements websocketpp::processor::processor< config >.
Definition at line 145 of file hybi00.hpp.
|
inlinevirtual |
Extracts requested subprotocols from a handshake request.
Extracts a list of all subprotocols that the client has requested in the given opening handshake request.
req | The request to extract from |
subprotocol_list | A reference to a vector of strings to store the results in. |
Implements websocketpp::processor::processor< config >.
Definition at line 168 of file hybi00.hpp.
|
inline |
Get hybi00 handshake key3.
Definition at line 204 of file hybi00.hpp.
|
inlinevirtual |
Retrieves the most recently processed message.
Retrieves a shared pointer to the recently completed message if there is one. If ready() returns true then there is a message available. Retrieving the message with get_message will reset the state of ready. As such, each new message may be retrieved only once. Calling get_message when there is no message available will result in a null pointer being returned.
Implements websocketpp::processor::processor< config >.
Definition at line 274 of file hybi00.hpp.
|
inlinevirtual |
Prepare a message for writing.
Performs validation, masking, compression, etc. will return an error if there was an error, otherwise msg will be ready to be written
Definition at line 286 of file hybi00.hpp.
|
inlinevirtual |
Calculate the appropriate response for this websocket request.
req | The request to process |
subprotocol | The subprotocol in use |
res | The response to store the processed response in |
Implements websocketpp::processor::processor< config >.
Definition at line 95 of file hybi00.hpp.
|
inlinevirtual |
Checks if there is a message ready.
Checks if the most recent consume operation processed enough bytes to complete a new WebSocket message. The message can be retrieved by calling get_message() which will reset the internal state to not-ready and allow consume to read more bytes.
Implements websocketpp::processor::processor< config >.
Definition at line 266 of file hybi00.hpp.
|
inlinevirtual |
validate a WebSocket handshake request for this version
request | The WebSocket handshake request to validate. is_websocket_handshake(request) must be true and get_websocket_version(request) must equal this->get_version(). |
Implements websocketpp::processor::processor< config >.
Definition at line 72 of file hybi00.hpp.
|
inlinevirtual |
Validate the server's response to an outgoing handshake request.
req | The original request sent |
res | The reponse to generate |
Implements websocketpp::processor::processor< config >.
Definition at line 151 of file hybi00.hpp.