1 /* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 #ifndef MYSQL_VERSION_GCS_PROTOCOL_MAP_INCLUDE
24 #define MYSQL_VERSION_GCS_PROTOCOL_MAP_INCLUDE
25 
26 #include "plugin/group_replication/include/member_version.h"
27 #include "plugin/group_replication/libmysqlgcs/include/mysql/gcs/gcs_types.h"
28 
29 /**
30  * Converts the given GCS protocol version into the respective MySQL version.
31  *
32  * @param gcs_protocol The GCS protocol to convert
33  * @returns the respective MySQL version as a Member_version object
34  */
35 Member_version convert_to_mysql_version(
36     Gcs_protocol_version const &gcs_protocol);
37 
38 /** Maps GCS protocol version to MySQL version. */
39 /**
40  * Converts the @c mysql_version into the respective GCS protocol, taking into
41  * account this server's version @c my_version.
42  *
43  * @param mysql_version The MySQL version to convert
44  * @param my_version The MySQL version of this server
45  * @returns the respective GCS protocol version
46  */
47 Gcs_protocol_version convert_to_gcs_protocol(
48     Member_version const &mysql_version, Member_version const &my_version);
49 
50 /**
51  * Checks whether the given C-style string has the version format
52  * "major.minor.patch".
53  *
54  * @param version_str the string to validate
55  * @retval true if valid
56  * @retval false otherwise
57  */
58 bool valid_mysql_version_string(char const *version_str);
59 
60 /**
61  * Converts a "major.minor.patch" C-style string to a Member_version object.
62  *
63  * Requires that version_str is a valid_mysql_version_string.
64  *
65  * @param version_str the string to convert
66  * @returns the version string as a Member_version object
67  */
68 Member_version convert_to_member_version(char const *version_str);
69 
70 #endif /* MYSQL_VERSION_GCS_PROTOCOL_MAP_INCLUDE */
71