1 /* Copyright (c) 2016, 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 CONNECTION_CONTROL_DATA_H
24 #define CONNECTION_CONTROL_DATA_H
25 
26 #include <my_global.h>
27 
28 /**
29   Enum for system variables : Must be in sync with
30   members of Connection_control_variables.
31 */
32 typedef enum opt_connection_control
33 {
34   OPT_FAILED_CONNECTIONS_THRESHOLD= 0,
35   OPT_MIN_CONNECTION_DELAY,
36   OPT_MAX_CONNECTION_DELAY,
37   OPT_LAST /* Must be last */
38 }opt_connection_control;
39 
40 /**
41   Enum for status variables : Must be in sync with
42   memebers of Connection_control_statistics.
43 */
44 typedef enum stats_connection_control
45 {
46   STAT_CONNECTION_DELAY_TRIGGERED= 0,
47   STAT_LAST /* Must be last */
48 }stats_connection_control;
49 
50 namespace connection_control
51 {
52   /** Structure to maintain system variables */
53   class Connection_control_variables
54   {
55   public:
56     /* Various global variables */
57     int64 failed_connections_threshold;
58     int64 min_connection_delay;
59     int64 max_connection_delay;
60   };
61 
62   /** Structure to maintain statistics */
63   class Connection_control_statistics
64   {
65   public:
Connection_control_statistics()66     Connection_control_statistics()
67     {}
68     /* Various statistics to be collected */
69     volatile int64 stats_array[STAT_LAST];
70   };
71 }
72 
73 extern connection_control::Connection_control_statistics g_statistics;
74 extern connection_control::Connection_control_variables g_variables;
75 #endif // !CONNECTION_CONTROL_DATA_H
76