1 #ifndef BABELTRACE_LIB_COPY_TRACE_H
2 #define BABELTRACE_LIB_COPY_TRACE_H
5 * BabelTrace - Library to create a copy of a CTF trace
7 * Copyright 2017 Julien Desfossez <jdesfossez@efficios.com>
9 * Author: Julien Desfossez <jdesfossez@efficios.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 #include <babeltrace/babeltrace-internal.h>
32 #include <babeltrace/component/component.h>
33 #include <babeltrace/ctf-writer/writer.h>
40 * Create a copy of the clock_class passed in parameter.
42 * Returns NULL on error.
44 struct bt_ctf_clock_class
*ctf_copy_clock_class(FILE *err
,
45 struct bt_ctf_clock_class
*clock_class
);
48 * Copy all the clock classes from the input trace and add them to the writer
51 * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
54 enum bt_component_status
ctf_copy_clock_classes(FILE *err
,
55 struct bt_ctf_trace
*writer_trace
,
56 struct bt_ctf_stream_class
*writer_stream_class
,
57 struct bt_ctf_trace
*trace
);
60 * Create a copy of the event class passed in paramater.
62 * Returns NULL on error.
64 struct bt_ctf_event_class
*ctf_copy_event_class(FILE *err
,
65 struct bt_ctf_event_class
*event_class
);
68 * Copy all the event classes from the input stream class and add them to the
69 * writer_stream_class.
71 * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
74 enum bt_component_status
ctf_copy_event_classes(FILE *err
,
75 struct bt_ctf_stream_class
*stream_class
,
76 struct bt_ctf_stream_class
*writer_stream_class
);
79 * Create a copy of the stream class passed in parameter.
81 * Returns NULL or error.
83 struct bt_ctf_stream_class
*ctf_copy_stream_class(FILE *err
,
84 struct bt_ctf_stream_class
*stream_class
);
87 * Copy the value of a packet context field and add it to the
88 * writer_packet_context. Only supports unsigned integers for now.
90 * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
93 enum bt_component_status
ctf_copy_packet_context_field(FILE *err
,
94 struct bt_ctf_field
*field
, const char *field_name
,
95 struct bt_ctf_field
*writer_packet_context
,
96 struct bt_ctf_field_type
*writer_packet_context_type
);
99 * Copy all the field values of the packet context from the packet passed in
100 * parameter and set it to the current packet in the writer stream.
101 * The content_size and packet_size fields are not copied since they are
102 * already handled by the ctf_writer library.
104 * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
107 enum bt_component_status
ctf_copy_packet_context(FILE *err
,
108 struct bt_ctf_packet
*packet
,
109 struct bt_ctf_stream
*writer_stream
);
112 * Create and return a copy of the event passed in parameter. The caller has to
113 * append it to the writer_stream.
115 * Returns NULL on error.
117 struct bt_ctf_event
*ctf_copy_event(FILE *err
, struct bt_ctf_event
*event
,
118 struct bt_ctf_event_class
*writer_event_class
);
121 * Copy the environment and the packet header from the input trace to the
124 * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
127 enum bt_component_status
ctf_copy_trace(FILE *err
, struct bt_ctf_trace
*trace
,
128 struct bt_ctf_trace
*writer_trace
);
134 #endif /* BABELTRACE_LIB_COPY_TRACE_H */