Babeltrace 2 C API  2.1.1
Open-source trace manipulation framework
packet.h
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5  */
6 
7 #ifndef BABELTRACE2_TRACE_IR_PACKET_H
8 #define BABELTRACE2_TRACE_IR_PACKET_H
9 
10 /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
11 
12 #ifndef __BT_IN_BABELTRACE_H
13 # error "Please include <babeltrace2/babeltrace.h> instead."
14 #endif
15 
16 #include <stdint.h>
17 
18 #include <babeltrace2/types.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
150 extern bt_packet *bt_packet_create(const bt_stream *stream) __BT_NOEXCEPT;
151 
176 extern bt_stream *bt_packet_borrow_stream(bt_packet *packet) __BT_NOEXCEPT;
177 
186  const bt_packet *packet) __BT_NOEXCEPT;
187 
213 extern
214 bt_field *bt_packet_borrow_context_field(bt_packet *packet) __BT_NOEXCEPT;
215 
223 extern
225  const bt_packet *packet) __BT_NOEXCEPT;
226 
249 extern void bt_packet_get_ref(const bt_packet *packet) __BT_NOEXCEPT;
250 
266 extern void bt_packet_put_ref(const bt_packet *packet) __BT_NOEXCEPT;
267 
282 #define BT_PACKET_PUT_REF_AND_RESET(_packet) \
283  do { \
284  bt_packet_put_ref(_packet); \
285  (_packet) = NULL; \
286  } while (0)
287 
313 #define BT_PACKET_MOVE_REF(_dst, _src) \
314  do { \
315  bt_packet_put_ref(_dst); \
316  (_dst) = (_src); \
317  (_src) = NULL; \
318  } while (0)
319 
324 #ifdef __cplusplus
325 }
326 #endif
327 
328 #endif /* BABELTRACE2_TRACE_IR_PACKET_H */
const bt_stream * bt_packet_borrow_stream_const(const bt_packet *packet)
Borrows the stream conceptually containing the packet packet (const version).
void bt_packet_put_ref(const bt_packet *packet)
Decrements the reference count of the packet packet.
struct bt_stream bt_stream
Stream.
Definition: types.h:89
void bt_packet_get_ref(const bt_packet *packet)
Increments the reference count of the packet packet.
bt_packet * bt_packet_create(const bt_stream *stream)
Creates a packet for the stream stream.
struct bt_packet bt_packet
Packet.
Definition: types.h:62
struct bt_field bt_field
Field.
Definition: types.h:38
bt_field * bt_packet_borrow_context_field(bt_packet *packet)
Borrows the context field of the packet packet.
const bt_field * bt_packet_borrow_context_field_const(const bt_packet *packet)
Borrows the context field of the packet packet (const version).
bt_stream * bt_packet_borrow_stream(bt_packet *packet)
Borrows the stream conceptually containing the packet packet.