dbus-protocol.inc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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., 51 Franklin Street, Fifth Floor, Boston,
  22. * MA 02110-1301, USA.
  23. *
  24. }
  25. { Normally docs are in .c files, but there isn't a .c file for this. }
  26. {
  27. * @defgroup DBusProtocol Protocol constants
  28. * @ingroup DBus
  29. *
  30. * D-Bus protocol constants
  31. *
  32. * @brief Defines constants which are part of the D-Bus protocol
  33. }
  34. const
  35. { Message byte order }
  36. DBUS_LITTLE_ENDIAN = 'l'; {< LSB first }
  37. DBUS_BIG_ENDIAN = 'B'; {< MSB first }
  38. { Protocol version }
  39. DBUS_MAJOR_PROTOCOL_VERSION = 1;
  40. { Never a legitimate type }
  41. DBUS_TYPE_INVALID = 0;
  42. DBUS_TYPE_INVALID_AS_STRING = #0;
  43. { Primitive types }
  44. DBUS_TYPE_BYTE = Integer('y');
  45. DBUS_TYPE_BYTE_AS_STRING = 'y';
  46. DBUS_TYPE_BOOLEAN = Integer('b');
  47. DBUS_TYPE_BOOLEAN_AS_STRING = 'b';
  48. DBUS_TYPE_INT16 = Integer('n');
  49. DBUS_TYPE_INT16_AS_STRING = 'n';
  50. DBUS_TYPE_UINT16 = Integer('q');
  51. DBUS_TYPE_UINT16_AS_STRING = 'q';
  52. DBUS_TYPE_INT32 = Integer('i');
  53. DBUS_TYPE_INT32_AS_STRING = 'i';
  54. DBUS_TYPE_UINT32 = Integer('u');
  55. DBUS_TYPE_UINT32_AS_STRING = 'u';
  56. DBUS_TYPE_INT64 = Integer('x');
  57. DBUS_TYPE_INT64_AS_STRING = 'x';
  58. DBUS_TYPE_UINT64 = Integer('t');
  59. DBUS_TYPE_UINT64_AS_STRING = 't';
  60. DBUS_TYPE_DOUBLE = Integer('d');
  61. DBUS_TYPE_DOUBLE_AS_STRING = 'd';
  62. DBUS_TYPE_STRING = Integer('s');
  63. DBUS_TYPE_STRING_AS_STRING = 's';
  64. DBUS_TYPE_OBJECT_PATH = Integer('o');
  65. DBUS_TYPE_OBJECT_PATH_AS_STRING = 'o';
  66. DBUS_TYPE_SIGNATURE = Integer('g');
  67. DBUS_TYPE_SIGNATURE_AS_STRING = 'g';
  68. { Compound types }
  69. DBUS_TYPE_ARRAY = Integer('a');
  70. DBUS_TYPE_ARRAY_AS_STRING = 'a';
  71. DBUS_TYPE_VARIANT = Integer('v');
  72. DBUS_TYPE_VARIANT_AS_STRING = 'v';
  73. { STRUCT and DICT_ENTRY are sort of special since their codes can't
  74. * appear in a type string, instead
  75. * DBUS_STRUCT_BEGIN_CHAR/DBUS_DICT_ENTRY_BEGIN_CHAR have to appear
  76. }
  77. DBUS_TYPE_STRUCT = Integer('r');
  78. DBUS_TYPE_STRUCT_AS_STRING = 'r';
  79. DBUS_TYPE_DICT_ENTRY = Integer('e');
  80. DBUS_TYPE_DICT_ENTRY_AS_STRING = 'e';
  81. { Does not count INVALID }
  82. DBUS_NUMBER_OF_TYPES = (16);
  83. { characters other than typecodes that appear in type signatures }
  84. DBUS_STRUCT_BEGIN_CHAR = Integer('(');
  85. DBUS_STRUCT_BEGIN_CHAR_AS_STRING = '(';
  86. DBUS_STRUCT_END_CHAR = Integer(')');
  87. DBUS_STRUCT_END_CHAR_AS_STRING = ')';
  88. DBUS_DICT_ENTRY_BEGIN_CHAR = Integer('{');
  89. DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING = '{';
  90. DBUS_DICT_ENTRY_END_CHAR = Integer('}');
  91. DBUS_DICT_ENTRY_END_CHAR_AS_STRING = '}';
  92. { Max length in bytes of a bus name, interface, or member (not object
  93. * path, paths are unlimited). This is limited because lots of stuff
  94. * is O(n) in this number, plus it would be obnoxious to type in a
  95. * paragraph-long method name so most likely something like that would
  96. * be an exploit.
  97. }
  98. DBUS_MAXIMUM_NAME_LENGTH = 255;
  99. { This one is 255 so it fits in a byte }
  100. DBUS_MAXIMUM_SIGNATURE_LENGTH = 255;
  101. { Max length of a match rule string; to keep people from hosing the
  102. * daemon with some huge rule
  103. }
  104. DBUS_MAXIMUM_MATCH_RULE_LENGTH = 1024;
  105. { Max arg number you can match on in a match rule, e.g.
  106. * arg0='hello' is OK, arg3489720987='hello' is not
  107. }
  108. DBUS_MAXIMUM_MATCH_RULE_ARG_NUMBER = 63;
  109. { Max length of a marshaled array in bytes (64M, 2^26) We use signed
  110. * int for lengths so must be INT_MAX or less. We need something a
  111. * bit smaller than INT_MAX because the array is inside a message with
  112. * header info, etc. so an INT_MAX array wouldn't allow the message
  113. * overhead. The 64M number is an attempt at a larger number than
  114. * we'd reasonably ever use, but small enough that your bus would chew
  115. * through it fairly quickly without locking up forever. If you have
  116. * data that's likely to be larger than this, you should probably be
  117. * sending it in multiple incremental messages anyhow.
  118. }
  119. DBUS_MAXIMUM_ARRAY_LENGTH = (67108864);
  120. { Number of bits you need in an unsigned to store the max array size }
  121. DBUS_MAXIMUM_ARRAY_LENGTH_BITS = 26;
  122. { The maximum total message size including header and body; similar
  123. * rationale to max array size.
  124. }
  125. DBUS_MAXIMUM_MESSAGE_LENGTH = (DBUS_MAXIMUM_ARRAY_LENGTH * 2);
  126. { Number of bits you need in an unsigned to store the max message size }
  127. DBUS_MAXIMUM_MESSAGE_LENGTH_BITS = 27;
  128. { Depth of recursion in the type tree. This is automatically limited
  129. * to DBUS_MAXIMUM_SIGNATURE_LENGTH since you could only have an array
  130. * of array of array of ... that fit in the max signature. But that's
  131. * probably a bit too large.
  132. }
  133. DBUS_MAXIMUM_TYPE_RECURSION_DEPTH = 32;
  134. { Types of message }
  135. DBUS_MESSAGE_TYPE_INVALID = 0;
  136. DBUS_MESSAGE_TYPE_METHOD_CALL = 1;
  137. DBUS_MESSAGE_TYPE_METHOD_RETURN= 2;
  138. DBUS_MESSAGE_TYPE_ERROR = 3;
  139. DBUS_MESSAGE_TYPE_SIGNAL = 4;
  140. { Header flags }
  141. DBUS_HEADER_FLAG_NO_REPLY_EXPECTED = $1;
  142. DBUS_HEADER_FLAG_NO_AUTO_START = $2;
  143. { Header fields }
  144. DBUS_HEADER_FIELD_INVALID = 0;
  145. DBUS_HEADER_FIELD_PATH = 1;
  146. DBUS_HEADER_FIELD_INTERFACE = 2;
  147. DBUS_HEADER_FIELD_MEMBER = 3;
  148. DBUS_HEADER_FIELD_ERROR_NAME = 4;
  149. DBUS_HEADER_FIELD_REPLY_SERIAL = 5;
  150. DBUS_HEADER_FIELD_DESTINATION = 6;
  151. DBUS_HEADER_FIELD_SENDER = 7;
  152. DBUS_HEADER_FIELD_SIGNATURE = 8;
  153. DBUS_HEADER_FIELD_LAST = DBUS_HEADER_FIELD_SIGNATURE;
  154. { Header format is defined as a signature:
  155. * byte byte order
  156. * byte message type ID
  157. * byte flags
  158. * byte protocol version
  159. * uint32 body length
  160. * uint32 serial
  161. * array of struct (byte,variant) (field name, value)
  162. *
  163. * The length of the header can be computed as the
  164. * fixed size of the initial data, plus the length of
  165. * the array at the end, plus padding to an 8-boundary.
  166. }
  167. { DBUS_HEADER_SIGNATURE \
  168. DBUS_TYPE_BYTE_AS_STRING \
  169. DBUS_TYPE_BYTE_AS_STRING \
  170. DBUS_TYPE_BYTE_AS_STRING \
  171. DBUS_TYPE_BYTE_AS_STRING \
  172. DBUS_TYPE_UINT32_AS_STRING \
  173. DBUS_TYPE_UINT32_AS_STRING \
  174. DBUS_TYPE_ARRAY_AS_STRING \
  175. DBUS_STRUCT_BEGIN_CHAR_AS_STRING \
  176. DBUS_TYPE_BYTE_AS_STRING \
  177. DBUS_TYPE_VARIANT_AS_STRING \
  178. DBUS_STRUCT_END_CHAR_AS_STRING}
  179. {
  180. * The smallest header size that can occur. (It won't be valid due to
  181. * missing required header fields.) This is 4 bytes, two uint32, an
  182. * array length. This isn't any kind of resource limit, just the
  183. * necessary/logical outcome of the header signature.
  184. }
  185. DBUS_MINIMUM_HEADER_SIZE = 16;
  186. { Errors }
  187. { WARNING these get autoconverted to an enum in dbus-glib.h. Thus,
  188. * if you change the order it breaks the ABI. Keep them in order.
  189. * Also, don't change the formatting since that will break the sed
  190. * script.
  191. }
  192. DBUS_ERROR_FAILED = 'org.freedesktop.DBus.Error.Failed';
  193. DBUS_ERROR_NO_MEMORY = 'org.freedesktop.DBus.Error.NoMemory';
  194. DBUS_ERROR_SERVICE_UNKNOWN = 'org.freedesktop.DBus.Error.ServiceUnknown';
  195. DBUS_ERROR_NAME_HAS_NO_OWNER = 'org.freedesktop.DBus.Error.NameHasNoOwner';
  196. DBUS_ERROR_NO_REPLY = 'org.freedesktop.DBus.Error.NoReply';
  197. DBUS_ERROR_IO_ERROR = 'org.freedesktop.DBus.Error.IOError';
  198. DBUS_ERROR_BAD_ADDRESS = 'org.freedesktop.DBus.Error.BadAddress';
  199. DBUS_ERROR_NOT_SUPPORTED = 'org.freedesktop.DBus.Error.NotSupported';
  200. DBUS_ERROR_LIMITS_EXCEEDED = 'org.freedesktop.DBus.Error.LimitsExceeded';
  201. DBUS_ERROR_ACCESS_DENIED = 'org.freedesktop.DBus.Error.AccessDenied';
  202. DBUS_ERROR_AUTH_FAILED = 'org.freedesktop.DBus.Error.AuthFailed';
  203. DBUS_ERROR_NO_SERVER = 'org.freedesktop.DBus.Error.NoServer';
  204. DBUS_ERROR_TIMEOUT = 'org.freedesktop.DBus.Error.Timeout';
  205. DBUS_ERROR_NO_NETWORK = 'org.freedesktop.DBus.Error.NoNetwork';
  206. DBUS_ERROR_ADDRESS_IN_USE = 'org.freedesktop.DBus.Error.AddressInUse';
  207. DBUS_ERROR_DISCONNECTED = 'org.freedesktop.DBus.Error.Disconnected';
  208. DBUS_ERROR_INVALID_ARGS = 'org.freedesktop.DBus.Error.InvalidArgs';
  209. DBUS_ERROR_FILE_NOT_FOUND = 'org.freedesktop.DBus.Error.FileNotFound';
  210. DBUS_ERROR_FILE_EXISTS = 'org.freedesktop.DBus.Error.FileExists';
  211. DBUS_ERROR_UNKNOWN_METHOD = 'org.freedesktop.DBus.Error.UnknownMethod';
  212. DBUS_ERROR_TIMED_OUT = 'org.freedesktop.DBus.Error.TimedOut';
  213. DBUS_ERROR_MATCH_RULE_NOT_FOUND = 'org.freedesktop.DBus.Error.MatchRuleNotFound';
  214. DBUS_ERROR_MATCH_RULE_INVALID = 'org.freedesktop.DBus.Error.MatchRuleInvalid';
  215. DBUS_ERROR_SPAWN_EXEC_FAILED = 'org.freedesktop.DBus.Error.Spawn.ExecFailed';
  216. DBUS_ERROR_SPAWN_FORK_FAILED = 'org.freedesktop.DBus.Error.Spawn.ForkFailed';
  217. DBUS_ERROR_SPAWN_CHILD_EXITED = 'org.freedesktop.DBus.Error.Spawn.ChildExited';
  218. DBUS_ERROR_SPAWN_CHILD_SIGNALED = 'org.freedesktop.DBus.Error.Spawn.ChildSignaled';
  219. DBUS_ERROR_SPAWN_FAILED = 'org.freedesktop.DBus.Error.Spawn.Failed';
  220. DBUS_ERROR_SPAWN_SETUP_FAILED = 'org.freedesktop.DBus.Error.Spawn.FailedToSetup';
  221. DBUS_ERROR_SPAWN_CONFIG_INVALID = 'org.freedesktop.DBus.Error.Spawn.ConfigInvalid';
  222. DBUS_ERROR_SPAWN_SERVICE_INVALID = 'org.freedesktop.DBus.Error.Spawn.ServiceNotValid';
  223. DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND = 'org.freedesktop.DBus.Error.Spawn.ServiceNotFound';
  224. DBUS_ERROR_SPAWN_PERMISSIONS_INVALID = 'org.freedesktop.DBus.Error.Spawn.PermissionsInvalid';
  225. DBUS_ERROR_SPAWN_FILE_INVALID = 'org.freedesktop.DBus.Error.Spawn.FileInvalid';
  226. DBUS_ERROR_SPAWN_NO_MEMORY = 'org.freedesktop.DBus.Error.Spawn.NoMemory';
  227. DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN = 'org.freedesktop.DBus.Error.UnixProcessIdUnknown';
  228. DBUS_ERROR_INVALID_SIGNATURE = 'org.freedesktop.DBus.Error.InvalidSignature';
  229. DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN = 'org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown';
  230. DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN = 'org.freedesktop.DBus.Error.AdtAuditDataUnknown';
  231. DBUS_ERROR_OBJECT_PATH_IN_USE = 'org.freedesktop.DBus.Error.ObjectPathInUse';
  232. DBUS_INTROSPECT_1_0_XML_NAMESPACE = 'http://www.freedesktop.org/standards/dbus';
  233. DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER = '-//freedesktop//DTD D-BUS Object Introspection 1.0//EN';
  234. DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER = 'http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd';
  235. DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE = '<!DOCTYPE node PUBLIC "'+DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER+'"'#10'"'+DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER+'">'#10;