+#include <babeltrace/prio_heap.h>
+#include <babeltrace/babeltrace.h>
+#include <babeltrace/types.h>
+#include <babeltrace/ctf/types.h>
+#include <babeltrace/ctf-ir/metadata.h>
+#include <stdarg.h>
+
+struct stream_saved_pos {
+ /*
+ * Use file_stream pointer to check if the trace collection we
+ * restore to match the one we saved from, for each stream.
+ */
+ struct ctf_file_stream *file_stream;
+ size_t cur_index; /* current index in packet index */
+ ssize_t offset; /* offset from base, in bits. EOF for end of file. */
+};
+
+struct babeltrace_saved_pos {
+ struct trace_collection *tc;
+ GArray *stream_saved_pos; /* Contains struct stream_saved_pos */
+};
+
+struct bt_callback {
+ int prio; /* Callback order priority. Lower first. Dynamically assigned from dependency graph. */
+ void *private_data;
+ enum bt_cb_ret (*callback)(void *private_data, void *caller_data);
+};
+
+struct bt_callback_chain {
+ GArray *callback; /* Array of struct bt_callback, ordered by priority */
+};
+
+/*
+ * per id callbacks need to be per stream class because event ID vs
+ * event name mapping can vary from stream to stream.
+ */
+struct bt_stream_callbacks {
+ GArray *per_id_callbacks; /* Array of struct bt_callback_chain */
+};
+
+/*
+ * struct babeltrace_iter: data structure representing an iterator on a trace
+ * collection.
+ */
+struct babeltrace_iter {
+ struct ptr_heap *stream_heap;
+ struct trace_collection *tc;
+ struct trace_collection_pos *end_pos;
+ GArray *callbacks; /* Array of struct bt_stream_hooks */
+ struct bt_callback_chain main_callbacks; /* For all events */
+ /*
+ * Flag indicating if dependency graph needs to be recalculated.
+ * Set by babeltrace_iter_add_callback(), and checked (and
+ * cleared) by upon entry into babeltrace_iter_read_event().
+ * babeltrace_iter_read_event() is responsible for calling dep
+ * graph calculation if it sees this flag set.
+ */
+ int recalculate_dep_graph;
+ /*
+ * Array of pointers to struct bt_dependencies, for garbage
+ * collection. We're not using a linked list here because each
+ * struct bt_dependencies can belong to more than one
+ * babeltrace_iter.
+ */
+ GPtrArray *dep_gc;
+};
+
+struct bt_dependencies {
+ GArray *deps; /* Array of GQuarks */
+ int refcount; /* free when decremented to 0 */
+};