WebSocket++
0.8.3-dev
C++ websocket client/server library
|
Go to the documentation of this file.
29 #ifndef WEBSOCKETPP_CLOSE_HPP
30 #define WEBSOCKETPP_CLOSE_HPP
36 #include <websocketpp/error.hpp>
37 #include <websocketpp/common/network.hpp>
38 #include <websocketpp/common/stdint.hpp>
39 #include <websocketpp/utf8_validator.hpp>
235 return "Normal close";
239 return "Protocol error";
240 case unsupported_data:
241 return "Unsupported data";
243 return "No status set";
245 return "Abnormal close";
246 case invalid_payload:
247 return "Invalid payload";
248 case policy_violation:
249 return "Policy violoation";
250 case message_too_big:
251 return "Message too big";
252 case extension_required:
253 return "Extension required";
254 case internal_endpoint_error:
255 return "Internal endpoint error";
256 case service_restart:
257 return "Service restart";
258 case try_again_later:
259 return "Try again later";
261 return "Bad gateway";
263 return "TLS handshake failure";
264 case subprotocol_error:
265 return "Generic subprotocol error";
266 case invalid_subprotocol_data:
267 return "Invalid subprotocol data";
297 ec = lib::error_code();
299 if (payload.size() == 0) {
301 }
else if (payload.size() == 1) {
302 ec = make_error_code(error::bad_close_code);
308 val.c[0] = payload[0];
309 val.c[1] = payload[1];
314 ec = make_error_code(error::invalid_close_code);
318 ec = make_error_code(error::reserved_close_code);
337 ec = lib::error_code();
339 if (payload.size() > 2) {
340 reason.append(payload.begin()+2,payload.end());
343 if (!websocketpp::utf8_validator::validate(reason)) {
344 ec = make_error_code(error::invalid_utf8);
static value const blank
A blank value for internal use.
Type used to convert close statuses between integer and wire representations.
static value const protocol_error
A protocol error occurred.
static value const extension_required
A client expected the server to accept a required extension request.
static value const try_again_later
static value const subprotocol_error
A generic subprotocol error.
static value const invalid_payload
An endpoint received message data inconsistent with its type.
bool invalid(value code)
Test whether a close code is invalid on the wire.
static value const bad_gateway
static value const normal
static value const policy_violation
An endpoint received a message that violated its policy.
uint16_t value
The type of a close code value.
status::value extract_code(std::string const &payload, lib::error_code &ec)
Extract a close code value from a close payload.
static value const invalid_low
First value in range that is always invalid on the wire.
static value const invalid_high
Last value in range that is always invalid on the wire.
static value const tls_handshake
An endpoint failed to perform a TLS handshake.
static value const unsupported_data
bool reserved(value code)
Test whether a close code is in a reserved range.
static value const invalid_subprotocol_data
A invalid subprotocol data.
static std::vector< int > const versions_supported(helper, helper+4)
Container that stores the list of protocol versions supported.
A package of types and methods for manipulating WebSocket close codes.
std::string extract_reason(std::string const &payload, lib::error_code &ec)
Extract the reason string from a close payload.
std::string get_string(value code)
Return a human readable interpretation of a WebSocket close code.
A package of types and methods for manipulating WebSocket close status'.
static value const rsv_start
First value in range reserved for future protocol use.
static value const service_restart
static value const abnormal_close
A dummy value to indicate that the connection was closed abnormally.
static value const going_away
static value const omit_handshake
Close the connection without a WebSocket close handshake.
static value const rsv_end
Last value in range reserved for future protocol use.
static value const no_status
A dummy value to indicate that no status code was received.
static value const message_too_big
An endpoint received a message too large to process.
static value const force_tcp_drop
Close the connection with a forced TCP drop.
bool terminal(value code)
Determine if the code represents an unrecoverable error.
static value const internal_endpoint_error