I. Overview
Official Website: http://www.freeyuntop.org/wiki/software/dbus, but if you want to download windowsCodeIt is best not to decompress the package from SourceForge in version 1.2.4 after multiple times. It can be obtained from SVN. For details, refer to the compile compilation section below.
You can see from the official homepage that the following section describes the D-BUS: "D-bus is a message bus system, a simple way for applications to talk to one another. in addition to Interprocess Communication, D-bus helps coordinate process lifecycle; it makes it simple and reliable to code a "single instance" application or daemon, and to launch applications and daemons on demand when their services are needed."
Therefore, D-BUS is essentially an implementation of inter-process communication (IPC. He was originally developed on the Linux platform and was developed as part of the freeyuntop.org project. Is beginning to penetrate into the Linux Desktop. It has been implemented in qt4, gnome, windows, and maemo. Kde4 has replaced the famous dcop and replaced the bulky bonobo in gnome. It is often used in embedded systems to implement the C/S structure.
As an IPC, it implements two points:
1. Different applications in the same desktop sessionProgramCommunication: The system bus is used by the operating system and background processes. It is highly secure and prevents any application from spoofing system events. Applications can communicate directly with the system bus, but the messages sent are limited.
2. The desktop program communicates with the kernel or daemon: Session bus, which is private to the login user. It is a session bus used by your applications to communicate with each other.
II,D-BUS Characteristics
1. D-BUS protocols are low-latency and Low-overhead, designed to be small (but less code) and efficient to minimize delivery time. It is designed to avoid round-trip interaction and allow asynchronous operations.
2. The protocol is binary, not text. This eliminates the time-consuming serialization process (our universal parameter serialization takes a relatively long time ).
3. the byte sequence problem is considered.
4. ease of use: It operates based on Messages rather than byte streams, and automatically handles many difficult IPC problems, and the D-bus library is designed in an encapsulated manner, in this way, developers can use the object/Type System in the framework, instead of learning a new object/type system dedicated to IPC.
5. Start the service and security policy during the request.
6. Because it was developed as a freeyuntop.org project and many talents participated in it, the quality should be guaranteed.
7. Supports multiple languages (C/C ++/Java/C sharp/Python/Ruby) and multiple platforms (Linux/Windows/maemo ).
8. Use C language instead of C ++.
9. Because it is basically not used for IPC on the Internet, local IPC is specially optimized.
10. Provide Service Registration, which can be infinitely expanded theoretically.
Iii. Architecture
Divided into three layers:
A. libbench library implements the underlying API and protocol. It has no dependencies except the XML parser. For different languages, the protocol may be implemented again. This library is a foundation. Although it is officially said that it is not designed to be called by the application, the application can actually be called directly, especially for Windows, the examples in the following analysis can be seen;
B. The message daemon can manage communications between multiple applications based on the liblistener. Each application is connected to the Message daemon, which distributes messages in a unified manner;
C. Various packaging libraries, bound to some common frameworks (QT, glib, Java, Python, C sharp etc.) have no new features, but they only encapsulate the libraries. This layer is recommended for convenient use of official applications;
Architecture Diagram