#include <babeltrace2/trace-ir/stream.h>
#include "lib/object.h"
#include "common/assert.h"
-#include <inttypes.h>
#include <stdbool.h>
#include "field.h"
#include "packet.h"
#include "stream-class.h"
#include "stream.h"
-#include "trace.h"
-#include "lib/func-status.h"
+BT_EXPORT
struct bt_stream *bt_packet_borrow_stream(struct bt_packet *packet)
{
BT_ASSERT_PRE_DEV_PACKET_NON_NULL(packet);
return packet->stream;
}
+BT_EXPORT
const struct bt_stream *bt_packet_borrow_stream_const(
const struct bt_packet *packet)
{
return bt_packet_borrow_stream((void *) packet);
}
+BT_EXPORT
struct bt_field *bt_packet_borrow_context_field(struct bt_packet *packet)
{
BT_ASSERT_PRE_DEV_PACKET_NON_NULL(packet);
return packet->context_field ? packet->context_field->field : NULL;
}
+BT_EXPORT
const struct bt_field *bt_packet_borrow_context_field_const(
const struct bt_packet *packet)
{
return bt_packet_borrow_context_field((void *) packet);
}
-BT_HIDDEN
void _bt_packet_set_is_frozen(const struct bt_packet *packet, bool is_frozen)
{
if (!packet) {
context_field);
}
-BT_HIDDEN
void bt_packet_recycle(struct bt_packet *packet)
{
struct bt_stream *stream;
bt_object_put_ref_no_null_check(&stream->base);
}
-BT_HIDDEN
void bt_packet_destroy(struct bt_packet *packet)
{
BT_LIB_LOGD("Destroying packet: %!+a", packet);
g_free(packet);
}
-BT_HIDDEN
struct bt_packet *bt_packet_new(struct bt_stream *stream)
{
struct bt_packet *packet = NULL;
return packet;
}
+BT_EXPORT
struct bt_packet *bt_packet_create(const struct bt_stream *c_stream)
{
struct bt_packet *packet = NULL;
BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_STREAM_NON_NULL(stream);
- BT_ASSERT_PRE(stream->class->supports_packets,
+ BT_ASSERT_PRE("stream-class-supports-packets",
+ stream->class->supports_packets,
"Stream class does not support packets: %![sc-]+S",
stream->class);
packet = bt_object_pool_create_object(&stream->packet_pool);
return (void *) packet;
}
+BT_EXPORT
void bt_packet_get_ref(const struct bt_packet *packet)
{
bt_object_get_ref(packet);
}
+BT_EXPORT
void bt_packet_put_ref(const struct bt_packet *packet)
{
bt_object_put_ref(packet);