// // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Official repository: https://github.com/boostorg/url // #ifndef BOOST_URL_SCHEME_HPP #define BOOST_URL_SCHEME_HPP #include #include #include namespace boost { namespace urls { /* VFALCO NOTE The formatting of javadocs for enums is the way it is to work around an output bug in Doxygen! */ /** Identifies a known URL scheme @par Specification @li 3.1. Scheme (rfc3986) */ // Made this short so it doesn't // show up as an ascii character enum class scheme : unsigned short { /** Indicates that no scheme is present */ none = 0, /** Indicates the scheme is not a well-known scheme */ unknown, /** * File Transfer Protocol (FTP) FTP is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network. @par Specification @li The 'ftp' URI Scheme */ ftp, /** * File URI Scheme The File URI Scheme is typically used to retrieve files from within one's own computer. @par Specification @li The "file" URI Scheme (rfc8089) */ file, /** * The Hypertext Transfer Protocol URI Scheme URLs of this type indicate a resource which is interacted with using the HTTP protocol. @par Specification @li Hypertext Transfer Protocol (HTTP/1.1) (rfc7230) */ http, /** * The Secure Hypertext Transfer Protocol URI Scheme URLs of this type indicate a resource which is interacted with using the Secure HTTP protocol. @par Specification @li Hypertext Transfer Protocol (HTTP/1.1) (rfc7230) */ https, /** * The WebSocket URI Scheme URLs of this type indicate a resource which is interacted with using the WebSocket protocol. @par Specification @li The WebSocket Protocol (rfc6455) */ ws, /** * The Secure WebSocket URI Scheme URLs of this type indicate a resource which is interacted with using the Secure WebSocket protocol. @par Specification @li The WebSocket Protocol (rfc6455) */ wss }; /** Return the known scheme for a non-normalized string, if known If the string does not identify a known scheme, the value @ref scheme::unknown is returned. @par BNF @code scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) @endcode @return The known scheme @param s The string holding the scheme @par Specification @li 3.1. Scheme (rfc3986) */ BOOST_URL_DECL scheme string_to_scheme(string_view s) noexcept; /** Return the normalized string for a known scheme @return A string representing the known scheme @param s The known scheme constant */ BOOST_URL_DECL string_view to_string(scheme s) noexcept; /** Return the default port for a known scheme This function returns the default port for the known schemes. If the value does not represent a known scheme or the scheme does not represent a protocol, the function returns zero. The following ports are returned by the function: @li @ref scheme::ftp = 21 @li @ref scheme::http, @ref scheme::ws = 80 @li @ref scheme::https, @ref scheme::wss = 443 @return An integer with the default port number @param s The known scheme constant */ BOOST_URL_DECL std::uint16_t default_port(scheme s) noexcept; } // urls } // boost #endif