Skip to content

Custom marshalling/transport API#9

Merged
jmacato merged 22 commits into
mainfrom
features/new-transport
Mar 11, 2026
Merged

Custom marshalling/transport API#9
jmacato merged 22 commits into
mainfrom
features/new-transport

Conversation

@jmacato
Copy link
Copy Markdown
Member

@jmacato jmacato commented Mar 6, 2026

This PR creates a new implementation of IDBusWireConnection that 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ChannelsDBusWireConnection backed by Channel<DBusSerializedMessage> with reply correlation, serial assignment, and DBusTransport/UnixSocketDBusTransport for socket-level framing
  • Renamed existing libdbus-backed classes (DBusWireConnectionLibDBusWireConnection, DbusWireWorkerLibDbusWireWorker) 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.

Comment thread src/Avalonia.DBus/Transport/UnixSocketDBusTransport.cs Outdated
Comment thread src/Avalonia.DBus/Managed/DBusWireReader.cs
Comment thread src/Avalonia.DBus/Transport/UnixSocketDBusTransport.cs Outdated
Comment thread src/Avalonia.DBus/ChannelsDBusWireConnection.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/Avalonia.DBus/Transport/UnixSocketDBusTransport.cs Outdated
Comment thread src/Avalonia.DBus/Managed/DBusWireReader.cs Outdated
Comment thread src/Avalonia.DBus/Transport/UnixSocketDBusTransport.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/Avalonia.DBus/ChannelsDBusWireConnection.cs
@jmacato jmacato force-pushed the features/new-transport branch from c0beb7a to 1445b11 Compare March 6, 2026 09:07
@jmacato jmacato marked this pull request as ready for review March 6, 2026 09:07
@jmacato jmacato merged commit 730b3a9 into main Mar 11, 2026
9 checks passed
@jmacato jmacato deleted the features/new-transport branch March 11, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants