Files
citra/src/network/network_clients/nasc.h
T
71235bd678 Online (#2)
* Implement SOC_U::GetHostByName and partial SOC_U::GetNetworkOpt

* Implement AC::GetWifiStatus, and get proper network interface.

* Minor fixes

* More minor fixes

* Even more fixes

* Fix Get/Set SockOpt

* Implement SendToOther

* Apply suggestions and fix timer advance

* Fix variable name

* WIP implementation

* More implemented friends/mii/fs stuff

* Add more sockopt values and fix send/recv flags.

* Temporary disable GetFriendPresence

* Fix dontwait logic

* Fix linux build

* Add missing header for linux

* Remove TCP_STDURG

* frd stuff

* Fix poll and add more 3ds <-> platform conversions

* Finish implementing all platform <-> 3ds conversion.

* Disable UDP connreset and fix poll again.

* Fix compile issues

* Apply suggestions

* Fix compiler issues

* Fix compiler errors (again)

* Fix GetAddrInfo

* Use cert from nand files instead of account.

* Implement more frd functionality.

* common: Add thread pool from yuzu

* Is really useful for asynchronous operations like shader compilation and custom textures, will be used in following PRs

* core: Improve ImageInterface

* Provide a default implementation so frontends don't have to duplicate code registering the lodepng version

* Add a dds version too which we will use in the next commit

* rasterizer_cache: Rewrite custom textures

* There's just too much to talk about here, look at the PR description for more details

* rasterizer_cache: Implement basic pack configuration file

* custom_tex_manager: Flip dumped textures

* custom_tex_manager: Optimize custom texture hashing

* If no convertions are needed then we can hash the decoded data directly removing the needed for duplicate decode

* custom_tex_manager: Implement asynchronous texture loading

* The file loading and decoding is offloaded into worker threads, while the upload itself still occurs in the main thread to avoid having to manage shared contexts

* Address review comments

* custom_tex_manager: Introduce custom material support

* Remove files that were not added properly

* fix submodules

* Fix submodules again

* fix more files

---------

Co-authored-by: GPUCode <geoster3d@gmail.com>
2023-07-27 18:19:33 +02:00

81 lines
2.1 KiB
C++

// Copyright 2017 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <httplib.h>
#include "common/common_types.h"
#include "map"
#include "string"
#include "vector"
namespace NetworkClient::NASC {
class NASCClient {
public:
struct NASCResult {
u8 result = 0;
int http_status;
std::string log_message;
std::string server_address;
u16 server_port;
std::string auth_token;
u64 time_stamp;
};
NASCClient(const std::string& url, const std::vector<u8>& cert, const std::vector<u8>& key)
: nasc_url(url) {
Initialize(cert, key);
}
~NASCClient() {
if (client_cert) {
X509_free(client_cert);
client_cert = nullptr;
}
if (client_priv_key) {
EVP_PKEY_free(client_priv_key);
client_priv_key = nullptr;
}
}
void Clear() {
parameters.clear();
}
void SetParameter(const std::string& key, int value) {
SetParameter(key, std::to_string(value));
}
void SetParameter(const std::string& key, const std::string& value) {
SetParameter(key, std::vector<u8>(value.cbegin(), value.cend()));
}
void SetParameter(const std::string& key, const std::vector<u8>& value) {
SetParameterImpl(key, value);
}
NASCResult Perform();
private:
const std::string base64_dict =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-";
std::string nasc_url;
X509* client_cert = nullptr;
EVP_PKEY* client_priv_key = nullptr;
void Initialize(const std::vector<u8>& cert, const std::vector<u8>& key);
httplib::Params parameters;
void SetParameterImpl(const std::string& key, const std::vector<u8>& value);
bool GetParameter(const httplib::Params& param, const std::string& key, std::string& out);
bool GetParameter(const httplib::Params& param, const std::string& key, int& out);
bool GetParameter(const httplib::Params& param, const std::string& key, long long& out);
};
} // namespace NetworkClient::NASC