The IPC subsystem provides the transport-neutral interface used by Dobby clients and the daemon to invoke methods, emit signals, register handlers, and run an event dispatcher. On supported builds it has libdbus and sd-bus implementations.
It does not define container semantics; those are in protocol/ and daemon/client contracts.
DobbyProxy / Dobby
|
v
IIpcService
/ \
libdbus sd-bus
\ /
D-Bus bus
AppInfrastructure/IpcService/include/IIpcService.h: common service contract.AppInfrastructure/IpcService/include/IpcFactory.h: implementation selection.AppInfrastructure/IpcService/include/IpcVariantList.h: typed argument list.AppInfrastructure/IpcService/include/IpcFileDescriptor.h: descriptor transport.AppInfrastructure/IpcService/source/libdbus/: libdbus connection, parsing, watches, timeouts, dispatch, and async replies.AppInfrastructure/IpcService/source/sdbus/: sd-bus service, arguments, and async reply helpers.ipcUtils/include/DobbyIpcBus.handsource/DobbyIpcBus.cpp: Dobby-specific bus setup.ipcUtils/include/DobbyIPCUtils.handsource/DobbyIPCUtils.cpp: Dobby IPC utilities.
The two backend directories contain the implementation files corresponding to connection, message parsing, event dispatch, watches/timeouts, and reply handling. Backend-specific wire details were not fully inspected.
IIpcService exposes validity, synchronous/asynchronous method invocation, signals, handler registration, monitor mode, availability checks, flush, start, stop, and bus address access.
Actual excerpt from AppInfrastructure/IpcService/include/IIpcService.h:
virtual bool start() = 0;
virtual bool stop() = 0;
virtual void flush() = 0;start() begins the dispatcher; stop() terminates it. In the current implementation, libdbus flush() waits for queued handlers via mHandlerDispatcher.sync() (IpcService.cpp); the sd-bus implementation is explicitly a no-op (SDBusIpcService.cpp). Callers must not rely on flush() for synchronization when using sd-bus.
IpcService/BaseService and their sd-bus equivalents implement transport details. AsyncReplyGetter and AsyncReplySender bridge asynchronous calls. DbusConnection, DbusMessageParser, DbusEventDispatcher, DbusWatches, and DbusTimeouts divide libdbus responsibilities.
Top-level CMake requires dbus; USE_SYSTEMD selects systemd/sd-bus integration, while disabled builds use libdbus APIs. Dobby service/object defaults are set in protocol/include/DobbyProtocol.h and can be overridden by DOBBY_SERVICE and DOBBY_OBJECT CMake settings.
Initialization constructs a backend through the factory, registers methods/signals, and calls start(). A request is parsed into a VariantList, dispatched to a handler, and answered synchronously or through an async reply sender. Signals are emitted to subscribers. On libdbus, flush() drains queued handler work before returning; the sd-bus implementation does not provide that synchronization. stop() ends the dispatcher.
Error handling is represented by boolean/empty-pointer returns in the interface. Detailed backend error mapping is not documented here because it is implementation-specific.
sequenceDiagram
participant Caller
participant Service as IIpcService
participant Parser
participant Handler
Caller->>Service: invokeMethod
Service->>Parser: decode message
Parser->>Handler: dispatch arguments
Handler-->>Service: reply values
Service-->>Caller: reply
classDiagram
class IIpcService
class IAsyncReplyGetter
class IAsyncReplySender
class IpcFactory
class IpcService
IIpcService <|.. IpcService
IpcFactory --> IIpcService
IIpcService --> IAsyncReplyGetter
IIpcService --> IAsyncReplySender
stateDiagram-v2
[*] --> Created
Created --> Started: start()
Started --> Dispatching
Dispatching --> Flushing: flush()
Flushing --> Dispatching
Dispatching --> Stopped: stop()
Stopped --> [*]
flowchart TD
M[Method call] --> P[Parse arguments]
P --> H[Invoke handler]
H --> R[Build reply]
R --> S[Send reply or signal]
Existing tests include AppInfrastructure/IpcService/test/source/IIpcServiceTests.cpp, DbusEntitlementsTest.cpp, and common IPC utility tests. Add backend parity tests, timeout and disconnect tests, FD ownership tests, flush ordering tests, malformed signature tests, and start/stop idempotence tests. The repository does not prove identical behavior for every backend from the inspected headers.
Must know first: IPC is the message boundary; IIpcService hides whether the backend is libdbus or sd-bus.
Advanced path: study VariantList encoding, asynchronous reply ownership, event-dispatch threading, match rules, and the precise differences introduced by USE_SYSTEMD.