Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 08:28:02

0001 //
0002 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/beast
0008 //
0009 
0010 #ifndef BOOST_BEAST_HTTP_STATUS_HPP
0011 #define BOOST_BEAST_HTTP_STATUS_HPP
0012 
0013 #include <boost/beast/core/detail/config.hpp>
0014 #include <boost/beast/core/string.hpp>
0015 #include <iosfwd>
0016 
0017 namespace boost {
0018 namespace beast {
0019 namespace http {
0020 
0021 enum class status : unsigned
0022 {
0023     /** An unknown status-code.
0024 
0025         This value indicates that the value for the status code
0026         is not in the list of commonly recognized status codes.
0027         Callers interested in the exactly value should use the
0028         interface which provides the raw integer.
0029     */
0030     unknown = 0,
0031 
0032     continue_                           = 100,
0033 
0034     /** Switching Protocols
0035 
0036         This status indicates that a request to switch to a new
0037         protocol was accepted and applied by the server. A successful
0038         response to a WebSocket Upgrade HTTP request will have this
0039         code.
0040     */
0041     switching_protocols                 = 101,
0042     processing                          = 102,
0043     early_hints                         = 103,
0044 
0045     ok                                  = 200,
0046     created                             = 201,
0047     accepted                            = 202,
0048     non_authoritative_information       = 203,
0049     no_content                          = 204,
0050     reset_content                       = 205,
0051     partial_content                     = 206,
0052     multi_status                        = 207,
0053     already_reported                    = 208,
0054     im_used                             = 226,
0055 
0056     multiple_choices                    = 300,
0057     moved_permanently                   = 301,
0058     found                               = 302,
0059     see_other                           = 303,
0060     not_modified                        = 304,
0061     use_proxy                           = 305,
0062     temporary_redirect                  = 307,
0063     permanent_redirect                  = 308,
0064 
0065     bad_request                         = 400,
0066     unauthorized                        = 401,
0067     payment_required                    = 402,
0068     forbidden                           = 403,
0069     not_found                           = 404,
0070     method_not_allowed                  = 405,
0071     not_acceptable                      = 406,
0072     proxy_authentication_required       = 407,
0073     request_timeout                     = 408,
0074     conflict                            = 409,
0075     gone                                = 410,
0076     length_required                     = 411,
0077     precondition_failed                 = 412,
0078     payload_too_large                   = 413,
0079     uri_too_long                        = 414,
0080     unsupported_media_type              = 415,
0081     range_not_satisfiable               = 416,
0082     expectation_failed                  = 417,
0083     i_am_a_teapot                       = 418,
0084     misdirected_request                 = 421,
0085     unprocessable_entity                = 422,
0086     locked                              = 423,
0087     failed_dependency                   = 424,
0088     too_early                           = 425,
0089     upgrade_required                    = 426,
0090     precondition_required               = 428,
0091     too_many_requests                   = 429,
0092     request_header_fields_too_large     = 431,
0093     unavailable_for_legal_reasons       = 451,
0094 
0095     internal_server_error               = 500,
0096     not_implemented                     = 501,
0097     bad_gateway                         = 502,
0098     service_unavailable                 = 503,
0099     gateway_timeout                     = 504,
0100     http_version_not_supported          = 505,
0101     variant_also_negotiates             = 506,
0102     insufficient_storage                = 507,
0103     loop_detected                       = 508,
0104     not_extended                        = 510,
0105     network_authentication_required     = 511
0106 };
0107 
0108 /** Represents the class of a status-code.
0109 */
0110 enum class status_class : unsigned
0111 {
0112     /// Unknown status-class
0113     unknown = 0,
0114 
0115     /// The request was received, continuing processing.
0116     informational = 1,
0117 
0118     /// The request was successfully received, understood, and accepted.
0119     successful = 2,
0120 
0121     /// Further action needs to be taken in order to complete the request.
0122     redirection = 3,
0123 
0124     /// The request contains bad syntax or cannot be fulfilled.
0125     client_error = 4,
0126 
0127     /// The server failed to fulfill an apparently valid request.
0128     server_error = 5,
0129 };
0130 
0131 /** Converts the integer to a known status-code.
0132 
0133     If the integer does not match a known status code,
0134     @ref status::unknown is returned.
0135 */
0136 BOOST_BEAST_DECL
0137 status
0138 int_to_status(unsigned v);
0139 
0140 /** Convert an integer to a status_class.
0141 
0142     @param v The integer representing a status code.
0143 
0144     @return The status class. If the integer does not match
0145     a known status class, @ref status_class::unknown is returned.
0146 */
0147 BOOST_BEAST_DECL
0148 status_class
0149 to_status_class(unsigned v);
0150 
0151 /** Convert a status_code to a status_class.
0152 
0153     @param v The status code to convert.
0154 
0155     @return The status class.
0156 */
0157 BOOST_BEAST_DECL
0158 status_class
0159 to_status_class(status v);
0160 
0161 /** Returns the obsolete reason-phrase text for a status code.
0162 
0163     @param v The status code to use.
0164 */
0165 BOOST_BEAST_DECL
0166 string_view
0167 obsolete_reason(status v);
0168 
0169 /// Outputs the standard reason phrase of a status code to a stream.
0170 BOOST_BEAST_DECL
0171 std::ostream&
0172 operator<<(std::ostream&, status);
0173 
0174 } // http
0175 } // beast
0176 } // boost
0177 
0178 #ifdef BOOST_BEAST_HEADER_ONLY
0179 #include <boost/beast/http/impl/status.ipp>
0180 #endif
0181 
0182 #endif