123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- #ifndef BOOST_MYSQL_IMPL_INTERNAL_PROTOCOL_CAPABILITIES_HPP
- #define BOOST_MYSQL_IMPL_INTERNAL_PROTOCOL_CAPABILITIES_HPP
- #include <boost/config.hpp>
- #include <cstdint>
- namespace boost {
- namespace mysql {
- namespace detail {
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_LONG_PASSWORD = 1;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_FOUND_ROWS = 2;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_LONG_FLAG = 4;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_CONNECT_WITH_DB = 8;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_NO_SCHEMA = 16;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_COMPRESS = 32;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_ODBC = 64;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_LOCAL_FILES = 128;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_IGNORE_SPACE = 256;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_PROTOCOL_41 = 512;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_INTERACTIVE = 1024;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_SSL = 2048;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_IGNORE_SIGPIPE = 4096;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_TRANSACTIONS = 8192;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_RESERVED = 16384;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_SECURE_CONNECTION = 32768;
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_MULTI_STATEMENTS = (1UL << 16);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_MULTI_RESULTS = (1UL << 17);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_PS_MULTI_RESULTS = (1UL << 18);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_PLUGIN_AUTH = (1UL << 19);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_CONNECT_ATTRS = (1UL << 20);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA = (1UL << 21);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS = (1UL << 22);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_SESSION_TRACK = (1UL << 23);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_DEPRECATE_EOF = (1UL << 24);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_SSL_VERIFY_SERVER_CERT = (1UL << 30);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_OPTIONAL_RESULTSET_METADATA = (1UL << 25);
- BOOST_INLINE_CONSTEXPR std::uint32_t CLIENT_REMEMBER_OPTIONS = (1UL << 31);
- class capabilities
- {
- std::uint32_t value_;
- public:
- constexpr explicit capabilities(std::uint32_t value = 0) noexcept : value_(value){};
- constexpr std::uint32_t get() const noexcept { return value_; }
- void set(std::uint32_t value) noexcept { value_ = value; }
- constexpr bool has(std::uint32_t cap) const noexcept { return value_ & cap; }
- constexpr bool has_all(capabilities other) const noexcept
- {
- return (value_ & other.get()) == other.get();
- }
- constexpr capabilities operator|(capabilities rhs) const noexcept
- {
- return capabilities(value_ | rhs.value_);
- }
- constexpr capabilities operator&(capabilities rhs) const noexcept
- {
- return capabilities(value_ & rhs.value_);
- }
- constexpr bool operator==(const capabilities& rhs) const noexcept { return value_ == rhs.value_; }
- constexpr bool operator!=(const capabilities& rhs) const noexcept { return value_ != rhs.value_; }
- };
- BOOST_INLINE_CONSTEXPR capabilities mandatory_capabilities{
- CLIENT_PROTOCOL_41 |
- CLIENT_PLUGIN_AUTH |
- CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA |
- CLIENT_DEPRECATE_EOF |
- CLIENT_SECURE_CONNECTION
- };
- BOOST_INLINE_CONSTEXPR capabilities optional_capabilities{CLIENT_MULTI_RESULTS | CLIENT_PS_MULTI_RESULTS};
- }
- }
- }
- #endif
|