Sunshine0.0.5917
Sunshine 0.0.5917
Self-hosted game stream host for Moonlight.
Loading...
Searching...
No Matches
nvhttp.h File Reference

Declarations for the nvhttp (GameStream) server. More...

#include <chrono>
#include <condition_variable>
#include <cstddef>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include <boost/property_tree/ptree.hpp>
#include <nlohmann/json.hpp>
#include <Simple-Web-Server/server_https.hpp>
#include "crypto.h"
Include dependency graph for nvhttp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  nvhttp::pair_session_t
 Pairing handshake state exchanged with a Moonlight client. More...
struct  nvhttp::pairing_completion_t
 Shared result used to return the completed pairing outcome to a PIN submitter. More...
struct  nvhttp::pending_pairing_t
 Operator-visible context for a pairing request awaiting PIN approval. More...
class  nvhttp::SunshineHTTPS
 Simple-Web-Server HTTPS backend configured for Sunshine certificate handling. More...

Namespaces

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

Enumerations

enum class  nvhttp::PAIR_PHASE {
  nvhttp::NONE , nvhttp::GETSERVERCERT , nvhttp::CLIENTCHALLENGE , nvhttp::SERVERCHALLENGERESP ,
  nvhttp::CLIENTPAIRINGSECRET
}
 Enumerates supported pAIR PHASE options. More...
enum class  nvhttp::pair_session_insert_e { nvhttp::ADDED , nvhttp::ALREADY_EXISTS , nvhttp::FULL }
 Result of inserting a new pairing session into bounded pending storage. More...

Functions

bool nvhttp::cancel_pairing (std::string_view pairing_id)
 Cancel a pairing request that is waiting for operator approval.
void nvhttp::clientchallenge (pair_session_t &sess, boost::property_tree::ptree &tree, const std::string &challenge)
 Pair, phase 2.
void nvhttp::clientpairingsecret (pair_session_t &sess, boost::property_tree::ptree &tree, const std::string &client_pairing_secret)
 Pair, phase 4 (final).
void nvhttp::erase_all_clients ()
 Remove all paired clients.
bool nvhttp::evict_abandoned_pair_session (const std::string &unique_id)
 Evict an abandoned in-progress pairing session for a client.
void nvhttp::expire_pair_sessions (std::chrono::steady_clock::time_point now=std::chrono::steady_clock::now())
 Remove pairing sessions whose completion deadline has passed.
nlohmann::json nvhttp::get_all_clients ()
 Get all paired clients.
std::string nvhttp::get_cert_by_uuid (const std::string_view uuid)
 Get cert by UUID.
std::vector< pending_pairing_t > nvhttp::get_pending_pairings ()
 List pairing requests that are waiting for operator PIN approval.
void nvhttp::getservercert (pair_session_t &sess, boost::property_tree::ptree &tree, const std::string &pin)
 Pair, phase 1.
pair_session_insert_e nvhttp::insert_pair_session (pair_session_t sess, std::string &pairing_id)
 Insert a newly created pairing session into bounded pending storage.
bool nvhttp::is_valid_pairing_id (std::string_view pairing_id)
 Validate an operator approval identifier received from the REST API.
bool nvhttp::is_valid_pairing_name (std::string_view name)
 Validate an operator-supplied paired-client name received from the REST API.
bool nvhttp::is_valid_pairing_pin (std::string_view pin)
 Validate a Moonlight pairing PIN received from the REST API.
bool nvhttp::pin (std::string_view pairing_id, std::string pin, std::string name)
 Apply the user supplied PIN to the explicitly selected pairing request.
void nvhttp::remove_session (const pair_session_t &sess)
 removes the temporary pairing session
void nvhttp::serverchallengeresp (pair_session_t &sess, boost::property_tree::ptree &tree, const std::string &encrypted_response)
 Pair, phase 3.
bool nvhttp::set_client_enabled (std::string_view uuid, bool enabled)
 Enable or disable a client.
void nvhttp::setup (const std::string &pkey, const std::string &cert)
 Setup the nvhttp server.
void nvhttp::start ()
 Start the nvhttp server.
bool nvhttp::unpair_client (std::string_view uuid)
 Remove single client.

Variables

constexpr auto nvhttp::GFE_VERSION = "3.23.0.74"
 The GFE version we are replicating.
constexpr std::size_t nvhttp::MAX_PAIRING_CLIENT_NAME_SIZE = 128
 Maximum number of bytes accepted for an operator-supplied paired-client name.
constexpr std::size_t nvhttp::MAX_PENDING_PAIRING_SESSIONS = 32
 Maximum number of pairing sessions retained at one time.
constexpr std::size_t nvhttp::PAIRING_ID_SIZE = 32
 Number of hexadecimal characters in an operator approval identifier.
constexpr auto nvhttp::PAIRING_SESSION_TIMEOUT = std::chrono::minutes {5}
 Lifetime of an incomplete pairing session.
constexpr auto nvhttp::PORT_HTTP = 0
 The HTTP port, as a difference from the config port.
constexpr auto nvhttp::PORT_HTTPS = -5
 The HTTPS port, as a difference from the config port.
constexpr auto nvhttp::VERSION = "7.1.431.-1"
 The protocol version.

Detailed Description

Declarations for the nvhttp (GameStream) server.