RESTinio
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
message.hpp File Reference
#include <functional>
#include <restinio/utils/impl/bitops.hpp>

Go to the source code of this file.

Classes

class  restinio::websocket::basic::message_t
 WebSocket message. More...
 

Namespaces

namespace  restinio
 
namespace  restinio::websocket
 
namespace  restinio::websocket::basic
 

Macros

#define RESTINIO_WEBSOCKET_OPCODES_MAP(RESTINIO_GEN)
 
#define RESTINIO_WEBSOCKET_OPCODES_GEN(name, code)   name = code,
 
#define RESTINIO_WEBSOCKET_OPCODES_GEN(name, code)    case opcode_t::name: result = #name; break;
 
#define RESTINIO_WEBSOCKET_OPCODES_GEN(name, code)    case opcode_t::name: break;
 

Typedefs

using restinio::websocket::basic::message_handle_t = std::shared_ptr< message_t >
 Request handler, that is the type for calling request handlers. More...
 
using restinio::websocket::basic::default_message_handler_t = std::function< void(message_handle_t) >
 

Enumerations

enum class  restinio::websocket::basic::opcode_t : std::uint8_t { restinio::websocket::basic::RESTINIO_WEBSOCKET_OPCODES_GEN , restinio::websocket::basic::unknown_frame = 0x0F }
 
enum class  restinio::websocket::basic::status_code_t : std::uint16_t {
  restinio::websocket::basic::normal_closure = 1000 , restinio::websocket::basic::going_away = 1001 , restinio::websocket::basic::protocol_error = 1002 , restinio::websocket::basic::cant_accept_data = 1003 ,
  restinio::websocket::basic::no_status_provided = 1005 , restinio::websocket::basic::connection_lost = 1006 , restinio::websocket::basic::invalid_message_data = 1007 , restinio::websocket::basic::policy_violation = 1008 ,
  restinio::websocket::basic::too_big_message = 1009 , restinio::websocket::basic::more_extensions_expected = 1010 , restinio::websocket::basic::unexpected_condition = 1011
}
 
enum class  restinio::websocket::basic::final_frame_flag_t : std::uint8_t { restinio::websocket::basic::final_frame , restinio::websocket::basic::not_final_frame }
 WS frame (message) "final"/"not final" flag. More...
 

Functions

const char * restinio::websocket::basic::opcode_to_string (opcode_t opcode)
 Helper sunction to get method string name. More...
 
bool restinio::websocket::basic::is_valid_opcode (opcode_t opcode)
 
std::string restinio::websocket::basic::status_code_to_bin (status_code_t code)
 
status_code_t restinio::websocket::basic::status_code_from_bin (string_view_t data)
 

Variables

constexpr final_frame_flag_t restinio::websocket::basic::final_frame = final_frame_flag_t::final_frame
 
constexpr final_frame_flag_t restinio::websocket::basic::not_final_frame = final_frame_flag_t::not_final_frame
 

Macro Definition Documentation

◆ RESTINIO_WEBSOCKET_OPCODES_GEN [1/3]

#define RESTINIO_WEBSOCKET_OPCODES_GEN (   name,
  code 
)    name = code,

Definition at line 38 of file message.hpp.

◆ RESTINIO_WEBSOCKET_OPCODES_GEN [2/3]

#define RESTINIO_WEBSOCKET_OPCODES_GEN (   name,
  code 
)     case opcode_t::name: result = #name; break;

Definition at line 38 of file message.hpp.

◆ RESTINIO_WEBSOCKET_OPCODES_GEN [3/3]

#define RESTINIO_WEBSOCKET_OPCODES_GEN (   name,
  code 
)     case opcode_t::name: break;

Definition at line 38 of file message.hpp.

◆ RESTINIO_WEBSOCKET_OPCODES_MAP

#define RESTINIO_WEBSOCKET_OPCODES_MAP (   RESTINIO_GEN)
Value:
RESTINIO_GEN( continuation_frame, 0x00 ) \
RESTINIO_GEN( text_frame, 0x01 ) \
RESTINIO_GEN( binary_frame, 0x02 ) \
RESTINIO_GEN( connection_close_frame, 0x08 ) \
RESTINIO_GEN( ping_frame, 0x09 ) \
RESTINIO_GEN( pong_frame, 0x0A )

Definition at line 24 of file message.hpp.