+struct bt_ctf_field_type *bt_ctf_stream_class_get_packet_context_type(
+ struct bt_ctf_stream_class *stream_class)
+{
+ struct bt_ctf_field_type *ret = NULL;
+
+ if (!stream_class) {
+ goto end;
+ }
+
+ assert(stream_class->packet_context_type);
+ bt_ctf_field_type_get(stream_class->packet_context_type);
+ ret = stream_class->packet_context_type;
+end:
+ return ret;
+}
+
+int bt_ctf_stream_class_set_packet_context_type(
+ struct bt_ctf_stream_class *stream_class,
+ struct bt_ctf_field_type *packet_context_type)
+{
+ int ret = 0;
+
+ if (!stream_class || !packet_context_type) {
+ ret = -1;
+ goto end;
+ }
+
+ assert(stream_class->packet_context_type);
+ if (bt_ctf_field_type_get_type_id(stream_class->packet_context_type) !=
+ CTF_TYPE_STRUCT) {
+ /* A packet context must be a structure */
+ ret = -1;
+ goto end;
+ }
+
+ bt_ctf_field_type_put(stream_class->packet_context_type);
+ bt_ctf_field_type_get(packet_context_type);
+ stream_class->packet_context_type = packet_context_type;
+end:
+ return ret;
+}
+