pidgin 2.15.0dev
Loading...
Searching...
No Matches
dbus-bindings.h
Go to the documentation of this file.
1
6/* purple
7 *
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 *
26 */
27
28#ifndef _PURPLE_DBUS_BINDINGS_H_
29#define _PURPLE_DBUS_BINDINGS_H_
30
31#include <dbus/dbus.h>
32#include <dbus/dbus-glib-lowlevel.h>
33#include <glib.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39gint purple_dbus_pointer_to_id(gconstpointer node);
40gpointer purple_dbus_id_to_pointer(gint id, PurpleDBusType *type);
41gint purple_dbus_pointer_to_id_error(gconstpointer ptr, DBusError *error);
42gpointer purple_dbus_id_to_pointer_error(gint id, PurpleDBusType *type,
43 const char *typename, DBusError *error);
44
45#define NULLIFY(id) id = empty_to_null(id)
46
47#define CHECK_ERROR(error) if (dbus_error_is_set(error)) return NULL;
48
49#define PURPLE_DBUS_ID_TO_POINTER(ptr, id, type, error) \
50 G_STMT_START { \
51 ptr = (type*) purple_dbus_id_to_pointer_error \
52 (id, PURPLE_DBUS_TYPE(type), #type, error); \
53 CHECK_ERROR(error); \
54 } G_STMT_END
55
56
57#define PURPLE_DBUS_POINTER_TO_ID(id, ptr, error) \
58 G_STMT_START { \
59 id = purple_dbus_pointer_to_id_error(ptr,error); \
60 CHECK_ERROR(error); \
61 } G_STMT_END
62
63#define PURPLE_DBUS_FOREACH_FUNC(f) ((GFunc) (void (*)(void)) (f))
64
65dbus_bool_t
66purple_dbus_message_get_args (DBusMessage *message,
67 DBusError *error,
68 int first_arg_type,
69 ...);
70dbus_bool_t
71purple_dbus_message_get_args_valist (DBusMessage *message,
72 DBusError *error,
73 int first_arg_type,
74 va_list var_args);
75
76dbus_bool_t
77purple_dbus_message_iter_get_args (DBusMessageIter *iter,
78 DBusError *error,
79 int first_arg_type,
80 ...);
81
82dbus_bool_t
83purple_dbus_message_iter_get_args_valist (DBusMessageIter *iter,
84 DBusError *error,
85 int first_arg_type,
86 va_list var_args);
87
88dbus_int32_t* purple_dbusify_GList(GList *list, gboolean free_memory,
89 dbus_int32_t *len);
90dbus_int32_t* purple_dbusify_GSList(GSList *list, gboolean free_memory,
91 dbus_int32_t *len);
92gpointer* purple_GList_to_array(GList *list, gboolean free_memory,
93 dbus_int32_t *len);
94gpointer* purple_GSList_to_array(GSList *list, gboolean free_memory,
95 dbus_int32_t *len);
96GHashTable *purple_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error);
97
98const char* empty_to_null(const char *str);
99const char* null_to_empty(const char *s);
100
101typedef struct {
102 const char *name;
103 const char *parameters;
104 DBusMessage* (*handler)(DBusMessage *request, DBusError *error);
106
107void purple_dbus_register_bindings(void *handle, PurpleDBusBinding *bindings);
108
109DBusConnection *purple_dbus_get_connection(void);
110
111#ifdef __cplusplus
112}
113#endif
114
115#endif
typedefG_BEGIN_DECLS struct _PurpleDBusType PurpleDBusType
Types of pointers are identified by the ADDRESS of a PurpleDbusType object.
Definition dbus-server.h:48