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 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
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. |
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 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
20 |
#pragma once
|
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. |
21 |
|
22 |
#include <drizzled/plugin/listen_tcp.h> |
|
23 |
#include <drizzled/plugin/client.h> |
|
1726.3.4
by LinuxJedi
Add a data_dictionary table for the MySQL protocol plugin |
24 |
#include <drizzled/atomics.h> |
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
25 |
#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. |
26 |
|
27 |
#include "net_serv.h" |
|
28 |
||
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
29 |
namespace drizzle_plugin |
30 |
{
|
|
1960.2.6
by Andrew Hutchings
Add ip address limitation for admin connections |
31 |
void compose_ip_addresses(std::vector<std::string> options); |
32 |
||
1953.2.6
by Andrew Hutchings
Completely redo max-connections so it is independant per-protocol. Also make counters independant |
33 |
class ProtocolCounters |
34 |
{
|
|
35 |
public: |
|
36 |
ProtocolCounters(): |
|
37 |
max_connections(1000) |
|
38 |
{ } |
|
39 |
drizzled::atomic<uint64_t> connectionCount; |
|
1960.2.5
by Andrew Hutchings
Fix counters |
40 |
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 |
41 |
drizzled::atomic<uint64_t> failedConnections; |
42 |
drizzled::atomic<uint64_t> connected; |
|
1960.2.5
by Andrew Hutchings
Fix counters |
43 |
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 |
44 |
uint32_t max_connections; |
45 |
};
|
|
1953.2.2
by Andrew Hutchings
Add Drizzle protocol support for max-connections (shared with MySQL protocol for now as other stats are shared) |
46 |
|
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
47 |
typedef drizzled::constrained_check<uint32_t, 300, 1> timeout_constraint; |
48 |
typedef drizzled::constrained_check<uint32_t, 300, 1> retry_constraint; |
|
49 |
typedef drizzled::constrained_check<uint32_t, 1048576, 1024, 1024> buffer_constraint; |
|
50 |
||
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. |
51 |
class ListenMySQLProtocol: public drizzled::plugin::ListenTcp |
52 |
{
|
|
1960.2.6
by Andrew Hutchings
Add ip address limitation for admin connections |
53 |
protected: |
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
54 |
const std::string _hostname; |
55 |
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. |
56 |
|
57 |
public: |
|
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
58 |
ListenMySQLProtocol(std::string name, |
59 |
const std::string &hostname, |
|
60 |
bool using_mysql41_protocol): |
|
61 |
drizzled::plugin::ListenTcp(name), |
|
62 |
_hostname(hostname), |
|
63 |
_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. |
64 |
{ } |
1666.4.19
by Monty Taylor
Free strdup'd option strings. |
65 |
virtual ~ListenMySQLProtocol(); |
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
66 |
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. |
67 |
virtual in_port_t getPort(void) const; |
68 |
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 |
69 |
static ProtocolCounters *mysql_counters; |
70 |
virtual ProtocolCounters *getCounters(void) const { return mysql_counters; } |
|
2131.7.1
by Andrew Hutchings
Add protocol counters table |
71 |
void addCountersToTable(void); |
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; |
2191.1.2
by Brian Aker
Adding SESSION table and adding back in the mysql interactive flag. |
82 |
bool _is_interactive; |
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. |
83 |
|
84 |
bool checkConnection(void); |
|
85 |
bool netStoreData(const unsigned char *from, size_t length); |
|
86 |
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. |
87 |
unsigned char *storeLength(unsigned char *packet, uint64_t length); |
1337.4.5
by Eric Day
Added MySQL password hash support. |
88 |
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. |
89 |
|
90 |
public: |
|
1953.2.7
by Andrew Hutchings
Merge with trunk |
91 |
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. |
92 |
virtual ~ClientMySQLProtocol(); |
93 |
||
2191.1.4
by Brian Aker
Add in interactive mode back to protocol. |
94 |
bool isInteractive() const |
2191.1.2
by Brian Aker
Adding SESSION table and adding back in the mysql interactive flag. |
95 |
{
|
96 |
return _is_interactive; |
|
97 |
}
|
|
98 |
||
2191.1.4
by Brian Aker
Add in interactive mode back to protocol. |
99 |
bool isAdmin() const |
100 |
{
|
|
101 |
return is_admin_connection; |
|
102 |
}
|
|
103 |
||
1953.2.6
by Andrew Hutchings
Completely redo max-connections so it is independant per-protocol. Also make counters independant |
104 |
ProtocolCounters *counters; |
1726.3.4
by LinuxJedi
Add a data_dictionary table for the MySQL protocol plugin |
105 |
|
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. |
106 |
virtual int getFileDescriptor(void); |
107 |
virtual bool isConnected(); |
|
108 |
virtual bool isReading(void); |
|
109 |
virtual bool isWriting(void); |
|
110 |
virtual bool flush(void); |
|
111 |
virtual void close(void); |
|
112 |
||
113 |
virtual bool authenticate(void); |
|
114 |
virtual bool readCommand(char **packet, uint32_t *packet_length); |
|
115 |
||
116 |
virtual void sendOK(void); |
|
117 |
virtual void sendEOF(void); |
|
2126.3.4
by Brian Aker
Additional error cleanup (passing error correctly to the client code). |
118 |
virtual void sendError(const drizzled::error_t sql_errno, const char *err); |
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 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
120 |
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. |
121 |
|
122 |
using Client::store; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
123 |
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. |
124 |
virtual bool store(void); |
125 |
virtual bool store(int32_t from); |
|
126 |
virtual bool store(uint32_t from); |
|
127 |
virtual bool store(int64_t from); |
|
128 |
virtual bool store(uint64_t from); |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
129 |
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. |
130 |
virtual bool store(const char *from, size_t length); |
131 |
||
132 |
virtual bool haveError(void); |
|
133 |
virtual bool haveMoreData(void); |
|
134 |
virtual bool wasAborted(void); |
|
1960.2.6
by Andrew Hutchings
Add ip address limitation for admin connections |
135 |
virtual bool isAdminAllowed(void); |
136 |
static std::vector<std::string> mysql_admin_ip_addresses; |
|
137 |
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. |
138 |
};
|
139 |
||
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
140 |
} /* namespace drizzle_plugin */ |
141 |