ifex

IFEX / D-Bus mapping

General

Primitive types

Most IFEX data types translate well to D-Bus. We can follow the generic principles of Mapping primitive types. In a few cases we need to follow a widening or minor-difference coercion approach (see linked chapter for details).

D-Bus basic types

…as defined in D-Bus Specification

Name Meaning
BYTE Unsigned 8-bit integer
BOOLEAN Boolean value: 0 is false, 1 is true
INT16 Signed (two’s complement) 16-bit integer
UINT16 Unsigned 16-bit integer
INT32 Signed (two’s complement) 32-bit integer
UINT32 Unsigned 32-bit integer
INT64 Signed (two’s complement) 64-bit integer
UINT64 Unsigned 64-bit integer
DOUBLE IEEE 754 double-precision floating point
UNIX_FD 32-bit index into array of file descriptors
STRING UTF-8 string (must be valid UTF-8). Must be nul terminated and contain no other nul bytes.

D-Bus composite and non-obvious types

Name Meaning
OBJECT_PATH Name of an object instance
SIGNATURE A type signature
VARIANT Variant type (the type of the value is part of the value itself)
DICT Key-value mapping

Type mappings (IFEX -> D-Bus)

Direction of IFEX Core IDL to D-Bus (represented by its introspection XML format):

Type mappings (D-Bus to IFEX)

Translating an existing D-Bus interface to IFEX Core IDL:

Follow the reverse of the above, with these additional comments:

As always, types that do not exist in the source (D-Bus) will naturally not appear in the translation (IFEX). There could be some special situation where the use of additional metadata (a Layer), certain objects could be given more semantic meaning, for example “this array is actually is a set”, but IFEX users will have to propose a solution if the need for this arises.

Comments

Feature mapping

We ought to be able to convert IFEX Errors into a D-Bus error in the implementation but it seems to be not described in the XML format (TODO: investigate further)

Errors

D-Bus describes an Error message type that can be sent in different situations, but usually as a reply to a method call. IFEX Errors concept also defines errors individually for each method. There are few rules expressed in the D-Bus specification but this sentence seems most significant:

"_An ERROR may have any arguments, but if the first argument is a STRING, it must be an error message. The error message may be logged or shown to the user in some way._"

This means that if the IFEX interface has a string as its first argument, we ought to establish whether it is an error message and shall be treated as such in the D-Bus representation of the interface (it could be a safe assumption to make, but alternatively some user interaction is appropriate, and/or to require this to be a parameter to the code generator).

TODO: Is there an XML representation of the error, or not? (Cannot determine this from the D-Bus specification).