X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fplugin%2Fplugin-system.h;h=ec84b872926bdc369c2d16ed43e504bf16774024;hb=fec2a9f220bdae0ce64716538c111348302f2696;hp=59fc54cc79f3e2eb889c8bbedfe3e9489677a4c2;hpb=0dfd8ee4fd5f9cf7745f287b3d88c824e91c2f91;p=babeltrace.git diff --git a/include/babeltrace/plugin/plugin-system.h b/include/babeltrace/plugin/plugin-system.h index 59fc54cc..ec84b872 100644 --- a/include/babeltrace/plugin/plugin-system.h +++ b/include/babeltrace/plugin/plugin-system.h @@ -31,6 +31,7 @@ */ #include +#include #ifdef __cplusplus extern "C" { @@ -49,9 +50,9 @@ typedef void (*bt_plugin_exit_func)(void); /** * Component private data deallocation function type. * - * @param data Component private data + * @param component Component instance */ -typedef void (*bt_component_destroy_cb)(void *data); +typedef void (*bt_component_destroy_cb)(struct bt_component *component); /** * Component initialization function type. @@ -121,45 +122,68 @@ bt_component_source_set_iterator_init_cb(struct bt_component *source, /** bt_component_sink */ /** - * Notification handling function type. + * Notification consumption function type. * - * A reference must be taken on the notification if the component wishes to - * keep ownership of the notification beyond the invocation of the callback. + * @param sink Sink component instance + * @returns One of #bt_component_status values + */ +typedef enum bt_component_status (*bt_component_sink_consume_cb)( + struct bt_component *); + +/** + * Iterator addition function type. + * + * A sink component may choose to refuse the addition of an iterator + * by not returning BT_COMPONENT_STATUS_OK. * * @param sink Sink component instance - * @param notification Notification to handle * @returns One of #bt_component_status values */ -typedef enum bt_component_status (*bt_component_sink_handle_notification_cb)( - struct bt_component *, struct bt_notification *); +typedef enum bt_component_status (*bt_component_sink_add_iterator_cb)( + struct bt_component *, struct bt_notification_iterator *); /** - * Set a sink component's notification handling callback. + * Set a sink component's consumption callback. * - * @param sink Sink component instance - * @param handle_notification Notification handling callback - * @returns One of #bt_component_status values + * @param sink Sink component instance + * @param consume Consumption callback + * @returns One of #bt_component_status values */ extern enum bt_component_status -bt_component_sink_set_handle_notification_cb(struct bt_component *sink, - bt_component_sink_handle_notification_cb handle_notification); +bt_component_sink_set_consume_cb(struct bt_component *sink, + bt_component_sink_consume_cb consume); /** - * Register a sink to a given notification type. + * Set a sink component's iterator addition callback. * - * A sink is always registered to notifications of type - * BT_NOTIFICATION_TYPE_EVENT. However, it may opt to receive any (or all) - * other notification type(s). - * - * @param sink Sink component instance. - * @param type One of #bt_notification_type - * @returns One of #bt_component_status + * @param sink Sink component instance + * @param add_iterator Iterator addition callback + * @returns One of #bt_component_status values */ extern enum bt_component_status -bt_component_sink_register_notification_type(struct bt_component *sink, - enum bt_notification_type type); +bt_component_sink_set_add_iterator_cb(struct bt_component *sink, + bt_component_sink_add_iterator_cb add_iterator); + +/* Defaults to 1. */ +extern enum bt_component_status +bt_component_sink_set_minimum_input_count(struct bt_component *sink, + unsigned int minimum); + +/* Defaults to 1. */ +extern enum bt_component_status +bt_component_sink_set_maximum_input_count(struct bt_component *sink, + unsigned int maximum); + +extern enum bt_component_status +bt_component_sink_get_input_count(struct bt_component *sink, + unsigned int *count); + +/* May return NULL after an interator has reached its end. */ +extern enum bt_component_status +bt_component_sink_get_input_iterator(struct bt_component *sink, + unsigned int input, struct bt_notification_iterator **iterator); -/** bt_component_notification_iterator */ +/** bt_notification_iterator */ /** * Function returning an iterator's current notification. *