Specifications

CHAPTER 5. IMPLEMENTATION 29
Modules use the structure IalEvent in conjunction with a wrapper function to report
abstract input events. The library libial implements this wrapper function and sends the
event using D-BUS. The meaning of the structure’s members is discussed in Section §5.2 and
§5.3.
All modules are based on two static data structures: ModuleData and ModuleOption. The
main structure ModuleData represents the common ground on which every module for the
Input Abstraction Layer is based on. The structure ModuleOption is required to represent a
module’s configuration option. Modules usually have a set of configuration options represented
as an array of ModuleOption structures. Apart from the modules, the daemon utilizes the two
structures for initialization, configuration and controlling the modules.
The use of both structures, their general importance at runtime and the meaning of the
structures’ members are discussed in Section §5.3 and §5.4.
5.2 Library
The library libial provides functions used by the remaining two components—the daemon
and the modules—and external applications. It implements wrapper functions for the inter-
process communication and the logging system. Hence, the library is split into two parts:
libial.c and libial log.c. The daemon as well as the modules have to be linked against
libial to utilize the library’s functions. Additionally, the library implements a function which
can be used by external applications to receive events from the Input Abstraction Layer. Due
to the fact that the library wraps most of the interprocess communication, this section first
describes the implementation of the interprocess communication using D-BUS.
D-BUS
In order to use D-BUS for interprocess communication, it first has to be properly set up. D-BUS
is implemented as a user space process (D-BUS daemon, dbus-daemon-1(1)) which provides
the two different message buses described in Chapter 4, §4.4. Since the Input Abstraction
Layer runs as a system daemon, it uses the system message bus. By default, this message bus
is well protected to prevent unauthorized processes from using it. The configuration of the
system message bus is stored in the file /etc/dbus-1/system.conf. It follows a deny policy.
This means, that by default, all operations on the system bus are denied for everyone. The
following excerpt from system.conf shows the corresponding implementation:
<policy context="default">
<deny send_interface="*"/>
<deny receive_interface="*"/>
<deny own="*"/>
<allow user="*"/>
<includedir>system.d</includedir>
</policy>
The first three tags encompass the default deny policy. On start-up the D-BUS daemon
sequentially parses the configuration file and hence denies send and receive operations to any
interface of the system message bus. The tag <deny own="*"/> further prevents processes
from creating services on the system message bus. The following tag <allow user="*"/> is