Commit | Line | Data |
---|---|---|
73760435 | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
73760435 | 3 | * |
0235b0db | 4 | * Copyright (C) 2019 EfficiOS Inc. and Linux Foundation |
73760435 SM |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef AUTODISC_AUTODISC_H |
8 | #define AUTODISC_AUTODISC_H | |
9 | ||
73760435 SM |
10 | #include <glib.h> |
11 | ||
12 | #include <babeltrace2/babeltrace.h> | |
13 | ||
3dae1685 SM |
14 | #define __BT_IN_BABELTRACE_H |
15 | #include <babeltrace2/func-status.h> | |
16 | #undef __BT_IN_BABELTRACE_H | |
17 | ||
73760435 SM |
18 | struct auto_source_discovery { |
19 | /* Array of `struct auto_source_discovery_result *`. */ | |
20 | GPtrArray *results; | |
21 | }; | |
22 | ||
23 | /* Value type of the `auto_source_discovery::results` array. */ | |
24 | ||
25 | struct auto_source_discovery_result { | |
26 | /* | |
27 | * `plugin_name` and `source_cc_name` are borrowed from the plugin and source | |
28 | * component class (which outlive this structure). | |
29 | */ | |
30 | const char *plugin_name; | |
31 | const char *source_cc_name; | |
32 | ||
33 | /* | |
34 | * `group` is owned by this structure. | |
35 | * | |
36 | * May be NULL, to mean "no group". | |
37 | */ | |
38 | gchar *group; | |
39 | ||
40 | /* Array of input strings. */ | |
41 | bt_value *inputs; | |
1ead9076 SM |
42 | |
43 | /* | |
44 | * Array of integers: indices of the original inputs that contributed | |
45 | * to this result. | |
46 | */ | |
47 | bt_value *original_input_indices; | |
73760435 SM |
48 | }; |
49 | ||
3dae1685 SM |
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; | |
56 | ||
73760435 SM |
57 | int auto_source_discovery_init(struct auto_source_discovery *auto_disc); |
58 | void auto_source_discovery_fini(struct auto_source_discovery *auto_disc); | |
59 | ||
60 | /* | |
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. | |
73760435 SM |
63 | */ |
64 | ||
3dae1685 | 65 | auto_source_discovery_status auto_discover_source_components( |
73760435 | 66 | const bt_value *inputs, |
97010665 SM |
67 | const bt_plugin **plugins, |
68 | size_t plugin_count, | |
69 | const char *component_class_restrict, | |
73760435 | 70 | enum bt_logging_level log_level, |
3dae1685 SM |
71 | struct auto_source_discovery *auto_disc, |
72 | const bt_interrupter *interrupter); | |
73760435 | 73 | |
97010665 | 74 | #endif /* AUTODISC_AUTODISC_H */ |