Commit | Line | Data |
---|---|---|
77a5caaf SM |
1 | #ifndef AUTODISC_AUTODISC_H |
2 | #define AUTODISC_AUTODISC_H | |
a1040187 SM |
3 | |
4 | /* | |
5 | * Copyright (c) 2019 EfficiOS Inc. and Linux Foundation | |
6 | * | |
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: | |
13 | * | |
14 | * The above copyright notice and this permission notice shall be included in | |
15 | * all copies or substantial portions of the Software. | |
16 | * | |
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 | |
23 | * SOFTWARE. | |
24 | */ | |
25 | ||
26 | #include <glib.h> | |
27 | ||
28 | #include <babeltrace2/babeltrace.h> | |
29 | ||
3f8644ec SM |
30 | #define __BT_IN_BABELTRACE_H |
31 | #include <babeltrace2/func-status.h> | |
32 | #undef __BT_IN_BABELTRACE_H | |
33 | ||
a1040187 SM |
34 | struct auto_source_discovery { |
35 | /* Array of `struct auto_source_discovery_result *`. */ | |
36 | GPtrArray *results; | |
37 | }; | |
38 | ||
39 | /* Value type of the `auto_source_discovery::results` array. */ | |
40 | ||
41 | struct auto_source_discovery_result { | |
42 | /* | |
43 | * `plugin_name` and `source_cc_name` are borrowed from the plugin and source | |
44 | * component class (which outlive this structure). | |
45 | */ | |
46 | const char *plugin_name; | |
47 | const char *source_cc_name; | |
48 | ||
49 | /* | |
50 | * `group` is owned by this structure. | |
51 | * | |
52 | * May be NULL, to mean "no group". | |
53 | */ | |
54 | gchar *group; | |
55 | ||
56 | /* Array of input strings. */ | |
57 | bt_value *inputs; | |
459f81ca SM |
58 | |
59 | /* | |
60 | * Array of integers: indices of the original inputs that contributed | |
61 | * to this result. | |
62 | */ | |
63 | bt_value *original_input_indices; | |
a1040187 SM |
64 | }; |
65 | ||
3f8644ec SM |
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; | |
72 | ||
a1040187 SM |
73 | int auto_source_discovery_init(struct auto_source_discovery *auto_disc); |
74 | void auto_source_discovery_fini(struct auto_source_discovery *auto_disc); | |
75 | ||
76 | /* | |
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. | |
a1040187 SM |
79 | */ |
80 | ||
3f8644ec | 81 | auto_source_discovery_status auto_discover_source_components( |
a1040187 | 82 | const bt_value *inputs, |
77a5caaf SM |
83 | const bt_plugin **plugins, |
84 | size_t plugin_count, | |
85 | const char *component_class_restrict, | |
a1040187 | 86 | enum bt_logging_level log_level, |
3f8644ec SM |
87 | struct auto_source_discovery *auto_disc, |
88 | const bt_interrupter *interrupter); | |
a1040187 | 89 | |
77a5caaf | 90 | #endif /* AUTODISC_AUTODISC_H */ |