1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-message.h DBusMessage object
4 * Copyright (C) 2002, 2003 Red Hat Inc.
6 * Licensed under the Academic Free License version 2.1
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
24 #error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
27 #ifndef DBUS_MESSAGE_H
28 #define DBUS_MESSAGE_H
30 #include <dbus/dbus-macros.h>
31 #include <dbus/dbus-types.h>
32 #include <dbus/dbus-arch-deps.h>
33 #include <dbus/dbus-memory.h>
34 #include <dbus/dbus-errors.h>
39 typedef struct DBusMessage DBusMessage
;
40 typedef struct DBusMessageIter DBusMessageIter
;
43 * DBusMessageIter struct; contains no public fields
45 struct DBusMessageIter
47 void *dummy1
; /**< Don't use this */
48 void *dummy2
; /**< Don't use this */
49 dbus_uint32_t dummy3
; /**< Don't use this */
50 int dummy4
; /**< Don't use this */
51 int dummy5
; /**< Don't use this */
52 int dummy6
; /**< Don't use this */
53 int dummy7
; /**< Don't use this */
54 int dummy8
; /**< Don't use this */
55 int dummy9
; /**< Don't use this */
56 int dummy10
; /**< Don't use this */
57 int dummy11
; /**< Don't use this */
58 int pad1
; /**< Don't use this */
59 int pad2
; /**< Don't use this */
60 void *pad3
; /**< Don't use this */
63 DBusMessage
* dbus_message_new (int message_type
);
64 DBusMessage
* dbus_message_new_method_call (const char *service
,
66 const char *interface
,
68 DBusMessage
* dbus_message_new_method_return (DBusMessage
*method_call
);
69 DBusMessage
* dbus_message_new_signal (const char *path
,
70 const char *interface
,
72 DBusMessage
* dbus_message_new_error (DBusMessage
*reply_to
,
73 const char *error_name
,
74 const char *error_message
);
75 DBusMessage
* dbus_message_new_error_printf (DBusMessage
*reply_to
,
76 const char *error_name
,
77 const char *error_format
,
80 DBusMessage
* dbus_message_copy (const DBusMessage
*message
);
82 DBusMessage
* dbus_message_ref (DBusMessage
*message
);
83 void dbus_message_unref (DBusMessage
*message
);
84 int dbus_message_get_type (DBusMessage
*message
);
85 dbus_bool_t
dbus_message_set_path (DBusMessage
*message
,
86 const char *object_path
);
87 const char* dbus_message_get_path (DBusMessage
*message
);
88 dbus_bool_t
dbus_message_set_interface (DBusMessage
*message
,
89 const char *interface
);
90 const char* dbus_message_get_interface (DBusMessage
*message
);
91 dbus_bool_t
dbus_message_set_member (DBusMessage
*message
,
93 const char* dbus_message_get_member (DBusMessage
*message
);
94 dbus_bool_t
dbus_message_set_error_name (DBusMessage
*message
,
96 const char* dbus_message_get_error_name (DBusMessage
*message
);
97 dbus_bool_t
dbus_message_set_destination (DBusMessage
*message
,
98 const char *destination
);
99 const char* dbus_message_get_destination (DBusMessage
*message
);
100 dbus_bool_t
dbus_message_set_sender (DBusMessage
*message
,
102 const char* dbus_message_get_sender (DBusMessage
*message
);
103 const char* dbus_message_get_signature (DBusMessage
*message
);
104 void dbus_message_set_no_reply (DBusMessage
*message
,
105 dbus_bool_t no_reply
);
106 dbus_bool_t
dbus_message_get_no_reply (DBusMessage
*message
);
107 dbus_bool_t
dbus_message_is_method_call (DBusMessage
*message
,
108 const char *interface
,
110 dbus_bool_t
dbus_message_is_signal (DBusMessage
*message
,
111 const char *interface
,
112 const char *signal_name
);
113 dbus_bool_t
dbus_message_is_error (DBusMessage
*message
,
114 const char *error_name
);
115 dbus_bool_t
dbus_message_has_destination (DBusMessage
*message
,
116 const char *service
);
117 dbus_bool_t
dbus_message_has_sender (DBusMessage
*message
,
118 const char *service
);
119 dbus_bool_t
dbus_message_has_signature (DBusMessage
*message
,
120 const char *signature
);
121 dbus_uint32_t
dbus_message_get_serial (DBusMessage
*message
);
122 dbus_bool_t
dbus_message_set_reply_serial (DBusMessage
*message
,
123 dbus_uint32_t reply_serial
);
124 dbus_uint32_t
dbus_message_get_reply_serial (DBusMessage
*message
);
126 void dbus_message_set_auto_activation (DBusMessage
*message
,
127 dbus_bool_t auto_activation
);
128 dbus_bool_t
dbus_message_get_auto_activation (DBusMessage
*message
);
130 dbus_bool_t
dbus_message_get_path_decomposed (DBusMessage
*message
,
133 dbus_bool_t
dbus_message_append_args (DBusMessage
*message
,
136 dbus_bool_t
dbus_message_append_args_valist (DBusMessage
*message
,
139 dbus_bool_t
dbus_message_get_args (DBusMessage
*message
,
143 dbus_bool_t
dbus_message_get_args_valist (DBusMessage
*message
,
147 dbus_bool_t
dbus_message_iter_get_args (DBusMessageIter
*iter
,
151 dbus_bool_t
dbus_message_iter_get_args_valist (DBusMessageIter
*iter
,
157 dbus_bool_t
dbus_message_iter_init (DBusMessage
*message
,
158 DBusMessageIter
*iter
);
159 dbus_bool_t
dbus_message_iter_has_next (DBusMessageIter
*iter
);
160 dbus_bool_t
dbus_message_iter_next (DBusMessageIter
*iter
);
161 int dbus_message_iter_get_arg_type (DBusMessageIter
*iter
);
162 int dbus_message_iter_get_array_type (DBusMessageIter
*iter
);
163 unsigned char dbus_message_iter_get_byte (DBusMessageIter
*iter
);
164 dbus_bool_t
dbus_message_iter_get_boolean (DBusMessageIter
*iter
);
165 dbus_int32_t
dbus_message_iter_get_int32 (DBusMessageIter
*iter
);
166 dbus_uint32_t
dbus_message_iter_get_uint32 (DBusMessageIter
*iter
);
167 #ifdef DBUS_HAVE_INT64
168 dbus_int64_t
dbus_message_iter_get_int64 (DBusMessageIter
*iter
);
169 dbus_uint64_t
dbus_message_iter_get_uint64 (DBusMessageIter
*iter
);
170 #endif /* DBUS_HAVE_INT64 */
171 double dbus_message_iter_get_double (DBusMessageIter
*iter
);
172 char * dbus_message_iter_get_string (DBusMessageIter
*iter
);
173 char * dbus_message_iter_get_object_path (DBusMessageIter
*iter
);
174 char * dbus_message_iter_get_dict_key (DBusMessageIter
*iter
);
175 dbus_bool_t
dbus_message_iter_get_custom (DBusMessageIter
*iter
,
177 unsigned char **value
,
180 dbus_bool_t
dbus_message_iter_init_array_iterator (DBusMessageIter
*iter
,
181 DBusMessageIter
*array_iter
,
183 dbus_bool_t
dbus_message_iter_init_dict_iterator (DBusMessageIter
*iter
,
184 DBusMessageIter
*dict_iter
);
185 dbus_bool_t
dbus_message_iter_get_byte_array (DBusMessageIter
*iter
,
186 unsigned char **value
,
188 dbus_bool_t
dbus_message_iter_get_boolean_array (DBusMessageIter
*iter
,
189 unsigned char **value
,
191 dbus_bool_t
dbus_message_iter_get_int32_array (DBusMessageIter
*iter
,
192 dbus_int32_t
**value
,
194 dbus_bool_t
dbus_message_iter_get_uint32_array (DBusMessageIter
*iter
,
195 dbus_uint32_t
**value
,
197 #ifdef DBUS_HAVE_INT64
198 dbus_bool_t
dbus_message_iter_get_int64_array (DBusMessageIter
*iter
,
199 dbus_int64_t
**value
,
201 dbus_bool_t
dbus_message_iter_get_uint64_array (DBusMessageIter
*iter
,
202 dbus_uint64_t
**value
,
204 #endif /* DBUS_HAVE_INT64 */
205 dbus_bool_t
dbus_message_iter_get_double_array (DBusMessageIter
*iter
,
208 dbus_bool_t
dbus_message_iter_get_string_array (DBusMessageIter
*iter
,
211 dbus_bool_t
dbus_message_iter_get_object_path_array (DBusMessageIter
*iter
,
216 void dbus_message_append_iter_init (DBusMessage
*message
,
217 DBusMessageIter
*iter
);
218 dbus_bool_t
dbus_message_iter_append_nil (DBusMessageIter
*iter
);
219 dbus_bool_t
dbus_message_iter_append_boolean (DBusMessageIter
*iter
,
221 dbus_bool_t
dbus_message_iter_append_byte (DBusMessageIter
*iter
,
222 unsigned char value
);
223 dbus_bool_t
dbus_message_iter_append_int32 (DBusMessageIter
*iter
,
225 dbus_bool_t
dbus_message_iter_append_uint32 (DBusMessageIter
*iter
,
226 dbus_uint32_t value
);
227 #ifdef DBUS_HAVE_INT64
228 dbus_bool_t
dbus_message_iter_append_int64 (DBusMessageIter
*iter
,
230 dbus_bool_t
dbus_message_iter_append_uint64 (DBusMessageIter
*iter
,
231 dbus_uint64_t value
);
232 #endif /* DBUS_HAVE_INT64 */
233 dbus_bool_t
dbus_message_iter_append_double (DBusMessageIter
*iter
,
235 dbus_bool_t
dbus_message_iter_append_string (DBusMessageIter
*iter
,
237 dbus_bool_t
dbus_message_iter_append_object_path (DBusMessageIter
*iter
,
239 dbus_bool_t
dbus_message_iter_append_custom (DBusMessageIter
*iter
,
241 const unsigned char *data
,
243 dbus_bool_t
dbus_message_iter_append_dict_key (DBusMessageIter
*iter
,
245 dbus_bool_t
dbus_message_iter_append_array (DBusMessageIter
*iter
,
246 DBusMessageIter
*array_iter
,
248 dbus_bool_t
dbus_message_iter_append_dict (DBusMessageIter
*iter
,
249 DBusMessageIter
*dict_iter
);
251 /* Helpers for normal types: */
252 dbus_bool_t
dbus_message_iter_append_boolean_array (DBusMessageIter
*iter
,
253 unsigned const char *value
,
255 dbus_bool_t
dbus_message_iter_append_int32_array (DBusMessageIter
*iter
,
256 const dbus_int32_t
*value
,
258 dbus_bool_t
dbus_message_iter_append_uint32_array (DBusMessageIter
*iter
,
259 const dbus_uint32_t
*value
,
261 #ifdef DBUS_HAVE_INT64
262 dbus_bool_t
dbus_message_iter_append_int64_array (DBusMessageIter
*iter
,
263 const dbus_int64_t
*value
,
265 dbus_bool_t
dbus_message_iter_append_uint64_array (DBusMessageIter
*iter
,
266 const dbus_uint64_t
*value
,
268 #endif /* DBUS_HAVE_INT64 */
269 dbus_bool_t
dbus_message_iter_append_double_array (DBusMessageIter
*iter
,
272 dbus_bool_t
dbus_message_iter_append_byte_array (DBusMessageIter
*iter
,
273 unsigned const char *value
,
275 dbus_bool_t
dbus_message_iter_append_string_array (DBusMessageIter
*iter
,
278 dbus_bool_t
dbus_message_iter_append_object_path_array (DBusMessageIter
*iter
,
284 dbus_bool_t
dbus_set_error_from_message (DBusError
*error
,
285 DBusMessage
*message
);
288 dbus_bool_t
dbus_message_allocate_data_slot (dbus_int32_t
*slot_p
);
289 void dbus_message_free_data_slot (dbus_int32_t
*slot_p
);
290 dbus_bool_t
dbus_message_set_data (DBusMessage
*message
,
293 DBusFreeFunction free_data_func
);
294 void* dbus_message_get_data (DBusMessage
*message
,
297 int dbus_message_type_from_string (const char *type_str
);
301 #endif /* DBUS_MESSAGE_H */