1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-message.h DBusMessage object
4 * Copyright (C) 2002 Red Hat Inc.
6 * Licensed under the Academic Free License version 1.2
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);
76 DBusMessage *dbus_message_copy (const DBusMessage *message);
78 void dbus_message_ref (DBusMessage *message);
79 void dbus_message_unref (DBusMessage *message);
80 int dbus_message_get_type (DBusMessage *message);
81 dbus_bool_t dbus_message_set_path (DBusMessage *message,
82 const char *object_path);
83 const char* dbus_message_get_path (DBusMessage *message);
84 dbus_bool_t dbus_message_set_interface (DBusMessage *message,
85 const char *interface);
86 const char* dbus_message_get_interface (DBusMessage *message);
87 dbus_bool_t dbus_message_set_member (DBusMessage *message,
89 const char* dbus_message_get_member (DBusMessage *message);
90 dbus_bool_t dbus_message_set_error_name (DBusMessage *message,
92 const char* dbus_message_get_error_name (DBusMessage *message);
93 dbus_bool_t dbus_message_set_destination (DBusMessage *message,
94 const char *destination);
95 const char* dbus_message_get_destination (DBusMessage *message);
96 dbus_bool_t dbus_message_set_sender (DBusMessage *message,
98 const char* dbus_message_get_sender (DBusMessage *message);
99 void dbus_message_set_no_reply (DBusMessage *message,
100 dbus_bool_t no_reply);
101 dbus_bool_t dbus_message_get_no_reply (DBusMessage *message);
102 dbus_bool_t dbus_message_is_method_call (DBusMessage *message,
103 const char *interface,
105 dbus_bool_t dbus_message_is_signal (DBusMessage *message,
106 const char *interface,
107 const char *signal_name);
108 dbus_bool_t dbus_message_is_error (DBusMessage *message,
109 const char *error_name);
110 dbus_bool_t dbus_message_has_destination (DBusMessage *message,
111 const char *service);
112 dbus_bool_t dbus_message_has_sender (DBusMessage *message,
113 const char *service);
114 dbus_uint32_t dbus_message_get_serial (DBusMessage *message);
115 dbus_bool_t dbus_message_set_reply_serial (DBusMessage *message,
116 dbus_uint32_t reply_serial);
117 dbus_uint32_t dbus_message_get_reply_serial (DBusMessage *message);
119 dbus_bool_t dbus_message_get_path_decomposed (DBusMessage *message,
122 dbus_bool_t dbus_message_append_args (DBusMessage *message,
125 dbus_bool_t dbus_message_append_args_valist (DBusMessage *message,
128 dbus_bool_t dbus_message_get_args (DBusMessage *message,
132 dbus_bool_t dbus_message_get_args_valist (DBusMessage *message,
136 dbus_bool_t dbus_message_iter_get_args (DBusMessageIter *iter,
140 dbus_bool_t dbus_message_iter_get_args_valist (DBusMessageIter *iter,
147 void dbus_message_iter_init (DBusMessage *message,
148 DBusMessageIter *iter);
149 dbus_bool_t dbus_message_iter_has_next (DBusMessageIter *iter);
150 dbus_bool_t dbus_message_iter_next (DBusMessageIter *iter);
151 int dbus_message_iter_get_arg_type (DBusMessageIter *iter);
152 int dbus_message_iter_get_array_type (DBusMessageIter *iter);
153 unsigned char dbus_message_iter_get_byte (DBusMessageIter *iter);
154 dbus_bool_t dbus_message_iter_get_boolean (DBusMessageIter *iter);
155 dbus_int32_t dbus_message_iter_get_int32 (DBusMessageIter *iter);
156 dbus_uint32_t dbus_message_iter_get_uint32 (DBusMessageIter *iter);
157 #ifdef DBUS_HAVE_INT64
158 dbus_int64_t dbus_message_iter_get_int64 (DBusMessageIter *iter);
159 dbus_uint64_t dbus_message_iter_get_uint64 (DBusMessageIter *iter);
160 #endif /* DBUS_HAVE_INT64 */
161 double dbus_message_iter_get_double (DBusMessageIter *iter);
162 char * dbus_message_iter_get_string (DBusMessageIter *iter);
163 char * dbus_message_iter_get_dict_key (DBusMessageIter *iter);
164 dbus_bool_t dbus_message_iter_get_named (DBusMessageIter *iter,
166 unsigned char **value,
169 dbus_bool_t dbus_message_iter_init_array_iterator (DBusMessageIter *iter,
170 DBusMessageIter *array_iter,
172 dbus_bool_t dbus_message_iter_init_dict_iterator (DBusMessageIter *iter,
173 DBusMessageIter *dict_iter);
174 dbus_bool_t dbus_message_iter_get_byte_array (DBusMessageIter *iter,
175 unsigned char **value,
177 dbus_bool_t dbus_message_iter_get_boolean_array (DBusMessageIter *iter,
178 unsigned char **value,
180 dbus_bool_t dbus_message_iter_get_int32_array (DBusMessageIter *iter,
181 dbus_int32_t **value,
183 dbus_bool_t dbus_message_iter_get_uint32_array (DBusMessageIter *iter,
184 dbus_uint32_t **value,
186 #ifdef DBUS_HAVE_INT64
187 dbus_bool_t dbus_message_iter_get_int64_array (DBusMessageIter *iter,
188 dbus_int64_t **value,
190 dbus_bool_t dbus_message_iter_get_uint64_array (DBusMessageIter *iter,
191 dbus_uint64_t **value,
193 #endif /* DBUS_HAVE_INT64 */
194 dbus_bool_t dbus_message_iter_get_double_array (DBusMessageIter *iter,
197 dbus_bool_t dbus_message_iter_get_string_array (DBusMessageIter *iter,
202 void dbus_message_append_iter_init (DBusMessage *message,
203 DBusMessageIter *iter);
204 dbus_bool_t dbus_message_iter_append_nil (DBusMessageIter *iter);
205 dbus_bool_t dbus_message_iter_append_boolean (DBusMessageIter *iter,
207 dbus_bool_t dbus_message_iter_append_byte (DBusMessageIter *iter,
208 unsigned char value);
209 dbus_bool_t dbus_message_iter_append_int32 (DBusMessageIter *iter,
211 dbus_bool_t dbus_message_iter_append_uint32 (DBusMessageIter *iter,
212 dbus_uint32_t value);
213 #ifdef DBUS_HAVE_INT64
214 dbus_bool_t dbus_message_iter_append_int64 (DBusMessageIter *iter,
216 dbus_bool_t dbus_message_iter_append_uint64 (DBusMessageIter *iter,
217 dbus_uint64_t value);
218 #endif /* DBUS_HAVE_INT64 */
219 dbus_bool_t dbus_message_iter_append_double (DBusMessageIter *iter,
221 dbus_bool_t dbus_message_iter_append_string (DBusMessageIter *iter,
223 dbus_bool_t dbus_message_iter_append_named (DBusMessageIter *iter,
225 const unsigned char *data,
227 dbus_bool_t dbus_message_iter_append_dict_key (DBusMessageIter *iter,
229 dbus_bool_t dbus_message_iter_append_array (DBusMessageIter *iter,
230 DBusMessageIter *array_iter,
232 dbus_bool_t dbus_message_iter_append_dict (DBusMessageIter *iter,
233 DBusMessageIter *dict_iter);
235 /* Helpers for normal types: */
236 dbus_bool_t dbus_message_iter_append_boolean_array (DBusMessageIter *iter,
237 unsigned const char *value,
239 dbus_bool_t dbus_message_iter_append_int32_array (DBusMessageIter *iter,
240 const dbus_int32_t *value,
242 dbus_bool_t dbus_message_iter_append_uint32_array (DBusMessageIter *iter,
243 const dbus_uint32_t *value,
245 #ifdef DBUS_HAVE_INT64
246 dbus_bool_t dbus_message_iter_append_int64_array (DBusMessageIter *iter,
247 const dbus_int64_t *value,
249 dbus_bool_t dbus_message_iter_append_uint64_array (DBusMessageIter *iter,
250 const dbus_uint64_t *value,
252 #endif /* DBUS_HAVE_INT64 */
253 dbus_bool_t dbus_message_iter_append_double_array (DBusMessageIter *iter,
256 dbus_bool_t dbus_message_iter_append_byte_array (DBusMessageIter *iter,
257 unsigned const char *value,
259 dbus_bool_t dbus_message_iter_append_string_array (DBusMessageIter *iter,
265 dbus_bool_t dbus_set_error_from_message (DBusError *error,
266 DBusMessage *message);
269 dbus_bool_t dbus_message_allocate_data_slot (dbus_int32_t *slot_p);
270 void dbus_message_free_data_slot (dbus_int32_t *slot_p);
271 dbus_bool_t dbus_message_set_data (DBusMessage *message,
274 DBusFreeFunction free_data_func);
275 void* dbus_message_get_data (DBusMessage *message,
278 int dbus_message_type_from_string (const char *type_str);
282 #endif /* DBUS_MESSAGE_H */