~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/mysql_protocol.h

  • Committer: Brian Aker
  • Date: 2010-10-22 17:44:34 UTC
  • mto: This revision was merged to the branch mainline in revision 1873.
  • Revision ID: brian@tangent.org-20101022174434-q8fjovcpclzqer7n
TableShare is no longer in the house (i.e. we no longer directly have a copy
of it in cursor).

One more bit of the knot now gone.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#include "net_serv.h"
29
29
 
30
 
namespace drizzle_plugin
31
 
{
32
 
void compose_ip_addresses(std::vector<std::string> options);
33
 
 
34
 
class ProtocolCounters
35
 
{
36
 
  public:
37
 
    ProtocolCounters():
38
 
      max_connections(1000)
39
 
    { }
40
 
    drizzled::atomic<uint64_t> connectionCount;
41
 
    drizzled::atomic<uint64_t> adminConnectionCount;
42
 
    drizzled::atomic<uint64_t> failedConnections;
43
 
    drizzled::atomic<uint64_t> connected;
44
 
    drizzled::atomic<uint64_t> adminConnected;
45
 
    uint32_t max_connections;
46
 
};
47
 
 
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
 
 
52
30
class ListenMySQLProtocol: public drizzled::plugin::ListenTcp
53
31
{
54
 
protected:
55
 
  const std::string _hostname;
56
 
  bool _using_mysql41_protocol;
 
32
private:
 
33
  bool using_mysql41_protocol;
 
34
  static drizzled::plugin::TableFunction* status_table_function_ptr;
57
35
 
58
36
public:
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)
 
37
  ListenMySQLProtocol(std::string name_arg, bool using_mysql41_protocol_arg):
 
38
   drizzled::plugin::ListenTcp(name_arg),
 
39
   using_mysql41_protocol(using_mysql41_protocol_arg)
65
40
  { }
66
41
  virtual ~ListenMySQLProtocol();
67
 
  virtual const std::string getHost(void) const;
 
42
  virtual const char* getHost(void) const;
68
43
  virtual in_port_t getPort(void) const;
69
44
  virtual drizzled::plugin::Client *getClient(int fd);
70
 
  static ProtocolCounters *mysql_counters;
71
 
  virtual ProtocolCounters *getCounters(void) const { return mysql_counters; }
72
45
};
73
46
 
74
47
class ClientMySQLProtocol: public drizzled::plugin::Client
75
48
{
76
 
protected:
 
49
private:
77
50
  NET net;
78
51
  drizzled::String packet;
79
52
  uint32_t client_capabilities;
80
 
  bool is_admin_connection;
81
 
  bool _using_mysql41_protocol;
 
53
  bool using_mysql41_protocol;
82
54
 
83
55
  bool checkConnection(void);
84
56
  bool netStoreData(const unsigned char *from, size_t length);
87
59
  void makeScramble(char *scramble);
88
60
 
89
61
public:
90
 
  ClientMySQLProtocol(int fd, bool _using_mysql41_protocol, ProtocolCounters *set_counters);
 
62
  ClientMySQLProtocol(int fd, bool using_mysql41_protocol_arg);
91
63
  virtual ~ClientMySQLProtocol();
92
64
 
93
 
  ProtocolCounters *counters;
 
65
  static drizzled::atomic<uint64_t> connectionCount;
 
66
  static drizzled::atomic<uint64_t> failedConnections;
 
67
  static drizzled::atomic<uint64_t> connected;
94
68
 
95
69
  virtual int getFileDescriptor(void);
96
70
  virtual bool isConnected();
121
95
  virtual bool haveError(void);
122
96
  virtual bool haveMoreData(void);
123
97
  virtual bool wasAborted(void);
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);
127
98
};
128
99
 
129
 
} /* namespace drizzle_plugin */
130
 
 
131
100
#endif /* PLUGIN_MYSQL_PROTOCOL_MYSQL_PROTOCOL_H */