D-Bus

D-Bus (Desktop Bus) is a free IPC framework, ie, a software system for interprocess communication, which is based in particular on the needs of desktop environments, a graphical user interface.

It is part of the freedesktop.org project and is used in almost any modern Linux distribution, which has a graphical user interface. In its entirety, provides D-Bus with all its components generally a lightweight middleware represents, and in particular an Object Request Broker ( ORB).

Basics

On D-Bus programs can communicate. In the example shown on the right is a file manager program logs on to a system-wide program, which over the hardware that is connected to the computer, provides information ( in this example, the hardware abstraction layer daemon, short hal daemon ). The hal daemon now informs the File Manager in changes to the hardware, so that, for example, when inserting a USB stick that automatically mount, and can display the content.

Operation

Individual programs get about the software library libdbus the possibility of pairwise mutual contact and exchange messages. Be addressed in each objects whose naming is reminiscent of file system paths, such as / org/kde/kspread/sheets/3/cells/4/5. To ensure that different programs can be distinguished, the D-Bus objects are combined in one name space. These namespaces contain mostly the domain of the developer ( for example / org / kde for the programs from kde.org ).

In addition, there is an executable Nachrichtenbusdaemon dbus with which multiple applications can connect. The daemon can forward messages from one application to one or more applications.

Thought is D-Bus to the one for the communication between desktop applications the same session ( the so-called session bus) and the other for the communication between the desktop session and parts of the operating system, such as the kernel, the various system daemons and system processes ( system bus).

History

Even before the introduction of a standardized messaging system for desktop applications by freedesktop.org the two most popular desktop environments KDE and GNOME each have different, mutually incompatible implementations of the same concept used, namely DCOP ( Desktop Communication Protocol) for KDE and CORBA ( Common Object Request Broker Architecture ) for GNOME.

D-Bus has more features and was quickly adopted by the standardization of the desktop environment projects and dropped implementations of their own systems in favor of the standard. The standard protocol has been so since the discrepancies between the user interfaces so that increasingly fall to a relevant factor for the Linux desktop.

Components

The D-Bus daemon implements a so-called message bus (message bus), of an Object Request Broker is equivalent in its function. Any number of clients connect to the daemon, based on the D -Bus protocol and usually with the aid of libdbus. Individual (L ) RPC calls are received by the daemon and communicates to the appropriate client, so the daemon is a broker. The (L ) RPC calls to act on abstract objects, and, in accordance with the OOP object model method calls accordingly dar. addition provides the daemon even services such as Activation on. Recently, the daemon of course at the same time, based on the individual compounds, a one-to -many communication (broadcast ) are available.

D- bus library ( libdbus )

The D-Bus library provides a reference implementation of the D- Bus protocol or the D-Bus specification as a whole, as it gives an API in the C programming language, with the two processes can form a connection to then via LRPC / RPC to communicate. It further provides the necessary marshaling available, so the alignment and correct placement of the bytes for the transport. Ultimately, the API provides all the services for a simple abstract point - to-point ( process - to-process ) inter-process communication.

Building on libdbus itself implementations have developed for all popular programming languages ​​and frameworks, the latter particularly on Qt and Glib (GTK ) tailored implementations.

D -Bus protocol

The D -Bus protocol is a binary IPC protocol. Specifies both primitive types and allowable message types as well as the encoding for the transport. Basically, the protocol is based on the principle of message exchange and based thereon specified remote calls ( LRPCs / RPCs).

212038
de