2 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; under version 2 of the License.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 #include <babeltrace/plugin/plugin-dev.h>
19 #include <babeltrace/component/component.h>
21 static int sink_value
= 42;
23 static enum bt_component_status
sink_run(struct bt_component
*component
)
25 return BT_COMPONENT_STATUS_OK
;
28 static enum bt_component_status
comp_class_sink_init(
29 struct bt_component
*component
, struct bt_value
*params
)
31 enum bt_component_status ret
;
33 ret
= bt_component_set_private_data(component
, &sink_value
);
34 if (ret
!= BT_COMPONENT_STATUS_OK
) {
35 return BT_COMPONENT_STATUS_ERROR
;
38 ret
= bt_component_sink_set_consume_cb(component
, sink_run
);
39 if (ret
!= BT_COMPONENT_STATUS_OK
) {
40 return BT_COMPONENT_STATUS_ERROR
;
43 return BT_COMPONENT_STATUS_OK
;
46 static enum bt_component_status
comp_class_dummy_init(
47 struct bt_component
*component
, struct bt_value
*params
)
49 return BT_COMPONENT_STATUS_OK
;
52 BT_PLUGIN_NAME("test-sfs");
53 BT_PLUGIN_DESCRIPTION("Babeltrace plugin with source, sink, and filter component classes");
54 BT_PLUGIN_AUTHOR("Janine Sutto");
55 BT_PLUGIN_LICENSE("Beerware");
57 BT_PLUGIN_COMPONENT_CLASSES_BEGIN
58 BT_PLUGIN_COMPONENT_CLASS_SOURCE_ENTRY("source", "A source", comp_class_dummy_init
)
59 BT_PLUGIN_COMPONENT_CLASS_SINK_ENTRY("sink", "A sink", comp_class_sink_init
)
60 BT_PLUGIN_COMPONENT_CLASS_FILTER_ENTRY("filter", "A filter", comp_class_dummy_init
)
61 BT_PLUGIN_COMPONENT_CLASSES_END