971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
1337.4.1
by Eric Day
Removed unused functions and extra complexity in MySQL module. Not rewriting any code here (yet?), just reshuffling to make it easier to manage. |
20 |
#ifndef PLUGIN_MYSQL_PROTOCOL_MYSQL_PROTOCOL_H
|
21 |
#define PLUGIN_MYSQL_PROTOCOL_MYSQL_PROTOCOL_H
|
|
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
22 |
|
23 |
#include <drizzled/plugin/listen_tcp.h> |
|
24 |
#include <drizzled/plugin/client.h> |
|
1726.3.4
by LinuxJedi
Add a data_dictionary table for the MySQL protocol plugin |
25 |
#include <drizzled/atomics.h> |
26 |
#include "drizzled/plugin/table_function.h" |
|
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
27 |
|
28 |
#include "net_serv.h" |
|
29 |
||
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
30 |
namespace drizzle_plugin |
31 |
{
|
|
1960.2.6
by Andrew Hutchings
Add ip address limitation for admin connections |
32 |
void compose_ip_addresses(std::vector<std::string> options); |
33 |
||
1953.2.6
by Andrew Hutchings
Completely redo max-connections so it is independant per-protocol. Also make counters independant |
34 |
class ProtocolCounters |
35 |
{
|
|
36 |
public: |
|
37 |
ProtocolCounters(): |
|
38 |
max_connections(1000) |
|
39 |
{ } |
|
40 |
drizzled::atomic<uint64_t> connectionCount; |
|
1960.2.5
by Andrew Hutchings
Fix counters |
41 |
drizzled::atomic<uint64_t> adminConnectionCount; |
1953.2.6
by Andrew Hutchings
Completely redo max-connections so it is independant per-protocol. Also make counters independant |
42 |
drizzled::atomic<uint64_t> failedConnections; |
43 |
drizzled::atomic<uint64_t> connected; |
|
1960.2.5
by Andrew Hutchings
Fix counters |
44 |
drizzled::atomic<uint64_t> adminConnected; |
1953.2.6
by Andrew Hutchings
Completely redo max-connections so it is independant per-protocol. Also make counters independant |
45 |
uint32_t max_connections; |
46 |
};
|
|
1953.2.2
by Andrew Hutchings
Add Drizzle protocol support for max-connections (shared with MySQL protocol for now as other stats are shared) |
47 |
|
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
48 |
typedef drizzled::constrained_check<uint32_t, 300, 1> timeout_constraint; |
49 |
typedef drizzled::constrained_check<uint32_t, 300, 1> retry_constraint; |
|
50 |
typedef drizzled::constrained_check<uint32_t, 1048576, 1024, 1024> buffer_constraint; |
|
51 |
||
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
52 |
class ListenMySQLProtocol: public drizzled::plugin::ListenTcp |
53 |
{
|
|
1960.2.6
by Andrew Hutchings
Add ip address limitation for admin connections |
54 |
protected: |
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
55 |
const std::string _hostname; |
56 |
bool _using_mysql41_protocol; |
|
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
57 |
|
58 |
public: |
|
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
59 |
ListenMySQLProtocol(std::string name, |
60 |
const std::string &hostname, |
|
61 |
bool using_mysql41_protocol): |
|
62 |
drizzled::plugin::ListenTcp(name), |
|
63 |
_hostname(hostname), |
|
64 |
_using_mysql41_protocol(using_mysql41_protocol) |
|
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
65 |
{ } |
1666.4.19
by Monty Taylor
Free strdup'd option strings. |
66 |
virtual ~ListenMySQLProtocol(); |
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
67 |
virtual const std::string getHost(void) const; |
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
68 |
virtual in_port_t getPort(void) const; |
69 |
virtual drizzled::plugin::Client *getClient(int fd); |
|
1953.2.6
by Andrew Hutchings
Completely redo max-connections so it is independant per-protocol. Also make counters independant |
70 |
static ProtocolCounters *mysql_counters; |
71 |
virtual ProtocolCounters *getCounters(void) const { return mysql_counters; } |
|
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
72 |
};
|
73 |
||
74 |
class ClientMySQLProtocol: public drizzled::plugin::Client |
|
75 |
{
|
|
1960.2.6
by Andrew Hutchings
Add ip address limitation for admin connections |
76 |
protected: |
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
77 |
NET net; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
78 |
drizzled::String packet; |
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
79 |
uint32_t client_capabilities; |
1960.2.1
by Andrew Hutchings
Add admin connection to client/server protocols |
80 |
bool is_admin_connection; |
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
81 |
bool _using_mysql41_protocol; |
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
82 |
|
83 |
bool checkConnection(void); |
|
84 |
bool netStoreData(const unsigned char *from, size_t length); |
|
85 |
void writeEOFPacket(uint32_t server_status, uint32_t total_warn_count); |
|
1337.4.1
by Eric Day
Removed unused functions and extra complexity in MySQL module. Not rewriting any code here (yet?), just reshuffling to make it easier to manage. |
86 |
unsigned char *storeLength(unsigned char *packet, uint64_t length); |
1337.4.5
by Eric Day
Added MySQL password hash support. |
87 |
void makeScramble(char *scramble); |
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
88 |
|
89 |
public: |
|
1953.2.7
by Andrew Hutchings
Merge with trunk |
90 |
ClientMySQLProtocol(int fd, bool _using_mysql41_protocol, ProtocolCounters *set_counters); |
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
91 |
virtual ~ClientMySQLProtocol(); |
92 |
||
1953.2.6
by Andrew Hutchings
Completely redo max-connections so it is independant per-protocol. Also make counters independant |
93 |
ProtocolCounters *counters; |
1726.3.4
by LinuxJedi
Add a data_dictionary table for the MySQL protocol plugin |
94 |
|
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
95 |
virtual int getFileDescriptor(void); |
96 |
virtual bool isConnected(); |
|
97 |
virtual bool isReading(void); |
|
98 |
virtual bool isWriting(void); |
|
99 |
virtual bool flush(void); |
|
100 |
virtual void close(void); |
|
101 |
||
102 |
virtual bool authenticate(void); |
|
103 |
virtual bool readCommand(char **packet, uint32_t *packet_length); |
|
104 |
||
105 |
virtual void sendOK(void); |
|
106 |
virtual void sendEOF(void); |
|
107 |
virtual void sendError(uint32_t sql_errno, const char *err); |
|
108 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
109 |
virtual bool sendFields(drizzled::List<drizzled::Item> *list); |
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
110 |
|
111 |
using Client::store; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
112 |
virtual bool store(drizzled::Field *from); |
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
113 |
virtual bool store(void); |
114 |
virtual bool store(int32_t from); |
|
115 |
virtual bool store(uint32_t from); |
|
116 |
virtual bool store(int64_t from); |
|
117 |
virtual bool store(uint64_t from); |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
118 |
virtual bool store(double from, uint32_t decimals, drizzled::String *buffer); |
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
119 |
virtual bool store(const char *from, size_t length); |
120 |
||
121 |
virtual bool haveError(void); |
|
122 |
virtual bool haveMoreData(void); |
|
123 |
virtual bool wasAborted(void); |
|
1960.2.6
by Andrew Hutchings
Add ip address limitation for admin connections |
124 |
virtual bool isAdminAllowed(void); |
125 |
static std::vector<std::string> mysql_admin_ip_addresses; |
|
126 |
static void mysql_compose_ip_addresses(std::vector<std::string> options); |
|
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
127 |
};
|
128 |
||
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
129 |
} /* namespace drizzle_plugin */ |
130 |
||
1337.4.1
by Eric Day
Removed unused functions and extra complexity in MySQL module. Not rewriting any code here (yet?), just reshuffling to make it easier to manage. |
131 |
#endif /* PLUGIN_MYSQL_PROTOCOL_MYSQL_PROTOCOL_H */ |