1 /*
2  * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License, version 2.0,
6  * as published by the Free Software Foundation.
7  *
8  * This program is also distributed with certain software (including
9  * but not limited to OpenSSL) that is licensed under separate terms,
10  * as designated in a particular file or component or in included license
11  * documentation.  The authors of MySQL hereby grant you an additional
12  * permission to link the program and your derivative works with the
13  * separately licensed software that they have included with MySQL.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License, version 2.0, for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
23  */
24 
25 // MySQL DB access module, for use by plugins and others
26 // For the module that implements interactive DB functionality see mod_db
27 
28 #ifndef PLUGIN_X_CLIENT_CONTEXT_XCONTEXT_H_
29 #define PLUGIN_X_CLIENT_CONTEXT_XCONTEXT_H_
30 
31 #include <cstring>
32 #include <string>
33 #include <vector>
34 
35 #include "plugin/x/client/context/xcompression_config.h"
36 #include "plugin/x/client/context/xconnection_config.h"
37 #include "plugin/x/client/context/xssl_config.h"
38 #include "plugin/x/client/mysqlxclient/xerror.h"
39 #include "plugin/x/client/mysqlxclient/xprotocol.h"
40 
41 namespace xcl {
42 
43 enum class Auth {
44   k_auto,
45   k_auto_fallback,
46   k_auto_from_capabilities,
47   k_mysql41,
48   k_plain,
49   k_sha256_memory
50 };
51 
52 class Context {
53  public:
54   Ssl_config m_ssl_config;
55   Connection_config m_connection_config;
56   Compression_config m_compression_config;
57   bool m_consume_all_notices{true};
58   XProtocol::Client_id m_client_id{XCL_CLIENT_ID_NOT_VALID};
59   XError m_global_error;
60   // Default value equal to lenght of DateTime when no time part is present
61   uint32_t m_datetime_length_discriminator = 10;
62   Internet_protocol m_internet_protocol{Internet_protocol::Any};
63   std::vector<Auth> m_use_auth_methods;
64 };
65 
66 }  // namespace xcl
67 
68 #endif  // PLUGIN_X_CLIENT_CONTEXT_XCONTEXT_H_
69