Dbus in a Nutshell

Dbus comes under IPC Mechanism for communicating between 2 or more process using message passing through an indirect method. This is used in linux to communicate with desktop applications in linux and hence the name Dbus or the desktop. The dbus can be diagrammatically represented as

Internally Dbus uses sockets at the lower level in the libdbus library for communication. The Dbus deamon is responsible for sending and receiving the message and delivering it to the correct sender and receiver based on the details of the sender/receiver. The Dbus Bindings provide the language specific Bindings.Let us say that process A is written in C language and Process B is written in Qt language. The bindings here are nothing but the API written in their own language i.e. C and Qt which are used to communicate with the Dbus deamon.

There are 2 daemons created one is the system bus deamon and the other is the session bus deamon

https://linux.die.net/man/1/dbus-daemon

Session bus -a session is group of process running under a user. There can be one or more session bus instance running on the system using Dbus launch command.

The system bus will have only one instance of it running.

The Dbus uses the following concept to communicate with process and is independent of the programming language.

1) the object defined by object path
2) Interface
3) method signal and properties Objects.

 The bindings from the native language to Dbus are done through objects and this can be considered as a entity that can be used to identify the process Object path Each object will have a specific object path and this is used to name the native objects so that other process can refer. Interface This contains the methods signals and properties and the interface name is the used to represent the collection of methods signals and properties under it Method A method is a function with parameter name, value and return type Signal

A signal message that is broadcasted Properties
These are the values that can be changed or only read and Types of objects

Server object which is used to represent the interface on the server side Proxy object which is used to represent interface on the client side We have the client server based communication in dbus where the server contains the implementation and client request

When a process is connected to the bus then a unique name is give by dbus deamon and this is called unique name. This is like port number followed by a colon but the process can map a well known name and the

Dbus deamon resolves it. It can be compared to a DHCP server giving IP to each user and a DNS Server used to resolve the user-friendly names.

Example xml file

References:

https://dbus.freedesktop.org/doc/dbus-tutorial.html

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.