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
23#ifndef __G_DBUS_PROXY_H__
24#define __G_DBUS_PROXY_H__
25
26#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27#error "Only <gio/gio.h> can be included directly."
28#endif
29
30#include <gio/giotypes.h>
31#include <gio/gdbusintrospection.h>
32
33G_BEGIN_DECLS
34
35#define G_TYPE_DBUS_PROXY (g_dbus_proxy_get_type ())
36#define G_DBUS_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_PROXY, GDBusProxy))
37#define G_DBUS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_PROXY, GDBusProxyClass))
38#define G_DBUS_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_PROXY, GDBusProxyClass))
39#define G_IS_DBUS_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_PROXY))
40#define G_IS_DBUS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_PROXY))
41
42typedef struct _GDBusProxyClass GDBusProxyClass;
43typedef struct _GDBusProxyPrivate GDBusProxyPrivate;
44
45struct _GDBusProxy
46{
47 /*< private >*/
48 GObject parent_instance;
49 GDBusProxyPrivate *priv;
50};
51
52/**
53 * GDBusProxyClass:
54 * @g_properties_changed: Signal class handler for the #GDBusProxy::g-properties-changed signal.
55 * @g_signal: Signal class handler for the #GDBusProxy::g-signal signal.
56 *
57 * Class structure for #GDBusProxy.
58 *
59 * Since: 2.26
60 */
61struct _GDBusProxyClass
62{
63 /*< private >*/
64 GObjectClass parent_class;
65
66 /*< public >*/
67 /* Signals */
68 void (*g_properties_changed) (GDBusProxy *proxy,
69 GVariant *changed_properties,
70 const gchar* const *invalidated_properties);
71 void (*g_signal) (GDBusProxy *proxy,
72 const gchar *sender_name,
73 const gchar *signal_name,
74 GVariant *parameters);
75
76 /*< private >*/
77 /* Padding for future expansion */
78 gpointer padding[32];
79};
80
81GIO_AVAILABLE_IN_ALL
82GType g_dbus_proxy_get_type (void) G_GNUC_CONST;
83GIO_AVAILABLE_IN_ALL
84void g_dbus_proxy_new (GDBusConnection *connection,
85 GDBusProxyFlags flags,
86 GDBusInterfaceInfo *info,
87 const gchar *name,
88 const gchar *object_path,
89 const gchar *interface_name,
90 GCancellable *cancellable,
91 GAsyncReadyCallback callback,
92 gpointer user_data);
93GIO_AVAILABLE_IN_ALL
94GDBusProxy *g_dbus_proxy_new_finish (GAsyncResult *res,
95 GError **error);
96GIO_AVAILABLE_IN_ALL
97GDBusProxy *g_dbus_proxy_new_sync (GDBusConnection *connection,
98 GDBusProxyFlags flags,
99 GDBusInterfaceInfo *info,
100 const gchar *name,
101 const gchar *object_path,
102 const gchar *interface_name,
103 GCancellable *cancellable,
104 GError **error);
105GIO_AVAILABLE_IN_ALL
106void g_dbus_proxy_new_for_bus (GBusType bus_type,
107 GDBusProxyFlags flags,
108 GDBusInterfaceInfo *info,
109 const gchar *name,
110 const gchar *object_path,
111 const gchar *interface_name,
112 GCancellable *cancellable,
113 GAsyncReadyCallback callback,
114 gpointer user_data);
115GIO_AVAILABLE_IN_ALL
116GDBusProxy *g_dbus_proxy_new_for_bus_finish (GAsyncResult *res,
117 GError **error);
118GIO_AVAILABLE_IN_ALL
119GDBusProxy *g_dbus_proxy_new_for_bus_sync (GBusType bus_type,
120 GDBusProxyFlags flags,
121 GDBusInterfaceInfo *info,
122 const gchar *name,
123 const gchar *object_path,
124 const gchar *interface_name,
125 GCancellable *cancellable,
126 GError **error);
127GIO_AVAILABLE_IN_ALL
128GDBusConnection *g_dbus_proxy_get_connection (GDBusProxy *proxy);
129GIO_AVAILABLE_IN_ALL
130GDBusProxyFlags g_dbus_proxy_get_flags (GDBusProxy *proxy);
131GIO_AVAILABLE_IN_ALL
132const gchar *g_dbus_proxy_get_name (GDBusProxy *proxy);
133GIO_AVAILABLE_IN_ALL
134gchar *g_dbus_proxy_get_name_owner (GDBusProxy *proxy);
135GIO_AVAILABLE_IN_ALL
136const gchar *g_dbus_proxy_get_object_path (GDBusProxy *proxy);
137GIO_AVAILABLE_IN_ALL
138const gchar *g_dbus_proxy_get_interface_name (GDBusProxy *proxy);
139GIO_AVAILABLE_IN_ALL
140gint g_dbus_proxy_get_default_timeout (GDBusProxy *proxy);
141GIO_AVAILABLE_IN_ALL
142void g_dbus_proxy_set_default_timeout (GDBusProxy *proxy,
143 gint timeout_msec);
144GIO_AVAILABLE_IN_ALL
145GDBusInterfaceInfo *g_dbus_proxy_get_interface_info (GDBusProxy *proxy);
146GIO_AVAILABLE_IN_ALL
147void g_dbus_proxy_set_interface_info (GDBusProxy *proxy,
148 GDBusInterfaceInfo *info);
149GIO_AVAILABLE_IN_ALL
150GVariant *g_dbus_proxy_get_cached_property (GDBusProxy *proxy,
151 const gchar *property_name);
152GIO_AVAILABLE_IN_ALL
153void g_dbus_proxy_set_cached_property (GDBusProxy *proxy,
154 const gchar *property_name,
155 GVariant *value);
156GIO_AVAILABLE_IN_ALL
157gchar **g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy);
158GIO_AVAILABLE_IN_ALL
159void g_dbus_proxy_call (GDBusProxy *proxy,
160 const gchar *method_name,
161 GVariant *parameters,
162 GDBusCallFlags flags,
163 gint timeout_msec,
164 GCancellable *cancellable,
165 GAsyncReadyCallback callback,
166 gpointer user_data);
167GIO_AVAILABLE_IN_ALL
168GVariant *g_dbus_proxy_call_finish (GDBusProxy *proxy,
169 GAsyncResult *res,
170 GError **error);
171GIO_AVAILABLE_IN_ALL
172GVariant *g_dbus_proxy_call_sync (GDBusProxy *proxy,
173 const gchar *method_name,
174 GVariant *parameters,
175 GDBusCallFlags flags,
176 gint timeout_msec,
177 GCancellable *cancellable,
178 GError **error);
179
180#ifdef G_OS_UNIX
181
182GIO_AVAILABLE_IN_ALL
183void g_dbus_proxy_call_with_unix_fd_list (GDBusProxy *proxy,
184 const gchar *method_name,
185 GVariant *parameters,
186 GDBusCallFlags flags,
187 gint timeout_msec,
188 GUnixFDList *fd_list,
189 GCancellable *cancellable,
190 GAsyncReadyCallback callback,
191 gpointer user_data);
192GIO_AVAILABLE_IN_ALL
193GVariant *g_dbus_proxy_call_with_unix_fd_list_finish (GDBusProxy *proxy,
194 GUnixFDList **out_fd_list,
195 GAsyncResult *res,
196 GError **error);
197GIO_AVAILABLE_IN_ALL
198GVariant *g_dbus_proxy_call_with_unix_fd_list_sync (GDBusProxy *proxy,
199 const gchar *method_name,
200 GVariant *parameters,
201 GDBusCallFlags flags,
202 gint timeout_msec,
203 GUnixFDList *fd_list,
204 GUnixFDList **out_fd_list,
205 GCancellable *cancellable,
206 GError **error);
207
208#endif /* G_OS_UNIX */
209
210G_END_DECLS
211
212#endif /* __G_DBUS_PROXY_H__ */
213