Custom marshalling/transport API#9
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new ChannelsDBusWireConnection implementation of IDBusWireConnection that decouples D-Bus message transport from the native libdbus library. It adds managed (pure C#) serialization/deserialization of D-Bus wire format messages (ManagedDBusMessageSerializer, DBusWireWriter, DBusWireReader), a Unix socket transport layer (DBusTransport, UnixSocketDBusTransport), and renames the existing libdbus-based classes from DBusWireConnection/DbusWireWorker to LibDBusWireConnection/LibDbusWireWorker for clarity.
Changes:
- Added managed D-Bus wire format reader/writer/serializer (
DBusWireReader,DBusWireWriter,ManagedDBusMessageSerializer) supporting little-endian and big-endian byte orders - Added
ChannelsDBusWireConnectionbacked byChannel<DBusSerializedMessage>with reply correlation, serial assignment, andDBusTransport/UnixSocketDBusTransportfor socket-level framing - Renamed existing libdbus-backed classes (
DBusWireConnection→LibDBusWireConnection,DbusWireWorker→LibDbusWireWorker) and updated all references
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/Avalonia.DBus/ChannelsDBusWireConnection.cs |
New IDBusWireConnection impl using channels, with reply correlation and serial management |
src/Avalonia.DBus/Managed/DBusWireWriter.cs |
LE wire-format writer for D-Bus primitives |
src/Avalonia.DBus/Managed/DBusWireReader.cs |
LE/BE wire-format reader for D-Bus primitives |
src/Avalonia.DBus/Managed/ManagedDBusMessageSerializer.cs |
Full D-Bus message serialize/deserialize using managed reader/writer |
src/Avalonia.DBus/IDBusMessageSerializer.cs |
New interface for custom serialization |
src/Avalonia.DBus/DBusSerializedMessage.cs |
New record holding wire bytes + out-of-band fds |
src/Avalonia.DBus/Transport/DBusTransport.cs |
Factory bridging sockets to channel pairs |
src/Avalonia.DBus/Transport/UnixSocketDBusTransport.cs |
Background reader/writer tasks for socket framing |
src/Avalonia.DBus/DBusTransportLog.cs |
Diagnostic logging helpers for transport layer |
src/Avalonia.DBus/LibDBusWireConnection.cs |
Renamed from DBusWireConnection |
src/Avalonia.DBus/LibDbusWireWorker.cs |
Renamed from DbusWireWorker |
src/Avalonia.DBus/LibDBusMessageMarshaler.cs |
Extracted libdbus marshalling (previously inline) |
src/Avalonia.DBus/DbusWireWorker.Records.cs |
Updated type references for rename |
src/Avalonia.DBus/DBusConnection.cs |
Updated to use renamed LibDBusWireConnection |
src/Avalonia.DBus/Avalonia.DBus.csproj |
Added InternalsVisibleTo for new test project |
tests/.../ManagedDBusMessageSerializerTests.cs |
Comprehensive round-trip tests for managed serializer |
tests/.../DBusWireWriterTests.cs |
Unit tests for wire writer |
tests/.../DBusWireReaderTests.cs |
Unit tests for wire reader |
tests/.../ChannelsDBusWireConnectionTests.cs |
Tests for channels-based connection |
tests/.../UnixSocketDBusTransportTests.cs |
Transport round-trip tests over Unix sockets |
tests/.../P2PWireConnectionTests.cs |
Integration tests for P2P connections |
tests/.../ManagedSerializerCrossValidationTests.cs |
Cross-validation against NDesk reference implementation |
tests/.../Avalonia.DBus.WireMarshalling.Tests.csproj |
New test project config with extern alias |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 23 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 23 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c0beb7a to
1445b11
Compare
This PR creates a new implementation of
IDBusWireConnectionthat allows users to customize the wire-level de/serialization with custom marshalling and also allows them to customize the method of transporting DBus messages with ChannelsDBusWireConnection.