* http://www.efficios.com/ctf
*/
-#include <babeltrace/ctf-ir/event-types.h>
+/* For bt_bool, bt_uuid */
+#include <babeltrace/types.h>
+
+#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
-struct bt_ctf_trace;
-struct bt_ctf_stream;
-struct bt_ctf_stream_class;
-struct bt_ctf_clock;
+struct bt_trace;
+struct bt_stream;
+struct bt_stream_class;
+struct bt_field_type;
+struct bt_value;
+struct bt_packet_header_field;
-/*
- * bt_ctf_trace_create: create a trace instance.
- *
- * Allocate a new trace
- *
- * Returns a new trace on success, NULL on error.
- */
-extern struct bt_ctf_trace *bt_ctf_trace_create(void);
+typedef void (* bt_trace_is_static_listener)(
+ struct bt_trace *trace, void *data);
-/*
- * bt_ctf_trace_create_stream: create a stream instance.
- *
- * Allocate a new stream instance and register it to the trace. The creation of
- * a stream sets its reference count to 1.
- *
- * @param trace Trace instance.
- * @param stream_class Stream class to instantiate.
- *
- * Returns a new stream on success, NULL on error.
- */
-extern struct bt_ctf_stream *bt_ctf_trace_create_stream(
- struct bt_ctf_trace *trace,
- struct bt_ctf_stream_class *stream_class);
+typedef void (* bt_trace_listener_removed)(
+ struct bt_trace *trace, void *data);
-/*
- * bt_ctf_trace_add_environment_field: add an environment field to the trace.
- *
- * Add an environment field to the trace. The name and value parameters are
- * copied.
- *
- * @param trace Trace instance.
- * @param name Name of the environment field (will be copied).
- * @param value Value of the environment field (will be copied).
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_trace_add_environment_field(struct bt_ctf_trace *trace,
- const char *name,
+extern struct bt_trace *bt_trace_create(void);
+
+extern bt_bool bt_trace_assigns_automatic_stream_class_id(
+ struct bt_trace *trace);
+
+extern int bt_trace_set_assigns_automatic_stream_class_id(
+ struct bt_trace *trace, bt_bool value);
+
+extern const char *bt_trace_get_name(struct bt_trace *trace);
+
+extern int bt_trace_set_name(struct bt_trace *trace, const char *name);
+
+extern bt_uuid bt_trace_get_uuid(struct bt_trace *trace);
+
+extern int bt_trace_set_uuid(struct bt_trace *trace, bt_uuid uuid);
+
+extern uint64_t bt_trace_get_environment_entry_count(struct bt_trace *trace);
+
+extern void bt_trace_borrow_environment_entry_by_index(
+ struct bt_trace *trace, uint64_t index,
+ const char **name, struct bt_value **value);
+
+extern struct bt_value *bt_trace_borrow_environment_entry_value_by_name(
+ struct bt_trace *trace, const char *name);
+
+extern int bt_trace_set_environment_entry_integer(
+ struct bt_trace *trace, const char *name,
+ int64_t value);
+
+extern int bt_trace_set_environment_entry_string(
+ struct bt_trace *trace, const char *name,
const char *value);
-/*
- * bt_ctf_trace_add_clock: add a clock to the trace.
- *
- * Add a clock to the trace. Clocks assigned to stream classes must be
- * added to the trace beforehand.
- *
- * @param trace Trace instance.
- * @param clock Clock to add to the trace.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_trace_add_clock(struct bt_ctf_trace *trace,
- struct bt_ctf_clock *clock);
+extern struct bt_field_type *bt_trace_borrow_packet_header_field_type(
+ struct bt_trace *trace);
-/*
- * bt_ctf_trace_get_clock_count: get the number of clocks
- * associated to the trace.
- *
- * @param trace Trace instance.
- *
- * Returns the clock count on success, a negative value on error.
- */
-extern int bt_ctf_trace_get_clock_count(struct bt_ctf_trace *trace);
+extern int bt_trace_set_packet_header_field_type(struct bt_trace *trace,
+ struct bt_field_type *packet_header_type);
-/*
- * bt_ctf_trace_get_clock: get a trace's clock at index.
- *
- * @param trace Trace instance.
- * @param index Index of the clock in the given trace.
- *
- * Return a clock instance on success, NULL on error.
- */
-extern struct bt_ctf_clock *bt_ctf_trace_get_clock(
- struct bt_ctf_trace *trace, int index);
+extern uint64_t bt_trace_get_stream_class_count(struct bt_trace *trace);
-/*
- * bt_ctf_trace_get_metadata_string: get metadata string.
- *
- * Get the trace's TSDL metadata. The caller assumes the ownership of the
- * returned string.
- *
- * @param trace Trace instance.
- *
- * Returns the metadata string on success, NULL on error.
- */
-extern char *bt_ctf_trace_get_metadata_string(struct bt_ctf_trace *trace);
+extern struct bt_stream_class *bt_trace_borrow_stream_class_by_index(
+ struct bt_trace *trace, uint64_t index);
-/*
- * bt_ctf_trace_set_byte_order: set a field type's byte order.
- *
- * Set the trace's byte order. Defaults to BT_CTF_BYTE_ORDER_NATIVE,
- * the host machine's endianness.
- *
- * @param trace Trace instance.
- * @param byte_order Trace's byte order.
- *
- * Returns 0 on success, a negative value on error.
- */
-extern int bt_ctf_trace_set_byte_order(struct bt_ctf_trace *trace,
- enum bt_ctf_byte_order byte_order);
+extern struct bt_stream_class *bt_trace_borrow_stream_class_by_id(
+ struct bt_trace *trace, uint64_t id);
-/*
- * bt_ctf_trace_get and bt_ctf_trace_put: increment and decrement the
- * trace's reference count.
- *
- * These functions ensure that the trace won't be destroyed while it
- * is in use. The same number of get and put (plus one extra put to
- * release the initial reference done at creation) have to be done to
- * destroy a trace.
- *
- * When the trace's reference count is decremented to 0 by a
- * bt_ctf_trace_put, the trace is freed.
- *
- * @param trace Trace instance.
- */
-extern void bt_ctf_trace_get(struct bt_ctf_trace *trace);
-extern void bt_ctf_trace_put(struct bt_ctf_trace *trace);
+extern uint64_t bt_trace_get_stream_count(struct bt_trace *trace);
+
+extern struct bt_stream *bt_trace_borrow_stream_by_index(
+ struct bt_trace *trace, uint64_t index);
+
+extern struct bt_stream *bt_trace_borrow_stream_by_id(
+ struct bt_trace *trace, uint64_t id);
+
+extern bt_bool bt_trace_is_static(struct bt_trace *trace);
+
+extern int bt_trace_make_static(struct bt_trace *trace);
+
+extern int bt_trace_add_is_static_listener(
+ struct bt_trace *trace,
+ bt_trace_is_static_listener listener,
+ bt_trace_listener_removed listener_removed, void *data,
+ uint64_t *listener_id);
+
+extern int bt_trace_remove_is_static_listener(
+ struct bt_trace *trace, uint64_t listener_id);
#ifdef __cplusplus
}