1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
/* Copyright (c) 2010 PrimeBase Technologies GmbH, Germany
*
* PrimeBase Media Stream for MySQL
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Barry Leslie
*
* 2010-05-31
*
* PBMS daemon plugin interface.
*
*/
#ifdef DRIZZLED
#include "config.h"
#include <drizzled/common.h>
#include <drizzled/plugin.h>
#include <drizzled/session.h>
#include <boost/program_options.hpp>
#include <drizzled/module/option_map.h>
using namespace drizzled;
using namespace drizzled::plugin;
namespace po= boost::program_options;
#include "cslib/CSConfig.h"
#else
#include "cslib/CSConfig.h"
#include "mysql_priv.h"
#include <mysql/plugin.h>
#include <my_dir.h>
#endif
#include <stdlib.h>
#include <time.h>
#include <inttypes.h>
#include "defs_ms.h"
#include "pbmslib.h"
/////////////////////////
// Plugin Definition:
/////////////////////////
#ifdef DRIZZLED
#include "events_ms.h"
static PBMSEvents *pbms_events= NULL;
extern int pbms_init_func(module::Context ®istry);
extern struct drizzled::drizzle_sys_var* pbms_system_variables[];
extern uint32_t pbms_port_number;
static void init_options(drizzled::module::option_context &context)
{
context("port",
po::value<uint32_t>(&pbms_port_number)->default_value(DEFAULT_PBMS_PORT),
N_("Port number to use for connection or 0 for default PBMS port "));
}
static int my_init(module::Context &context)
{
int rtc;
const module::option_map &vm= context.getOptions();
if (vm.count("port"))
{
if (pbms_port_number > 65535)
{
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid port number\n"));
return(-1);
}
}
PBMSParameters::startUp();
rtc = pbms_init_func(context);
if (rtc == 0) {
pbms_events = new PBMSEvents();
context.add(pbms_events);
}
return rtc;
}
DRIZZLE_DECLARE_PLUGIN
{
DRIZZLE_VERSION_ID,
"PBMS",
"1.0",
"Barry Leslie, PrimeBase Technologies GmbH",
"The Media Stream daemon for Drizzle",
PLUGIN_LICENSE_GPL,
my_init, /* Plugin Init */
pbms_system_variables, /* system variables */
init_options /* config options */
}
DRIZZLE_DECLARE_PLUGIN_END;
#else
extern int pbms_init_func(void *p);
extern int pbms_done_func(void *);
extern struct st_mysql_sys_var* pbms_system_variables[];
struct st_mysql_storage_engine pbms_engine_handler = {
MYSQL_HANDLERTON_INTERFACE_VERSION
};
mysql_declare_plugin(pbms)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
&pbms_engine_handler,
"PBMS",
"Barry Leslie, PrimeBase Technologies GmbH",
"The Media Stream daemon for MySQL",
PLUGIN_LICENSE_GPL,
pbms_init_func, /* Plugin Init */
pbms_done_func, /* Plugin Deinit */
0x0001 /* 0.1 */,
NULL, /* status variables */
#if MYSQL_VERSION_ID >= 50118
pbms_system_variables, /* system variables */
#else
NULL,
#endif
NULL /* config options */
}
mysql_declare_plugin_end;
#endif //DRIZZLED
|