1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Mark Atwood
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#include <drizzled/server_includes.h>
21
#include <drizzled/protocol.h>
22
#include <drizzled/gettext.h>
24
extern char *opt_protocol;
26
ProtocolFactory *protocol_factory= NULL;
28
Protocol *get_protocol()
30
assert(protocol_factory != NULL);
31
return (*protocol_factory)();
34
int protocol_initializer(st_plugin_int *plugin)
36
if (memcmp(plugin->plugin->name, opt_protocol, strlen(opt_protocol)))
39
if (protocol_factory != NULL)
41
fprintf(stderr, "You cannot load more then one protocol plugin\n");
45
assert(plugin->plugin->init); /* Find poorly designed plugins */
47
if (plugin->plugin->init((void *)&protocol_factory))
50
TRANSLATORS> The leading word "protocol" is the name
51
of the plugin api, and so should not be translated.
53
errmsg_printf(ERRMSG_LVL_ERROR, _("protocol plugin '%s' init() failed"),
58
plugin->data= protocol_factory;
63
int protocol_finalizer(st_plugin_int *plugin)
65
/* We know which one we initialized since its data pointer is filled */
66
if (plugin->plugin->deinit && plugin->data)
68
if (plugin->plugin->deinit((void *)plugin->data))
70
/* TRANSLATORS: The leading word "protocol" is the name
71
of the plugin api, and so should not be translated. */
72
errmsg_printf(ERRMSG_LVL_ERROR,
73
_("protocol plugin '%s' deinit() failed"),