#include <babeltrace/babeltrace.h>
#include <babeltrace/babeltrace-internal.h>
+#include "../metadata/ctf-meta.h"
+
/**
* @file ctf-notif-iter.h
*
* @returns Stream instance (weak reference) or
* \c NULL on error
*/
- struct bt_stream * (* borrow_stream)(
- struct bt_stream_class *stream_class,
- uint64_t stream_id, void *data);
+ bt_stream * (* borrow_stream)(
+ bt_stream_class *stream_class,
+ int64_t stream_id, void *data);
};
/** CTF notification iterator. */
struct bt_notif_iter;
-// TODO: Replace by the real thing
-enum bt_notif_iter_notif_type {
- BT_NOTIF_ITER_NOTIF_NEW_PACKET,
- BT_NOTIF_ITER_NOTIF_END_OF_PACKET,
- BT_NOTIF_ITER_NOTIF_EVENT,
-};
-
-struct bt_notif_iter_notif {
- enum bt_notif_iter_notif_type type;
-};
-
-struct bt_notif_iter_notif_new_packet {
- struct bt_notif_iter_notif base;
- struct bt_packet *packet;
-};
-
-struct bt_notif_iter_notif_end_of_packet {
- struct bt_notif_iter_notif base;
- struct bt_packet *packet;
-};
-
-struct bt_notif_iter_notif_event {
- struct bt_notif_iter_notif base;
- struct bt_event *event;
-};
-
/**
* Creates a CTF notification iterator.
*
* success, or \c NULL on error
*/
BT_HIDDEN
-struct bt_notif_iter *bt_notif_iter_create(struct bt_trace *trace,
+struct bt_notif_iter *bt_notif_iter_create(struct ctf_trace_class *tc,
size_t max_request_sz, struct bt_notif_iter_medium_ops medops,
void *medops_data);
* call this function again, until another status is returned.
*
* @param notif_iter CTF notification iterator
- * @param cc_prio_map Clock class priority map to use when
- * creating an event notification
* @param notification Returned notification if the function's
* return value is #BT_NOTIF_ITER_STATUS_OK
* @returns One of #bt_notif_iter_status values
BT_HIDDEN
enum bt_notif_iter_status bt_notif_iter_get_next_notification(
struct bt_notif_iter *notit,
- struct bt_clock_class_priority_map *cc_prio_map,
- struct bt_notification **notification);
+ bt_self_notification_iterator *notif_iter,
+ bt_notification **notification);
/**
* Returns the first packet header and context fields. This function
BT_HIDDEN
enum bt_notif_iter_status bt_notif_iter_borrow_packet_header_context_fields(
struct bt_notif_iter *notit,
- struct bt_field **packet_header_field,
- struct bt_field **packet_context_field);
+ bt_field **packet_header_field,
+ bt_field **packet_context_field);
+
+struct bt_notif_iter_packet_properties {
+ uint64_t exp_packet_total_size;
+ uint64_t exp_packet_content_size;
+ uint64_t stream_class_id;
+ int64_t data_stream_id;
+
+ struct {
+ uint64_t discarded_events;
+ uint64_t packets;
+ uint64_t beginning_clock;
+ uint64_t end_clock;
+ } snapshots;
+};
+
+BT_HIDDEN
+enum bt_notif_iter_status bt_notif_iter_get_packet_properties(
+ struct bt_notif_iter *notit,
+ struct bt_notif_iter_packet_properties *props);
BT_HIDDEN
void bt_notif_iter_set_medops_data(struct bt_notif_iter *notit,
* Resets the iterator so that the next requested medium bytes are
* assumed to be the first bytes of a new stream. The first notification
* which this iterator emits after calling bt_notif_iter_reset() is a
- * BT_NOTIFICATION_TYPE_STREAM_BEGIN one.
+ * BT_NOTIFICATION_TYPE_STREAM_BEGINNING one.
*/
BT_HIDDEN
void bt_notif_iter_reset(struct bt_notif_iter *notit);
+/*
+ * Notify the iterator that the trace class changed somehow (new
+ * stream/event classes).
+ */
+BT_HIDDEN
+void bt_notif_trace_class_changed(struct bt_notif_iter *notit);
+
static inline
const char *bt_notif_iter_medium_status_string(
enum bt_notif_iter_medium_status status)