2 * Babeltrace - CTF Utils
4 * Copyright (c) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 #define BT_LOG_TAG "PLUGIN-CTF-UTILS"
30 struct bt_stream_class
*ctf_utils_stream_class_from_packet_header(
31 struct bt_trace
*trace
,
32 struct bt_field
*packet_header_field
)
34 struct bt_field
*stream_id_field
= NULL
;
35 struct bt_stream_class
*stream_class
= NULL
;
36 uint64_t stream_id
= -1ULL;
39 if (!packet_header_field
) {
40 goto single_stream_class
;
43 stream_id_field
= bt_field_structure_get_field_by_name(
44 packet_header_field
, "stream_id");
45 if (!stream_id_field
) {
46 goto single_stream_class
;
49 ret
= bt_field_unsigned_integer_get_value(stream_id_field
,
55 if (stream_id
== -1ULL) {
57 /* Single stream class */
58 if (bt_trace_get_stream_class_count(trace
) == 0) {
62 stream_class
= bt_trace_get_stream_class_by_index(trace
, 0);
64 stream_class
= bt_trace_get_stream_class_by_id(trace
,
69 bt_put(stream_id_field
);
This page took 0.031932 seconds and 5 git commands to generate.