+@prenotnull{struct_field}
+@prenotnull{name}
+@preisstructfield{struct_field}
+@postrefcountsame{struct_field}
+@postsuccessrefcountretinc
+
+@sa bt_field_structure_get_field_by_index(): Returns the field of a
+ given structure field by index.
+@sa bt_field_structure_set_field_by_name(): Sets the field of a
+ given structure field by name.
+*/
+extern struct bt_field *bt_field_structure_get_field_by_name(
+ struct bt_field *struct_field, const char *name);
+
+/**
+@brief Returns the @field at index \p index in the @structfield
+ \p struct_field.
+
+@param[in] struct_field Structure field of which to get the field
+ at index \p index.
+@param[in] index Index of the field to get in \p struct_field.
+@returns Field at index \p index in \p struct_field, or
+ \c NULL on error.
+
+@prenotnull{struct_field}
+@preisstructfield{struct_field}
+@pre \p index is lesser than the number of fields contained in the
+ parent field type of \p struct_field (see
+ bt_field_type_structure_get_field_count()).
+@postrefcountsame{struct_field}
+@postsuccessrefcountretinc
+
+@sa bt_field_structure_get_field_by_name(): Returns the field of a
+ given structure field by name.
+@sa bt_field_structure_set_field_by_name(): Sets the field of a
+ given structure field by name.
+*/
+extern struct bt_field *bt_field_structure_get_field_by_index(
+ struct bt_field *struct_field, uint64_t index);
+
+/**
+@brief Sets the field of the @structfield \p struct_field named \p name
+ to the @field \p field.
+
+If \p struct_field already contains a field named \p name, then it may
+either be replaced by \p field and its reference count is decremented,
+or \p field's value is assigned to it.
+
+The field type of \p field, as returned by bt_field_get_type(),
+\em must be equivalent to the field type returned by
+bt_field_type_structure_get_field_type_by_name() with the field
+type of \p struct_field and the same name, \p name.
+
+bt_trace_get_packet_header_type() for the parent trace class of
+\p packet.
+
+@param[in] struct_field Structure field of which to set the field
+ named \p name.
+@param[in] name Name of the field to set in \p struct_field.
+@param[in] field Field named \p name to set in \p struct_field.
+@returns 0 on success, or -1 on error.
+
+@prenotnull{struct_field}
+@prenotnull{name}
+@prenotnull{field}
+@prehot{struct_field}
+@preisstructfield{struct_field}
+@pre \p field has a field type equivalent to the field type returned by
+ bt_field_type_structure_get_field_type_by_name() for the
+ field type of \p struct_field with the name \p name.
+@postrefcountsame{struct_field}
+@post <strong>On success, the field in \p struct_field named \p name</strong>
+ may either be replaced by \p field or have the same value as \p field.
+@postsuccessrefcountinc{field}
+
+@sa bt_field_structure_get_field_by_index(): Returns the field of a
+ given structure field by index.
+@sa bt_field_structure_get_field_by_name(): Returns the field of a
+ given structure field by name.
+*/
+extern int bt_field_structure_set_field_by_name(
+ struct bt_field *struct_field,
+ const char *name, struct bt_field *field);
+
+/** @} */
+
+/**
+@defgroup ctfirarrayfield CTF IR array field
+@ingroup ctfirfields
+@brief CTF IR array field.
+
+@code
+#include <babeltrace/ctf-ir/fields.h>
+@endcode
+
+A CTF IR <strong><em>array field</em></strong> is a @field which
+contains an ordered list of zero or more @fields sharing the same @ft,
+and which is described by a @arrayft.
+
+To set the value of a specific field of an array field, you need to
+first get the field with bt_field_array_get_field().
+
+@sa ctfirarrayfieldtype
+@sa ctfirfields
+
+@addtogroup ctfirarrayfield
+@{
+*/
+
+/**
+@brief Returns the @field at index \p index, potentially creating it,
+ in the @arrayfield \p array_field.
+
+This function creates the @field to return if it does not currently
+exist.
+
+@param[in] array_field Array field of which to get the field
+ at index \p index.
+@param[in] index Index of the field to get in \p array_field.
+@returns Field at index \p index in \p array_field, or
+ \c NULL on error.
+
+@prenotnull{array_field}
+@preisarrayfield{array_field}
+@pre \p index is lesser than bt_field_type_array_get_length() called
+ on the field type of \p array_field.
+@postrefcountsame{array_field}
+@postsuccessrefcountretinc
+*/
+extern struct bt_field *bt_field_array_get_field(
+ struct bt_field *array_field, uint64_t index);
+
+/** @} */
+
+/**
+@defgroup ctfirseqfield CTF IR sequence field
+@ingroup ctfirfields
+@brief CTF IR sequence field.
+
+@code
+#include <babeltrace/ctf-ir/fields.h>
+@endcode
+
+A CTF IR <strong><em>sequence field</em></strong> is a @field which
+contains an ordered list of zero or more @fields sharing the same @ft,
+and which is described by a @seqft.
+
+Before you can get a specific field of a sequence field with
+bt_field_sequence_get_field(), you need to set its current length
+@intfield with bt_field_sequence_set_length(). The integral value of
+the length field of a sequence field indicates the number of fields
+it contains.
+
+@sa ctfirseqfieldtype
+@sa ctfirfields
+
+@addtogroup ctfirseqfield
+@{
+*/
+
+/**
+@brief Returns the @field at index \p index, potentially creating it,
+ in the @seqfield \p sequence_field.
+
+This function creates the @field to return if it does not currently
+exist.
+
+@param[in] sequence_field Sequence field of which to get the field
+ at index \p index.
+@param[in] index Index of the field to get in
+ \p sequence_field.
+@returns Field at index \p index in
+ \p sequence_field, or \c NULL on error.
+
+@prenotnull{sequence_field}
+@preisseqfield{sequence_field}
+@pre \p sequence_field has a length field previously set with
+ bt_field_sequence_set_length().
+@pre \p index is lesser than the current integral value of the current
+ length field of \p sequence_field (see
+ bt_field_sequence_get_length()).
+@postrefcountsame{sequence_field}
+@postsuccessrefcountretinc
+*/
+extern struct bt_field *bt_field_sequence_get_field(
+ struct bt_field *sequence_field, uint64_t index);
+
+/**
+@brief Returns the length @intfield of the @seqfield \p sequence_field.
+
+The current integral value of the returned length field indicates the
+number of fields contained in \p sequence_field.
+
+@param[in] sequence_field Sequence field of which to get the
+ length field.
+@returns Length field of \p sequence_field, or
+ \c NULL on error.
+
+@prenotnull{sequence_field}
+@preisseqfield{sequence_field}
+@pre \p sequence_field has a length field previously set with
+ bt_field_sequence_set_length().
+@postrefcountsame{sequence_field}
+@postsuccessrefcountretinc
+@post <strong>On success</strong>, the returned field is a @intfield.
+
+@sa bt_field_sequence_set_length(): Sets the length field of a given
+ sequence field.
+*/
+extern struct bt_field *bt_field_sequence_get_length(
+ struct bt_field *sequence_field);
+
+/**
+@brief Sets the length @intfield of the @seqfield \p sequence_field
+ to \p length_field.
+
+The current integral value of \p length_field indicates the number of
+fields contained in \p sequence_field.
+
+@param[in] sequence_field Sequence field of which to set the
+ length field.
+@param[in] length_field Length field of \p sequence_field.
+@returns 0 on success, or a negative value on error.
+
+@prenotnull{sequence_field}
+@prenotnull{length_field}
+@preisseqfield{sequence_field}
+@preisintfield{length_field}
+@prehot{sequence_field}
+@postrefcountsame{sequence_field}
+@postsuccessrefcountinc{length_field}
+
+@sa bt_field_sequence_get_length(): Returns the length field of a
+ given sequence field.
+*/
+extern int bt_field_sequence_set_length(struct bt_field *sequence_field,
+ struct bt_field *length_field);
+
+/** @} */
+
+/**
+@defgroup ctfirvarfield CTF IR variant field
+@ingroup ctfirfields
+@brief CTF IR variant field.
+
+@code
+#include <babeltrace/ctf-ir/fields.h>
+@endcode
+
+A CTF IR <strong><em>variant field</em></strong> is a @field which
+contains a current @field amongst one or more choices, and which is
+described by a @varft.
+
+Use bt_field_variant_get_field() to get the @field selected by
+a specific tag @enumfield. Once you call this function, you can call
+bt_field_variant_get_current_field() afterwards to get this last
+field again.
+
+@sa ctfirvarfieldtype
+@sa ctfirfields
+
+@addtogroup ctfirvarfield
+@{
+*/
+
+/**
+@brief Returns the @field, potentially creating it, selected by the
+ tag @intfield \p tag_field in the @varfield \p variant_field.
+
+This function creates the @field to return if it does not currently
+exist.
+
+Once you call this function, you can call
+bt_field_variant_get_current_field() to get the same field again,
+and you can call bt_field_variant_get_tag() to get \p tag_field.
+
+@param[in] variant_field Variant field of which to get the field
+ selected by \p tag_field.
+@param[in] tag_field Tag field.
+@returns Field selected by \p tag_field in
+ \p variant_field, or \c NULL on error.
+
+@prenotnull{variant_field}
+@prenotnull{tag_field}
+@preisvarfield{variant_field}
+@preisenumfield{tag_field}
+@postrefcountsame{variant_field}
+@postsuccessrefcountinc{tag_field}
+@postsuccessrefcountretinc
+*/
+extern struct bt_field *bt_field_variant_get_field(
+ struct bt_field *variant_field,
+ struct bt_field *tag_field);
+
+/**
+@brief Returns the currently selected @field of the @varfield
+ \p variant_field.
+
+@param[in] variant_field Variant field of which to get the
+ currently selected field.
+@returns Currently selected field of
+ \p variant_field, or \c NULL if there's
+ no selected field or on error.
+
+@prenotnull{variant_field}
+@preisvarfield{variant_field}
+@pre \p variant_field contains has a current selected field previously
+ set with bt_field_variant_get_field().
+@postrefcountsame{variant_field}
+@postsuccessrefcountretinc
+*/
+extern struct bt_field *bt_field_variant_get_current_field(
+ struct bt_field *variant_field);
+
+/**
+@brief Returns the tag @enumfield of the @varfield \p variant_field.
+
+@param[in] variant_field Variant field of which to get the
+ tag field.
+@returns Tag field of \p variant_field, or
+ \c NULL on error.
+
+@prenotnull{variant_field}
+@preisvarfield{variant_field}
+@pre \p variant_field contains has a current selected field previously
+ set with bt_field_variant_get_field().
+@postrefcountsame{variant_field}
+@postsuccessrefcountretinc
+@post <strong>On success</strong>, the returned field is a @enumfield.
+*/
+extern struct bt_field *bt_field_variant_get_tag(
+ struct bt_field *variant_field);
+
+/** @} */
+
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_field bt_field
+#define bt_ctf_field_create bt_field_create
+#define bt_ctf_field_structure_get_field bt_field_structure_get_field_by_name
+#define bt_ctf_field_variant_get_field bt_field_variant_get_field
+#define bt_ctf_field_array_get_field bt_field_array_get_field
+#define bt_ctf_field_sequence_set_length bt_field_sequence_set_length
+#define bt_ctf_field_sequence_get_field bt_field_sequence_get_field
+#define bt_ctf_field_enumeration_get_container bt_field_enumeration_get_container
+#define bt_ctf_field_signed_integer_set_value bt_field_signed_integer_set_value
+#define bt_ctf_field_unsigned_integer_set_value bt_field_unsigned_integer_set_value
+#define bt_ctf_field_floating_point_set_value bt_field_floating_point_set_value
+#define bt_ctf_field_string_set_value bt_field_string_set_value