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
33 G_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
42 typedef struct _GDBusProxyClass GDBusProxyClass;
43 typedef struct _GDBusProxyPrivate GDBusProxyPrivate;
44
45 struct _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 */
61 struct _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
81 GIO_AVAILABLE_IN_ALL
82 GType g_dbus_proxy_get_type (void) G_GNUC_CONST;
83 GIO_AVAILABLE_IN_ALL
84 void 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);
93 GIO_AVAILABLE_IN_ALL
94 GDBusProxy *g_dbus_proxy_new_finish (GAsyncResult *res,
95 GError **error);
96 GIO_AVAILABLE_IN_ALL
97 GDBusProxy *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);
105 GIO_AVAILABLE_IN_ALL
106 void 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);
115 GIO_AVAILABLE_IN_ALL
116 GDBusProxy *g_dbus_proxy_new_for_bus_finish (GAsyncResult *res,
117 GError **error);
118 GIO_AVAILABLE_IN_ALL
119 GDBusProxy *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);
127 GIO_AVAILABLE_IN_ALL
128 GDBusConnection *g_dbus_proxy_get_connection (GDBusProxy *proxy);
129 GIO_AVAILABLE_IN_ALL
130 GDBusProxyFlags g_dbus_proxy_get_flags (GDBusProxy *proxy);
131 GIO_AVAILABLE_IN_ALL
132 const gchar *g_dbus_proxy_get_name (GDBusProxy *proxy);
133 GIO_AVAILABLE_IN_ALL
134 gchar *g_dbus_proxy_get_name_owner (GDBusProxy *proxy);
135 GIO_AVAILABLE_IN_ALL
136 const gchar *g_dbus_proxy_get_object_path (GDBusProxy *proxy);
137 GIO_AVAILABLE_IN_ALL
138 const gchar *g_dbus_proxy_get_interface_name (GDBusProxy *proxy);
139 GIO_AVAILABLE_IN_ALL
140 gint g_dbus_proxy_get_default_timeout (GDBusProxy *proxy);
141 GIO_AVAILABLE_IN_ALL
142 void g_dbus_proxy_set_default_timeout (GDBusProxy *proxy,
143 gint timeout_msec);
144 GIO_AVAILABLE_IN_ALL
145 GDBusInterfaceInfo *g_dbus_proxy_get_interface_info (GDBusProxy *proxy);
146 GIO_AVAILABLE_IN_ALL
147 void g_dbus_proxy_set_interface_info (GDBusProxy *proxy,
148 GDBusInterfaceInfo *info);
149 GIO_AVAILABLE_IN_ALL
150 GVariant *g_dbus_proxy_get_cached_property (GDBusProxy *proxy,
151 const gchar *property_name);
152 GIO_AVAILABLE_IN_ALL
153 void g_dbus_proxy_set_cached_property (GDBusProxy *proxy,
154 const gchar *property_name,
155 GVariant *value);
156 GIO_AVAILABLE_IN_ALL
157 gchar **g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy);
158 GIO_AVAILABLE_IN_ALL
159 void 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);
167 GIO_AVAILABLE_IN_ALL
168 GVariant *g_dbus_proxy_call_finish (GDBusProxy *proxy,
169 GAsyncResult *res,
170 GError **error);
171 GIO_AVAILABLE_IN_ALL
172 GVariant *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
182 GIO_AVAILABLE_IN_ALL
183 void 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);
192 GIO_AVAILABLE_IN_ALL
193 GVariant *g_dbus_proxy_call_with_unix_fd_list_finish (GDBusProxy *proxy,
194 GUnixFDList **out_fd_list,
195 GAsyncResult *res,
196 GError **error);
197 GIO_AVAILABLE_IN_ALL
198 GVariant *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
210 G_END_DECLS
211
212 #endif /* __G_DBUS_PROXY_H__ */