1.
https://en.wikipedia.org/wiki/D-Bus
In computing, D-Bus (for "Desktop Bus"dead link]
The freedesktop.org project also developed a free and open-source software library called libdbus, as a reference implementation of the specification. This library should not be confused with the D-Bus itself; indeed, other implementations of the D-Bus client library also exist, such as GDBus (GNOME),[12]
]
D-Bus is an IPC mechanism initially designed to replace the software component communications systems used by the GNOME and KDE Linux desktop environments(CORBA and DCOP respectively).applications or by other components of the desktop environment to perform their tasks.
Due to the large number of processes involved —adding up processes providing the services and clients accessing them— establishing one-to-one IPC communications between all of them becomes an inefficient and quite unreliable[citation needed] approach. Instead, D-Bus provides a software-busabstraction that gathers all the communications between a group of processes over a single shared virtual channel.[6] Processes connected to a bus don't know how it is internally implemented, but D-Bus specification guarantees that all processes connected to the bus can communicate with each other through it.
Linux desktop environments take advantage of the D-Bus facilities by instancing not one bus but many[16]:
- a single system bus, available to all users and processes of the system, that provides access to system services (i.e. services provided by the operating system and also by any system daemons)
- a session bus for each user login session, that provides desktop services to user applications in the same desktop session, and allows the integration of the desktop session as a whole
A process can connect to any number of buses, provided that it has been granted access to them. In practice, this means that any user process can connect to the system bus and to its current session bus, but not to another users' session buses, or even to a different session bus owned by the same user. The latter restriction may change in the future if all user sessions are combined into a single user bus.[17]
D-Bus provides additional or simplifies existing functionality to the applications, including information-sharing, modularity and privilege separation. For example, information on an incoming voice-call received through Bluetooth or Skype can be propagated and interpreted by any currently-running music player, which can react by muting the volume or by pausing playback until the call is finished.[18]
D-Bus can also be used as a framework to integrate different components of a user application. For instance, an office suite can communicate through the session bus to share data between a word processor and a spreadsheet.
]
]
Every connection to a bus is identified in the context of D-Bus by what is called a bus name.[6]
When a process sets up a connection to a bus, the bus assigns to the connection a special bus name called unique connection name.[16]).
A process can ask for additional bus names for its connection,[6]
The idea behind these additional bus names, commonly called well-known names, is to provide a way to refer to a service using a prearranged bus name.org.freedesktop.timedate1 bus name, regardless of which process it is.
Bus names can be used as a simple way to implement single instance applications (second instances detect that the bus name is already taken).[16]
]
Because of its original conception as a replacement for several component oriented communications systems, D-Bus shares with its predecessors an object model in which to express the semantics of the communications between clients and services. The terms used in the D-Bus object model mimic those used by some object oriented programming languages. That doesn't mean that D-Bus is somehow limited to OOP languages —in fact, the most used implementation (libdbus) is written in C, a procedural programming language.
A process connected to a D-Bus bus can request it to export as many D-Bus objects as it wants. Each object is identified by an object path, a string of numbers, letters and underscores separated and prefixed by the slash character, called that because of their resemblance to Unix filesystem paths.[16]
Every object is inextricably associated to the particular bus connection where it was exported, and, from the D-Bus point of view, only lives in the context of such connection. Therefore, in order to be able to use a certain service, a client must indicate not only the object path providing the desired service, but also the bus name under which the service process is connected to the bus.[5] This in turn allows that several processes connected to the bus can export different objects with identical object paths unambiguously.
Members —methods and signals— that can be used with an object are specified by an interface.[16]
When using an object, it's a good practice for the client process to provide the member's interface name besides the member's name, but is only mandatory when there is an ambiguity caused by duplicated member names available from different interfaces implemented by the object[16] —otherwise, the selected member is undefined or erroneous. An emitted signal, on the other hand, must always indicate to which interface it belongs.
The D-Bus specification also defines several standard interfaces that objects may want to implement in addition to its own interfaces.[6]
- org.freedesktop.DBus.Peer: provides a way to test if a D-Bus connection is alive.[6]
- org.freedesktop.DBus.Introspectable: provides an introspection mechanism by which a client process can get in run-time a description (in XML format) of the interfaces, methods and signals that the object implements.[15]
- org.freedesktop.DBus.Properties: allows a D-Bus object to expose the underlying native object properties or attributes, or simulate them if it doesn't exist.[15]
- org.freedesktop.DBus.ObjectManager: when a D-Bus service arranges its objects hierarchically, this interface provides a way to query an object about all sub-objects under its path, as well as their interfaces and properties, using a single method call.[15]
The D-Bus specification defines a number of administrative bus operations (called "bus services") to be performed using the /org/freedesktop/DBus object that resides in the org.freedesktop.DBus bus name.[6]
]
D-Bus was conceived as a generic, high-level inter-process communication system. To accomplish such goals, D-Bus communications are based on the exchange of messages between processes instead of "raw bytes".[5]
:1.14) in the bus.
The bus supports two modes of interchanging messages between a client and a service process[5]:
- One-to-one request-response: This is the way for a client to invoke an object's method. The client sends a message to the service process exporting the object, and the service in turn replies with a message back to the client process.[16]
- Publish/subscribe: This is the way for an object to announce the occurrence of a signal to the interested parties. The object's service process broadcasts a message that the bus passes only to the connected clients subscribed to the object's signal.[16]
Every D-Bus message consists of a header and a body.marshaling.
The D-Bus specification defines the wire protocol: how to build the D-Bus messages to be exchanged between processes within a D-Bus connection. However, it does not define the underlying transport method for delivering these messages.
2.
https://aleksander.es/data/GNOMEASIA2014%20-%20Introduction%20to%20DBus.pdf
3.
https://developer.gnome.org/gio/stable/gdbus-convenience.html
4.
https://github.com/open-iscsi/tcmu-runner/blob/master/main.c