~drizzle-trunk/drizzle/development

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
/* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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>
using namespace drizzled;
using namespace drizzled::plugin;

#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"


/////////////////////////
// Plugin Definition:
/////////////////////////
#ifdef DRIZZLED
#include "events_ms.h"
static PBMSEvents *pbms_events= NULL;


extern int pbms_init_func(module::Context &registry);
extern struct drizzled::drizzle_sys_var* pbms_system_variables[];

static int my_init(module::Context &registry)
{
	int rtc;
	
	PBMSParameters::startUp();
	rtc = pbms_init_func(registry);
	if (rtc == 0) {
		pbms_events = new PBMSEvents();
		registry.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                */
	NULL                                            /* 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