+ integer->p.index = root_name ? INT_MAX : index;
+ integer->p.name = field_name;
+ integer->p.path = bt_new_definition_path(parent_scope, field_name,
+ root_name);
+ integer->p.scope = NULL;
+ integer->value._unsigned = 0;
+ ret = bt_register_field_definition(field_name, &integer->p,
+ parent_scope);
+ assert(!ret);
+ return &integer->p;
+}
+
+static
+void _integer_definition_free(struct bt_definition *definition)
+{
+ struct definition_integer *integer =
+ container_of(definition, struct definition_integer, p);
+
+ bt_declaration_unref(integer->p.declaration);
+ g_free(integer);
+}
+
+enum ctf_string_encoding bt_get_int_encoding(const struct bt_definition *field)
+{
+ struct definition_integer *integer_definition;
+ const struct declaration_integer *integer_declaration;
+
+ integer_definition = container_of(field, struct definition_integer, p);
+ integer_declaration = integer_definition->declaration;
+
+ return integer_declaration->encoding;
+}
+
+int bt_get_int_base(const struct bt_definition *field)
+{
+ struct definition_integer *integer_definition;
+ const struct declaration_integer *integer_declaration;
+
+ integer_definition = container_of(field, struct definition_integer, p);
+ integer_declaration = integer_definition->declaration;
+
+ return integer_declaration->base;
+}
+
+size_t bt_get_int_len(const struct bt_definition *field)
+{
+ struct definition_integer *integer_definition;
+ const struct declaration_integer *integer_declaration;
+
+ integer_definition = container_of(field, struct definition_integer, p);
+ integer_declaration = integer_definition->declaration;
+
+ return integer_declaration->len;
+}
+
+int bt_get_int_byte_order(const struct bt_definition *field)
+{
+ struct definition_integer *integer_definition;
+ const struct declaration_integer *integer_declaration;
+
+ integer_definition = container_of(field, struct definition_integer, p);
+ integer_declaration = integer_definition->declaration;
+
+ return integer_declaration->byte_order;
+}
+
+int bt_get_int_signedness(const struct bt_definition *field)
+{
+ struct definition_integer *integer_definition;
+ const struct declaration_integer *integer_declaration;
+
+ integer_definition = container_of(field, struct definition_integer, p);
+ integer_declaration = integer_definition->declaration;
+
+ return integer_declaration->signedness;
+}
+
+uint64_t bt_get_unsigned_int(const struct bt_definition *field)
+{
+ struct definition_integer *integer_definition;
+ const struct declaration_integer *integer_declaration;
+
+ integer_definition = container_of(field, struct definition_integer, p);
+ integer_declaration = integer_definition->declaration;
+
+ if (!integer_declaration->signedness) {
+ return integer_definition->value._unsigned;
+ }
+ fprintf(stderr, "[warning] Extracting unsigned value from a signed int (%s)\n",
+ g_quark_to_string(field->name));
+ return (uint64_t)integer_definition->value._signed;