comparison dbus-d/dsrc/org/freedesktop/dbus/c/Protocol.d @ 0:a5576806d36d

recreate repository without any libs for lightweight repository
author Frank Benoit <benoit@tionex.de>
date Sat, 20 Oct 2007 18:07:18 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a5576806d36d
1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-protocol.h D-Bus protocol constants
3 *
4 * Copyright (C) 2002, 2003 CodeFactory AB
5 * Copyright (C) 2004, 2005 Red Hat, Inc.
6 *
7 * Licensed under the Academic Free License version 2.1
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25 module org.freedesktop.dbus.c.Protocol;
26
27 extern(C):
28
29 /* Normally docs are in .c files, but there isn't a .c file for this. */
30 /**
31 * @defgroup DBusProtocol Protocol constants
32 * @ingroup DBus
33 *
34 * @brief Defines constants which are part of the D-Bus protocol
35 *
36 * This header is intended for use by any library, not only libdbus.
37 *
38 * @{
39 */
40
41
42 /* Message byte order */
43 const dchar DBUS_LITTLE_ENDIAN ='l'; /**< Code marking LSB-first byte order in the wire protocol. */
44 const dchar DBUS_BIG_ENDIAN ='B'; /**< Code marking MSB-first byte order in the wire protocol. */
45
46 /** Protocol version. */
47 const int DBUS_MAJOR_PROTOCOL_VERSION =1;
48
49 /** Type code that is never equal to a legitimate type code */
50 const int DBUS_TYPE_INVALID = '\0';
51 /** #DBUS_TYPE_INVALID as a string literal instead of a int literal */
52 const char[] DBUS_TYPE_INVALID_AS_STRING = "\0";
53
54 /* Primitive types */
55 /** Type code marking an 8-bit unsigned integer */
56 const int DBUS_TYPE_BYTE = 'y';
57 /** #DBUS_TYPE_BYTE as a string literal instead of a int literal */
58 const char[] DBUS_TYPE_BYTE_AS_STRING ="y";
59 /** Type code marking a boolean */
60 const int DBUS_TYPE_BOOLEAN = 'b';
61 /** #DBUS_TYPE_BOOLEAN as a string literal instead of a int literal */
62 const char[] DBUS_TYPE_BOOLEAN_AS_STRING ="b";
63 /** Type code marking a 16-bit signed integer */
64 const int DBUS_TYPE_INT16 = 'n';
65 /** #DBUS_TYPE_INT16 as a string literal instead of a int literal */
66 const char[] DBUS_TYPE_INT16_AS_STRING ="n";
67 /** Type code marking a 16-bit unsigned integer */
68 const int DBUS_TYPE_UINT16 = 'q';
69 /** #DBUS_TYPE_UINT16 as a string literal instead of a int literal */
70 const char[] DBUS_TYPE_UINT16_AS_STRING ="q";
71 /** Type code marking a 32-bit signed integer */
72 const int DBUS_TYPE_INT32 = 'i';
73 /** #DBUS_TYPE_INT32 as a string literal instead of a int literal */
74 const char[] DBUS_TYPE_INT32_AS_STRING ="i";
75 /** Type code marking a 32-bit unsigned integer */
76 const int DBUS_TYPE_UINT32 = 'u';
77 /** #DBUS_TYPE_UINT32 as a string literal instead of a int literal */
78 const char[] DBUS_TYPE_UINT32_AS_STRING ="u";
79 /** Type code marking a 64-bit signed integer */
80 const int DBUS_TYPE_INT64 = 'x';
81 /** #DBUS_TYPE_INT64 as a string literal instead of a int literal */
82 const char[] DBUS_TYPE_INT64_AS_STRING ="x";
83 /** Type code marking a 64-bit unsigned integer */
84 const int DBUS_TYPE_UINT64 = 't';
85 /** #DBUS_TYPE_UINT64 as a string literal instead of a int literal */
86 const char[] DBUS_TYPE_UINT64_AS_STRING ="t";
87 /** Type code marking an 8-byte double in IEEE 754 format */
88 const int DBUS_TYPE_DOUBLE = 'd';
89 /** #DBUS_TYPE_DOUBLE as a string literal instead of a int literal */
90 const char[] DBUS_TYPE_DOUBLE_AS_STRING ="d";
91 /** Type code marking a UTF-8 encoded, nul-terminated Unicode string */
92 const int DBUS_TYPE_STRING = 's';
93 /** #DBUS_TYPE_STRING as a string literal instead of a int literal */
94 const char[] DBUS_TYPE_STRING_AS_STRING ="s";
95 /** Type code marking a D-Bus object path */
96 const int DBUS_TYPE_OBJECT_PATH = 'o';
97 /** #DBUS_TYPE_OBJECT_PATH as a string literal instead of a int literal */
98 const char[] DBUS_TYPE_OBJECT_PATH_AS_STRING ="o";
99 /** Type code marking a D-Bus type signature */
100 const int DBUS_TYPE_SIGNATURE = 'g';
101 /** #DBUS_TYPE_SIGNATURE as a string literal instead of a int literal */
102 const char[] DBUS_TYPE_SIGNATURE_AS_STRING ="g";
103
104 /* Compound types */
105 /** Type code marking a D-Bus array type */
106 const int DBUS_TYPE_ARRAY = 'a';
107 /** #DBUS_TYPE_ARRAY as a string literal instead of a int literal */
108 const char[] DBUS_TYPE_ARRAY_AS_STRING ="a";
109 /** Type code marking a D-Bus variant type */
110 const int DBUS_TYPE_VARIANT = 'v';
111 /** #DBUS_TYPE_VARIANT as a string literal instead of a int literal */
112 const char[] DBUS_TYPE_VARIANT_AS_STRING ="v";
113
114 /** STRUCT and DICT_ENTRY are sort of special since their codes can't
115 * appear in a type string, instead
116 * DBUS_STRUCT_BEGIN_CHAR/DBUS_DICT_ENTRY_BEGIN_CHAR have to appear
117 */
118 /** Type code used to represent a struct; however, this type code does not appear
119 * in type signatures, instead #DBUS_STRUCT_BEGIN_CHAR and #DBUS_STRUCT_END_CHAR will
120 * appear in a signature.
121 */
122 const int DBUS_TYPE_STRUCT = 'r';
123 /** #DBUS_TYPE_STRUCT as a string literal instead of a int literal */
124 const char[] DBUS_TYPE_STRUCT_AS_STRING ="r";
125 /** Type code used to represent a dict entry; however, this type code does not appear
126 * in type signatures, instead #DBUS_DICT_ENTRY_BEGIN_CHAR and #DBUS_DICT_ENTRY_END_CHAR will
127 * appear in a signature.
128 */
129 const int DBUS_TYPE_DICT_ENTRY = 'e';
130 /** #DBUS_TYPE_DICT_ENTRY as a string literal instead of a int literal */
131 const char[] DBUS_TYPE_DICT_ENTRY_AS_STRING = "e";
132
133 /** Does not include #DBUS_TYPE_INVALID, #DBUS_STRUCT_BEGIN_CHAR, #DBUS_STRUCT_END_CHAR,
134 * #DBUS_DICT_ENTRY_BEGIN_CHAR, or #DBUS_DICT_ENTRY_END_CHAR - i.e. it is the number of
135 * valid types, not the number of distinct characters that may appear in a type signature.
136 */
137 const int DBUS_NUMBER_OF_TYPES = (16);
138
139 /* characters other than typecodes that appear in type signatures */
140
141 /** Code marking the start of a struct type in a type signature */
142 const int DBUS_STRUCT_BEGIN_CHAR = '(';
143 /** #DBUS_STRUCT_BEGIN_CHAR as a string literal instead of a int literal */
144 const char[] DBUS_STRUCT_BEGIN_CHAR_AS_STRING = "(";
145 /** Code marking the end of a struct type in a type signature */
146 const int DBUS_STRUCT_END_CHAR = ')';
147 /** #DBUS_STRUCT_END_CHAR a string literal instead of a int literal */
148 const char[] DBUS_STRUCT_END_CHAR_AS_STRING = ")";
149 /** Code marking the start of a dict entry type in a type signature */
150 const int DBUS_DICT_ENTRY_BEGIN_CHAR = '{';
151 /** #DBUS_DICT_ENTRY_BEGIN_CHAR as a string literal instead of a int literal */
152 const char[] DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING = "{";
153 /** Code marking the end of a dict entry type in a type signature */
154 const int DBUS_DICT_ENTRY_END_CHAR = '}';
155 /** #DBUS_DICT_ENTRY_END_CHAR as a string literal instead of a int literal */
156 const char[] DBUS_DICT_ENTRY_END_CHAR_AS_STRING = "}";
157
158 /** Max length in bytes of a bus name, interface, or member (not object
159 * path, paths are unlimited). This is limited because lots of stuff
160 * is O(n) in this number, plus it would be obnoxious to type in a
161 * paragraph-long method name so most likely something like that would
162 * be an exploit.
163 */
164 const int DBUS_MAXIMUM_NAME_LENGTH =255;
165
166 /** This one is 255 so it fits in a byte */
167 const int DBUS_MAXIMUM_SIGNATURE_LENGTH =255;
168
169 /** Max length of a match rule string; to keep people from hosing the
170 * daemon with some huge rule
171 */
172 const int DBUS_MAXIMUM_MATCH_RULE_LENGTH =1024;
173
174 /** Max arg number you can match on in a match rule, e.g.
175 * arg0='hello' is OK, arg3489720987='hello' is not
176 */
177 const int DBUS_MAXIMUM_MATCH_RULE_ARG_NUMBER =63;
178
179 /** Max length of a marshaled array in bytes (64M, 2^26) We use signed
180 * int for lengths so must be INT_MAX or less. We need something a
181 * bit smaller than INT_MAX because the array is inside a message with
182 * header info, etc. so an INT_MAX array wouldn't allow the message
183 * overhead. The 64M number is an attempt at a larger number than
184 * we'd reasonably ever use, but small enough that your bus would chew
185 * through it fairly quickly without locking up forever. If you have
186 * data that's likely to be larger than this, you should probably be
187 * sending it in multiple incremental messages anyhow.
188 */
189 const int DBUS_MAXIMUM_ARRAY_LENGTH =(67108864);
190 /** Number of bits you need in an unsigned to store the max array size */
191 const int DBUS_MAXIMUM_ARRAY_LENGTH_BITS =26;
192
193 /** The maximum total message size including header and body; similar
194 * rationale to max array size.
195 */
196 const int DBUS_MAXIMUM_MESSAGE_LENGTH =(DBUS_MAXIMUM_ARRAY_LENGTH * 2);
197 /** Number of bits you need in an unsigned to store the max message size */
198 const int DBUS_MAXIMUM_MESSAGE_LENGTH_BITS =27;
199
200 /** Depth of recursion in the type tree. This is automatically limited
201 * to DBUS_MAXIMUM_SIGNATURE_LENGTH since you could only have an array
202 * of array of array of ... that fit in the max signature. But that's
203 * probably a bit too large.
204 */
205 const int DBUS_MAXIMUM_TYPE_RECURSION_DEPTH =32;
206
207 /* Types of message */
208
209 /** This value is never a valid message type, see dbus_message_get_type() */
210 const int DBUS_MESSAGE_TYPE_INVALID =0;
211 /** Message type of a method call message, see dbus_message_get_type() */
212 const int DBUS_MESSAGE_TYPE_METHOD_CALL =1;
213 /** Message type of a method return message, see dbus_message_get_type() */
214 const int DBUS_MESSAGE_TYPE_METHOD_RETURN =2;
215 /** Message type of an error reply message, see dbus_message_get_type() */
216 const int DBUS_MESSAGE_TYPE_ERROR =3;
217 /** Message type of a signal message, see dbus_message_get_type() */
218 const int DBUS_MESSAGE_TYPE_SIGNAL =4;
219
220 /* Header flags */
221
222 /** If set, this flag means that the sender of a message does not care about getting
223 * a reply, so the recipient need not send one. See dbus_message_set_no_reply().
224 */
225 const int DBUS_HEADER_FLAG_NO_REPLY_EXPECTED =0x1;
226 /**
227 * If set, this flag means that even if the message bus knows how to start an owner for
228 * the destination bus name (see dbus_message_set_destination()), it should not
229 * do so. If this flag is not set, the bus may launch a program to process the
230 * message.
231 */
232 const int DBUS_HEADER_FLAG_NO_AUTO_START =0x2;
233
234 /* Header fields */
235
236 /** Not equal to any valid header field code */
237 const int DBUS_HEADER_FIELD_INVALID =0;
238 /** Header field code for the path - the path is the object emitting a signal or the object receiving a method call.
239 * See dbus_message_set_path().
240 */
241 const int DBUS_HEADER_FIELD_PATH =1;
242 /** Header field code for the interface containing a member (method or signal).
243 * See dbus_message_set_interface().
244 */
245 const int DBUS_HEADER_FIELD_INTERFACE =2;
246 /** Header field code for a member (method or signal). See dbus_message_set_member(). */
247 const int DBUS_HEADER_FIELD_MEMBER =3;
248 /** Header field code for an error name (found in #DBUS_MESSAGE_TYPE_ERROR messages).
249 * See dbus_message_set_error_name().
250 */
251 const int DBUS_HEADER_FIELD_ERROR_NAME =4;
252 /** Header field code for a reply serial, used to match a #DBUS_MESSAGE_TYPE_METHOD_RETURN message with the
253 * message that it's a reply to. See dbus_message_set_reply_serial().
254 */
255 const int DBUS_HEADER_FIELD_REPLY_SERIAL =5;
256 /**
257 * Header field code for the destination bus name of a message. See dbus_message_set_destination().
258 */
259 const int DBUS_HEADER_FIELD_DESTINATION =6;
260 /**
261 * Header field code for the sender of a message; usually initialized by the message bus.
262 * See dbus_message_set_sender().
263 */
264 const int DBUS_HEADER_FIELD_SENDER =7;
265 /**
266 * Header field code for the type signature of a message.
267 */
268 const int DBUS_HEADER_FIELD_SIGNATURE =8;
269
270 /**
271 * Value of the highest-numbered header field code, can be used to determine
272 * the size of an array indexed by header field code. Remember though
273 * that unknown codes must be ignored, so check for that before
274 * indexing the array.
275 */
276 const int DBUS_HEADER_FIELD_LAST = DBUS_HEADER_FIELD_SIGNATURE;
277
278 /** Header format is defined as a signature:
279 * byte byte order
280 * byte message type ID
281 * byte flags
282 * byte protocol version
283 * uint32 body length
284 * uint32 serial
285 * array of struct (byte,variant) (field name, value)
286 *
287 * The length of the header can be computed as the
288 * fixed size of the initial data, plus the length of
289 * the array at the end, plus padding to an 8-boundary.
290 */
291 const char[] DBUS_HEADER_SIGNATURE =
292 DBUS_TYPE_BYTE_AS_STRING ~
293 DBUS_TYPE_BYTE_AS_STRING ~
294 DBUS_TYPE_BYTE_AS_STRING ~
295 DBUS_TYPE_BYTE_AS_STRING ~
296 DBUS_TYPE_UINT32_AS_STRING ~
297 DBUS_TYPE_UINT32_AS_STRING ~
298 DBUS_TYPE_ARRAY_AS_STRING ~
299 DBUS_STRUCT_BEGIN_CHAR_AS_STRING ~
300 DBUS_TYPE_BYTE_AS_STRING ~
301 DBUS_TYPE_VARIANT_AS_STRING ~
302 DBUS_STRUCT_END_CHAR_AS_STRING ;
303
304
305 /**
306 * The smallest header size that can occur. (It won't be valid due to
307 * missing required header fields.) This is 4 bytes, two uint32, an
308 * array length. This isn't any kind of resource limit, just the
309 * necessary/logical outcome of the header signature.
310 */
311 const int DBUS_MINIMUM_HEADER_SIZE =16;
312
313 /* Errors */
314 /* WARNING these get autoconverted to an enum in dbus-glib.h. Thus,
315 * if you change the order it breaks the ABI. Keep them in order.
316 * Also, don't change the formatting since that will break the sed
317 * script.
318 */
319 /** A generic error; "something went wrong" - see the error message for more. */
320 const char[] DBUS_ERROR_FAILED ="org.freedesktop.DBus.Error.Failed";
321 /** There was not enough memory to complete an operation. */
322 const char[] DBUS_ERROR_NO_MEMORY ="org.freedesktop.DBus.Error.NoMemory";
323 /** The bus doesn't know how to launch a service to supply the bus name you wanted. */
324 const char[] DBUS_ERROR_SERVICE_UNKNOWN ="org.freedesktop.DBus.Error.ServiceUnknown";
325 /** The bus name you referenced doesn't exist (i.e. no application owns it). */
326 const char[] DBUS_ERROR_NAME_HAS_NO_OWNER ="org.freedesktop.DBus.Error.NameHasNoOwner";
327 /** No reply to a message expecting one, usually means a timeout occurred. */
328 const char[] DBUS_ERROR_NO_REPLY ="org.freedesktop.DBus.Error.NoReply";
329 /** Something went wrong reading or writing to a socket, for example. */
330 const char[] DBUS_ERROR_IO_ERROR ="org.freedesktop.DBus.Error.IOError";
331 /** A D-Bus bus address was malformed. */
332 const char[] DBUS_ERROR_BAD_ADDRESS ="org.freedesktop.DBus.Error.BadAddress";
333 /** Requested operation isn't supported (like ENOSYS on UNIX). */
334 const char[] DBUS_ERROR_NOT_SUPPORTED ="org.freedesktop.DBus.Error.NotSupported";
335 /** Some limited resource is exhausted. */
336 const char[] DBUS_ERROR_LIMITS_EXCEEDED ="org.freedesktop.DBus.Error.LimitsExceeded";
337 /** Security restrictions don't allow doing what you're trying to do. */
338 const char[] DBUS_ERROR_ACCESS_DENIED ="org.freedesktop.DBus.Error.AccessDenied";
339 /** Authentication didn't work. */
340 const char[] DBUS_ERROR_AUTH_FAILED ="org.freedesktop.DBus.Error.AuthFailed";
341 /** Unable to connect to server (probably caused by ECONNREFUSED on a socket). */
342 const char[] DBUS_ERROR_NO_SERVER ="org.freedesktop.DBus.Error.NoServer";
343 /** Certain timeout errors, possibly ETIMEDOUT on a socket.
344 * Note that #DBUS_ERROR_NO_REPLY is used for message reply timeouts.
345 * @warning this is confusingly-named given that #DBUS_ERROR_TIMED_OUT also exists. We can't fix
346 * it for compatibility reasons so just be careful.
347 */
348 const char[] DBUS_ERROR_TIMEOUT ="org.freedesktop.DBus.Error.Timeout";
349 /** No network access (probably ENETUNREACH on a socket). */
350 const char[] DBUS_ERROR_NO_NETWORK ="org.freedesktop.DBus.Error.NoNetwork";
351 /** Can't bind a socket since its address is in use (i.e. EADDRINUSE). */
352 const char[] DBUS_ERROR_ADDRESS_IN_USE ="org.freedesktop.DBus.Error.AddressInUse";
353 /** The connection is disconnected and you're trying to use it. */
354 const char[] DBUS_ERROR_DISCONNECTED ="org.freedesktop.DBus.Error.Disconnected";
355 /** Invalid arguments passed to a method call. */
356 const char[] DBUS_ERROR_INVALID_ARGS ="org.freedesktop.DBus.Error.InvalidArgs";
357 /** Missing file. */
358 const char[] DBUS_ERROR_FILE_NOT_FOUND ="org.freedesktop.DBus.Error.FileNotFound";
359 /** Existing file and the operation you're using does not silently overwrite. */
360 const char[] DBUS_ERROR_FILE_EXISTS ="org.freedesktop.DBus.Error.FileExists";
361 /** Method name you invoked isn't known by the object you invoked it on. */
362 const char[] DBUS_ERROR_UNKNOWN_METHOD ="org.freedesktop.DBus.Error.UnknownMethod";
363 /** Certain timeout errors, e.g. while starting a service.
364 * @warning this is confusingly-named given that #DBUS_ERROR_TIMEOUT also exists. We can't fix
365 * it for compatibility reasons so just be careful.
366 */
367 const char[] DBUS_ERROR_TIMED_OUT ="org.freedesktop.DBus.Error.TimedOut";
368 /** Tried to remove or modify a match rule that didn't exist. */
369 const char[] DBUS_ERROR_MATCH_RULE_NOT_FOUND ="org.freedesktop.DBus.Error.MatchRuleNotFound";
370 /** The match rule isn't syntactically valid. */
371 const char[] DBUS_ERROR_MATCH_RULE_INVALID ="org.freedesktop.DBus.Error.MatchRuleInvalid";
372 /** While starting a new process, the exec() call failed. */
373 const char[] DBUS_ERROR_SPAWN_EXEC_FAILED ="org.freedesktop.DBus.Error.Spawn.ExecFailed";
374 /** While starting a new process, the fork() call failed. */
375 const char[] DBUS_ERROR_SPAWN_FORK_FAILED ="org.freedesktop.DBus.Error.Spawn.ForkFailed";
376 /** While starting a new process, the child exited with a status code. */
377 const char[] DBUS_ERROR_SPAWN_CHILD_EXITED ="org.freedesktop.DBus.Error.Spawn.ChildExited";
378 /** While starting a new process, the child exited on a signal. */
379 const char[] DBUS_ERROR_SPAWN_CHILD_SIGNALED ="org.freedesktop.DBus.Error.Spawn.ChildSignaled";
380 /** While starting a new process, something went wrong. */
381 const char[] DBUS_ERROR_SPAWN_FAILED ="org.freedesktop.DBus.Error.Spawn.Failed";
382 /** Tried to get a UNIX process ID and it wasn't available. */
383 const char[] DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN ="org.freedesktop.DBus.Error.UnixProcessIdUnknown";
384 /** A type signature is not valid. */
385 const char[] DBUS_ERROR_INVALID_SIGNATURE ="org.freedesktop.DBus.Error.InvalidSignature";
386 /** A file contains invalid syntax or is otherwise broken. */
387 const char[] DBUS_ERROR_INVALID_FILE_CONTENT ="org.freedesktop.DBus.Error.InvalidFileContent";
388 /** Asked for SELinux security context and it wasn't available. */
389 const char[] DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN ="org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown";
390
391 /* XML introspection format */
392
393 /** XML namespace of the introspection format version 1.0 */
394 const char[] DBUS_INTROSPECT_1_0_XML_NAMESPACE ="http://www.freedesktop.org/standards/dbus";
395 /** XML public identifier of the introspection format version 1.0 */
396 const char[] DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER ="-//freedesktop//DTD D-BUS Object Introspection 1.0//EN";
397 /** XML system identifier of the introspection format version 1.0 */
398 const char[] DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER ="http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd";
399 /** XML document type declaration of the introspection format version 1.0 */
400 const char[] DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE ="<!DOCTYPE node PUBLIC \""~DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER~"\"\n\""~DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER~"\">\n";
401
402 /** @} */
403