1 | /* Copyright (C) 2010 Sergei Golubchik and Monty Program Ab |
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 as published by |
5 | the Free Software Foundation; version 2 of the License. |
6 | |
7 | This program is distributed in the hope that it will be useful, |
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 | GNU General Public License for more details. |
11 | |
12 | You should have received a copy of the GNU General Public License |
13 | along with this program; if not, write to the Free Software |
14 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ |
15 | |
16 | #define MYSQL_SERVER 1 |
17 | #include <my_global.h> |
18 | #include <sql_class.h> |
19 | |
20 | namespace feedback { |
21 | |
22 | int fill_feedback(THD *thd, TABLE_LIST *tables, COND *cond); |
23 | int fill_plugin_version(THD *thd, TABLE_LIST *tables); |
24 | int fill_misc_data(THD *thd, TABLE_LIST *tables); |
25 | int fill_linux_info(THD *thd, TABLE_LIST *tables); |
26 | int fill_collation_statistics(THD *thd, TABLE_LIST *tables); |
27 | |
28 | static const int SERVER_UID_SIZE= 29; |
29 | extern char server_uid_buf[SERVER_UID_SIZE+1], *user_info; |
30 | int calculate_server_uid(char *); |
31 | int prepare_linux_info(); |
32 | |
33 | extern ST_SCHEMA_TABLE *i_s_feedback; |
34 | |
35 | extern ulong send_timeout, send_retry_wait; |
36 | |
37 | pthread_handler_t background_thread(void *arg); |
38 | |
39 | /** |
40 | The class for storing urls to send report data to. |
41 | |
42 | Constructors are private, the object should be created with create() method. |
43 | send() method does the actual sending. |
44 | */ |
45 | class Url { |
46 | protected: |
47 | Url(LEX_STRING &url_arg) : full_url(url_arg) {} |
48 | const LEX_STRING full_url; |
49 | |
50 | public: |
51 | virtual ~Url() { my_free(full_url.str); } |
52 | |
53 | const char *url() { return full_url.str; } |
54 | size_t url_length() { return full_url.length; } |
55 | virtual int send(const char* data, size_t data_length) = 0; |
56 | virtual int set_proxy(const char *proxy, size_t proxy_len) |
57 | { |
58 | return 0; |
59 | } |
60 | |
61 | static Url* create(const char *url, size_t url_length); |
62 | static int parse_proxy_server(const char *proxy_server, size_t proxy_length, |
63 | LEX_STRING *host, LEX_STRING *port); |
64 | }; |
65 | |
66 | extern Url **urls; |
67 | extern uint url_count; |
68 | |
69 | extern ulong startup_interval; |
70 | extern ulong first_interval; |
71 | extern ulong interval; |
72 | |
73 | /* these are used to communicate with the background thread */ |
74 | extern mysql_mutex_t sleep_mutex; |
75 | extern mysql_cond_t sleep_condition; |
76 | extern volatile bool shutdown_plugin; |
77 | |
78 | } // namespace feedback |
79 | |
80 | |