From 6d5435616644a5d36148a724a04cb8b6493c0a5e Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Fri, 10 Mar 2023 09:05:52 -0500 Subject: [PATCH] logging: change client verified messages to debug (#1020) --- docs/Doxyfile | 8 ++++---- src/nvhttp.cpp | 55 +++++++++++++++++++++++++++++++++++--------------- src/nvhttp.h | 35 +++++++++++++++++++++++++++++--- 3 files changed, 75 insertions(+), 23 deletions(-) diff --git a/docs/Doxyfile b/docs/Doxyfile index bf6a1ce4..cac6c8f8 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -487,7 +487,7 @@ LOOKUP_CACHE_SIZE = 0 # DOT_NUM_THREADS setting. # Minimum value: 0, maximum value: 32, default value: 1. -NUM_PROC_THREADS = 1 +NUM_PROC_THREADS = 0 #--------------------------------------------------------------------------- # Build related configuration options @@ -672,7 +672,7 @@ SORT_MEMBER_DOCS = YES # this will also influence the order of the classes in the class list. # The default value is: NO. -SORT_BRIEF_DOCS = NO +SORT_BRIEF_DOCS = YES # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and @@ -919,7 +919,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ../src ../src/platform ../src/platform/linux ../src/platform/macos ../src/platform/windows +INPUT = ../src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -1010,7 +1010,7 @@ FILE_PATTERNS = *.c \ # be searched for input files as well. # The default value is: NO. -RECURSIVE = NO +RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a diff --git a/src/nvhttp.cpp b/src/nvhttp.cpp index fe357199..cd87e8c6 100644 --- a/src/nvhttp.cpp +++ b/src/nvhttp.cpp @@ -1,22 +1,23 @@ -// Created by loki on 6/3/19. +/** +* @file nvhttp.h +*/ +// macros #define BOOST_BIND_GLOBAL_PLACEHOLDERS -#include "process.h" - +// standard includes #include +// lib includes +#include +#include +#include +#include #include #include #include -#include - -#include -#include -#include - - +// local includes #include "config.h" #include "crypto.h" #include "httpcommon.h" @@ -24,6 +25,7 @@ #include "network.h" #include "nvhttp.h" #include "platform/common.h" +#include "process.h" #include "rtsp.h" #include "utility.h" #include "uuid.h" @@ -31,10 +33,6 @@ using namespace std::literals; namespace nvhttp { -// The negative 4th version number tells Moonlight that this is Sunshine -constexpr auto VERSION = "7.1.431.-1"; -constexpr auto GFE_VERSION = "3.23.0.74"; - namespace fs = std::filesystem; namespace pt = boost::property_tree; @@ -512,6 +510,16 @@ void pair(std::shared_ptr> &add_cert, std::shared_ } } +/** + * @brief Compare the user supplied pin to the Moonlight pin. + * @param pin The user supplied pin. + * @return `true` if the pin is correct, `false` otherwise. + * + * EXAMPLES: + * ```cpp + * bool pin_status = nvhttp::pin("1234"); + * ``` + */ bool pin(std::string pin) { pt::ptree tree; if(map_id_sess.empty()) { @@ -845,6 +853,14 @@ void appasset(resp_https_t response, req_https_t request) { response->close_connection_after_response = true; } +/** + * @brief Start the nvhttp server. + * + * EXAMPLES: + * ```cpp + * nvhttp::start(); + * ``` + */ void start() { auto shutdown_event = mail::man->event(mail::shutdown); @@ -892,8 +908,7 @@ void start() { X509_NAME_oneline(X509_get_subject_name(x509), subject_name, sizeof(subject_name)); - - BOOST_LOG(info) << subject_name << " -- "sv << (verified ? "verified"sv : "denied"sv); + BOOST_LOG(debug) << subject_name << " -- "sv << (verified ? "verified"sv : "denied"sv); }); while(add_cert->peek()) { @@ -984,6 +999,14 @@ void start() { tcp.join(); } +/** + * @brief Remove all paired clients. + * + * EXAMPLES: + * ```cpp + * nvhttp::erase_all_clients(); + * ``` + */ void erase_all_clients() { map_id_client.clear(); save_state(); diff --git a/src/nvhttp.h b/src/nvhttp.h index ae96c6db..0639ee57 100644 --- a/src/nvhttp.h +++ b/src/nvhttp.h @@ -1,15 +1,44 @@ -// Created by loki on 6/3/19. +/** +* @file nvhttp.h +*/ +// macros #ifndef SUNSHINE_NVHTTP_H #define SUNSHINE_NVHTTP_H -#include "thread_safe.h" +// standard includes #include +// local includes +#include "thread_safe.h" + +/** + * @brief This namespace contains all the functions and variables related to the nvhttp (GameStream) server. + */ namespace nvhttp { -constexpr auto PORT_HTTP = 0; + +/** + * @brief The protocol version. + */ +constexpr auto VERSION = "7.1.431.-1"; +// The negative 4th version number tells Moonlight that this is Sunshine + +/** + * @brief The GFE version we are replicating. + */ +constexpr auto GFE_VERSION = "3.23.0.74"; + +/** + * @brief The HTTP port, as a difference from the config port. + */ +constexpr auto PORT_HTTP = 0; + +/** + * @brief The HTTPS port, as a difference from the config port. + */ constexpr auto PORT_HTTPS = -5; +// functions void start(); bool pin(std::string pin); void erase_all_clients();