Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
nvhttp Namespace Reference

Contains all the functions and variables related to the nvhttp (GameStream) server. More...

Classes

struct  client_t
struct  conf_intern_t
struct  hestia_session_prepare_t
struct  pair_session_t
struct  pending_hestia_session_prepare_t
class  SunshineHTTPS
class  SunshineHTTPSServer
struct  tunnel
struct  tunnel< SimpleWeb::HTTP >
struct  tunnel< SunshineHTTPS >

Typedefs

using p_named_cert_t = crypto::p_named_cert_t
using PERM = crypto::PERM
using https_server_t = SunshineHTTPSServer
using http_server_t = SimpleWeb::Server<SimpleWeb::HTTP>
using resp_https_t = std::shared_ptr<typename SimpleWeb::ServerBase<SunshineHTTPS>::Response>
using req_https_t = std::shared_ptr<typename SimpleWeb::ServerBase<SunshineHTTPS>::Request>
using resp_http_t = std::shared_ptr<typename SimpleWeb::ServerBase<SimpleWeb::HTTP>::Response>
using req_http_t = std::shared_ptr<typename SimpleWeb::ServerBase<SimpleWeb::HTTP>::Request>
using args_t = SimpleWeb::CaseInsensitiveMultimap
using cmd_list_t = std::list<crypto::command_entry_t>

Enumerations

enum class  op_e { ADD , REMOVE }
enum class  PAIR_PHASE {
  NONE , GETSERVERCERT , CLIENTCHALLENGE , SERVERCHALLENGERESP ,
  CLIENTPAIRINGSECRET
}

Functions

bool experimental_isolated_sessions_enabled ()
nlohmann::json describe_applied_settings (const std::string &app_id, bool virtual_display, int scale_factor)
uint32_t launch_count ()
 How many launch and resume requests have been accepted so far.
void set_pending_pair (const std::string &unique_id, const std::string &name)
void clear_pending_pair (const std::string &unique_id)
void clear_pending_pairs ()
std::string get_arg (const args_t &args, const char *name, const char *default_value)
cmd_list_t extract_command_entries (const nlohmann::json &j, const std::string &key)
void save_state ()
void load_state ()
void add_authorized_client (const p_named_cert_t &named_cert_p)
std::shared_ptr< rtsp_stream::launch_session_t > make_launch_session (bool host_audio, bool input_only, const args_t &args, const crypto::named_cert_t *named_cert_p)
void remove_session (const pair_session_t &sess)
 removes the temporary pairing session
bool cancel_pending_pairing (const std::string &unique_id)
pair_session_t & begin_pairing_session (pair_session_t session)
void fail_pair (pair_session_t &sess, pt::ptree &tree, const std::string status_msg)
void getservercert (pair_session_t &sess, pt::ptree &tree, const std::string &pin)
void clientchallenge (pair_session_t &sess, pt::ptree &tree, const std::string &challenge)
void serverchallengeresp (pair_session_t &sess, pt::ptree &tree, const std::string &encrypted_response)
void clientpairingsecret (pair_session_t &sess, pt::ptree &tree, const std::string &client_pairing_secret)
crypto::named_cert_t * get_verified_cert (req_https_t request)
template<class T>
void print_req (std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request)
template<class T>
void not_found (std::shared_ptr< typename SimpleWeb::ServerBase< T >::Response > response, std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request)
template<class T>
void pair (std::shared_ptr< typename SimpleWeb::ServerBase< T >::Response > response, std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request)
void cancel_pairing_request (std::shared_ptr< SimpleWeb::ServerBase< SimpleWeb::HTTP >::Response > response, std::shared_ptr< SimpleWeb::ServerBase< SimpleWeb::HTTP >::Request > request)
std::optional< std::string > pending_pair_client ()
 The client whose pairing request is waiting for a PIN, if any.
bool pin (std::string pin, std::string name)
 Compare the user supplied pin to the Moonlight pin.
template<class T>
void serverinfo (std::shared_ptr< typename SimpleWeb::ServerBase< T >::Response > response, std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request)
nlohmann::json get_all_clients ()
 Get all paired clients.
void applist (resp_https_t response, req_https_t request)
void launch (bool &host_audio, resp_https_t response, req_https_t request)
void resume (bool &host_audio, resp_https_t response, req_https_t request)
void cancel (resp_https_t response, req_https_t request)
void appasset (resp_https_t response, req_https_t request)
void getClipboard (resp_https_t response, req_https_t request)
void setClipboard (resp_https_t response, req_https_t request)
void setup (const std::string &pkey, const std::string &cert)
 Setup the nvhttp server.
bool verify_paired_client_certificate (X509 *certificate, crypto::p_named_cert_t &named_cert_out)
 Verify a TLS client certificate against the paired-client store.
void store_hestia_session_prepare (const std::string &client_uuid, hestia_session_prepare_t prepare)
std::optional< hestia_session_prepare_t > take_hestia_session_prepare (const std::string &client_uuid)
void clear_hestia_session_prepare (const std::string &client_uuid)
void start ()
 Start the nvhttp server.
std::string request_otp (const std::string &passphrase, const std::string &deviceName)
void erase_all_clients ()
 Remove all paired clients.
void stop_session (stream::session_t &session, bool graceful)
 Stops a session.
bool find_and_stop_session (const std::string &uuid, bool graceful)
 Finds and stop session.
void update_session_info (stream::session_t &session, const std::string &name, const crypto::PERM newPerm)
 Update device info associated to the session.
bool find_and_udpate_session_info (const std::string &uuid, const std::string &name, const crypto::PERM newPerm)
 Finds and udpate session information.
bool update_device_info (const std::string &uuid, const std::string &name, const std::string &display_mode, const cmd_list_t &do_cmds, const cmd_list_t &undo_cmds, const crypto::PERM newPerm, const bool enable_legacy_ordering, const bool allow_client_commands, const bool always_use_virtual_display)
 Update device info.
bool unpair_client (std::string_view uuid)
 Remove single client.
void getservercert (pair_session_t &sess, boost::property_tree::ptree &tree, const std::string &pin)
 Pair, phase 1.
void clientchallenge (pair_session_t &sess, boost::property_tree::ptree &tree, const std::string &challenge)
 Pair, phase 2.
void serverchallengeresp (pair_session_t &sess, boost::property_tree::ptree &tree, const std::string &encrypted_response)
 Pair, phase 3.
void clientpairingsecret (pair_session_t &sess, boost::property_tree::ptree &tree, const std::string &client_pairing_secret)
 Pair, phase 4 (final).

Variables

crypto::cert_chain_t cert_chain
struct nvhttp::conf_intern_t conf_intern
std::unordered_map< std::string, pair_session_t > map_id_sess
std::recursive_mutex pair_session_mutex
client_t client_root
std::atomic< uint32_t > session_id_counter
std::mutex pending_pair_mutex
 The clients whose pairing requests are waiting for a PIN, if any.
std::unordered_map< std::string, std::string > pending_pairs
constexpr auto VERSION = "7.1.431.-1"
 The protocol version.
constexpr auto GFE_VERSION = "3.23.0.74"
 The GFE version we are replicating.
constexpr auto PORT_HTTP = 0
 The HTTP port, as a difference from the config port.
constexpr auto PORT_HTTPS = -5
 The HTTPS port, as a difference from the config port.
constexpr auto OTP_EXPIRE_DURATION = 180s

Detailed Description

Contains all the functions and variables related to the nvhttp (GameStream) server.

Typedef Documentation

◆ args_t

using nvhttp::args_t = SimpleWeb::CaseInsensitiveMultimap

Definition at line 31 of file nvhttp.h.

◆ cmd_list_t

using nvhttp::cmd_list_t = std::list<crypto::command_entry_t>

Definition at line 32 of file nvhttp.h.

◆ http_server_t

using nvhttp::http_server_t = SimpleWeb::Server<SimpleWeb::HTTP>

Definition at line 216 of file nvhttp.cpp.

◆ https_server_t

using nvhttp::https_server_t = SunshineHTTPSServer

Definition at line 215 of file nvhttp.cpp.

◆ p_named_cert_t

using nvhttp::p_named_cert_t = crypto::p_named_cert_t

Definition at line 52 of file nvhttp.cpp.

◆ PERM

Definition at line 53 of file nvhttp.cpp.

◆ req_http_t

using nvhttp::req_http_t = std::shared_ptr<typename SimpleWeb::ServerBase<SimpleWeb::HTTP>::Request>

Definition at line 281 of file nvhttp.cpp.

◆ req_https_t

using nvhttp::req_https_t = std::shared_ptr<typename SimpleWeb::ServerBase<SunshineHTTPS>::Request>

Definition at line 279 of file nvhttp.cpp.

◆ resp_http_t

using nvhttp::resp_http_t = std::shared_ptr<typename SimpleWeb::ServerBase<SimpleWeb::HTTP>::Response>

Definition at line 280 of file nvhttp.cpp.

◆ resp_https_t

using nvhttp::resp_https_t = std::shared_ptr<typename SimpleWeb::ServerBase<SunshineHTTPS>::Response>

Definition at line 278 of file nvhttp.cpp.

Enumeration Type Documentation

◆ op_e

enum class nvhttp::op_e
strong
Enumerator
ADD 

Add certificate.

REMOVE 

Remove certificate.

Definition at line 283 of file nvhttp.cpp.

◆ PAIR_PHASE

enum class nvhttp::PAIR_PHASE
strong
Enumerator
NONE 

Sunshine is not in a pairing phase.

GETSERVERCERT 

Sunshine is in the get server certificate phase.

CLIENTCHALLENGE 

Sunshine is in the client challenge phase.

SERVERCHALLENGERESP 

Sunshine is in the server challenge response phase.

CLIENTPAIRINGSECRET 

Sunshine is in the client pairing secret phase.

Definition at line 140 of file nvhttp.h.

Function Documentation

◆ add_authorized_client()

void nvhttp::add_authorized_client ( const p_named_cert_t & named_cert_p)

Definition at line 497 of file nvhttp.cpp.

◆ appasset()

void nvhttp::appasset ( resp_https_t response,
req_https_t request )

Definition at line 2066 of file nvhttp.cpp.

◆ applist()

void nvhttp::applist ( resp_https_t response,
req_https_t request )

Definition at line 1290 of file nvhttp.cpp.

◆ begin_pairing_session()

pair_session_t & nvhttp::begin_pairing_session ( pair_session_t session)

Begin a fresh handshake, replacing a stale attempt for the same uniqueID.

Definition at line 637 of file nvhttp.cpp.

◆ cancel()

void nvhttp::cancel ( resp_https_t response,
req_https_t request )

Definition at line 2017 of file nvhttp.cpp.

◆ cancel_pairing_request()

void nvhttp::cancel_pairing_request ( std::shared_ptr< SimpleWeb::ServerBase< SimpleWeb::HTTP >::Response > response,
std::shared_ptr< SimpleWeb::ServerBase< SimpleWeb::HTTP >::Request > request )

Definition at line 997 of file nvhttp.cpp.

◆ cancel_pending_pairing()

bool nvhttp::cancel_pending_pairing ( const std::string & unique_id)

Cancel only an incomplete handshake; never revoke an authorized client.

Definition at line 615 of file nvhttp.cpp.

◆ clear_hestia_session_prepare()

void nvhttp::clear_hestia_session_prepare ( const std::string & client_uuid)

Remove any unconsumed preparation hints for a paired client.

Definition at line 2236 of file nvhttp.cpp.

◆ clear_pending_pair()

void nvhttp::clear_pending_pair ( const std::string & unique_id)

Definition at line 261 of file nvhttp.cpp.

◆ clear_pending_pairs()

void nvhttp::clear_pending_pairs ( )

Definition at line 266 of file nvhttp.cpp.

◆ clientchallenge() [1/2]

void nvhttp::clientchallenge ( pair_session_t & sess,
boost::property_tree::ptree & tree,
const std::string & challenge )

Pair, phase 2.

Using the AES key that we generated in phase 1 we have to decrypt the client challenge,

We generate a SHA256 hash with the following:

  • Decrypted challenge
  • Server certificate signature
  • Server secret: a randomly generated secret

The hash + server_challenge will then be AES encrypted and sent as the challengeresponse in the returned XML

◆ clientchallenge() [2/2]

void nvhttp::clientchallenge ( pair_session_t & sess,
pt::ptree & tree,
const std::string & challenge )

Definition at line 676 of file nvhttp.cpp.

◆ clientpairingsecret() [1/2]

void nvhttp::clientpairingsecret ( pair_session_t & sess,
boost::property_tree::ptree & tree,
const std::string & client_pairing_secret )

Pair, phase 4 (final).

We now have to use everything we exchanged before in order to verify and finally pair the clients

We'll check the client_hash obtained at phase 3, it should contain the following:

  • The original server_challenge
  • The signature of the X509 client_cert
  • The unencrypted client_pairing_secret We'll check that SHA256(server_challenge + client_public_cert_signature + client_secret) == client_hash

Then using the client certificate public key we should be able to verify that the client secret has been signed by Moonlight

◆ clientpairingsecret() [2/2]

void nvhttp::clientpairingsecret ( pair_session_t & sess,
pt::ptree & tree,
const std::string & client_pairing_secret )

Definition at line 748 of file nvhttp.cpp.

◆ describe_applied_settings()

nlohmann::json nvhttp::describe_applied_settings ( const std::string & app_id,
bool virtual_display,
int scale_factor )

What the next launch of app app_id will apply for the settings a client asks for, and who decides each one: {"virtual_display": {"requested", "effective", "source"}, "scale_factor": {...}}. Sources: "client", "app_forced", "app", "host_default", "headless", "isolated_session". Null when no app has that id.

Definition at line 94 of file nvhttp.cpp.

◆ erase_all_clients()

void nvhttp::erase_all_clients ( )

Remove all paired clients.

Examples

void erase_all_clients()
Remove all paired clients.
Definition nvhttp.cpp:2398

Definition at line 2398 of file nvhttp.cpp.

◆ experimental_isolated_sessions_enabled()

bool nvhttp::experimental_isolated_sessions_enabled ( )

Definition at line 55 of file nvhttp.cpp.

◆ extract_command_entries()

cmd_list_t nvhttp::extract_command_entries ( const nlohmann::json & j,
const std::string & key )

Definition at line 301 of file nvhttp.cpp.

◆ fail_pair()

void nvhttp::fail_pair ( pair_session_t & sess,
pt::ptree & tree,
const std::string status_msg )

Definition at line 644 of file nvhttp.cpp.

◆ find_and_stop_session()

bool nvhttp::find_and_stop_session ( const std::string & uuid,
bool graceful )

Finds and stop session.

Parameters
[in]uuidThe uuid string
[in]gracefulWhether to stop gracefully

Definition at line 2414 of file nvhttp.cpp.

◆ find_and_udpate_session_info()

bool nvhttp::find_and_udpate_session_info ( const std::string & uuid,
const std::string & name,
const crypto::PERM newPerm )

Finds and udpate session information.

Parameters
[in]uuidThe uuid string
[in]nameNew name
[in]newPermNew permission

Definition at line 2427 of file nvhttp.cpp.

◆ get_all_clients()

nlohmann::json nvhttp::get_all_clients ( )

Get all paired clients.

Returns
The list of all paired clients.

Examples

nlohmann::json clients = nvhttp::get_all_clients();
nlohmann::json get_all_clients()
Get all paired clients.
Definition nvhttp.cpp:1236

Definition at line 1236 of file nvhttp.cpp.

◆ get_arg()

std::string nvhttp::get_arg ( const args_t & args,
const char * name,
const char * default_value )

Definition at line 288 of file nvhttp.cpp.

◆ get_verified_cert()

crypto::named_cert_t * nvhttp::get_verified_cert ( req_https_t request)
inline

Definition at line 831 of file nvhttp.cpp.

◆ getClipboard()

void nvhttp::getClipboard ( resp_https_t response,
req_https_t request )

Definition at line 2097 of file nvhttp.cpp.

◆ getservercert() [1/2]

void nvhttp::getservercert ( pair_session_t & sess,
boost::property_tree::ptree & tree,
const std::string & pin )

Pair, phase 1.

Moonlight will send a salt and client certificate, we'll also need the user provided pin.

PIN and SALT will be used to derive a shared AES key that needs to be stored in order to be used to decrypt_symmetric in the next phases.

At this stage we only have to send back our public certificate.

◆ getservercert() [2/2]

void nvhttp::getservercert ( pair_session_t & sess,
pt::ptree & tree,
const std::string & pin )

Definition at line 652 of file nvhttp.cpp.

◆ launch()

void nvhttp::launch ( bool & host_audio,
resp_https_t response,
req_https_t request )

Definition at line 1377 of file nvhttp.cpp.

◆ launch_count()

uint32_t nvhttp::launch_count ( )

How many launch and resume requests have been accepted so far.

A request counted here is not a streaming session until its RTSP handshake completes; a caller waiting for a quiet moment compares two readings.

Definition at line 231 of file nvhttp.cpp.

◆ load_state()

void nvhttp::load_state ( )

Definition at line 413 of file nvhttp.cpp.

◆ make_launch_session()

std::shared_ptr< rtsp_stream::launch_session_t > nvhttp::make_launch_session ( bool host_audio,
bool input_only,
const args_t & args,
const crypto::named_cert_t * named_cert_p )

Definition at line 511 of file nvhttp.cpp.

◆ not_found()

template<class T>
void nvhttp::not_found ( std::shared_ptr< typename SimpleWeb::ServerBase< T >::Response > response,
std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request )

Definition at line 856 of file nvhttp.cpp.

◆ pair()

template<class T>
void nvhttp::pair ( std::shared_ptr< typename SimpleWeb::ServerBase< T >::Response > response,
std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request )

Definition at line 870 of file nvhttp.cpp.

◆ pending_pair_client()

std::optional< std::string > nvhttp::pending_pair_client ( )

The client whose pairing request is waiting for a PIN, if any.

Empty whenever nothing is pending. The window is narrow on purpose: it opens when a client's request parks itself waiting for four digits and closes the moment any are submitted, so a caller polling this is asking "does somebody need to type a PIN right now", not "has anyone ever tried to pair".

Definition at line 1018 of file nvhttp.cpp.

◆ pin()

bool nvhttp::pin ( std::string pin,
std::string name )

Compare the user supplied pin to the Moonlight pin.

Parameters
pinThe user supplied pin.
nameThe user supplied name.
Returns
true if the pin is correct, false otherwise.

Examples

bool pin_status = nvhttp::pin("1234", "laptop");
bool pin(std::string pin, std::string name)
Compare the user supplied pin to the Moonlight pin.
Definition nvhttp.cpp:1026

Definition at line 1026 of file nvhttp.cpp.

◆ print_req()

template<class T>
void nvhttp::print_req ( std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request)

Definition at line 836 of file nvhttp.cpp.

◆ remove_session()

void nvhttp::remove_session ( const pair_session_t & sess)

removes the temporary pairing session

Parameters
sess

Definition at line 606 of file nvhttp.cpp.

◆ request_otp()

std::string nvhttp::request_otp ( const std::string & passphrase,
const std::string & deviceName )

Definition at line 2384 of file nvhttp.cpp.

◆ resume()

void nvhttp::resume ( bool & host_audio,
resp_https_t response,
req_https_t request )

Definition at line 1818 of file nvhttp.cpp.

◆ save_state()

void nvhttp::save_state ( )

Definition at line 330 of file nvhttp.cpp.

◆ serverchallengeresp() [1/2]

void nvhttp::serverchallengeresp ( pair_session_t & sess,
boost::property_tree::ptree & tree,
const std::string & encrypted_response )

Pair, phase 3.

Moonlight will send back a serverchallengeresp: an AES encrypted client hash, we have to send back the pairingsecret: using our private key we have to sign the certificate_signature + server_secret (generated in phase 2)

◆ serverchallengeresp() [2/2]

void nvhttp::serverchallengeresp ( pair_session_t & sess,
pt::ptree & tree,
const std::string & encrypted_response )

Definition at line 719 of file nvhttp.cpp.

◆ serverinfo()

template<class T>
void nvhttp::serverinfo ( std::shared_ptr< typename SimpleWeb::ServerBase< T >::Response > response,
std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request )

Definition at line 1091 of file nvhttp.cpp.

◆ set_pending_pair()

void nvhttp::set_pending_pair ( const std::string & unique_id,
const std::string & name )

Definition at line 256 of file nvhttp.cpp.

◆ setClipboard()

void nvhttp::setClipboard ( resp_https_t response,
req_https_t request )

Definition at line 2145 of file nvhttp.cpp.

◆ setup()

void nvhttp::setup ( const std::string & pkey,
const std::string & cert )

Setup the nvhttp server.

Parameters
pkey
cert

Definition at line 2202 of file nvhttp.cpp.

◆ start()

void nvhttp::start ( )

Start the nvhttp server.

Examples

void start()
Start the nvhttp server.
Definition nvhttp.cpp:2241

Definition at line 2241 of file nvhttp.cpp.

◆ stop_session()

void nvhttp::stop_session ( stream::session_t & session,
bool graceful )

Stops a session.

Parameters
sessionThe session
[in]gracefulWhether to stop gracefully

Definition at line 2406 of file nvhttp.cpp.

◆ store_hestia_session_prepare()

void nvhttp::store_hestia_session_prepare ( const std::string & client_uuid,
hestia_session_prepare_t prepare )

Store preparation hints for a paired client's next GameStream launch.

Definition at line 2211 of file nvhttp.cpp.

◆ take_hestia_session_prepare()

std::optional< hestia_session_prepare_t > nvhttp::take_hestia_session_prepare ( const std::string & client_uuid)

Consume unexpired preparation hints for a paired client's next launch.

Definition at line 2219 of file nvhttp.cpp.

◆ unpair_client()

bool nvhttp::unpair_client ( std::string_view uuid)

Remove single client.

Parameters
uuidThe UUID of the client to remove.

Examples

nvhttp::unpair_client("4D7BB2DD-5704-A405-B41C-891A022932E1");
bool unpair_client(const std::string_view uuid)
Remove single client.
Definition nvhttp.cpp:2470

Definition at line 2470 of file nvhttp.cpp.

◆ update_device_info()

bool nvhttp::update_device_info ( const std::string & uuid,
const std::string & name,
const std::string & display_mode,
const cmd_list_t & do_cmds,
const cmd_list_t & undo_cmds,
const crypto::PERM newPerm,
const bool enable_legacy_ordering,
const bool allow_client_commands,
const bool always_use_virtual_display )

Update device info.

Parameters
[in]uuidThe uuid string
[in]nameNew name
[in]do_cmdsThe do commands
[in]undo_cmdsThe undo commands
[in]newPermNew permission
[in]enable_legacy_orderingEnable legacy ordering
[in]allow_client_commandsAllow client commands
[in]always_use_virtual_displayAlways use virtual display
Returns
Whether the update is successful

Definition at line 2436 of file nvhttp.cpp.

◆ update_session_info()

void nvhttp::update_session_info ( stream::session_t & session,
const std::string & name,
const crypto::PERM newPerm )

Update device info associated to the session.

Parameters
sessionThe session
[in]nameNew name
[in]newPermNew permission

Definition at line 2423 of file nvhttp.cpp.

◆ verify_paired_client_certificate()

bool nvhttp::verify_paired_client_certificate ( X509 * certificate,
crypto::p_named_cert_t & named_cert_out )

Verify a TLS client certificate against the paired-client store.

Parameters
certificateThe peer certificate obtained from a TLS connection.
named_cert_outThe paired-client record when verification succeeds.
Returns
True when the certificate belongs to a paired client.

Definition at line 2207 of file nvhttp.cpp.

Variable Documentation

◆ cert_chain

crypto::cert_chain_t nvhttp::cert_chain

Definition at line 136 of file nvhttp.cpp.

◆ client_root

client_t nvhttp::client_root

Definition at line 228 of file nvhttp.cpp.

◆ GFE_VERSION

auto nvhttp::GFE_VERSION = "3.23.0.74"
constexpr

The GFE version we are replicating.

Definition at line 44 of file nvhttp.h.

◆ map_id_sess

std::unordered_map<std::string, pair_session_t> nvhttp::map_id_sess

Definition at line 224 of file nvhttp.cpp.

◆ OTP_EXPIRE_DURATION

auto nvhttp::OTP_EXPIRE_DURATION = 180s
constexpr

Definition at line 56 of file nvhttp.h.

◆ pair_session_mutex

std::recursive_mutex nvhttp::pair_session_mutex

Definition at line 227 of file nvhttp.cpp.

◆ pending_pair_mutex

std::mutex nvhttp::pending_pair_mutex

The clients whose pairing requests are waiting for a PIN, if any.

Keyed by the client's uniqueID rather than a single global flag: a pairing session being removed - a failure, a timeout, the success path itself - must clear exactly the client it belonged to, or one client's finished pairing erases another's still-waiting one.

Tracked beside map_id_sess rather than read out of it: the map lives on the nvhttp threads with no lock of its own, and this is read from the web server's threads. A separate guarded copy is the difference between one more unsynchronised reader and none.

"Waiting for a PIN" is narrower than "has a pair session": it begins when the request parks itself on async_insert_pin.response and ends the moment a PIN is submitted, because that is exactly the window in which somebody has to go and type four digits.

Definition at line 253 of file nvhttp.cpp.

◆ pending_pairs

std::unordered_map<std::string, std::string> nvhttp::pending_pairs

Definition at line 254 of file nvhttp.cpp.

◆ PORT_HTTP

auto nvhttp::PORT_HTTP = 0
constexpr

The HTTP port, as a difference from the config port.

Definition at line 49 of file nvhttp.h.

◆ PORT_HTTPS

auto nvhttp::PORT_HTTPS = -5
constexpr

The HTTPS port, as a difference from the config port.

Definition at line 54 of file nvhttp.h.

◆ session_id_counter

std::atomic<uint32_t> nvhttp::session_id_counter

Definition at line 229 of file nvhttp.cpp.

◆ VERSION

auto nvhttp::VERSION = "7.1.431.-1"
constexpr

The protocol version.

The version of the GameStream protocol we are mocking.

Note
The negative 4th number indicates to Moonlight that this is Sunshine.

Definition at line 39 of file nvhttp.h.