From: Jérémie Galarneau Date: Wed, 9 Nov 2016 19:19:17 +0000 (-0500) Subject: Add bt_notification_get_stream interface X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=cc5236c95a8b0f6a6399a06d1ae7be44ab4007a6;p=deliverable%2Fbabeltrace.git Add bt_notification_get_stream interface Signed-off-by: Jérémie Galarneau --- 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; +}