From cc5236c95a8b0f6a6399a06d1ae7be44ab4007a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 9 Nov 2016 14:19:17 -0500 Subject: [PATCH] Add bt_notification_get_stream interface MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- .../plugin/notification/notification-internal.h | 5 +++++ include/babeltrace/plugin/notification/stream.h | 1 + lib/plugin-system/notification/notification.c | 14 ++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/include/babeltrace/plugin/notification/notification-internal.h b/include/babeltrace/plugin/notification/notification-internal.h index 77b6bf13b..2259eac0e 100644 --- a/include/babeltrace/plugin/notification/notification-internal.h +++ b/include/babeltrace/plugin/notification/notification-internal.h @@ -31,14 +31,19 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { #endif +typedef struct bt_ctf_stream *(*get_stream_func)( + struct bt_notification *notification); + struct bt_notification { struct bt_object base; enum bt_notification_type type; + get_stream_func get_stream; }; BT_HIDDEN diff --git a/include/babeltrace/plugin/notification/stream.h b/include/babeltrace/plugin/notification/stream.h index 6f079256a..f717365cc 100644 --- a/include/babeltrace/plugin/notification/stream.h +++ b/include/babeltrace/plugin/notification/stream.h @@ -28,6 +28,7 @@ */ #include +#include #ifdef __cplusplus extern "C" { diff --git a/lib/plugin-system/notification/notification.c b/lib/plugin-system/notification/notification.c index 50aca6f77..139caed0b 100644 --- a/lib/plugin-system/notification/notification.c +++ b/lib/plugin-system/notification/notification.c @@ -42,3 +42,17 @@ enum bt_notification_type bt_notification_get_type( { return notification ? notification->type : BT_NOTIFICATION_TYPE_UNKNOWN; } + +struct bt_ctf_stream *bt_notification_get_stream( + struct bt_notification *notification) +{ + struct bt_ctf_stream *stream = NULL; + + if (!notification || !notification->get_stream) { + goto end; + } + + stream = notification->get_stream(notification); +end: + return stream; +} -- 2.34.1