Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
safestack.h
Go to the documentation of this file.
1/*
2 * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#ifndef HEADER_SAFESTACK_H
11# define HEADER_SAFESTACK_H
12
13# include <openssl/stack.h>
14# include <openssl/e_os2.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20# define STACK_OF(type) struct stack_st_##type
21
22# define SKM_DEFINE_STACK_OF(t1, t2, t3)
23 STACK_OF(t1);
24 typedef int (*sk_##t1##_compfunc)(const t3 * const *a, const t3 *const *b);
25 typedef void (*sk_##t1##_freefunc)(t3 *a);
26 typedef t3 * (*sk_##t1##_copyfunc)(const t3 *a);
27 static ossl_unused ossl_inline int sk_##t1##_num(const STACK_OF(t1) *sk)
28 {
29 return OPENSSL_sk_num((const OPENSSL_STACK *)sk);
30 }
31 static ossl_unused ossl_inline t2 *sk_##t1##_value(const STACK_OF(t1) *sk, int idx)
32 {
33 return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx);
34 }
35 static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new(sk_##t1##_compfunc compare)
36 {
37 return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare);
38 }
39 static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void)
40 {
41 return (STACK_OF(t1) *)OPENSSL_sk_new_null();
42 }
43 static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n)
44 {
45 return (STACK_OF(t1) *)OPENSSL_sk_new_reserve((OPENSSL_sk_compfunc)compare, n);
46 }
47 static ossl_unused ossl_inline int sk_##t1##_reserve(STACK_OF(t1) *sk, int n)
48 {
49 return OPENSSL_sk_reserve((OPENSSL_STACK *)sk, n);
50 }
51 static ossl_unused ossl_inline void sk_##t1##_free(STACK_OF(t1) *sk)
52 {
53 OPENSSL_sk_free((OPENSSL_STACK *)sk);
54 }
55 static ossl_unused ossl_inline void sk_##t1##_zero(STACK_OF(t1) *sk)
56 {
57 OPENSSL_sk_zero((OPENSSL_STACK *)sk);
58 }
59 static ossl_unused ossl_inline t2 *sk_##t1##_delete(STACK_OF(t1) *sk, int i)
60 {
61 return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i);
62 }
63 static ossl_unused ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr)
64 {
65 return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk,
66 (const void *)ptr);
67 }
68 static ossl_unused ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr)
69 {
70 return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr);
71 }
72 static ossl_unused ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr)
73 {
74 return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr);
75 }
76 static ossl_unused ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk)
77 {
78 return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk);
79 }
80 static ossl_unused ossl_inline t2 *sk_##t1##_shift(STACK_OF(t1) *sk)
81 {
82 return (t2 *)OPENSSL_sk_shift((OPENSSL_STACK *)sk);
83 }
84 static ossl_unused ossl_inline void sk_##t1##_pop_free(STACK_OF(t1) *sk, sk_##t1##_freefunc freefunc)
85 {
86 OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc);
87 }
88 static ossl_unused ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx)
89 {
90 return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx);
91 }
92 static ossl_unused ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr)
93 {
94 return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr);
95 }
96 static ossl_unused ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr)
97 {
98 return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr);
99 }
100 static ossl_unused ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr)
101 {
102 return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr);
103 }
104 static ossl_unused ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk)
105 {
106 OPENSSL_sk_sort((OPENSSL_STACK *)sk);
107 }
108 static ossl_unused ossl_inline int sk_##t1##_is_sorted(const STACK_OF(t1) *sk)
109 {
110 return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk);
111 }
112 static ossl_unused ossl_inline STACK_OF(t1) * sk_##t1##_dup(const STACK_OF(t1) *sk)
113 {
114 return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk);
115 }
116 static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk,
117 sk_##t1##_copyfunc copyfunc,
118 sk_##t1##_freefunc freefunc)
119 {
120 return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk,
121 (OPENSSL_sk_copyfunc)copyfunc,
122 (OPENSSL_sk_freefunc)freefunc);
123 }
124 static ossl_unused ossl_inline sk_##t1##_compfunc sk_##t1##_set_cmp_func(STACK_OF(t1) *sk, sk_##t1##_compfunc compare)
125 {
126 return (sk_##t1##_compfunc)OPENSSL_sk_set_cmp_func((OPENSSL_STACK *)sk, (OPENSSL_sk_compfunc)compare);
127 }
128
129# define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2)
130# define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t)
131# define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2)
132 SKM_DEFINE_STACK_OF(t1, const t2, t2)
133# define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t)
134
135/*-
136 * Strings are special: normally an lhash entry will point to a single
137 * (somewhat) mutable object. In the case of strings:
138 *
139 * a) Instead of a single char, there is an array of chars, NUL-terminated.
140 * b) The string may have be immutable.
141 *
142 * So, they need their own declarations. Especially important for
143 * type-checking tools, such as Deputy.
144 *
145 * In practice, however, it appears to be hard to have a const
146 * string. For now, I'm settling for dealing with the fact it is a
147 * string at all.
148 */
149typedef char *OPENSSL_STRING;
150typedef const char *OPENSSL_CSTRING;
151
152/*-
153 * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but
154 * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned
155 * above, instead of a single char each entry is a NUL-terminated array of
156 * chars. So, we have to implement STRING specially for STACK_OF. This is
157 * dealt with in the autogenerated macros below.
158 */
159DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
160DEFINE_SPECIAL_STACK_OF_CONST(OPENSSL_CSTRING, char)
161
162/*
163 * Similarly, we sometimes use a block of characters, NOT nul-terminated.
164 * These should also be distinguished from "normal" stacks.
165 */
166typedef void *OPENSSL_BLOCK;
167DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
168
169/*
170 * If called without higher optimization (min. -xO3) the Oracle Developer
171 * Studio compiler generates code for the defined (static inline) functions
172 * above.
173 * This would later lead to the linker complaining about missing symbols when
174 * this header file is included but the resulting object is not linked against
175 * the Crypto library (openssl#6912).
176 */
177# ifdef __SUNPRO_C
178# pragma weak OPENSSL_sk_num
179# pragma weak OPENSSL_sk_value
180# pragma weak OPENSSL_sk_new
181# pragma weak OPENSSL_sk_new_null
182# pragma weak OPENSSL_sk_new_reserve
183# pragma weak OPENSSL_sk_reserve
184# pragma weak OPENSSL_sk_free
185# pragma weak OPENSSL_sk_zero
186# pragma weak OPENSSL_sk_delete
187# pragma weak OPENSSL_sk_delete_ptr
188# pragma weak OPENSSL_sk_push
189# pragma weak OPENSSL_sk_unshift
190# pragma weak OPENSSL_sk_pop
191# pragma weak OPENSSL_sk_shift
192# pragma weak OPENSSL_sk_pop_free
193# pragma weak OPENSSL_sk_insert
194# pragma weak OPENSSL_sk_set
195# pragma weak OPENSSL_sk_find
196# pragma weak OPENSSL_sk_find_ex
197# pragma weak OPENSSL_sk_sort
198# pragma weak OPENSSL_sk_is_sorted
199# pragma weak OPENSSL_sk_dup
200# pragma weak OPENSSL_sk_deep_copy
201# pragma weak OPENSSL_sk_set_cmp_func
202# endif /* __SUNPRO_C */
203
204# ifdef __cplusplus
205}
206# endif
207#endif
#define ARK_API
Definition Base.h:9
#define poco_unexpected()
Definition Bugcheck.h:140
#define POCO_EXTERNAL_OPENSSL
Definition Config.h:189
#define POCO_NO_SOO
Definition Config.h:82
#define POCO_DECLARE_EXCEPTION(API, CLS, BASE)
Definition Exception.h:157
#define POCO_DECLARE_EXCEPTION_CODE(API, CLS, BASE, CODE)
Definition Exception.h:140
#define POCO_DO_JOIN2(X, Y)
Definition Foundation.h:134
#define POCO_DO_JOIN(X, Y)
Definition Foundation.h:133
#define Foundation_API
Definition Foundation.h:60
#define POCO_JOIN(X, Y)
Definition Foundation.h:132
#define POCO_HAVE_IPv6
Definition Net.h:64
#define Net_API
Definition Net.h:47
#define NetSSL_API
Definition NetSSL.h:48
#define POCO_OS_IRIX
Definition Platform.h:35
#define POCO_OS_TRU64
Definition Platform.h:30
#define POCO_OS_WINDOWS_NT
Definition Platform.h:43
#define POCO_OS_HPUX
Definition Platform.h:29
#define POCO_OS_CYGWIN
Definition Platform.h:39
#define POCO_OS_WINDOWS_CE
Definition Platform.h:44
#define POCO_UNUSED
Definition Platform.h:274
#define POCO_OS_VXWORKS
Definition Platform.h:38
#define POCO_OS_ANDROID
Definition Platform.h:41
#define POCO_OS_QNX
Definition Platform.h:37
#define POCO_OS_AIX
Definition Platform.h:28
#define POCO_OS_LINUX
Definition Platform.h:31
#define POCO_OS_SOLARIS
Definition Platform.h:36
#define POCO_ARCH_AMD64
Definition Platform.h:129
#define OPENSSL_VERSION_PREREQ(maj, min)
Definition Crypto.h:36
#define Crypto_API
Definition Crypto.h:82
RSAPaddingMode
The padding mode used for RSA public key encryption.
Definition Crypto.h:44
@ RSA_PADDING_PKCS1_OAEP
PKCS #1 v1.5 padding. This currently is the most widely used mode.
Definition Crypto.h:48
@ RSA_PADDING_NONE
Definition Crypto.h:52
@ RSA_PADDING_PKCS1
Definition Crypto.h:45
#define POCO_EXTERNAL_OPENSSL_SLPRO
Definition Crypto.h:24
#define poco_ntoh_32(x)
Definition SocketDefs.h:328
#define INADDR_NONE
Definition SocketDefs.h:291
#define INADDR_BROADCAST
Definition SocketDefs.h:299
#define INADDR_ANY
Definition SocketDefs.h:295
#define poco_ntoh_16(x)
Definition SocketDefs.h:326
#define INADDR_LOOPBACK
Definition SocketDefs.h:303
virtual std::unique_ptr< ArkApi::ICommands > & GetCommands()=0
std::mutex RequestMutex_
Definition Requests.cpp:47
void WriteRequest(std::function< void(bool, std::string)> callback, bool success, std::string result)
Definition Requests.cpp:73
std::string GetResponse(Poco::Net::HTTPClientSession *session, Poco::Net::HTTPResponse &response)
Definition Requests.cpp:107
Poco::Net::HTTPRequest ConstructRequest(const std::string &url, Poco::Net::HTTPClientSession *&session, const std::vector< std::string > &headers, const std::string &request_type)
Definition Requests.cpp:79
std::vector< RequestData > RequestsVec_
Definition Requests.cpp:46
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.
Definition Requests.cpp:129
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...
Definition Requests.cpp:238
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...
Definition Requests.cpp:292
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...
Definition Requests.cpp:162
static ARK_API Requests & Get()
Definition Requests.cpp:67
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...
Definition Requests.cpp:200
std::unique_ptr< impl > pimpl
Definition Requests.h:84
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.
Definition Logger.h:9
static std::shared_ptr< spdlog::logger > & GetLog()
Definition Logger.h:22
ValueType operator--()
Increments the counter and returns the previous value.
ValueType operator++()
Returns the value of the counter.
ValueType operator++(int)
Increments the counter and returns the result.
AtomicCounter(ValueType initialValue)
Creates a new AtomicCounter and initializes it to zero.
operator ValueType() const
Assigns a value to the counter.
ValueType operator--(int)
Decrements the counter and returns the result.
ValueType value() const
Converts the AtomicCounter to ValueType.
AtomicCounter & operator=(const AtomicCounter &counter)
Destroys the AtomicCounter.
AtomicCounter & operator=(ValueType value)
Assigns the value of another AtomicCounter.
AtomicCounter()
The underlying integer type.
bool operator!() const
Decrements the counter and returns the previous value.
AtomicCounter(const AtomicCounter &counter)
~AtomicCounter()
Creates the counter by copying another one.
std::atomic< int > _counter
Returns true if the counter is zero, false otherwise.
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)
static struct CRYPTO_dynlock_value * dynlockCreate(const char *file, int line)
static void uninitialize()
Initializes the OpenSSL machinery.
static void initialize()
Automatically shut down OpenSSL on exit.
~OpenSSLInitializer()
Automatically initialize OpenSSL on startup.
static void lock(int mode, int n, const char *file, int line)
static unsigned long id()
static Poco::AtomicCounter _rc
static void enableFIPSMode(bool enabled)
static Poco::FastMutex * _mutexes
static void dynlock(int mode, struct CRYPTO_dynlock_value *lock, const char *file, int line)
static bool isFIPSEnabled()
Shuts down the OpenSSL machinery.
static void dynlockDestroy(struct CRYPTO_dynlock_value *lock, const char *file, int line)
This class represents a X509 Certificate.
void swap(X509Certificate &cert)
Move assignment.
std::string subjectName(NID nid) const
Returns the certificate subject's distinguished name.
bool equals(const X509Certificate &otherCertificate) const
const X509 * certificate() const
Poco::DateTime expiresOn() const
Returns the date and time the certificate is valid from.
X509Certificate(X509 *pCert, bool shared)
std::string issuerName(NID nid) const
Returns the certificate issuer's distinguished name.
const std::string & subjectName() const
X509Certificate(const X509Certificate &cert)
const std::string & serialNumber() const
Returns the version of the certificate.
X509Certificate & operator=(const X509Certificate &cert)
Creates the certificate by moving another one.
X509 * dup() const
Returns the underlying OpenSSL certificate.
~X509Certificate()
Exchanges the certificate with another one.
bool issuedBy(const X509Certificate &issuerCertificate) const
const std::string & issuerName() const
long version() const
Destroys the X509Certificate.
X509Certificate(X509Certificate &&cert) noexcept
Creates the certificate by copying another one.
void load(std::istream &stream)
Writes the list of certificates to the specified PEM file.
std::string signatureAlgorithm() const
void print(std::ostream &out) const
Returns the certificate signature algorithm long name.
Poco::DateTime validFrom() const
X509Certificate(std::istream &istr)
std::string commonName() const
void save(std::ostream &stream) const
OpenSSLInitializer _openSSLInitializer
X509Certificate & operator=(X509Certificate &&cert) noexcept
Assigns a certificate.
Exception(const Exception &exc)
virtual const char * what() const noexcept
Returns the name of the exception class.
const std::string & message() const
Definition Exception.h:116
void message(const std::string &msg)
Standard constructor.
Definition Exception.h:122
Exception(const std::string &msg, const Exception &nested, int code=0)
Creates an exception.
std::string _msg
Sets the extended message for the exception.
Definition Exception.h:101
Exception(const std::string &msg, const std::string &arg, int code=0)
Creates an exception.
const Exception * nested() const
Definition Exception.h:110
Exception * _pNested
Definition Exception.h:102
virtual Exception * clone() const
Exception & operator=(const Exception &exc)
Destroys the exception and deletes the nested exception.
Exception(int code=0)
virtual void rethrow() const
void extendedMessage(const std::string &arg)
Sets the message for the exception.
virtual const char * name() const noexcept
Assignment operator.
int code() const
Returns the message text.
Definition Exception.h:128
~Exception() noexcept
Copy constructor.
std::string displayText() const
Returns the exception code if defined.
Exception(const std::string &msg, int code=0)
virtual const char * className() const noexcept
Returns a static string describing the exception.
void unlock()
Definition Mutex.h:333
bool tryLock(long milliseconds)
Definition Mutex.h:327
~FastMutex()
creates the Mutex.
void lock()
destroys the Mutex.
Definition Mutex.h:308
bool tryLock()
Definition Mutex.h:321
FastMutex(const FastMutex &)
void lock(long milliseconds)
Definition Mutex.h:314
FastMutex & operator=(const FastMutex &)
bool tryLock(long milliseconds)
Definition Mutex.h:292
void lock(long milliseconds)
Definition Mutex.h:279
void unlock()
Definition Mutex.h:298
void lock()
destroys the Mutex.
Definition Mutex.h:273
Mutex & operator=(const Mutex &)
bool tryLock()
Definition Mutex.h:286
Mutex(const Mutex &)
~Mutex()
creates the Mutex.
bool tryLockImpl(long milliseconds)
void init(const Params &params)
void setSessionCacheSize(std::size_t size)
Returns true iff the session cache is enabled.
std::size_t getSessionCacheSize() const
Context::VerificationMode verificationMode() const
Returns true iff the context is for use by a server.
Definition Context.h:466
void requireMinimumProtocol(Protocols protocol)
void enableExtendedCertificateVerification(bool flag=true)
void setInvalidCertificateHandler(InvalidCertificateHandlerPtr pInvalidCertificageHandler)
Usage _usage
Create a SSL_CTX object according to Context configuration.
Definition Context.h:437
Usage usage() const
Returns the underlying OpenSSL SSL Context object.
Definition Context.h:449
SSL_CTX * sslContext() const
Definition Context.h:472
long getSessionTimeout() const
void usePrivateKey(const Poco::Crypto::RSAKey &key)
Add one trusted certification authority to be used by the Context.
void enableSessionCache(bool flag=true)
Returns the verification mode.
void addCertificateAuthority(const Poco::Crypto::X509Certificate &certificate)
Adds a certificate for certificate chain validation.
void usePrivateKey(const Poco::Crypto::EVPPKey &pkey)
bool extendedCertificateVerificationEnabled() const
Definition Context.h:478
bool isForServerUse() const
Definition Context.h:455
void addChainCertificate(const Poco::Crypto::X509Certificate &certificate)
bool _ocspStaplingResponseVerification
Definition Context.h:441
bool ocspStaplingResponseVerificationEnabled() const
Definition Context.h:484
bool _extendedCertificateVerification
Definition Context.h:440
VerificationMode _mode
Definition Context.h:438
@ SERVER_USE
DEPRECATED. Context is used by a client.
Definition Context.h:71
@ TLSV1_2_CLIENT_USE
DEPRECATED. Context is used by a server requiring TLSv1.1 (OpenSSL 1.0.0 or newer).
Definition Context.h:76
@ TLSV1_CLIENT_USE
DEPRECATED. Context is used by a server.
Definition Context.h:72
@ TLSV1_3_SERVER_USE
DEPRECATED. Context is used by a client requiring TLSv1.3 (OpenSSL 1.1.1 or newer).
Definition Context.h:79
@ CLIENT_USE
Context is used by a client for TLSv1 or higher. Use requireMinimumProtocol() or disableProtocols() t...
Definition Context.h:70
@ TLSV1_2_SERVER_USE
DEPRECATED. Context is used by a client requiring TLSv1.2 (OpenSSL 1.0.1 or newer).
Definition Context.h:77
@ TLSV1_SERVER_USE
DEPRECATED. Context is used by a client requiring TLSv1.
Definition Context.h:73
@ TLSV1_3_CLIENT_USE
DEPRECATED. Context is used by a server requiring TLSv1.2 (OpenSSL 1.0.1 or newer).
Definition Context.h:78
@ TLS_SERVER_USE
Context is used by a client for TLSv1 or higher. Use requireMinimumProtocol() or disableProtocols() t...
Definition Context.h:69
@ TLSV1_1_CLIENT_USE
DEPRECATED. Context is used by a server requiring TLSv1.
Definition Context.h:74
@ TLSV1_1_SERVER_USE
DEPRECATED. Context is used by a client requiring TLSv1.1 (OpenSSL 1.0.0 or newer).
Definition Context.h:75
void useCertificate(const Poco::Crypto::X509Certificate &certificate)
Destroys the Context.
void preferServerCiphers()
Context(Usage usage, const Params &params)
InvalidCertificateHandlerPtr _pInvalidCertificateHandler
Definition Context.h:442
void setSessionTimeout(long seconds)
InvalidCertificateHandlerPtr getInvalidCertificateHandler() const
Definition Context.h:490
void disableStatelessSessionResumption()
bool sessionCacheEnabled() const
void disableProtocols(int protocols)
SSL_CTX * _pSSLContext
Definition Context.h:439
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)
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)
InvalidCertificateHandler(bool handleErrorsOnServerSide)
virtual void onInvalidCertificate(const void *pSender, VerificationErrorArgs &errorCert)=0
Destroys the InvalidCertificateHandler.
RejectCertificateHandler(bool handleErrorsOnServerSide)
void initializeClient(PrivateKeyPassphraseHandlerPtr ptrPassphraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext)
static SSLManager & instance()
static std::string convertCertificateError(long errCode)
static std::string getLastError()
Converts an SSL certificate handling error code into an error message.
static void clearErrorStack()
Returns the last error from the error stack.
A utility class for certificate error handling.
void unlock()
Does nothing.
Definition Mutex.h:258
void lock(long)
Does nothing.
Definition Mutex.h:241
NullMutex()
Creates the NullMutex.
Definition Mutex.h:226
bool tryLock()
Does nothing and always returns true.
Definition Mutex.h:246
void lock()
Does nothing.
Definition Mutex.h:236
~NullMutex()
Destroys the NullMutex.
Definition Mutex.h:231
bool tryLock(long)
Does nothing and always returns true.
Definition Mutex.h:252
This stream discards all characters written to it.
Definition NullStream.h:77
ScopedLock(M &mutex, long milliseconds)
Definition ScopedLock.h:41
ScopedLock(const ScopedLock &)
ScopedLock(M &mutex)
Definition ScopedLock.h:36
ScopedLock & operator=(const ScopedLock &)
ScopedLockWithUnlock & operator=(const ScopedLockWithUnlock &)
ScopedLockWithUnlock(const ScopedLockWithUnlock &)
ScopedLockWithUnlock(M &mutex, long milliseconds)
Definition ScopedLock.h:83
static std::streamsize copyStream(std::istream &istr, std::ostream &ostr, std::size_t bufferSize=8192)
A class that represents time spans up to microsecond resolution.
Definition Timespan.h:30
Timestamp & operator=(const Timestamp &other)
Destroys the timestamp.
Timestamp & operator+=(TimeDiff d)
Definition Timestamp.h:210
Timestamp & operator-=(TimeDiff d)
Definition Timestamp.h:217
Timestamp(TimeVal tv)
Creates a timestamp with the current time.
Timestamp & operator=(TimeVal tv)
bool isElapsed(TimeDiff interval) const
Definition Timestamp.h:249
static const TimeVal TIMEVAL_MIN
Difference between two TimeVal values in microseconds.
Definition Timestamp.h:61
TimeVal epochMicroseconds() const
Definition Timestamp.h:236
static Timestamp fromUtcTime(UtcTimeVal val)
Creates a timestamp from a std::time_t.
TimeDiff elapsed() const
Definition Timestamp.h:242
static TimeDiff resolution()
Definition Timestamp.h:257
bool operator<=(const Timestamp &ts) const
Definition Timestamp.h:186
Timestamp operator+(const Timespan &span) const
std::time_t epochTime() const
Definition Timestamp.h:224
~Timestamp()
Copy constructor.
Timestamp operator-(const Timespan &span) const
bool operator==(const Timestamp &ts) const
Updates the Timestamp with the current time.
Definition Timestamp.h:156
bool operator>=(const Timestamp &ts) const
Definition Timestamp.h:174
Timestamp & operator-=(const Timespan &span)
UtcTimeVal utcTime() const
Definition Timestamp.h:230
Timestamp operator+(TimeDiff d) const
Definition Timestamp.h:192
bool operator<(const Timestamp &ts) const
Definition Timestamp.h:180
static Timestamp fromEpochTime(std::time_t t)
Timestamp()
Maximum timestamp value.
bool operator!=(const Timestamp &ts) const
Definition Timestamp.h:162
static const TimeVal TIMEVAL_MAX
Minimum timestamp value.
Definition Timestamp.h:62
TimeDiff operator-(const Timestamp &ts) const
Definition Timestamp.h:204
Timestamp & operator+=(const Timespan &span)
bool operator>(const Timestamp &ts) const
Definition Timestamp.h:168
Timestamp(const Timestamp &other)
void swap(Timestamp &timestamp)
Timestamp operator-(TimeDiff d) const
Definition Timestamp.h:198
TimeVal raw() const
Definition Timestamp.h:269
void update()
Swaps the Timestamp with another one.
const std::string & getHost() const
Sets the user-info part of the URI.
Definition URI.h:385
const std::string & getScheme() const
Definition URI.h:373
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.
FormatError(CStringRef message)
Definition format.h:686
void error(const T &)
#define ossl_unused
Definition e_os2.h:294
#define ossl_inline
Definition e_os2.h:276
#define ossl_ssize_t
Definition e_os2.h:214
#define __owur
Definition e_os2.h:227
#define ossl_noreturn
Definition e_os2.h:287
Definition IBaseApi.h:9
std::unique_ptr< IBaseApi > game_api
Definition IBaseApi.h:25
void Crypto_API uninitializeCrypto()
void Crypto_API initializeCrypto()
std::vector< SocketBuf > SocketBufVec
Definition SocketDefs.h:365
void NetSSL_API initializeSSL()
void Net_API uninitializeNetwork()
void Net_API initializeNetwork()
void NetSSL_API uninitializeSSL()
void swap(Timestamp &s1, Timestamp &s2)
Definition Timestamp.h:263
MutexImpl FastMutexImpl
Definition Mutex_WIN32.h:44
Null localtime_s(...)
Definition time.h:60
Null gmtime_r(...)
Definition time.h:61
Null localtime_r(...)
Definition time.h:59
Null gmtime_s(...)
Definition time.h:62
Definition format.h:408
void format_arg(BasicFormatter< char, ArgFormatter > &f, const char *&format_str, const std::tm &tm)
Definition time.h:24
Definition json.hpp:4518
int CRYPTO_secure_malloc_done(void)
int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b)
void OPENSSL_thread_stop(void)
void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
void CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, long argl, void *argp)
Definition crypto.h:166
size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz)
int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)
void * CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
int CRYPTO_mem_ctrl(int mode)
void * CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num, const char *file, int line)
void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, unsigned long flags)
int CRYPTO_set_mem_functions(void *(*m)(size_t, const char *, int), void *(*r)(void *, size_t, const char *, int), void(*f)(void *, const char *, int))
#define OPENSSL_INIT_ENGINE_PADLOCK
Definition crypto.h:370
int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec)
#define OPENSSL_INIT_ENGINE_RDRAND
Definition crypto.h:365
void OPENSSL_cleanse(void *ptr, size_t len)
int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
unsigned long OpenSSL_version_num(void)
int OPENSSL_isservice(void)
#define OPENSSL_DIR
Definition crypto.h:161
int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void(*cleanup)(void *))
void CRYPTO_free(void *ptr, const char *file, int line)
int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, const char *config_filename)
size_t OPENSSL_strnlen(const char *str, size_t maxlen)
int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)
unsigned char * OPENSSL_hexstr2buf(const char *str, long *len)
int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
void CRYPTO_get_mem_functions(void *(**m)(size_t, const char *, int), void *(**r)(void *, size_t, const char *, int), void(**f)(void *, const char *, int))
#define OPENSSL_BUILT_ON
Definition crypto.h:159
int OPENSSL_atexit(void(*handler)(void))
#define OPENSSL_CFLAGS
Definition crypto.h:158
void * CRYPTO_malloc(size_t num, const char *file, int line)
int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key)
int CRYPTO_secure_allocated(const void *ptr)
#define OPENSSL_VERSION
Definition crypto.h:157
int CRYPTO_secure_malloc_init(size_t sz, int minsize)
int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void(*init)(void))
char * CRYPTO_strdup(const char *str, const char *file, int line)
char * CRYPTO_strndup(const char *str, size_t s, const char *file, int line)
size_t CRYPTO_secure_actual_size(void *ptr)
void * CRYPTO_secure_malloc(size_t num, const char *file, int line)
#define CRYPTO_ONCE_STATIC_INIT
Definition crypto.h:428
int CRYPTO_free_ex_index(int class_index, int idx)
void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line)
void * CRYPTO_memdup(const void *str, size_t siz, const char *file, int line)
void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, long argl, void *argp)
Definition crypto.h:168
size_t CRYPTO_secure_used(void)
int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, void *from_d, int idx, long argl, void *argp)
Definition crypto.h:170
void CRYPTO_RWLOCK
Definition crypto.h:67
int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock)
void * CRYPTO_secure_zalloc(size_t num, const char *file, int line)
int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len)
int FIPS_mode(void)
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings)
CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void)
char * OPENSSL_buf2hexstr(const unsigned char *buffer, long len)
size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz)
#define OPENSSL_INIT_ENGINE_CAPI
Definition crypto.h:369
int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from)
__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock)
void OPENSSL_cleanup(void)
void * CRYPTO_realloc(void *addr, size_t num, const char *file, int line)
OPENSSL_INIT_SETTINGS * OPENSSL_INIT_new(void)
void OPENSSL_init(void)
void * CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
int CRYPTO_set_mem_debug(int flag)
int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, const char *config_appname)
#define OPENSSL_PLATFORM
Definition crypto.h:160
int OPENSSL_hexchar2int(unsigned char c)
int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val)
CRYPTO_RWLOCK * CRYPTO_THREAD_lock_new(void)
int OPENSSL_issetugid(void)
#define OPENSSL_INIT_ENGINE_DYNAMIC
Definition crypto.h:366
void CRYPTO_secure_free(void *ptr, const char *file, int line)
void * CRYPTO_zalloc(size_t num, const char *file, int line)
int CRYPTO_secure_malloc_initialized(void)
ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line)
int OPENSSL_gmtime_diff(int *pday, int *psec, const struct tm *from, const struct tm *to)
const char * OpenSSL_version(int type)
#define OPENSSL_INIT_ENGINE_CRYPTODEV
Definition crypto.h:368
struct tm * OPENSSL_gmtime(const time_t *timer, struct tm *result)
void CRYPTO_secure_clear_free(void *ptr, size_t num, const char *file, int line)
int FIPS_mode_set(int r)
#define OPENSSL_EXPORT_VAR_AS_FUNCTION
#define OPENSSL_API_COMPAT
#define OPENSSL_MIN_API
#define OPENSSL_THREADS
Definition opensslconf.h:37
#define DECLARE_DEPRECATED(f)
#define OPENSSL_FILE
#define OPENSSL_NO_CRYPTO_MDEBUG
Definition opensslconf.h:49
#define OPENSSL_LINE
#define OPENSSL_VERSION_NUMBER
Definition opensslv.h:42
struct ssl_ctx_st SSL_CTX
Definition ossl_typ.h:149
struct x509_st X509
Definition ossl_typ.h:121
struct crypto_ex_data_st CRYPTO_EX_DATA
Definition ossl_typ.h:164
struct ossl_init_settings_st OPENSSL_INIT_SETTINGS
Definition ossl_typ.h:142
char * OPENSSL_STRING
Definition safestack.h:149
#define DEFINE_SPECIAL_STACK_OF(t1, t2)
Definition safestack.h:129
#define SKM_DEFINE_STACK_OF(t1, t2, t3)
Definition safestack.h:22
const char * OPENSSL_CSTRING
Definition safestack.h:150
#define DEFINE_STACK_OF(t)
Definition safestack.h:130
#define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2)
Definition safestack.h:131
void * OPENSSL_BLOCK
Definition safestack.h:166
#define STACK_OF(type)
Definition safestack.h:20
#define SSL_VERIFY_NONE
Definition ssl.h:1099
#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT
Definition ssl.h:1101
#define SSL_VERIFY_PEER
Definition ssl.h:1100
#define SSL_VERIFY_CLIENT_ONCE
Definition ssl.h:1102
std::function< void(bool, std::string)> callback
Definition Requests.cpp:41
Family
Possible address families for socket addresses.
Definition SocketDefs.h:373
std::string privateKeyFile
Initializes the struct with default values.
Definition Context.h:134
std::string certificateFile
Definition Context.h:138
VerificationMode verificationMode
Definition Context.h:149
static std::string escape(const std::string &s, bool strictJSON=false)
#define FMT_THROW(x)
Definition format.h:222
#define FMT_NULL
Definition format.h:273