add first draft of the nonce-tcp spec
[dbus4win.git] / dbus / dbus-message.h
blob2e29fef0033fc20c9be5b7e100ed1831f44f7a2f
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-message.h DBusMessage object
4 * Copyright (C) 2002, 2003, 2005 Red Hat Inc.
6 * Licensed under the Academic Free License version 2.1
7 *
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."
25 #endif
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>
35 #include <stdarg.h>
37 DBUS_BEGIN_DECLS
39 /**
40 * @addtogroup DBusMessage
41 * @{
44 typedef struct DBusMessage DBusMessage;
45 /** Opaque type representing a message iterator. Can be copied by value, and contains no allocated memory so never needs to be freed and can be allocated on the stack. */
46 typedef struct DBusMessageIter DBusMessageIter;
48 /**
49 * DBusMessageIter struct; contains no public fields.
51 struct DBusMessageIter
53 void *dummy1; /**< Don't use this */
54 void *dummy2; /**< Don't use this */
55 dbus_uint32_t dummy3; /**< Don't use this */
56 int dummy4; /**< Don't use this */
57 int dummy5; /**< Don't use this */
58 int dummy6; /**< Don't use this */
59 int dummy7; /**< Don't use this */
60 int dummy8; /**< Don't use this */
61 int dummy9; /**< Don't use this */
62 int dummy10; /**< Don't use this */
63 int dummy11; /**< Don't use this */
64 int pad1; /**< Don't use this */
65 int pad2; /**< Don't use this */
66 void *pad3; /**< Don't use this */
69 DBusMessage* dbus_message_new (int message_type);
70 DBusMessage* dbus_message_new_method_call (const char *bus_name,
71 const char *path,
72 const char *interface,
73 const char *method);
74 DBusMessage* dbus_message_new_method_return (DBusMessage *method_call);
75 DBusMessage* dbus_message_new_signal (const char *path,
76 const char *interface,
77 const char *name);
78 DBusMessage* dbus_message_new_error (DBusMessage *reply_to,
79 const char *error_name,
80 const char *error_message);
81 DBusMessage* dbus_message_new_error_printf (DBusMessage *reply_to,
82 const char *error_name,
83 const char *error_format,
84 ...);
86 DBusMessage* dbus_message_copy (const DBusMessage *message);
88 DBusMessage* dbus_message_ref (DBusMessage *message);
89 void dbus_message_unref (DBusMessage *message);
90 int dbus_message_get_type (DBusMessage *message);
91 dbus_bool_t dbus_message_set_path (DBusMessage *message,
92 const char *object_path);
93 const char* dbus_message_get_path (DBusMessage *message);
94 dbus_bool_t dbus_message_has_path (DBusMessage *message,
95 const char *object_path);
96 dbus_bool_t dbus_message_set_interface (DBusMessage *message,
97 const char *interface);
98 const char* dbus_message_get_interface (DBusMessage *message);
99 dbus_bool_t dbus_message_has_interface (DBusMessage *message,
100 const char *interface);
101 dbus_bool_t dbus_message_set_member (DBusMessage *message,
102 const char *member);
103 const char* dbus_message_get_member (DBusMessage *message);
104 dbus_bool_t dbus_message_has_member (DBusMessage *message,
105 const char *member);
106 dbus_bool_t dbus_message_set_error_name (DBusMessage *message,
107 const char *name);
108 const char* dbus_message_get_error_name (DBusMessage *message);
109 dbus_bool_t dbus_message_set_destination (DBusMessage *message,
110 const char *destination);
111 const char* dbus_message_get_destination (DBusMessage *message);
112 dbus_bool_t dbus_message_set_sender (DBusMessage *message,
113 const char *sender);
114 const char* dbus_message_get_sender (DBusMessage *message);
115 const char* dbus_message_get_signature (DBusMessage *message);
116 void dbus_message_set_no_reply (DBusMessage *message,
117 dbus_bool_t no_reply);
118 dbus_bool_t dbus_message_get_no_reply (DBusMessage *message);
119 dbus_bool_t dbus_message_is_method_call (DBusMessage *message,
120 const char *interface,
121 const char *method);
122 dbus_bool_t dbus_message_is_signal (DBusMessage *message,
123 const char *interface,
124 const char *signal_name);
125 dbus_bool_t dbus_message_is_error (DBusMessage *message,
126 const char *error_name);
127 dbus_bool_t dbus_message_has_destination (DBusMessage *message,
128 const char *bus_name);
129 dbus_bool_t dbus_message_has_sender (DBusMessage *message,
130 const char *unique_bus_name);
131 dbus_bool_t dbus_message_has_signature (DBusMessage *message,
132 const char *signature);
133 dbus_uint32_t dbus_message_get_serial (DBusMessage *message);
134 void dbus_message_set_serial (DBusMessage *message,
135 dbus_uint32_t serial);
136 dbus_bool_t dbus_message_set_reply_serial (DBusMessage *message,
137 dbus_uint32_t reply_serial);
138 dbus_uint32_t dbus_message_get_reply_serial (DBusMessage *message);
140 void dbus_message_set_auto_start (DBusMessage *message,
141 dbus_bool_t auto_start);
142 dbus_bool_t dbus_message_get_auto_start (DBusMessage *message);
144 dbus_bool_t dbus_message_get_path_decomposed (DBusMessage *message,
145 char ***path);
147 dbus_bool_t dbus_message_append_args (DBusMessage *message,
148 int first_arg_type,
149 ...);
150 dbus_bool_t dbus_message_append_args_valist (DBusMessage *message,
151 int first_arg_type,
152 va_list var_args);
153 dbus_bool_t dbus_message_get_args (DBusMessage *message,
154 DBusError *error,
155 int first_arg_type,
156 ...);
157 dbus_bool_t dbus_message_get_args_valist (DBusMessage *message,
158 DBusError *error,
159 int first_arg_type,
160 va_list var_args);
163 dbus_bool_t dbus_message_iter_init (DBusMessage *message,
164 DBusMessageIter *iter);
165 dbus_bool_t dbus_message_iter_has_next (DBusMessageIter *iter);
166 dbus_bool_t dbus_message_iter_next (DBusMessageIter *iter);
167 char* dbus_message_iter_get_signature (DBusMessageIter *iter);
168 int dbus_message_iter_get_arg_type (DBusMessageIter *iter);
169 int dbus_message_iter_get_element_type (DBusMessageIter *iter);
170 void dbus_message_iter_recurse (DBusMessageIter *iter,
171 DBusMessageIter *sub);
172 void dbus_message_iter_get_basic (DBusMessageIter *iter,
173 void *value);
174 #ifndef DBUS_DISABLE_DEPRECATED
175 /* This function returns the wire protocol size of the array in bytes,
176 * you do not want to know that probably
178 DBUS_DEPRECATED int dbus_message_iter_get_array_len (DBusMessageIter *iter);
179 #endif
180 void dbus_message_iter_get_fixed_array (DBusMessageIter *iter,
181 void *value,
182 int *n_elements);
185 void dbus_message_iter_init_append (DBusMessage *message,
186 DBusMessageIter *iter);
187 dbus_bool_t dbus_message_iter_append_basic (DBusMessageIter *iter,
188 int type,
189 const void *value);
190 dbus_bool_t dbus_message_iter_append_fixed_array (DBusMessageIter *iter,
191 int element_type,
192 const void *value,
193 int n_elements);
194 dbus_bool_t dbus_message_iter_open_container (DBusMessageIter *iter,
195 int type,
196 const char *contained_signature,
197 DBusMessageIter *sub);
198 dbus_bool_t dbus_message_iter_close_container (DBusMessageIter *iter,
199 DBusMessageIter *sub);
201 void dbus_message_lock (DBusMessage *message);
203 dbus_bool_t dbus_set_error_from_message (DBusError *error,
204 DBusMessage *message);
207 dbus_bool_t dbus_message_allocate_data_slot (dbus_int32_t *slot_p);
208 void dbus_message_free_data_slot (dbus_int32_t *slot_p);
209 dbus_bool_t dbus_message_set_data (DBusMessage *message,
210 dbus_int32_t slot,
211 void *data,
212 DBusFreeFunction free_data_func);
213 void* dbus_message_get_data (DBusMessage *message,
214 dbus_int32_t slot);
216 int dbus_message_type_from_string (const char *type_str);
217 const char* dbus_message_type_to_string (int type);
219 dbus_bool_t dbus_message_marshal (DBusMessage *msg,
220 char **marshalled_data_p,
221 int *len_p);
222 DBusMessage* dbus_message_demarshal (const char *str,
223 int len,
224 DBusError *error);
226 int dbus_message_demarshal_bytes_needed (const char *str,
227 int len);
229 /** @} */
231 DBUS_END_DECLS
233 #endif /* DBUS_MESSAGE_H */