gdbusmethodinvocation.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* GDBus - GLib D-Bus Library
  2. *
  3. * Copyright (C) 2008-2010 Red Hat, Inc.
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General
  18. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * Author: David Zeuthen <davidz@redhat.com>
  21. */
  22. #ifndef __G_DBUS_METHOD_INVOCATION_H__
  23. #define __G_DBUS_METHOD_INVOCATION_H__
  24. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  25. #error "Only <gio/gio.h> can be included directly."
  26. #endif
  27. #include <gio/giotypes.h>
  28. G_BEGIN_DECLS
  29. #define G_TYPE_DBUS_METHOD_INVOCATION (g_dbus_method_invocation_get_type ())
  30. #define G_DBUS_METHOD_INVOCATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_METHOD_INVOCATION, GDBusMethodInvocation))
  31. #define G_IS_DBUS_METHOD_INVOCATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_METHOD_INVOCATION))
  32. /**
  33. * G_DBUS_METHOD_INVOCATION_HANDLED:
  34. *
  35. * The value returned by handlers of the signals generated by
  36. * the `gdbus-codegen` tool to indicate that a method call has been
  37. * handled by an implementation. It is equal to %TRUE, but using
  38. * this macro is sometimes more readable.
  39. *
  40. * In code that needs to be backwards-compatible with older GLib,
  41. * use %TRUE instead, often written like this:
  42. *
  43. * |[
  44. * g_dbus_method_invocation_return_error (invocation, ...);
  45. * return TRUE; // handled
  46. * ]|
  47. *
  48. * Since: 2.68
  49. */
  50. #define G_DBUS_METHOD_INVOCATION_HANDLED TRUE GIO_AVAILABLE_MACRO_IN_2_68
  51. /**
  52. * G_DBUS_METHOD_INVOCATION_UNHANDLED:
  53. *
  54. * The value returned by handlers of the signals generated by
  55. * the `gdbus-codegen` tool to indicate that a method call has not been
  56. * handled by an implementation. It is equal to %FALSE, but using
  57. * this macro is sometimes more readable.
  58. *
  59. * In code that needs to be backwards-compatible with older GLib,
  60. * use %FALSE instead.
  61. *
  62. * Since: 2.68
  63. */
  64. #define G_DBUS_METHOD_INVOCATION_UNHANDLED FALSE GIO_AVAILABLE_MACRO_IN_2_68
  65. GIO_AVAILABLE_IN_ALL
  66. GType g_dbus_method_invocation_get_type (void) G_GNUC_CONST;
  67. GIO_AVAILABLE_IN_ALL
  68. const gchar *g_dbus_method_invocation_get_sender (GDBusMethodInvocation *invocation);
  69. GIO_AVAILABLE_IN_ALL
  70. const gchar *g_dbus_method_invocation_get_object_path (GDBusMethodInvocation *invocation);
  71. GIO_AVAILABLE_IN_ALL
  72. const gchar *g_dbus_method_invocation_get_interface_name (GDBusMethodInvocation *invocation);
  73. GIO_AVAILABLE_IN_ALL
  74. const gchar *g_dbus_method_invocation_get_method_name (GDBusMethodInvocation *invocation);
  75. GIO_AVAILABLE_IN_ALL
  76. const GDBusMethodInfo *g_dbus_method_invocation_get_method_info (GDBusMethodInvocation *invocation);
  77. GIO_AVAILABLE_IN_2_38
  78. const GDBusPropertyInfo *g_dbus_method_invocation_get_property_info (GDBusMethodInvocation *invocation);
  79. GIO_AVAILABLE_IN_ALL
  80. GDBusConnection *g_dbus_method_invocation_get_connection (GDBusMethodInvocation *invocation);
  81. GIO_AVAILABLE_IN_ALL
  82. GDBusMessage *g_dbus_method_invocation_get_message (GDBusMethodInvocation *invocation);
  83. GIO_AVAILABLE_IN_ALL
  84. GVariant *g_dbus_method_invocation_get_parameters (GDBusMethodInvocation *invocation);
  85. GIO_AVAILABLE_IN_ALL
  86. gpointer g_dbus_method_invocation_get_user_data (GDBusMethodInvocation *invocation);
  87. GIO_AVAILABLE_IN_ALL
  88. void g_dbus_method_invocation_return_value (GDBusMethodInvocation *invocation,
  89. GVariant *parameters);
  90. #ifdef G_OS_UNIX
  91. GIO_AVAILABLE_IN_ALL
  92. void g_dbus_method_invocation_return_value_with_unix_fd_list (GDBusMethodInvocation *invocation,
  93. GVariant *parameters,
  94. GUnixFDList *fd_list);
  95. #endif /* G_OS_UNIX */
  96. GIO_AVAILABLE_IN_ALL
  97. void g_dbus_method_invocation_return_error (GDBusMethodInvocation *invocation,
  98. GQuark domain,
  99. gint code,
  100. const gchar *format,
  101. ...) G_GNUC_PRINTF(4, 5);
  102. GIO_AVAILABLE_IN_ALL
  103. void g_dbus_method_invocation_return_error_valist (GDBusMethodInvocation *invocation,
  104. GQuark domain,
  105. gint code,
  106. const gchar *format,
  107. va_list var_args)
  108. G_GNUC_PRINTF(4, 0);
  109. GIO_AVAILABLE_IN_ALL
  110. void g_dbus_method_invocation_return_error_literal (GDBusMethodInvocation *invocation,
  111. GQuark domain,
  112. gint code,
  113. const gchar *message);
  114. GIO_AVAILABLE_IN_ALL
  115. void g_dbus_method_invocation_return_gerror (GDBusMethodInvocation *invocation,
  116. const GError *error);
  117. GIO_AVAILABLE_IN_ALL
  118. void g_dbus_method_invocation_take_error (GDBusMethodInvocation *invocation,
  119. GError *error);
  120. GIO_AVAILABLE_IN_ALL
  121. void g_dbus_method_invocation_return_dbus_error (GDBusMethodInvocation *invocation,
  122. const gchar *error_name,
  123. const gchar *error_message);
  124. G_END_DECLS
  125. #endif /* __G_DBUS_METHOD_INVOCATION_H__ */