Skip to content

feat(host): expose FakeIP UDP ports, the game server FakeIP request and networking diagnostics - #4

Merged
hzqst merged 1 commit into
mainfrom
feat/fake-udp-ports
Nov 21, 2026
Merged

hzqst merged 1 commit into
mainfrom
feat/fake-udp-ports

Conversation

@hzqst

@hzqst hzqst commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Host mode gains what an engine needs for Steam FakeIP datagrams. It mirrors the HL25 GoldSrc engine (hw.so), which sends to FakeIPs from client and listen-server fake UDP ports. Needed for HLND2T/HLND2T-DiligentGraphics#704.

API (include/SteamAPIBridge.h)

  • Ports. SteamBridge_FakeUDPPortCreate / Destroy create and destroy an opaque port on the client session (SteamNetworkingSockets013 of the user) or on the game server session (of the game server). fakeServerPort is the fake port index, or -1. A session's shutdown destroys the ports it still holds.
  • Datagrams.
    • SteamBridge_FakeUDPPortSend returns the Steam EResult.
    • SteamBridge_FakeUDPPortReceive takes one message, copies it out and releases it. It reports the sender as IPv4 and port in host order.
    • A message that does not fit, or does not come from an IP address, is dropped. It is described as SB_FAKE_UDP_TOO_LARGE / SB_FAKE_UDP_NOT_IP, with Steam's text for the peer.
    • SteamBridge_FakeUDPPortScheduleCleanup.
  • FakeIP checks and diagnostics. These use SteamNetworkingUtils004: the client's, or the game server's when there is no client.
    • SteamBridge_IsFakeIPv4 checks an address.
    • SteamBridge_NetworkingSetDebugOutput forwards SteamNetworkingSockets diagnostics to a C callback.
  • Game server FakeIP. SteamBridge_ServerBeginAsyncRequestFakeIP and SteamBridge_ServerGetFakeIP request and query the FakeIP. SteamNetworkingFakeIPResult_t now reaches the server callback as SB_SERVER_FAKE_IP_RESULT, with the EResult in result.

Port send, receive and cleanup may run on any thread while the port exists, so an engine's network thread can poll a port. Creation and destruction stay on the host's main thread. No Steam object crosses the ABI.

Tests

  • tests/HostStubs.h gains empty SteamNetworkingSockets013 and SteamNetworkingUtils004 implementations, generated from the SDK v1.65 declarations like the existing stubs.
  • The host fixture adds FakeIP ports, queued datagrams, a FakeIP result and the diagnostics hook. It also defines the two interface destructors that the SDK leaves to the runtime.
  • SteamBridge.Host covers:
    • client and server port creation, including an unavailable session and an invalid index;
    • send results;
    • delivery, oversized and non-IP datagrams, with every message released;
    • cleanup;
    • destruction of ports left open, on both client and server shutdown;
    • utilities taken from the game server without a client, and dropped with it;
    • the FakeIP request and query (busy, then OK);
    • the result event;
    • diagnostics forwarding and removal.

Verification

Platform CTest
Windows x64 Release (VS 2022) 3/3
Windows x86 Release (VS 2022) 4/4
Linux x64 Release (GCC 13, WSL Ubuntu 24.04) 2/2
Linux x86 Release (GCC 13, -m32) 2/2

clang-format 23.1.3: format-check reports 0 differences.

Simulated only. FakeIP traffic over the Steam relay is not verified here: it needs a running Steam client, and a second Steam account to receive. It will be checked through the engine.

🤖 Generated with Claude Code

…nd networking diagnostics

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@hzqst
hzqst merged commit f8ca122 into main Nov 21, 2026
2 checks passed
@hzqst
hzqst deleted the feat/fake-udp-ports branch November 21, 2026 08:39
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.

1 participant