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

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

#include <filesystem>
#include <format>
#include <mutex>
#include <string>
#include <unordered_map>
#include <utility>
#include <boost/asio/ssl/context.hpp>
#include <boost/asio/ssl/context_base.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <Simple-Web-Server/server_http.hpp>
#include "config.h"
#include "display_device.h"
#include "file_handler.h"
#include "globals.h"
#include "httpcommon.h"
#include "logging.h"
#include "network.h"
#include "nvhttp.h"
#include "platform/common.h"
#include "process.h"
#include "rtsp.h"
#include "stream.h"
#include "system_tray.h"
#include "utility.h"
#include "uuid.h"
#include "video.h"
#include "zwpad.h"
Include dependency graph for nvhttp.cpp:

Go to the source code of this file.

Classes

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

Namespaces

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

Typedefs

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

Enumerations

enum class  nvhttp::op_e { nvhttp::ADD , nvhttp::REMOVE }

Functions

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

Variables

crypto::cert_chain_t nvhttp::cert_chain
struct nvhttp::conf_intern_t nvhttp::conf_intern
std::unordered_map< std::string, pair_session_t > nvhttp::map_id_sess
std::recursive_mutex nvhttp::pair_session_mutex
client_t nvhttp::client_root
std::atomic< uint32_t > nvhttp::session_id_counter
std::mutex nvhttp::pending_pair_mutex
 The clients whose pairing requests are waiting for a PIN, if any.
std::unordered_map< std::string, std::string > nvhttp::pending_pairs

Detailed Description

Definitions for the nvhttp (GameStream) server.

Definition in file nvhttp.cpp.

Macro Definition Documentation

◆ BOOST_BIND_GLOBAL_PLACEHOLDERS

#define BOOST_BIND_GLOBAL_PLACEHOLDERS

Definition at line 6 of file nvhttp.cpp.