From: Jérémie Galarneau Date: Tue, 19 May 2015 16:35:08 +0000 (-0400) Subject: Notification interfaces X-Git-Tag: v2.0.0-pre1~879 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=9900dfa70bfcad56a2647a1ec9e0edd44403849f Notification interfaces Signed-off-by: Jérémie Galarneau --- diff --git a/include/babeltrace/plugin/notification/eot.h b/include/babeltrace/plugin/notification/eot.h index e69de29b..d33476c8 100644 --- a/include/babeltrace/plugin/notification/eot.h +++ b/include/babeltrace/plugin/notification/eot.h @@ -0,0 +1,38 @@ +#ifndef BABELTRACE_PLUGIN_NOTIFICATION_EOT_H +#define BABELTRACE_PLUGIN_NOTIFICATION_EOT_H + +/* + * BabelTrace - Plug-in End of Trace Notification + * + * Copyright 2015 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * 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. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_PLUGIN_NOTIFICATION_EOT_H */ diff --git a/include/babeltrace/plugin/notification/event.h b/include/babeltrace/plugin/notification/event.h index 93d1d68a..39d3e03b 100644 --- a/include/babeltrace/plugin/notification/event.h +++ b/include/babeltrace/plugin/notification/event.h @@ -2,7 +2,7 @@ #define BABELTRACE_PLUGIN_NOTIFICATION_EVENT_H /* - * BabelTrace - Plug-in Notification + * BabelTrace - Plug-in Event Notification * * Copyright 2015 Jérémie Galarneau * @@ -27,16 +27,60 @@ * SOFTWARE. */ -#include - #ifdef __cplusplus extern "C" { #endif -struct bt_notification; +struct bt_plugin_notification; +struct bt_ctf_trace; +struct bt_ctf_stream; struct bt_ctf_event; -struct bt_ctf_event *bt_plugin_notification_event_get_event( +/** + * Create an event notification. + * + * @param trace The event's trace + * @param stream The event's stream + * @param event The event + * @returns An event notification instance + * + * @see #bt_plugin_notification_type + */ +extern struct bt_plugin_notification *bt_plugin_notification_event_create( + struct bt_ctf_trace *trace, struct bt_ctf_stream *stream, + struct bt_ctf_event *event); + +/** + * Get an event notification's associated trace. + * + * @param notification Event notification instance + * @returns A trace instance + * + * @see #bt_ctf_trace + */ +extern struct bt_ctf_trace *bt_plugin_notification_event_get_trace( + struct bt_plugin_notification *notification); + +/** + * Get an event notification's associated stream. + * + * @param notification Event notification instance + * @returns A stream instance + * + * @see #bt_ctf_stream + */ +extern struct bt_ctf_stream *bt_plugin_notification_event_get_stream( + struct bt_plugin_notification *notification); + +/** + * Get an event notification's event. + * + * @param notification Event notification instance + * @returns An event instance + * + * @see #bt_ctf_event + */ +extern struct bt_ctf_event *bt_plugin_notification_event_get_event( struct bt_plugin_notification *notification); #ifdef __cplusplus diff --git a/include/babeltrace/plugin/notification/iterator.h b/include/babeltrace/plugin/notification/iterator.h index 9c968f52..18ee4f62 100644 --- a/include/babeltrace/plugin/notification/iterator.h +++ b/include/babeltrace/plugin/notification/iterator.h @@ -77,7 +77,7 @@ enum bt_notification_iterator_seek_type { * This functions will not advance the cursor's position. * The returned notification's reference count is already incremented. * - * @param Iterator Iterator instance + * @param iterator Iterator instance * @returns Returns a bt_notification instance * * @see bt_notification_put() diff --git a/include/babeltrace/plugin/notification/notification.h b/include/babeltrace/plugin/notification/notification.h index a15fde6a..bc21a396 100644 --- a/include/babeltrace/plugin/notification/notification.h +++ b/include/babeltrace/plugin/notification/notification.h @@ -27,8 +27,6 @@ * SOFTWARE. */ -#include - #ifdef __cplusplus extern "C" { #endif @@ -57,7 +55,7 @@ enum bt_plugin_notification_type { * @param notification Notification instance * @returns One of #bt_plugin_notification_type */ -enum bt_plugin_notification_type bt_plugin_notification_get_type( +extern enum bt_plugin_notification_type bt_plugin_notification_get_type( struct bt_plugin_notification *notification); /** @@ -67,7 +65,8 @@ enum bt_plugin_notification_type bt_plugin_notification_get_type( * * @see bt_plugin_notification_put() */ -void bt_plugin_notification_get(struct bt_plugin_notification *notification); +extern void bt_plugin_notification_get( + struct bt_plugin_notification *notification); /** * Decrements the reference count of \p notification, destroying it when this @@ -77,7 +76,8 @@ void bt_plugin_notification_get(struct bt_plugin_notification *notification); * * @see bt_plugin_notification_get() */ -void bt_plugin_notification_put(struct bt_plugin_notification *notification); +extern void bt_plugin_notification_put( + struct bt_plugin_notification *notification); #ifdef __cplusplus } diff --git a/include/babeltrace/plugin/notification/packet.h b/include/babeltrace/plugin/notification/packet.h index e69de29b..ab952fe5 100644 --- a/include/babeltrace/plugin/notification/packet.h +++ b/include/babeltrace/plugin/notification/packet.h @@ -0,0 +1,38 @@ +#ifndef BABELTRACE_PLUGIN_NOTIFICATION_PACKET_H +#define BABELTRACE_PLUGIN_NOTIFICATION_PACKET_H + +/* + * BabelTrace - Plug-in New Packet Notification + * + * Copyright 2015 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * 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. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_PLUGIN_NOTIFICATION_NEW_PACKET_H */ diff --git a/include/babeltrace/plugin/plugin-internal.h b/include/babeltrace/plugin/plugin-internal.h index 83654c17..a0505318 100644 --- a/include/babeltrace/plugin/plugin-internal.h +++ b/include/babeltrace/plugin/plugin-internal.h @@ -28,6 +28,7 @@ */ #include +#include #include #ifdef __cplusplus @@ -37,6 +38,7 @@ extern "C" { struct bt_notification; struct bt_plugin { + struct bt_ctf_ref ref_count; GString *name; enum bt_plugin_type type;