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