Start ctf reader implementation stub
[babeltrace.git] / include / babeltrace / plugin / plugin-system.h
CommitLineData
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>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/**
bf36dbdf 40 * Plug-in private data deallocation function type.
43de0e13 41 *
bf36dbdf 42 * @param plugin Plug-in instance
43de0e13 43 */
bf36dbdf 44typedef void (*bt_plugin_destroy_cb)(struct bt_plugin *plugin);
43de0e13
JG
45
46/**
bf36dbdf 47 * Plug-in error stream registration function type.
43de0e13 48 *
bf36dbdf
JG
49 * @param plugin Plug-in instance
50 * @param error_stream Error stream, ownership is not transferred
51 * @returns One of #bt_plugin_status values
43de0e13 52 */
bf36dbdf
JG
53typedef enum bt_plugin_status (*bt_plugin_set_error_stream_cb)(
54 struct bt_plugin *plugin, FILE *error_stream);
43de0e13
JG
55
56/**
57 * Get a plug-in's private (implementation) data.
58 *
59 * @param plugin Plug-in of which to get the private data
60 * @returns Plug-in private data
61 */
62extern void *bt_plugin_get_private_data(struct bt_plugin *plugin);
63
64/**
65 * Set a callback permiting the registration of an error stream.
66 *
67 * @param plugin Plug-in to which the callback should be registered
68 * @param cb Error stream registration callback
69 */
70extern int bt_plugin_set_error_stream_cb(struct bt_plugin *plugin,
71 bt_plugin_set_error_stream_cb cb);
72
73/* Plug-in initialization functions */
74/**
75 * Allocate a source plug-in.
76 *
77 * @param name Plug-in instance name (will be copied)
78 * @param private_data Private plug-in implementation data
79 * @param destroy_cb Plug-in private data clean-up callback
80 * @param iterator_create_cb Iterator creation callback
81 * @returns A source plug-in instance
82 */
83extern struct bt_plugin *bt_plugin_source_create(const char *name,
84 void *private_data, bt_plugin_destroy_func destroy_func,
85 bt_plugin_source_iterator_create_cb iterator_create_cb);
86
87/**
88 * Allocate a sink plug-in.
89 *
90 * @param name Plug-in instance name (will be copied)
91 * @param private_data Private plug-in implementation data
92 * @param destroy_cb Plug-in private data clean-up callback
93 * @param notification_cb Notification handling callback
94 * @returns A sink plug-in instance
95 */
96extern struct bt_plugin *bt_plugin_sink_create(const char *name,
97 void *private_data, bt_plugin_destroy_func destroy_func,
98 bt_plugin_sink_handle_notification_cb notification_cb);
99
c602a809 100/* Notification iterator functions */
43de0e13 101/**
bfd20a42 102 * Allocate a notification iterator.
43de0e13
JG
103 *
104 * @param plugin Plug-in instance
105 * @param next_cb Callback advancing to the next notification
106 * @param notification_cb Callback providing the current notification
107 * @returns A notification iterator instance
108 */
109extern struct bt_notification_iterator *bt_notification_iterator_create(
110 struct bt_plugin *plugin,
111 bt_notification_iterator_next_cb next_cb,
112 bt_notification_iterator_get_notification_cb notification_cb);
113
c602a809
JG
114/**
115 * Set an iterator's private data.
116 *
117 * @param plugin Plug-in instance on which to iterate
118 * @param data Iterator private data
119 * @returns One of #bt_notification_iterator_status values
120 */
121extern enum bt_notification_iterator_status *bt_notification_iterator_create(
122 struct bt_plugin *plugin, void *data);
123
43de0e13
JG
124#ifdef __cplusplus
125}
126#endif
127
128#endif /* BABELTRACE_PLUGIN_SYSTEM_H */
This page took 0.027104 seconds and 4 git commands to generate.