![]() |
|
|||
File indexing completed on 2025-07-12 08:21:18
0001 // 0002 // Copyright (c) 2019-2024 Ruben Perez Hidalgo (rubenperez038 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 0008 #ifndef BOOST_MYSQL_IMPL_INTERNAL_PROTOCOL_CAPABILITIES_HPP 0009 #define BOOST_MYSQL_IMPL_INTERNAL_PROTOCOL_CAPABILITIES_HPP 0010 0011 #include <boost/config.hpp> 0012 0013 #include <cstdint> 0014 0015 namespace boost { 0016 namespace mysql { 0017 namespace detail { 0018 0019 // Server/client capabilities 0020 // clang-format off 0021 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_LONG_PASSWORD = 1; // Use the improved version of Old Password Authentication 0022 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_FOUND_ROWS = 2; // Send found rows instead of affected rows in EOF_Packet 0023 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_LONG_FLAG = 4; // Get all column flags 0024 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_CONNECT_WITH_DB = 8; // Database (schema) name can be specified on connect in Handshake Response Packet 0025 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_NO_SCHEMA = 16; // Don't allow database.table.column 0026 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_COMPRESS = 32; // Compression protocol supported 0027 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_ODBC = 64; // Special handling of ODBC behavior 0028 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_LOCAL_FILES = 128; // Can use LOAD DATA LOCAL 0029 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_IGNORE_SPACE = 256; // Ignore spaces before '(' 0030 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_PROTOCOL_41 = 512; // New 4.1 protocol 0031 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_INTERACTIVE = 1024; // This is an interactive client 0032 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_SSL = 2048; // Use SSL encryption for the session 0033 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_IGNORE_SIGPIPE = 4096; // Client only flag 0034 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_TRANSACTIONS = 8192; // Client knows about transactions 0035 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_RESERVED = 16384; // DEPRECATED: Old flag for 4.1 protocol 0036 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_SECURE_CONNECTION = 32768; // DEPRECATED: Old flag for 4.1 authentication, required by MariaDB 0037 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_MULTI_STATEMENTS = (1UL << 16); // Enable/disable multi-stmt support 0038 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_MULTI_RESULTS = (1UL << 17); // Enable/disable multi-results 0039 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_PS_MULTI_RESULTS = (1UL << 18); // Multi-results and OUT parameters in PS-protocol 0040 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_PLUGIN_AUTH = (1UL << 19); // Client supports plugin authentication 0041 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_CONNECT_ATTRS = (1UL << 20); // Client supports connection attributes 0042 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA = (1UL << 21); // Enable authentication response packet to be larger than 255 bytes 0043 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS = (1UL << 22); // Don't close the connection for a user account with expired password 0044 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_SESSION_TRACK = (1UL << 23); // Capable of handling server state change information 0045 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_DEPRECATE_EOF = (1UL << 24); // Client no longer needs EOF_Packet and will use OK_Packet instead 0046 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_SSL_VERIFY_SERVER_CERT = (1UL << 30); // Verify server certificate 0047 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_OPTIONAL_RESULTSET_METADATA = (1UL << 25); // The client can handle optional metadata information in the resultset 0048 BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_REMEMBER_OPTIONS = (1UL << 31); // Don't reset the options after an unsuccessful connect 0049 // clang-format on 0050 0051 class capabilities 0052 { 0053 std::uint32_t value_; 0054 0055 public: 0056 constexpr explicit capabilities(std::uint32_t value = 0) noexcept : value_(value){}; 0057 constexpr std::uint32_t get() const noexcept { return value_; } 0058 void set(std::uint32_t value) noexcept { value_ = value; } 0059 constexpr bool has(std::uint32_t cap) const noexcept { return value_ & cap; } 0060 constexpr bool has_all(capabilities other) const noexcept 0061 { 0062 return (value_ & other.get()) == other.get(); 0063 } 0064 constexpr capabilities operator|(capabilities rhs) const noexcept 0065 { 0066 return capabilities(value_ | rhs.value_); 0067 } 0068 constexpr capabilities operator&(capabilities rhs) const noexcept 0069 { 0070 return capabilities(value_ & rhs.value_); 0071 } 0072 constexpr bool operator==(const capabilities& rhs) const noexcept { return value_ == rhs.value_; } 0073 constexpr bool operator!=(const capabilities& rhs) const noexcept { return value_ != rhs.value_; } 0074 }; 0075 0076 /* 0077 * CLIENT_LONG_PASSWORD: unset // Use the improved version of Old Password Authentication 0078 * CLIENT_FOUND_ROWS: unset // Send found rows instead of affected rows in EOF_Packet 0079 * CLIENT_LONG_FLAG: unset // Get all column flags 0080 * CLIENT_CONNECT_WITH_DB: optional // Database (schema) name can be specified on connect in 0081 * Handshake Response Packet CLIENT_NO_SCHEMA: unset // Don't allow database.table.column 0082 * CLIENT_COMPRESS: unset // Compression protocol supported 0083 * CLIENT_ODBC: unset // Special handling of ODBC behavior 0084 * CLIENT_LOCAL_FILES: unset // Can use LOAD DATA LOCAL 0085 * CLIENT_IGNORE_SPACE: unset // Ignore spaces before '(' 0086 * CLIENT_PROTOCOL_41: mandatory // New 4.1 protocol 0087 * CLIENT_INTERACTIVE: unset // This is an interactive client 0088 * CLIENT_SSL: unset // Use SSL encryption for the session 0089 * CLIENT_IGNORE_SIGPIPE: unset // Client only flag 0090 * CLIENT_TRANSACTIONS: unset // Client knows about transactions 0091 * CLIENT_RESERVED: unset // DEPRECATED: Old flag for 4.1 protocol 0092 * CLIENT_RESERVED2: unset // DEPRECATED: Old flag for 4.1 authentication 0093 * \ CLIENT_SECURE_CONNECTION CLIENT_MULTI_STATEMENTS: unset // Enable/disable multi-stmt support 0094 * CLIENT_MULTI_RESULTS: unset // Enable/disable multi-results 0095 * CLIENT_PS_MULTI_RESULTS: unset // Multi-results and OUT parameters in PS-protocol 0096 * CLIENT_PLUGIN_AUTH: mandatory // Client supports plugin authentication 0097 * CLIENT_CONNECT_ATTRS: unset // Client supports connection attributes 0098 * CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA: mandatory // Enable authentication response packet to be 0099 * larger than 255 bytes CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS: unset // Don't close the connection 0100 * for a user account with expired password CLIENT_SESSION_TRACK: unset // Capable of handling 0101 * server state change information CLIENT_DEPRECATE_EOF: mandatory // Client no longer needs 0102 * EOF_Packet and will use OK_Packet instead CLIENT_SSL_VERIFY_SERVER_CERT: unset // Verify server 0103 * certificate CLIENT_OPTIONAL_RESULTSET_METADATA: unset // The client can handle optional metadata 0104 * information in the resultset CLIENT_REMEMBER_OPTIONS: unset // Don't reset the options after an 0105 * unsuccessful connect 0106 * 0107 * We pay attention to: 0108 * CLIENT_CONNECT_WITH_DB: optional // Database (schema) name can be specified on connect in 0109 * Handshake Response Packet CLIENT_PROTOCOL_41: mandatory // New 4.1 protocol CLIENT_PLUGIN_AUTH: 0110 * mandatory // Client supports plugin authentication CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA: 0111 * mandatory // Enable authentication response packet to be larger than 255 bytes 0112 * CLIENT_DEPRECATE_EOF: mandatory // Client no longer needs EOF_Packet and will use OK_Packet 0113 * instead 0114 */ 0115 0116 // clang-format off 0117 BOOST_INLINE_CONSTEXPR capabilities mandatory_capabilities{ 0118 CLIENT_PROTOCOL_41 | 0119 CLIENT_PLUGIN_AUTH | 0120 CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | 0121 CLIENT_DEPRECATE_EOF | 0122 CLIENT_SECURE_CONNECTION 0123 }; 0124 // clang-format on 0125 0126 BOOST_INLINE_CONSTEXPR capabilities optional_capabilities{CLIENT_MULTI_RESULTS | CLIENT_PS_MULTI_RESULTS}; 0127 0128 } // namespace detail 0129 } // namespace mysql 0130 } // namespace boost 0131 0132 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |