+int64_t bt_ctf_event_class_get_field_count(
+ struct bt_ctf_event_class *event_class)
+{
+ int64_t ret;
+
+ if (!event_class) {
+ ret = -1;
+ goto end;
+ }
+
+ ret = bt_ctf_field_type_structure_get_field_count(event_class->fields);
+end:
+ return ret;
+}
+
+int bt_ctf_event_class_get_field(struct bt_ctf_event_class *event_class,
+ const char **field_name, struct bt_ctf_field_type **field_type,
+ size_t index)
+{
+ int ret;
+
+ if (!event_class) {
+ ret = -1;
+ goto end;
+ }
+
+ ret = bt_ctf_field_type_structure_get_field(event_class->fields,
+ field_name, field_type, index);
+end:
+ return ret;
+}
+
+struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
+ struct bt_ctf_event_class *event_class, const char *name)
+{
+ GQuark name_quark;
+ struct bt_ctf_field_type *field_type = NULL;
+
+ if (!event_class || !name) {
+ goto end;
+ }
+
+ name_quark = g_quark_try_string(name);
+ if (!name_quark) {
+ goto end;
+ }
+
+ /*
+ * No need to increment field_type's reference count since getting it
+ * from the structure already does.
+ */
+ field_type = bt_ctf_field_type_structure_get_field_type_by_name(
+ event_class->fields, name);
+end:
+ return field_type;
+}
+