Moonlight-XboxOG latest
Moonlight Xbox OG is a port of the Moonlight Game Streaming client to the original Xbox console.
host_discovery.h File Reference

Declares host auto-discovery helpers. More...

#include <cstdint>
#include <functional>
#include <string>
#include <vector>
Include dependency graph for host_discovery.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  network::DiscoveredHost
 One Moonlight-compatible host discovered through mDNS/DNS-SD. More...
 
struct  network::DiscoverHostsResult
 Result of one host auto-discovery sweep. More...
 

Typedefs

using network::testing::HostDiscoveryTestHandler = std::function<DiscoverHostsResult(uint32_t timeoutMilliseconds)>
 Callback used by unit tests to replace runtime host discovery.
 

Functions

void network::testing::clear_host_discovery_test_handler ()
 Remove any scripted host-discovery handler installed for tests.
 
DiscoverHostsResult network::discover_hosts (uint32_t timeoutMilliseconds)
 Discover Moonlight-compatible hosts on the local network.
 
void network::testing::set_host_discovery_test_handler (HostDiscoveryTestHandler handler)
 Install a scripted host-discovery handler for unit tests.
 

Detailed Description

Declares host auto-discovery helpers.

Function Documentation

◆ discover_hosts()

DiscoverHostsResult network::discover_hosts ( uint32_t timeoutMilliseconds)

Discover Moonlight-compatible hosts on the local network.

The Xbox build uses lwIP mDNS/DNS-SD search support to look for compatible GameStream services. Host-native test builds return scripted results when a test handler is installed, or an empty successful result otherwise.

Parameters
timeoutMillisecondsMaximum discovery window in milliseconds.
Returns
Discovered hosts plus an optional error message.

◆ set_host_discovery_test_handler()

void network::testing::set_host_discovery_test_handler ( HostDiscoveryTestHandler handler)

Install a scripted host-discovery handler for unit tests.

Parameters
handlerCallback that should service subsequent discovery requests.