1 #ifndef AUTODISC_AUTODISC_H
2 #define AUTODISC_AUTODISC_H
5 * Copyright (c) 2019 EfficiOS Inc. and Linux Foundation
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 #include <babeltrace2/babeltrace.h>
30 #define __BT_IN_BABELTRACE_H
31 #include <babeltrace2/func-status.h>
32 #undef __BT_IN_BABELTRACE_H
34 struct auto_source_discovery
{
35 /* Array of `struct auto_source_discovery_result *`. */
39 /* Value type of the `auto_source_discovery::results` array. */
41 struct auto_source_discovery_result
{
43 * `plugin_name` and `source_cc_name` are borrowed from the plugin and source
44 * component class (which outlive this structure).
46 const char *plugin_name
;
47 const char *source_cc_name
;
50 * `group` is owned by this structure.
52 * May be NULL, to mean "no group".
56 /* Array of input strings. */
60 * Array of integers: indices of the original inputs that contributed
63 bt_value
*original_input_indices
;
66 typedef enum auto_source_discovery_status
{
67 AUTO_SOURCE_DISCOVERY_STATUS_OK
= __BT_FUNC_STATUS_OK
,
68 AUTO_SOURCE_DISCOVERY_STATUS_ERROR
= __BT_FUNC_STATUS_ERROR
,
69 AUTO_SOURCE_DISCOVERY_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
70 AUTO_SOURCE_DISCOVERY_STATUS_INTERRUPTED
= __BT_FUNC_STATUS_INTERRUPTED
,
71 } auto_source_discovery_status
;
73 int auto_source_discovery_init(struct auto_source_discovery
*auto_disc
);
74 void auto_source_discovery_fini(struct auto_source_discovery
*auto_disc
);
77 * Given `inputs` a list of strings, query source component classes to discover
78 * which source components should be instantiated to deal with these inputs.
81 auto_source_discovery_status
auto_discover_source_components(
82 const bt_value
*inputs
,
83 const bt_plugin
**plugins
,
85 const char *component_class_restrict
,
86 enum bt_logging_level log_level
,
87 struct auto_source_discovery
*auto_disc
,
88 const bt_interrupter
*interrupter
);
90 #endif /* AUTODISC_AUTODISC_H */