3 * Copyright (C) 2007-2010 Jürg Billeter
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 Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * Jürg Billeter <j@bitron.ch>
21 * Michael 'Mickey' Lauer <mlauer@vanille-media.de>
24 [CCode (cheader_filename = "dbus/dbus-glib-lowlevel.h,dbus/dbus-glib.h")]
26 public const string SERVICE_DBUS;
27 public const string PATH_DBUS;
28 public const string INTERFACE_DBUS;
30 public const string INTERFACE_INTROSPECTABLE;
31 public const string INTERFACE_PROPERTIES;
32 public const string INTERFACE_PEER;
34 [CCode (cname = "dbus_g_thread_init")]
35 public static void thread_init ();
37 [CCode (cprefix = "DBUS_BUS_")]
44 [CCode (lower_case_cprefix = "dbus_bus_")]
46 public static RawConnection get (BusType type, ref RawError error);
49 [CCode (ref_function = "dbus_connection_ref", unref_function = "dbus_connection_unref", cname = "DBusConnection", cprefix = "dbus_connection_")]
50 public class RawConnection {
51 [CCode (cname = "dbus_connection_setup_with_g_main")]
52 public void setup_with_main (GLib.MainContext? context = null);
53 [CCode (cname = "dbus_connection_get_g_connection")]
54 public unowned Connection get_g_connection ();
55 [CCode (cname = "dbus_connection_register_g_object")]
56 public void register_object (string at_path, GLib.Object object);
58 public bool send (RawMessage message, uint32? client_serial);
59 public RawMessage send_with_reply_and_block (RawMessage message, int timeout_milliseconds, ref RawError error);
61 public bool add_filter (RawHandleMessageFunction function, RawFreeFunction? free_data_function = null);
62 public void remove_filter (RawHandleMessageFunction function);
64 [CCode (cname = "dbus_bus_add_match")]
65 public void add_match (string rule, ref RawError error);
66 [CCode (cname = "dbus_bus_remove_match")]
67 public void remove_match (string rule, ref RawError error);
68 [CCode (cname = "dbus_bus_get_unique_name")]
69 public unowned string get_unique_name();
70 [CCode (cname = "dbus_bus_request_name")]
71 public int request_name(string name, uint flags, ref RawError error);
72 [CCode (cname="dbus_bus_release_name")]
73 public int release_name(string name, ref RawError error);
76 [CCode (cname = "DBusError", cprefix = "dbus_error_", destroy_function = "dbus_error_free")]
77 public struct RawError {
79 public string message;
82 public bool has_name (string name);
83 public bool is_set ();
86 [CCode (cname = "DBusFreeFunction", has_target = false)]
87 public delegate void* RawFreeFunction (void* memory);
88 [CCode (cname = "DBusHandleMessageFunction", instance_pos = -1)]
89 public delegate RawHandlerResult RawHandleMessageFunction(RawConnection connection, RawMessage message);
91 [CCode (cname = "DBusHandlerResult", cprefix = "DBUS_HANDLER_RESULT_")]
92 public enum RawHandlerResult {
98 [CCode (cname = "DBusMessageIter", cprefix = "dbus_message_iter_")]
99 public struct RawMessageIter {
100 public bool has_next ();
102 public string get_signature ();
103 public int get_arg_type ();
104 public int get_element_type ();
105 public void recurse (RawMessageIter sub);
106 public void get_basic (void* value);
107 public bool open_container (RawType arg_type, string? signature, RawMessageIter sub);
108 public bool close_container (RawMessageIter sub);
109 public bool append_basic (RawType arg_type, void* value);
111 [CCode (cname = "dbus_message_type_from_string")]
112 public static int type_from_string (string type);
113 [CCode (cname = "dbus_message_type_to_string")]
114 public static string type_to_string (int type);
117 [CCode (ref_function = "dbus_message_ref", unref_function = "dbus_message_unref", cname = "DBusMessage", cprefix = "dbus_message_")]
118 public class RawMessage {
119 [CCode (cname = "dbus_message_new_method_call")]
120 public RawMessage.call (string bus_name, string path, string interface, string method);
121 [CCode (sentinel = "DBUS_TYPE_INVALID")]
122 public bool append_args (RawType first_arg_type, ...);
123 [CCode (cname = "dbus_message_iter_init")]
124 public bool iter_init (RawMessageIter iter);
125 [CCode (cname = "dbus_message_iter_init_append")]
126 public bool iter_init_append (RawMessageIter iter);
128 public RawMessageType get_type ();
129 public bool set_path (string object_path);
130 public unowned string get_path ();
131 public bool has_path (string object_path);
132 public bool set_interface (string iface);
133 public unowned string get_interface ();
134 public bool has_interface (string iface);
135 public bool set_member (string member);
136 public unowned string get_member ();
137 public bool has_member (string member);
138 public bool set_error_name (string name);
139 public unowned string get_error_name ();
140 public bool set_destination (string destination);
141 public unowned string get_destination ();
142 public bool set_sender (string sender);
143 public unowned string get_sender ();
144 public unowned string get_signature ();
145 public void set_no_reply (bool no_reply);
146 public bool get_no_reply ();
147 public bool is_method_call (string iface, string method);
148 public bool is_signal (string iface, string signal_name);
149 public bool is_error (string error_name);
150 public bool has_destination (string bus_name);
151 public bool has_sender (string unique_bus_name);
152 public bool has_signature (string signature);
153 public uint32 get_serial ();
154 public void set_serial (uint32 serial);
155 public bool set_reply_serial (uint32 reply_serial);
156 public uint32 get_reply_serial ();
157 public void set_auto_start (bool auto_start);
158 public bool get_auto_start ();
159 public bool get_path_decomposed (out char[] path );
162 [CCode (cname = "int", cprefix = "DBUS_MESSAGE_TYPE_")]
163 public enum RawMessageType {
171 [CCode (cname = "int", cprefix = "DBUS_TYPE_")]
172 public enum RawType {
192 [DBus (name = "org.freedesktop.DBus.Error")]
193 [CCode (cname = "DBusGError", lower_case_csuffix = "gerror", cprefix = "DBUS_GERROR_")]
194 public errordomain Error {
200 [DBus (name = "IOError")]
217 MATCH_RULE_NOT_FOUND,
219 [DBus (name = "Spawn.ExecFailed")]
221 [DBus (name = "Spawn.ForkFailed")]
223 [DBus (name = "Spawn.ChildExited")]
225 [DBus (name = "Spawn.ChildSignaled")]
226 SPAWN_CHILD_SIGNALED,
227 [DBus (name = "Spawn.Failed")]
229 UNIX_PROCESS_ID_UNKNOWN,
231 INVALID_FILE_CONTENT,
232 [DBus (name = "SELinuxSecurityContextUnknown")]
233 SELINUX_SECURITY_CONTEXT_UNKNOWN,
238 [CCode (cname = "dbus_g_bus_get")]
239 public static Connection get (BusType type) throws Error;
243 [CCode (ref_function = "dbus_g_connection_ref", unref_function = "dbus_g_connection_unref", cname = "DBusGConnection")]
244 public class Connection {
245 [CCode (cname = "dbus_g_proxy_new_for_name")]
246 public Object get_object (string name, string path, string? interface_ = null);
247 [CCode (cname="dbus_g_proxy_new_for_name_owner")]
248 public Object get_object_for_name_owner (string name, string path, string? interface_ = null) throws Error;
249 [CCode (cname = "dbus_g_proxy_new_from_type")]
250 public GLib.Object get_object_from_type (string name, string path, string interface_, GLib.Type type);
251 [CCode (cname = "dbus_g_connection_register_g_object")]
252 public void register_object (string at_path, GLib.Object object);
253 [CCode (cname = "dbus_g_connection_unregister_g_object")]
254 public void unregister_object (GLib.Object object);
255 [CCode (cname = "dbus_g_connection_lookup_g_object")]
256 public unowned GLib.Object lookup_object (string at_path);
257 [CCode (cname = "dbus_g_connection_get_connection")]
258 public unowned RawConnection get_connection ();
261 [CCode (cname = "DBusGProxy", lower_case_csuffix = "g_proxy")]
262 public class Object : GLib.Object {
263 public bool call (string method, out GLib.Error error, GLib.Type first_arg_type, ...);
264 public unowned ProxyCall begin_call (string method, ProxyCallNotify notify, GLib.DestroyNotify destroy, GLib.Type first_arg_type, ...);
265 public bool end_call (ProxyCall call, out GLib.Error error, GLib.Type first_arg_type, ...);
266 public void cancel_call (ProxyCall call);
267 public unowned string get_path ();
268 public unowned string get_bus_name ();
269 public unowned string get_interface ();
270 public GLib.HashTable<string,GLib.Value?> get_all (string interface_name) throws DBus.Error;
272 public signal void destroy ();
275 [CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "DBUS_TYPE_G_OBJECT_PATH", marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed", type_signature = "o")]
276 public class ObjectPath : string {
277 [CCode (cname = "g_strdup")]
278 public ObjectPath (string path);
281 [CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string")]
282 public class BusName : string {
283 [CCode (cname = "g_strdup")]
284 public BusName (string bus_name);
287 [CCode (cname = "DBusGProxyCallNotify")]
288 public delegate void ProxyCallNotify (Object obj, ProxyCall call_id);
290 [CCode (cname = "DBusGProxyCall")]
291 public class ProxyCall {
294 [CCode (cname = "DBusGMethodInvocation")]
295 public class MethodInvocation {
299 [CCode (cname = "uint")]
300 public enum NameFlag {
306 [CCode (cname = "int")]
307 public enum RequestNameReply {