17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
21
#define PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
20
#ifndef DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H
21
#define DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H
23
#include <drizzled/plugin/listen_tcp.h>
24
#include <drizzled/plugin/client.h>
23
#include <drizzled/plugin/protocol.h>
26
25
#include "net_serv.h"
28
namespace drizzle_protocol
31
class ListenDrizzleProtocol: public drizzled::plugin::ListenTcp
34
bool using_mysql41_protocol;
37
ListenDrizzleProtocol(std::string name_arg, bool using_mysql41_protocol_arg):
38
drizzled::plugin::ListenTcp(name_arg),
39
using_mysql41_protocol(using_mysql41_protocol_arg)
41
virtual const char* getHost(void) const;
42
virtual in_port_t getPort(void) const;
43
virtual drizzled::plugin::Client *getClient(int fd);
46
class ClientDrizzleProtocol: public drizzled::plugin::Client
28
class ProtocolOldLibdrizzle: public Protocol
50
drizzled::String packet;
51
uint32_t client_capabilities;
52
bool using_mysql41_protocol;
33
struct rand_struct rand;
34
char scramble[SCRAMBLE_LENGTH+1];
39
bool netStoreData(const unsigned char *from, size_t length);
40
bool netStoreData(const unsigned char *from, size_t length,
41
const CHARSET_INFO * const fromcs,
42
const CHARSET_INFO * const tocs);
43
bool storeString(const char *from, size_t length,
44
const CHARSET_INFO * const fromcs,
45
const CHARSET_INFO * const tocs);
48
* Performs handshake with client and authorizes user.
50
* Returns true is the connection is valid and the
51
* user is authorized, otherwise false.
54
53
bool checkConnection(void);
55
bool netStoreData(const unsigned char *from, size_t length);
56
void writeEOFPacket(uint32_t server_status, uint32_t total_warn_count);
59
ClientDrizzleProtocol(int fd, bool using_mysql41_protocol_arg);
60
virtual ~ClientDrizzleProtocol();
62
virtual int getFileDescriptor(void);
56
ProtocolOldLibdrizzle();
57
virtual void setSession(Session *session_arg);
63
58
virtual bool isConnected();
59
virtual void setReadTimeout(uint32_t timeout);
60
virtual void setWriteTimeout(uint32_t timeout);
61
virtual void setRetryCount(uint32_t count);
62
virtual void setError(char error);
63
virtual bool haveError(void);
64
virtual bool wasAborted(void);
65
virtual void enableCompression(void);
66
virtual bool haveMoreData(void);
64
67
virtual bool isReading(void);
65
68
virtual bool isWriting(void);
66
virtual bool flush(void);
67
virtual void close(void);
69
virtual bool setFileDescriptor(int fd);
70
virtual int fileDescriptor(void);
71
virtual void setRandom(uint64_t seed1, uint64_t seed2);
69
72
virtual bool authenticate(void);
70
73
virtual bool readCommand(char **packet, uint32_t *packet_length);
72
virtual void sendOK(void);
73
virtual void sendEOF(void);
74
virtual void sendOK();
75
virtual void sendEOF();
74
76
virtual void sendError(uint32_t sql_errno, const char *err);
76
virtual bool sendFields(drizzled::List<drizzled::Item> *list);
79
virtual bool store(drizzled::Field *from);
78
virtual void forceClose();
79
virtual void prepareForResend();
83
virtual bool sendFields(List<Item> *list, uint32_t flags);
85
using Protocol::store;
86
virtual bool store(Field *from);
80
87
virtual bool store(void);
81
88
virtual bool store(int32_t from);
82
89
virtual bool store(uint32_t from);
83
90
virtual bool store(int64_t from);
84
91
virtual bool store(uint64_t from);
85
virtual bool store(double from, uint32_t decimals, drizzled::String *buffer);
86
virtual bool store(const char *from, size_t length);
88
virtual bool haveError(void);
89
virtual bool haveMoreData(void);
90
virtual bool wasAborted(void);
93
} /* namespace drizzle_protocol */
95
#endif /* PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H */
92
virtual bool store(double from, uint32_t decimals, String *buffer);
93
virtual bool store(const DRIZZLE_TIME *from);
94
virtual bool store(const char *from, size_t length,
95
const CHARSET_INFO * const cs);
98
class ProtocolFactoryOldLibdrizzle: public ProtocolFactory
101
ProtocolFactoryOldLibdrizzle() : ProtocolFactory("oldlibdrizzle") {}
102
Protocol *operator()(void)
104
return new ProtocolOldLibdrizzle;
108
#endif /* DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H */