00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #pragma once
00021
00022 #include <drizzled/plugin/plugin.h>
00023 #include <drizzled/atomics.h>
00024 #include <vector>
00025
00026 #include <drizzled/visibility.h>
00027
00028 namespace drizzled
00029 {
00030 namespace plugin
00031 {
00032
00033 class Client;
00034 class Listen;
00035 typedef std::vector<Listen *> ListenVector;
00036 typedef std::pair<std::string*, drizzled::atomic<uint64_t>*> ListenCounter;
00041 class DRIZZLED_API Listen : public Plugin
00042 {
00043 Listen();
00044 Listen(const Listen&);
00045 Listen& operator=(const Listen&);
00046 protected:
00047 std::vector<ListenCounter*> counters;
00048 public:
00049 explicit Listen(std::string name_arg)
00050 : Plugin(name_arg, "Listen")
00051 {}
00052 virtual ~Listen()
00053 {
00054 std::vector<ListenCounter*>::iterator it;
00055 for (it= counters.begin(); it < counters.end(); ++it)
00056 {
00057 ListenCounter* counter= *it;
00058 delete counter->first;
00059 delete counter;
00060 }
00061 }
00062
00063 static ListenVector &getListenProtocols();
00064
00065 std::vector<ListenCounter*>& getListenCounters()
00066 {
00067 return counters;
00068 }
00076 virtual bool getFileDescriptors(std::vector<int> &fds)= 0;
00077
00082 virtual plugin::Client *getClient(int fd)= 0;
00083
00087 static bool addPlugin(Listen *listen_obj);
00088
00092 static void removePlugin(Listen *listen_obj);
00093
00097 static bool setup(void);
00098
00103 static plugin::Client *getClient(void);
00104
00109 static plugin::Client *getNullClient(void);
00110
00114 static void shutdown(void);
00115
00116 };
00117
00118 }
00119
00120 }
00121