D-BUS is a system for interprocess communication (IPC) written in
C. It makes it possible for applications to communicate to one another. It
was started in 2002 by Havoc Pennington, Alex Larsson, and Anders Carlsson
as part of the freedesktop.org project to standardize around one messaging
platform for the desktop.
D-BUS was designed for two specific cases—communication between
desktop applications in the same desktop session and communication between
the desktop session and the operating system.
D-BUS has nice clear architecture. It consists of the three basic layers:
- Low-level library for connecting applications to each other
and exchanging messages. It supports one-to-one connections
- message bus daemon
- Executable to which multiple applications can
connect. The daemon can route messages from one application to zero or
- wrapper libraries
- Wrapper libraries, also known as bindings, wrap
the standard low-level library D-BUS to provide a better environment
Wrapper libraries include libdbus-qt and libdbus-glib.
Because D-BUS is a message bus system, it does not send byte streams
but messages. Messages have a header with type identification and a body
including data. They are binary in format. There are different built-in
messages, for example, for error messages or event
notification. Information about the message type is stored in the header of the
message. The header also includes information about the path and
interface of the message.
The bus daemon, which acts like a server for messages, normally has
multiple instances. The first is global and mostly is similar to classic
httpd or sendmail. This instance has a lot of security restrictions and it
is used for systemwide communication. The other instances are created one
per user login session. These instances are used for communication among
applications in the user session.
Before a connection is established and communication starts,
applications must authenticate. For this purpose, a simple
plain-text protocol based on SASL is used. To deliver the right message to
application, addresses in a special format and message bus
names are used. This means that every connection has at least one name. When a
connection is closed, all the names that it owns are deleted.
The core low-level D-BUS API is written in C and is not intended for
developing application frameworks. D-BUS provides various bindings to
languages for this purpose. Among others, you can choose: