Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Timestamp.h
Go to the documentation of this file.
1//
2// Timestamp.h
3//
4// Library: Foundation
5// Package: DateTime
6// Module: Timestamp
7//
8// Definition of the Timestamp class.
9//
10// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
11// and Contributors.
12//
13// SPDX-License-Identifier: BSL-1.0
14//
15
16
17#ifndef Foundation_Timestamp_INCLUDED
18#define Foundation_Timestamp_INCLUDED
19
20
21#include "Poco/Foundation.h"
22#include <ctime>
23
24
25namespace Poco {
26
27
28class Timespan;
29
30
32 /// A Timestamp stores a monotonic* time value
33 /// with (theoretical) microseconds resolution.
34 /// Timestamps can be compared with each other
35 /// and simple arithmetic is supported.
36 ///
37 /// [*] Note that Timestamp values are only monotonic as
38 /// long as the systems's clock is monotonic as well
39 /// (and not, e.g. set back due to time synchronization
40 /// or other reasons).
41 ///
42 /// Timestamps are UTC (Coordinated Universal Time)
43 /// based and thus independent of the timezone
44 /// in effect on the system.
45 ///
46 /// The internal reference time is the Unix epoch,
47 /// midnight, January 1, 1970.
48{
49public:
50 using TimeVal = Int64;
51 /// Monotonic UTC time value in microsecond resolution,
52 /// with base time midnight, January 1, 1970.
53
54 using UtcTimeVal = Int64;
55 /// Monotonic UTC time value in 100 nanosecond resolution,
56 /// with base time midnight, October 15, 1582.
57
58 using TimeDiff = Int64;
59 /// Difference between two TimeVal values in microseconds.
60
61 static const TimeVal TIMEVAL_MIN; /// Minimum timestamp value.
62 static const TimeVal TIMEVAL_MAX; /// Maximum timestamp value.
63
65 /// Creates a timestamp with the current time.
66
67 Timestamp(TimeVal tv);
68 /// Creates a timestamp from the given time value
69 /// (microseconds since midnight, January 1, 1970).
70
71 Timestamp(const Timestamp& other);
72 /// Copy constructor.
73
75 /// Destroys the timestamp
76
77 Timestamp& operator = (const Timestamp& other);
78 Timestamp& operator = (TimeVal tv);
79
80 void swap(Timestamp& timestamp);
81 /// Swaps the Timestamp with another one.
82
83 void update();
84 /// Updates the Timestamp with the current time.
85
86 bool operator == (const Timestamp& ts) const;
87 bool operator != (const Timestamp& ts) const;
88 bool operator > (const Timestamp& ts) const;
89 bool operator >= (const Timestamp& ts) const;
90 bool operator < (const Timestamp& ts) const;
91 bool operator <= (const Timestamp& ts) const;
92
93 Timestamp operator + (TimeDiff d) const;
94 Timestamp operator + (const Timespan& span) const;
95 Timestamp operator - (TimeDiff d) const;
96 Timestamp operator - (const Timespan& span) const;
97 TimeDiff operator - (const Timestamp& ts) const;
98 Timestamp& operator += (TimeDiff d);
99 Timestamp& operator += (const Timespan& span);
100 Timestamp& operator -= (TimeDiff d);
101 Timestamp& operator -= (const Timespan& span);
102
103 std::time_t epochTime() const;
104 /// Returns the timestamp expressed in time_t.
105 /// time_t base time is midnight, January 1, 1970.
106 /// Resolution is one second.
107
108 UtcTimeVal utcTime() const;
109 /// Returns the timestamp expressed in UTC-based
110 /// time. UTC base time is midnight, October 15, 1582.
111 /// Resolution is 100 nanoseconds.
112
113 TimeVal epochMicroseconds() const;
114 /// Returns the timestamp expressed in microseconds
115 /// since the Unix epoch, midnight, January 1, 1970.
116
117 TimeDiff elapsed() const;
118 /// Returns the time elapsed since the time denoted by
119 /// the timestamp. Equivalent to Timestamp() - *this.
120
121 bool isElapsed(TimeDiff interval) const;
122 /// Returns true iff the given interval has passed
123 /// since the time denoted by the timestamp.
124
125 TimeVal raw() const;
126 /// Returns the raw time value.
127 ///
128 /// Same as epochMicroseconds().
129
130 static Timestamp fromEpochTime(std::time_t t);
131 /// Creates a timestamp from a std::time_t.
132
133 static Timestamp fromUtcTime(UtcTimeVal val);
134 /// Creates a timestamp from a UTC time value
135 /// (100 nanosecond intervals since midnight,
136 /// October 15, 1582).
137
138 static TimeDiff resolution();
139 /// Returns the resolution in units per second.
140 /// Since the timestamp has microsecond resolution,
141 /// the returned value is always 1000000.
142
143#if defined(_WIN32)
144 static Timestamp fromFileTimeNP(UInt32 fileTimeLow, UInt32 fileTimeHigh);
145 void toFileTimeNP(UInt32& fileTimeLow, UInt32& fileTimeHigh) const;
146#endif
147
148private:
149 TimeVal _ts;
150};
151
152
153//
154// inlines
155//
156inline bool Timestamp::operator == (const Timestamp& ts) const
157{
158 return _ts == ts._ts;
159}
160
161
162inline bool Timestamp::operator != (const Timestamp& ts) const
163{
164 return _ts != ts._ts;
165}
166
167
168inline bool Timestamp::operator > (const Timestamp& ts) const
169{
170 return _ts > ts._ts;
171}
172
173
174inline bool Timestamp::operator >= (const Timestamp& ts) const
175{
176 return _ts >= ts._ts;
177}
178
179
180inline bool Timestamp::operator < (const Timestamp& ts) const
181{
182 return _ts < ts._ts;
183}
184
185
186inline bool Timestamp::operator <= (const Timestamp& ts) const
187{
188 return _ts <= ts._ts;
189}
190
191
192inline Timestamp Timestamp::operator + (Timestamp::TimeDiff d) const
193{
194 return Timestamp(_ts + d);
195}
196
197
198inline Timestamp Timestamp::operator - (Timestamp::TimeDiff d) const
199{
200 return Timestamp(_ts - d);
201}
202
203
204inline Timestamp::TimeDiff Timestamp::operator - (const Timestamp& ts) const
205{
206 return _ts - ts._ts;
207}
208
209
210inline Timestamp& Timestamp::operator += (Timestamp::TimeDiff d)
211{
212 _ts += d;
213 return *this;
214}
215
216
217inline Timestamp& Timestamp::operator -= (Timestamp::TimeDiff d)
218{
219 _ts -= d;
220 return *this;
221}
222
223
224inline std::time_t Timestamp::epochTime() const
225{
226 return std::time_t(_ts/resolution());
227}
228
229
230inline Timestamp::UtcTimeVal Timestamp::utcTime() const
231{
232 return _ts*10 + (TimeDiff(0x01b21dd2) << 32) + 0x13814000;
233}
234
235
236inline Timestamp::TimeVal Timestamp::epochMicroseconds() const
237{
238 return _ts;
239}
240
241
242inline Timestamp::TimeDiff Timestamp::elapsed() const
243{
244 Timestamp now;
245 return now - *this;
246}
247
248
249inline bool Timestamp::isElapsed(Timestamp::TimeDiff interval) const
250{
251 Timestamp now;
252 Timestamp::TimeDiff diff = now - *this;
253 return diff >= interval;
254}
255
256
257inline Timestamp::TimeDiff Timestamp::resolution()
258{
259 return 1000000;
260}
261
262
263inline void swap(Timestamp& s1, Timestamp& s2)
264{
265 s1.swap(s2);
266}
267
268
269inline Timestamp::TimeVal Timestamp::raw() const
270{
271 return _ts;
272}
273
274
275} // namespace Poco
276
277
278#endif // Foundation_Timestamp_INCLUDED
#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
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.
void error(const T &)
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
Definition format.h:408
Definition json.hpp:4518
#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
#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)