Commit | Line | Data |
---|---|---|
cbb9e0b1 | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: GPL-2.0-only |
cbb9e0b1 | 3 | * |
0235b0db | 4 | * Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com> |
cbb9e0b1 PP |
5 | */ |
6 | ||
3fadfbc0 | 7 | #include <babeltrace2/babeltrace.h> |
578e048b | 8 | #include "common/assert.h" |
cbb9e0b1 | 9 | |
d24d5663 | 10 | static bt_component_class_sink_consume_method_status sink_consume( |
ecd7492f | 11 | bt_self_component_sink *self_comp __attribute__((unused))) |
cbb9e0b1 | 12 | { |
d24d5663 | 13 | return BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK; |
cbb9e0b1 PP |
14 | } |
15 | ||
c39793dd SM |
16 | static bt_component_class_get_supported_mip_versions_method_status |
17 | sink_get_supported_mip_versions( | |
ecd7492f MJ |
18 | bt_self_component_class_sink *source_component_class __attribute__((unused)), |
19 | const bt_value *params __attribute__((unused)), | |
20 | void *initialize_method_data __attribute__((unused)), | |
21 | bt_logging_level logging_level __attribute__((unused)), | |
c39793dd SM |
22 | bt_integer_range_set_unsigned *supported_versions) |
23 | { | |
24 | return (int) bt_integer_range_set_unsigned_add_range( | |
25 | supported_versions, 0, 0); | |
26 | } | |
27 | ||
a3f0c7db | 28 | static bt_message_iterator_class_initialize_method_status |
d24d5663 | 29 | src_dummy_iterator_init_method( |
ecd7492f MJ |
30 | bt_self_message_iterator *self_msg_iter __attribute__((unused)), |
31 | bt_self_message_iterator_configuration *config __attribute__((unused)), | |
32 | bt_self_component_port_output *self_port __attribute__((unused))) | |
cbb9e0b1 | 33 | { |
a3f0c7db | 34 | return BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK; |
d94d92ac PP |
35 | } |
36 | ||
a3f0c7db | 37 | static bt_message_iterator_class_initialize_method_status |
d24d5663 | 38 | flt_dummy_iterator_init_method( |
ecd7492f MJ |
39 | bt_self_message_iterator *self_msg_iter __attribute__((unused)), |
40 | bt_self_message_iterator_configuration *config __attribute__((unused)), | |
41 | bt_self_component_port_output *self_port __attribute__((unused))) | |
d94d92ac | 42 | { |
a3f0c7db | 43 | return BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_OK; |
d3eb6e8f PP |
44 | } |
45 | ||
64cadc66 | 46 | static void dummy_iterator_finalize_method( |
ecd7492f | 47 | bt_self_message_iterator *self_msg_iter __attribute__((unused))) |
d3eb6e8f PP |
48 | { |
49 | } | |
50 | ||
a3f0c7db | 51 | static bt_message_iterator_class_next_method_status |
d24d5663 | 52 | dummy_iterator_next_method( |
ecd7492f MJ |
53 | bt_self_message_iterator *self_msg_iter __attribute__((unused)), |
54 | bt_message_array_const msgs __attribute__((unused)), | |
55 | uint64_t capacity __attribute__((unused)), | |
56 | uint64_t *count __attribute__((unused))) | |
d3eb6e8f | 57 | { |
a3f0c7db | 58 | return BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK; |
d3eb6e8f PP |
59 | } |
60 | ||
d24d5663 | 61 | static bt_component_class_query_method_status flt_query_method( |
ecd7492f MJ |
62 | bt_self_component_class_filter *component_class __attribute__((unused)), |
63 | bt_private_query_executor *priv_query_exec __attribute__((unused)), | |
b19ff26f | 64 | const char *object, const bt_value *params, |
7c14d641 | 65 | __attribute__((unused)) void *method_data, |
b19ff26f | 66 | const bt_value **result) |
5933c0f2 | 67 | { |
b19ff26f PP |
68 | bt_value *res = bt_value_array_create(); |
69 | bt_value *val; | |
05e21286 | 70 | *result = res; |
c7eee084 | 71 | int iret; |
5933c0f2 | 72 | |
d94d92ac | 73 | BT_ASSERT(*result); |
05e21286 PP |
74 | iret = bt_value_array_append_string_element(res, object); |
75 | BT_ASSERT(iret == 0); | |
6be5a99e | 76 | iret = bt_value_copy(params, &val); |
25583cd0 | 77 | BT_ASSERT(iret == 0); |
05e21286 | 78 | iret = bt_value_array_append_element(res, val); |
25583cd0 | 79 | BT_ASSERT(iret == 0); |
c5b9b441 | 80 | bt_value_put_ref(val); |
d24d5663 | 81 | return BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK; |
5933c0f2 PP |
82 | } |
83 | ||
df5b5d01 | 84 | BT_PLUGIN_MODULE(); |
6ba0b073 | 85 | BT_PLUGIN(test_sfs); |
cbb9e0b1 PP |
86 | BT_PLUGIN_DESCRIPTION("Babeltrace plugin with source, sink, and filter component classes"); |
87 | BT_PLUGIN_AUTHOR("Janine Sutto"); | |
88 | BT_PLUGIN_LICENSE("Beerware"); | |
458e8e1d | 89 | BT_PLUGIN_VERSION(1, 2, 3, "yes"); |
cbb9e0b1 | 90 | |
41a2b7ae | 91 | BT_PLUGIN_SOURCE_COMPONENT_CLASS(source, dummy_iterator_next_method); |
d3e4dcd8 | 92 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(source, "A source."); |
8e1fe2a4 | 93 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD(source, |
d94d92ac | 94 | src_dummy_iterator_init_method); |
8e1fe2a4 | 95 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD(source, |
64cadc66 | 96 | dummy_iterator_finalize_method); |
6ba0b073 | 97 | |
d3e4dcd8 PP |
98 | BT_PLUGIN_SINK_COMPONENT_CLASS(sink, sink_consume); |
99 | BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(sink, "A sink."); | |
a889b89f PP |
100 | BT_PLUGIN_SINK_COMPONENT_CLASS_HELP(sink, |
101 | "Bacon ipsum dolor amet strip steak cupim pastrami venison shoulder.\n" | |
102 | "Prosciutto beef ribs flank meatloaf pancetta brisket kielbasa drumstick\n" | |
103 | "venison tenderloin cow tail. Beef short loin shoulder meatball, sirloin\n" | |
104 | "ground round brisket salami cupim pork bresaola turkey bacon boudin.\n" | |
105 | ); | |
c39793dd SM |
106 | BT_PLUGIN_SINK_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD(sink, |
107 | sink_get_supported_mip_versions); | |
6ba0b073 | 108 | |
41a2b7ae | 109 | BT_PLUGIN_FILTER_COMPONENT_CLASS(filter, dummy_iterator_next_method); |
d3e4dcd8 | 110 | BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(filter, "A filter."); |
8e1fe2a4 | 111 | BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD(filter, |
d94d92ac | 112 | flt_dummy_iterator_init_method); |
8e1fe2a4 | 113 | BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD(filter, |
64cadc66 | 114 | dummy_iterator_finalize_method); |
d94d92ac | 115 | BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(filter, flt_query_method); |