drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
plugin/listen.h
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008 Sun Microsystems, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#pragma once
21
22#include <drizzled/plugin/plugin.h>
23#include <drizzled/atomics.h>
24#include <vector>
25#include <drizzled/visibility.h>
26
27namespace drizzled {
28namespace plugin {
29
30typedef std::vector<Listen *> ListenVector;
31typedef std::pair<std::string*, drizzled::atomic<uint64_t>*> ListenCounter;
36class DRIZZLED_API Listen : public Plugin
37{
38protected:
39 std::vector<ListenCounter*> counters;
40public:
41 explicit Listen(std::string name_arg)
42 : Plugin(name_arg, "Listen")
43 {}
44
45 virtual ~Listen()
46 {
47 for (ListenCounter* counter : counters)
48 {
49 delete counter->first;
50 delete counter;
51 }
52 }
53
54 static ListenVector &getListenProtocols();
55
56 std::vector<ListenCounter*>& getListenCounters()
57 {
58 return counters;
59 }
67 virtual bool getFileDescriptors(std::vector<int> &fds)= 0;
68
73 virtual plugin::Client *getClient(int fd)= 0;
74
78 static bool addPlugin(Listen&);
79
83 static void removePlugin(Listen&);
84
88 static bool setup(void);
89
95
101
105 static void shutdown();
106
107};
108
109} /* namespace plugin */
110
111} /* namespace drizzled */
112
static bool addPlugin(Listen &)
Definition listen.cc:64
virtual plugin::Client * getClient(int fd)=0
static bool setup(void)
Definition listen.cc:75
virtual bool getFileDescriptors(std::vector< int > &fds)=0
static plugin::Client * serveConnections()
Definition listen.cc:136
static void shutdown()
Definition listen.cc:189
static plugin::Client * getNullClient()
Definition listen.cc:184
static void removePlugin(Listen &)
Definition listen.cc:70
TODO: Rename this file - func.h is stupid.
Visibility Control Macros.
#define DRIZZLED_API
Definition visibility.h:38