1 #ifndef BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_STREAM_H
2 #define BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_STREAM_H
5 * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 #include <babeltrace/babeltrace-internal.h>
27 #include <babeltrace/babeltrace.h>
28 #include <babeltrace/ctfser-internal.h>
33 #include "fs-sink-ctf-meta.h"
37 struct fs_sink_stream
{
38 struct fs_sink_trace
*trace
;
39 struct bt_ctfser ctfser
;
41 /* Stream's file name */
45 const bt_stream
*ir_stream
;
47 struct fs_sink_ctf_stream_class
*sc
;
51 uint64_t beginning_cs
;
53 uint64_t content_size
;
55 uint64_t discarded_events_counter
;
57 uint64_t context_offset_bits
;
60 const bt_packet
*packet
;
65 uint64_t discarded_events_counter
;
71 uint64_t beginning_cs
;
73 } discarded_events_state
;
77 uint64_t beginning_cs
;
79 } discarded_packets_state
;
81 bool in_discarded_events_range
;
85 struct fs_sink_stream
*fs_sink_stream_create(struct fs_sink_trace
*trace
,
86 const bt_stream
*ir_stream
);
89 void fs_sink_stream_destroy(struct fs_sink_stream
*stream
);
92 int fs_sink_stream_write_event(struct fs_sink_stream
*stream
,
93 const bt_clock_snapshot
*cs
, const bt_event
*event
,
94 struct fs_sink_ctf_event_class
*ec
);
97 int fs_sink_stream_open_packet(struct fs_sink_stream
*stream
,
98 const bt_clock_snapshot
*cs
, const bt_packet
*packet
);
101 int fs_sink_stream_close_packet(struct fs_sink_stream
*stream
,
102 const bt_clock_snapshot
*cs
);
104 #endif /* BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_STREAM_H */