Commit | Line | Data |
---|---|---|
a1040187 SM |
1 | #ifndef CLI_BABELTRACE_CFG_SRC_AUTO_DISC_H |
2 | #define CLI_BABELTRACE_CFG_SRC_AUTO_DISC_H | |
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 | ||
30 | struct auto_source_discovery { | |
31 | /* Array of `struct auto_source_discovery_result *`. */ | |
32 | GPtrArray *results; | |
33 | }; | |
34 | ||
35 | /* Value type of the `auto_source_discovery::results` array. */ | |
36 | ||
37 | struct auto_source_discovery_result { | |
38 | /* | |
39 | * `plugin_name` and `source_cc_name` are borrowed from the plugin and source | |
40 | * component class (which outlive this structure). | |
41 | */ | |
42 | const char *plugin_name; | |
43 | const char *source_cc_name; | |
44 | ||
45 | /* | |
46 | * `group` is owned by this structure. | |
47 | * | |
48 | * May be NULL, to mean "no group". | |
49 | */ | |
50 | gchar *group; | |
51 | ||
52 | /* Array of input strings. */ | |
53 | bt_value *inputs; | |
459f81ca SM |
54 | |
55 | /* | |
56 | * Array of integers: indices of the original inputs that contributed | |
57 | * to this result. | |
58 | */ | |
59 | bt_value *original_input_indices; | |
a1040187 SM |
60 | }; |
61 | ||
62 | int auto_source_discovery_init(struct auto_source_discovery *auto_disc); | |
63 | void auto_source_discovery_fini(struct auto_source_discovery *auto_disc); | |
64 | ||
65 | /* | |
66 | * Given `inputs` a list of strings, query source component classes to discover | |
67 | * which source components should be instantiated to deal with these inputs. | |
68 | * | |
69 | * Return 0 if execution completed successfully, < 0 otherwise. | |
70 | */ | |
71 | ||
72 | int auto_discover_source_components( | |
73 | const bt_value *plugin_paths, | |
74 | const bt_value *inputs, | |
75 | const char *plugin_filter, | |
76 | const char *component_class_filter, | |
77 | enum bt_logging_level log_level, | |
78 | struct auto_source_discovery *auto_disc); | |
79 | ||
80 | #endif /* CLI_BABELTRACE_CFG_SRC_AUTO_DISC_H */ |