2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 2019 EfficiOS Inc. and Linux Foundation
7 #ifndef AUTODISC_AUTODISC_H
8 #define AUTODISC_AUTODISC_H
12 #include <babeltrace2/babeltrace.h>
14 #define __BT_IN_BABELTRACE_H
15 #include <babeltrace2/func-status.h>
16 #undef __BT_IN_BABELTRACE_H
18 struct auto_source_discovery
{
19 /* Array of `struct auto_source_discovery_result *`. */
23 /* Value type of the `auto_source_discovery::results` array. */
25 struct auto_source_discovery_result
{
27 * `plugin_name` and `source_cc_name` are borrowed from the plugin and source
28 * component class (which outlive this structure).
30 const char *plugin_name
;
31 const char *source_cc_name
;
34 * `group` is owned by this structure.
36 * May be NULL, to mean "no group".
40 /* Array of input strings. */
44 * Array of integers: indices of the original inputs that contributed
47 bt_value
*original_input_indices
;
50 typedef enum auto_source_discovery_status
{
51 AUTO_SOURCE_DISCOVERY_STATUS_OK
= __BT_FUNC_STATUS_OK
,
52 AUTO_SOURCE_DISCOVERY_STATUS_ERROR
= __BT_FUNC_STATUS_ERROR
,
53 AUTO_SOURCE_DISCOVERY_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
54 AUTO_SOURCE_DISCOVERY_STATUS_INTERRUPTED
= __BT_FUNC_STATUS_INTERRUPTED
,
55 } auto_source_discovery_status
;
57 int auto_source_discovery_init(struct auto_source_discovery
*auto_disc
);
58 void auto_source_discovery_fini(struct auto_source_discovery
*auto_disc
);
61 * Given `inputs` a list of strings, query source component classes to discover
62 * which source components should be instantiated to deal with these inputs.
65 auto_source_discovery_status
auto_discover_source_components(
66 const bt_value
*inputs
,
67 const bt_plugin
**plugins
,
69 const char *component_class_restrict
,
70 enum bt_logging_level log_level
,
71 struct auto_source_discovery
*auto_disc
,
72 const bt_interrupter
*interrupter
);
74 #endif /* AUTODISC_AUTODISC_H */