|
Packit |
ae235b |
/* GDBus - GLib D-Bus Library
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Copyright (C) 2008-2010 Red Hat, Inc.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* This library is free software; you can redistribute it and/or
|
|
Packit |
ae235b |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
ae235b |
* License as published by the Free Software Foundation; either
|
|
Packit |
ae235b |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
ae235b |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
ae235b |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
ae235b |
* Lesser General Public License for more details.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* You should have received a copy of the GNU Lesser General
|
|
Packit |
ae235b |
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Author: David Zeuthen <davidz@redhat.com>
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#ifndef __G_DBUS_CONNECTION_H__
|
|
Packit |
ae235b |
#define __G_DBUS_CONNECTION_H__
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
|
|
Packit |
ae235b |
#error "Only <gio/gio.h> can be included directly."
|
|
Packit |
ae235b |
#endif
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#include <gio/giotypes.h>
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
G_BEGIN_DECLS
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#define G_TYPE_DBUS_CONNECTION (g_dbus_connection_get_type ())
|
|
Packit |
ae235b |
#define G_DBUS_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_CONNECTION, GDBusConnection))
|
|
Packit |
ae235b |
#define G_IS_DBUS_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_CONNECTION))
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GType g_dbus_connection_get_type (void) G_GNUC_CONST;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_bus_get (GBusType bus_type,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GAsyncReadyCallback callback,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GDBusConnection *g_bus_get_finish (GAsyncResult *res,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GDBusConnection *g_bus_get_sync (GBusType bus_type,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_dbus_connection_new (GIOStream *stream,
|
|
Packit |
ae235b |
const gchar *guid,
|
|
Packit |
ae235b |
GDBusConnectionFlags flags,
|
|
Packit |
ae235b |
GDBusAuthObserver *observer,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GAsyncReadyCallback callback,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GDBusConnection *g_dbus_connection_new_finish (GAsyncResult *res,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GDBusConnection *g_dbus_connection_new_sync (GIOStream *stream,
|
|
Packit |
ae235b |
const gchar *guid,
|
|
Packit |
ae235b |
GDBusConnectionFlags flags,
|
|
Packit |
ae235b |
GDBusAuthObserver *observer,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_dbus_connection_new_for_address (const gchar *address,
|
|
Packit |
ae235b |
GDBusConnectionFlags flags,
|
|
Packit |
ae235b |
GDBusAuthObserver *observer,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GAsyncReadyCallback callback,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GDBusConnection *g_dbus_connection_new_for_address_finish (GAsyncResult *res,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GDBusConnection *g_dbus_connection_new_for_address_sync (const gchar *address,
|
|
Packit |
ae235b |
GDBusConnectionFlags flags,
|
|
Packit |
ae235b |
GDBusAuthObserver *observer,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_dbus_connection_start_message_processing (GDBusConnection *connection);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_dbus_connection_is_closed (GDBusConnection *connection);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GIOStream *g_dbus_connection_get_stream (GDBusConnection *connection);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
const gchar *g_dbus_connection_get_guid (GDBusConnection *connection);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
const gchar *g_dbus_connection_get_unique_name (GDBusConnection *connection);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GCredentials *g_dbus_connection_get_peer_credentials (GDBusConnection *connection);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_2_34
|
|
Packit |
ae235b |
guint32 g_dbus_connection_get_last_serial (GDBusConnection *connection);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_dbus_connection_get_exit_on_close (GDBusConnection *connection);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_dbus_connection_set_exit_on_close (GDBusConnection *connection,
|
|
Packit |
ae235b |
gboolean exit_on_close);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GDBusCapabilityFlags g_dbus_connection_get_capabilities (GDBusConnection *connection);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_dbus_connection_close (GDBusConnection *connection,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GAsyncReadyCallback callback,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_dbus_connection_close_finish (GDBusConnection *connection,
|
|
Packit |
ae235b |
GAsyncResult *res,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_dbus_connection_close_sync (GDBusConnection *connection,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_dbus_connection_flush (GDBusConnection *connection,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GAsyncReadyCallback callback,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_dbus_connection_flush_finish (GDBusConnection *connection,
|
|
Packit |
ae235b |
GAsyncResult *res,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_dbus_connection_flush_sync (GDBusConnection *connection,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_dbus_connection_send_message (GDBusConnection *connection,
|
|
Packit |
ae235b |
GDBusMessage *message,
|
|
Packit |
ae235b |
GDBusSendMessageFlags flags,
|
|
Packit |
ae235b |
volatile guint32 *out_serial,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_dbus_connection_send_message_with_reply (GDBusConnection *connection,
|
|
Packit |
ae235b |
GDBusMessage *message,
|
|
Packit |
ae235b |
GDBusSendMessageFlags flags,
|
|
Packit |
ae235b |
gint timeout_msec,
|
|
Packit |
ae235b |
volatile guint32 *out_serial,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GAsyncReadyCallback callback,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GDBusMessage *g_dbus_connection_send_message_with_reply_finish (GDBusConnection *connection,
|
|
Packit |
ae235b |
GAsyncResult *res,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GDBusMessage *g_dbus_connection_send_message_with_reply_sync (GDBusConnection *connection,
|
|
Packit |
ae235b |
GDBusMessage *message,
|
|
Packit |
ae235b |
GDBusSendMessageFlags flags,
|
|
Packit |
ae235b |
gint timeout_msec,
|
|
Packit |
ae235b |
volatile guint32 *out_serial,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_dbus_connection_emit_signal (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *destination_bus_name,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *signal_name,
|
|
Packit |
ae235b |
GVariant *parameters,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_dbus_connection_call (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *bus_name,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *method_name,
|
|
Packit |
ae235b |
GVariant *parameters,
|
|
Packit |
ae235b |
const GVariantType *reply_type,
|
|
Packit |
ae235b |
GDBusCallFlags flags,
|
|
Packit |
ae235b |
gint timeout_msec,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GAsyncReadyCallback callback,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GVariant *g_dbus_connection_call_finish (GDBusConnection *connection,
|
|
Packit |
ae235b |
GAsyncResult *res,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
GVariant *g_dbus_connection_call_sync (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *bus_name,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *method_name,
|
|
Packit |
ae235b |
GVariant *parameters,
|
|
Packit |
ae235b |
const GVariantType *reply_type,
|
|
Packit |
ae235b |
GDBusCallFlags flags,
|
|
Packit |
ae235b |
gint timeout_msec,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_2_30
|
|
Packit |
ae235b |
void g_dbus_connection_call_with_unix_fd_list (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *bus_name,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *method_name,
|
|
Packit |
ae235b |
GVariant *parameters,
|
|
Packit |
ae235b |
const GVariantType *reply_type,
|
|
Packit |
ae235b |
GDBusCallFlags flags,
|
|
Packit |
ae235b |
gint timeout_msec,
|
|
Packit |
ae235b |
GUnixFDList *fd_list,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GAsyncReadyCallback callback,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_2_30
|
|
Packit |
ae235b |
GVariant *g_dbus_connection_call_with_unix_fd_list_finish (GDBusConnection *connection,
|
|
Packit |
ae235b |
GUnixFDList **out_fd_list,
|
|
Packit |
ae235b |
GAsyncResult *res,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_2_30
|
|
Packit |
ae235b |
GVariant *g_dbus_connection_call_with_unix_fd_list_sync (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *bus_name,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *method_name,
|
|
Packit |
ae235b |
GVariant *parameters,
|
|
Packit |
ae235b |
const GVariantType *reply_type,
|
|
Packit |
ae235b |
GDBusCallFlags flags,
|
|
Packit |
ae235b |
gint timeout_msec,
|
|
Packit |
ae235b |
GUnixFDList *fd_list,
|
|
Packit |
ae235b |
GUnixFDList **out_fd_list,
|
|
Packit |
ae235b |
GCancellable *cancellable,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GDBusInterfaceMethodCallFunc:
|
|
Packit |
ae235b |
* @connection: A #GDBusConnection.
|
|
Packit |
ae235b |
* @sender: The unique bus name of the remote caller.
|
|
Packit |
ae235b |
* @object_path: The object path that the method was invoked on.
|
|
Packit |
ae235b |
* @interface_name: The D-Bus interface name the method was invoked on.
|
|
Packit |
ae235b |
* @method_name: The name of the method that was invoked.
|
|
Packit |
ae235b |
* @parameters: A #GVariant tuple with parameters.
|
|
Packit |
ae235b |
* @invocation: (transfer full): A #GDBusMethodInvocation object that must be used to return a value or error.
|
|
Packit |
ae235b |
* @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The type of the @method_call function in #GDBusInterfaceVTable.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.26
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef void (*GDBusInterfaceMethodCallFunc) (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *sender,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *method_name,
|
|
Packit |
ae235b |
GVariant *parameters,
|
|
Packit |
ae235b |
GDBusMethodInvocation *invocation,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GDBusInterfaceGetPropertyFunc:
|
|
Packit |
ae235b |
* @connection: A #GDBusConnection.
|
|
Packit |
ae235b |
* @sender: The unique bus name of the remote caller.
|
|
Packit |
ae235b |
* @object_path: The object path that the method was invoked on.
|
|
Packit |
ae235b |
* @interface_name: The D-Bus interface name for the property.
|
|
Packit |
ae235b |
* @property_name: The name of the property to get the value of.
|
|
Packit |
ae235b |
* @error: Return location for error.
|
|
Packit |
ae235b |
* @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The type of the @get_property function in #GDBusInterfaceVTable.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Returns: A #GVariant with the value for @property_name or %NULL if
|
|
Packit |
ae235b |
* @error is set. If the returned #GVariant is floating, it is
|
|
Packit |
ae235b |
* consumed - otherwise its reference count is decreased by one.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.26
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef GVariant *(*GDBusInterfaceGetPropertyFunc) (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *sender,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *property_name,
|
|
Packit |
ae235b |
GError **error,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GDBusInterfaceSetPropertyFunc:
|
|
Packit |
ae235b |
* @connection: A #GDBusConnection.
|
|
Packit |
ae235b |
* @sender: The unique bus name of the remote caller.
|
|
Packit |
ae235b |
* @object_path: The object path that the method was invoked on.
|
|
Packit |
ae235b |
* @interface_name: The D-Bus interface name for the property.
|
|
Packit |
ae235b |
* @property_name: The name of the property to get the value of.
|
|
Packit |
ae235b |
* @value: The value to set the property to.
|
|
Packit |
ae235b |
* @error: Return location for error.
|
|
Packit |
ae235b |
* @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The type of the @set_property function in #GDBusInterfaceVTable.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Returns: %TRUE if the property was set to @value, %FALSE if @error is set.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.26
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef gboolean (*GDBusInterfaceSetPropertyFunc) (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *sender,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *property_name,
|
|
Packit |
ae235b |
GVariant *value,
|
|
Packit |
ae235b |
GError **error,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GDBusInterfaceVTable:
|
|
Packit |
ae235b |
* @method_call: Function for handling incoming method calls.
|
|
Packit |
ae235b |
* @get_property: Function for getting a property.
|
|
Packit |
ae235b |
* @set_property: Function for setting a property.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Virtual table for handling properties and method calls for a D-Bus
|
|
Packit |
ae235b |
* interface.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since 2.38, if you want to handle getting/setting D-Bus properties
|
|
Packit |
ae235b |
* asynchronously, give %NULL as your get_property() or set_property()
|
|
Packit |
ae235b |
* function. The D-Bus call will be directed to your @method_call function,
|
|
Packit |
ae235b |
* with the provided @interface_name set to "org.freedesktop.DBus.Properties".
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Ownership of the #GDBusMethodInvocation object passed to the
|
|
Packit |
ae235b |
* method_call() function is transferred to your handler; you must
|
|
Packit |
ae235b |
* call one of the methods of #GDBusMethodInvocation to return a reply
|
|
Packit |
ae235b |
* (possibly empty), or an error. These functions also take ownership
|
|
Packit |
ae235b |
* of the passed-in invocation object, so unless the invocation
|
|
Packit |
ae235b |
* object has otherwise been referenced, it will be then be freed.
|
|
Packit |
ae235b |
* Calling one of these functions may be done within your
|
|
Packit |
ae235b |
* method_call() implementation but it also can be done at a later
|
|
Packit |
ae235b |
* point to handle the method asynchronously.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The usual checks on the validity of the calls is performed. For
|
|
Packit |
ae235b |
* `Get` calls, an error is automatically returned if the property does
|
|
Packit |
ae235b |
* not exist or the permissions do not allow access. The same checks are
|
|
Packit |
ae235b |
* performed for `Set` calls, and the provided value is also checked for
|
|
Packit |
ae235b |
* being the correct type.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* For both `Get` and `Set` calls, the #GDBusMethodInvocation
|
|
Packit |
ae235b |
* passed to the @method_call handler can be queried with
|
|
Packit |
ae235b |
* g_dbus_method_invocation_get_property_info() to get a pointer
|
|
Packit |
ae235b |
* to the #GDBusPropertyInfo of the property.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* If you have readable properties specified in your interface info,
|
|
Packit |
ae235b |
* you must ensure that you either provide a non-%NULL @get_property()
|
|
Packit |
ae235b |
* function or provide implementations of both the `Get` and `GetAll`
|
|
Packit |
ae235b |
* methods on org.freedesktop.DBus.Properties interface in your @method_call
|
|
Packit |
ae235b |
* function. Note that the required return type of the `Get` call is
|
|
Packit |
ae235b |
* `(v)`, not the type of the property. `GetAll` expects a return value
|
|
Packit |
ae235b |
* of type `a{sv}`.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* If you have writable properties specified in your interface info,
|
|
Packit |
ae235b |
* you must ensure that you either provide a non-%NULL @set_property()
|
|
Packit |
ae235b |
* function or provide an implementation of the `Set` call. If implementing
|
|
Packit |
ae235b |
* the call, you must return the value of type %G_VARIANT_TYPE_UNIT.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.26
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
struct _GDBusInterfaceVTable
|
|
Packit |
ae235b |
{
|
|
Packit |
ae235b |
GDBusInterfaceMethodCallFunc method_call;
|
|
Packit |
ae235b |
GDBusInterfaceGetPropertyFunc get_property;
|
|
Packit |
ae235b |
GDBusInterfaceSetPropertyFunc set_property;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/*< private >*/
|
|
Packit |
ae235b |
/* Padding for future expansion - also remember to update
|
|
Packit |
ae235b |
* gdbusconnection.c:_g_dbus_interface_vtable_copy() when
|
|
Packit |
ae235b |
* changing this.
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
gpointer padding[8];
|
|
Packit |
ae235b |
};
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
guint g_dbus_connection_register_object (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
GDBusInterfaceInfo *interface_info,
|
|
Packit |
ae235b |
const GDBusInterfaceVTable *vtable,
|
|
Packit |
ae235b |
gpointer user_data,
|
|
Packit |
ae235b |
GDestroyNotify user_data_free_func,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_2_46
|
|
Packit |
ae235b |
guint g_dbus_connection_register_object_with_closures (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
GDBusInterfaceInfo *interface_info,
|
|
Packit |
ae235b |
GClosure *method_call_closure,
|
|
Packit |
ae235b |
GClosure *get_property_closure,
|
|
Packit |
ae235b |
GClosure *set_property_closure,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_dbus_connection_unregister_object (GDBusConnection *connection,
|
|
Packit |
ae235b |
guint registration_id);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GDBusSubtreeEnumerateFunc:
|
|
Packit |
ae235b |
* @connection: A #GDBusConnection.
|
|
Packit |
ae235b |
* @sender: The unique bus name of the remote caller.
|
|
Packit |
ae235b |
* @object_path: The object path that was registered with g_dbus_connection_register_subtree().
|
|
Packit |
ae235b |
* @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The type of the @enumerate function in #GDBusSubtreeVTable.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* This function is called when generating introspection data and also
|
|
Packit |
ae235b |
* when preparing to dispatch incoming messages in the event that the
|
|
Packit |
ae235b |
* %G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is not
|
|
Packit |
ae235b |
* specified (ie: to verify that the object path is valid).
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Hierarchies are not supported; the items that you return should not
|
|
Packit |
ae235b |
* contain the '/' character.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The return value will be freed with g_strfreev().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Returns: A newly allocated array of strings for node names that are children of @object_path.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.26
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef gchar** (*GDBusSubtreeEnumerateFunc) (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *sender,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GDBusSubtreeIntrospectFunc:
|
|
Packit |
ae235b |
* @connection: A #GDBusConnection.
|
|
Packit |
ae235b |
* @sender: The unique bus name of the remote caller.
|
|
Packit |
ae235b |
* @object_path: The object path that was registered with g_dbus_connection_register_subtree().
|
|
Packit |
ae235b |
* @node: A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree.
|
|
Packit |
ae235b |
* @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The type of the @introspect function in #GDBusSubtreeVTable.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Subtrees are flat. @node, if non-%NULL, is always exactly one
|
|
Packit |
ae235b |
* segment of the object path (ie: it never contains a slash).
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* This function should return %NULL to indicate that there is no object
|
|
Packit |
ae235b |
* at this node.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* If this function returns non-%NULL, the return value is expected to
|
|
Packit |
ae235b |
* be a %NULL-terminated array of pointers to #GDBusInterfaceInfo
|
|
Packit |
ae235b |
* structures describing the interfaces implemented by @node. This
|
|
Packit |
ae235b |
* array will have g_dbus_interface_info_unref() called on each item
|
|
Packit |
ae235b |
* before being freed with g_free().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The difference between returning %NULL and an array containing zero
|
|
Packit |
ae235b |
* items is that the standard DBus interfaces will returned to the
|
|
Packit |
ae235b |
* remote introspector in the empty array case, but not in the %NULL
|
|
Packit |
ae235b |
* case.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Returns: A %NULL-terminated array of pointers to #GDBusInterfaceInfo, or %NULL.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.26
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef GDBusInterfaceInfo ** (*GDBusSubtreeIntrospectFunc) (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *sender,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *node,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GDBusSubtreeDispatchFunc:
|
|
Packit |
ae235b |
* @connection: A #GDBusConnection.
|
|
Packit |
ae235b |
* @sender: The unique bus name of the remote caller.
|
|
Packit |
ae235b |
* @object_path: The object path that was registered with g_dbus_connection_register_subtree().
|
|
Packit |
ae235b |
* @interface_name: The D-Bus interface name that the method call or property access is for.
|
|
Packit |
ae235b |
* @node: A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree.
|
|
Packit |
ae235b |
* @out_user_data: (nullable) (not optional): Return location for user data to pass to functions in the returned #GDBusInterfaceVTable (never %NULL).
|
|
Packit |
ae235b |
* @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* The type of the @dispatch function in #GDBusSubtreeVTable.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Subtrees are flat. @node, if non-%NULL, is always exactly one
|
|
Packit |
ae235b |
* segment of the object path (ie: it never contains a slash).
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Returns: A #GDBusInterfaceVTable or %NULL if you don't want to handle the methods.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.26
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef const GDBusInterfaceVTable * (*GDBusSubtreeDispatchFunc) (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *sender,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *node,
|
|
Packit |
ae235b |
gpointer *out_user_data,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GDBusSubtreeVTable:
|
|
Packit |
ae235b |
* @enumerate: Function for enumerating child nodes.
|
|
Packit |
ae235b |
* @introspect: Function for introspecting a child node.
|
|
Packit |
ae235b |
* @dispatch: Function for dispatching a remote call on a child node.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Virtual table for handling subtrees registered with g_dbus_connection_register_subtree().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.26
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
struct _GDBusSubtreeVTable
|
|
Packit |
ae235b |
{
|
|
Packit |
ae235b |
GDBusSubtreeEnumerateFunc enumerate;
|
|
Packit |
ae235b |
GDBusSubtreeIntrospectFunc introspect;
|
|
Packit |
ae235b |
GDBusSubtreeDispatchFunc dispatch;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/*< private >*/
|
|
Packit |
ae235b |
/* Padding for future expansion - also remember to update
|
|
Packit |
ae235b |
* gdbusconnection.c:_g_dbus_subtree_vtable_copy() when
|
|
Packit |
ae235b |
* changing this.
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
gpointer padding[8];
|
|
Packit |
ae235b |
};
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
guint g_dbus_connection_register_subtree (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const GDBusSubtreeVTable *vtable,
|
|
Packit |
ae235b |
GDBusSubtreeFlags flags,
|
|
Packit |
ae235b |
gpointer user_data,
|
|
Packit |
ae235b |
GDestroyNotify user_data_free_func,
|
|
Packit |
ae235b |
GError **error);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
gboolean g_dbus_connection_unregister_subtree (GDBusConnection *connection,
|
|
Packit |
ae235b |
guint registration_id);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GDBusSignalCallback:
|
|
Packit |
ae235b |
* @connection: A #GDBusConnection.
|
|
Packit |
ae235b |
* @sender_name: The unique bus name of the sender of the signal.
|
|
Packit |
ae235b |
* @object_path: The object path that the signal was emitted on.
|
|
Packit |
ae235b |
* @interface_name: The name of the interface.
|
|
Packit |
ae235b |
* @signal_name: The name of the signal.
|
|
Packit |
ae235b |
* @parameters: A #GVariant tuple with parameters for the signal.
|
|
Packit |
ae235b |
* @user_data: User data passed when subscribing to the signal.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Signature for callback function used in g_dbus_connection_signal_subscribe().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.26
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef void (*GDBusSignalCallback) (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *sender_name,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *signal_name,
|
|
Packit |
ae235b |
GVariant *parameters,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
guint g_dbus_connection_signal_subscribe (GDBusConnection *connection,
|
|
Packit |
ae235b |
const gchar *sender,
|
|
Packit |
ae235b |
const gchar *interface_name,
|
|
Packit |
ae235b |
const gchar *member,
|
|
Packit |
ae235b |
const gchar *object_path,
|
|
Packit |
ae235b |
const gchar *arg0,
|
|
Packit |
ae235b |
GDBusSignalFlags flags,
|
|
Packit |
ae235b |
GDBusSignalCallback callback,
|
|
Packit |
ae235b |
gpointer user_data,
|
|
Packit |
ae235b |
GDestroyNotify user_data_free_func);
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_dbus_connection_signal_unsubscribe (GDBusConnection *connection,
|
|
Packit |
ae235b |
guint subscription_id);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/**
|
|
Packit |
ae235b |
* GDBusMessageFilterFunction:
|
|
Packit |
ae235b |
* @connection: (transfer none): A #GDBusConnection.
|
|
Packit |
ae235b |
* @message: (transfer full): A locked #GDBusMessage that the filter function takes ownership of.
|
|
Packit |
ae235b |
* @incoming: %TRUE if it is a message received from the other peer, %FALSE if it is
|
|
Packit |
ae235b |
* a message to be sent to the other peer.
|
|
Packit |
ae235b |
* @user_data: User data passed when adding the filter.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Signature for function used in g_dbus_connection_add_filter().
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* A filter function is passed a #GDBusMessage and expected to return
|
|
Packit |
ae235b |
* a #GDBusMessage too. Passive filter functions that don't modify the
|
|
Packit |
ae235b |
* message can simply return the @message object:
|
|
Packit |
ae235b |
* |[
|
|
Packit |
ae235b |
* static GDBusMessage *
|
|
Packit |
ae235b |
* passive_filter (GDBusConnection *connection
|
|
Packit |
ae235b |
* GDBusMessage *message,
|
|
Packit |
ae235b |
* gboolean incoming,
|
|
Packit |
ae235b |
* gpointer user_data)
|
|
Packit |
ae235b |
* {
|
|
Packit |
ae235b |
* // inspect @message
|
|
Packit |
ae235b |
* return message;
|
|
Packit |
ae235b |
* }
|
|
Packit |
ae235b |
* ]|
|
|
Packit |
ae235b |
* Filter functions that wants to drop a message can simply return %NULL:
|
|
Packit |
ae235b |
* |[
|
|
Packit |
ae235b |
* static GDBusMessage *
|
|
Packit |
ae235b |
* drop_filter (GDBusConnection *connection
|
|
Packit |
ae235b |
* GDBusMessage *message,
|
|
Packit |
ae235b |
* gboolean incoming,
|
|
Packit |
ae235b |
* gpointer user_data)
|
|
Packit |
ae235b |
* {
|
|
Packit |
ae235b |
* if (should_drop_message)
|
|
Packit |
ae235b |
* {
|
|
Packit |
ae235b |
* g_object_unref (message);
|
|
Packit |
ae235b |
* message = NULL;
|
|
Packit |
ae235b |
* }
|
|
Packit |
ae235b |
* return message;
|
|
Packit |
ae235b |
* }
|
|
Packit |
ae235b |
* ]|
|
|
Packit |
ae235b |
* Finally, a filter function may modify a message by copying it:
|
|
Packit |
ae235b |
* |[
|
|
Packit |
ae235b |
* static GDBusMessage *
|
|
Packit |
ae235b |
* modifying_filter (GDBusConnection *connection
|
|
Packit |
ae235b |
* GDBusMessage *message,
|
|
Packit |
ae235b |
* gboolean incoming,
|
|
Packit |
ae235b |
* gpointer user_data)
|
|
Packit |
ae235b |
* {
|
|
Packit |
ae235b |
* GDBusMessage *copy;
|
|
Packit |
ae235b |
* GError *error;
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* error = NULL;
|
|
Packit |
ae235b |
* copy = g_dbus_message_copy (message, &error);
|
|
Packit |
ae235b |
* // handle @error being set
|
|
Packit |
ae235b |
* g_object_unref (message);
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* // modify @copy
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* return copy;
|
|
Packit |
ae235b |
* }
|
|
Packit |
ae235b |
* ]|
|
|
Packit |
ae235b |
* If the returned #GDBusMessage is different from @message and cannot
|
|
Packit |
ae235b |
* be sent on @connection (it could use features, such as file
|
|
Packit |
ae235b |
* descriptors, not compatible with @connection), then a warning is
|
|
Packit |
ae235b |
* logged to standard error. Applications can
|
|
Packit |
ae235b |
* check this ahead of time using g_dbus_message_to_blob() passing a
|
|
Packit |
ae235b |
* #GDBusCapabilityFlags value obtained from @connection.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Returns: (transfer full) (nullable): A #GDBusMessage that will be freed with
|
|
Packit |
ae235b |
* g_object_unref() or %NULL to drop the message. Passive filter
|
|
Packit |
ae235b |
* functions can simply return the passed @message object.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Since: 2.26
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
typedef GDBusMessage *(*GDBusMessageFilterFunction) (GDBusConnection *connection,
|
|
Packit |
ae235b |
GDBusMessage *message,
|
|
Packit |
ae235b |
gboolean incoming,
|
|
Packit |
ae235b |
gpointer user_data);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
guint g_dbus_connection_add_filter (GDBusConnection *connection,
|
|
Packit |
ae235b |
GDBusMessageFilterFunction filter_function,
|
|
Packit |
ae235b |
gpointer user_data,
|
|
Packit |
ae235b |
GDestroyNotify user_data_free_func);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
GLIB_AVAILABLE_IN_ALL
|
|
Packit |
ae235b |
void g_dbus_connection_remove_filter (GDBusConnection *connection,
|
|
Packit |
ae235b |
guint filter_id);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
/* ---------------------------------------------------------------------------------------------------- */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
G_END_DECLS
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#endif /* __G_DBUS_CONNECTION_H__ */
|