Specifications
CHAPTER 5. IMPLEMENTATION 46
The string mod options consists of one or more strings with the format mod option. The
function opt modules opts() parses the string mod options using string operations provided
by the GNU C Library. One mod option supplies the configuration options for one module. To
pass configuration options for several modules, a comma-separated list of mod option strings
has to be passed as argument. The following example is based on the already discussed
demonstration module (§5.3). For this module, a valid argument for the configuration option
module-options would be:
example_module:disable=false:verbose=true
Granted that a second module with the token example module2 is available which has same
options as the first demonstration module, a valid argument for module-options would be:
example_module:disable=false:verbose=true,example_module2:disable=true
Possible configuration options which were already set by the configuration file parser (stage
two) are overwritten by the command line parser. This is done on purpose as it offers an easy
way for testing various configuration options of the daemon without the need of changing the
Input Abstraction Layer’s configuration file. As soon as the command line parser has finished
processing the command line options, the third stage is finalized. At this point the set-up of
all modules is completed. The daemon is set up, too, but the D-BUS environment has still to
be set up before it is possible to start the modules.
D-BUS
The daemon performs several operations to set up the D-BUS environment for the Input
Abstraction Layer at stage four. First of all, the daemon’s global variable dbus connection
of type DBusConnection represents the connection to the system message bus. To establish
a connection to the system message bus, the daemon calls the function ial dbus connect(),
which is implemented by the library (§5.2). The daemon subsequently creates the D-BUS
service using this connection. The following source code shows the set-up of the D-BUS
service:
/* Establish connection to the system message bus. */
if (ial_dbus_connect() == FALSE) {
ERROR(("D-BUS connection failed."));
exit(1);
}
/* Create D-BUS interface "com.novell.Ial". */
dbus_bus_acquire_service(dbus_connection,
"com.novell.Ial",
0,
&dbus_error);
The first argument of dbus acquire service() represents the connection to the D-BUS.
The string com.novell.Ial passed as second argument states the name of the D-BUS service