feat(libwebrtc): implement the rtc::SocketAddress port, ipaddr, IsAnyIP, IsComplete and IsNil accessors #15261

Merged
alvaroelpob merged 5 commits from upstream-pr/15261 into main 2026-11-06 22:24:08 +00:00
alvaroelpob commented 2026-11-02 22:34:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alvaroelpob on 2026-11-02T22:34:58Z.


What

Implements the rtc::SocketAddress const accessors port(), ipaddr(), IsAnyIP(), IsComplete() and IsNil() in libwebrtc, which threw and were declared without parameters.

The module's WebRTC revision lies between M127 and M134, as recorded in the debt file. The five accessors in socket_address.cc (M127, M134) and IPIsAny in ip_address.cc are the same at both. socket_address.h differs only in a unit-test-only operator<<. src/SocketAddress.cpp starts with that file's WebRTC notice and the BSD licence.

WebRtcSocketAddress is the 88-byte layout:

  • hostname_ at 0: the guest's 40-byte std::string that GuestLocale.hpp measured on the console (characters inline up to a capacity of 15, on the heap above), added as include/GuestString.hpp;
  • the 32-byte IPAddress on main at 40;
  • port_ at 72, scope_id_ at 76 and literal_ at 80.

Behaviour:

  • port returns port_, and ipaddr returns a pointer to ip_, as the const IPAddress& it is.
  • IsAnyIP matches 0.0.0.0, :: and ::ffff:0.0.0.0.
  • IsComplete is "not any, and a nonzero port".
  • IsNil is "empty hostname, unspecified family and port 0".

A null address throws. It removes 5 exports from the inventory.

Tested

Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with BUILD_TESTING=ON.

  • New guest_webrtc_socket_address test:
    • IPv4 any and loopback, IPv6 ::, ::ffff:0.0.0.0, ::1, and a half-written mapped prefix that is not "any".
    • Unspecified addresses with and without a port, with an inline hostname, an empty one and a heap one.
    • ipaddr returns the embedded address, and a null address throws.
  • Full ctest -j16 on head 83d05eadce: 3596/3596 pass. check_conventions.py --base upstream/main passes.
  • pr_overlap.py: no open pull request implements these functions. The shared lines are the pending-export count in docs/dev/debt/libwebrtc.md and the source, test and declaration lists in CMakeLists.txt and Api.hpp.
  • Not tested: Windows, a title.
  • Rebased on main 4f41f4c375, head f05c14ceca, to resolve the conflicts on the shared CMakeLists.txt, Export.cpp and debt-file lines; both sides are kept and the debt count is recomputed from Export.cpp. Full build and ctest -j16: 3796/3800 pass; guest_sce_net, guest_poll, guest_select_wait and guest_memory failed under that load, pass when run alone, and main 4f41f4c375 passes all 3799 with -j16 on the same machine. check_conventions.py --base upstream/main passes.
  • Head fbbde73875, after review: adds the Derived from lines for socket_address.cc and ip_address.cc. Full build and ctest -j16: 3796/3800 pass; guest_sce_net, guest_poll, guest_select_wait and guest_memory fail only when the suite runs as a background job here, and pass when run in the foreground on this head and on main. check_conventions.py --base upstream/main passes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5128521508 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15261). Originally posted by [alvaroelpob](https://github.com/alvaroelpob) on 2026-11-02T22:34:58Z. --- ### What Implements the `rtc::SocketAddress` const accessors `port()`, `ipaddr()`, `IsAnyIP()`, `IsComplete()` and `IsNil()` in libwebrtc, which threw and were declared without parameters. The module's WebRTC revision lies between M127 and M134, as recorded in the debt file. The five accessors in `socket_address.cc` ([M127](https://webrtc.googlesource.com/src/+/e0b28a6a81a989c1f5c89e30fcd247870047390d/rtc_base/socket_address.cc), [M134](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/rtc_base/socket_address.cc)) and `IPIsAny` in `ip_address.cc` are the same at both. `socket_address.h` differs only in a unit-test-only `operator<<`. `src/SocketAddress.cpp` starts with that file's WebRTC notice and the BSD licence. `WebRtcSocketAddress` is the 88-byte layout: - `hostname_` at 0: the guest's 40-byte `std::string` that [`GuestLocale.hpp`](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libc/include/GuestLocale.hpp) measured on the console (characters inline up to a capacity of 15, on the heap above), added as `include/GuestString.hpp`; - the 32-byte `IPAddress` on `main` at 40; - `port_` at 72, `scope_id_` at 76 and `literal_` at 80. Behaviour: - `port` returns `port_`, and `ipaddr` returns a pointer to `ip_`, as the `const IPAddress&` it is. - `IsAnyIP` matches 0.0.0.0, `::` and `::ffff:0.0.0.0`. - `IsComplete` is "not any, and a nonzero port". - `IsNil` is "empty hostname, unspecified family and port 0". A null address throws. It removes 5 exports from the inventory. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with `BUILD_TESTING=ON`. - New `guest_webrtc_socket_address` test: - IPv4 any and loopback, IPv6 `::`, `::ffff:0.0.0.0`, `::1`, and a half-written mapped prefix that is not "any". - Unspecified addresses with and without a port, with an inline hostname, an empty one and a heap one. - `ipaddr` returns the embedded address, and a null address throws. - Full `ctest -j16` on head 83d05eadce: 3596/3596 pass. `check_conventions.py --base upstream/main` passes. - `pr_overlap.py`: no open pull request implements these functions. The shared lines are the pending-export count in `docs/dev/debt/libwebrtc.md` and the source, test and declaration lists in `CMakeLists.txt` and `Api.hpp`. - Not tested: Windows, a title. - Rebased on `main` 4f41f4c375, head f05c14ceca, to resolve the conflicts on the shared `CMakeLists.txt`, `Export.cpp` and debt-file lines; both sides are kept and the debt count is recomputed from `Export.cpp`. Full build and `ctest -j16`: 3796/3800 pass; `guest_sce_net`, `guest_poll`, `guest_select_wait` and `guest_memory` failed under that load, pass when run alone, and `main` 4f41f4c375 passes all 3799 with `-j16` on the same machine. `check_conventions.py --base upstream/main` passes. - Head fbbde73875, after review: adds the `Derived from` lines for `socket_address.cc` and `ip_address.cc`. Full build and `ctest -j16`: 3796/3800 pass; `guest_sce_net`, `guest_poll`, `guest_select_wait` and `guest_memory` fail only when the suite runs as a background job here, and pass when run in the foreground on this head and on `main`. `check_conventions.py --base upstream/main` passes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
boykopovar/AnyPS5!15261
No description provided.