D-Bus

From Wikipedia, the free encyclopedia

Jump to: navigation, search
D-Bus
Developed by Red Hat and the community
Latest release 1.2.12 / 07 January 2009
Operating system Cross-platform
Type Inter-process communication
License GNU General Public License or Academic Free License 2.1[1]
Website http://www.freedesktop.org/wiki/Software/dbus

D-Bus (Desktop Bus) is a simple inter-process communication (IPC) system for software applications to communicate with one another. D-Bus was heavily influenced by KDE2–3's DCOP system and has replaced it in the KDE 4 release; it is supported on Linux, Microsoft Windows and Apple OS X operating systems and is used by Qt 4 and GNOME. In GNOME it has gradually replaced most parts of the earlier Bonobo mechanism.

D-Bus is primarily developed by Red Hat, as part of the freedesktop.org project. Released under the terms of the GNU General Public License and the Academic Free License, D-Bus is free software.

Contents

[edit] Design

D-Bus allows programs to register on it for offering services to others. It also offers client programs the possibility to look up which services are available. Programs can also register as waiting for events of the kernel like hot swapping hardware.

D-Bus is implemented as a daemon. Users can run several instances of it, each called a channel. There will usually be a privileged system channel, and a private instance for each logged in user. The private instances are required because the system channel has access restrictions.

The main mission of the system channel is to deliver the signals from the HAL (hardware abstraction layer) daemon to the processes interested in them. The mission of the private instances is to provide unrestricted communication among any applications of the user.

[edit] Architecture

D-Bus has three architectural layers:[2]

  • A library, libdbus, that allows two applications to connect to each other and exchange messages.
  • A message bus daemon executable, built on libdbus, that multiple applications can connect to. The daemon can route messages from one application to zero or more applications, thereby implementing the publish/subscribe paradigm.
  • Wrapper libraries based on particular application frameworks.

D-Bus is designed for two specific cases:

  • Communication between desktop applications in the same desktop session; to allow integration of the desktop session as a whole, and address issues of process lifecycle.
  • Communication between the desktop session and the operating system, where the operating system would typically include the kernel and any system daemons or processes.

[edit] Mechanisms

Each application using D-Bus contains objects, which generally (but not necessarily) map to GObject, QObject, C++ objects, or Python objects. An object is an instance rather than a type. When messages are received over a D-Bus connection, they are sent to a specific object, not to the application as a whole. In this way, D-Bus resembles software componentry, as it appears to the user as if he is interacting with an object across the IPC connection, no matter if there is an object on the other side or not.

To allow messages to specify their destination object, there has to be a way to refer to an object. In many programming languages, this is usually called a pointer or reference. However, these references are implemented as memory addresses relative to the address space of the application, and thus can't be passed from one application to another.

To solve this, D-Bus introduces a name for each object. The name looks like a filesystem path, for example an object could be named /org/kde/kspread/sheets/3/cells/4/5. Human-readable paths are preferred, but developers are free to create an object named /com/mycompany/c5yo817y0c1y1c5b if it makes sense for their application.

The D-Bus objects' names are namespaced to ensure different code modules are kept separated. Namespaces are generally prefixed with the developer's domain name components (eg. /org/kde).

[edit] References

[edit] External links

  • D-Bus at the Freedesktop.org home page
Personal tools