Commit | Line | Data |
---|---|---|
43de0e13 JG |
1 | #ifndef BABELTRACE_PLUGIN_SYSTEM_H |
2 | #define BABELTRACE_PLUGIN_SYSTEM_H | |
3 | ||
4 | /* | |
5 | * BabelTrace - Babeltrace Plug-in System Interface | |
6 | * | |
7 | * This interface is provided for plug-ins to use the Babeltrace | |
8 | * plug-in system facilities. | |
9 | * | |
10 | * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
11 | * | |
12 | * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
13 | * | |
14 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
15 | * of this software and associated documentation files (the "Software"), to deal | |
16 | * in the Software without restriction, including without limitation the rights | |
17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
18 | * copies of the Software, and to permit persons to whom the Software is | |
19 | * furnished to do so, subject to the following conditions: | |
20 | * | |
21 | * The above copyright notice and this permission notice shall be included in | |
22 | * all copies or substantial portions of the Software. | |
23 | * | |
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
30 | * SOFTWARE. | |
31 | */ | |
32 | ||
33 | #include <babeltrace/objects.h> | |
47e5a032 | 34 | #include <babeltrace/objects.h> |
43de0e13 JG |
35 | |
36 | #ifdef __cplusplus | |
37 | extern "C" { | |
38 | #endif | |
39 | ||
2bd8a567 | 40 | struct bt_notification; |
47e5a032 JG |
41 | struct bt_notification_iterator; |
42 | struct bt_component; | |
2bd8a567 | 43 | |
43de0e13 | 44 | /** |
633edee0 | 45 | * Component private data deallocation function type. |
43de0e13 | 46 | * |
633edee0 | 47 | * @param component Component instance |
43de0e13 | 48 | */ |
633edee0 | 49 | typedef void (*bt_component_destroy_cb)(struct bt_component *component); |
43de0e13 | 50 | |
2bd8a567 JG |
51 | /** |
52 | * Iterator creation function type. | |
53 | * | |
633edee0 | 54 | * @param component Component instance |
2bd8a567 | 55 | */ |
47e5a032 JG |
56 | typedef enum bt_component_status (*bt_component_source_iterator_init_cb)( |
57 | struct bt_component *component, | |
58 | struct bt_notification_iterator *iterator); | |
59 | ||
60 | typedef struct bt_component *(*bt_component_init_cb)( | |
61 | struct bt_component *component); | |
62 | ||
63 | typedef struct bt_component *(*bt_component_fini_cb)( | |
633edee0 | 64 | struct bt_component *component); |
2bd8a567 JG |
65 | |
66 | /** | |
67 | * Notification handling function type. | |
68 | * | |
633edee0 | 69 | * @param component Component instance |
2bd8a567 | 70 | * @param notificattion Notification to handle |
633edee0 | 71 | * @returns One of #bt_component_status values |
2bd8a567 | 72 | */ |
633edee0 JG |
73 | typedef enum bt_component_status (*bt_component_sink_handle_notification_cb)( |
74 | struct bt_component *, struct bt_notification *); | |
2bd8a567 | 75 | |
47e5a032 | 76 | typedef struct bt_notification *(*bt_notification_iterator_get_cb)( |
2bd8a567 JG |
77 | struct bt_notification_iterator *); |
78 | ||
47e5a032 | 79 | typedef enum bt_notification_iterator_status (*bt_notification_iterator_next_cb)( |
2bd8a567 JG |
80 | struct bt_notification_iterator *); |
81 | ||
43de0e13 | 82 | /** |
633edee0 | 83 | * Get a component's private (implementation) data. |
43de0e13 | 84 | * |
633edee0 | 85 | * @param component Component of which to get the private data |
0d884c50 | 86 | * @returns Component's private data |
43de0e13 | 87 | */ |
633edee0 | 88 | extern void *bt_component_get_private_data(struct bt_component *component); |
43de0e13 | 89 | |
47e5a032 JG |
90 | extern enum bt_notification_iterator_status |
91 | bt_notification_iterator_set_get_cb(struct bt_notification_iterator *iterator, | |
92 | bt_notification_iterator_get_cb get); | |
93 | ||
94 | extern enum bt_notification_iterator_status | |
95 | bt_notification_iterator_set_next_cb(struct bt_notification_iterator *iterator, | |
96 | bt_notification_iterator_next_cb next); | |
97 | ||
98 | extern enum bt_notification_iterator_status | |
99 | bt_notification_iterator_set_private_data( | |
100 | struct bt_notification_iterator *iterator, void *data); | |
101 | ||
102 | extern void *bt_notification_iterator_get_private_data( | |
103 | struct bt_notification_iterator *iterator); | |
104 | ||
43de0e13 | 105 | /** |
633edee0 | 106 | * Set a component's private (implementation) data. |
43de0e13 | 107 | * |
633edee0 | 108 | * @param component Component of which to set the private data |
0d884c50 JG |
109 | * @param data Component private data |
110 | * @returns One of #bt_component_status values | |
43de0e13 | 111 | */ |
0d884c50 JG |
112 | extern enum bt_component_status bt_component_set_private_data( |
113 | struct bt_component *component, void *data); | |
43de0e13 | 114 | |
43de0e13 JG |
115 | #ifdef __cplusplus |
116 | } | |
117 | #endif | |
118 | ||
119 | #endif /* BABELTRACE_PLUGIN_SYSTEM_H */ |