Drizzled Public API Documentation

protocol.h

00001 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2010 Brian Aker
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 
00022 #pragma once
00023 
00024 #include <drizzled/plugin/listen_tcp.h>
00025 #include <drizzled/plugin/client.h>
00026 #include <drizzled/atomics.h>
00027 #include <drizzled/plugin/table_function.h>
00028 
00029 #include <boost/filesystem.hpp>
00030 
00031 #include <plugin/mysql_protocol/mysql_protocol.h>
00032 
00033 namespace drizzle_plugin
00034 {
00035 namespace mysql_unix_socket_protocol
00036 {
00037 
00038 class Protocol: public ListenMySQLProtocol
00039 {
00040   const boost::filesystem::path _unix_socket_path;
00041 public:
00042   Protocol(std::string name,
00043            bool using_mysql41_protocol,
00044            const boost::filesystem::path &unix_socket_path) :
00045     ListenMySQLProtocol(name, unix_socket_path.file_string(),
00046                         using_mysql41_protocol),
00047     _unix_socket_path(unix_socket_path)
00048   { }
00049 
00050   ~Protocol();
00051   bool getFileDescriptors(std::vector<int> &fds);
00052 
00053   in_port_t getPort(void) const;
00054   static ProtocolCounters *mysql_unix_counters;
00055   virtual ProtocolCounters *getCounters(void) const {return mysql_unix_counters; }
00056   drizzled::plugin::Client *getClient(int fd);
00057 };
00058 
00059 class ClientMySQLUnixSocketProtocol: public ClientMySQLProtocol
00060 {
00061 public:
00062   ClientMySQLUnixSocketProtocol(int fd, bool __using_mysql41_protocol, ProtocolCounters *set_counters): ClientMySQLProtocol(fd, __using_mysql41_protocol, set_counters) {}
00063 
00064   /* Unix socket protocol is for MySQL compatibility so do not allow admin connections */
00065   bool isAdminAllowed(void) { return false; }
00066 };
00067 
00068 
00069 } /* namespace mysql_unix_socket_protocol */
00070 } /* namespace drizzle_plugin */
00071