feat(winrt): secure device association over loopback #19

Open
github-bot wants to merge 1 commit from github-bot/gh-19 into main AGit
Owner

@⁠landovg on GitHub · 2026-11-27 18:42 UTC · original
landovg:feat/sda-loopback → main · +1311 −11 · 9 files · 1 commits · open

Closes #18 (the design issue for this change).

What

Windows.Xbox.Networking's SecureDeviceAssociationTemplate returned no templates, and every association failed as offline. This adds:

  • appx::inspect_manifest reads the windows.xbox.networking extension, under an application (where titles have it) or under the package:

    • socket descriptions: name, SecureIpProtocol, BoundPort range, usages;
    • association templates: initiator and acceptor sockets, usages, MultiplayerSessionRequirement.

    Malformed, reversed and out-of-range ports are refused.

  • winrt/networking, reached from activation_factory like the input and storage classes:

    • SecureDeviceAssociationTemplate statics: Templates and GetTemplateByName (exact names).
    • Template objects with their socket descriptions, usages, session requirement and live associations.
    • CreateAssociationAsync and CreateAssociationForPortsAsync complete at once with a Ready association. Its remote socket address is a peer on this machine at the acceptor's port (or the port asked for): ::1, or the IP address in XV_SDA_PEER. Ports outside the template's sockets are refused.
    • SecureDeviceAssociation statics: GetAssociationBySocketAddressBytes.
    • DestroyAsync (→ Destroyed).
  • The two inert rows these classes replace are removed: statics slots 6 and 7.

Not implemented yet:

  • RemoteHostName / LocalHostName (E_NOTIMPL);
  • GetAssociationByHostNamesAndPorts;
  • certificate requests;
  • incoming associations (AssociationIncoming is never raised).

Where the interface details come from

The GUIDs and member order are from WinDurango's idl/Windows.Xbox.Networking.idl (LGPL), and they agree with this repository's own inert table:

  • statics slot 6 GetTemplateByName, slot 7 Templates, under the same statics IID 46745a18-…;
  • the template's instance rows 6–20, written from titles' calls, including the result argument of each async method.

No SDK headers or console material is included.

Tested

Windows 11, VS 2022 Build Tools 17.14 (MSVC 14.44), Release build.

  • build.cmd --test: CTest 2/2.
  • xv_tests from its fixture directory: 141/141 test cases, 22,370 assertions (before: 134/134, 22,240).
  • The 7 new [network] cases (130 assertions), all on synthetic manifests:
    • parsing, including broken ports and both extension locations;
    • the model, including a template naming an undescribed socket;
    • template lookup and properties;
    • the association lifecycle and lookup by socket address;
    • XV_SDA_PEER;
    • a UDP datagram from a "title" socket to a local server through the association's address, and the reply back, on ::1 and 127.0.0.1.
  • clang-format --dry-run: clean on every touched file.

🤖 Generated with Claude Code

**@⁠landovg** on GitHub · 2026-11-27 18:42 UTC · [original](https://github.com/sammwyy/xvalkyrie/pull/19) `landovg:feat/sda-loopback` → `main` · +1311 −11 · 9 files · 1 commits · open Closes #18 (the design issue for this change). ### What Windows.Xbox.Networking's `SecureDeviceAssociationTemplate` returned no templates, and every association failed as offline. This adds: - **`appx::inspect_manifest`** reads the `windows.xbox.networking` extension, under an application (where titles have it) or under the package: - socket descriptions: name, `SecureIpProtocol`, `BoundPort` range, usages; - association templates: initiator and acceptor sockets, usages, `MultiplayerSessionRequirement`. Malformed, reversed and out-of-range ports are refused. - **`winrt/networking`**, reached from `activation_factory` like the input and storage classes: - `SecureDeviceAssociationTemplate` statics: `Templates` and `GetTemplateByName` (exact names). - Template objects with their socket descriptions, usages, session requirement and live associations. - `CreateAssociationAsync` and `CreateAssociationForPortsAsync` complete at once with a **Ready** association. Its remote socket address is a peer on this machine at the acceptor's port (or the port asked for): `::1`, or the IP address in `XV_SDA_PEER`. Ports outside the template's sockets are refused. - `SecureDeviceAssociation` statics: `GetAssociationBySocketAddressBytes`. - `DestroyAsync` (→ Destroyed). - The two inert rows these classes replace are removed: statics slots 6 and 7. **Not implemented yet:** - `RemoteHostName` / `LocalHostName` (`E_NOTIMPL`); - `GetAssociationByHostNamesAndPorts`; - certificate requests; - incoming associations (`AssociationIncoming` is never raised). ### Where the interface details come from The GUIDs and member order are from WinDurango's `idl/Windows.Xbox.Networking.idl` (LGPL), and they agree with this repository's own inert table: - statics slot 6 `GetTemplateByName`, slot 7 `Templates`, under the same statics IID `46745a18-…`; - the template's instance rows 6–20, written from titles' calls, including the result argument of each async method. No SDK headers or console material is included. ### Tested Windows 11, VS 2022 Build Tools 17.14 (MSVC 14.44), Release build. - `build.cmd --test`: CTest 2/2. - `xv_tests` from its fixture directory: **141/141 test cases, 22,370 assertions** (before: 134/134, 22,240). - The 7 new `[network]` cases (130 assertions), all on synthetic manifests: - parsing, including broken ports and both extension locations; - the model, including a template naming an undescribed socket; - template lookup and properties; - the association lifecycle and lookup by socket address; - `XV_SDA_PEER`; - a UDP datagram from a "title" socket to a local server through the association's address, and the reply back, on `::1` and `127.0.0.1`. - `clang-format --dry-run`: clean on every touched file. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Windows.Xbox.Networking's SecureDeviceAssociationTemplate returned no templates
and every association failed as offline, so a title that sends its game traffic
through secure device association (SDA) had no socket address to send to.

- appx: inspect_manifest reads the windows.xbox.networking extension (under an
  application, as titles have it, or under the package): socket descriptions
  with protocol, BoundPort range and usages, and association templates with
  their sockets, usages and MultiplayerSessionRequirement. Malformed, reversed
  and out-of-range ports are refused.
- winrt/networking: SecureDeviceAssociationTemplate's statics (Templates,
  GetTemplateByName) over the title's manifest; templates with their socket
  descriptions; CreateAssociationAsync / CreateAssociationForPortsAsync give an
  association that is Ready at once and whose remote socket address is a peer
  on this machine at the acceptor's port (::1, or the IP in XV_SDA_PEER), so a
  local server can answer; SecureDeviceAssociation's statics find an
  association by socket address; DestroyAsync.
- The two inert rows these classes replace are removed.

Interface IDs and member order: Windows.Xbox.Networking as WinDurango's
idl/Windows.Xbox.Networking.idl declares it; the statics slots agree with the
existing inert rows (6 GetTemplateByName, 7 Templates), and the template's
instance slots 6-20 with the inert rows written from titles' calls.

Tests (synthetic manifests): parsing including broken ports, the model,
template lookup, the association lifecycle and lookup, the peer setting, and a
UDP datagram from a title socket to a local server through an association's
address and back, on ::1 and 127.0.0.1. xv_tests: 141/141 cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 18:45:29 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/19/head:github-bot/gh-19'
git switch 'github-bot/gh-19'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-19'
git switch 'github-bot/gh-19'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-19'
git switch 'github-bot/gh-19'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-19'
git switch 'main'
git merge --squash 'github-bot/gh-19'
git switch 'main'
git merge --ff-only 'github-bot/gh-19'
git switch 'main'
git merge 'github-bot/gh-19'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/sammwyy--xvalkyrie!19
No description provided.