Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Platform.h
Go to the documentation of this file.
1//
2// Platform.h
3//
4// Library: Foundation
5// Package: Core
6// Module: Platform
7//
8// Platform and architecture identification macros.
9//
10// NOTE: This file may be included from both C++ and C code, so it
11// must not contain any C++ specific things.
12//
13// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
14// and Contributors.
15//
16// SPDX-License-Identifier: BSL-1.0
17//
18
19
20#ifndef Foundation_Platform_INCLUDED
21#define Foundation_Platform_INCLUDED
22
23
24//
25// Platform Identification
26//
27#define POCO_OS_FREE_BSD 0x0001
28#define POCO_OS_AIX 0x0002
29#define POCO_OS_HPUX 0x0003
30#define POCO_OS_TRU64 0x0004
31#define POCO_OS_LINUX 0x0005
32#define POCO_OS_MAC_OS_X 0x0006
33#define POCO_OS_NET_BSD 0x0007
34#define POCO_OS_OPEN_BSD 0x0008
35#define POCO_OS_IRIX 0x0009
36#define POCO_OS_SOLARIS 0x000a
37#define POCO_OS_QNX 0x000b
38#define POCO_OS_VXWORKS 0x000c
39#define POCO_OS_CYGWIN 0x000d
40#define POCO_OS_NACL 0x000e
41#define POCO_OS_ANDROID 0x000f
42#define POCO_OS_UNKNOWN_UNIX 0x00ff
43#define POCO_OS_WINDOWS_NT 0x1001
44#define POCO_OS_WINDOWS_CE 0x1011
45#define POCO_OS_VMS 0x2001
46
47
48#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
49 #define POCO_OS_FAMILY_UNIX 1
50 #define POCO_OS_FAMILY_BSD 1
51 #define POCO_OS POCO_OS_FREE_BSD
52#elif defined(_AIX) || defined(__TOS_AIX__)
53 #define POCO_OS_FAMILY_UNIX 1
54 #define POCO_OS POCO_OS_AIX
55#elif defined(hpux) || defined(_hpux) || defined(__hpux)
56 #define POCO_OS_FAMILY_UNIX 1
57 #define POCO_OS POCO_OS_HPUX
58#elif defined(__digital__) || defined(__osf__)
59 #define POCO_OS_FAMILY_UNIX 1
60 #define POCO_OS POCO_OS_TRU64
61#elif defined(__NACL__)
62 #define POCO_OS_FAMILY_UNIX 1
63 #define POCO_OS POCO_OS_NACL
64#elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__TOS_LINUX__) || defined(EMSCRIPTEN)
65 #define POCO_OS_FAMILY_UNIX 1
66 #if defined(__ANDROID__)
67 #define POCO_OS POCO_OS_ANDROID
68 #else
69 #define POCO_OS POCO_OS_LINUX
70 #endif
71#elif defined(__APPLE__) || defined(__TOS_MACOS__)
72 #define POCO_OS_FAMILY_UNIX 1
73 #define POCO_OS_FAMILY_BSD 1
74 #define POCO_OS POCO_OS_MAC_OS_X
75#elif defined(__NetBSD__)
76 #define POCO_OS_FAMILY_UNIX 1
77 #define POCO_OS_FAMILY_BSD 1
78 #define POCO_OS POCO_OS_NET_BSD
79#elif defined(__OpenBSD__)
80 #define POCO_OS_FAMILY_UNIX 1
81 #define POCO_OS_FAMILY_BSD 1
82 #define POCO_OS POCO_OS_OPEN_BSD
83#elif defined(sgi) || defined(__sgi)
84 #define POCO_OS_FAMILY_UNIX 1
85 #define POCO_OS POCO_OS_IRIX
86#elif defined(sun) || defined(__sun)
87 #define POCO_OS_FAMILY_UNIX 1
88 #define POCO_OS POCO_OS_SOLARIS
89#elif defined(__QNX__)
90 #define POCO_OS_FAMILY_UNIX 1
91 #define POCO_OS POCO_OS_QNX
92#elif defined(__CYGWIN__)
93 #define POCO_OS_FAMILY_UNIX 1
94 #define POCO_OS POCO_OS_CYGWIN
95#elif defined(POCO_VXWORKS)
96 #define POCO_OS_FAMILY_UNIX 1
97 #define POCO_OS POCO_OS_VXWORKS
98#elif defined(unix) || defined(__unix) || defined(__unix__)
99 #define POCO_OS_FAMILY_UNIX 1
100 #define POCO_OS POCO_OS_UNKNOWN_UNIX
101#elif defined(_WIN32_WCE)
102 #define POCO_OS_FAMILY_WINDOWS 1
103 #define POCO_OS POCO_OS_WINDOWS_CE
104#elif defined(_WIN32) || defined(_WIN64)
105 #define POCO_OS_FAMILY_WINDOWS 1
106 #define POCO_OS POCO_OS_WINDOWS_NT
107#elif defined(__VMS)
108 #define POCO_OS_FAMILY_VMS 1
109 #define POCO_OS POCO_OS_VMS
110#endif
111
112
113#if !defined(POCO_OS)
114 #error "Unknown Platform."
115#endif
116
117
118//
119// Hardware Architecture and Byte Order
120//
121#define POCO_ARCH_ALPHA 0x01
122#define POCO_ARCH_IA32 0x02
123#define POCO_ARCH_IA64 0x03
124#define POCO_ARCH_MIPS 0x04
125#define POCO_ARCH_HPPA 0x05
126#define POCO_ARCH_PPC 0x06
127#define POCO_ARCH_POWER 0x07
128#define POCO_ARCH_SPARC 0x08
129#define POCO_ARCH_AMD64 0x09
130#define POCO_ARCH_ARM 0x0a
131#define POCO_ARCH_M68K 0x0b
132#define POCO_ARCH_S390 0x0c
133#define POCO_ARCH_SH 0x0d
134#define POCO_ARCH_NIOS2 0x0e
135#define POCO_ARCH_AARCH64 0x0f
136#define POCO_ARCH_ARM64 0x0f // same as POCO_ARCH_AARCH64
137#define POCO_ARCH_RISCV64 0x10
138#define POCO_ARCH_RISCV32 0x11
139
140
141#if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)
142 #define POCO_ARCH POCO_ARCH_ALPHA
143 #define POCO_ARCH_LITTLE_ENDIAN 1
144#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(EMSCRIPTEN)
145 #define POCO_ARCH POCO_ARCH_IA32
146 #define POCO_ARCH_LITTLE_ENDIAN 1
147#elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
148 #define POCO_ARCH POCO_ARCH_IA64
149 #if defined(hpux) || defined(_hpux)
150 #define POCO_ARCH_BIG_ENDIAN 1
151 #else
152 #define POCO_ARCH_LITTLE_ENDIAN 1
153 #endif
154#elif defined(__x86_64__) || defined(_M_X64)
155 #define POCO_ARCH POCO_ARCH_AMD64
156 #define POCO_ARCH_LITTLE_ENDIAN 1
157#elif defined(__mips__) || defined(__mips) || defined(__MIPS__) || defined(_M_MRX000)
158 #define POCO_ARCH POCO_ARCH_MIPS
159 #if defined(POCO_OS_FAMILY_WINDOWS)
160 // Is this OK? Supports windows only little endian??
161 #define POCO_ARCH_LITTLE_ENDIAN 1
162 #elif defined(__MIPSEB__) || defined(_MIPSEB) || defined(__MIPSEB)
163 #define POCO_ARCH_BIG_ENDIAN 1
164 #elif defined(__MIPSEL__) || defined(_MIPSEL) || defined(__MIPSEL)
165 #define POCO_ARCH_LITTLE_ENDIAN 1
166 #else
167 #error "MIPS but neither MIPSEL nor MIPSEB?"
168 #endif
169#elif defined(__hppa) || defined(__hppa__)
170 #define POCO_ARCH POCO_ARCH_HPPA
171 #define POCO_ARCH_BIG_ENDIAN 1
172#elif defined(__PPC) || defined(__POWERPC__) || defined(__powerpc) || defined(__PPC__) ||
173 defined(__powerpc__) || defined(__ppc__) || defined(__ppc) || defined(_ARCH_PPC) || defined(_M_PPC)
174 #define POCO_ARCH POCO_ARCH_PPC
175 #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
176 #define POCO_ARCH_LITTLE_ENDIAN 1
177 #else
178 #define POCO_ARCH_BIG_ENDIAN 1
179 #endif
180#elif defined(_POWER) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_ARCH_PWR3) ||
181 defined(_ARCH_PWR4) || defined(__THW_RS6000)
182 #define POCO_ARCH POCO_ARCH_POWER
183 #define POCO_ARCH_BIG_ENDIAN 1
184#elif defined(__sparc__) || defined(__sparc) || defined(sparc)
185 #define POCO_ARCH POCO_ARCH_SPARC
186 #define POCO_ARCH_BIG_ENDIAN 1
187#elif defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM)
188 #define POCO_ARCH POCO_ARCH_ARM
189 #if defined(__ARMEB__)
190 #define POCO_ARCH_BIG_ENDIAN 1
191 #else
192 #define POCO_ARCH_LITTLE_ENDIAN 1
193 #endif
194#elif defined(__arm64__) || defined(__arm64)
195 #define POCO_ARCH POCO_ARCH_ARM64
196 #if defined(__ARMEB__)
197 #define POCO_ARCH_BIG_ENDIAN 1
198 #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
199 #define POCO_ARCH_BIG_ENDIAN 1
200 #else
201 #define POCO_ARCH_LITTLE_ENDIAN 1
202 #endif
203#elif defined(__m68k__)
204 #define POCO_ARCH POCO_ARCH_M68K
205 #define POCO_ARCH_BIG_ENDIAN 1
206#elif defined(__s390__)
207 #define POCO_ARCH POCO_ARCH_S390
208 #define POCO_ARCH_BIG_ENDIAN 1
209#elif defined(__sh__) || defined(__sh) || defined(SHx) || defined(_SHX_)
210 #define POCO_ARCH POCO_ARCH_SH
211 #if defined(__LITTLE_ENDIAN__) || (POCO_OS == POCO_OS_WINDOWS_CE)
212 #define POCO_ARCH_LITTLE_ENDIAN 1
213 #else
214 #define POCO_ARCH_BIG_ENDIAN 1
215 #endif
216#elif defined (nios2) || defined(__nios2) || defined(__nios2__)
217 #define POCO_ARCH POCO_ARCH_NIOS2
218 #if defined(__nios2_little_endian) || defined(nios2_little_endian) || defined(__nios2_little_endian__)
219 #define POCO_ARCH_LITTLE_ENDIAN 1
220 #else
221 #define POCO_ARCH_BIG_ENDIAN 1
222 #endif
223#elif defined(__AARCH64EL__)
224 #define POCO_ARCH POCO_ARCH_AARCH64
225 #define POCO_ARCH_LITTLE_ENDIAN 1
226#elif defined(__AARCH64EB__)
227 #define POCO_ARCH POCO_ARCH_AARCH64
228 #define POCO_ARCH_BIG_ENDIAN 1
229#elif defined(__riscv)
230 #if (__riscv_xlen == 64)
231 #define POCO_ARCH POCO_ARCH_RISCV64
232 #define POCO_ARCH_LITTLE_ENDIAN 1
233 #elif(__riscv_xlen == 32)
234 #define POCO_ARCH POCO_ARCH_RISCV32
235 #define POCO_ARCH_LITTLE_ENDIAN 1
236 #endif
237#endif
238
239
240#if defined(__clang__)
241 #define POCO_COMPILER_CLANG
242#elif defined(_MSC_VER)
243 #define POCO_COMPILER_MSVC
244#elif defined (__GNUC__)
245 #define POCO_COMPILER_GCC
246#elif defined (__MINGW32__) || defined (__MINGW64__)
247 #define POCO_COMPILER_MINGW
248#elif defined (__INTEL_COMPILER) || defined(__ICC) || defined(__ECC) || defined(__ICL)
249 #define POCO_COMPILER_INTEL
250#elif defined (__SUNPRO_CC)
251 #define POCO_COMPILER_SUN
252#elif defined (__MWERKS__) || defined(__CWCC__)
253 #define POCO_COMPILER_CODEWARRIOR
254#elif defined (__sgi) || defined(sgi)
255 #define POCO_COMPILER_SGI
256#elif defined (__HP_aCC)
257 #define POCO_COMPILER_HP_ACC
258#elif defined (__BORLANDC__) || defined(__CODEGEARC__)
259 #define POCO_COMPILER_CBUILDER
260#elif defined (__DMC__)
261 #define POCO_COMPILER_DMARS
262#elif defined (__DECCXX)
263 #define POCO_COMPILER_COMPAC
264#elif (defined (__xlc__) || defined (__xlC__)) && defined(__IBMCPP__)
265 #define POCO_COMPILER_IBM_XLC // IBM XL C++
266#elif defined (__IBMCPP__) && defined(__COMPILER_VER__)
267 #define POCO_COMPILER_IBM_XLC_ZOS // IBM z/OS C++
268#endif
269
270
271#ifdef __GNUC__
272#define POCO_UNUSED __attribute__((unused))
273#else
274#define POCO_UNUSED
275#endif // __GNUC__
276
277
278#if !defined(POCO_ARCH)
279 #error "Unknown Hardware Architecture."
280#endif
281
282
283#if defined(POCO_OS_FAMILY_WINDOWS)
284 #define POCO_DEFAULT_NEWLINE_CHARS "\r\n"
285#else
286 #define POCO_DEFAULT_NEWLINE_CHARS "\n"
287#endif
288
289
290#endif // Foundation_Platform_INCLUDED
#define ARK_API
Definition Base.h:9
#define POCO_NO_SOO
Definition Config.h:82
#define POCO_DO_JOIN2(X, Y)
Definition Foundation.h:134
#define POCO_DO_JOIN(X, Y)
Definition Foundation.h:133
#define Net_API
Definition Net.h:47
#define NetSSL_API
Definition NetSSL.h:48
#define POCO_OS_WINDOWS_NT
Definition Platform.h:43
#define POCO_OS_ANDROID
Definition Platform.h:41
#define POCO_OS_QNX
Definition Platform.h:37
#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 POCO_EXTERNAL_OPENSSL_SLPRO
Definition Crypto.h:24
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
std::string displayText() const
Returns the exception code if defined.
virtual std::istream & receiveResponse(HTTPResponse &response)
virtual std::ostream & sendRequest(HTTPRequest &request)
Returns the connection timeout for HTTP connections.
static const std::string HTTP_1_1
void setContentLength(std::streamsize length)
Returns the HTTP version for this message.
HTTPRequest(const std::string &method, const std::string &uri, const std::string &version)
Creates a HTTP/1.0 request with the given method and URI.
static const std::string HTTP_GET
static const std::string HTTP_DELETE
static const std::string HTTP_POST
const std::string & getReason() const
Sets the HTTP reason phrase.
HTTPResponse(HTTPStatus status)
HTTPStatus getStatus() const
HTTPSClientSession(const std::string &host, Poco::UInt16 port, Context::Ptr pContext, Session::Ptr pSession)
std::string proxyRequestPrefix() const
Sends the given HTTPRequest over an existing connection.
HTTPSClientSession(Context::Ptr pContext, Session::Ptr pSession)
HTTPSClientSession(Context::Ptr pContext)
Creates a HTTPSClientSession using the given host and port.
void proxyAuthenticate(HTTPRequest &request)
Checks if we can reuse a persistent connection.
int read(char *buffer, std::streamsize length)
HTTPSClientSession(const HTTPSClientSession &)
void connect(const SocketAddress &address)
Refills the internal buffer.
HTTPSClientSession(const SecureStreamSocket &socket, Session::Ptr pSession)
X509Certificate serverCertificate()
HTTPSClientSession & operator=(const HTTPSClientSession &)
HTTPSClientSession(const std::string &host, Poco::UInt16 port=HTTPS_PORT)
HTTPSClientSession(const SecureStreamSocket &socket)
Creates an unconnected HTTPSClientSession.
HTTPSClientSession(const std::string &host, Poco::UInt16 port, Context::Ptr pContext)
RejectCertificateHandler(bool handleErrorsOnServerSide)
void initializeClient(PrivateKeyPassphraseHandlerPtr ptrPassphraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext)
static SSLManager & instance()
This stream discards all characters written to it.
Definition NullStream.h:77
static std::streamsize copyStream(std::istream &istr, std::ostream &ostr, std::size_t bufferSize=8192)
const std::string & getHost() const
Sets the user-info part of the URI.
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 NetSSL_API initializeSSL()
void Net_API uninitializeNetwork()
void Net_API initializeNetwork()
void NetSSL_API uninitializeSSL()
Definition format.h:408
Definition json.hpp:4518
std::function< void(bool, std::string)> callback
Definition Requests.cpp:41
static std::string escape(const std::string &s, bool strictJSON=false)