### Class

# Gio DBusMessage

since: 2.26

#### Description

    final class Gio.DBusMessage : GObject.Object
    {
      /* No available fields */
    }

A type for representing D-Bus messages that can be sent or received on a `GDBusConnection`.

Available since: 2.26

#### Ancestors

- GObject

#### Constructors

###### g_dbus_message_new

Creates a new empty `GDBusMessage`.

since: 2.26

###### g_dbus_message_new_from_blob

Creates a new `GDBusMessage` from the data stored at `blob`. The byte order that the message was in can be retrieved using g_dbus_message_get_byte_order().

since: 2.26

###### g_dbus_message_new_method_call

Creates a new `GDBusMessage` for a method call.

since: 2.26

###### g_dbus_message_new_signal

Creates a new `GDBusMessage` for a signal emission.

since: 2.26

#### Functions

###### g_dbus_message_bytes_needed

Utility function to calculate how many bytes are needed to completely deserialize the D-Bus message stored at `blob`.

since: 2.26

#### Instance methods

###### g_dbus_message_copy

Copies `message`. The copy is a deep copy and the returned `GDBusMessage` is completely identical except that it is guaranteed to not be locked.

since: 2.26

###### g_dbus_message_get_arg0

Convenience to get the first item in the body of `message`.

since: 2.26

###### g_dbus_message_get_arg0_path

Convenience to get the first item in the body of `message`.

since: 2.80

###### g_dbus_message_get_body

Gets the body of a message.

since: 2.26

###### g_dbus_message_get_byte_order

Gets the byte order of `message`.

since: 2.0

###### g_dbus_message_get_destination

Convenience getter for the `G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION` header field.

since: 2.26

###### g_dbus_message_get_error_name

Convenience getter for the `G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME` header field.

since: 2.26

###### g_dbus_message_get_flags

Gets the flags for `message`.

since: 2.26

###### g_dbus_message_get_header

Gets a header field on `message`.

since: 2.26

###### g_dbus_message_get_header_fields

Gets an array of all header fields on `message` that are set.

since: 2.26

###### g_dbus_message_get_interface

Convenience getter for the `G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE` header field.

since: 2.26

###### g_dbus_message_get_locked

Checks whether `message` is locked. To monitor changes to this value, conncet to the `GObject::notify` signal to listen for changes on the `GDBusMessage:locked` property.

since: 2.26

###### g_dbus_message_get_member

Convenience getter for the `G_DBUS_MESSAGE_HEADER_FIELD_MEMBER` header field.

since: 2.26

###### g_dbus_message_get_message_type

Gets the type of `message`.

since: 2.26

###### g_dbus_message_get_num_unix_fds

Convenience getter for the `G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS` header field.

since: 2.26

###### g_dbus_message_get_path

Convenience getter for the `G_DBUS_MESSAGE_HEADER_FIELD_PATH` header field.

since: 2.26

###### g_dbus_message_get_reply_serial

Convenience getter for the `G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL` header field.

since: 2.26

###### g_dbus_message_get_sender

Convenience getter for the `G_DBUS_MESSAGE_HEADER_FIELD_SENDER` header field.

since: 2.26

###### g_dbus_message_get_serial

Gets the serial for `message`.

since: 2.26

###### g_dbus_message_get_signature

Convenience getter for the `G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE` header field.

since: 2.26

###### g_dbus_message_get_unix_fd_list

Gets the UNIX file descriptors associated with `message`, if any.

since: 2.26

###### g_dbus_message_lock

If `message` is locked, does nothing. Otherwise locks the message.

since: 2.26

###### g_dbus_message_new_method_error

Creates a new `GDBusMessage` that is an error reply to `method_call_message`.

since: 2.26

###### g_dbus_message_new_method_error_literal

Creates a new `GDBusMessage` that is an error reply to `method_call_message`.

since: 2.26

###### g_dbus_message_new_method_error_valist

Like `g_dbus_message_new_method_error()` but intended for language bindings.

since: 2.26

###### g_dbus_message_new_method_reply

Creates a new `GDBusMessage` that is a reply to `method_call_message`.

since: 2.26

###### g_dbus_message_print

Produces a human-readable multi-line description of `message`.

since: 2.26

###### g_dbus_message_set_body

Sets the body `message`. As a side-effect the `G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE` header field is set to the type string of `body` (or cleared if `body` is `NULL`).

since: 2.26

###### g_dbus_message_set_byte_order

Sets the byte order of `message`.

since: 2.0

###### g_dbus_message_set_destination

Convenience setter for the `G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION` header field.

since: 2.26

###### g_dbus_message_set_error_name

Convenience setter for the `G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME` header field.

since: 2.26

###### g_dbus_message_set_flags

Sets the flags to set on `message`.

since: 2.26

###### g_dbus_message_set_header

Sets a header field on `message`.

since: 2.26

###### g_dbus_message_set_interface

Convenience setter for the `G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE` header field.

since: 2.26

###### g_dbus_message_set_member

Convenience setter for the `G_DBUS_MESSAGE_HEADER_FIELD_MEMBER` header field.

since: 2.26

###### g_dbus_message_set_message_type

Sets `message` to be of `type`.

since: 2.26

###### g_dbus_message_set_num_unix_fds

Convenience setter for the `G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS` header field.

since: 2.26

###### g_dbus_message_set_path

Convenience setter for the `G_DBUS_MESSAGE_HEADER_FIELD_PATH` header field.

since: 2.26

###### g_dbus_message_set_reply_serial

Convenience setter for the `G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL` header field.

since: 2.26

###### g_dbus_message_set_sender

Convenience setter for the `G_DBUS_MESSAGE_HEADER_FIELD_SENDER` header field.

since: 2.26

###### g_dbus_message_set_serial

Sets the serial for `message`.

since: 2.26

###### g_dbus_message_set_signature

Convenience setter for the `G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE` header field.

since: 2.26

###### g_dbus_message_set_unix_fd_list

Sets the UNIX file descriptors associated with `message`. As a side-effect the `G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS` header field is set to the number of fds in `fd_list` (or cleared if `fd_list` is `NULL`).

since: 2.26

###### g_dbus_message_to_blob

Serializes `message` to a blob. The byte order returned by `g_dbus_message_get_byte_order()` will be used.

since: 2.26

###### g_dbus_message_to_gerror

If `message` is not of type `G_DBUS_MESSAGE_TYPE_ERROR` does nothing and returns `FALSE`.

since: 2.26

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Gio.DBusMessage:locked

No description available.

since: 2.0

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

since: 2.0