D-Bus is a system for interprocess communication (IPC). Architecturally, it has several layers:
-
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 other applications.
-
Wrapper libraries or bindings based on particular application frameworks. For example, libdbus-glib and libdbus-qt. There are also bindings to languages such as Python. These wrapper libraries are the API most people should use, as they simplify the details of D-Bus programming. libdbus is intended to be a low-level backend for the higher level bindings. Much of the libdbus API is only useful for binding implementation.
libdbus only supports one-to-one connections, just like a raw
network socket. However, rather than sending byte streams over the
connection, you send messages. Messages
have a header identifying the kind of message, and a body containing a
data payload. libdbus also abstracts the exact transport used (sockets
vs. whatever else), and handles details such as authentication.
The message bus daemon forms the hub of a wheel. Each spoke of the
wheel is a one-to-one connection to an application using libdbus. An
application sends a message to the bus daemon over its spoke, and the
bus daemon forwards the message to other connected applications as
appropriate. Think of the daemon as a router.
The bus daemon has multiple instances on a typical computer. The
first instance is a machine-global singleton, that is, a system daemon
similar to sendmail or Apache. This instance has heavy security
restrictions on what messages it will accept, and is used for
systemwide communication. The other instances are created one per user
login session. These instances allow applications in the user's session
to communicate with one another.
The systemwide and per-user daemons are separate. Normal
within-session IPC does not involve the systemwide message bus process
and vice versa.