1 <!doctype article PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
5 <title>D-BUS Specification</title>
6 <releaseinfo>Version 0.8</releaseinfo>
7 <date>06 September 2003</date>
10 <firstname>Havoc</firstname>
11 <surname>Pennington</surname>
13 <orgname>Red Hat, Inc</orgname>
15 <email>hp@pobox.com</email>
20 <firstname>Anders</firstname>
21 <surname>Carlsson</surname>
23 <orgname>CodeFactory AB</orgname>
25 <email>andersca@codefactory.se</email>
30 <firstname>Alexander</firstname>
31 <surname>Larsson</surname>
33 <orgname>Red Hat, Inc</orgname>
35 <email>alexl@redhat.com</email>
42 <sect1 id="introduction">
43 <title>Introduction</title>
45 D-BUS is a system for low-latency, low-overhead, easy to use
46 interprocess communication (IPC). In more detail:
50 D-BUS is <emphasis>low-latency</emphasis> because it is designed
51 to avoid round trips and allow asynchronous operation, much like
57 D-BUS is <emphasis>low-overhead</emphasis> because it uses a
58 binary protocol, and does not have to convert to and from a text
59 format such as XML. Because D-BUS is intended for potentially
60 high-resolution same-machine IPC, not primarily for Internet IPC,
61 this is an interesting optimization.
66 D-BUS is <emphasis>easy to use</emphasis> because it works in terms
67 of <firstterm>messages</firstterm> rather than byte streams, and
68 automatically handles a lot of the hard IPC issues. Also, the D-BUS
69 library is designed to be wrapped in a way that lets developers use
70 their framework's existing object/type system, rather than learning
71 a new one specifically for IPC.
77 The base D-BUS protocol is a peer-to-peer protocol, specified in <xref
78 linkend="message-protocol">. That is, it is a system for one application
79 to talk to a single other application. However, the primary intended
80 application of D-BUS is the D-BUS <firstterm>message bus</firstterm>,
81 specified in <xref linkend="message-bus">. The message bus is a special
82 application that accepts connections from multiple other applications, and
83 forwards messages among them.
86 Uses of D-BUS include notification of system changes (notification of when
87 a camera is plugged in to a computer, or a new version of some software
88 has been installed), or desktop interoperablity, for example a file
89 monitoring service or a configuration service.
93 <sect1 id="message-protocol">
94 <title>Message Protocol</title>
96 A <firstterm>message</firstterm> consists of a
97 <firstterm>header</firstterm> and a <firstterm>body</firstterm>. If you
98 think of a message as a package, the header is the address, and the body
99 contains the package contents. The message delivery system uses the header
100 information to figure out where to send the message and how to interpret
101 it; the recipient inteprets the body of the message.
105 The body of the message is made up of zero or more
106 <firstterm>arguments</firstterm>, which are typed
107 values, such as an integer or a byte array.
110 <sect2 id="message-protocol-header-encoding">
111 <title>Header Encoding</title>
113 Following the mandatory fields, there are zero or more named fields (see
114 <xref linkend="message-protocol-header-fields">), and then nul bytes
115 padding the header such that its total length in bytes is a multiple of
119 The header MUST begin with the following mandatory fields in the following
126 <entry>Description</entry>
131 <entry>1 byte</entry>
132 <entry>Endianness flag; ASCII 'l' for little-endian
133 or ASCII 'B' for big-endian.</entry>
136 <entry>1 byte</entry>
137 <entry>Type of message. Unknown types MUST be ignored.
138 Currently-defined types are described below.
142 <entry>1 byte</entry>
143 <entry>Bitwise OR of flags. Unknown flags
144 MUST be ignored. Currently-defined flags are described below.
148 <entry>1 byte</entry>
149 <entry>Major protocol version of the sending application. If
150 the major protocol version of the receiving application does not
151 match, the applications will not be able to communicate and the
152 D-BUS connection MUST be disconnected. The major protocol
153 version for this version of the specification is 0.
157 <entry>4 bytes</entry>
158 <entry>An unsigned 32-bit integer in the
159 message's byte order, indicating the total length in bytes of
160 the header including named fields and any alignment padding.
161 MUST be a multiple of 8.
165 <entry>4 bytes</entry>
166 <entry>An unsigned 32-bit integer in the
167 message's byte order, indicating the total length in bytes of
172 <entry>4 bytes</entry>
173 <entry>The message's serial number, an unsigned 32-bit integer in
174 the message's byte order. The serial number is a cookie used to
175 identify message replies; thus all outstanding unreplied-to messages
176 from the same connection MUST have a different serial number.
177 Zero is not a valid serial number, but all other numbers are
186 Types that can appear in the second byte of the header:
191 <entry>Conventional name</entry>
192 <entry>Decimal value</entry>
193 <entry>Description</entry>
198 <entry>INVALID</entry>
200 <entry>This is an invalid type, if seen in a message
201 the connection should be dropped immediately.</entry>
204 <entry>METHOD_CALL</entry>
206 <entry>Method call.</entry>
209 <entry>METHOD_RETURN</entry>
211 <entry>Method reply with returned data.</entry>
216 <entry>Error reply. If the first argument exists and is a
217 string, it is an error message.</entry>
220 <entry>SIGNAL</entry>
222 <entry>Signal emission.</entry>
229 Flags that can appear in the third byte of the header:
234 <entry>Conventional name</entry>
235 <entry>Hex value</entry>
236 <entry>Description</entry>
241 <entry>NO_REPLY_EXPECTED</entry>
243 <entry>This message does not expect method return replies or
244 error replies; the reply can be omitted as an
245 optimization. However, it is compliant with this specification
246 to return the reply despite this flag.</entry>
254 <sect2 id="message-protocol-header-fields">
255 <title>Header Fields</title>
257 In addition to the required header information mentioned
258 in <xref linkend="message-protocol-header-encoding">,
259 the header may contain zero or more named
260 header fields. These fields are named to allow
261 future versions of this protocol specification to
262 add new fields; implementations must ignore fields
263 they do not understand. Implementations must not
264 invent their own header fields; only changes to
265 this specification may introduce new header fields.
269 Header field names MUST consist of 4 non-nul bytes. The field name is
270 NOT nul terminated; it occupies exactly 4 bytes. Following the name, the
271 field MUST have a type code represented as a single unsigned byte, and
272 then a properly-aligned value of that type. See <xref
273 linkend="message-protocol-arguments"> for a description of how each type
274 is encoded. If an implementation sees a header field name that it does
275 not understand, it MUST ignore that field.
279 Here are the currently-defined named header fields:
286 <entry>Description</entry>
292 <entry>STRING</entry>
293 <entry>The object to send the message to; objects are identified by
294 a path, "/foo/bar"</entry>
298 <entry>STRING</entry>
299 <entry>The interface to invoke a method call on, or
300 that a signal is emitted from. e.g. "org.freedesktop.Introspectable"</entry>
304 <entry>STRING</entry>
305 <entry>The member, either the method name or signal name.
306 e.g. "Frobate"</entry>
310 <entry>STRING</entry>
311 <entry>The name of the error that occurred, for errors</entry>
315 <entry>UINT32</entry>
316 <entry>The serial number of the message this message is a reply
317 to. (The serial number is one of the mandatory header fields,
318 see <xref linkend="message-protocol-header-encoding">.)</entry>
322 <entry>STRING</entry>
323 <entry>The name of the service this message should be routed to.
324 Only used in combination with the message bus, see
325 <xref linkend="message-bus">.</entry>
329 <entry>STRING</entry>
330 <entry>Sender service. The name of the base service that sent
331 this message. The message bus fills in this field; the field is
332 only meaningful in combination with the message bus.</entry>
340 <sect2 id="message-protocol-header-padding">
341 <title>Header Alignment Padding</title>
343 To allow implementations to keep the header and the body in a single
344 buffer while keeping data types aligned, the total length of the header
345 must be a multiple of 8 bytes. To achieve this, the header MUST be padded
346 with nul bytes to align its total length on an 8-byte boundary.
347 The minimum number of padding bytes MUST be used. Because all possible
348 named fields use at least 8 bytes, implementations can distinguish
349 padding (which must be less than 8 bytes) from additional named fields
350 (which must be at least 8 bytes).
354 <sect2 id="message-protocol-arguments">
355 <title>Message Arguments</title>
357 The message body is made up of arguments. Each argument is a type code,
358 represented by a single unsigned byte, followed by the aligned value of
359 the argument in a type-dependent format. Alignment padding between the
360 typecode and the value is initialized to zero.
367 <entry>Type name</entry>
369 <entry>Description</entry>
374 <entry>INVALID</entry>
376 <entry>Not a valid type code (error if it appears in a message)</entry>
380 <entry>Marks an "unset" or "nonexistent" argument</entry>
384 <entry>8-bit unsigned integer</entry>
386 <entry>BOOLEAN</entry>
388 <entry>Boolean value, 0 is FALSE and 1 is TRUE. Everything else is invalid.</entry>
392 <entry>32-bit signed integer</entry>
394 <entry>UINT32</entry>
396 <entry>32-bit unsigned integer</entry>
400 <entry>64-bit signed integer</entry>
402 <entry>UINT64</entry>
404 <entry>64-bit unsigned integer</entry>
406 <entry>DOUBLE</entry>
408 <entry>IEEE 754 double</entry>
410 <entry>STRING</entry>
412 <entry>UTF-8 string (<emphasis>must</emphasis> be valid UTF-8). Must be zero terminated. </entry>
416 <entry>A named byte array, used for custom types</entry>
424 <entry>A dictionary of key/value pairs</entry>
431 The types are encoded as follows:
436 <entry>Type name</entry>
437 <entry>Encoding</entry>
442 <entry>INVALID</entry>
443 <entry>Not applicable; cannot be encoded.</entry>
446 <entry>No data is encoded; the type code is followed immediately
447 by the type code of the next argument.</entry>
450 <entry>A byte.</entry>
452 <entry>BOOLEAN</entry>
453 <entry>A byte, with valid values 0 and 1.</entry>
456 <entry>32-bit signed integer in the message's byte order, aligned to 4-byte boundary.</entry>
458 <entry>UINT32</entry>
459 <entry>32-bit unsigned integer in the message's byte order, aligned to 4-byte boundary.</entry>
462 <entry>64-bit signed integer in the message's byte order, aligned to 8-byte boundary.</entry>
464 <entry>UINT64</entry>
465 <entry>64-bit unsigned integer in the message's byte order, aligned to 8-byte boundary.</entry>
467 <entry>DOUBLE</entry>
468 <entry>64-bit IEEE 754 double in the message's byte order, aligned to 8-byte boundary.</entry>
470 <entry>STRING</entry>
471 <entry>UINT32 aligned to 4-byte boundary indicating the string's
472 length in bytes excluding its terminating nul, followed by
473 string data of the given length, followed by a terminating nul
478 <entry>A string (encoded as the STRING type above) giving the
479 name of the type followed by an UINT32 aligned to 4-byte boundary
480 indicating the data length in bytes, followed by the data.
484 <entry>A sequence of bytes giving the element type of the array, terminated
485 by a type different from ARRAY (just one byte for one-dimensional arrays, but
486 larger for multi-dimensional arrays), followed by an UINT32 (aligned to 4 bytes)
487 giving the length of the array data in bytes. This is followed by each array entry
488 encoded the way it would normally be encoded, except arrays, which are encoded
489 without the type information, since that is already declared above. Arrays containing
494 <entry>UINT32 giving the length of the dictionary data in bytes.
495 This is followed by a number of keyname/value pairs, where the
496 keyname is encoded as a STRING above, and the value is encoded
497 as a byte with typecode and how that type normally would be encoded
507 <sect2 id="message-protocol-names">
508 <title>Valid names</title>
510 The various header fields of type STRING have some restrictions
511 on the string's format.
513 <sect3 id="message-protocol-names-service">
514 <title>Service names</title>
516 Services have names with type STRING, meaning that
517 they must be valid UTF-8. However, there are also some
518 additional restrictions that apply to service names
521 <listitem><para>They must contain at least one '.' (period) character</para></listitem>
522 <listitem><para>They must not begin with a '.' (period) character</para></listitem>
523 <listitem><para>They must not exceed 256 bytes in length</para></listitem>
524 <listitem><para>They must be at least 1 byte in length</para></listitem>
527 As a special exception, base service names (those beginning with a colon
528 (':') character) need not contain a period.
531 FIXME really, shouldn't we ban basically everything non-alphanumeric
532 so the name will work in all programming languages?
535 <sect3 id="message-protocol-names-interface">
536 <title>Interface names</title>
538 Interface names have the same restrictions as service names,
539 but do not have the special exception for names beginning with
543 FIXME really, shouldn't we ban basically everything non-alphanumeric
544 so the name will work in all programming languages?
547 <sect3 id="message-protocol-names-method">
548 <title>Method names</title>
552 <listitem><para>May not contain the '.' (period) character</para></listitem>
553 <listitem><para>Must not exceed 256 bytes in length</para></listitem>
554 <listitem><para>Must be at least 1 byte in length</para></listitem>
558 FIXME really, shouldn't we ban basically everything non-alphanumeric
559 so the name will work in all programming languages?
562 <sect3 id="message-protocol-names-path">
563 <title>Path names</title>
565 A path must begin with an ASCII '/' (slash) character. Paths may not
566 end with a slash character unless the path is the one-byte string
567 "/". Two slash characters may not appear adjacent to one another (the
568 empty string is not a valid "subdirectory"). Paths may not exceed
572 <sect3 id="message-protocol-names-error">
573 <title>Error names</title>
575 Error names have the same restrictions as interface names.
578 FIXME really, shouldn't we ban basically everything non-alphanumeric
579 so the name will work in all programming languages?
584 <sect2 id="message-protocol-types">
585 <title>Message types</title>
587 Each of the message types (METHOD_CALL, METHOD_RETURN, ERROR, and
588 SIGNAL) has its own expected usage conventions and header fields.
590 <sect3 id="message-protocol-types-method">
591 <title>Method Calls, Returns, and Errors</title>
593 Some messages invoke an operation on a remote object. These are
594 called method call messages and have the type tag METHOD_CALL. Such
595 messages map naturally to methods on objects in a typical program.
598 A method call message is expected to have a 'mebr' header field
599 indicating the name of the method. Optionally, the message has an
600 'ifce' field giving the interface the method is a part of. In the
601 absence of an 'ifce' field, if two interfaces on the same object have
602 a method with the same name, it is undefined which of the two methods
603 will be invoked. Implementations may also choose to return an error in
604 this ambiguous case. However, if a method name is unique
605 implementations should not require an interface field.
608 Method call messages also include a 'path' field indicating the
609 object to invoke the method on. If the call is passing through
610 a message bus, the message will also have a 'srvc' field giving
611 the service to receive the message.
614 When an application handles a method call message, it is expected to
615 return a reply. The reply is identified by a 'rply' header field
616 indicating the serial number of the METHOD_CALL being replied to. The
617 reply can have one of two types; either METHOD_RETURN or ERROR.
620 If the reply has type METHOD_RETURN, the arguments to the reply message
621 are the return value(s) or "out parameters" of the method call.
622 If the reply has type ERROR, then an "exception" has been thrown,
623 and the call fails; no return value will be provided. It makes
624 no sense to send multiple replies to the same method call.
627 Even if a method call has no return values, a METHOD_RETURN
628 reply is expected, so the caller will know the method
629 was successfully processed.
632 If a METHOD_CALL message has the flag NO_REPLY_EXPECTED,
633 then as an optimization the application receiving the method
634 call may choose to omit the reply message (regardless of
635 whether the reply would have been METHOD_RETURN or ERROR).
636 However, it is also acceptable to ignore the NO_REPLY_EXPECTED
637 flag and reply anyway.
639 <sect4 id="message-protocol-types-method-apis">
640 <title>Mapping method calls to native APIs</title>
642 APIs for D-BUS may map method calls to a method call in a specific
643 programming language, such as C++, or may map a method call written
644 in an IDL to a D-BUS message.
647 In APIs of this nature, arguments to a method are often termed "in"
648 (which implies sent in the METHOD_CALL), or "out" (which implies
649 returned in the METHOD_RETURN). Some APIs such as CORBA also have
650 "inout" arguments, which are both sent and received, i.e. the caller
651 passes in a value which is modified. Mapped to D-BUS, an "inout"
652 argument is equivalent to an "in" argument, followed by an "out"
653 argument. You can't pass things "by reference" over the wire, so
654 "inout" is purely an illusion of the in-process API.
657 Given a method with zero or one return values, followed by zero or more
658 arguments, where each argument may be "in", "out", or "inout", the
659 caller constructs a message by appending each "in" or "inout" argument,
660 in order. "out" arguments are not represented in the caller's message.
663 The recipient constructs a reply by appending first the return value
664 if any, then each "out" or "inout" argument, in order.
665 "in" arguments are not represented in the reply message.
671 <sect3 id="message-protocol-types-signal">
672 <title>Signal Emission</title>
674 Unlike method calls, signal emissions have no replies.
675 A signal emission is simply a single message of type SIGNAL.
676 It must have three header fields: 'path' giving the object
677 the signal was emitted from, plus 'ifce' and 'mebr' giving the
678 fully-qualified name of the signal.
682 <sect3 id="message-protocol-types-notation">
683 <title>Notation in this document</title>
685 This document uses a simple pseudo-IDL to describe particular method
686 calls and signals. Here is an example of a method call:
688 org.freedesktop.DBus.ActivateService (in STRING service_name, in UINT32 flags,
689 out UINT32 resultcode)
691 This means ifce = org.freedesktop.DBus, mebr = ActivateService,
692 METHOD_CALL arguments are STRING and UINT32, METHOD_RETURN argument
693 is UINT32. Remember that the 'mebr' field can't contain any '.' (period)
694 characters so it's known that the last part of the name in
695 the "IDL" is the member name.
698 In C++ that might end up looking like this:
700 unsigned int org::freedesktop::DBus::ActivateService (const char *service_name,
703 or equally valid, the return value could be done as an argument:
705 void org::freedesktop::DBus::ActivateService (const char *service_name,
707 unsigned int *resultcode);
709 It's really up to the API designer how they want to make
710 this look. You could design an API where the namespace wasn't used
711 in C++, using STL or Qt, using varargs, or whatever you wanted.
714 Signals are written as follows:
716 org.freedesktop.DBus.ServiceLost (STRING service_name)
718 Signals don't specify "in" vs. "out" because only
719 a single direction is possible.
722 In this ad hoc notation, the special type name ANY means any type
723 other than NIL, and the special type name ANY_OR_NIL means any valid
727 It isn't especially encouraged to use this lame pseudo-IDL in actual
728 API implementations; you might use the native notation for the
729 language you're using, or you might use COM or CORBA IDL, for example.
736 <sect1 id="auth-protocol">
737 <title>Authentication Protocol</title>
739 Before the flow of messages begins, two applications must
740 authenticate. A simple plain-text protocol is used for
741 authentication; this protocol is a SASL profile, and maps fairly
742 directly from the SASL specification. The message encoding is
743 NOT used here, only plain text messages.
746 In examples, "C:" and "S:" indicate lines sent by the client and
749 <sect2 id="auth-protocol-overview">
750 <title>Protocol Overview</title>
752 The protocol is a line-based protocol, where each line ends with
753 \r\n. Each line begins with an all-caps ASCII command name containing
754 only the character range [A-Z], a space, then any arguments for the
755 command, then the \r\n ending the line. The protocol is
756 case-sensitive. All bytes must be in the ASCII character set.
758 Commands from the client to the server are as follows:
761 <listitem><para>AUTH [mechanism] [initial-response]</para></listitem>
762 <listitem><para>CANCEL</para></listitem
763 <listitem><para>BEGIN</para></listitem>
764 <listitem><para>DATA <data in base 64 encoding></para></listitem>
765 <listitem><para>ERROR [human-readable error explanation]</para></listitem>
768 From server to client are as follows:
771 <listitem><para>REJECTED <space-separated list of mechanism names></para></listitem>
772 <listitem><para>OK</para></listitem>
773 <listitem><para>DATA <data in base 64 encoding></para></listitem>
774 <listitem><para>ERROR</para></listitem>
778 <sect2 id="auth-nul-byte">
779 <title>Special credentials-passing nul byte</title>
781 Immediately after connecting to the server, the client must send a
782 single nul byte. This byte may be accompanied by credentials
783 information on some operating systems that use sendmsg() with
784 SCM_CREDS or SCM_CREDENTIALS to pass credentials over UNIX domain
785 sockets. However, the nul byte MUST be sent even on other kinds of
786 socket, and even on operating systems that do not require a byte to be
787 sent in order to transmit credentials. The text protocol described in
788 this document begins after the single nul byte. If the first byte
789 received from the client is not a nul byte, the server may disconnect
793 A nul byte in any context other than the initial byte is an error;
794 the protocol is ASCII-only.
797 The credentials sent along with the nul byte may be used with the
798 SASL mechanism EXTERNAL.
801 <sect2 id="auth-command-auth">
802 <title>AUTH command</title>
804 If an AUTH command has no arguments, it is a request to list
805 available mechanisms. The server SHOULD respond with a REJECTED
806 command listing the mechanisms it understands.
809 If an AUTH command specifies a mechanism, and the server supports
810 said mechanism, the server SHOULD begin exchanging SASL
811 challenge-response data with the client using DATA commands.
814 If the server does not support the mechanism given in the AUTH
815 command, it SHOULD send a REJECTED command listing the mechanisms
819 If the [initial-response] argument is provided, it is intended for
820 use with mechanisms that have no initial challenge (or an empty
821 initial challenge), as if it were the argument to an initial DATA
822 command. If the selected mechanism has an initial challenge, the
823 server should reject authentication by sending REJECTED.
826 If authentication succeeds after exchanging DATA commands,
827 an OK command should be sent to the client.
830 The first octet received by the client after the \r\n of the OK
831 command MUST be the first octet of the authenticated/encrypted
832 stream of D-BUS messages.
835 The first octet received by the server after the \r\n of the BEGIN
836 command from the client MUST be the first octet of the
837 authenticated/encrypted stream of D-BUS messages.
840 <sect2 id="auth-command-cancel">
841 <title>CANCEL Command</title>
843 At any time up to sending the BEGIN command, the client may send a
844 CANCEL command. On receiving the CANCEL command, the server MUST
845 send a REJECTED command and abort the current authentication
849 <sect2 id="auth-command-data">
850 <title>DATA Command</title>
852 The DATA command may come from either client or server, and simply
853 contains a base64-encoded block of data to be interpreted
854 according to the SASL mechanism in use.
857 Some SASL mechanisms support sending an "empty string";
858 FIXME we need some way to do this.
861 <sect2 id="auth-command-begin">
862 <title>BEGIN Command</title>
864 The BEGIN command acknowledges that the client has received an
865 OK command from the server, and that the stream of messages
869 The first octet received by the server after the \r\n of the BEGIN
870 command from the client MUST be the first octet of the
871 authenticated/encrypted stream of D-BUS messages.
874 <sect2 id="auth-command-rejected">
875 <title>REJECTED Command</title>
877 The REJECTED command indicates that the current authentication
878 exchange has failed, and further exchange of DATA is inappropriate.
879 The client would normally try another mechanism, or try providing
880 different responses to challenges.
882 Optionally, the REJECTED command has a space-separated list of
883 available auth mechanisms as arguments. If a server ever provides
884 a list of supported mechanisms, it MUST provide the same list
885 each time it sends a REJECTED message. Clients are free to
886 ignore all lists received after the first.
889 <sect2 id="auth-command-ok">
890 <title>OK Command</title>
892 The OK command indicates that the client has been authenticated,
893 and that further communication will be a stream of D-BUS messages
894 (optionally encrypted, as negotiated) rather than this protocol.
897 The first octet received by the client after the \r\n of the OK
898 command MUST be the first octet of the authenticated/encrypted
899 stream of D-BUS messages.
902 The client MUST respond to the OK command by sending a BEGIN
903 command, followed by its stream of messages, or by disconnecting.
904 The server MUST NOT accept additional commands using this protocol
905 after the OK command has been sent.
908 <sect2 id="auth-command-error">
909 <title>ERROR Command</title>
911 The ERROR command indicates that either server or client did not
912 know a command, does not accept the given command in the current
913 context, or did not understand the arguments to the command. This
914 allows the protocol to be extended; a client or server can send a
915 command present or permitted only in new protocol versions, and if
916 an ERROR is received instead of an appropriate response, fall back
917 to using some other technique.
920 If an ERROR is sent, the server or client that sent the
921 error MUST continue as if the command causing the ERROR had never been
922 received. However, the the server or client receiving the error
923 should try something other than whatever caused the error;
924 if only canceling/rejecting the authentication.
927 <sect2 id="auth-examples">
928 <title>Authentication examples</title>
932 <title>Example of successful magic cookie authentication</title>
934 (MAGIC_COOKIE is a made up mechanism)
936 C: AUTH MAGIC_COOKIE BsAY3g4gBNo=
942 <title>Example of finding out mechanisms then picking one</title>
945 S: REJECTED KERBEROS_V4 SKEY
946 C: AUTH SKEY bW9yZ2Fu
947 S: DATA OTUgUWE1ODMwOA==
948 C: DATA Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
954 <title>Example of client sends unknown command then falls back to regular auth</title>
958 C: AUTH MAGIC_COOKIE BsAY3g4gBNo=
964 <title>Example of server doesn't support initial auth mechanism</title>
966 C: AUTH MAGIC_COOKIE BsAY3g4gBNo=
967 S: REJECTED KERBEROS_V4 SKEY
968 C: AUTH SKEY bW9yZ2Fu
969 S: DATA OTUgUWE1ODMwOA==
970 C: DATA Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
976 <title>Example of wrong password or the like followed by successful retry</title>
978 C: AUTH MAGIC_COOKIE BsAY3g4gBNo=
979 S: REJECTED KERBEROS_V4 SKEY
980 C: AUTH SKEY bW9yZ2Fu
981 S: DATA OTUgUWE1ODMwOA==
982 C: DATA Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
984 C: AUTH SKEY bW9yZ2Fu
985 S: DATA OTUgUWE1ODMwOA==
986 C: DATA Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
992 <title>Example of skey cancelled and restarted</title>
994 C: AUTH MAGIC_COOKIE BsAY3g4gBNo=
995 S: REJECTED KERBEROS_V4 SKEY
996 C: AUTH SKEY bW9yZ2Fu
997 S: DATA OTUgUWE1ODMwOA==
1000 C: AUTH SKEY bW9yZ2Fu
1001 S: DATA OTUgUWE1ODMwOA==
1002 C: DATA Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
1009 <sect2 id="auth-states">
1010 <title>Authentication state diagrams</title>
1016 <sect2 id="auth-mechanisms">
1017 <title>Authentication mechanisms</title>
1019 This section describes some new authentication mechanisms.
1020 D-BUS also allows any standard SASL mechanism of course.
1022 <sect3 id="auth-mechanisms-sha">
1023 <title>DBUS_COOKIE_SHA1</title>
1025 The DBUS_COOKIE_SHA1 mechanism is designed to establish that a client
1026 has the ability to read a private file owned by the user being
1027 authenticated. If the client can prove that it has access to a secret
1028 cookie stored in this file, then the client is authenticated.
1029 Thus the security of DBUS_COOKIE_SHA1 depends on a secure home
1033 Authentication proceeds as follows:
1037 The client sends the username it would like to authenticate
1043 The server sends the name of its "cookie context" (see below); a
1044 space character; the integer ID of the secret cookie the client
1045 must demonstrate knowledge of; a space character; then a
1046 hex-encoded randomly-generated challenge string.
1051 The client locates the cookie, and generates its own hex-encoded
1052 randomly-generated challenge string. The client then
1053 concatentates the server's hex-encoded challenge, a ":"
1054 character, its own hex-encoded challenge, another ":" character,
1055 and the hex-encoded cookie. It computes the SHA-1 hash of this
1056 composite string. It sends back to the server the client's
1057 hex-encoded challenge string, a space character, and the SHA-1
1063 The server generates the same concatenated string used by the
1064 client and computes its SHA-1 hash. It compares the hash with
1065 the hash received from the client; if the two hashes match, the
1066 client is authenticated.
1072 Each server has a "cookie context," which is a name that identifies a
1073 set of cookies that apply to that server. A sample context might be
1074 "org_freedesktop_session_bus". Context names must be valid ASCII,
1075 nonzero length, and may not contain the characters slash ("/"),
1076 backslash ("\"), space (" "), newline ("\n"), carriage return ("\r"),
1077 tab ("\t"), or period ("."). There is a default context,
1078 "org_freedesktop_global" that's used by servers that do not specify
1082 Cookies are stored in a user's home directory, in the directory
1083 <filename>~/.dbus-keyrings/</filename>. This directory must
1084 not be readable or writable by other users. If it is,
1085 clients and servers must ignore it. The directory
1086 contains cookie files named after the cookie context.
1089 A cookie file contains one cookie per line. Each line
1090 has three space-separated fields:
1094 The cookie ID number, which must be a non-negative integer and
1095 may not be used twice in the same file.
1100 The cookie's creation time, in UNIX seconds-since-the-epoch
1106 The cookie itself, a hex-encoded random block of bytes.
1112 Only server processes modify the cookie file.
1113 They must do so with this procedure:
1117 Create a lockfile name by appending ".lock" to the name of the
1118 cookie file. The server should attempt to create this file
1119 using <literal>O_CREAT | O_EXCL</literal>. If file creation
1120 fails, the lock fails. Servers should retry for a reasonable
1121 period of time, then they may choose to delete an existing lock
1122 to keep users from having to manually delete a stale
1123 lock. <footnote><para>Lockfiles are used instead of real file
1124 locking <literal>fcntl()</literal> because real locking
1125 implementations are still flaky on network
1126 filesystems.</para></footnote>
1131 Once the lockfile has been created, the server loads the cookie
1132 file. It should then delete any cookies that are old (the
1133 timeout can be fairly short), or more than a reasonable
1134 time in the future (so that cookies never accidentally
1135 become permanent, if the clock was set far into the future
1136 at some point). If no recent keys remain, the
1137 server may generate a new key.
1142 The pruned and possibly added-to cookie file
1143 must be resaved atomically (using a temporary
1144 file which is rename()'d).
1149 The lock must be dropped by deleting the lockfile.
1155 Clients need not lock the file in order to load it,
1156 because servers are required to save the file atomically.
1161 <sect1 id="addresses">
1162 <title>Server Addresses</title>
1164 Server addresses consist of a transport name followed by a colon, and
1165 then an optional, comma-separated list of keys and values in the form key=value.
1166 [FIXME how do you escape colon, comma, and semicolon in the values of the key=value pairs?]
1170 <programlisting>unix:path=/tmp/dbus-test</programlisting>
1171 Which is the address to a unix socket with the path /tmp/dbus-test.
1174 [FIXME clarify if attempting to connect to each is a requirement
1175 or just a suggestion]
1176 When connecting to a server, multiple server addresses can be
1177 separated by a semi-colon. The library will then try to connect
1178 to the first address and if that fails, it'll try to connect to
1179 the next one specified, and so forth. For example
1180 <programlisting>unix:path=/tmp/dbus-test;unix:path=/tmp/dbus-test2</programlisting>
1183 [FIXME we need to specify in detail each transport and its possible arguments]
1184 Current transports include: unix domain sockets (including
1185 abstract namespace on linux), TCP/IP, and a debug/testing transport using
1186 in-process pipes. Future possible transports include one that
1187 tunnels over X11 protocol.
1191 <sect1 id="standard-messages">
1192 <title>Standard Peer-to-Peer Messages</title>
1194 See <xref linkend="message-protocol-types-notation"> for details on
1195 the notation used in this section.
1197 <sect2 id="standard-messages-ping">
1198 <title><literal>org.freedesktop.Peer.Ping</literal></title>
1201 org.freedesktop.Peer.Ping ()
1205 On receipt of the METHOD_CALL
1206 message <literal>org.freedesktop.Peer.Ping</literal>, an application
1207 should do nothing other than reply with a METHOD_RETURN as usual.
1211 <sect2 id="standard-messages-get-props">
1212 <title><literal>org.freedesktop.Props.Get</literal></title>
1214 [FIXME this is just a bogus made-up method that isn't implemented
1215 or thought through, to save an example of table formatting for the
1216 argument descriptions]
1218 org.freedesktop.Props.Get (in STRING property_name,
1219 out ANY_OR_NIL property_value)
1226 <entry>Argument</entry>
1228 <entry>Description</entry>
1234 <entry>in STRING</entry>
1235 <entry>Name of the property to get</entry>
1239 <entry>out ANY_OR_NIL</entry>
1240 <entry>The value of the property. The type depends on the property.</entry>
1249 <sect1 id="message-bus">
1250 <title>Message Bus Specification</title>
1251 <sect2 id="message-bus-overview">
1252 <title>Message Bus Overview</title>
1254 The message bus accepts connections from one or more applications.
1255 Once connected, applications can send and receive messages from
1256 the message bus, as in the peer-to-peer case.
1259 The message bus keeps track of a set of
1260 <firstterm>services</firstterm>. A service is simply a name, such as
1261 <literal>com.yoyodyne.Screensaver</literal>, which can be
1262 <firstterm>owned</firstterm> by one or more of the connected
1263 applications. The message bus itself always owns the special service
1264 <literal>org.freedesktop.DBus</literal>.
1267 Services may have <firstterm>secondary owners</firstterm>. Secondary owners
1268 of a service are kept in a queue; if the primary owner of a service
1269 disconnects, or releases the service, the next secondary owner becomes
1270 the new owner of the service.
1273 Messages may have a <literal>srvc</literal> field (see <xref
1274 linkend="message-protocol-header-fields">). When the message bus
1275 receives a message, if the <literal>srvc</literal> field is absent, the
1276 message is taken to be a standard peer-to-peer message and interpreted
1277 by the message bus itself. For example, sending
1278 an <literal>org.freedesktop.Peer.Ping</literal> message with no
1279 <literal>srvc</literal> will cause the message bus itself to reply
1280 to the ping immediately; the message bus would never make
1281 this message visible to other applications.
1284 If the <literal>srvc</literal> field is present, then it indicates a
1285 request for the message bus to route the message. In the usual case,
1286 messages are routed to the owner of the named service.
1287 Messages may also be <firstterm>broadcast</firstterm>
1288 by sending them to the special service
1289 <literal>org.freedesktop.DBus.Broadcast</literal>. Broadcast messages are
1290 sent to all applications with <firstterm>message matching
1291 rules</firstterm> that match the message.
1294 Continuing the <literal>org.freedesktop.Peer.Ping</literal> example, if
1295 the ping message were sent with a <literal>srvc</literal> name of
1296 <literal>com.yoyodyne.Screensaver</literal>, then the ping would be
1297 forwarded, and the Yoyodyne Corporation screensaver application would be
1298 expected to reply to the ping. If
1299 <literal>org.freedesktop.Peer.Ping</literal> were sent to
1300 <literal>org.freedesktop.DBus.Broadcast</literal>, then multiple applications
1301 might receive the ping, and all would normally reply to it.
1305 <sect2 id="message-bus-services">
1306 <title>Message Bus Services</title>
1308 A service is a name that identifies a certain application. Each
1309 application connected to the message bus has at least one service name
1310 assigned at connection time and returned in response to the
1311 <literal>org.freedesktop.DBus.Hello</literal> message.
1312 This automatically-assigned service name is called
1313 the application's <firstterm>base service</firstterm>.
1314 Base service names are unique and MUST never be reused for two different
1318 Ownership of the base service is a prerequisite for interaction with
1319 the message bus. It logically follows that the base service is always
1320 the first service that an application comes to own, and the last
1321 service that it loses ownership of.
1324 Base service names must begin with the character ':' (ASCII colon
1325 character); service names that are not base service names must not begin
1326 with this character. (The bus must reject any attempt by an application
1327 to manually create a service name beginning with ':'.) This restriction
1328 categorically prevents "spoofing"; messages sent to a base service name
1329 will always go to a single application instance and that instance only.
1332 An application can request additional service names to be associated
1334 <literal>org.freedesktop.DBus.AcquireService</literal>
1335 message. [FIXME what service names are allowed; ASCII or unicode;
1339 [FIXME this needs more detail, and should move the service-related message
1340 descriptions up into this section perhaps]
1341 Service ownership handling can be specified in the flags part
1342 of the <literal>org.freedesktop.DBus.AcquireService</literal>
1343 message. If an application specifies the
1344 DBUS_SERVICE_FLAGS_PROHIBIT_REPLACEMENT flag, then all applications
1345 trying to acquire the service will be put in a queue. When the
1346 primary owner disconnects from the bus or removes ownership
1347 from the service, the next application in the queue will be the
1348 primary owner. If the DBUS_SERVICE_FLAGS_PROHIBIT_REPLACEMENT
1349 flag is not specified, then the primary owner will lose
1350 ownership whenever another application requests ownership of the
1354 When a client disconnects from the bus, all the services that
1355 the clients own are deleted, or in the case of a service that
1356 prohibits replacement, ownership is transferred to the next
1357 client in the queue, if any.
1360 <sect2 id="message-bus-routing">
1361 <title>Message Bus Message Routing</title>
1363 When a message is received by the message bus, the message's
1364 <literal>sndr</literal> header field MUST be set to the base service of
1365 the application which sent the message. If the service already has
1366 a <literal>sndr</literal> field, the pre-existing field is replaced.
1367 This rule means that a replies are always sent to the base service name,
1368 i.e. to the same application that sent the message being replied to.
1371 [FIXME go into detail about broadcast, multicast, unicast, etc.]
1374 <sect2 id="message-bus-activation">
1375 <title>Message Bus Service Activation</title>
1377 <firstterm>Activation</firstterm> means to locate a service
1378 owner for a service that is currently unowned. For now, it
1379 means to launch an executable that will take ownership of
1380 a particular service.
1383 To find an executable corresponding to a particular service, the bus
1384 daemon looks for <firstterm>service description files</firstterm>.
1385 Service description files define a mapping from service names to
1386 executables. Different kinds of message bus will look for these files
1387 in different places, see <xref linkend="message-bus-types">.
1390 [FIXME the file format should be much better specified than
1391 "similar to .desktop entries" esp. since desktop entries are
1392 already badly-specified. ;-)] Service description files have
1393 the ".service" file extension. The message bus will only load
1394 service description files ending with .service; all other
1395 files will be ignored. The file format is similar to that of
1397 url="http://www.freedesktop.org/standards/desktop-entry-spec/desktop-entry-spec.html">desktop
1398 entries</ulink>. All service description files must be in
1399 UTF-8 encoding. To ensure that there will be no name
1400 collisions, service files must be namespaced using the same
1401 mechanism as messages and service names.
1404 <title>Example service description file</title>
1406 # Sample service description file
1408 Name=org.gnome.ConfigurationDatabase
1409 Exec=/usr/libexec/gconfd-2
1414 When an application requests a service to be activated, the
1415 bus daemon tries to find it in the list of activation
1416 entries. It then tries to spawn the executable associated with
1417 it. If this fails, it will report an error. [FIXME what
1418 happens if two .service files offer the same service; what
1419 kind of error is reported, should we have a way for the client
1423 The executable launched will have the environment variable
1424 <literal>DBUS_ACTIVATION_ADDRESS</literal> set to the address of the
1425 message bus so it can connect and register the appropriate services.
1428 The executable being launched may want to know whether the message bus
1429 activating it is one of the well-known message buses (see <xref
1430 linkend="message-bus-types">). To facilitate this, the bus MUST also set
1431 the <literal>DBUS_ACTIVATION_BUS_TYPE</literal> environment variable if it is one
1432 of the well-known buses. The currently-defined values for this variable
1433 are <literal>system</literal> for the systemwide message bus,
1434 and <literal>session</literal> for the per-login-session message
1435 bus. The activated executable must still connect to the address given
1436 in <literal>DBUS_ACTIVATION_ADDRESS</literal>, but may assume that the
1437 resulting connection is to the well-known bus.
1440 [FIXME there should be a timeout somewhere, either specified
1441 in the .service file, by the client, or just a global value
1442 and if the client being activated fails to connect within that
1443 timeout, an error should be sent back.]
1447 <sect2 id="message-bus-types">
1448 <title>Well-known Message Bus Instances</title>
1450 Two standard message bus instances are defined here, along with how
1451 to locate them and where their service files live.
1453 <sect3 id="message-bus-types-login">
1454 <title>Login session message bus</title>
1456 Each time a user logs in, a <firstterm>login session message
1457 bus</firstterm> may be started. All applications in the user's login
1458 session may interact with one another using this message bus.
1461 The address of the login session message bus is given
1462 in the <literal>DBUS_SESSION_BUS_ADDRESS</literal> environment
1463 variable. If that variable is not set, applications may
1464 also try to read the address from the X Window System root
1465 window property <literal>_DBUS_SESSION_BUS_ADDRESS</literal>.
1466 The root window property must have type <literal>STRING</literal>.
1467 The environment variable should have precedence over the
1468 root window property.
1471 [FIXME specify location of .service files, probably using
1472 DESKTOP_DIRS etc. from basedir specification, though login session
1473 bus is not really desktop-specific]
1476 <sect3 id="message-bus-types-system">
1477 <title>System message bus</title>
1479 A computer may have a <firstterm>system message bus</firstterm>,
1480 accessible to all applications on the system. This message bus may be
1481 used to broadcast system events, such as adding new hardware devices,
1482 changes in the printer queue, and so forth.
1485 The address of the login session message bus is given
1486 in the <literal>DBUS_SYSTEM_BUS_ADDRESS</literal> environment
1487 variable. If that variable is not set, applications should try
1488 to connect to the well-known address
1489 <literal>unix:path=/var/run/dbus/system_bus_socket</literal>.
1492 The D-BUS reference implementation actually honors the
1493 <literal>$(localstatedir)</literal> configure option
1494 for this address, on both client and server side.
1499 [FIXME specify location of system bus .service files]
1504 <sect2 id="message-bus-messages">
1505 <title>Message Bus Messages</title>
1507 The special message bus service <literal>org.freedesktop.DBus</literal>
1508 responds to a number of messages, allowing applications to
1509 interact with the message bus.
1512 <sect3 id="bus-messages-hello">
1513 <title><literal>org.freedesktop.DBus.Hello</literal></title>
1524 <entry>Argument</entry>
1526 <entry>Description</entry>
1532 <entry>STRING</entry>
1533 <entry>Name of the service assigned to the application</entry>
1540 Before an application is able to send messages to other
1541 applications it must send the
1542 <literal>org.freedesktop.DBus.Hello</literal> message to the
1543 message bus service. If an application tries to send a
1544 message to another application, or a message to the message
1545 bus service that isn't the
1546 <literal>org.freedesktop.DBus.Hello</literal> message, it
1547 will be disconnected from the bus. If a client wishes to
1548 disconnect from the bus, it just has to disconnect from the
1549 transport used. No de-registration message is necessary.
1552 The reply message contains the name of the application's base service.
1555 <sect3 id="bus-messages-list-services">
1556 <title><literal>org.freedesktop.DBus.ListServices</literal></title>
1560 STRING_ARRAY ListServices ()
1567 <entry>Argument</entry>
1569 <entry>Description</entry>
1575 <entry>STRING_ARRAY</entry>
1576 <entry>Array of strings where each string is the name of a service</entry>
1583 Returns a list of all existing services registered with the message bus.
1586 <sect3 id="bus-messages-service-exists">
1587 <title><literal>org.freedesktop.DBus.ServiceExists</literal></title>
1591 BOOLEAN ServiceExists (in STRING service_name)
1598 <entry>Argument</entry>
1600 <entry>Description</entry>
1606 <entry>STRING</entry>
1607 <entry>Name of the service</entry>
1617 <entry>Argument</entry>
1619 <entry>Description</entry>
1625 <entry>BOOLEAN</entry>
1626 <entry>Return value, true if the service exists</entry>
1633 Checks if a service with a specified name exists.
1637 <sect3 id="bus-messages-acquire-service">
1638 <title><literal>org.freedesktop.DBus.AcquireService</literal></title>
1642 UINT32 AcquireService (in STRING service_name)
1649 <entry>Argument</entry>
1651 <entry>Description</entry>
1657 <entry>STRING</entry>
1658 <entry>Name of the service</entry>
1662 <entry>UINT32</entry>
1663 <entry>Flags</entry>
1673 <entry>Argument</entry>
1675 <entry>Description</entry>
1681 <entry>UINT32</entry>
1682 <entry>Return value</entry>
1689 Tries to become owner of a specific service. The flags
1690 specified can be the following values logically ORed together:
1696 <entry>Identifier</entry>
1697 <entry>Value</entry>
1698 <entry>Description</entry>
1703 <entry>DBUS_SERVICE_FLAGS_PROHIBIT_REPLACEMENT</entry>
1706 If the application succeeds in being the owner of the specified service,
1707 then ownership of the service can't be transferred until the service
1708 disconnects. If this flag is not set, then any application trying to become
1709 the owner of the service will succeed and the previous owner will be
1710 sent a <literal>org.freedesktop.DBus.ServiceLost</literal> message.
1714 <entry>DBUS_SERVICE_FLAGS_REPLACE_EXISTING</entry>
1716 <entry>Try to replace the current owner if there is one. If this flag
1717 is not set the application will only become the owner of the service if
1718 there is no current owner.</entry>
1724 [FIXME if it's one of the following values, why are the values
1725 done as flags instead of just 0, 1, 2, 3, 4]
1726 The return value can be one of the following values:
1732 <entry>Identifier</entry>
1733 <entry>Value</entry>
1734 <entry>Description</entry>
1739 <entry>DBUS_SERVICE_REPLY_PRIMARY_OWNER</entry>
1741 <entry>The application is now the primary owner of the service.</entry>
1744 <entry>DBUS_SERVICE_REPLY_IN_QUEUE</entry>
1746 <entry>The service already has an owner which do not want to give up ownership and therefore the application has been put in a queue.</entry>
1749 <entry>DBUS_SERVICE_REPLY_SERVICE_EXISTS</entry>
1751 <entry>The service does already have a primary owner, and DBUS_SERVICE_FLAG_REPLACE_EXISTING was not specified when trying to acquire the service.</entry>
1754 <entry>DBUS_SERVICE_REPLY_ALREADY_OWNER</entry>
1756 <entry>The application trying to request ownership of the service is already the owner of it.</entry>
1763 <sect3 id="bus-messages-service-acquired">
1764 <title><literal>org.freedesktop.DBus.ServiceAcquired</literal></title>
1768 ServiceAcquired (in STRING service_name)
1775 <entry>Argument</entry>
1777 <entry>Description</entry>
1783 <entry>STRING</entry>
1784 <entry>Name of the service</entry>
1788 <entry>UINT32</entry>
1789 <entry>Flags</entry>
1796 This message is sent to a specific application when it becomes the
1797 primary owner of a service.
1800 <sect3 id="bus-messages-service-lost">
1801 <title><literal>org.freedesktop.DBus.ServiceLost</literal></title>
1805 ServiceLost (in STRING service_name)
1812 <entry>Argument</entry>
1814 <entry>Description</entry>
1820 <entry>STRING</entry>
1821 <entry>Name of the service</entry>
1825 <entry>UINT32</entry>
1826 <entry>Flags</entry>
1833 This message is sent to a specific application when it loses primary
1834 ownership of a service.
1836 [FIXME instead of ServiceLost/ServiceCreated going only to
1837 a specific app, why not just OwnerChanged that covers both
1838 lost and created and changed owner and deleted]
1842 <sect3 id="bus-messages-service-created">
1843 <title><literal>org.freedesktop.DBus.ServiceCreated</literal></title>
1847 ServiceCreated (in STRING service_name)
1854 <entry>Argument</entry>
1856 <entry>Description</entry>
1862 <entry>STRING</entry>
1863 <entry>Name of the service</entry>
1867 <entry>UINT32</entry>
1868 <entry>Flags</entry>
1875 This message is broadcast to all applications when a service has been
1876 successfully registered on the message bus.
1880 <sect3 id="bus-messages-service-deleted">
1881 <title><literal>org.freedesktop.DBus.ServiceDeleted</literal></title>
1885 ServiceDeleted (in STRING service_name)
1892 <entry>Argument</entry>
1894 <entry>Description</entry>
1900 <entry>STRING</entry>
1901 <entry>Name of the service</entry>
1905 <entry>UINT32</entry>
1906 <entry>Flags</entry>
1913 This message is broadcast to all applications when a service has been
1914 deleted from the message bus.
1918 <sect3 id="bus-messages-activate-service">
1919 <title><literal>org.freedesktop.DBus.ActivateService</literal></title>
1923 UINT32 ActivateService (in STRING service_name, in UINT32 flags)
1930 <entry>Argument</entry>
1932 <entry>Description</entry>
1938 <entry>STRING</entry>
1939 <entry>Name of the service to activate</entry>
1943 <entry>UINT32</entry>
1944 <entry>Flags (currently not used)</entry>
1954 <entry>Argument</entry>
1956 <entry>Description</entry>
1962 <entry>UINT32</entry>
1963 <entry>Result code; DBUS_ACTIVATION_REPLY_ACTIVATED if
1964 the service was activated successfully or
1965 DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE if the service is
1966 already active.</entry>
1973 Tries to launch the executable associated with a service. For more information, see <xref linkend="message-bus-activation">.
1975 [FIXME need semantics in much more detail here; for example,
1976 if I activate a service then send it a message, is the message
1977 queued for the new service or is there a race]
1981 <sect3 id="bus-messages-out-of-memory">
1982 <title><literal>org.freedesktop.DBus.Error.NoMemory</literal></title>
1990 Sent by the message bus when it can't process a message due to an out of memory failure.
1994 <sect3 id="bus-messages-service-does-not-exist">
1995 <title><literal>org.freedesktop.DBus.Error.ServiceDoesNotExist</literal></title>
1999 void ServiceDoesNotExist (in STRING error)
2003 Sent by the message bus as a reply to a client that tried to send a message to a service that doesn't exist.
2010 <appendix id="implementation-notes">
2011 <title>Implementation notes</title>
2012 <sect1 id="implementation-notes-subsection">
2020 <glossary><title>Glossary</title>
2022 This glossary defines some of the terms used in this specification.
2025 <glossentry id="term-activation"><glossterm>Activation</glossterm>
2028 The process of creating an owner for a particular service,
2029 typically by launching an executable.
2034 <glossentry id="term-base-service"><glossterm>Base Service</glossterm>
2037 The special service automatically assigned to an application by the
2038 message bus. This service may never change owner, and the service
2039 name will be unique (never reused during the lifetime of the
2045 <glossentry id="term-broadcast"><glossterm>Broadcast</glossterm>
2048 A message sent to the special <literal>org.freedesktop.DBus.Broadcast</literal>
2049 service; the message bus will forward the broadcast message
2050 to all applications that have expressed interest in it.
2055 <glossentry id="term-message"><glossterm>Message</glossterm>
2058 A message is the atomic unit of communication via the D-BUS
2059 protocol. It consists of a <firstterm>header</firstterm> and a
2060 <firstterm>body</firstterm>; the body is made up of
2061 <firstterm>arguments</firstterm>.
2066 <glossentry id="term-message-bus"><glossterm>Message Bus</glossterm>
2069 The message bus is a special application that forwards
2070 or broadcasts messages between a group of applications
2071 connected to the message bus. It also manages
2072 <firstterm>services</firstterm>.
2077 <glossentry id="namespace"><glossterm>Namespace</glossterm>
2080 Used to prevent collisions when defining message and service
2081 names. The convention used is the same as Java uses for
2082 defining classes: a reversed domain name.
2087 <glossentry id="term-object"><glossterm>Object</glossterm>
2090 Each application contains <firstterm>objects</firstterm>,
2091 which have <firstterm>interfaces</firstterm> and
2092 <firstterm>methods</firstterm>. Objects are referred to
2093 by a name, called a <firstterm>path</firstterm> or
2094 <firstterm>object reference</firstterm>.
2099 <glossentry id="term-path"><glossterm>Path</glossterm>
2102 Object references (object names) in D-BUS are
2103 organized into a filesystem-style hierarchy, so
2104 each object is named by a path. As in LDAP,
2105 there's no difference between "files" and "directories";
2106 a path can refer to an object, while still having
2107 child objects below it.
2112 <glossentry id="peer-to-peer"><glossterm>Peer-to-peer</glossterm>
2115 An application talking directly to another application, without going through a message bus.
2119 <glossentry id="term-secondary-owner"><glossterm>Secondary service owner</glossterm>
2122 Each service has a primary owner; messages sent to the service name
2123 go to the primary owner. However, certain services also maintain
2124 a queue of secondary owners "waiting in the wings." If
2125 the primary owner releases the service, then the first secondary
2126 owner in the queue automatically becomes the primary owner.
2130 <glossentry id="term-service"><glossterm>Service</glossterm>
2133 A service is simply a named list of applications. For example, the
2134 hypothetical <literal>com.yoyodyne.Screensaver</literal> service might
2135 accept messages that affect a screensaver from Yoyodyne Corporation.
2136 An application is said to <firstterm>own</firstterm> a service if the
2137 message bus has associated the application with the service name.
2138 Services may also have <firstterm>secondary owners</firstterm> (see
2139 <xref linkend="term-secondary-owner">).
2143 <glossentry id="term-service-name"><glossterm>Service name</glossterm>
2146 The name used when referring to a service. If the service is
2147 a base service it has a unique service name, for example
2148 ":1-20", and otherwise it should be namespaced.
2152 <glossentry id="term-service-description-files"><glossterm>Service Description Files</glossterm>
2155 ".service files" tell the bus how to activate a particular service.
2156 See <xref linkend="term-activation">