19#ifndef Crypto_Crypto_INCLUDED
20#define Crypto_Crypto_INCLUDED
23#define POCO_EXTERNAL_OPENSSL_DEFAULT 1
24#define POCO_EXTERNAL_OPENSSL_SLPRO 2
27#include "Poco/Foundation.h"
28#include <openssl/opensslv.h>
31#ifndef OPENSSL_VERSION_PREREQ
32 #if defined(OPENSSL_VERSION_MAJOR) && defined(OPENSSL_VERSION_MINOR)
33 #define OPENSSL_VERSION_PREREQ(maj, min)
34 ((OPENSSL_VERSION_MAJOR << 16
) + OPENSSL_VERSION_MINOR >= ((maj) << 16
) + (min))
36 #define OPENSSL_VERSION_PREREQ(maj, min)
69 #if defined(Crypto_EXPORTS)
70 #define Crypto_API __declspec(dllexport)
72 #define Crypto_API __declspec(dllimport)
78#if !defined(Crypto_API)
79 #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4
)
80 #define Crypto_API __attribute__ ((visibility ("default")))
91 #if !defined(POCO_NO_AUTOMATIC_LIBS)
92 #if defined(POCO_INTERNAL_OPENSSL_MSVC_VER)
93 #if defined(POCO_EXTERNAL_OPENSSL)
94 #pragma message("External OpenSSL defined but internal headers used - possible mismatch!")
97 #define POCO_DEBUG_SUFFIX ""
99 #define POCO_STATIC_SUFFIX "mt"
101 #define POCO_STATIC_SUFFIX ""
104 #define POCO_DEBUG_SUFFIX "d"
106 #define POCO_STATIC_SUFFIX "mt"
108 #define POCO_STATIC_SUFFIX ""
111 #pragma comment(lib, "libcrypto" POCO_STATIC_SUFFIX POCO_DEBUG_SUFFIX ".lib")
112 #pragma comment(lib, "libssl" POCO_STATIC_SUFFIX POCO_DEBUG_SUFFIX ".lib")
113 #if !defined(_WIN64) && !defined (_DLL) &&
114 (POCO_INTERNAL_OPENSSL_MSVC_VER == 120
) &&
115 (POCO_MSVC_VERSION < POCO_INTERNAL_OPENSSL_MSVC_VER)
116 #pragma comment(lib, "libPreVS2013CRT" POCO_STATIC_SUFFIX POCO_DEBUG_SUFFIX ".lib")
118 #if !defined (_DLL) && (POCO_MSVS_VERSION >= 2015
)
119 #pragma comment(lib, "legacy_stdio_definitions.lib")
120 #pragma comment(lib, "legacy_stdio_wide_specifiers.lib")
124 #if defined(POCO_DLL)
125 #if OPENSSL_VERSION_PREREQ(1
,1
)
126 #pragma comment(lib, "libcrypto.lib")
127 #pragma comment(lib, "libssl.lib")
129 #pragma comment(lib, "libeay32.lib")
130 #pragma comment(lib, "ssleay32.lib")
135 #pragma comment(lib, "libcrypto")
136 #pragma comment(lib, "libssl")
138 #pragma comment(lib, "libcrypto32" POCO_LIB_SUFFIX)
139 #pragma comment(lib, "libssl32" POCO_LIB_SUFFIX)
142 #pragma comment(lib, "libeay32" POCO_LIB_SUFFIX)
143 #pragma comment(lib, "ssleay32" POCO_LIB_SUFFIX)
146 #elif POCO_EXTERNAL_OPENSSL == POCO_EXTERNAL_OPENSSL_DEFAULT
147 #if OPENSSL_VERSION_PREREQ(1
,1
)
148 #pragma comment(lib, "libcrypto.lib")
149 #pragma comment(lib, "libssl.lib")
151 #pragma comment(lib, "libeay32.lib")
152 #pragma comment(lib, "ssleay32.lib")
156 #if !defined(Crypto_EXPORTS)
157 #pragma comment(lib, "PocoCrypto" POCO_LIB_SUFFIX
)
#define POCO_EXTERNAL_OPENSSL
#define POCO_DO_JOIN2(X, Y)
#define POCO_DO_JOIN(X, Y)
#define OPENSSL_VERSION_PREREQ(maj, min)
RSAPaddingMode
The padding mode used for RSA public key encryption.
@ RSA_PADDING_PKCS1_OAEP
PKCS #1 v1.5 padding. This currently is the most widely used mode.
#define POCO_EXTERNAL_OPENSSL_SLPRO
virtual std::unique_ptr< ArkApi::ICommands > & GetCommands()=0
void WriteRequest(std::function< void(bool, std::string)> callback, bool success, std::string result)
std::string GetResponse(Poco::Net::HTTPClientSession *session, Poco::Net::HTTPResponse &response)
Poco::Net::HTTPRequest ConstructRequest(const std::string &url, Poco::Net::HTTPClientSession *&session, const std::vector< std::string > &headers, const std::string &request_type)
std::vector< RequestData > RequestsVec_
Requests(Requests &&)=delete
ARK_API bool CreateGetRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, std::vector< std::string > headers={})
Creates an async GET Request that runs in another thread but calls the callback from the main thread.
ARK_API bool CreatePostRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, const std::vector< std::string > &post_ids, const std::vector< std::string > &post_data, std::vector< std::string > headers={})
Creates an async POST Request that runs in another thread but calls the callback from the main thread...
Requests & operator=(Requests &&)=delete
ARK_API bool CreateDeleteRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, std::vector< std::string > headers={})
Creates an async DELETE Request that runs in another thread but calls the callback from the main thre...
Requests & operator=(const Requests &)=delete
ARK_API bool CreatePostRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, const std::string &post_data, std::vector< std::string > headers={})
Creates an async POST Request with application/x-www-form-urlencoded content type that runs in anothe...
static ARK_API Requests & Get()
ARK_API bool CreatePostRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, const std::string &post_data, const std::string &content_type, std::vector< std::string > headers={})
Creates an async POST Request that runs in another thread but calls the callback from the main thread...
std::unique_ptr< impl > pimpl
Requests(const Requests &)=delete
virtual void AddOnTickCallback(const FString &id, const std::function< void(float)> &callback)=0
Added function will be called every frame.
virtual bool RemoveOnTickCallback(const FString &id)=0
Removes a on-tick callback.
static std::shared_ptr< spdlog::logger > & GetLog()
static std::string what(const char *msg, const char *file, int line, const char *text=0)
static void bugcheck(const char *msg, const char *file, int line)
static void nullPointer(const char *ptr, const char *file, int line)
static void debugger(const char *msg, const char *file, int line)
static void debugger(const char *file, int line)
static void bugcheck(const char *file, int line)
static void assertion(const char *cond, const char *file, int line, const char *text=0)
static void unexpected(const char *file, int line)
std::string displayText() const
Returns the exception code if defined.
virtual std::istream & receiveResponse(HTTPResponse &response)
virtual std::ostream & sendRequest(HTTPRequest &request)
Returns the connection timeout for HTTP connections.
static const std::string HTTP_1_1
void setContentLength(std::streamsize length)
Returns the HTTP version for this message.
HTTPRequest(const std::string &method, const std::string &uri, const std::string &version)
Creates a HTTP/1.0 request with the given method and URI.
static const std::string HTTP_GET
static const std::string HTTP_DELETE
static const std::string HTTP_POST
const std::string & getReason() const
Sets the HTTP reason phrase.
HTTPResponse(HTTPStatus status)
HTTPStatus getStatus() const
HTTPSClientSession(const std::string &host, Poco::UInt16 port, Context::Ptr pContext, Session::Ptr pSession)
std::string proxyRequestPrefix() const
Sends the given HTTPRequest over an existing connection.
HTTPSClientSession(Context::Ptr pContext, Session::Ptr pSession)
Session::Ptr sslSession()
HTTPSClientSession(Context::Ptr pContext)
Creates a HTTPSClientSession using the given host and port.
void proxyAuthenticate(HTTPRequest &request)
Checks if we can reuse a persistent connection.
int read(char *buffer, std::streamsize length)
HTTPSClientSession(const HTTPSClientSession &)
void connect(const SocketAddress &address)
Refills the internal buffer.
HTTPSClientSession(const SecureStreamSocket &socket, Session::Ptr pSession)
X509Certificate serverCertificate()
HTTPSClientSession & operator=(const HTTPSClientSession &)
HTTPSClientSession(const std::string &host, Poco::UInt16 port=HTTPS_PORT)
HTTPSClientSession(const SecureStreamSocket &socket)
Creates an unconnected HTTPSClientSession.
HTTPSClientSession(const std::string &host, Poco::UInt16 port, Context::Ptr pContext)
RejectCertificateHandler(bool handleErrorsOnServerSide)
void initializeClient(PrivateKeyPassphraseHandlerPtr ptrPassphraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext)
static SSLManager & instance()
This stream discards all characters written to it.
static std::streamsize copyStream(std::istream &istr, std::ostream &ostr, std::size_t bufferSize=8192)
const std::string & getHost() const
Sets the user-info part of the URI.
const std::string & getScheme() const
URI(const std::string &uri)
Creates an empty URI.
unsigned short getPort() const
Sets the host part of the URI.
std::string getPathAndQuery() const
Returns the encoded path, query and fragment parts of the URI.
std::unique_ptr< IBaseApi > game_api
void Crypto_API uninitializeCrypto()
void Crypto_API initializeCrypto()
void NetSSL_API initializeSSL()
void Net_API uninitializeNetwork()
void Net_API initializeNetwork()
void NetSSL_API uninitializeSSL()
#define OPENSSL_VERSION_NUMBER
std::function< void(bool, std::string)> callback
static std::string escape(const std::string &s, bool strictJSON=false)