|
||||
File indexing completed on 2025-01-18 09:53:29
0001 // 0002 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.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/url 0008 // 0009 0010 #ifndef BOOST_URL_SCHEME_HPP 0011 #define BOOST_URL_SCHEME_HPP 0012 0013 #include <boost/url/detail/config.hpp> 0014 #include <boost/core/detail/string_view.hpp> 0015 #include <cinttypes> 0016 0017 namespace boost { 0018 namespace urls { 0019 0020 /* VFALCO NOTE The formatting of javadocs 0021 for enums is the way it is 0022 to work around an output bug in Doxygen! 0023 */ 0024 0025 /** Identifies a known URL scheme 0026 0027 @par Specification 0028 @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.1" 0029 >3.1. Scheme (rfc3986)</a> 0030 */ 0031 // Made this short so it doesn't 0032 // show up as an ascii character 0033 enum class scheme : unsigned short 0034 { 0035 /** Indicates that no scheme is present 0036 */ 0037 none = 0, 0038 0039 /** Indicates the scheme is not a well-known scheme 0040 */ 0041 unknown, 0042 0043 /** 0044 * File Transfer Protocol (FTP) 0045 0046 FTP is a standard communication protocol 0047 used for the transfer of computer files 0048 from a server to a client on a computer 0049 network. 0050 0051 @par Specification 0052 @li <a href="https://datatracker.ietf.org/doc/html/draft-yevstifeyev-ftp-uri-scheme"> 0053 The 'ftp' URI Scheme</a> 0054 */ 0055 ftp, 0056 0057 /** 0058 * File URI Scheme 0059 0060 The File URI Scheme is typically used 0061 to retrieve files from within one's 0062 own computer. 0063 0064 @par Specification 0065 @li <a href="https://datatracker.ietf.org/doc/html/rfc8089"> 0066 The "file" URI Scheme (rfc8089)</a> 0067 */ 0068 file, 0069 0070 /** 0071 * The Hypertext Transfer Protocol URI Scheme 0072 0073 URLs of this type indicate a resource which 0074 is interacted with using the HTTP protocol. 0075 0076 @par Specification 0077 @li <a href="https://datatracker.ietf.org/doc/html/rfc7230"> 0078 Hypertext Transfer Protocol (HTTP/1.1) (rfc7230)</a> 0079 */ 0080 http, 0081 0082 /** 0083 * The Secure Hypertext Transfer Protocol URI Scheme 0084 0085 URLs of this type indicate a resource which 0086 is interacted with using the Secure HTTP 0087 protocol. 0088 0089 @par Specification 0090 @li <a href="https://datatracker.ietf.org/doc/html/rfc7230"> 0091 Hypertext Transfer Protocol (HTTP/1.1) (rfc7230)</a> 0092 */ 0093 https, 0094 0095 /** 0096 * The WebSocket URI Scheme 0097 0098 URLs of this type indicate a resource which 0099 is interacted with using the WebSocket protocol. 0100 0101 @par Specification 0102 @li <a href="https://datatracker.ietf.org/doc/html/rfc6455"> 0103 The WebSocket Protocol (rfc6455)</a> 0104 */ 0105 ws, 0106 0107 /** 0108 * The Secure WebSocket URI Scheme 0109 0110 URLs of this type indicate a resource which 0111 is interacted with using the Secure WebSocket 0112 protocol. 0113 0114 @par Specification 0115 @li <a href="https://datatracker.ietf.org/doc/html/rfc6455"> 0116 The WebSocket Protocol (rfc6455)</a> 0117 */ 0118 wss 0119 }; 0120 0121 /** Return the known scheme for a non-normalized string, if known 0122 0123 If the string does not identify a known 0124 scheme, the value @ref scheme::unknown is 0125 returned. 0126 0127 @par BNF 0128 @code 0129 scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) 0130 @endcode 0131 0132 @return The known scheme 0133 0134 @param s The string holding the scheme 0135 0136 @par Specification 0137 @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.1" 0138 >3.1. Scheme (rfc3986)</a> 0139 */ 0140 BOOST_URL_DECL 0141 scheme 0142 string_to_scheme(core::string_view s) noexcept; 0143 0144 /** Return the normalized string for a known scheme 0145 0146 @return A string representing the known scheme 0147 0148 @param s The known scheme constant 0149 */ 0150 BOOST_URL_DECL 0151 core::string_view 0152 to_string(scheme s) noexcept; 0153 0154 /** Return the default port for a known scheme 0155 0156 This function returns the default port 0157 for the known schemes. If the value does 0158 not represent a known scheme or the scheme 0159 does not represent a protocol, the function 0160 returns zero. 0161 0162 The following ports are returned by the 0163 function: 0164 0165 @li @ref scheme::ftp = 21 0166 @li @ref scheme::http, @ref scheme::ws = 80 0167 @li @ref scheme::https, @ref scheme::wss = 443 0168 0169 @return An integer with the default port number 0170 0171 @param s The known scheme constant 0172 */ 0173 BOOST_URL_DECL 0174 std::uint16_t 0175 default_port(scheme s) noexcept; 0176 0177 } // urls 0178 } // boost 0179 0180 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |