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:
4
* Copyright (C) 2010 Brian Aker
4
* Copyright (C) 2008 Sun Microsystems
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; either version 2 of the License, or
9
* (at your option) any later version.
8
* the Free Software Foundation; version 2 of the License.
11
10
* This program is distributed in the hope that it will be useful,
12
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#ifndef PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
23
#define PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
25
#include <drizzled/plugin/listen_tcp.h>
26
#include <drizzled/plugin/client.h>
27
#include <drizzled/atomics.h>
28
#include "drizzled/plugin/table_function.h"
30
#include "plugin/mysql_protocol/mysql_protocol.h"
32
namespace drizzle_plugin
34
namespace drizzle_protocol
37
class ListenDrizzleProtocol: public ListenMySQLProtocol
40
ListenDrizzleProtocol(std::string name,
41
const std::string &bind_address,
42
bool using_mysql41_protocol):
43
ListenMySQLProtocol(name, bind_address, using_mysql41_protocol)
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);
53
class ClientDrizzleProtocol: public ClientMySQLProtocol
56
ClientDrizzleProtocol(int fd, ProtocolCounters *set_counters): ClientMySQLProtocol(fd, true, set_counters) {}
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);
63
} /* namespace drizzle_protocol */
64
} /* namespace drizzle_plugin */
66
#endif /* PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H */
20
#ifndef DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H
21
#define DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H
23
#include <drizzled/plugin/listen.h>
24
#include <drizzled/plugin/protocol.h>
29
class ListenOldLibdrizzle: public Listen
35
ListenOldLibdrizzle();
36
ListenOldLibdrizzle(in_port_t port_arg): port(port_arg) {}
37
virtual in_port_t getPort(void) const;
38
virtual Protocol *protocolFactory(void) const;
41
class ProtocolOldLibdrizzle: public Protocol
46
struct rand_struct rand;
47
char scramble[SCRAMBLE_LENGTH+1];
52
bool netStoreData(const unsigned char *from, size_t length);
55
* Performs handshake with client and authorizes user.
57
* Returns true is the connection is valid and the
58
* user is authorized, otherwise false.
60
bool checkConnection(void);
63
ProtocolOldLibdrizzle();
64
~ProtocolOldLibdrizzle();
65
virtual void setSession(Session *session_arg);
66
virtual bool isConnected();
67
virtual void setReadTimeout(uint32_t timeout);
68
virtual void setWriteTimeout(uint32_t timeout);
69
virtual void setRetryCount(uint32_t count);
70
virtual void setError(char error);
71
virtual bool haveError(void);
72
virtual bool wasAborted(void);
73
virtual void enableCompression(void);
74
virtual bool haveMoreData(void);
75
virtual bool isReading(void);
76
virtual bool isWriting(void);
77
virtual bool setFileDescriptor(int fd);
78
virtual int fileDescriptor(void);
79
virtual void setRandom(uint64_t seed1, uint64_t seed2);
80
virtual bool authenticate(void);
81
virtual bool readCommand(char **packet, uint32_t *packet_length);
82
virtual void sendOK();
83
virtual void sendEOF();
84
virtual void sendError(uint32_t sql_errno, const char *err);
86
virtual void forceClose();
87
virtual void prepareForResend();
91
virtual bool sendFields(List<Item> *list, uint32_t flags);
93
using Protocol::store;
94
virtual bool store(Field *from);
95
virtual bool store(void);
96
virtual bool store(int32_t from);
97
virtual bool store(uint32_t from);
98
virtual bool store(int64_t from);
99
virtual bool store(uint64_t from);
100
virtual bool store(double from, uint32_t decimals, String *buffer);
101
virtual bool store(const DRIZZLE_TIME *from);
102
virtual bool store(const char *from, size_t length);
105
#endif /* DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H */