Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
websocketpp::close::status Namespace Reference

A package of types and methods for manipulating WebSocket close status'.

Typedefs

typedef uint16_t value
 The type of a close code value.
 

Functions

bool reserved (value code)
 Test whether a close code is in a reserved range.
 
bool invalid (value code)
 Test whether a close code is invalid on the wire.
 
bool terminal (value code)
 Determine if the code represents an unrecoverable error.
 
std::string get_string (value code)
 Return a human readable interpretation of a WebSocket close code.
 

Typedef Documentation

◆ value

Definition at line 49 of file close.hpp.

Function Documentation

◆ get_string()

std::string websocketpp::close::status::get_string ( value code)
inline

See https://tools.ietf.org/html/rfc6455#section-7.4 for more details.

Since
0.3.0
Parameters
[in]codeThe code to look up.
Returns
A human readable interpretation of the code.

Definition at line 227 of file close.hpp.

227 {
228 switch (code) {
229 case normal:
230 return "Normal close";
231 case going_away:
232 return "Going away";
233 case protocol_error:
234 return "Protocol error";
235 case unsupported_data:
236 return "Unsupported data";
237 case no_status:
238 return "No status set";
239 case abnormal_close:
240 return "Abnormal close";
241 case invalid_payload:
242 return "Invalid payload";
243 case policy_violation:
244 return "Policy violoation";
245 case message_too_big:
246 return "Message too big";
247 case extension_required:
248 return "Extension required";
249 case internal_endpoint_error:
250 return "Internal endpoint error";
251 case tls_handshake:
252 return "TLS handshake failure";
253 case subprotocol_error:
254 return "Generic subprotocol error";
255 case invalid_subprotocol_data:
256 return "Invalid subprotocol data";
257 default:
258 return "Unknown";
259 }
260 }
Here is the caller graph for this function:

◆ invalid()

bool websocketpp::close::status::invalid ( value code)
inline
Parameters
[in]codeThe code to test
Returns
Whether or not code is invalid on the wire

Definition at line 194 of file close.hpp.

194 {
195 return (code <= invalid_low || code >= invalid_high ||
196 code == no_status || code == abnormal_close ||
197 code == tls_handshake);
198 }
Here is the caller graph for this function:

◆ reserved()

bool websocketpp::close::status::reserved ( value code)
inline
Parameters
[in]codeThe code to test
Returns
Whether or not code is reserved

Definition at line 179 of file close.hpp.

179 {
180 return ((code >= rsv_start && code <= rsv_end) ||
181 code == 1004 || code == 1014);
182 }
Here is the caller graph for this function:

◆ terminal()

bool websocketpp::close::status::terminal ( value code)
inline

There is a class of errors for which once they are discovered normal WebSocket functionality can no longer occur. This function determines if a given code is one of these values. This information is used to determine if the system has the capability of waiting for a close acknowledgement or if it should drop the TCP connection immediately after sending its close frame.

Parameters
[in]codeThe value to test.
Returns
True if the code represents an unrecoverable error

Definition at line 212 of file close.hpp.

212 {
213 return (code == protocol_error || code == invalid_payload ||
214 code == policy_violation || code == message_too_big ||
215 code == internal_endpoint_error);
216 }
Here is the caller graph for this function: