Skip to main content

Module dbus

Module dbus 

Source
Expand description

D-Bus server: NetGet as a small message bus that every call terminates at. A client authenticates (SASL EXTERNAL on the Unix socket, checked against the peer’s uid; ANONYMOUS where allowed), may say Hello and request names, and every method call that is not the bus’s own goes to the model, which answers with a return value or an error.

Fails closed: a call expecting a reply that gets none from the model — no answer, an answer that does not encode, a backend failure — is answered with a D-Bus error, never left to the caller’s timeout.

Modules§

actions
What the model sees of a D-Bus method call and how it answers. dbus_return and dbus_error answer the call being handled — the protocol instance carries it — and dbus_emit_signal may accompany either, or be injected into a connection at any time.
wire
The D-Bus wire protocol (D-Bus Specification 0.43), shared by NetGet’s server and client: the SASL handshake that precedes messages, and messages themselves — the fixed header, the header fields, and a body marshalled by its type signature. Bodies are converted to and from JSON so the model never sees bytes: a signature says how a JSON value is encoded.

Constants§

AUTH_TIMEOUT
The SASL handshake, from connect to BEGIN.
DEFAULT_ALLOW_ANONYMOUS
IDLE_TIMEOUT
How long an authenticated connection may stay silent, by default.
MAX_IDLE_TIMEOUT_SECS

Functions§

authenticate
The server’s half of SASL: a NUL byte, then lines until BEGIN. EXTERNAL is offered only where the peer’s uid is known (the Unix socket) and succeeds only for that uid.
spawn