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"
19 #include "vici_control.h"
24 typedef struct private_vici_plugin_t private_vici_plugin_t
;
27 * Private members of vici_plugin_t
29 struct private_vici_plugin_t
{
37 * Dispatcher, creating socket
39 vici_dispatcher_t
*dispatcher
;
49 vici_control_t
*control
;
52 METHOD(plugin_t
, get_name
, char*,
53 private_vici_plugin_t
*this)
59 * Register vici plugin features
61 static bool register_vici(private_vici_plugin_t
*this,
62 plugin_feature_t
*feature
, bool reg
, void *data
)
68 uri
= lib
->settings
->get_str(lib
->settings
, "%s.plugins.vici.socket",
69 VICI_DEFAULT_URI
, lib
->ns
);
70 this->dispatcher
= vici_dispatcher_create(uri
);
73 this->query
= vici_query_create(this->dispatcher
);
74 this->control
= vici_control_create(this->dispatcher
);
81 this->control
->destroy(this->control
);
82 this->query
->destroy(this->query
);
83 this->dispatcher
->destroy(this->dispatcher
);
88 METHOD(plugin_t
, get_features
, int,
89 private_vici_plugin_t
*this, plugin_feature_t
*features
[])
91 static plugin_feature_t f
[] = {
92 PLUGIN_CALLBACK((plugin_feature_callback_t
)register_vici
, NULL
),
93 PLUGIN_PROVIDE(CUSTOM
, "vici"),
99 METHOD(plugin_t
, destroy
, void,
100 private_vici_plugin_t
*this)
108 plugin_t
*vici_plugin_create()
110 private_vici_plugin_t
*this;
115 .get_name
= _get_name
,
116 .reload
= (void*)return_false
,
117 .get_features
= _get_features
,
123 return &this->public.plugin
;