123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- #ifndef BOOST_BEAST_WEBSOCKET_RFC6455_HPP
- #define BOOST_BEAST_WEBSOCKET_RFC6455_HPP
- #include <boost/beast/core/detail/config.hpp>
- #include <boost/beast/core/static_string.hpp>
- #include <boost/beast/core/string.hpp>
- #include <boost/beast/http/empty_body.hpp>
- #include <boost/beast/http/message.hpp>
- #include <boost/beast/http/string_body.hpp>
- #include <array>
- #include <cstdint>
- namespace boost {
- namespace beast {
- namespace websocket {
- using request_type = http::request<http::empty_body>;
- using response_type = http::response<http::string_body>;
- template<class Allocator>
- bool
- is_upgrade(beast::http::header<true,
- http::basic_fields<Allocator>> const& req);
- enum close_code : std::uint16_t
- {
-
- normal = 1000,
-
- going_away = 1001,
-
- protocol_error = 1002,
-
- unknown_data = 1003,
-
- bad_payload = 1007,
-
- policy_error = 1008,
-
- too_big = 1009,
-
- needs_extension = 1010,
-
- internal_error = 1011,
-
- service_restart = 1012,
-
- try_again_later = 1013,
-
-
-
-
-
- none = 0,
-
- reserved1 = 1004,
-
- no_status = 1005,
-
- abnormal = 1006,
-
- reserved2 = 1014,
-
- reserved3 = 1015
-
-
-
- };
- using reason_string = static_string<123, char>;
- using ping_data = static_string<125, char>;
- struct close_reason
- {
-
- std::uint16_t code = close_code::none;
-
- reason_string reason;
-
- close_reason() = default;
-
- close_reason(std::uint16_t code_)
- : code(code_)
- {
- }
-
- close_reason(string_view s)
- : code(close_code::normal)
- , reason(s.data(), s.size())
- {
- }
-
- close_reason(char const* s)
- : code(close_code::normal)
- , reason(s)
- {
- }
-
- close_reason(close_code code_, string_view s)
- : code(code_)
- , reason(s.data(), s.size())
- {
- }
-
- operator bool() const
- {
- return code != close_code::none;
- }
- };
- }
- }
- }
- #include <boost/beast/websocket/impl/rfc6455.hpp>
- #endif
|