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