Initial plug-in interface draft
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 3 Feb 2015 14:56:45 +0000 (09:56 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 16:54:29 +0000 (12:54 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/plugin/notification/event.h [new file with mode: 0644]
include/babeltrace/plugin/notification/iterator.h [new file with mode: 0644]
include/babeltrace/plugin/notification/notification.h [new file with mode: 0644]
include/babeltrace/plugin/plugin-internal.h [new file with mode: 0644]
include/babeltrace/plugin/plugin.h [new file with mode: 0644]
include/babeltrace/plugin/source.h [new file with mode: 0644]

diff --git a/include/babeltrace/plugin/notification/event.h b/include/babeltrace/plugin/notification/event.h
new file mode 100644 (file)
index 0000000..93d1d68
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef BABELTRACE_PLUGIN_NOTIFICATION_EVENT_H
+#define BABELTRACE_PLUGIN_NOTIFICATION_EVENT_H
+
+/*
+ * BabelTrace - Plug-in Notification
+ *
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_notification;
+struct bt_ctf_event;
+
+struct bt_ctf_event *bt_plugin_notification_event_get_event(
+               struct bt_plugin_notification *notification);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_NOTIFICATION_EVENT_H */
diff --git a/include/babeltrace/plugin/notification/iterator.h b/include/babeltrace/plugin/notification/iterator.h
new file mode 100644 (file)
index 0000000..baf62f0
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef BABELTRACE_PLUGIN_NOTIFICATION_ITERATOR_H
+#define BABELTRACE_PLUGIN_NOTIFICATION_ITERATOR_H
+
+/*
+ * BabelTrace - Plug-in Notification Iterator
+ *
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_notification;
+struct bt_notification_iterator;
+
+int bt_notification_iterator_next(struct bt_notification_iterator *iterator);
+
+struct bt_notification *bt_notification_iterator_get_notification(
+               struct bt_notification_iterator *iterator);
+
+void bt_notification_iterator_get(struct bt_notification_iterator *iterator);
+void bt_notification_iterator_put(struct bt_notification_iterator *iterator);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_NOTIFICATION_H */
diff --git a/include/babeltrace/plugin/notification/notification.h b/include/babeltrace/plugin/notification/notification.h
new file mode 100644 (file)
index 0000000..2d73dcc
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef BABELTRACE_PLUGIN_NOTIFICATION_H
+#define BABELTRACE_PLUGIN_NOTIFICATION_H
+
+/*
+ * BabelTrace - Plug-in Notification
+ *
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_notification;
+
+enum bt_plugin_notification_type {
+       BT_PLUGIN_NOTIFICATION_TYPE_UNKNOWN = -1,
+       BT_PLUGIN_NOTIFICATION_TYPE_EVENT = 0, /* see notification/event.h */
+};
+
+enum bt_plugin_notification_type bt_plugin_notification_get_type(
+               struct bt_plugin_notification *notification);
+
+void bt_plugin_notification_get(struct bt_plugin_notification *notification);
+void bt_plugin_notification_put(struct bt_plugin_notification *notification);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_NOTIFICATION_H */
diff --git a/include/babeltrace/plugin/plugin-internal.h b/include/babeltrace/plugin/plugin-internal.h
new file mode 100644 (file)
index 0000000..d6bbbd3
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef BABELTRACE_PLUGIN_INTERNAL_H
+#define BABELTRACE_PLUGIN_INTERNAL_H
+
+/*
+ * BabelTrace - Plug-in internal
+ *
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_notification;
+
+struct bt_plugin {
+       const char * name;
+       enum bt_plugin_type type;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_INTERNAL_H */
diff --git a/include/babeltrace/plugin/plugin.h b/include/babeltrace/plugin/plugin.h
new file mode 100644 (file)
index 0000000..9c2c5f0
--- /dev/null
@@ -0,0 +1,73 @@
+#ifndef BABELTRACE_PLUGIN_H
+#define BABELTRACE_PLUGIN_H
+
+/*
+ * BabelTrace - Plug-in
+ *
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_plugin;
+struct bt_notification;
+
+enum bt_plugin_type {
+       BT_PLUGIN_TYPE_UNKNOWN = -1,
+       /* A source plug-in is a notification generator. */
+       BT_PLUGIN_TYPE_SOURCE = 0,
+       /* A sink plug-in handles incoming notifications. */
+       BT_PLUGIN_TYPE_SINK = 1,
+       /* A filter plug-in implements both SOURCE and SINK interfaces. */
+       BT_PLUGIN_TYPE_FILTER = 2,
+};
+
+/**
+ * Plug-in discovery functions.
+ *
+ * The Babeltrace plug-in architecture mandates that a given plug-in shared
+ * object only define one plug-in. These functions are used to query a about
+ * shared object about its attributes.
+ *
+ * The functions marked as mandatory MUST be exported by the shared object
+ * to be considered a valid plug-in.
+ */
+enum bt_plugin_type bt_plugin_get_type(void);
+const char *bt_plugin_get_name(void);
+
+/* TODO: document mandatory fields and their expected types */
+int bt_plugin_set_parameters(struct bt_plugin *plugin,
+               struct bt_ctf_field *field);
+
+void bt_plugin_get(struct bt_plugin *plugin);
+void bt_plugin_put(struct bt_plugin *plugin);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_H */
diff --git a/include/babeltrace/plugin/source.h b/include/babeltrace/plugin/source.h
new file mode 100644 (file)
index 0000000..581b789
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef BABELTRACE_PLUGIN_SOURCE_H
+#define BABELTRACE_PLUGIN_SOURCE_H
+
+/*
+ * BabelTrace - Source Plug-in
+ *
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_plugin;
+struct bt_notification_iterator;
+typedef struct bt_iterator *(*bt_plugin_source_iterator_create_func)(struct bt_plugin *);
+
+struct bt_notification_iterator *bt_plugin_source_get_iterator(
+               struct bt_plugin *plugin);
+
+/* Plug-in initialization functions */
+struct bt_plugin *bt_plugin_source_create(void *data);
+int bt_plugin_source_set_iterator_create_function(struct bt_plugin *plugin,
+               bt_plugin_source_iterator_create_func func);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_SOURCE_H */
This page took 0.028278 seconds and 4 git commands to generate.