src.ctf.fs: use one CTF notif iter per notification iterator
[babeltrace.git] / plugins / ctf / common / notif-iter / notif-iter.h
index 476e7d7a90138639c127adaa8f5184551267eb5f..428dd2eca2332644fdd5c7224d60b58db711761a 100644 (file)
@@ -54,12 +54,12 @@ enum bt_ctf_notif_iter_medium_status {
         * The medium function called by the notification iterator
         * function reached the end of the file.
         */
-       BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF =   -4,
+       BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF =   1,
 
        /**
         * There is no data available right now, try again later.
         */
-       BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN = -3,
+       BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN = 11,
 
        /** Invalid argument. */
        BT_CTF_NOTIF_ITER_MEDIUM_STATUS_INVAL = -2,
@@ -247,7 +247,7 @@ struct bt_ctf_notif_iter_notif_event {
 BT_HIDDEN
 struct bt_ctf_notif_iter *bt_ctf_notif_iter_create(struct bt_ctf_trace *trace,
        size_t max_request_sz, struct bt_ctf_notif_iter_medium_ops medops,
-       void *medops_data, FILE *err_stream);
+       void *medops_data);
 
 /**
  * Destroys a CTF notification iterator, freeing all internal resources.
@@ -284,4 +284,66 @@ enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_next_notification(
                struct bt_clock_class_priority_map *cc_prio_map,
                struct bt_notification **notification);
 
+/**
+ * Returns the first packet header and context fields. This function
+ * never needs to call the `get_stream()` medium operation because
+ * it does not create packet or event objects.
+ *
+ * @param notif_iter           CTF notification iterator
+ * @param packet_header_field  Packet header field (\c NULL if there's
+ *                             no packet header field)
+ * @param packet_context_field Packet context field (\c NULL if there's
+ *                             no packet context field)
+ * @returns                    One of #bt_ctf_notif_iter_status values
+ */
+BT_HIDDEN
+enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_packet_header_context_fields(
+               struct bt_ctf_notif_iter *notit,
+               struct bt_ctf_field **packet_header_field,
+               struct bt_ctf_field **packet_context_field);
+
+BT_HIDDEN
+void bt_ctf_notif_iter_set_medops_data(struct bt_ctf_notif_iter *notit,
+               void *medops_data);
+
+static inline
+const char *bt_ctf_notif_iter_medium_status_string(
+               enum bt_ctf_notif_iter_medium_status status)
+{
+       switch (status) {
+       case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF:
+               return "BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF";
+       case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN:
+               return "BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN";
+       case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_INVAL:
+               return "BT_CTF_NOTIF_ITER_MEDIUM_STATUS_INVAL";
+       case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR:
+               return "BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR";
+       case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK:
+               return "BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK";
+       default:
+               return "(unknown)";
+       }
+}
+
+static inline
+const char *bt_ctf_notif_iter_status_string(
+               enum bt_ctf_notif_iter_status status)
+{
+       switch (status) {
+       case BT_CTF_NOTIF_ITER_STATUS_EOF:
+               return "BT_CTF_NOTIF_ITER_STATUS_EOF";
+       case BT_CTF_NOTIF_ITER_STATUS_AGAIN:
+               return "BT_CTF_NOTIF_ITER_STATUS_AGAIN";
+       case BT_CTF_NOTIF_ITER_STATUS_INVAL:
+               return "BT_CTF_NOTIF_ITER_STATUS_INVAL";
+       case BT_CTF_NOTIF_ITER_STATUS_ERROR:
+               return "BT_CTF_NOTIF_ITER_STATUS_ERROR";
+       case BT_CTF_NOTIF_ITER_STATUS_OK:
+               return "BT_CTF_NOTIF_ITER_STATUS_OK";
+       default:
+               return "(unknown)";
+       }
+}
+
 #endif /* CTF_NOTIF_ITER_H */
This page took 0.037006 seconds and 4 git commands to generate.