Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
SharedPtr.h
Go to the documentation of this file.
1//
2// SharedPtr.h
3//
4// Library: Foundation
5// Package: Core
6// Module: SharedPtr
7//
8// Definition of the SharedPtr template class.
9//
10// Copyright (c) 2005-2008, Applied Informatics Software Engineering GmbH.
11// and Contributors.
12//
13// SPDX-License-Identifier: BSL-1.0
14//
15
16
17#ifndef Foundation_SharedPtr_INCLUDED
18#define Foundation_SharedPtr_INCLUDED
19
20
21#include "Poco/Foundation.h"
22#include "Poco/Exception.h"
23#include "Poco/AtomicCounter.h"
24#include <algorithm>
25#include <cstddef>
26
27
28namespace Poco {
29
30
32 /// Simple ReferenceCounter object, does not delete itself when count reaches 0.
33{
34public:
36 {
37 }
38
39 void duplicate()
40 {
41 ++_cnt;
42 }
43
44 int release()
45 {
46 return --_cnt;
47 }
48
49 int referenceCount() const
50 {
51 return _cnt.value();
52 }
53
54private:
56};
57
58
59template <class C>
61 /// The default release policy for SharedPtr, which
62 /// simply uses the delete operator to delete an object.
63{
64public:
65 static void release(C* pObj) noexcept
66 /// Delete the object.
67 /// Note that pObj can be nullptr.
68 {
69 delete pObj;
70 }
71};
72
73
74template <class C>
76 /// The release policy for SharedPtr holding arrays.
77{
78public:
79 static void release(C* pObj) noexcept
80 /// Delete the object.
81 /// Note that pObj can be nullptr.
82 {
83 delete [] pObj;
84 }
85};
86
87
88template <class C, class RC = ReferenceCounter, class RP = ReleasePolicy<C>>
90 /// SharedPtr is a "smart" pointer for classes implementing
91 /// reference counting based garbage collection.
92 /// SharedPtr is thus similar to AutoPtr. Unlike the
93 /// AutoPtr template, which can only be used with
94 /// classes that support reference counting, SharedPtr
95 /// can be used with any class. For this to work, a
96 /// SharedPtr manages a reference count for the object
97 /// it manages.
98 ///
99 /// SharedPtr works in the following way:
100 /// If an SharedPtr is assigned an ordinary pointer to
101 /// an object (via the constructor or the assignment operator),
102 /// it takes ownership of the object and the object's reference
103 /// count is initialized to one.
104 /// If the SharedPtr is assigned another SharedPtr, the
105 /// object's reference count is incremented by one.
106 /// The destructor of SharedPtr decrements the object's
107 /// reference count by one and deletes the object if the
108 /// reference count reaches zero.
109 /// SharedPtr supports dereferencing with both the ->
110 /// and the * operator. An attempt to dereference a null
111 /// SharedPtr results in a NullPointerException being thrown.
112 /// SharedPtr also implements all relational operators and
113 /// a cast operator in case dynamic casting of the encapsulated data types
114 /// is required.
115{
116public:
117 typedef C Type;
118
120 _pCounter(nullptr),
121 _ptr(nullptr)
122 {
123 }
124
125 SharedPtr(C* ptr)
126 try:
127 _pCounter(ptr ? new RC : nullptr),
128 _ptr(ptr)
129 {
130 }
131 catch (...)
132 {
133 RP::release(ptr);
134 }
135
136 template <class Other, class OtherRP>
137 SharedPtr(const SharedPtr<Other, RC, OtherRP>& ptr):
139 _ptr(const_cast<Other*>(ptr.get()))
140 {
142 }
143
144 SharedPtr(const SharedPtr& ptr):
145 _pCounter(ptr._pCounter),
146 _ptr(ptr._ptr)
147 {
148 if (_pCounter) _pCounter->duplicate();
149 }
150
151 SharedPtr(SharedPtr&& ptr) noexcept:
152 _pCounter(ptr._pCounter),
153 _ptr(ptr._ptr)
154 {
155 ptr._pCounter = nullptr;
156 ptr._ptr = nullptr;
157 }
158
160 {
161 release();
162 }
163
165 {
166 if (get() != ptr)
167 {
169 swap(tmp);
170 }
171 return *this;
172 }
173
175 {
176 if (&ptr != this)
177 {
179 swap(tmp);
180 }
181 return *this;
182 }
183
184 template <class Other, class OtherRP>
185 SharedPtr& assign(const SharedPtr<Other, RC, OtherRP>& ptr)
186 {
187 if (ptr.get() != _ptr)
188 {
190 swap(tmp);
191 }
192 return *this;
193 }
194
195 void reset()
196 {
197 assign(nullptr);
198 }
199
200 void reset(C* ptr)
201 {
202 assign(ptr);
203 }
204
205 void reset(const SharedPtr& ptr)
206 {
207 assign(ptr);
208 }
209
210 template <class Other, class OtherRP>
211 void reset(const SharedPtr<Other, RC, OtherRP>& ptr)
212 {
214 }
215
216 SharedPtr& operator = (C* ptr)
217 {
218 return assign(ptr);
219 }
220
222 {
223 return assign(ptr);
224 }
225
226 SharedPtr& operator = (SharedPtr&& ptr) noexcept
227 {
228 release();
229 _ptr = ptr._ptr;
230 ptr._ptr = nullptr;
232 ptr._pCounter = nullptr;
233 return *this;
234 }
235
236 template <class Other, class OtherRP>
237 SharedPtr& operator = (const SharedPtr<Other, RC, OtherRP>& ptr)
238 {
239 return assign<Other>(ptr);
240 }
241
242 void swap(SharedPtr& ptr)
243 {
244 std::swap(_ptr, ptr._ptr);
246 }
247
248 template <class Other>
249 SharedPtr<Other, RC, RP> cast() const
250 /// Casts the SharedPtr via a dynamic cast to the given type.
251 /// Returns an SharedPtr containing NULL if the cast fails.
252 /// Example: (assume class Sub: public Super)
253 /// SharedPtr<Super> super(new Sub());
254 /// SharedPtr<Sub> sub = super.cast<Sub>();
255 /// poco_assert (sub.get());
256 {
257 Other* pOther = dynamic_cast<Other*>(_ptr);
258 if (pOther)
259 return SharedPtr<Other, RC, RP>(_pCounter, pOther);
260 return SharedPtr<Other, RC, RP>();
261 }
262
263 template <class Other>
264 SharedPtr<Other, RC, RP> unsafeCast() const
265 /// Casts the SharedPtr via a static cast to the given type.
266 /// Example: (assume class Sub: public Super)
267 /// SharedPtr<Super> super(new Sub());
268 /// SharedPtr<Sub> sub = super.unsafeCast<Sub>();
269 /// poco_assert (sub.get());
270 {
271 Other* pOther = static_cast<Other*>(_ptr);
272 return SharedPtr<Other, RC, RP>(_pCounter, pOther);
273 }
274
275 C* operator -> ()
276 {
277 return deref();
278 }
279
280 const C* operator -> () const
281 {
282 return deref();
283 }
284
285 C& operator * ()
286 {
287 return *deref();
288 }
289
290 const C& operator * () const
291 {
292 return *deref();
293 }
294
295 C* get()
296 {
297 return _ptr;
298 }
299
300 const C* get() const
301 {
302 return _ptr;
303 }
304
306 {
307 return _ptr;
308 }
309
310 operator const C* () const
311 {
312 return _ptr;
313 }
314
315 bool operator ! () const
316 {
317 return _ptr == nullptr;
318 }
319
320 bool isNull() const
321 {
322 return _ptr == nullptr;
323 }
324
325 bool operator == (const SharedPtr& ptr) const
326 {
327 return get() == ptr.get();
328 }
329
330 bool operator == (const C* ptr) const
331 {
332 return get() == ptr;
333 }
334
335 bool operator == (C* ptr) const
336 {
337 return get() == ptr;
338 }
339
340 bool operator == (std::nullptr_t ptr) const
341 {
342 return get() == ptr;
343 }
344
345 bool operator != (const SharedPtr& ptr) const
346 {
347 return get() != ptr.get();
348 }
349
350 bool operator != (const C* ptr) const
351 {
352 return get() != ptr;
353 }
354
355 bool operator != (C* ptr) const
356 {
357 return get() != ptr;
358 }
359
360 bool operator != (std::nullptr_t ptr) const
361 {
362 return get() != ptr;
363 }
364
365 bool operator < (const SharedPtr& ptr) const
366 {
367 return get() < ptr.get();
368 }
369
370 bool operator < (const C* ptr) const
371 {
372 return get() < ptr;
373 }
374
375 bool operator < (C* ptr) const
376 {
377 return get() < ptr;
378 }
379
380 bool operator <= (const SharedPtr& ptr) const
381 {
382 return get() <= ptr.get();
383 }
384
385 bool operator <= (const C* ptr) const
386 {
387 return get() <= ptr;
388 }
389
390 bool operator <= (C* ptr) const
391 {
392 return get() <= ptr;
393 }
394
395 bool operator > (const SharedPtr& ptr) const
396 {
397 return get() > ptr.get();
398 }
399
400 bool operator > (const C* ptr) const
401 {
402 return get() > ptr;
403 }
404
405 bool operator > (C* ptr) const
406 {
407 return get() > ptr;
408 }
409
410 bool operator >= (const SharedPtr& ptr) const
411 {
412 return get() >= ptr.get();
413 }
414
415 bool operator >= (const C* ptr) const
416 {
417 return get() >= ptr;
418 }
419
420 bool operator >= (C* ptr) const
421 {
422 return get() >= ptr;
423 }
424
425 int referenceCount() const
426 {
427 return _pCounter ? _pCounter->referenceCount() : 0;
428 }
429
430private:
431 C* deref() const
432 {
433 if (!_ptr)
434 throw NullPointerException();
435
436 return _ptr;
437 }
438
439 void release() noexcept
440 {
441 if (_pCounter && _pCounter->release() == 0)
442 {
443 RP::release(_ptr);
444 _ptr = nullptr;
445
446 delete _pCounter;
447 _pCounter = nullptr;
448 }
449 }
450
451 SharedPtr(RC* pCounter, C* ptr): _pCounter(pCounter), _ptr(ptr)
452 /// for cast operation
453 {
454 poco_assert_dbg (_pCounter);
456 }
457
458private:
461
462 template <class OtherC, class OtherRC, class OtherRP> friend class SharedPtr;
463};
464
465
466template <class C, class RC, class RP>
467inline void swap(SharedPtr<C, RC, RP>& p1, SharedPtr<C, RC, RP>& p2)
468{
469 p1.swap(p2);
470}
471
472
473template <typename T, typename... Args>
474SharedPtr<T> makeShared(Args&&... args)
475{
476 return SharedPtr<T>(new T(std::forward<Args>(args)...));
477}
478
479
480template <typename T>
482{
484}
485
486
487} // namespace Poco
488
489
490#endif // Foundation_SharedPtr_INCLUDED
#define ARK_API
Definition Base.h:9
#define poco_unexpected()
Definition Bugcheck.h:140
#define poco_assert_dbg(cond)
Definition Bugcheck.h:113
#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.
void swap(DateTime &dateTime)
bool operator<=(const DateTime &dateTime) const
Definition DateTime.h:410
short _millisecond
Definition DateTime.h:286
DateTime & operator-=(const Timespan &span)
int millisecond() const
Returns the second (0 to 59).
Definition DateTime.h:380
static bool isValid(int year, int month, int day, int hour=0, int minute=0, int second=0, int millisecond=0, int microsecond=0)
bool operator!=(const DateTime &dateTime) const
Definition DateTime.h:398
static bool isLeapYear(int year)
Converts a UTC time into a local time, by applying the given time zone differential.
Definition DateTime.h:428
void makeUTC(int tzd)
Converts DateTime to tm struct.
DateTime(double julianDay)
int microsecond() const
Returns the millisecond (0 to 999)
Definition DateTime.h:386
Timestamp::UtcTimeVal utcTime() const
Returns the date and time expressed as a Timestamp.
Definition DateTime.h:315
Months
Symbolic names for month numbers (1 to 12).
Definition DateTime.h:66
bool operator<(const DateTime &dateTime) const
Definition DateTime.h:404
void computeDaytime()
int hour() const
Definition DateTime.h:339
DateTime & operator=(double julianDay)
Assigns a Timestamp.
bool operator>(const DateTime &dateTime) const
Definition DateTime.h:416
bool operator>=(const DateTime &dateTime) const
Definition DateTime.h:422
bool isPM() const
Returns true if hour < 12;.
Definition DateTime.h:362
int day() const
Definition DateTime.h:333
short _microsecond
Definition DateTime.h:287
int dayOfYear() const
int hourAMPM() const
Returns the hour (0 to 23).
Definition DateTime.h:345
double julianDay() const
Returns the microsecond (0 to 999)
static double toJulianDay(int year, int month, int day, int hour=0, int minute=0, int second=0, int millisecond=0, int microsecond=0)
Computes the Julian day for an UTC time.
DaysOfWeek
Symbolic names for week day numbers (0 to 6).
Definition DateTime.h:83
DateTime & operator=(const DateTime &dateTime)
Destroys the DateTime.
void makeLocal(int tzd)
Converts a local time into UTC, by applying the given time zone differential.
DateTime(const Timestamp &timestamp)
Creates a DateTime from tm struct.
static double toJulianDay(Timestamp::UtcTimeVal utcTime)
Definition DateTime.h:296
Timespan operator-(const DateTime &dateTime) const
tm makeTM() const
DateTime operator-(const Timespan &span) const
DateTime & operator+=(const Timespan &span)
static Timestamp::UtcTimeVal toUtcTime(double julianDay)
Definition DateTime.h:303
Timestamp timestamp() const
Returns the julian day for the date and time.
Definition DateTime.h:309
int week(int firstDayOfWeek=MONDAY) const
Returns the month (1 to 12).
int second() const
Returns the minute (0 to 59).
Definition DateTime.h:374
~DateTime()
Copy constructor. Creates the DateTime from another one.
bool operator==(const DateTime &dateTime) const
Definition DateTime.h:392
int year() const
Swaps the DateTime with another one.
Definition DateTime.h:321
static int daysOfMonth(int year, int month)
void computeGregorian(double julianDay)
Computes the UTC time for a Julian day.
int dayOfWeek() const
Returns the day within the month (1 to 31).
DateTime & assign(int year, int month, int day, int hour=0, int minute=0, int second=0, int millisecond=0, int microseconds=0)
Assigns a Julian day.
void checkLimit(short &lower, short &higher, short limit)
Extracts the daytime (hours, minutes, seconds, etc.) from the stored utcTime.
DateTime(const DateTime &dateTime)
Timestamp::UtcTimeVal _utcTime
utility functions used to correct the overflow in computeGregorian
Definition DateTime.h:279
int month() const
Returns the year.
Definition DateTime.h:327
DateTime(int year, int month, int day, int hour=0, int minute=0, int second=0, int millisecond=0, int microsecond=0)
DateTime(const tm &tmStruct)
Creates a DateTime for the current date and time.
DateTime(Timestamp::UtcTimeVal utcTime, Timestamp::TimeDiff diff)
Creates a DateTime for the given Julian day.
DateTime & operator=(const Timestamp &timestamp)
Assigns another DateTime.
DateTime operator+(const Timespan &span) const
int minute() const
Returns true if hour >= 12.
Definition DateTime.h:368
bool isAM() const
Returns the hour (0 to 12).
Definition DateTime.h:356
virtual void updateImpl(const void *data, std::size_t length)=0
virtual const Digest & digest()=0
void update(char data)
DigestEngine & operator=(const DigestEngine &)
virtual std::size_t digestLength() const =0
Updates the digest with the given data.
DigestEngine(const DigestEngine &)
void update(const void *data, std::size_t length)
virtual void reset()=0
Returns the length of the digest in bytes.
virtual ~DigestEngine()
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
Simple ReferenceCounter object, does not delete itself when count reaches 0.
Definition SharedPtr.h:33
AtomicCounter _cnt
Definition SharedPtr.h:55
int referenceCount() const
Definition SharedPtr.h:49
The release policy for SharedPtr holding arrays.
Definition SharedPtr.h:77
static void release(C *pObj) noexcept
Definition SharedPtr.h:79
static void release(C *pObj) noexcept
Definition SharedPtr.h:65
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
C * deref() const
Definition SharedPtr.h:431
bool operator!=(const SharedPtr &ptr) const
Definition SharedPtr.h:345
SharedPtr(SharedPtr &&ptr) noexcept
Definition SharedPtr.h:151
SharedPtr & operator=(SharedPtr &&ptr) noexcept
Definition SharedPtr.h:226
const C * get() const
Definition SharedPtr.h:300
SharedPtr< Other, RC, RP > cast() const
Definition SharedPtr.h:249
void release() noexcept
Definition SharedPtr.h:439
SharedPtr(C *ptr)
Definition SharedPtr.h:125
bool operator<=(C *ptr) const
Definition SharedPtr.h:390
bool operator<(const C *ptr) const
Definition SharedPtr.h:370
bool operator<=(const C *ptr) const
Definition SharedPtr.h:385
bool operator>=(C *ptr) const
Definition SharedPtr.h:420
void swap(SharedPtr &ptr)
Definition SharedPtr.h:242
SharedPtr(const SharedPtr< Other, RC, OtherRP > &ptr)
Definition SharedPtr.h:137
void reset(const SharedPtr< Other, RC, OtherRP > &ptr)
Definition SharedPtr.h:211
bool operator==(const SharedPtr &ptr) const
Definition SharedPtr.h:325
bool operator>=(const C *ptr) const
Definition SharedPtr.h:415
bool operator!=(const C *ptr) const
Definition SharedPtr.h:350
bool operator>(C *ptr) const
Definition SharedPtr.h:405
bool operator>(const C *ptr) const
Definition SharedPtr.h:400
void reset(const SharedPtr &ptr)
Definition SharedPtr.h:205
bool operator==(C *ptr) const
Definition SharedPtr.h:335
bool operator<=(const SharedPtr &ptr) const
Definition SharedPtr.h:380
bool operator!=(C *ptr) const
Definition SharedPtr.h:355
bool operator>=(const SharedPtr &ptr) const
Definition SharedPtr.h:410
bool operator==(std::nullptr_t ptr) const
Definition SharedPtr.h:340
SharedPtr(const SharedPtr &ptr)
Definition SharedPtr.h:144
SharedPtr(RC *pCounter, C *ptr)
Definition SharedPtr.h:451
SharedPtr< Other, RC, RP > unsafeCast() const
Definition SharedPtr.h:264
SharedPtr & assign(const SharedPtr &ptr)
Definition SharedPtr.h:174
SharedPtr & operator=(const SharedPtr &ptr)
Definition SharedPtr.h:221
operator const C *() const
Definition SharedPtr.h:310
SharedPtr & assign(C *ptr)
Definition SharedPtr.h:164
const C & operator*() const
Definition SharedPtr.h:290
const C * operator->() const
Definition SharedPtr.h:280
int referenceCount() const
Definition SharedPtr.h:425
SharedPtr & assign(const SharedPtr< Other, RC, OtherRP > &ptr)
Definition SharedPtr.h:185
void reset(C *ptr)
Definition SharedPtr.h:200
bool operator==(const C *ptr) const
Definition SharedPtr.h:330
bool operator>(const SharedPtr &ptr) const
Definition SharedPtr.h:395
bool operator!() const
Definition SharedPtr.h:315
SharedPtr & operator=(const SharedPtr< Other, RC, OtherRP > &ptr)
Definition SharedPtr.h:237
bool isNull() const
Definition SharedPtr.h:320
bool operator<(const SharedPtr &ptr) const
Definition SharedPtr.h:365
SharedPtr & operator=(C *ptr)
Definition SharedPtr.h:216
bool operator<(C *ptr) const
Definition SharedPtr.h:375
bool operator!=(std::nullptr_t ptr) const
Definition SharedPtr.h:360
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
int useconds() const
Definition Timespan.h:205
Timespan(const Timespan &timespan)
Creates a Timespan.
int totalMinutes() const
Returns the number of minutes (0 to 59).
Definition Timespan.h:169
static const TimeDiff SECONDS
The number of microseconds in a millisecond.
Definition Timespan.h:132
bool operator>=(TimeDiff microSeconds) const
Definition Timespan.h:271
bool operator>(TimeDiff microSeconds) const
Definition Timespan.h:265
int seconds() const
Returns the total number of minutes.
Definition Timespan.h:175
Timespan(int days, int hours, int minutes, int seconds, int microSeconds)
Timespan & operator=(TimeDiff microseconds)
Assignment operator.
Timespan operator-(TimeDiff microSeconds) const
bool operator<=(const Timespan &ts) const
Definition Timespan.h:247
static const TimeDiff HOURS
The number of microseconds in a minute.
Definition Timespan.h:134
Timespan & assign(long seconds, long microseconds)
Assigns a new span.
bool operator==(const Timespan &ts) const
Swaps the Timespan with another one.
Definition Timespan.h:217
void swap(Timespan &timespan)
bool operator==(TimeDiff microSeconds) const
Definition Timespan.h:253
TimeDiff _span
The number of microseconds in a day.
Definition Timespan.h:138
Timespan & operator-=(TimeDiff microSeconds)
Timespan(long seconds, long microseconds)
Creates a Timespan.
TimeDiff totalMicroseconds() const
Definition Timespan.h:211
int totalHours() const
Returns the number of hours (0 to 23).
Definition Timespan.h:157
Timespan & operator=(const Timespan &timespan)
Destroys the Timespan.
int totalSeconds() const
Returns the number of seconds (0 to 59).
Definition Timespan.h:181
TimeDiff totalMilliseconds() const
Returns the number of milliseconds (0 to 999).
Definition Timespan.h:193
Timespan & operator-=(const Timespan &d)
bool operator>=(const Timespan &ts) const
Definition Timespan.h:235
int hours() const
Returns the number of days.
Definition Timespan.h:151
Timespan(TimeDiff microseconds)
Creates a zero Timespan.
int minutes() const
Returns the total number of hours.
Definition Timespan.h:163
bool operator!=(const Timespan &ts) const
Definition Timespan.h:223
Timespan operator+(TimeDiff microSeconds) const
bool operator>(const Timespan &ts) const
Definition Timespan.h:229
bool operator<(TimeDiff microSeconds) const
Definition Timespan.h:277
int days() const
Definition Timespan.h:145
static const TimeDiff DAYS
The number of microseconds in a hour.
Definition Timespan.h:135
int microseconds() const
Returns the total number of milliseconds.
Definition Timespan.h:199
int milliseconds() const
Returns the total number of seconds.
Definition Timespan.h:187
Timespan & operator+=(TimeDiff microSeconds)
static const TimeDiff MINUTES
The number of microseconds in a second.
Definition Timespan.h:133
~Timespan()
Creates a Timespan from another one.
Definition Timespan.h:295
Timespan & operator+=(const Timespan &d)
static const TimeDiff MILLISECONDS
Returns the total number of microseconds.
Definition Timespan.h:131
bool operator<(const Timespan &ts) const
Definition Timespan.h:241
Timespan operator-(const Timespan &d) const
Timespan & assign(int days, int hours, int minutes, int seconds, int microSeconds)
Assignment operator.
Timespan operator+(const Timespan &d) const
bool operator<=(TimeDiff microSeconds) const
Definition Timespan.h:283
bool operator!=(TimeDiff microSeconds) const
Definition Timespan.h:259
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 &)
int ERR_load_CRYPTO_strings(void)
#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
void swap(SharedPtr< C, RC, RP > &p1, SharedPtr< C, RC, RP > &p2)
Definition SharedPtr.h:467
void swap(DateTime &d1, DateTime &d2)
Definition DateTime.h:434
void swap(Timespan &s1, Timespan &s2)
Definition Timespan.h:289
SharedPtr< T, ReferenceCounter, ReleaseArrayPolicy< T > > makeSharedArray(std::size_t size)
Definition SharedPtr.h:481
MutexImpl FastMutexImpl
Definition Mutex_WIN32.h:44
SharedPtr< T > makeShared(Args &&... args)
Definition SharedPtr.h:474
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 bignum_ctx BN_CTX
Definition ossl_typ.h:81
struct x509_lookup_method_st X509_LOOKUP_METHOD
Definition ossl_typ.h:133
struct asn1_string_st ASN1_PRINTABLESTRING
Definition ossl_typ.h:44
struct asn1_string_st ASN1_IA5STRING
Definition ossl_typ.h:46
long ossl_intmax_t
Definition ossl_typ.h:190
struct evp_md_ctx_st EVP_MD_CTX
Definition ossl_typ.h:92
struct ocsp_response_st OCSP_RESPONSE
Definition ossl_typ.h:167
struct asn1_string_st ASN1_UNIVERSALSTRING
Definition ossl_typ.h:48
struct ssl_ctx_st SSL_CTX
Definition ossl_typ.h:149
struct asn1_string_st ASN1_T61STRING
Definition ossl_typ.h:45
struct conf_st CONF
Definition ossl_typ.h:141
struct sct_st SCT
Definition ossl_typ.h:170
struct AUTHORITY_KEYID_st AUTHORITY_KEYID
Definition ossl_typ.h:159
struct ctlog_store_st CTLOG_STORE
Definition ossl_typ.h:173
struct evp_pkey_st EVP_PKEY
Definition ossl_typ.h:93
struct bn_blinding_st BN_BLINDING
Definition ossl_typ.h:82
struct v3_ext_ctx X509V3_CTX
Definition ossl_typ.h:140
struct x509_store_st X509_STORE
Definition ossl_typ.h:128
struct X509_POLICY_TREE_st X509_POLICY_TREE
Definition ossl_typ.h:156
struct DIST_POINT_st DIST_POINT
Definition ossl_typ.h:160
struct asn1_string_st ASN1_ENUMERATED
Definition ossl_typ.h:41
struct x509_st X509
Definition ossl_typ.h:121
struct X509_POLICY_NODE_st X509_POLICY_NODE
Definition ossl_typ.h:154
struct evp_cipher_st EVP_CIPHER
Definition ossl_typ.h:89
struct rsa_meth_st RSA_METHOD
Definition ossl_typ.h:111
struct dh_st DH
Definition ossl_typ.h:104
struct X509_name_st X509_NAME
Definition ossl_typ.h:126
struct dh_method DH_METHOD
Definition ossl_typ.h:105
struct sct_ctx_st SCT_CTX
Definition ossl_typ.h:171
struct bn_recp_ctx_st BN_RECP_CTX
Definition ossl_typ.h:84
struct dsa_method DSA_METHOD
Definition ossl_typ.h:108
struct asn1_sctx_st ASN1_SCTX
Definition ossl_typ.h:64
struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS
Definition ossl_typ.h:162
struct ui_st UI
Definition ossl_typ.h:144
struct bignum_st BIGNUM
Definition ossl_typ.h:80
struct ssl_st SSL
Definition ossl_typ.h:148
struct evp_Encode_Ctx_st EVP_ENCODE_CTX
Definition ossl_typ.h:100
struct asn1_string_st ASN1_GENERALSTRING
Definition ossl_typ.h:47
struct ec_key_st EC_KEY
Definition ossl_typ.h:114
struct ossl_store_info_st OSSL_STORE_INFO
Definition ossl_typ.h:176
struct rsa_pss_params_st RSA_PSS_PARAMS
Definition ossl_typ.h:112
struct evp_pkey_method_st EVP_PKEY_METHOD
Definition ossl_typ.h:97
struct x509_revoked_st X509_REVOKED
Definition ossl_typ.h:125
struct crypto_ex_data_st CRYPTO_EX_DATA
Definition ossl_typ.h:164
struct asn1_pctx_st ASN1_PCTX
Definition ossl_typ.h:63
struct ocsp_responder_id_st OCSP_RESPID
Definition ossl_typ.h:168
struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX
Definition ossl_typ.h:174
struct ctlog_st CTLOG
Definition ossl_typ.h:172
struct X509_pubkey_st X509_PUBKEY
Definition ossl_typ.h:127
struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL
Definition ossl_typ.h:155
struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT
Definition ossl_typ.h:161
struct comp_ctx_st COMP_CTX
Definition ossl_typ.h:151
struct rsa_st RSA
Definition ossl_typ.h:110
struct ossl_init_settings_st OPENSSL_INIT_SETTINGS
Definition ossl_typ.h:142
struct comp_method_st COMP_METHOD
Definition ossl_typ.h:152
struct hmac_ctx_st HMAC_CTX
Definition ossl_typ.h:102
struct dsa_st DSA
Definition ossl_typ.h:107
struct X509_algor_st X509_ALGOR
Definition ossl_typ.h:122
struct evp_pkey_ctx_st EVP_PKEY_CTX
Definition ossl_typ.h:98
struct evp_cipher_ctx_st EVP_CIPHER_CTX
Definition ossl_typ.h:90
struct buf_mem_st BUF_MEM
Definition ossl_typ.h:87
struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO
Definition ossl_typ.h:138
int ASN1_BOOLEAN
Definition ossl_typ.h:56
struct engine_st ENGINE
Definition ossl_typ.h:147
struct x509_crl_method_st X509_CRL_METHOD
Definition ossl_typ.h:124
struct asn1_string_st ASN1_BMPSTRING
Definition ossl_typ.h:49
struct asn1_string_st ASN1_GENERALIZEDTIME
Definition ossl_typ.h:52
struct ossl_store_search_st OSSL_STORE_SEARCH
Definition ossl_typ.h:177
struct X509_crl_st X509_CRL
Definition ossl_typ.h:123
struct X509_POLICY_CACHE_st X509_POLICY_CACHE
Definition ossl_typ.h:157
struct ssl_dane_st SSL_DANE
Definition ossl_typ.h:120
struct asn1_string_st ASN1_STRING
Definition ossl_typ.h:55
struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD
Definition ossl_typ.h:95
struct asn1_string_st ASN1_UTF8STRING
Definition ossl_typ.h:54
struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM
Definition ossl_typ.h:134
struct x509_object_st X509_OBJECT
Definition ossl_typ.h:131
struct asn1_string_st ASN1_TIME
Definition ossl_typ.h:51
struct rand_drbg_st RAND_DRBG
Definition ossl_typ.h:118
struct evp_md_st EVP_MD
Definition ossl_typ.h:91
struct bn_gencb_st BN_GENCB
Definition ossl_typ.h:85
struct ui_method_st UI_METHOD
Definition ossl_typ.h:145
struct asn1_object_st ASN1_OBJECT
Definition ossl_typ.h:60
struct x509_store_ctx_st X509_STORE_CTX
Definition ossl_typ.h:129
unsigned long ossl_uintmax_t
Definition ossl_typ.h:191
struct ASN1_ITEM_st ASN1_ITEM
Definition ossl_typ.h:62
struct rand_meth_st RAND_METHOD
Definition ossl_typ.h:117
struct bn_mont_ctx_st BN_MONT_CTX
Definition ossl_typ.h:83
struct x509_sig_info_st X509_SIG_INFO
Definition ossl_typ.h:136
int ASN1_NULL
Definition ossl_typ.h:57
struct bio_st BIO
Definition ossl_typ.h:79
struct asn1_string_st ASN1_INTEGER
Definition ossl_typ.h:40
struct asn1_string_st ASN1_BIT_STRING
Definition ossl_typ.h:42
struct ocsp_req_ctx_st OCSP_REQ_CTX
Definition ossl_typ.h:166
struct asn1_string_st ASN1_UTCTIME
Definition ossl_typ.h:50
struct asn1_string_st ASN1_OCTET_STRING
Definition ossl_typ.h:43
struct ec_key_method_st EC_KEY_METHOD
Definition ossl_typ.h:115
struct asn1_string_st ASN1_VISIBLESTRING
Definition ossl_typ.h:53
struct x509_lookup_st X509_LOOKUP
Definition ossl_typ.h:132
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
void(* OPENSSL_sk_freefunc)(void *)
Definition stack.h:20
void * OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p)
void * OPENSSL_sk_delete(OPENSSL_STACK *st, int loc)
int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n)
void OPENSSL_sk_zero(OPENSSL_STACK *st)
OPENSSL_STACK * OPENSSL_sk_deep_copy(const OPENSSL_STACK *, OPENSSL_sk_copyfunc c, OPENSSL_sk_freefunc f)
int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st)
OPENSSL_STACK * OPENSSL_sk_new(OPENSSL_sk_compfunc cmp)
OPENSSL_STACK * OPENSSL_sk_new_null(void)
struct stack_st OPENSSL_STACK
Definition stack.h:17
int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
int(* OPENSSL_sk_compfunc)(const void *, const void *)
Definition stack.h:19
OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, OPENSSL_sk_compfunc cmp)
OPENSSL_STACK * OPENSSL_sk_dup(const OPENSSL_STACK *st)
int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where)
void * OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data)
int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data)
void * OPENSSL_sk_pop(OPENSSL_STACK *st)
int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data)
int OPENSSL_sk_num(const OPENSSL_STACK *)
void *(* OPENSSL_sk_copyfunc)(const void *)
Definition stack.h:21
void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void(*func)(void *))
void * OPENSSL_sk_shift(OPENSSL_STACK *st)
void OPENSSL_sk_sort(OPENSSL_STACK *st)
OPENSSL_STACK * OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n)
void * OPENSSL_sk_value(const OPENSSL_STACK *, int)
void OPENSSL_sk_free(OPENSSL_STACK *)
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