~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/drizzle_protocol/drizzle_protocol.h

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2010 Brian Aker
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; version 2 of the License.
 
8
 *  the Free Software Foundation; either version 2 of the License, or
 
9
 *  (at your option) any later version.
9
10
 *
10
11
 *  This program is distributed in the hope that it will be useful,
11
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
19
 */
19
20
 
 
21
 
20
22
#ifndef PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
21
23
#define PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
22
24
 
25
27
#include <drizzled/atomics.h>
26
28
#include "drizzled/plugin/table_function.h"
27
29
 
28
 
#include "net_serv.h"
 
30
#include "plugin/mysql_protocol/mysql_protocol.h"
29
31
 
 
32
namespace drizzle_plugin
 
33
{
30
34
namespace drizzle_protocol
31
35
{
32
36
 
33
 
class ListenDrizzleProtocol: public drizzled::plugin::ListenTcp
 
37
class ListenDrizzleProtocol: public ListenMySQLProtocol
34
38
{
35
 
private:
36
 
  bool using_mysql41_protocol;
37
 
 
38
39
public:
39
 
  ListenDrizzleProtocol(std::string name_arg, bool using_mysql41_protocol_arg):
40
 
   drizzled::plugin::ListenTcp(name_arg),
41
 
   using_mysql41_protocol(using_mysql41_protocol_arg)
 
40
  ListenDrizzleProtocol(std::string name, 
 
41
                        const std::string &bind_address,
 
42
                        bool using_mysql41_protocol):
 
43
    ListenMySQLProtocol(name, bind_address, using_mysql41_protocol)
42
44
  { }
43
 
  virtual ~ListenDrizzleProtocol();
44
 
  virtual const char* getHost(void) const;
45
 
  virtual in_port_t getPort(void) const;
46
 
  virtual drizzled::plugin::Client *getClient(int fd);
 
45
 
 
46
  ~ListenDrizzleProtocol();
 
47
  in_port_t getPort(void) const;
 
48
  static ProtocolCounters *drizzle_counters;
 
49
  virtual ProtocolCounters *getCounters(void) const { return drizzle_counters; }
 
50
  drizzled::plugin::Client *getClient(int fd);
47
51
};
48
52
 
49
 
class ClientDrizzleProtocol: public drizzled::plugin::Client
 
53
class ClientDrizzleProtocol: public ClientMySQLProtocol
50
54
{
51
 
private:
52
 
  NET net;
53
 
  drizzled::String packet;
54
 
  uint32_t client_capabilities;
55
 
  bool using_mysql41_protocol;
56
 
 
57
 
  bool checkConnection(void);
58
 
  bool netStoreData(const unsigned char *from, size_t length);
59
 
  void writeEOFPacket(uint32_t server_status, uint32_t total_warn_count);
60
 
 
61
55
public:
62
 
  ClientDrizzleProtocol(int fd, bool using_mysql41_protocol_arg);
63
 
  virtual ~ClientDrizzleProtocol();
64
 
 
65
 
  static drizzled::atomic<uint64_t> connectionCount;
66
 
  static drizzled::atomic<uint64_t> failedConnections;
67
 
  static drizzled::atomic<uint64_t> connected;
68
 
 
69
 
  virtual int getFileDescriptor(void);
70
 
  virtual bool isConnected();
71
 
  virtual bool isReading(void);
72
 
  virtual bool isWriting(void);
73
 
  virtual bool flush(void);
74
 
  virtual void close(void);
75
 
 
76
 
  virtual bool authenticate(void);
77
 
  virtual bool readCommand(char **packet, uint32_t *packet_length);
78
 
 
79
 
  virtual void sendOK(void);
80
 
  virtual void sendEOF(void);
81
 
  virtual void sendError(uint32_t sql_errno, const char *err);
82
 
 
83
 
  virtual bool sendFields(drizzled::List<drizzled::Item> *list);
84
 
 
85
 
  using Client::store;
86
 
  virtual bool store(drizzled::Field *from);
87
 
  virtual bool store(void);
88
 
  virtual bool store(int32_t from);
89
 
  virtual bool store(uint32_t from);
90
 
  virtual bool store(int64_t from);
91
 
  virtual bool store(uint64_t from);
92
 
  virtual bool store(double from, uint32_t decimals, drizzled::String *buffer);
93
 
  virtual bool store(const char *from, size_t length);
94
 
 
95
 
  virtual bool haveError(void);
96
 
  virtual bool haveMoreData(void);
97
 
  virtual bool wasAborted(void);
 
56
  ClientDrizzleProtocol(int fd, ProtocolCounters *set_counters): ClientMySQLProtocol(fd, true, set_counters) {}
 
57
 
 
58
  static std::vector<std::string> drizzle_admin_ip_addresses;
 
59
  static void drizzle_compose_ip_addresses(std::vector<std::string> options);
 
60
  bool isAdminAllowed(void);
98
61
};
99
62
 
100
63
} /* namespace drizzle_protocol */
101
 
 
 
64
} /* namespace drizzle_plugin */
 
65
 
102
66
#endif /* PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H */