pidgin: dbus-bindings.h Source File

pidgin 2.14.4

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
64dbus_bool_t
65purple_dbus_message_get_args (DBusMessage *message,
66 DBusError *error,
67 int first_arg_type,
68 ...);
69dbus_bool_t
70purple_dbus_message_get_args_valist (DBusMessage *message,
71 DBusError *error,
72 int first_arg_type,
73 va_list var_args);
74
75dbus_bool_t
76purple_dbus_message_iter_get_args (DBusMessageIter *iter,
77 DBusError *error,
78 int first_arg_type,
79 ...);
80
81dbus_bool_t
82purple_dbus_message_iter_get_args_valist (DBusMessageIter *iter,
83 DBusError *error,
84 int first_arg_type,
85 va_list var_args);
86
87dbus_int32_t* purple_dbusify_GList(GList *list, gboolean free_memory,
88 dbus_int32_t *len);
89dbus_int32_t* purple_dbusify_GSList(GSList *list, gboolean free_memory,
90 dbus_int32_t *len);
91gpointer* purple_GList_to_array(GList *list, gboolean free_memory,
92 dbus_int32_t *len);
93gpointer* purple_GSList_to_array(GSList *list, gboolean free_memory,
94 dbus_int32_t *len);
95GHashTable *purple_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error);
96
97const char* empty_to_null(const char *str);
98const char* null_to_empty(const char *s);
99
100 typedef struct {
101 const char *name;
102 const char *parameters;
103 DBusMessage* (*handler)(DBusMessage *request, DBusError *error);
104} PurpleDBusBinding;
105
106void purple_dbus_register_bindings(void *handle, PurpleDBusBinding *bindings);
107
108DBusConnection *purple_dbus_get_connection(void);
109
110#ifdef __cplusplus
111}
112#endif
113
114#endif
PurpleDBusType
typedefG_BEGIN_DECLS struct _PurpleDBusType PurpleDBusType
Types of pointers are identified by the ADDRESS of a PurpleDbusType object.
Definition: dbus-server.h:48
PurpleDBusBinding
Definition: dbus-bindings.h:100