"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
[
]>
-
<article id="index">
<articleinfo>
<title>D-Bus Specification</title>
- <releaseinfo>Version 0.13</releaseinfo>
- <date>23 Dezember 2009</date>
+ <releaseinfo>Version 0.17</releaseinfo>
+ <date>(not final)</date>
<authorgroup>
<author>
<firstname>Havoc</firstname>
</address>
</affiliation>
</author>
+ <author>
+ <firstname>Sven</firstname>
+ <surname>Herzberg</surname>
+ <affiliation>
+ <orgname>Imendio AB</orgname>
+ <address>
+ <email>sven@imendio.com</email>
+ </address>
+ </affiliation>
+ </author>
</authorgroup>
+ <revhistory>
+ <revision>
+ <revnumber>current</revnumber>
+ <date><ulink url='http://cgit.freedesktop.org/dbus/dbus/log/doc/dbus-specification.xml'>commit log</ulink></date>
+ <authorinitials></authorinitials>
+ <revremark></revremark>
+ </revision>
+ <revision>
+ <revnumber>0.16</revnumber>
+ <date>11 April 2011</date>
+ <authorinitials></authorinitials>
+ <revremark>add path_namespace, arg0namespace; argNpath matches object
+ paths</revremark>
+ </revision>
+ <revision>
+ <revnumber>0.15</revnumber>
+ <date>3 November 2010</date>
+ <authorinitials></authorinitials>
+ <revremark></revremark>
+ </revision>
+ <revision>
+ <revnumber>0.14</revnumber>
+ <date>12 May 2010</date>
+ <authorinitials></authorinitials>
+ <revremark></revremark>
+ </revision>
+ <revision>
+ <revnumber>0.13</revnumber>
+ <date>23 Dezember 2009</date>
+ <authorinitials></authorinitials>
+ <revremark></revremark>
+ </revision>
+ <revision>
+ <revnumber>0.12</revnumber>
+ <date>7 November, 2006</date>
+ <authorinitials></authorinitials>
+ <revremark></revremark>
+ </revision>
+ <revision>
+ <revnumber>0.11</revnumber>
+ <date>6 February 2005</date>
+ <authorinitials></authorinitials>
+ <revremark></revremark>
+ </revision>
+ <revision>
+ <revnumber>0.10</revnumber>
+ <date>28 January 2005</date>
+ <authorinitials></authorinitials>
+ <revremark></revremark>
+ </revision>
+ <revision>
+ <revnumber>0.9</revnumber>
+ <date>7 Januar 2005</date>
+ <authorinitials></authorinitials>
+ <revremark></revremark>
+ </revision>
+ <revision>
+ <revnumber>0.8</revnumber>
+ <date>06 September 2003</date>
+ <authorinitials></authorinitials>
+ <revremark>First released document.</revremark>
+ </revision>
+ </revhistory>
</articleinfo>
<sect1 id="introduction">
</row><row>
<entry><literal>STRUCT</literal></entry>
<entry>114 (ASCII 'r'), 40 (ASCII '('), 41 (ASCII ')')</entry>
- <entry>Struct</entry>
+ <entry>Struct; type code 114 'r' is reserved for use in
+ bindings and implementations to represent the general
+ concept of a struct, and must not appear in signatures
+ used on D-Bus.</entry>
</row><row>
<entry><literal>VARIANT</literal></entry>
<entry>118 (ASCII 'v') </entry>
</row><row>
<entry><literal>DICT_ENTRY</literal></entry>
<entry>101 (ASCII 'e'), 123 (ASCII '{'), 125 (ASCII '}') </entry>
- <entry>Entry in a dict or map (array of key-value pairs)</entry>
+ <entry>Entry in a dict or map (array of key-value pairs).
+ Type code 101 'e' is reserved for use in bindings and
+ implementations to represent the general concept of a
+ dict or dict-entry, and must not appear in signatures
+ used on D-Bus.</entry>
</row><row>
<entry><literal>UNIX_FD</literal></entry>
<entry>104 (ASCII 'h')</entry>
<entry>Unix file descriptor</entry>
</row>
+ <row>
+ <entry>(reserved)</entry>
+ <entry>109 (ASCII 'm')</entry>
+ <entry>Reserved for <ulink
+ url="https://bugs.freedesktop.org/show_bug.cgi?id=27857">a
+ 'maybe' type compatible with the one in GVariant</ulink>,
+ and must not appear in signatures used on D-Bus until
+ specified here</entry>
+ </row>
+ <row>
+ <entry>(reserved)</entry>
+ <entry>42 (ASCII '*')</entry>
+ <entry>Reserved for use in bindings/implementations to
+ represent any <firstterm>single complete type</firstterm>,
+ and must not appear in signatures used on D-Bus.</entry>
+ </row>
+ <row>
+ <entry>(reserved)</entry>
+ <entry>63 (ASCII '?')</entry>
+ <entry>Reserved for use in bindings/implementations to
+ represent any <firstterm>basic type</firstterm>, and must
+ not appear in signatures used on D-Bus.</entry>
+ </row>
+ <row>
+ <entry>(reserved)</entry>
+ <entry>64 (ASCII '@'), 38 (ASCII '&'),
+ 94 (ASCII '^')</entry>
+ <entry>Reserved for internal use by bindings/implementations,
+ and must not appear in signatures used on D-Bus.
+ GVariant uses these type-codes to encode calling
+ conventions.</entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
</row><row>
<entry><literal>VARIANT</literal></entry>
<entry>
- A variant type has a marshaled <literal>SIGNATURE</literal>
- followed by a marshaled value with the type
- given in the signature.
- Unlike a message signature, the variant signature
- can contain only a single complete type.
- So "i", "ai" or "(ii)" is OK, but "ii" is not.
+ A variant type has a marshaled
+ <literal>SIGNATURE</literal> followed by a marshaled
+ value with the type given in the signature. Unlike
+ a message signature, the variant signature can
+ contain only a single complete type. So "i", "ai"
+ or "(ii)" is OK, but "ii" is not. Use of variants may not
+ cause a total message depth to be larger than 64, including
+ other container types such as structures.
</entry>
<entry>
1 (alignment of the signature)
</itemizedlist>
</para>
+ <para>
+ Object paths are often namespaced by starting with a reversed
+ domain name and containing an interface version number, in the
+ same way as
+ <link linkend="message-protocol-names-interface">interface
+ names</link> and
+ <link linkend="message-protocol-names-bus">well-known
+ bus names</link>.
+ This makes it possible to implement more than one service, or
+ more than one version of a service, in the same process,
+ even if the services share a connection but cannot otherwise
+ co-operate (for instance, if they are implemented by different
+ plugins).
+ </para>
+
+ <para>
+ For instance, if the owner of <literal>example.com</literal> is
+ developing a D-Bus API for a music player, they might use the
+ hierarchy of object paths that start with
+ <literal>/com/example/MusicPlayer1</literal> for its objects.
+ </para>
</sect3>
-
<sect3 id="message-protocol-marshaling-signature">
<title>Valid Signatures</title>
<para>
<listitem><para>Interface names must not exceed the maximum name length.</para></listitem>
</itemizedlist>
</para>
+
+ <para>
+ Interface names should start with the reversed DNS domain name of
+ the author of the interface (in lower-case), like interface names
+ in Java. It is conventional for the rest of the interface name
+ to consist of words run together, with initial capital letters
+ on all words ("CamelCase"). Several levels of hierarchy can be used.
+ It is also a good idea to include the major version of the interface
+ in the name, and increment it if incompatible changes are made;
+ this way, a single object can implement several versions of an
+ interface in parallel, if necessary.
+ </para>
+
+ <para>
+ For instance, if the owner of <literal>example.com</literal> is
+ developing a D-Bus API for a music player, they might define
+ interfaces called <literal>com.example.MusicPlayer1</literal>,
+ <literal>com.example.MusicPlayer1.Track</literal> and
+ <literal>com.example.MusicPlayer1.Seekable</literal>.
+ </para>
+
+ <para>
+ D-Bus does not distinguish between the concepts that would be
+ called classes and interfaces in Java: either can be identified on
+ D-Bus by an interface name.
+ </para>
</sect3>
<sect3 id="message-protocol-names-bus">
<title>Bus names</title>
<para>
Connections have one or more bus names associated with them.
- A connection has exactly one bus name that is a unique connection
- name. The unique connection name remains with the connection for
- its entire lifetime.
+ A connection has exactly one bus name that is a <firstterm>unique
+ connection name</firstterm>. The unique connection name remains
+ with the connection for its entire lifetime.
A bus name is of type <literal>STRING</literal>,
meaning that it must be valid UTF-8. However, there are also
some additional restrictions that apply to bus names
specifically:
<itemizedlist>
<listitem><para>Bus names that start with a colon (':')
- character are unique connection names.
+ character are unique connection names. Other bus names
+ are called <firstterm>well-known bus names</firstterm>.
</para>
</listitem>
<listitem><para>Bus names are composed of 1 or more elements separated by
Note that the hyphen ('-') character is allowed in bus names but
not in interface names.
</para>
+
+ <para>
+ Like <link linkend="message-protocol-names-interface">interface
+ names</link>, well-known bus names should start with the
+ reversed DNS domain name of the author of the interface (in
+ lower-case), and it is conventional for the rest of the well-known
+ bus name to consist of words run together, with initial
+ capital letters. As with interface names, including a version
+ number in well-known bus names is a good idea; it's possible to
+ have the well-known bus name for more than one version
+ simultaneously if backwards compatibility is required.
+ </para>
+
+ <para>
+ If a well-known bus name implies the presence of a "main" interface,
+ that "main" interface is often given the same name as
+ the well-known bus name, and situated at the corresponding object
+ path. For instance, if the owner of <literal>example.com</literal>
+ is developing a D-Bus API for a music player, they might define
+ that any application that takes the well-known name
+ <literal>com.example.MusicPlayer1</literal> should have an object
+ at the object path <literal>/com/example/MusicPlayer1</literal>
+ which implements the interface
+ <literal>com.example.MusicPlayer1</literal>.
+ </para>
</sect3>
<sect3 id="message-protocol-names-member">
<title>Member names</title>
<listitem><para>Must be at least 1 byte in length.</para></listitem>
</itemizedlist>
</para>
+
+ <para>
+ It is conventional for member names on D-Bus to consist of
+ capitalized words with no punctuation ("camel-case").
+ Method names should usually be verbs, such as
+ <literal>GetItems</literal>, and signal names should usually be
+ a description of an event, such as <literal>ItemsChanged</literal>.
+ </para>
</sect3>
<sect3 id="message-protocol-names-error">
<title>Error names</title>
<para>
Error names have the same restrictions as interface names.
</para>
+
+ <para>
+ Error names have the same naming conventions as interface
+ names, and often contain <literal>.Error.</literal>; for instance,
+ the owner of <literal>example.com</literal> might define the
+ errors <literal>com.example.MusicPlayer.Error.FileNotFound</literal>
+ and <literal>com.example.MusicPlayer.Error.OutOfMemory</literal>.
+ The errors defined by D-Bus itself, such as
+ <literal>org.freedesktop.DBus.Error.Failed</literal>, follow a
+ similar pattern.
+ </para>
</sect3>
</sect2>
[FIXME we need to specify in detail each transport and its possible arguments]
Current transports include: unix domain sockets (including
- abstract namespace on linux), TCP/IP, and a debug/testing transport using
- in-process pipes. Future possible transports include one that
+ abstract namespace on linux), launchd, TCP/IP, and a debug/testing transport
+ using in-process pipes. Future possible transports include one that
tunnels over X11 protocol.
</para>
</informaltable>
</sect3>
</sect2>
+ <sect2 id="transports-launchd">
+ <title>launchd</title>
+ <para>
+ launchd is a open-source server management system that replaces init, inetd
+ and cron on Apple Mac OS X versions 10.4 and above. It provides a common session
+ bus address for each user and deprecates the X11-enabled D-Bus launcher on OSX.
+ </para>
+
+ <para>
+ launchd allocates a socket and provides it with the unix path through the
+ DBUS_LAUNCHD_SESSION_BUS_SOCKET variable in launchd's environment. Every process
+ spawned by launchd (or dbus-daemon, if it was started by launchd) can access
+ it through its environment.
+ Other processes can query for the launchd socket by executing:
+ $ launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET
+ This is normally done by the D-Bus client library so doesn't have to be done
+ manually.
+ </para>
+ <para>
+ launchd is not available on Microsoft Windows.
+ </para>
+ <sect3 id="transports-launchd-addresses">
+ <title>Server Address Format</title>
+ <para>
+ launchd addresses are identified by the "launchd:" prefix
+ and support the following key/value pairs:
+ </para>
+ <informaltable>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Values</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>env</entry>
+ <entry>(environment variable)</entry>
+ <entry>path of the unix domain socket for the launchd created dbus-daemon.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </sect3>
+ </sect2>
<sect2 id="transports-tcp-sockets">
<title>TCP Sockets</title>
<para>
</informaltable>
</sect3>
</sect2>
-
- </sect1>
-
- <sect1 id="naming-conventions">
- <title>Naming Conventions</title>
-
- <para>
- D-Bus namespaces are all lowercase and correspond to reversed domain
- names, as with Java. e.g. "org.freedesktop"
- </para>
- <para>
- Interface, signal, method, and property names are "WindowsStyleCaps", note
- that the first letter is capitalized, unlike Java.
- </para>
+ </sect1>
+ <sect1 id="meta-transports">
+ <title>Meta Transports</title>
<para>
- Object paths are normally all lowercase with underscores used rather than
- hyphens.
+ Meta transports are a kind of transport with special enhancements or
+ behavior. Currently available meta transports include: autolaunch
</para>
- </sect1>
+
+ <sect2 id="meta-transports-autolaunch">
+ <title>Autolaunch</title>
+ <para>The autolaunch transport provides a way for dbus clients to autodetect
+ a running dbus session bus and to autolaunch a session bus if not present.
+ </para>
+ <sect3 id="meta-transports-autolaunch-addresses">
+ <title>Server Address Format</title>
+ <para>
+ Autolaunch addresses uses the "autolaunch:" prefix and support the
+ following key/value pairs:
+ </para>
+ <informaltable>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Values</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>scope</entry>
+ <entry>(string)</entry>
+ <entry>scope of autolaunch (Windows only)
+ <itemizedlist>
+ <listitem>
+ <para>
+ "*install-path" - limit session bus to dbus installation path.
+ The dbus installation path is determined from the location of
+ the shared dbus library. If the library is located in a 'bin'
+ subdirectory the installation root is the directory above,
+ otherwise the directory where the library lives is taken as
+ installation root.
+ <programlisting>
+ <install-root>/bin/[lib]dbus-1.dll
+ <install-root>/[lib]dbus-1.dll
+ </programlisting>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ "*user" - limit session bus to the recent user.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ other values - specify dedicated session bus like "release",
+ "debug" or other
+ </para>
+ </listitem>
+ </itemizedlist>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </sect3>
+
+ <sect3 id="meta-transports-autolaunch-windows-implementation">
+ <title>Windows implementation</title>
+ <para>
+ On start, the server opens a platform specific transport, creates a mutex
+ and a shared memory section containing the related session bus address.
+ This mutex will be inspected by the dbus client library to detect a
+ running dbus session bus. The access to the mutex and the shared memory
+ section are protected by global locks.
+ </para>
+ <para>
+ In the recent implementation the autolaunch transport uses a tcp transport
+ on localhost with a port choosen from the operating system. This detail may
+ change in the future.
+ </para>
+ <para>
+ Disclaimer: The recent implementation is in an early state and may not
+ work in all cirumstances and/or may have security issues. Because of this
+ the implementation is not documentated yet.
+ </para>
+ </sect3>
+ </sect2>
+ </sect1>
<sect1 id="uuids">
<title>UUIDs</title>
deterministic rule, or returning an error, are the reasonable
possibilities).
</para>
+ <para>
+ If one or more properties change on an object, the
+ <literal>org.freedesktop.DBus.Properties.PropertiesChanged</literal>
+ signal may be emitted (this signal was added in 0.14):
+ </para>
+ <para>
+ <programlisting>
+ org.freedesktop.DBus.Properties.PropertiesChanged (STRING interface_name,
+ DICT<STRING,VARIANT> changed_properties,
+ ARRAY<STRING> invalidated_properties);
+ </programlisting>
+ </para>
+ <para>
+ where <literal>changed_properties</literal> is a dictionary
+ containing the changed properties with the new values and
+ <literal>invalidated_properties</literal> is an array of
+ properties that changed but the value is not conveyed.
+ </para>
+ <para>
+ Whether the <literal>PropertiesChanged</literal> signal is
+ supported can be determined by calling
+ <literal>org.freedesktop.DBus.Introspectable.Introspect</literal>. Note
+ that the signal may be supported for an object but it may
+ differ how whether and how it is used on a per-property basis
+ (for e.g. performance or security reasons). Each property (or
+ the parent interface) must be annotated with the
+ <literal>org.freedesktop.DBus.Property.EmitsChangedSignal</literal>
+ annotation to convey this (usually the default value
+ <literal>true</literal> is sufficient meaning that the
+ annotation does not need to be used). See <xref
+ linkend="introspection-format"/> for details on this
+ annotation.
+ </para>
</sect2>
</sect1>
<entry>true,false</entry>
<entry>If set, don't expect a reply to the method call; defaults to false.</entry>
</row>
+ <row>
+ <entry>org.freedesktop.DBus.Property.EmitsChangedSignal</entry>
+ <entry>true,invalidates,false</entry>
+ <entry>
+ <para>
+ If set to <literal>false</literal>, the
+ <literal>org.freedesktop.DBus.Properties.PropertiesChanged</literal>
+ signal, see <xref
+ linkend="standard-interfaces-properties"/> is not
+ guaranteed to be emitted if the property changes.
+ </para>
+ <para>
+ If set to <literal>invalidates</literal> the signal
+ is emitted but the value is not included in the
+ signal.
+ </para>
+ <para>
+ If set to <literal>true</literal> the signal is
+ emitted with the value included.
+ </para>
+ <para>
+ The value for the annotation defaults to
+ <literal>true</literal> if the enclosing interface
+ element does not specify the annotation. Otherwise it
+ defaults to the value specified in the enclosing
+ interface element.
+ </para>
+ </entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
linkend="message-protocol-header-fields"/>). If the
<literal>DESTINATION</literal> field is present, it specifies a message
recipient by name. Method calls and replies normally specify this field.
+ The message bus must send messages (of any type) with the
+ <literal>DESTINATION</literal> field set to the specified recipient,
+ regardless of whether the recipient has set up a match rule matching
+ the message.
</para>
<para>
</tgroup>
</informaltable>
</para>
- </sect3>
+ </sect3>
+
+ <sect3 id="bus-messages-list-queued-owners">
+ <title><literal>org.freedesktop.DBus.ListQueuedOwners</literal></title>
+ <para>
+ As a method:
+ <programlisting>
+ ARRAY of STRING ListQueuedOwners (in STRING name)
+ </programlisting>
+ Message arguments:
+ <informaltable>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Argument</entry>
+ <entry>Type</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>0</entry>
+ <entry>STRING</entry>
+ <entry>The well-known bus name to query, such as
+ <literal>com.example.cappuccino</literal></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ Reply arguments:
+ <informaltable>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Argument</entry>
+ <entry>Type</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>0</entry>
+ <entry>ARRAY of STRING</entry>
+ <entry>The unique bus names of connections currently queued
+ for the name</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ <para>
+ This method call should be sent to
+ <literal>org.freedesktop.DBus</literal> and lists the connections
+ currently queued for a bus name (see
+ <xref linkend="term-queued-owner"/>).
+ </para>
+ </sect3>
</sect2>
<sect2 id="message-bus-routing">
</para>
<para>
Match rules are added using the AddMatch bus method
- (see xref linkend="bus-messages-add-match"/>). Rules are
+ (see <xref linkend="bus-messages-add-match"/>). Rules are
specified as a string of comma separated key/value pairs.
Excluding a key from the rule indicates a wildcard match.
For instance excluding the the member from a match rule but
path match is path='/org/freedesktop/Hal/Manager'</entry>
</row>
<row>
+ <entry><literal>path_namespace</literal></entry>
+ <entry>An object path</entry>
+ <entry>
+ <para>
+ Matches messages which are sent from or to an
+ object for which the object path is either the
+ given value, or that value followed by one or
+ more path components.
+ </para>
+
+ <para>
+ For example,
+ <literal>path_namespace='/com/example/foo'</literal>
+ would match signals sent by
+ <literal>/com/example/foo</literal>
+ or by
+ <literal>/com/example/foo/bar</literal>,
+ but not by
+ <literal>/com/example/foobar</literal>.
+ </para>
+
+ <para>
+ Using both <literal>path</literal> and
+ <literal>path_namespace</literal> in the same match
+ rule is not allowed.
+ </para>
+
+ <para>
+ <emphasis>
+ This match key was added in version 0.16 of the
+ D-Bus specification and implemented by the bus
+ daemon in dbus 1.5.0 and later.
+ </emphasis>
+ </para>
+ </entry>
+ </row>
+ <row>
<entry><literal>destination</literal></entry>
<entry>A unique name (see <xref linkend="term-unique-name"/>)</entry>
<entry>Matches messages which are being sent to the given unique name. An
<entry><literal>arg[0, 1, 2, 3, ...]</literal></entry>
<entry>Any string</entry>
<entry>Arg matches are special and are used for further restricting the
- match based on the arguments in the body of a message. As of this time
- only string arguments can be matched. An example of an argument match
+ match based on the arguments in the body of a message. Only arguments of type
+ STRING can be matched in this way. An example of an argument match
would be arg3='Foo'. Only argument indexes from 0 to 63 should be
accepted.</entry>
</row>
<row>
<entry><literal>arg[0, 1, 2, 3, ...]path</literal></entry>
<entry>Any string</entry>
- <entry>Argument path matches provide a specialised form of wildcard
- matching for path-like namespaces. As with normal argument matches,
- if the argument is exactly equal to the string given in the match
- rule then the rule is satisfied. Additionally, there is also a
- match when either the string given in the match rule or the
- appropriate message argument ends with '/' and is a prefix of the
- other. An example argument path match is arg0path='/aa/bb/'. This
- would match messages with first arguments of '/', '/aa/',
- '/aa/bb/', '/aa/bb/cc/' and '/aa/bb/cc'. It would not match
- messages with first arguments of '/aa/b', '/aa' or even '/aa/bb'.</entry>
+ <entry>
+ <para>Argument path matches provide a specialised form of wildcard matching for
+ path-like namespaces. They can match arguments whose type is either STRING or
+ OBJECT_PATH. As with normal argument matches,
+ if the argument is exactly equal to the string given in the match
+ rule then the rule is satisfied. Additionally, there is also a
+ match when either the string given in the match rule or the
+ appropriate message argument ends with '/' and is a prefix of the
+ other. An example argument path match is arg0path='/aa/bb/'. This
+ would match messages with first arguments of '/', '/aa/',
+ '/aa/bb/', '/aa/bb/cc/' and '/aa/bb/cc'. It would not match
+ messages with first arguments of '/aa/b', '/aa' or even '/aa/bb'.</para>
+
+ <para>This is intended for monitoring “directories” in file system-like
+ hierarchies, as used in the <citetitle>dconf</citetitle> configuration
+ system. An application interested in all nodes in a particular hierarchy would
+ monitor <literal>arg0path='/ca/example/foo/'</literal>. Then the service could
+ emit a signal with zeroth argument <literal>"/ca/example/foo/bar"</literal> to
+ represent a modification to the “bar” property, or a signal with zeroth
+ argument <literal>"/ca/example/"</literal> to represent atomic modification of
+ many properties within that directory, and the interested application would be
+ notified in both cases.</para>
+ <para>
+ <emphasis>
+ This match key was added in version 0.12 of the
+ D-Bus specification, implemented for STRING
+ arguments by the bus daemon in dbus 1.2.0 and later,
+ and implemented for OBJECT_PATH arguments in dbus 1.5.0
+ and later.
+ </emphasis>
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry><literal>arg0namespace</literal></entry>
+ <entry>Like a bus name, except that the string is not
+ required to contain a '.' (period)</entry>
+ <entry>
+ <para>Match messages whose first argument is of type STRING, and is a bus name
+ or interface name within the specified namespace. This is primarily intended
+ for watching name owner changes for a group of related bus names, rather than
+ for a single name or all name changes.</para>
+
+ <para>Because every valid interface name is also a valid
+ bus name, this can also be used for messages whose
+ first argument is an interface name.</para>
+
+ <para>For example, the match rule
+ <literal>member='NameOwnerChanged',arg0namespace='com.example.backend'</literal>
+ matches name owner changes for bus names such as
+ <literal>com.example.backend.foo</literal>,
+ <literal>com.example.backend.foo.bar</literal>, and
+ <literal>com.example.backend</literal> itself.</para>
+
+ <para>See also <xref linkend='bus-messages-name-owner-changed'/>.</para>
+ <para>
+ <emphasis>
+ This match key was added in version 0.16 of the
+ D-Bus specification and implemented by the bus
+ daemon in dbus 1.5.0 and later.
+ </emphasis>
+ </para>
+ </entry>
</row>
</tbody>
</tgroup>
<xref linkend="message-bus-types"/>.
</para>
<para>
- [FIXME the file format should be much better specified than "similar to
- .desktop entries" esp. since desktop entries are already
- badly-specified. ;-)] Service description files have the ".service" file
+ Service description files have the ".service" file
extension. The message bus will only load service description files
ending with .service; all other files will be ignored. The file format
is similar to that of <ulink
- url="http://www.freedesktop.org/standards/desktop-entry-spec/desktop-entry-spec.html">desktop
+ url="http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html">desktop
entries</ulink>. All service description files must be in UTF-8
encoding. To ensure that there will be no name collisions, service files
must be namespaced using the same mechanism as messages and service
names.
+ </para>
+
+ <para>
+ [FIXME the file format should be much better specified than "similar to
+ .desktop entries" esp. since desktop entries are already
+ badly-specified. ;-)]
+ These sections from the specification apply to service files as well:
+
+ <itemizedlist>
+ <listitem><para>General syntax</para></listitem>
+ <listitem><para>Comment format</para></listitem>
+ </itemizedlist>
<figure>
<title>Example service description file</title>
The environment variable should have precedence over the
root window property.
</para>
- <para>
- [FIXME specify location of .service files, probably using
- DESKTOP_DIRS etc. from basedir specification, though login session
- bus is not really desktop-specific]
- </para>
+ <para>The address of the login session message bus is given in the
+ <literal>DBUS_SESSION_BUS_ADDRESS</literal> environment variable. If
+ DBUS_SESSION_BUS_ADDRESS is not set, or if it's set to the string
+ "autolaunch:", the system should use platform-specific methods of
+ locating a running D-Bus session server, or starting one if a running
+ instance cannot be found. Note that this mechanism is not recommended
+ for attempting to determine if a daemon is running. It is inherently
+ racy to attempt to make this determination, since the bus daemon may
+ be started just before or just after the determination is made.
+ Therefore, it is recommended that applications do not try to make this
+ determination for their functionality purposes, and instead they
+ should attempt to start the server.</para>
+
+ <sect4 id="message-bus-types-login-x-windows">
+ <title>X Windowing System</title>
+ <para>
+ For the X Windowing System, the application must locate the
+ window owner of the selection represented by the atom formed by
+ concatenating:
+ <itemizedlist>
+ <listitem>
+ <para>the literal string "_DBUS_SESSION_BUS_SELECTION_"</para>
+ </listitem>
+
+ <listitem>
+ <para>the current user's username</para>
+ </listitem>
+
+ <listitem>
+ <para>the literal character '_' (underscore)</para>
+ </listitem>
+
+ <listitem>
+ <para>the machine's ID</para>
+ </listitem>
+ </itemizedlist>
+ </para>
+
+ <para>
+ The following properties are defined for the window that owns
+ this X selection:
+ <informaltable frame="all">
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>
+ <para>Atom</para>
+ </entry>
+
+ <entry>
+ <para>meaning</para>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <para>_DBUS_SESSION_BUS_ADDRESS</para>
+ </entry>
+
+ <entry>
+ <para>the actual address of the server socket</para>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <para>_DBUS_SESSION_BUS_PID</para>
+ </entry>
+
+ <entry>
+ <para>the PID of the server process</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+
+ <para>
+ At least the _DBUS_SESSION_BUS_ADDRESS property MUST be
+ present in this window.
+ </para>
+
+ <para>
+ If the X selection cannot be located or if reading the
+ properties from the window fails, the implementation MUST conclude
+ that there is no D-Bus server running and proceed to start a new
+ server. (See below on concurrency issues)
+ </para>
+
+ <para>
+ Failure to connect to the D-Bus server address thus obtained
+ MUST be treated as a fatal connection error and should be reported
+ to the application.
+ </para>
+
+ <para>
+ As an alternative, an implementation MAY find the information
+ in the following file located in the current user's home directory,
+ in subdirectory .dbus/session-bus/:
+ <itemizedlist>
+ <listitem>
+ <para>the machine's ID</para>
+ </listitem>
+
+ <listitem>
+ <para>the literal character '-' (dash)</para>
+ </listitem>
+
+ <listitem>
+ <para>the X display without the screen number, with the
+ following prefixes removed, if present: ":", "localhost:"
+ ."localhost.localdomain:". That is, a display of
+ "localhost:10.0" produces just the number "10"</para>
+ </listitem>
+ </itemizedlist>
+ </para>
+
+ <para>
+ The contents of this file NAME=value assignment pairs and
+ lines starting with # are comments (no comments are allowed
+ otherwise). The following variable names are defined:
+ <informaltable
+ frame="all">
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>
+ <para>Variable</para>
+ </entry>
+
+ <entry>
+ <para>meaning</para>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <para>DBUS_SESSION_BUS_ADDRESS</para>
+ </entry>
+
+ <entry>
+ <para>the actual address of the server socket</para>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <para>DBUS_SESSION_BUS_PID</para>
+ </entry>
+
+ <entry>
+ <para>the PID of the server process</para>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <para>DBUS_SESSION_BUS_WINDOWID</para>
+ </entry>
+
+ <entry>
+ <para>the window ID</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+
+ <para>
+ At least the DBUS_SESSION_BUS_ADDRESS variable MUST be present
+ in this file.
+ </para>
+
+ <para>
+ Failure to open this file MUST be interpreted as absence of a
+ running server. Therefore, the implementation MUST proceed to
+ attempting to launch a new bus server if the file cannot be
+ opened.
+ </para>
+
+ <para>
+ However, success in opening this file MUST NOT lead to the
+ conclusion that the server is running. Thus, a failure to connect to
+ the bus address obtained by the alternative method MUST NOT be
+ considered a fatal error. If the connection cannot be established,
+ the implementation MUST proceed to check the X selection settings or
+ to start the server on its own.
+ </para>
+
+ <para>
+ If the implementation concludes that the D-Bus server is not
+ running it MUST attempt to start a new server and it MUST also
+ ensure that the daemon started as an effect of the "autolaunch"
+ mechanism provides the lookup mechanisms described above, so
+ subsequent calls can locate the newly started server. The
+ implementation MUST also ensure that if two or more concurrent
+ initiations happen, only one server remains running and all other
+ initiations are able to obtain the address of this server and
+ connect to it. In other words, the implementation MUST ensure that
+ the X selection is not present when it attempts to set it, without
+ allowing another process to set the selection between the
+ verification and the setting (e.g., by using XGrabServer /
+ XungrabServer).
+ </para>
+ </sect4>
+ <sect4>
+ <title></title>
+ <para>
+ [FIXME specify location of .service files, probably using
+ DESKTOP_DIRS etc. from basedir specification, though login session
+ bus is not really desktop-specific]
+ </para>
+ </sect4>
</sect3>
<sect3 id="message-bus-types-system">
<title>System message bus</title>
<para>
As a method:
<programlisting>
- UINT32 GetConnectionUnixUser (in STRING connection_name)
+ UINT32 GetConnectionUnixUser (in STRING bus_name)
</programlisting>
Message arguments:
<informaltable>
<row>
<entry>0</entry>
<entry>STRING</entry>
- <entry>Name of the connection to query</entry>
+ <entry>Unique or well-known bus name of the connection to
+ query, such as <literal>:12.34</literal> or
+ <literal>com.example.tea</literal></entry>
</row>
</tbody>
</tgroup>
<row>
<entry>0</entry>
<entry>UINT32</entry>
- <entry>unix user id</entry>
+ <entry>Unix user ID</entry>
</row>
</tbody>
</tgroup>
</informaltable>
- Returns the unix uid of the process connected to the server. If unable to
- determine it, a <literal>org.freedesktop.DBus.Error.Failed</literal>
- error is returned.
+ Returns the Unix user ID of the process connected to the server. If
+ unable to determine it (for instance, because the process is not on the
+ same machine as the bus daemon), an error is returned.
+ </para>
+ </sect3>
+
+ <sect3 id="bus-messages-get-connection-unix-process-id">
+ <title><literal>org.freedesktop.DBus.GetConnectionUnixProcessID</literal></title>
+ <para>
+ As a method:
+ <programlisting>
+ UINT32 GetConnectionUnixProcessID (in STRING bus_name)
+ </programlisting>
+ Message arguments:
+ <informaltable>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Argument</entry>
+ <entry>Type</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>0</entry>
+ <entry>STRING</entry>
+ <entry>Unique or well-known bus name of the connection to
+ query, such as <literal>:12.34</literal> or
+ <literal>com.example.tea</literal></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ Reply arguments:
+ <informaltable>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Argument</entry>
+ <entry>Type</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>0</entry>
+ <entry>UINT32</entry>
+ <entry>Unix process id</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ Returns the Unix process ID of the process connected to the server. If
+ unable to determine it (for instance, because the process is not on the
+ same machine as the bus daemon), an error is returned.
</para>
</sect3>