Automatically generate discarded packets/events notifications
[babeltrace.git] / include / babeltrace / graph / notification-iterator-internal.h
index 5903a586ecae7e3bb9fcba3f88737ecb90ca0711..9fcab16af8d59a4117ce730ebe3e6ab8d44c2eeb 100644 (file)
@@ -44,6 +44,8 @@ enum bt_notification_iterator_notif_type {
        BT_NOTIFICATION_ITERATOR_NOTIF_TYPE_STREAM_END =        (1U << 3),
        BT_NOTIFICATION_ITERATOR_NOTIF_TYPE_PACKET_BEGIN =      (1U << 4),
        BT_NOTIFICATION_ITERATOR_NOTIF_TYPE_PACKET_END =        (1U << 5),
+       BT_NOTIFICATION_ITERATOR_NOTIF_TYPE_DISCARDED_EVENTS =  (1U << 6),
+       BT_NOTIFICATION_ITERATOR_NOTIF_TYPE_DISCARDED_PACKETS = (1U << 7),
 };
 
 enum bt_notification_iterator_state {
@@ -132,28 +134,13 @@ bt_private_notification_iterator_from_notification_iterator(
        return (void *) notification_iterator;
 }
 
-/**
- * Allocate a notification iterator.
- *
- * @param component            Component instance
- * @returns                    A notification iterator instance
- */
 BT_HIDDEN
-struct bt_notification_iterator *bt_notification_iterator_create(
-               struct bt_component *upstream_component,
+enum bt_connection_status bt_notification_iterator_create(
+               struct bt_component *upstream_comp,
                struct bt_port *upstream_port,
                const enum bt_notification_type *notification_types,
-               struct bt_connection *connection);
-
-/**
- * Validate a notification iterator.
- *
- * @param iterator             Notification iterator instance
- * @returns                    One of #bt_component_status values
- */
-BT_HIDDEN
-enum bt_notification_iterator_status bt_notification_iterator_validate(
-               struct bt_notification_iterator *iterator);
+               struct bt_connection *connection,
+               struct bt_notification_iterator **iterator);
 
 BT_HIDDEN
 void bt_notification_iterator_finalize(
@@ -164,4 +151,48 @@ void bt_notification_iterator_set_connection(
                struct bt_notification_iterator *iterator,
                struct bt_connection *connection);
 
+static inline
+const char *bt_notification_iterator_status_string(
+               enum bt_notification_iterator_status status)
+{
+       switch (status) {
+       case BT_NOTIFICATION_ITERATOR_STATUS_CANCELED:
+               return "BT_NOTIFICATION_ITERATOR_STATUS_CANCELED";
+       case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
+               return "BT_NOTIFICATION_ITERATOR_STATUS_AGAIN";
+       case BT_NOTIFICATION_ITERATOR_STATUS_END:
+               return "BT_NOTIFICATION_ITERATOR_STATUS_END";
+       case BT_NOTIFICATION_ITERATOR_STATUS_OK:
+               return "BT_NOTIFICATION_ITERATOR_STATUS_OK";
+       case BT_NOTIFICATION_ITERATOR_STATUS_INVALID:
+               return "BT_NOTIFICATION_ITERATOR_STATUS_INVALID";
+       case BT_NOTIFICATION_ITERATOR_STATUS_ERROR:
+               return "BT_NOTIFICATION_ITERATOR_STATUS_ERROR";
+       case BT_NOTIFICATION_ITERATOR_STATUS_NOMEM:
+               return "BT_NOTIFICATION_ITERATOR_STATUS_NOMEM";
+       case BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED:
+               return "BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED";
+       default:
+               return "(unknown)";
+       }
+};
+
+static inline
+const char *bt_notification_iterator_state_string(
+               enum bt_notification_iterator_state state)
+{
+       switch (state) {
+       case BT_NOTIFICATION_ITERATOR_STATE_ACTIVE:
+               return "BT_NOTIFICATION_ITERATOR_STATE_ACTIVE";
+       case BT_NOTIFICATION_ITERATOR_STATE_ENDED:
+               return "BT_NOTIFICATION_ITERATOR_STATE_ENDED";
+       case BT_NOTIFICATION_ITERATOR_STATE_FINALIZED:
+               return "BT_NOTIFICATION_ITERATOR_STATE_FINALIZED";
+       case BT_NOTIFICATION_ITERATOR_STATE_FINALIZED_AND_ENDED:
+               return "BT_NOTIFICATION_ITERATOR_STATE_FINALIZED_AND_ENDED";
+       default:
+               return "(unknown)";
+       }
+};
+
 #endif /* BABELTRACE_COMPONENT_NOTIFICATION_ITERATOR_INTERNAL_H */
This page took 0.024648 seconds and 4 git commands to generate.