~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/plugin_ms.cc

  • Committer: Monty Taylor
  • Date: 2010-07-04 20:02:43 UTC
  • mfrom: (1548.2.40 drizzle_pbms)
  • mto: This revision was merged to the branch mainline in revision 1644.
  • Revision ID: mordred@inaugust.com-20100704200243-2vkq9gi6ysauj2tb
Merge PBMS from Barry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2010 PrimeBase Technologies GmbH, Germany
 
2
 *
 
3
 * PrimeBase Media Stream for MySQL
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
18
 *
 
19
 * Barry Leslie
 
20
 *
 
21
 * 2010-05-31
 
22
 *
 
23
 * PBMS daemon plugin interface.
 
24
 *
 
25
 */
 
26
#ifdef DRIZZLED
 
27
#include "config.h"
 
28
#include <drizzled/common.h>
 
29
#include <drizzled/plugin.h>
 
30
#include <drizzled/session.h>
 
31
using namespace drizzled;
 
32
using namespace drizzled::plugin;
 
33
 
 
34
#include "cslib/CSConfig.h"
 
35
#else
 
36
#include "cslib/CSConfig.h"
 
37
#include "mysql_priv.h"
 
38
#include <mysql/plugin.h>
 
39
#include <my_dir.h>
 
40
#endif 
 
41
 
 
42
#include <stdlib.h>
 
43
#include <time.h>
 
44
#include <inttypes.h>
 
45
 
 
46
 
 
47
#include "defs_ms.h"
 
48
 
 
49
 
 
50
/////////////////////////
 
51
// Plugin Definition:
 
52
/////////////////////////
 
53
#ifdef DRIZZLED
 
54
#include "events_ms.h"
 
55
static PBMSEvents *pbms_events= NULL;
 
56
 
 
57
 
 
58
extern int pbms_init_func(module::Context &registry);
 
59
extern struct drizzled::drizzle_sys_var* pbms_system_variables[];
 
60
 
 
61
static int my_init(module::Context &registry)
 
62
{
 
63
        int rtc;
 
64
        
 
65
        PBMSParameters::startUp();
 
66
        rtc = pbms_init_func(registry);
 
67
        if (rtc == 0) {
 
68
                pbms_events = new PBMSEvents();
 
69
                registry.add(pbms_events);
 
70
        }
 
71
        
 
72
        return rtc;
 
73
}
 
74
 
 
75
DRIZZLE_DECLARE_PLUGIN
 
76
{
 
77
        DRIZZLE_VERSION_ID,
 
78
        "PBMS",
 
79
        "1.0",
 
80
        "Barry Leslie, PrimeBase Technologies GmbH",
 
81
        "The Media Stream daemon for Drizzle",
 
82
        PLUGIN_LICENSE_GPL,
 
83
        my_init, /* Plugin Init */
 
84
        pbms_system_variables,          /* system variables                */
 
85
        NULL                                            /* config options                  */
 
86
}
 
87
DRIZZLE_DECLARE_PLUGIN_END;
 
88
 
 
89
#else
 
90
 
 
91
extern int pbms_init_func(void *p);
 
92
extern int pbms_done_func(void *);
 
93
extern struct st_mysql_sys_var* pbms_system_variables[];
 
94
 
 
95
struct st_mysql_storage_engine pbms_engine_handler = {
 
96
        MYSQL_HANDLERTON_INTERFACE_VERSION
 
97
};
 
98
 
 
99
mysql_declare_plugin(pbms)
 
100
{
 
101
        MYSQL_STORAGE_ENGINE_PLUGIN,
 
102
        &pbms_engine_handler,
 
103
        "PBMS",
 
104
        "Barry Leslie, PrimeBase Technologies GmbH",
 
105
        "The Media Stream daemon for MySQL",
 
106
        PLUGIN_LICENSE_GPL,
 
107
        pbms_init_func, /* Plugin Init */
 
108
        pbms_done_func, /* Plugin Deinit */
 
109
        0x0001 /* 0.1 */,
 
110
        NULL,                                                                                   /* status variables                                                             */
 
111
#if MYSQL_VERSION_ID >= 50118
 
112
        pbms_system_variables,                                                  /* system variables                                                             */
 
113
#else
 
114
        NULL,
 
115
#endif
 
116
        NULL                                                                                    /* config options                                                               */
 
117
}
 
118
mysql_declare_plugin_end;
 
119
#endif //DRIZZLED
 
120
 
 
121