Move to kernel style SPDX license identifiers
[babeltrace.git] / src / autodisc / autodisc.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2019 EfficiOS Inc. and Linux Foundation
5 */
6
7 #ifndef AUTODISC_AUTODISC_H
8 #define AUTODISC_AUTODISC_H
9
10 #include <glib.h>
11
12 #include <babeltrace2/babeltrace.h>
13
14 #define __BT_IN_BABELTRACE_H
15 #include <babeltrace2/func-status.h>
16 #undef __BT_IN_BABELTRACE_H
17
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;
42
43 /*
44 * Array of integers: indices of the original inputs that contributed
45 * to this result.
46 */
47 bt_value *original_input_indices;
48 };
49
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
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.
63 */
64
65 auto_source_discovery_status auto_discover_source_components(
66 const bt_value *inputs,
67 const bt_plugin **plugins,
68 size_t plugin_count,
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);
73
74 #endif /* AUTODISC_AUTODISC_H */
This page took 0.030205 seconds and 4 git commands to generate.