Drizzled Public API Documentation

plugin_ms.cc

00001 /* Copyright (C) 2010 PrimeBase Technologies GmbH, Germany
00002  *
00003  * PrimeBase Media Stream for MySQL
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00018  *
00019  * Barry Leslie
00020  *
00021  * 2010-05-31
00022  *
00023  * PBMS daemon plugin interface.
00024  *
00025  */
00026 #ifdef DRIZZLED
00027 #include <config.h>
00028 #include <drizzled/common.h>
00029 #include <drizzled/plugin.h>
00030 #include <drizzled/session.h>
00031 #include <boost/program_options.hpp>
00032 #include <drizzled/module/option_map.h>
00033 using namespace drizzled;
00034 using namespace drizzled::plugin;
00035 namespace po= boost::program_options;
00036 
00037 #include "cslib/CSConfig.h"
00038 #else
00039 #include "cslib/CSConfig.h"
00040 #include "mysql_priv.h"
00041 #include <mysql/plugin.h>
00042 #include <my_dir.h>
00043 #endif 
00044 
00045 #include <stdlib.h>
00046 #include <time.h>
00047 #include <inttypes.h>
00048 
00049 
00050 #include "defs_ms.h"
00051 #include "pbmslib.h"
00052 
00054 // Plugin Definition:
00056 #ifdef DRIZZLED
00057 #include "events_ms.h"
00058 static PBMSEvents *pbms_events= NULL;
00059 
00060 extern int pbms_init_func(module::Context &registry);
00061 
00062 static void init_options(module::option_context &context)
00063 {
00064   PBMSParameters::initOptions(context);
00065 }
00066 
00067 static int my_init(module::Context &context)
00068 {
00069   int rtc;
00070 
00071   PBMSParameters::startUp(context);
00072   rtc = pbms_init_func(context);
00073   if (rtc == 0) {
00074     pbms_events = new PBMSEvents();
00075     context.add(pbms_events);
00076   }
00077 
00078   return rtc;
00079 }
00080 
00081 DRIZZLE_DECLARE_PLUGIN
00082 {
00083   DRIZZLE_VERSION_ID,
00084   "PBMS",
00085   "1.0",
00086   "Barry Leslie, PrimeBase Technologies GmbH",
00087   "The Media Stream daemon for Drizzle",
00088   PLUGIN_LICENSE_GPL,
00089   my_init, /* Plugin Init */
00090   NULL,          /* depends */
00091   init_options                                            /* config options                  */
00092 }
00093 DRIZZLE_DECLARE_PLUGIN_END;
00094 
00095 #else
00096 
00097 extern int pbms_init_func(void *p);
00098 extern int pbms_done_func(void *);
00099 extern struct st_mysql_sys_var* pbms_system_variables[];
00100 
00101 struct st_mysql_storage_engine pbms_engine_handler = {
00102   MYSQL_HANDLERTON_INTERFACE_VERSION
00103 };
00104 
00105 mysql_declare_plugin(pbms)
00106 {
00107   MYSQL_STORAGE_ENGINE_PLUGIN,
00108   &pbms_engine_handler,
00109   "PBMS",
00110   "Barry Leslie, PrimeBase Technologies GmbH",
00111   "The Media Stream daemon for MySQL",
00112   PLUGIN_LICENSE_GPL,
00113   pbms_init_func, /* Plugin Init */
00114   pbms_done_func, /* Plugin Deinit */
00115   0x0001 /* 0.1 */,
00116   NULL,                       /* status variables               */
00117 #if MYSQL_VERSION_ID >= 50118
00118   pbms_system_variables,              /* depends */
00119 #else
00120   NULL,
00121 #endif
00122   NULL                      /* config options               */
00123 }
00124 mysql_declare_plugin_end;
00125 #endif //DRIZZLED
00126 
00127 
00128 // vim:noexpandtab:sts=8:sw=8:tabstop=8:smarttab: