Sunshine latest
Self-hosted game stream host for Moonlight.
nvhttp.cpp File Reference

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

#include <filesystem>
#include <string>
#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 "system_tray.h"
#include "utility.h"
#include "uuid.h"
#include "video.h"
Include dependency graph for nvhttp.cpp:

Classes

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

Namespaces

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

Typedefs

using nvhttp::args_t = SimpleWeb::CaseInsensitiveMultimap
 
using nvhttp::http_server_t = SimpleWeb::Server<SimpleWeb::HTTP>
 
using nvhttp::https_server_t = SunshineHTTPSServer
 
using nvhttp::req_http_t = std::shared_ptr<typename SimpleWeb::ServerBase<SimpleWeb::HTTP>::Request>
 
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::resp_https_t = std::shared_ptr<typename SimpleWeb::ServerBase<SunshineHTTPS>::Response>
 

Enumerations

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

Functions

void nvhttp::add_authorized_client (const std::string &name, std::string &&cert)
 
void nvhttp::appasset (resp_https_t response, req_https_t request)
 
void nvhttp::applist (resp_https_t response, req_https_t request)
 
void nvhttp::cancel (resp_https_t response, req_https_t request)
 
void nvhttp::clientchallenge (pair_session_t &sess, pt::ptree &tree, const std::string &challenge)
 
void nvhttp::clientpairingsecret (pair_session_t &sess, std::shared_ptr< safe::queue_t< crypto::x509_t > > &add_cert, pt::ptree &tree, const std::string &client_pairing_secret)
 
void nvhttp::erase_all_clients ()
 Remove all paired clients.
 
void nvhttp::fail_pair (pair_session_t &sess, pt::ptree &tree, const std::string status_msg)
 
pt::ptree nvhttp::get_all_clients ()
 Get all paired clients.
 
std::string nvhttp::get_arg (const args_t &args, const char *name, const char *default_value=nullptr)
 
void nvhttp::getservercert (pair_session_t &sess, pt::ptree &tree, const std::string &pin)
 
void nvhttp::launch (bool &host_audio, resp_https_t response, req_https_t request)
 
void nvhttp::load_state ()
 
std::shared_ptr< rtsp_stream::launch_session_tnvhttp::make_launch_session (bool host_audio, const args_t &args)
 
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< safe::queue_t< crypto::x509_t > > &add_cert, std::shared_ptr< typename SimpleWeb::ServerBase< T >::Response > response, std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request)
 
bool nvhttp::pin (std::string pin, std::string name)
 Compare the user supplied pin to the Moonlight pin.
 
template<class T >
void nvhttp::print_req (std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request)
 
void nvhttp::remove_session (const pair_session_t &sess)
 removes the temporary pairing session
 
void nvhttp::resume (bool &host_audio, resp_https_t response, req_https_t request)
 
void nvhttp::save_state ()
 
void nvhttp::serverchallengeresp (pair_session_t &sess, pt::ptree &tree, const std::string &encrypted_response)
 
template<class T >
void nvhttp::serverinfo (std::shared_ptr< typename SimpleWeb::ServerBase< T >::Response > response, std::shared_ptr< typename SimpleWeb::ServerBase< T >::Request > request)
 
void nvhttp::setup (const std::string &pkey, const std::string &cert)
 Setup the nvhttp server.
 
void nvhttp::start ()
 Start the nvhttp server.
 
int nvhttp::unpair_client (std::string uniqueid)
 Remove single client.
 

Variables

crypto::cert_chain_t nvhttp::cert_chain
 
client_t nvhttp::client_root
 
struct nvhttp::conf_intern_t nvhttp::conf_intern
 
std::unordered_map< std::string, pair_session_tnvhttp::map_id_sess
 
std::atomic< uint32_t > nvhttp::session_id_counter
 

Detailed Description

Definitions for the nvhttp (GameStream) server.