1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
9 <title>D-BUS Specification</title>
10 <releaseinfo>Version 0.8</releaseinfo>
11 <date>06 September 2003</date>
14 <firstname>Havoc</firstname>
15 <surname>Pennington</surname>
17 <orgname>Red Hat, Inc.</orgname>
19 <email>hp@pobox.com</email>
24 <firstname>Anders</firstname>
25 <surname>Carlsson</surname>
27 <orgname>CodeFactory AB</orgname>
29 <email>andersca@codefactory.se</email>
34 <firstname>Alexander</firstname>
35 <surname>Larsson</surname>
37 <orgname>Red Hat, Inc.</orgname>
39 <email>alexl@redhat.com</email>
46 <sect1 id="introduction">
47 <title>Introduction</title>
49 D-BUS is a system for low-latency, low-overhead, easy to use
50 interprocess communication (IPC). In more detail:
54 D-BUS is <emphasis>low-latency</emphasis> because it is designed
55 to avoid round trips and allow asynchronous operation, much like
61 D-BUS is <emphasis>low-overhead</emphasis> because it uses a
62 binary protocol, and does not have to convert to and from a text
63 format such as XML. Because D-BUS is intended for potentially
64 high-resolution same-machine IPC, not primarily for Internet IPC,
65 this is an interesting optimization.
70 D-BUS is <emphasis>easy to use</emphasis> because it works in terms
71 of <firstterm>messages</firstterm> rather than byte streams, and
72 automatically handles a lot of the hard IPC issues. Also, the D-BUS
73 library is designed to be wrapped in a way that lets developers use
74 their framework's existing object/type system, rather than learning
75 a new one specifically for IPC.
81 The base D-BUS protocol is a peer-to-peer protocol, specified in <xref
82 linkend="message-protocol"/>. That is, it is a system for one application
83 to talk to a single other application. However, the primary intended
84 application of D-BUS is the D-BUS <firstterm>message bus</firstterm>,
85 specified in <xref linkend="message-bus"/>. The message bus is a special
86 application that accepts connections from multiple other applications, and
87 forwards messages among them.
90 Uses of D-BUS include notification of system changes (notification of when
91 a camera is plugged in to a computer, or a new version of some software
92 has been installed), or desktop interoperablity, for example a file
93 monitoring service or a configuration service.
97 <sect1 id="message-protocol">
98 <title>Message Protocol</title>
100 A <firstterm>message</firstterm> consists of a
101 <firstterm>header</firstterm> and a <firstterm>body</firstterm>. If you
102 think of a message as a package, the header is the address, and the body
103 contains the package contents. The message delivery system uses the header
104 information to figure out where to send the message and how to interpret
105 it; the recipient inteprets the body of the message.
109 The body of the message is made up of zero or more
110 <firstterm>arguments</firstterm>, which are typed
111 values, such as an integer or a byte array.
114 <sect2 id="message-protocol-header-encoding">
115 <title>Header Encoding</title>
117 Following the mandatory fields, there are zero or more named fields (see
118 <xref linkend="message-protocol-header-fields"/>), and then nul bytes
119 padding the header such that its total length in bytes is a multiple of
123 The header MUST begin with the following mandatory fields in the following
130 <entry>Description</entry>
135 <entry>1 byte</entry>
136 <entry>Endianness flag; ASCII 'l' for little-endian
137 or ASCII 'B' for big-endian.</entry>
140 <entry>1 byte</entry>
141 <entry>Type of message. Unknown types MUST be ignored.
142 Currently-defined types are described below.
146 <entry>1 byte</entry>
147 <entry>Bitwise OR of flags. Unknown flags
148 MUST be ignored. Currently-defined flags are described below.
152 <entry>1 byte</entry>
153 <entry>Major protocol version of the sending application. If
154 the major protocol version of the receiving application does not
155 match, the applications will not be able to communicate and the
156 D-BUS connection MUST be disconnected. The major protocol
157 version for this version of the specification is 0.
161 <entry>4 bytes</entry>
162 <entry>An unsigned 32-bit integer in the
163 message's byte order, indicating the total length in bytes of
164 the header including named fields and any alignment padding.
165 MUST be a multiple of 8.
169 <entry>4 bytes</entry>
170 <entry>An unsigned 32-bit integer in the
171 message's byte order, indicating the total length in bytes of
176 <entry>4 bytes</entry>
177 <entry>The message's serial number, an unsigned 32-bit integer in
178 the message's byte order. The serial number is a cookie used to
179 identify message replies; thus all outstanding unreplied-to messages
180 from the same connection MUST have a different serial number.
181 Zero is not a valid serial number, but all other numbers are
190 Types that can appear in the second byte of the header:
195 <entry>Conventional name</entry>
196 <entry>Decimal value</entry>
197 <entry>Description</entry>
202 <entry>INVALID</entry>
204 <entry>This is an invalid type, if seen in a message
205 the connection should be dropped immediately.</entry>
208 <entry>METHOD_CALL</entry>
210 <entry>Method call.</entry>
213 <entry>METHOD_RETURN</entry>
215 <entry>Method reply with returned data.</entry>
220 <entry>Error reply. If the first argument exists and is a
221 string, it is an error message.</entry>
224 <entry>SIGNAL</entry>
226 <entry>Signal emission.</entry>
233 Flags that can appear in the third byte of the header:
238 <entry>Conventional name</entry>
239 <entry>Hex value</entry>
240 <entry>Description</entry>
245 <entry>NO_REPLY_EXPECTED</entry>
247 <entry>This message does not expect method return replies or
248 error replies; the reply can be omitted as an
249 optimization. However, it is compliant with this specification
250 to return the reply despite this flag.</entry>
258 <sect2 id="message-protocol-header-fields">
259 <title>Header Fields</title>
261 In addition to the required header information mentioned
262 in <xref linkend="message-protocol-header-encoding"/>,
263 the header may contain zero or more named
264 header fields. Future versions of this protocol
265 specification may add new fields. Implementations must
266 ignore fields they do not understand. Implementations
267 must not invent their own header fields; only changes to
268 this specification may introduce new header fields.
272 Header field names MUST consist of a single byte, possible values
273 of which are defined below. Following the name, the field MUST have
274 a type code represented as a single unsigned byte, and then a
275 properly-aligned value of that type. See <xref
276 linkend="message-protocol-arguments"/> for a description of how each
277 type is encoded. If an implementation sees a header field name that
278 it does not understand, it MUST ignore that field.
282 Here are the currently-defined named header fields:
287 <entry>Conventional Name</entry>
288 <entry>Decimal Value</entry>
290 <entry>Description</entry>
295 <entry>INVALID</entry>
297 <entry>INVALID</entry>
298 <entry>Not a valid field name (error if it appears in a message)</entry>
303 <entry>STRING</entry>
304 <entry>The object to send the message to; objects are identified by
305 a path, "/foo/bar"</entry>
308 <entry>INTERFACE</entry>
310 <entry>STRING</entry>
311 <entry>The interface to invoke a method call on, or
312 that a signal is emitted from. e.g. "org.freedesktop.Introspectable"</entry>
315 <entry>MEMBER</entry>
317 <entry>STRING</entry>
318 <entry>The member, either the method name or signal name.
319 e.g. "Frobate"</entry>
322 <entry>ERROR_NAME</entry>
324 <entry>STRING</entry>
325 <entry>The name of the error that occurred, for errors</entry>
328 <entry>REPLY_SERIAL</entry>
330 <entry>UINT32</entry>
331 <entry>The serial number of the message this message is a reply
332 to. (The serial number is one of the mandatory header fields,
333 see <xref linkend="message-protocol-header-encoding"/>.)</entry>
336 <entry>SERVICE</entry>
338 <entry>STRING</entry>
339 <entry>The name of the service this message should be routed to.
340 Only used in combination with the message bus, see
341 <xref linkend="message-bus"/>.</entry>
344 <entry>SENDER_SERVICE</entry>
346 <entry>STRING</entry>
347 <entry>Sender service. The name of the base service that sent
348 this message. The message bus fills in this field; the field is
349 only meaningful in combination with the message bus.</entry>
357 <sect2 id="message-protocol-header-padding">
358 <title>Header Alignment Padding</title>
360 To allow implementations to keep the header and the body in a single
361 buffer while keeping data types aligned, the total length of the header
362 must be a multiple of 8 bytes. To achieve this, the header MUST be padded
363 with nul bytes to align its total length on an 8-byte boundary.
364 The minimum number of padding bytes MUST be used. Because zero is an
365 invalid field name, implementations can distinguish padding (which must be
366 zero initialized) from additional named fields.
370 <sect2 id="message-protocol-arguments">
371 <title>Message Arguments</title>
373 The message body is made up of arguments. Each argument is a type code,
374 represented by a single unsigned byte, followed by the aligned value of
375 the argument in a type-dependent format. Alignment padding between the
376 typecode and the value is initialized to zero.
383 <entry>Type name</entry>
385 <entry>Description</entry>
390 <entry>INVALID</entry>
392 <entry>Not a valid type code (error if it appears in a message)</entry>
396 <entry>Marks an "unset" or "nonexistent" argument</entry>
400 <entry>8-bit unsigned integer</entry>
402 <entry>BOOLEAN</entry>
404 <entry>Boolean value, 0 is FALSE and 1 is TRUE. Everything else is invalid.</entry>
408 <entry>32-bit signed integer</entry>
410 <entry>UINT32</entry>
412 <entry>32-bit unsigned integer</entry>
416 <entry>64-bit signed integer</entry>
418 <entry>UINT64</entry>
420 <entry>64-bit unsigned integer</entry>
422 <entry>DOUBLE</entry>
424 <entry>IEEE 754 double</entry>
426 <entry>STRING</entry>
428 <entry>UTF-8 string (<emphasis>must</emphasis> be valid UTF-8). Must be zero terminated. </entry>
432 <entry>A named byte array, used for custom types</entry>
440 <entry>A dictionary of key/value pairs</entry>
447 The types are encoded as follows:
452 <entry>Type name</entry>
453 <entry>Encoding</entry>
458 <entry>INVALID</entry>
459 <entry>Not applicable; cannot be encoded.</entry>
462 <entry>No data is encoded; the type code is followed immediately
463 by the type code of the next argument.</entry>
466 <entry>A byte.</entry>
468 <entry>BOOLEAN</entry>
469 <entry>A byte, with valid values 0 and 1.</entry>
472 <entry>32-bit signed integer in the message's byte order, aligned to 4-byte boundary.</entry>
474 <entry>UINT32</entry>
475 <entry>32-bit unsigned integer in the message's byte order, aligned to 4-byte boundary.</entry>
478 <entry>64-bit signed integer in the message's byte order, aligned to 8-byte boundary.</entry>
480 <entry>UINT64</entry>
481 <entry>64-bit unsigned integer in the message's byte order, aligned to 8-byte boundary.</entry>
483 <entry>DOUBLE</entry>
484 <entry>64-bit IEEE 754 double in the message's byte order, aligned to 8-byte boundary.</entry>
486 <entry>STRING</entry>
487 <entry>UINT32 aligned to 4-byte boundary indicating the string's
488 length in bytes excluding its terminating nul, followed by
489 string data of the given length, followed by a terminating nul
494 <entry>A string (encoded as the STRING type above) giving the
495 name of the type followed by an UINT32 aligned to 4-byte boundary
496 indicating the data length in bytes, followed by the data.
500 <entry>A sequence of bytes giving the element type of the array, terminated
501 by a type different from ARRAY (just one byte for one-dimensional arrays, but
502 larger for multi-dimensional arrays), followed by an UINT32 (aligned to 4 bytes)
503 giving the length of the array data in bytes. This is followed by each array entry
504 encoded the way it would normally be encoded, except arrays, which are encoded
505 without the type information, since that is already declared above. Arrays containing
510 <entry>UINT32 giving the length of the dictionary data in bytes.
511 This is followed by a number of keyname/value pairs, where the
512 keyname is encoded as a STRING above, and the value is encoded
513 as a byte with typecode and how that type normally would be encoded
523 <sect2 id="message-protocol-names">
524 <title>Valid names</title>
526 The various header fields of type STRING have some restrictions
527 on the string's format.
529 <sect3 id="message-protocol-names-service">
530 <title>Service names</title>
532 Services have names with type STRING, meaning that
533 they must be valid UTF-8. However, there are also some
534 additional restrictions that apply to service names
537 <listitem><para>They must contain at least one '.' (period) character</para></listitem>
538 <listitem><para>They must not begin with a '.' (period) character</para></listitem>
539 <listitem><para>They must not exceed 256 bytes in length</para></listitem>
540 <listitem><para>They must be at least 1 byte in length</para></listitem>
543 As a special exception, base service names (those beginning with a colon
544 (':') character) need not contain a period.
547 FIXME really, shouldn't we ban basically everything non-alphanumeric
548 so the name will work in all programming languages?
551 <sect3 id="message-protocol-names-interface">
552 <title>Interface names</title>
554 Interface names have the same restrictions as service names,
555 but do not have the special exception for names beginning with
559 FIXME really, shouldn't we ban basically everything non-alphanumeric
560 so the name will work in all programming languages?
563 <sect3 id="message-protocol-names-method">
564 <title>Method names</title>
568 <listitem><para>May not contain the '.' (period) character</para></listitem>
569 <listitem><para>Must not exceed 256 bytes in length</para></listitem>
570 <listitem><para>Must be at least 1 byte in length</para></listitem>
574 FIXME really, shouldn't we ban basically everything non-alphanumeric
575 so the name will work in all programming languages?
578 <sect3 id="message-protocol-names-path">
579 <title>Path names</title>
581 A path must begin with an ASCII '/' (slash) character. Paths may not
582 end with a slash character unless the path is the one-byte string
583 "/". Two slash characters may not appear adjacent to one another (the
584 empty string is not a valid "subdirectory"). Paths may not exceed
588 <sect3 id="message-protocol-names-error">
589 <title>Error names</title>
591 Error names have the same restrictions as interface names.
594 FIXME really, shouldn't we ban basically everything non-alphanumeric
595 so the name will work in all programming languages?
600 <sect2 id="message-protocol-types">
601 <title>Message types</title>
603 Each of the message types (METHOD_CALL, METHOD_RETURN, ERROR, and
604 SIGNAL) has its own expected usage conventions and header fields.
606 <sect3 id="message-protocol-types-method">
607 <title>Method Calls, Returns, and Errors</title>
609 Some messages invoke an operation on a remote object. These are
610 called method call messages and have the type tag METHOD_CALL. Such
611 messages map naturally to methods on objects in a typical program.
614 A method call message is expected to have a MEMBER header field
615 indicating the name of the method. Optionally, the message has an
616 INTERFACE field giving the interface the method is a part of. In the
617 absence of an INTERFACE field, if two interfaces on the same object have
618 a method with the same name, it is undefined which of the two methods
619 will be invoked. Implementations may also choose to return an error in
620 this ambiguous case. However, if a method name is unique
621 implementations should not require an interface field.
624 Method call messages also include a PATH field indicating the
625 object to invoke the method on. If the call is passing through
626 a message bus, the message will also have a SERVICE field giving
627 the service to receive the message.
630 When an application handles a method call message, it is expected to
631 return a reply. The reply is identified by a REPLY_SERIAL header field
632 indicating the serial number of the METHOD_CALL being replied to. The
633 reply can have one of two types; either METHOD_RETURN or ERROR.
636 If the reply has type METHOD_RETURN, the arguments to the reply message
637 are the return value(s) or "out parameters" of the method call.
638 If the reply has type ERROR, then an "exception" has been thrown,
639 and the call fails; no return value will be provided. It makes
640 no sense to send multiple replies to the same method call.
643 Even if a method call has no return values, a METHOD_RETURN
644 reply is expected, so the caller will know the method
645 was successfully processed.
648 If a METHOD_CALL message has the flag NO_REPLY_EXPECTED,
649 then as an optimization the application receiving the method
650 call may choose to omit the reply message (regardless of
651 whether the reply would have been METHOD_RETURN or ERROR).
652 However, it is also acceptable to ignore the NO_REPLY_EXPECTED
653 flag and reply anyway.
655 <sect4 id="message-protocol-types-method-apis">
656 <title>Mapping method calls to native APIs</title>
658 APIs for D-BUS may map method calls to a method call in a specific
659 programming language, such as C++, or may map a method call written
660 in an IDL to a D-BUS message.
663 In APIs of this nature, arguments to a method are often termed "in"
664 (which implies sent in the METHOD_CALL), or "out" (which implies
665 returned in the METHOD_RETURN). Some APIs such as CORBA also have
666 "inout" arguments, which are both sent and received, i.e. the caller
667 passes in a value which is modified. Mapped to D-BUS, an "inout"
668 argument is equivalent to an "in" argument, followed by an "out"
669 argument. You can't pass things "by reference" over the wire, so
670 "inout" is purely an illusion of the in-process API.
673 Given a method with zero or one return values, followed by zero or more
674 arguments, where each argument may be "in", "out", or "inout", the
675 caller constructs a message by appending each "in" or "inout" argument,
676 in order. "out" arguments are not represented in the caller's message.
679 The recipient constructs a reply by appending first the return value
680 if any, then each "out" or "inout" argument, in order.
681 "in" arguments are not represented in the reply message.
687 <sect3 id="message-protocol-types-signal">
688 <title>Signal Emission</title>
690 Unlike method calls, signal emissions have no replies.
691 A signal emission is simply a single message of type SIGNAL.
692 It must have three header fields: PATH giving the object
693 the signal was emitted from, plus INTERFACE and MEMBER giving
694 the fully-qualified name of the signal.
698 <sect3 id="message-protocol-types-notation">
699 <title>Notation in this document</title>
701 This document uses a simple pseudo-IDL to describe particular method
702 calls and signals. Here is an example of a method call:
704 org.freedesktop.DBus.ActivateService (in STRING service_name, in UINT32 flags,
705 out UINT32 resultcode)
707 This means INTERFACE = org.freedesktop.DBus, MEMBER = ActivateService,
708 METHOD_CALL arguments are STRING and UINT32, METHOD_RETURN argument
709 is UINT32. Remember that the MEMBER field can't contain any '.' (period)
710 characters so it's known that the last part of the name in
711 the "IDL" is the member name.
714 In C++ that might end up looking like this:
716 unsigned int org::freedesktop::DBus::ActivateService (const char *service_name,
719 or equally valid, the return value could be done as an argument:
721 void org::freedesktop::DBus::ActivateService (const char *service_name,
723 unsigned int *resultcode);
725 It's really up to the API designer how they want to make
726 this look. You could design an API where the namespace wasn't used
727 in C++, using STL or Qt, using varargs, or whatever you wanted.
730 Signals are written as follows:
732 org.freedesktop.DBus.ServiceLost (STRING service_name)
734 Signals don't specify "in" vs. "out" because only
735 a single direction is possible.
738 In this ad hoc notation, the special type name ANY means any type
739 other than NIL, and the special type name ANY_OR_NIL means any valid
743 It isn't especially encouraged to use this lame pseudo-IDL in actual
744 API implementations; you might use the native notation for the
745 language you're using, or you might use COM or CORBA IDL, for example.
752 <sect1 id="auth-protocol">
753 <title>Authentication Protocol</title>
755 Before the flow of messages begins, two applications must
756 authenticate. A simple plain-text protocol is used for
757 authentication; this protocol is a SASL profile, and maps fairly
758 directly from the SASL specification. The message encoding is
759 NOT used here, only plain text messages.
762 In examples, "C:" and "S:" indicate lines sent by the client and
765 <sect2 id="auth-protocol-overview">
766 <title>Protocol Overview</title>
768 The protocol is a line-based protocol, where each line ends with
769 \r\n. Each line begins with an all-caps ASCII command name containing
770 only the character range [A-Z], a space, then any arguments for the
771 command, then the \r\n ending the line. The protocol is
772 case-sensitive. All bytes must be in the ASCII character set.
774 Commands from the client to the server are as follows:
777 <listitem><para>AUTH [mechanism] [initial-response]</para></listitem>
778 <listitem><para>CANCEL</para></listitem>
779 <listitem><para>BEGIN</para></listitem>
780 <listitem><para>DATA <data in base 64 encoding></para></listitem>
781 <listitem><para>ERROR [human-readable error explanation]</para></listitem>
784 From server to client are as follows:
787 <listitem><para>REJECTED <space-separated list of mechanism names></para></listitem>
788 <listitem><para>OK</para></listitem>
789 <listitem><para>DATA <data in base 64 encoding></para></listitem>
790 <listitem><para>ERROR</para></listitem>
794 <sect2 id="auth-nul-byte">
795 <title>Special credentials-passing nul byte</title>
797 Immediately after connecting to the server, the client must send a
798 single nul byte. This byte may be accompanied by credentials
799 information on some operating systems that use sendmsg() with
800 SCM_CREDS or SCM_CREDENTIALS to pass credentials over UNIX domain
801 sockets. However, the nul byte MUST be sent even on other kinds of
802 socket, and even on operating systems that do not require a byte to be
803 sent in order to transmit credentials. The text protocol described in
804 this document begins after the single nul byte. If the first byte
805 received from the client is not a nul byte, the server may disconnect
809 A nul byte in any context other than the initial byte is an error;
810 the protocol is ASCII-only.
813 The credentials sent along with the nul byte may be used with the
814 SASL mechanism EXTERNAL.
817 <sect2 id="auth-command-auth">
818 <title>AUTH command</title>
820 If an AUTH command has no arguments, it is a request to list
821 available mechanisms. The server SHOULD respond with a REJECTED
822 command listing the mechanisms it understands.
825 If an AUTH command specifies a mechanism, and the server supports
826 said mechanism, the server SHOULD begin exchanging SASL
827 challenge-response data with the client using DATA commands.
830 If the server does not support the mechanism given in the AUTH
831 command, it SHOULD send a REJECTED command listing the mechanisms
835 If the [initial-response] argument is provided, it is intended for
836 use with mechanisms that have no initial challenge (or an empty
837 initial challenge), as if it were the argument to an initial DATA
838 command. If the selected mechanism has an initial challenge, the
839 server should reject authentication by sending REJECTED.
842 If authentication succeeds after exchanging DATA commands,
843 an OK command should be sent to the client.
846 The first octet received by the client after the \r\n of the OK
847 command MUST be the first octet of the authenticated/encrypted
848 stream of D-BUS messages.
851 The first octet received by the server after the \r\n of the BEGIN
852 command from the client MUST be the first octet of the
853 authenticated/encrypted stream of D-BUS messages.
856 <sect2 id="auth-command-cancel">
857 <title>CANCEL Command</title>
859 At any time up to sending the BEGIN command, the client may send a
860 CANCEL command. On receiving the CANCEL command, the server MUST
861 send a REJECTED command and abort the current authentication
865 <sect2 id="auth-command-data">
866 <title>DATA Command</title>
868 The DATA command may come from either client or server, and simply
869 contains a base64-encoded block of data to be interpreted
870 according to the SASL mechanism in use.
873 Some SASL mechanisms support sending an "empty string";
874 FIXME we need some way to do this.
877 <sect2 id="auth-command-begin">
878 <title>BEGIN Command</title>
880 The BEGIN command acknowledges that the client has received an
881 OK command from the server, and that the stream of messages
885 The first octet received by the server after the \r\n of the BEGIN
886 command from the client MUST be the first octet of the
887 authenticated/encrypted stream of D-BUS messages.
890 <sect2 id="auth-command-rejected">
891 <title>REJECTED Command</title>
893 The REJECTED command indicates that the current authentication
894 exchange has failed, and further exchange of DATA is inappropriate.
895 The client would normally try another mechanism, or try providing
896 different responses to challenges.
898 Optionally, the REJECTED command has a space-separated list of
899 available auth mechanisms as arguments. If a server ever provides
900 a list of supported mechanisms, it MUST provide the same list
901 each time it sends a REJECTED message. Clients are free to
902 ignore all lists received after the first.
905 <sect2 id="auth-command-ok">
906 <title>OK Command</title>
908 The OK command indicates that the client has been authenticated,
909 and that further communication will be a stream of D-BUS messages
910 (optionally encrypted, as negotiated) rather than this protocol.
913 The first octet received by the client after the \r\n of the OK
914 command MUST be the first octet of the authenticated/encrypted
915 stream of D-BUS messages.
918 The client MUST respond to the OK command by sending a BEGIN
919 command, followed by its stream of messages, or by disconnecting.
920 The server MUST NOT accept additional commands using this protocol
921 after the OK command has been sent.
924 <sect2 id="auth-command-error">
925 <title>ERROR Command</title>
927 The ERROR command indicates that either server or client did not
928 know a command, does not accept the given command in the current
929 context, or did not understand the arguments to the command. This
930 allows the protocol to be extended; a client or server can send a
931 command present or permitted only in new protocol versions, and if
932 an ERROR is received instead of an appropriate response, fall back
933 to using some other technique.
936 If an ERROR is sent, the server or client that sent the
937 error MUST continue as if the command causing the ERROR had never been
938 received. However, the the server or client receiving the error
939 should try something other than whatever caused the error;
940 if only canceling/rejecting the authentication.
943 <sect2 id="auth-examples">
944 <title>Authentication examples</title>
948 <title>Example of successful magic cookie authentication</title>
950 (MAGIC_COOKIE is a made up mechanism)
952 C: AUTH MAGIC_COOKIE BsAY3g4gBNo=
958 <title>Example of finding out mechanisms then picking one</title>
961 S: REJECTED KERBEROS_V4 SKEY
962 C: AUTH SKEY bW9yZ2Fu
963 S: DATA OTUgUWE1ODMwOA==
964 C: DATA Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
970 <title>Example of client sends unknown command then falls back to regular auth</title>
974 C: AUTH MAGIC_COOKIE BsAY3g4gBNo=
980 <title>Example of server doesn't support initial auth mechanism</title>
982 C: AUTH MAGIC_COOKIE BsAY3g4gBNo=
983 S: REJECTED KERBEROS_V4 SKEY
984 C: AUTH SKEY bW9yZ2Fu
985 S: DATA OTUgUWE1ODMwOA==
986 C: DATA Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
992 <title>Example of wrong password or the like followed by successful retry</title>
994 C: AUTH MAGIC_COOKIE BsAY3g4gBNo=
995 S: REJECTED KERBEROS_V4 SKEY
996 C: AUTH SKEY bW9yZ2Fu
997 S: DATA OTUgUWE1ODMwOA==
998 C: DATA Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
1000 C: AUTH SKEY bW9yZ2Fu
1001 S: DATA OTUgUWE1ODMwOA==
1002 C: DATA Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
1008 <title>Example of skey cancelled and restarted</title>
1010 C: AUTH MAGIC_COOKIE BsAY3g4gBNo=
1011 S: REJECTED KERBEROS_V4 SKEY
1012 C: AUTH SKEY bW9yZ2Fu
1013 S: DATA OTUgUWE1ODMwOA==
1016 C: AUTH SKEY bW9yZ2Fu
1017 S: DATA OTUgUWE1ODMwOA==
1018 C: DATA Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA==
1025 <sect2 id="auth-states">
1026 <title>Authentication state diagrams</title>
1032 <sect2 id="auth-mechanisms">
1033 <title>Authentication mechanisms</title>
1035 This section describes some new authentication mechanisms.
1036 D-BUS also allows any standard SASL mechanism of course.
1038 <sect3 id="auth-mechanisms-sha">
1039 <title>DBUS_COOKIE_SHA1</title>
1041 The DBUS_COOKIE_SHA1 mechanism is designed to establish that a client
1042 has the ability to read a private file owned by the user being
1043 authenticated. If the client can prove that it has access to a secret
1044 cookie stored in this file, then the client is authenticated.
1045 Thus the security of DBUS_COOKIE_SHA1 depends on a secure home
1049 Authentication proceeds as follows:
1053 The client sends the username it would like to authenticate
1059 The server sends the name of its "cookie context" (see below); a
1060 space character; the integer ID of the secret cookie the client
1061 must demonstrate knowledge of; a space character; then a
1062 hex-encoded randomly-generated challenge string.
1067 The client locates the cookie, and generates its own hex-encoded
1068 randomly-generated challenge string. The client then
1069 concatentates the server's hex-encoded challenge, a ":"
1070 character, its own hex-encoded challenge, another ":" character,
1071 and the hex-encoded cookie. It computes the SHA-1 hash of this
1072 composite string. It sends back to the server the client's
1073 hex-encoded challenge string, a space character, and the SHA-1
1079 The server generates the same concatenated string used by the
1080 client and computes its SHA-1 hash. It compares the hash with
1081 the hash received from the client; if the two hashes match, the
1082 client is authenticated.
1088 Each server has a "cookie context," which is a name that identifies a
1089 set of cookies that apply to that server. A sample context might be
1090 "org_freedesktop_session_bus". Context names must be valid ASCII,
1091 nonzero length, and may not contain the characters slash ("/"),
1092 backslash ("\"), space (" "), newline ("\n"), carriage return ("\r"),
1093 tab ("\t"), or period ("."). There is a default context,
1094 "org_freedesktop_global" that's used by servers that do not specify
1098 Cookies are stored in a user's home directory, in the directory
1099 <filename>~/.dbus-keyrings/</filename>. This directory must
1100 not be readable or writable by other users. If it is,
1101 clients and servers must ignore it. The directory
1102 contains cookie files named after the cookie context.
1105 A cookie file contains one cookie per line. Each line
1106 has three space-separated fields:
1110 The cookie ID number, which must be a non-negative integer and
1111 may not be used twice in the same file.
1116 The cookie's creation time, in UNIX seconds-since-the-epoch
1122 The cookie itself, a hex-encoded random block of bytes.
1128 Only server processes modify the cookie file.
1129 They must do so with this procedure:
1133 Create a lockfile name by appending ".lock" to the name of the
1134 cookie file. The server should attempt to create this file
1135 using <literal>O_CREAT | O_EXCL</literal>. If file creation
1136 fails, the lock fails. Servers should retry for a reasonable
1137 period of time, then they may choose to delete an existing lock
1138 to keep users from having to manually delete a stale
1139 lock. <footnote><para>Lockfiles are used instead of real file
1140 locking <literal>fcntl()</literal> because real locking
1141 implementations are still flaky on network
1142 filesystems.</para></footnote>
1147 Once the lockfile has been created, the server loads the cookie
1148 file. It should then delete any cookies that are old (the
1149 timeout can be fairly short), or more than a reasonable
1150 time in the future (so that cookies never accidentally
1151 become permanent, if the clock was set far into the future
1152 at some point). If no recent keys remain, the
1153 server may generate a new key.
1158 The pruned and possibly added-to cookie file
1159 must be resaved atomically (using a temporary
1160 file which is rename()'d).
1165 The lock must be dropped by deleting the lockfile.
1171 Clients need not lock the file in order to load it,
1172 because servers are required to save the file atomically.
1177 <sect1 id="addresses">
1178 <title>Server Addresses</title>
1180 Server addresses consist of a transport name followed by a colon, and
1181 then an optional, comma-separated list of keys and values in the form key=value.
1182 [FIXME how do you escape colon, comma, and semicolon in the values of the key=value pairs?]
1186 <programlisting>unix:path=/tmp/dbus-test</programlisting>
1187 Which is the address to a unix socket with the path /tmp/dbus-test.
1190 [FIXME clarify if attempting to connect to each is a requirement
1191 or just a suggestion]
1192 When connecting to a server, multiple server addresses can be
1193 separated by a semi-colon. The library will then try to connect
1194 to the first address and if that fails, it'll try to connect to
1195 the next one specified, and so forth. For example
1196 <programlisting>unix:path=/tmp/dbus-test;unix:path=/tmp/dbus-test2</programlisting>
1199 [FIXME we need to specify in detail each transport and its possible arguments]
1200 Current transports include: unix domain sockets (including
1201 abstract namespace on linux), TCP/IP, and a debug/testing transport using
1202 in-process pipes. Future possible transports include one that
1203 tunnels over X11 protocol.
1207 <sect1 id="standard-messages">
1208 <title>Standard Peer-to-Peer Messages</title>
1210 See <xref linkend="message-protocol-types-notation"/> for details on
1211 the notation used in this section.
1213 <sect2 id="standard-messages-ping">
1214 <title><literal>org.freedesktop.Peer.Ping</literal></title>
1217 org.freedesktop.Peer.Ping ()
1221 On receipt of the METHOD_CALL
1222 message <literal>org.freedesktop.Peer.Ping</literal>, an application
1223 should do nothing other than reply with a METHOD_RETURN as usual.
1227 <sect2 id="standard-messages-get-props">
1228 <title><literal>org.freedesktop.Props.Get</literal></title>
1230 [FIXME this is just a bogus made-up method that isn't implemented
1231 or thought through, to save an example of table formatting for the
1232 argument descriptions]
1234 org.freedesktop.Props.Get (in STRING property_name,
1235 out ANY_OR_NIL property_value)
1242 <entry>Argument</entry>
1244 <entry>Description</entry>
1250 <entry>in STRING</entry>
1251 <entry>Name of the property to get</entry>
1255 <entry>out ANY_OR_NIL</entry>
1256 <entry>The value of the property. The type depends on the property.</entry>
1265 <sect1 id="message-bus">
1266 <title>Message Bus Specification</title>
1267 <sect2 id="message-bus-overview">
1268 <title>Message Bus Overview</title>
1270 The message bus accepts connections from one or more applications.
1271 Once connected, applications can send and receive messages from
1272 the message bus, as in the peer-to-peer case.
1275 The message bus keeps track of a set of
1276 <firstterm>services</firstterm>. A service is simply a name, such as
1277 <literal>com.yoyodyne.Screensaver</literal>, which can be
1278 <firstterm>owned</firstterm> by one or more of the connected
1279 applications. The message bus itself always owns the special service
1280 <literal>org.freedesktop.DBus</literal>.
1283 Services may have <firstterm>secondary owners</firstterm>. Secondary owners
1284 of a service are kept in a queue; if the primary owner of a service
1285 disconnects, or releases the service, the next secondary owner becomes
1286 the new owner of the service.
1289 Messages may have a <literal>SERVICE</literal> field (see <xref
1290 linkend="message-protocol-header-fields"/>). When the message bus
1291 receives a message, if the <literal>SERVICE</literal> field is absent, the
1292 message is taken to be a standard peer-to-peer message and interpreted
1293 by the message bus itself. For example, sending
1294 an <literal>org.freedesktop.Peer.Ping</literal> message with no
1295 <literal>SERVICE</literal> will cause the message bus itself to reply
1296 to the ping immediately; the message bus would never make
1297 this message visible to other applications.
1300 If the <literal>SERVICE</literal> field is present, then it indicates a
1301 request for the message bus to route the message. In the usual case,
1302 messages are routed to the owner of the named service.
1303 Messages may also be <firstterm>broadcast</firstterm>
1304 by sending them to the special service
1305 <literal>org.freedesktop.DBus.Broadcast</literal>. Broadcast messages are
1306 sent to all applications with <firstterm>message matching
1307 rules</firstterm> that match the message.
1310 Continuing the <literal>org.freedesktop.Peer.Ping</literal> example, if
1311 the ping message were sent with a <literal>SERVICE</literal> name of
1312 <literal>com.yoyodyne.Screensaver</literal>, then the ping would be
1313 forwarded, and the Yoyodyne Corporation screensaver application would be
1314 expected to reply to the ping. If
1315 <literal>org.freedesktop.Peer.Ping</literal> were sent to
1316 <literal>org.freedesktop.DBus.Broadcast</literal>, then multiple applications
1317 might receive the ping, and all would normally reply to it.
1321 <sect2 id="message-bus-services">
1322 <title>Message Bus Services</title>
1324 A service is a name that identifies a certain application. Each
1325 application connected to the message bus has at least one service name
1326 assigned at connection time and returned in response to the
1327 <literal>org.freedesktop.DBus.Hello</literal> message.
1328 This automatically-assigned service name is called
1329 the application's <firstterm>base service</firstterm>.
1330 Base service names are unique and MUST never be reused for two different
1334 Ownership of the base service is a prerequisite for interaction with
1335 the message bus. It logically follows that the base service is always
1336 the first service that an application comes to own, and the last
1337 service that it loses ownership of.
1340 Base service names must begin with the character ':' (ASCII colon
1341 character); service names that are not base service names must not begin
1342 with this character. (The bus must reject any attempt by an application
1343 to manually create a service name beginning with ':'.) This restriction
1344 categorically prevents "spoofing"; messages sent to a base service name
1345 will always go to a single application instance and that instance only.
1348 An application can request additional service names to be associated
1350 <literal>org.freedesktop.DBus.AcquireService</literal>
1351 message. [FIXME what service names are allowed; ASCII or unicode;
1355 [FIXME this needs more detail, and should move the service-related message
1356 descriptions up into this section perhaps]
1357 Service ownership handling can be specified in the flags part
1358 of the <literal>org.freedesktop.DBus.AcquireService</literal>
1359 message. If an application specifies the
1360 DBUS_SERVICE_FLAGS_PROHIBIT_REPLACEMENT flag, then all applications
1361 trying to acquire the service will be put in a queue. When the
1362 primary owner disconnects from the bus or removes ownership
1363 from the service, the next application in the queue will be the
1364 primary owner. If the DBUS_SERVICE_FLAGS_PROHIBIT_REPLACEMENT
1365 flag is not specified, then the primary owner will lose
1366 ownership whenever another application requests ownership of the
1370 When a client disconnects from the bus, all the services that
1371 the clients own are deleted, or in the case of a service that
1372 prohibits replacement, ownership is transferred to the next
1373 client in the queue, if any.
1376 <sect2 id="message-bus-routing">
1377 <title>Message Bus Message Routing</title>
1379 When a message is received by the message bus, the message's
1380 <literal>sndr</literal> header field MUST be set to the base service of
1381 the application which sent the message. If the service already has
1382 a <literal>sndr</literal> field, the pre-existing field is replaced.
1383 This rule means that a replies are always sent to the base service name,
1384 i.e. to the same application that sent the message being replied to.
1387 [FIXME go into detail about broadcast, multicast, unicast, etc.]
1390 <sect2 id="message-bus-activation">
1391 <title>Message Bus Service Activation</title>
1393 <firstterm>Activation</firstterm> means to locate a service
1394 owner for a service that is currently unowned. For now, it
1395 means to launch an executable that will take ownership of
1396 a particular service.
1399 To find an executable corresponding to a particular service, the bus
1400 daemon looks for <firstterm>service description files</firstterm>.
1401 Service description files define a mapping from service names to
1402 executables. Different kinds of message bus will look for these files
1403 in different places, see <xref linkend="message-bus-types"/>.
1406 [FIXME the file format should be much better specified than
1407 "similar to .desktop entries" esp. since desktop entries are
1408 already badly-specified. ;-)] Service description files have
1409 the ".service" file extension. The message bus will only load
1410 service description files ending with .service; all other
1411 files will be ignored. The file format is similar to that of
1413 url="http://www.freedesktop.org/standards/desktop-entry-spec/desktop-entry-spec.html">desktop
1414 entries</ulink>. All service description files must be in
1415 UTF-8 encoding. To ensure that there will be no name
1416 collisions, service files must be namespaced using the same
1417 mechanism as messages and service names.
1420 <title>Example service description file</title>
1422 # Sample service description file
1424 Name=org.gnome.ConfigurationDatabase
1425 Exec=/usr/libexec/gconfd-2
1430 When an application requests a service to be activated, the
1431 bus daemon tries to find it in the list of activation
1432 entries. It then tries to spawn the executable associated with
1433 it. If this fails, it will report an error. [FIXME what
1434 happens if two .service files offer the same service; what
1435 kind of error is reported, should we have a way for the client
1439 The executable launched will have the environment variable
1440 <literal>DBUS_ACTIVATION_ADDRESS</literal> set to the address of the
1441 message bus so it can connect and register the appropriate services.
1444 The executable being launched may want to know whether the message bus
1445 activating it is one of the well-known message buses (see <xref
1446 linkend="message-bus-types"/>). To facilitate this, the bus MUST also set
1447 the <literal>DBUS_ACTIVATION_BUS_TYPE</literal> environment variable if it is one
1448 of the well-known buses. The currently-defined values for this variable
1449 are <literal>system</literal> for the systemwide message bus,
1450 and <literal>session</literal> for the per-login-session message
1451 bus. The activated executable must still connect to the address given
1452 in <literal>DBUS_ACTIVATION_ADDRESS</literal>, but may assume that the
1453 resulting connection is to the well-known bus.
1456 [FIXME there should be a timeout somewhere, either specified
1457 in the .service file, by the client, or just a global value
1458 and if the client being activated fails to connect within that
1459 timeout, an error should be sent back.]
1463 <sect2 id="message-bus-types">
1464 <title>Well-known Message Bus Instances</title>
1466 Two standard message bus instances are defined here, along with how
1467 to locate them and where their service files live.
1469 <sect3 id="message-bus-types-login">
1470 <title>Login session message bus</title>
1472 Each time a user logs in, a <firstterm>login session message
1473 bus</firstterm> may be started. All applications in the user's login
1474 session may interact with one another using this message bus.
1477 The address of the login session message bus is given
1478 in the <literal>DBUS_SESSION_BUS_ADDRESS</literal> environment
1479 variable. If that variable is not set, applications may
1480 also try to read the address from the X Window System root
1481 window property <literal>_DBUS_SESSION_BUS_ADDRESS</literal>.
1482 The root window property must have type <literal>STRING</literal>.
1483 The environment variable should have precedence over the
1484 root window property.
1487 [FIXME specify location of .service files, probably using
1488 DESKTOP_DIRS etc. from basedir specification, though login session
1489 bus is not really desktop-specific]
1492 <sect3 id="message-bus-types-system">
1493 <title>System message bus</title>
1495 A computer may have a <firstterm>system message bus</firstterm>,
1496 accessible to all applications on the system. This message bus may be
1497 used to broadcast system events, such as adding new hardware devices,
1498 changes in the printer queue, and so forth.
1501 The address of the login session message bus is given
1502 in the <literal>DBUS_SYSTEM_BUS_ADDRESS</literal> environment
1503 variable. If that variable is not set, applications should try
1504 to connect to the well-known address
1505 <literal>unix:path=/var/run/dbus/system_bus_socket</literal>.
1508 The D-BUS reference implementation actually honors the
1509 <literal>$(localstatedir)</literal> configure option
1510 for this address, on both client and server side.
1515 [FIXME specify location of system bus .service files]
1520 <sect2 id="message-bus-messages">
1521 <title>Message Bus Messages</title>
1523 The special message bus service <literal>org.freedesktop.DBus</literal>
1524 responds to a number of messages, allowing applications to
1525 interact with the message bus.
1528 <sect3 id="bus-messages-hello">
1529 <title><literal>org.freedesktop.DBus.Hello</literal></title>
1540 <entry>Argument</entry>
1542 <entry>Description</entry>
1548 <entry>STRING</entry>
1549 <entry>Name of the service assigned to the application</entry>
1556 Before an application is able to send messages to other
1557 applications it must send the
1558 <literal>org.freedesktop.DBus.Hello</literal> message to the
1559 message bus service. If an application tries to send a
1560 message to another application, or a message to the message
1561 bus service that isn't the
1562 <literal>org.freedesktop.DBus.Hello</literal> message, it
1563 will be disconnected from the bus. If a client wishes to
1564 disconnect from the bus, it just has to disconnect from the
1565 transport used. No de-registration message is necessary.
1568 The reply message contains the name of the application's base service.
1571 <sect3 id="bus-messages-list-services">
1572 <title><literal>org.freedesktop.DBus.ListServices</literal></title>
1576 STRING_ARRAY ListServices ()
1583 <entry>Argument</entry>
1585 <entry>Description</entry>
1591 <entry>STRING_ARRAY</entry>
1592 <entry>Array of strings where each string is the name of a service</entry>
1599 Returns a list of all existing services registered with the message bus.
1602 <sect3 id="bus-messages-service-exists">
1603 <title><literal>org.freedesktop.DBus.ServiceExists</literal></title>
1607 BOOLEAN ServiceExists (in STRING service_name)
1614 <entry>Argument</entry>
1616 <entry>Description</entry>
1622 <entry>STRING</entry>
1623 <entry>Name of the service</entry>
1633 <entry>Argument</entry>
1635 <entry>Description</entry>
1641 <entry>BOOLEAN</entry>
1642 <entry>Return value, true if the service exists</entry>
1649 Checks if a service with a specified name exists.
1653 <sect3 id="bus-messages-acquire-service">
1654 <title><literal>org.freedesktop.DBus.AcquireService</literal></title>
1658 UINT32 AcquireService (in STRING service_name)
1665 <entry>Argument</entry>
1667 <entry>Description</entry>
1673 <entry>STRING</entry>
1674 <entry>Name of the service</entry>
1678 <entry>UINT32</entry>
1679 <entry>Flags</entry>
1689 <entry>Argument</entry>
1691 <entry>Description</entry>
1697 <entry>UINT32</entry>
1698 <entry>Return value</entry>
1705 Tries to become owner of a specific service. The flags
1706 specified can be the following values logically ORed together:
1712 <entry>Identifier</entry>
1713 <entry>Value</entry>
1714 <entry>Description</entry>
1719 <entry>DBUS_SERVICE_FLAGS_PROHIBIT_REPLACEMENT</entry>
1722 If the application succeeds in being the owner of the specified service,
1723 then ownership of the service can't be transferred until the service
1724 disconnects. If this flag is not set, then any application trying to become
1725 the owner of the service will succeed and the previous owner will be
1726 sent a <literal>org.freedesktop.DBus.ServiceLost</literal> message.
1730 <entry>DBUS_SERVICE_FLAGS_REPLACE_EXISTING</entry>
1732 <entry>Try to replace the current owner if there is one. If this flag
1733 is not set the application will only become the owner of the service if
1734 there is no current owner.</entry>
1740 [FIXME if it's one of the following values, why are the values
1741 done as flags instead of just 0, 1, 2, 3, 4]
1742 The return value can be one of the following values:
1748 <entry>Identifier</entry>
1749 <entry>Value</entry>
1750 <entry>Description</entry>
1755 <entry>DBUS_SERVICE_REPLY_PRIMARY_OWNER</entry>
1757 <entry>The application is now the primary owner of the service.</entry>
1760 <entry>DBUS_SERVICE_REPLY_IN_QUEUE</entry>
1762 <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>
1765 <entry>DBUS_SERVICE_REPLY_SERVICE_EXISTS</entry>
1767 <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>
1770 <entry>DBUS_SERVICE_REPLY_ALREADY_OWNER</entry>
1772 <entry>The application trying to request ownership of the service is already the owner of it.</entry>
1779 <sect3 id="bus-messages-service-acquired">
1780 <title><literal>org.freedesktop.DBus.ServiceAcquired</literal></title>
1784 ServiceAcquired (in STRING service_name)
1791 <entry>Argument</entry>
1793 <entry>Description</entry>
1799 <entry>STRING</entry>
1800 <entry>Name of the service</entry>
1804 <entry>UINT32</entry>
1805 <entry>Flags</entry>
1812 This message is sent to a specific application when it becomes the
1813 primary owner of a service.
1816 <sect3 id="bus-messages-service-lost">
1817 <title><literal>org.freedesktop.DBus.ServiceLost</literal></title>
1821 ServiceLost (in STRING service_name)
1828 <entry>Argument</entry>
1830 <entry>Description</entry>
1836 <entry>STRING</entry>
1837 <entry>Name of the service</entry>
1841 <entry>UINT32</entry>
1842 <entry>Flags</entry>
1849 This message is sent to a specific application when it loses primary
1850 ownership of a service.
1852 [FIXME instead of ServiceLost/ServiceCreated going only to
1853 a specific app, why not just OwnerChanged that covers both
1854 lost and created and changed owner and deleted]
1858 <sect3 id="bus-messages-service-created">
1859 <title><literal>org.freedesktop.DBus.ServiceCreated</literal></title>
1863 ServiceCreated (in STRING service_name)
1870 <entry>Argument</entry>
1872 <entry>Description</entry>
1878 <entry>STRING</entry>
1879 <entry>Name of the service</entry>
1883 <entry>UINT32</entry>
1884 <entry>Flags</entry>
1891 This message is broadcast to all applications when a service has been
1892 successfully registered on the message bus.
1896 <sect3 id="bus-messages-service-deleted">
1897 <title><literal>org.freedesktop.DBus.ServiceDeleted</literal></title>
1901 ServiceDeleted (in STRING service_name)
1908 <entry>Argument</entry>
1910 <entry>Description</entry>
1916 <entry>STRING</entry>
1917 <entry>Name of the service</entry>
1921 <entry>UINT32</entry>
1922 <entry>Flags</entry>
1929 This message is broadcast to all applications when a service has been
1930 deleted from the message bus.
1934 <sect3 id="bus-messages-activate-service">
1935 <title><literal>org.freedesktop.DBus.ActivateService</literal></title>
1939 UINT32 ActivateService (in STRING service_name, in UINT32 flags)
1946 <entry>Argument</entry>
1948 <entry>Description</entry>
1954 <entry>STRING</entry>
1955 <entry>Name of the service to activate</entry>
1959 <entry>UINT32</entry>
1960 <entry>Flags (currently not used)</entry>
1970 <entry>Argument</entry>
1972 <entry>Description</entry>
1978 <entry>UINT32</entry>
1979 <entry>Return value</entry>
1984 Tries to launch the executable associated with a service. For more information, see <xref linkend="message-bus-activation"/>.
1986 [FIXME need semantics in much more detail here; for example,
1987 if I activate a service then send it a message, is the message
1988 queued for the new service or is there a race]
1991 The return value can be one of the following values:
1996 <entry>Identifier</entry>
1997 <entry>Value</entry>
1998 <entry>Description</entry>
2003 <entry>DBUS_ACTIVATION_REPLY_ACTIVATED</entry>
2005 <entry>The service was activated successfully.</entry>
2008 <entry>DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE</entry>
2010 <entry>The service is already active.</entry>
2019 <sect3 id="bus-messages-out-of-memory">
2020 <title><literal>org.freedesktop.DBus.Error.NoMemory</literal></title>
2028 Sent by the message bus when it can't process a message due to an out of memory failure.
2032 <sect3 id="bus-messages-service-does-not-exist">
2033 <title><literal>org.freedesktop.DBus.Error.ServiceDoesNotExist</literal></title>
2037 void ServiceDoesNotExist (in STRING error)
2041 Sent by the message bus as a reply to a client that tried to send a message to a service that doesn't exist.
2048 <appendix id="implementation-notes">
2049 <title>Implementation notes</title>
2050 <sect1 id="implementation-notes-subsection">
2058 <glossary><title>Glossary</title>
2060 This glossary defines some of the terms used in this specification.
2063 <glossentry id="term-activation"><glossterm>Activation</glossterm>
2066 The process of creating an owner for a particular service,
2067 typically by launching an executable.
2072 <glossentry id="term-base-service"><glossterm>Base Service</glossterm>
2075 The special service automatically assigned to an application by the
2076 message bus. This service may never change owner, and the service
2077 name will be unique (never reused during the lifetime of the
2083 <glossentry id="term-broadcast"><glossterm>Broadcast</glossterm>
2086 A message sent to the special <literal>org.freedesktop.DBus.Broadcast</literal>
2087 service; the message bus will forward the broadcast message
2088 to all applications that have expressed interest in it.
2093 <glossentry id="term-message"><glossterm>Message</glossterm>
2096 A message is the atomic unit of communication via the D-BUS
2097 protocol. It consists of a <firstterm>header</firstterm> and a
2098 <firstterm>body</firstterm>; the body is made up of
2099 <firstterm>arguments</firstterm>.
2104 <glossentry id="term-message-bus"><glossterm>Message Bus</glossterm>
2107 The message bus is a special application that forwards
2108 or broadcasts messages between a group of applications
2109 connected to the message bus. It also manages
2110 <firstterm>services</firstterm>.
2115 <glossentry id="namespace"><glossterm>Namespace</glossterm>
2118 Used to prevent collisions when defining message and service
2119 names. The convention used is the same as Java uses for
2120 defining classes: a reversed domain name.
2125 <glossentry id="term-object"><glossterm>Object</glossterm>
2128 Each application contains <firstterm>objects</firstterm>,
2129 which have <firstterm>interfaces</firstterm> and
2130 <firstterm>methods</firstterm>. Objects are referred to
2131 by a name, called a <firstterm>path</firstterm> or
2132 <firstterm>object reference</firstterm>.
2137 <glossentry id="term-path"><glossterm>Path</glossterm>
2140 Object references (object names) in D-BUS are
2141 organized into a filesystem-style hierarchy, so
2142 each object is named by a path. As in LDAP,
2143 there's no difference between "files" and "directories";
2144 a path can refer to an object, while still having
2145 child objects below it.
2150 <glossentry id="peer-to-peer"><glossterm>Peer-to-peer</glossterm>
2153 An application talking directly to another application, without going through a message bus.
2157 <glossentry id="term-secondary-owner"><glossterm>Secondary service owner</glossterm>
2160 Each service has a primary owner; messages sent to the service name
2161 go to the primary owner. However, certain services also maintain
2162 a queue of secondary owners "waiting in the wings." If
2163 the primary owner releases the service, then the first secondary
2164 owner in the queue automatically becomes the primary owner.
2168 <glossentry id="term-service"><glossterm>Service</glossterm>
2171 A service is simply a named list of applications. For example, the
2172 hypothetical <literal>com.yoyodyne.Screensaver</literal> service might
2173 accept messages that affect a screensaver from Yoyodyne Corporation.
2174 An application is said to <firstterm>own</firstterm> a service if the
2175 message bus has associated the application with the service name.
2176 Services may also have <firstterm>secondary owners</firstterm> (see
2177 <xref linkend="term-secondary-owner"/>).
2181 <glossentry id="term-service-name"><glossterm>Service name</glossterm>
2184 The name used when referring to a service. If the service is
2185 a base service it has a unique service name, for example
2186 ":1-20", and otherwise it should be namespaced.
2190 <glossentry id="term-service-description-files"><glossterm>Service Description Files</glossterm>
2193 ".service files" tell the bus how to activate a particular service.
2194 See <xref linkend="term-activation"/>