20
20
#include <drizzled/server_includes.h>
21
21
#include <drizzled/protocol.h>
22
#include "drizzled/plugin_registry.h"
22
23
#include <drizzled/gettext.h>
24
26
extern char *opt_protocol;
26
28
ProtocolFactory *protocol_factory= NULL;
31
33
return (*protocol_factory)();
34
int protocol_initializer(st_plugin_int *plugin)
36
bool add_protocol_factory(ProtocolFactory *factory)
36
if (memcmp(plugin->plugin->name, opt_protocol, strlen(opt_protocol)))
38
if (factory->getName() != opt_protocol)
39
41
if (protocol_factory != NULL)
41
43
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;
46
protocol_factory= factory;
63
int protocol_finalizer(st_plugin_int *plugin)
51
bool remove_protocol_factory(ProtocolFactory *)
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"),
53
protocol_factory= NULL;