1 /* GDBus - GLib D-Bus Library
3 * Copyright (C) 2008-2010 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 * Author: David Zeuthen <davidz@redhat.com>
25 #include "gdbusutils.h"
26 #include "gdbusconnection.h"
27 #include "gdbusmessage.h"
28 #include "gdbusmethodinvocation.h"
29 #include "gdbusintrospection.h"
30 #include "gdbuserror.h"
31 #include "gdbusprivate.h"
35 #include "gunixfdlist.h"
41 * SECTION:gdbusmethodinvocation
42 * @short_description: Object for handling remote calls
45 * Instances of the #GDBusMethodInvocation class are used when
46 * handling D-Bus method calls. It provides a way to asynchronously
47 * return results and errors.
49 * The normal way to obtain a #GDBusMethodInvocation object is to receive
50 * it as an argument to the handle_method_call() function in a
51 * #GDBusInterfaceVTable that was passed to g_dbus_connection_register_object().
54 typedef struct _GDBusMethodInvocationClass GDBusMethodInvocationClass;
57 * GDBusMethodInvocationClass:
59 * Class structure for #GDBusMethodInvocation.
63 struct _GDBusMethodInvocationClass
66 GObjectClass parent_class;
70 * GDBusMethodInvocation:
72 * The #GDBusMethodInvocation structure contains only private data and
73 * should only be accessed using the provided API.
77 struct _GDBusMethodInvocation
80 GObject parent_instance;
82 /* construct-only properties */
85 gchar *interface_name;
87 GDBusMethodInfo *method_info;
88 GDBusPropertyInfo *property_info;
89 GDBusConnection *connection;
90 GDBusMessage *message;
95 G_DEFINE_TYPE (GDBusMethodInvocation, g_dbus_method_invocation, G_TYPE_OBJECT)
98 g_dbus_method_invocation_finalize (GObject *object)
100 GDBusMethodInvocation *invocation = G_DBUS_METHOD_INVOCATION (object);
102 g_free (invocation->sender);
103 g_free (invocation->object_path);
104 g_free (invocation->interface_name);
105 g_free (invocation->method_name);
106 if (invocation->method_info)
107 g_dbus_method_info_unref (invocation->method_info);
108 if (invocation->property_info)
109 g_dbus_property_info_unref (invocation->property_info);
110 g_object_unref (invocation->connection);
111 g_object_unref (invocation->message);
112 g_variant_unref (invocation->parameters);
114 G_OBJECT_CLASS (g_dbus_method_invocation_parent_class)->finalize (object);
118 g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
120 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
122 gobject_class->finalize = g_dbus_method_invocation_finalize;
126 g_dbus_method_invocation_init (GDBusMethodInvocation *invocation)
131 * g_dbus_method_invocation_get_sender:
132 * @invocation: A #GDBusMethodInvocation.
134 * Gets the bus name that invoked the method.
136 * Returns: A string. Do not free, it is owned by @invocation.
141 g_dbus_method_invocation_get_sender (GDBusMethodInvocation *invocation)
143 g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
144 return invocation->sender;
148 * g_dbus_method_invocation_get_object_path:
149 * @invocation: A #GDBusMethodInvocation.
151 * Gets the object path the method was invoked on.
153 * Returns: A string. Do not free, it is owned by @invocation.
158 g_dbus_method_invocation_get_object_path (GDBusMethodInvocation *invocation)
160 g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
161 return invocation->object_path;
165 * g_dbus_method_invocation_get_interface_name:
166 * @invocation: A #GDBusMethodInvocation.
168 * Gets the name of the D-Bus interface the method was invoked on.
170 * If this method call is a property Get, Set or GetAll call that has
171 * been redirected to the method call handler then
172 * "org.freedesktop.DBus.Properties" will be returned. See
173 * #GDBusInterfaceVTable for more information.
175 * Returns: A string. Do not free, it is owned by @invocation.
180 g_dbus_method_invocation_get_interface_name (GDBusMethodInvocation *invocation)
182 g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
183 return invocation->interface_name;
187 * g_dbus_method_invocation_get_method_info:
188 * @invocation: A #GDBusMethodInvocation.
190 * Gets information about the method call, if any.
192 * If this method invocation is a property Get, Set or GetAll call that
193 * has been redirected to the method call handler then %NULL will be
194 * returned. See g_dbus_method_invocation_get_property_info() and
195 * #GDBusInterfaceVTable for more information.
197 * Returns: (nullable): A #GDBusMethodInfo or %NULL. Do not free, it is owned by @invocation.
201 const GDBusMethodInfo *
202 g_dbus_method_invocation_get_method_info (GDBusMethodInvocation *invocation)
204 g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
205 return invocation->method_info;
209 * g_dbus_method_invocation_get_property_info:
210 * @invocation: A #GDBusMethodInvocation
212 * Gets information about the property that this method call is for, if
215 * This will only be set in the case of an invocation in response to a
216 * property Get or Set call that has been directed to the method call
217 * handler for an object on account of its property_get() or
218 * property_set() vtable pointers being unset.
220 * See #GDBusInterfaceVTable for more information.
222 * If the call was GetAll, %NULL will be returned.
224 * Returns: (nullable) (transfer none): a #GDBusPropertyInfo or %NULL
228 const GDBusPropertyInfo *
229 g_dbus_method_invocation_get_property_info (GDBusMethodInvocation *invocation)
231 g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
232 return invocation->property_info;
236 * g_dbus_method_invocation_get_method_name:
237 * @invocation: A #GDBusMethodInvocation.
239 * Gets the name of the method that was invoked.
241 * Returns: A string. Do not free, it is owned by @invocation.
246 g_dbus_method_invocation_get_method_name (GDBusMethodInvocation *invocation)
248 g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
249 return invocation->method_name;
253 * g_dbus_method_invocation_get_connection:
254 * @invocation: A #GDBusMethodInvocation.
256 * Gets the #GDBusConnection the method was invoked on.
258 * Returns: (transfer none):A #GDBusConnection. Do not free, it is owned by @invocation.
263 g_dbus_method_invocation_get_connection (GDBusMethodInvocation *invocation)
265 g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
266 return invocation->connection;
270 * g_dbus_method_invocation_get_message:
271 * @invocation: A #GDBusMethodInvocation.
273 * Gets the #GDBusMessage for the method invocation. This is useful if
274 * you need to use low-level protocol features, such as UNIX file
275 * descriptor passing, that cannot be properly expressed in the
278 * See this [server][gdbus-server] and [client][gdbus-unix-fd-client]
279 * for an example of how to use this low-level API to send and receive
280 * UNIX file descriptors.
282 * Returns: (transfer none): #GDBusMessage. Do not free, it is owned by @invocation.
287 g_dbus_method_invocation_get_message (GDBusMethodInvocation *invocation)
289 g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
290 return invocation->message;
294 * g_dbus_method_invocation_get_parameters:
295 * @invocation: A #GDBusMethodInvocation.
297 * Gets the parameters of the method invocation. If there are no input
298 * parameters then this will return a GVariant with 0 children rather than NULL.
300 * Returns: (transfer none): A #GVariant tuple. Do not unref this because it is owned by @invocation.
305 g_dbus_method_invocation_get_parameters (GDBusMethodInvocation *invocation)
307 g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
308 return invocation->parameters;
312 * g_dbus_method_invocation_peek_unix_fd:
313 * @invocation: A #GDBusMethodInvocation.
316 * Gets the fd associated with @index in the method invocation.
318 * If there is no file descriptor at the given index, -1 is returned.
320 * The returned file descriptor is owned by the message and must not be
321 * closed by the caller. Use dup() if you want your own copy.
323 * Returns: the file descriptor, or -1
327 g_dbus_method_invocation_peek_unix_fd (GDBusMethodInvocation *invocation,
330 GUnixFDList *fd_list;
332 fd_list = g_dbus_message_get_unix_fd_list (invocation->message);
339 fds = g_unix_fd_list_peek_fds (fd_list, &n_fds);
341 if (index_ < (guint) n_fds)
350 * g_dbus_method_invocation_get_user_data: (skip)
351 * @invocation: A #GDBusMethodInvocation.
353 * Gets the @user_data #gpointer passed to g_dbus_connection_register_object().
355 * Returns: A #gpointer.
360 g_dbus_method_invocation_get_user_data (GDBusMethodInvocation *invocation)
362 g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
363 return invocation->user_data;
367 * _g_dbus_method_invocation_new:
368 * @sender: (nullable): The bus name that invoked the method or %NULL if @connection is not a bus connection.
369 * @object_path: The object path the method was invoked on.
370 * @interface_name: The name of the D-Bus interface the method was invoked on.
371 * @method_name: The name of the method that was invoked.
372 * @method_info: (nullable): Information about the method call or %NULL.
373 * @property_info: (nullable): Information about the property or %NULL.
374 * @connection: The #GDBusConnection the method was invoked on.
375 * @message: The D-Bus message as a #GDBusMessage.
376 * @parameters: The parameters as a #GVariant tuple.
377 * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object().
379 * Creates a new #GDBusMethodInvocation object.
381 * Returns: A #GDBusMethodInvocation. Free with g_object_unref().
385 GDBusMethodInvocation *
386 _g_dbus_method_invocation_new (const gchar *sender,
387 const gchar *object_path,
388 const gchar *interface_name,
389 const gchar *method_name,
390 const GDBusMethodInfo *method_info,
391 const GDBusPropertyInfo *property_info,
392 GDBusConnection *connection,
393 GDBusMessage *message,
394 GVariant *parameters,
397 GDBusMethodInvocation *invocation;
399 g_return_val_if_fail (sender == NULL || g_dbus_is_name (sender), NULL);
400 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
401 g_return_val_if_fail (interface_name == NULL || g_dbus_is_interface_name (interface_name), NULL);
402 g_return_val_if_fail (g_dbus_is_member_name (method_name), NULL);
403 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
404 g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL);
405 g_return_val_if_fail (g_variant_is_of_type (parameters, G_VARIANT_TYPE_TUPLE), NULL);
407 invocation = G_DBUS_METHOD_INVOCATION (g_object_new (G_TYPE_DBUS_METHOD_INVOCATION, NULL));
408 invocation->sender = g_strdup (sender);
409 invocation->object_path = g_strdup (object_path);
410 invocation->interface_name = g_strdup (interface_name);
411 invocation->method_name = g_strdup (method_name);
413 invocation->method_info = g_dbus_method_info_ref ((GDBusMethodInfo *)method_info);
415 invocation->property_info = g_dbus_property_info_ref ((GDBusPropertyInfo *)property_info);
416 invocation->connection = g_object_ref (connection);
417 invocation->message = g_object_ref (message);
418 invocation->parameters = g_variant_ref (parameters);
419 invocation->user_data = user_data;
424 /* ---------------------------------------------------------------------------------------------------- */
427 g_dbus_method_invocation_return_value_internal (GDBusMethodInvocation *invocation,
428 GVariant *parameters,
429 GUnixFDList *fd_list)
434 g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation));
435 g_return_if_fail ((parameters == NULL) || g_variant_is_of_type (parameters, G_VARIANT_TYPE_TUPLE));
437 if (g_dbus_message_get_flags (invocation->message) & G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED)
439 if (parameters != NULL)
441 g_variant_ref_sink (parameters);
442 g_variant_unref (parameters);
447 if (parameters == NULL)
448 parameters = g_variant_new_tuple (NULL, 0);
450 /* if we have introspection data, check that the signature of @parameters is correct */
451 if (invocation->method_info != NULL)
455 type = _g_dbus_compute_complete_signature (invocation->method_info->out_args);
457 if (!g_variant_is_of_type (parameters, type))
459 gchar *type_string = g_variant_type_dup_string (type);
461 g_warning ("Type of return value is incorrect: expected '%s', got '%s''",
462 type_string, g_variant_get_type_string (parameters));
463 g_variant_type_free (type);
464 g_free (type_string);
467 g_variant_type_free (type);
470 /* property_info is only non-NULL if set that way from
471 * GDBusConnection, so this must be the case of async property
472 * handling on either 'Get', 'Set' or 'GetAll'.
474 if (invocation->property_info != NULL)
476 if (g_str_equal (invocation->method_name, "Get"))
480 if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(v)")))
482 g_warning ("Type of return value for property 'Get' call should be '(v)' but got '%s'",
483 g_variant_get_type_string (parameters));
487 /* Go deeper and make sure that the value inside of the
488 * variant matches the property type.
490 g_variant_get (parameters, "(v)", &nested);
491 if (!g_str_equal (g_variant_get_type_string (nested), invocation->property_info->signature))
493 g_warning ("Value returned from property 'Get' call for '%s' should be '%s' but is '%s'",
494 invocation->property_info->name, invocation->property_info->signature,
495 g_variant_get_type_string (nested));
496 g_variant_unref (nested);
499 g_variant_unref (nested);
502 else if (g_str_equal (invocation->method_name, "GetAll"))
504 if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(a{sv})")))
506 g_warning ("Type of return value for property 'GetAll' call should be '(a{sv})' but got '%s'",
507 g_variant_get_type_string (parameters));
511 /* Could iterate the list of properties and make sure that all
512 * of them are actually on the interface and with the correct
513 * types, but let's not do that for now...
517 else if (g_str_equal (invocation->method_name, "Set"))
519 if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE_UNIT))
521 g_warning ("Type of return value for property 'Set' call should be '()' but got '%s'",
522 g_variant_get_type_string (parameters));
528 g_assert_not_reached ();
531 if (G_UNLIKELY (_g_dbus_debug_return ()))
533 _g_dbus_debug_print_lock ();
534 g_print ("========================================================================\n"
535 "GDBus-debug:Return:\n"
536 " >>>> METHOD RETURN\n"
537 " in response to %s.%s()\n"
540 " reply-serial %d\n",
541 invocation->interface_name, invocation->method_name,
542 invocation->object_path,
544 g_dbus_message_get_serial (invocation->message));
545 _g_dbus_debug_print_unlock ();
548 reply = g_dbus_message_new_method_reply (invocation->message);
549 g_dbus_message_set_body (reply, parameters);
553 g_dbus_message_set_unix_fd_list (reply, fd_list);
557 if (!g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, &error))
559 if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED))
560 g_warning ("Error sending message: %s", error->message);
561 g_error_free (error);
563 g_object_unref (reply);
566 g_object_unref (invocation);
570 * g_dbus_method_invocation_return_value:
571 * @invocation: (transfer full): A #GDBusMethodInvocation.
572 * @parameters: (nullable): A #GVariant tuple with out parameters for the method or %NULL if not passing any parameters.
574 * Finishes handling a D-Bus method call by returning @parameters.
575 * If the @parameters GVariant is floating, it is consumed.
577 * It is an error if @parameters is not of the right format: it must be a tuple
578 * containing the out-parameters of the D-Bus method. Even if the method has a
579 * single out-parameter, it must be contained in a tuple. If the method has no
580 * out-parameters, @parameters may be %NULL or an empty tuple.
582 * |[<!-- language="C" -->
583 * GDBusMethodInvocation *invocation = some_invocation;
584 * g_autofree gchar *result_string = NULL;
585 * g_autoptr (GError) error = NULL;
587 * result_string = calculate_result (&error);
590 * g_dbus_method_invocation_return_gerror (invocation, error);
592 * g_dbus_method_invocation_return_value (invocation,
593 * g_variant_new ("(s)", result_string));
595 * // Do not free @invocation here; returning a value does that
598 * This method will take ownership of @invocation. See
599 * #GDBusInterfaceVTable for more information about the ownership of
602 * Since 2.48, if the method call requested for a reply not to be sent
603 * then this call will sink @parameters and free @invocation, but
604 * otherwise do nothing (as per the recommendations of the D-Bus
610 g_dbus_method_invocation_return_value (GDBusMethodInvocation *invocation,
611 GVariant *parameters)
613 g_dbus_method_invocation_return_value_internal (invocation, parameters, NULL);
618 * g_dbus_method_invocation_return_value_with_unix_fd_list:
619 * @invocation: (transfer full): A #GDBusMethodInvocation.
620 * @parameters: (nullable): A #GVariant tuple with out parameters for the method or %NULL if not passing any parameters.
621 * @fd_list: (nullable): A #GUnixFDList or %NULL.
623 * Like g_dbus_method_invocation_return_value() but also takes a #GUnixFDList.
625 * This method is only available on UNIX.
627 * This method will take ownership of @invocation. See
628 * #GDBusInterfaceVTable for more information about the ownership of
634 g_dbus_method_invocation_return_value_with_unix_fd_list (GDBusMethodInvocation *invocation,
635 GVariant *parameters,
636 GUnixFDList *fd_list)
638 g_dbus_method_invocation_return_value_internal (invocation, parameters, fd_list);
642 /* ---------------------------------------------------------------------------------------------------- */
645 * g_dbus_method_invocation_return_error:
646 * @invocation: (transfer full): A #GDBusMethodInvocation.
647 * @domain: A #GQuark for the #GError error domain.
648 * @code: The error code.
649 * @format: printf()-style format.
650 * @...: Parameters for @format.
652 * Finishes handling a D-Bus method call by returning an error.
654 * See g_dbus_error_encode_gerror() for details about what error name
655 * will be returned on the wire. In a nutshell, if the given error is
656 * registered using g_dbus_error_register_error() the name given
657 * during registration is used. Otherwise, a name of the form
658 * `org.gtk.GDBus.UnmappedGError.Quark...` is used. This provides
659 * transparent mapping of #GError between applications using GDBus.
661 * If you are writing an application intended to be portable,
662 * always register errors with g_dbus_error_register_error()
663 * or use g_dbus_method_invocation_return_dbus_error().
665 * This method will take ownership of @invocation. See
666 * #GDBusInterfaceVTable for more information about the ownership of
669 * Since 2.48, if the method call requested for a reply not to be sent
670 * then this call will free @invocation but otherwise do nothing (as per
671 * the recommendations of the D-Bus specification).
676 g_dbus_method_invocation_return_error (GDBusMethodInvocation *invocation,
684 g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation));
685 g_return_if_fail (format != NULL);
687 va_start (var_args, format);
688 g_dbus_method_invocation_return_error_valist (invocation,
697 * g_dbus_method_invocation_return_error_valist:
698 * @invocation: (transfer full): A #GDBusMethodInvocation.
699 * @domain: A #GQuark for the #GError error domain.
700 * @code: The error code.
701 * @format: printf()-style format.
702 * @var_args: #va_list of parameters for @format.
704 * Like g_dbus_method_invocation_return_error() but intended for
707 * This method will take ownership of @invocation. See
708 * #GDBusInterfaceVTable for more information about the ownership of
714 g_dbus_method_invocation_return_error_valist (GDBusMethodInvocation *invocation,
720 gchar *literal_message;
722 g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation));
723 g_return_if_fail (format != NULL);
725 literal_message = g_strdup_vprintf (format, var_args);
726 g_dbus_method_invocation_return_error_literal (invocation,
730 g_free (literal_message);
734 * g_dbus_method_invocation_return_error_literal:
735 * @invocation: (transfer full): A #GDBusMethodInvocation.
736 * @domain: A #GQuark for the #GError error domain.
737 * @code: The error code.
738 * @message: The error message.
740 * Like g_dbus_method_invocation_return_error() but without printf()-style formatting.
742 * This method will take ownership of @invocation. See
743 * #GDBusInterfaceVTable for more information about the ownership of
749 g_dbus_method_invocation_return_error_literal (GDBusMethodInvocation *invocation,
752 const gchar *message)
756 g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation));
757 g_return_if_fail (message != NULL);
759 error = g_error_new_literal (domain, code, message);
760 g_dbus_method_invocation_return_gerror (invocation, error);
761 g_error_free (error);
765 * g_dbus_method_invocation_return_gerror:
766 * @invocation: (transfer full): A #GDBusMethodInvocation.
769 * Like g_dbus_method_invocation_return_error() but takes a #GError
770 * instead of the error domain, error code and message.
772 * This method will take ownership of @invocation. See
773 * #GDBusInterfaceVTable for more information about the ownership of
779 g_dbus_method_invocation_return_gerror (GDBusMethodInvocation *invocation,
782 gchar *dbus_error_name;
784 g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation));
785 g_return_if_fail (error != NULL);
787 dbus_error_name = g_dbus_error_encode_gerror (error);
789 g_dbus_method_invocation_return_dbus_error (invocation,
792 g_free (dbus_error_name);
796 * g_dbus_method_invocation_take_error: (skip)
797 * @invocation: (transfer full): A #GDBusMethodInvocation.
798 * @error: (transfer full): A #GError.
800 * Like g_dbus_method_invocation_return_gerror() but takes ownership
801 * of @error so the caller does not need to free it.
803 * This method will take ownership of @invocation. See
804 * #GDBusInterfaceVTable for more information about the ownership of
810 g_dbus_method_invocation_take_error (GDBusMethodInvocation *invocation,
813 g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation));
814 g_return_if_fail (error != NULL);
815 g_dbus_method_invocation_return_gerror (invocation, error);
816 g_error_free (error);
820 * g_dbus_method_invocation_return_dbus_error:
821 * @invocation: (transfer full): A #GDBusMethodInvocation.
822 * @error_name: A valid D-Bus error name.
823 * @error_message: A valid D-Bus error message.
825 * Finishes handling a D-Bus method call by returning an error.
827 * This method will take ownership of @invocation. See
828 * #GDBusInterfaceVTable for more information about the ownership of
834 g_dbus_method_invocation_return_dbus_error (GDBusMethodInvocation *invocation,
835 const gchar *error_name,
836 const gchar *error_message)
840 g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation));
841 g_return_if_fail (error_name != NULL && g_dbus_is_name (error_name));
842 g_return_if_fail (error_message != NULL);
844 if (g_dbus_message_get_flags (invocation->message) & G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED)
847 if (G_UNLIKELY (_g_dbus_debug_return ()))
849 _g_dbus_debug_print_lock ();
850 g_print ("========================================================================\n"
851 "GDBus-debug:Return:\n"
852 " >>>> METHOD ERROR %s\n"
854 " in response to %s.%s()\n"
857 " reply-serial %d\n",
860 invocation->interface_name, invocation->method_name,
861 invocation->object_path,
863 g_dbus_message_get_serial (invocation->message));
864 _g_dbus_debug_print_unlock ();
867 reply = g_dbus_message_new_method_error_literal (invocation->message,
870 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
871 g_object_unref (reply);
874 g_object_unref (invocation);