Functions
g_dbus_message_new_signal ()
GDBusMessage *
g_dbus_message_new_signal (const gchar *path,
const gchar *interface_,
const gchar *signal);
Creates a new GDBusMessage for a signal emission.
Since: 2.26
g_dbus_message_new_method_call ()
GDBusMessage *
g_dbus_message_new_method_call (const gchar *name,
const gchar *path,
const gchar *interface_,
const gchar *method);
Creates a new GDBusMessage for a method call.
Since: 2.26
g_dbus_message_new_method_reply ()
GDBusMessage *
g_dbus_message_new_method_reply (GDBusMessage *method_call_message);
Creates a new GDBusMessage that is a reply to method_call_message
.
Returns
GDBusMessage. Free with g_object_unref().
[transfer full]
Since: 2.26
g_dbus_message_new_method_error ()
GDBusMessage *
g_dbus_message_new_method_error (GDBusMessage *method_call_message,
const gchar *error_name,
const gchar *error_message_format,
...);
Creates a new GDBusMessage that is an error reply to method_call_message
.
Returns
A GDBusMessage. Free with g_object_unref().
[transfer full]
Since: 2.26
g_dbus_message_new_method_error_valist ()
GDBusMessage *
g_dbus_message_new_method_error_valist
(GDBusMessage *method_call_message,
const gchar *error_name,
const gchar *error_message_format,
va_list var_args);
Like g_dbus_message_new_method_error() but intended for language bindings.
Returns
A GDBusMessage. Free with g_object_unref().
[transfer full]
Since: 2.26
g_dbus_message_new_method_error_literal ()
GDBusMessage *
g_dbus_message_new_method_error_literal
(GDBusMessage *method_call_message,
const gchar *error_name,
const gchar *error_message);
Creates a new GDBusMessage that is an error reply to method_call_message
.
Returns
A GDBusMessage. Free with g_object_unref().
[transfer full]
Since: 2.26
g_dbus_message_print ()
gchar *
g_dbus_message_print (GDBusMessage *message,
guint indent);
Produces a human-readable multi-line description of message
.
The contents of the description has no ABI guarantees, the contents
and formatting is subject to change at any time. Typical output
looks something like this:
or
Returns
A string that should be freed with g_free().
Since: 2.26
g_dbus_message_get_locked ()
gboolean
g_dbus_message_get_locked (GDBusMessage *message);
Checks whether message
is locked. To monitor changes to this
value, conncet to the “notify” signal to listen for changes
on the “locked” property.
Returns
TRUE if message
is locked, FALSE otherwise.
Since: 2.26
g_dbus_message_lock ()
void
g_dbus_message_lock (GDBusMessage *message);
If message
is locked, does nothing. Otherwise locks the message.
Since: 2.26
g_dbus_message_copy ()
GDBusMessage *
g_dbus_message_copy (GDBusMessage *message,
GError **error);
Copies message
. The copy is a deep copy and the returned
GDBusMessage is completely identical except that it is guaranteed
to not be locked.
This operation can fail if e.g. message
contains file descriptors
and the per-process or system-wide open files limit is reached.
Returns
A new GDBusMessage or NULL if error
is set.
Free with g_object_unref().
[transfer full]
Since: 2.26
g_dbus_message_set_message_type ()
void
g_dbus_message_set_message_type (GDBusMessage *message,
GDBusMessageType type);
Sets message
to be of type
.
Since: 2.26
g_dbus_message_get_serial ()
guint32
g_dbus_message_get_serial (GDBusMessage *message);
Gets the serial for message
.
Since: 2.26
g_dbus_message_set_serial ()
void
g_dbus_message_set_serial (GDBusMessage *message,
guint32 serial);
Sets the serial for message
.
Since: 2.26
g_dbus_message_get_body ()
GVariant *
g_dbus_message_get_body (GDBusMessage *message);
Gets the body of a message.
Returns
A GVariant or NULL if the body is
empty. Do not free, it is owned by message
.
[transfer none]
Since: 2.26
g_dbus_message_set_body ()
void
g_dbus_message_set_body (GDBusMessage *message,
GVariant *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).
If body
is floating, message
assumes ownership of body
.
Since: 2.26
g_dbus_message_get_unix_fd_list ()
GUnixFDList *
g_dbus_message_get_unix_fd_list (GDBusMessage *message);
Gets the UNIX file descriptors associated with message
, if any.
This method is only available on UNIX.
Returns
A GUnixFDList or NULL if no file descriptors are
associated. Do not free, this object is owned by message
.
[transfer none]
Since: 2.26
g_dbus_message_set_unix_fd_list ()
void
g_dbus_message_set_unix_fd_list (GDBusMessage *message,
GUnixFDList *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).
This method is only available on UNIX.
Since: 2.26
g_dbus_message_get_header_fields ()
guchar *
g_dbus_message_get_header_fields (GDBusMessage *message);
Gets an array of all header fields on message
that are set.
Since: 2.26
g_dbus_message_get_header ()
GVariant *
g_dbus_message_get_header (GDBusMessage *message,
GDBusMessageHeaderField header_field);
Gets a header field on message
.
The caller is responsible for checking the type of the returned GVariant
matches what is expected.
Returns
A GVariant with the value if the header was found, NULL
otherwise. Do not free, it is owned by message
.
[transfer none][nullable]
Since: 2.26
g_dbus_message_set_header ()
void
g_dbus_message_set_header (GDBusMessage *message,
GDBusMessageHeaderField header_field,
GVariant *value);
Sets a header field on message
.
If value
is floating, message
assumes ownership of value
.
Since: 2.26
g_dbus_message_get_arg0 ()
const gchar *
g_dbus_message_get_arg0 (GDBusMessage *message);
Convenience to get the first item in the body of message
.
Returns
The string item or NULL if the first item in the body of
message
is not a string.
Since: 2.26
g_dbus_message_to_blob ()
guchar *
g_dbus_message_to_blob (GDBusMessage *message,
gsize *out_size,
GDBusCapabilityFlags capabilities,
GError **error);
Serializes message
to a blob. The byte order returned by
g_dbus_message_get_byte_order() will be used.
Returns
A pointer to a
valid binary D-Bus message of out_size
bytes generated by message
or NULL if error
is set. Free with g_free().
[array length=out_size][transfer full]
Since: 2.26
g_dbus_message_bytes_needed ()
gssize
g_dbus_message_bytes_needed (guchar *blob,
gsize blob_len,
GError **error);
Utility function to calculate how many bytes are needed to
completely deserialize the D-Bus message stored at blob
.
Returns
Number of bytes needed or -1 if error
is set (e.g. if
blob
contains invalid data or not enough data is available to
determine the size).
Since: 2.26