2 * Copyright (C) 2014 Martin Willi
3 * Copyright (C) 2014 revosec AG
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #include "vici_plugin.h"
17 #include "vici_dispatcher.h"
18 #include "vici_query.h"
23 typedef struct private_vici_plugin_t private_vici_plugin_t
;
26 * Private members of vici_plugin_t
28 struct private_vici_plugin_t
{
36 * Dispatcher, creating socket
38 vici_dispatcher_t
*dispatcher
;
46 METHOD(plugin_t
, get_name
, char*,
47 private_vici_plugin_t
*this)
53 * Register vici plugin features
55 static bool register_vici(private_vici_plugin_t
*this,
56 plugin_feature_t
*feature
, bool reg
, void *data
)
62 uri
= lib
->settings
->get_str(lib
->settings
, "%s.plugins.vici.socket",
63 VICI_DEFAULT_URI
, lib
->ns
);
64 this->dispatcher
= vici_dispatcher_create(uri
);
67 this->query
= vici_query_create(this->dispatcher
);
74 this->query
->destroy(this->query
);
75 this->dispatcher
->destroy(this->dispatcher
);
80 METHOD(plugin_t
, get_features
, int,
81 private_vici_plugin_t
*this, plugin_feature_t
*features
[])
83 static plugin_feature_t f
[] = {
84 PLUGIN_CALLBACK((plugin_feature_callback_t
)register_vici
, NULL
),
85 PLUGIN_PROVIDE(CUSTOM
, "vici"),
91 METHOD(plugin_t
, destroy
, void,
92 private_vici_plugin_t
*this)
100 plugin_t
*vici_plugin_create()
102 private_vici_plugin_t
*this;
107 .get_name
= _get_name
,
108 .reload
= (void*)return_false
,
109 .get_features
= _get_features
,
115 return &this->public.plugin
;