wscript: add --docdir option and change the default
[ladish.git] / cdbus / helpers.h
blobd76072a35c288e9a108ffa0811a7953ed1a256d1
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2008,2009,2010,2011 Nedko Arnaudov <nedko@arnaudov.name>
6 * Copyright (C) 2008 Juuso Alasuutari <juuso.alasuutari@gmail.com>
8 **************************************************************************
9 * This file contains interface to the D-Bus helpers code
10 **************************************************************************
12 * Licensed under the Academic Free License version 2.1
14 * LADI Session Handler is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * LADI Session Handler is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
26 * or write to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
30 #ifndef HELPERS_H__6C2107A6_A5E3_4806_869B_4BE609535BA2__INCLUDED
31 #define HELPERS_H__6C2107A6_A5E3_4806_869B_4BE609535BA2__INCLUDED
33 #include <dbus/dbus.h>
35 extern DBusConnection * cdbus_g_dbus_connection;
36 extern DBusError cdbus_g_dbus_error;
38 bool cdbus_iter_get_dict_entry(DBusMessageIter * iter_ptr, const char * key, void * value, int * type, int * size);
39 bool cdbus_iter_get_dict_entry_string(DBusMessageIter * iter_ptr, const char * key, const char ** value);
40 bool cdbus_iter_append_variant(DBusMessageIter * iter, int type, const void * arg);
41 bool cdbus_iter_append_dict_entry(DBusMessageIter *iter, int type, const char * key, const void * value, int length);
42 bool cdbus_maybe_add_dict_entry_string(DBusMessageIter *dict_iter_ptr, const char * key, const char * value);
43 bool cdbus_add_dict_entry_uint32(DBusMessageIter * dict_iter_ptr, const char * key, dbus_uint32_t value);
44 bool cdbus_add_dict_entry_bool(DBusMessageIter * dict_iter_ptr, const char * key, dbus_bool_t value);
46 DBusMessage *
47 cdbus_call_raw(
48 unsigned int timeout, /* in milliseconds */
49 DBusMessage * request_ptr);
51 bool
52 cdbus_call(
53 unsigned int timeout, /* in milliseconds */
54 const char * service,
55 const char * object,
56 const char * iface,
57 const char * method,
58 const char * input_signature,
59 ...);
61 bool
62 cdbus_call_async(
63 DBusMessage * request_ptr,
64 void * context,
65 void * cookie,
66 size_t cookie_size,
67 void (* callback)(void * context, void * cookie, DBusMessage * reply_ptr));
69 DBusMessage *
70 cdbus_new_method_call_message(
71 const char * service,
72 const char * object,
73 const char * iface,
74 const char * method,
75 const char * input_signature,
76 ...);
78 bool
79 cdbus_register_object_signal_handler(
80 DBusConnection * connection,
81 const char * service,
82 const char * object,
83 const char * iface,
84 const char * const * signals,
85 DBusHandleMessageFunction handler,
86 void * handler_data);
88 bool
89 cdbus_unregister_object_signal_handler(
90 DBusConnection * connection,
91 const char * service,
92 const char * object,
93 const char * iface,
94 const char * const * signals,
95 DBusHandleMessageFunction handler,
96 void * handler_data);
98 struct cdbus_signal_hook
100 const char * signal_name;
101 void (* hook_function)(void * context, DBusMessage * message_ptr);
104 bool
105 cdbus_register_object_signal_hooks(
106 DBusConnection * connection,
107 const char * service,
108 const char * object,
109 const char * iface,
110 void * hook_context,
111 const struct cdbus_signal_hook * signal_hooks);
113 void
114 cdbus_unregister_object_signal_hooks(
115 DBusConnection * connection,
116 const char * service,
117 const char * object,
118 const char * iface);
120 bool
121 cdbus_register_service_lifetime_hook(
122 DBusConnection * connection,
123 const char * service,
124 void (* hook_function)(bool appeared));
126 void
127 cdbus_unregister_service_lifetime_hook(
128 DBusConnection * connection,
129 const char * service);
131 void cdbus_call_last_error_cleanup(void);
132 bool cdbus_call_last_error_is_name(const char * name);
133 const char * cdbus_call_last_error_get_message(void);
135 #include "method.h"
136 #include "signal.h"
137 #include "interface.h"
138 #include "object_path.h"
140 #endif /* #ifndef HELPERS_H__6C2107A6_A5E3_4806_869B_4BE609535BA2__INCLUDED */