dbus-protocol.inc 11 KB

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