Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
SocketDefs.h
Go to the documentation of this file.
1//
2// SocketDefs.h
3//
4// Library: Net
5// Package: NetCore
6// Module: SocketDefs
7//
8// Include platform-specific header files for sockets.
9//
10// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
11// and Contributors.
12//
13// SPDX-License-Identifier: BSL-1.0
14//
15
16
17#ifndef Net_SocketDefs_INCLUDED
18#define Net_SocketDefs_INCLUDED
19
20
21#include <vector>
22
23
24#define POCO_ENOERR 0
25
26
27#if defined(POCO_OS_FAMILY_WINDOWS)
28 #include "Poco/UnWindows.h"
29 #include <winsock2.h>
30 #include <ws2tcpip.h>
31 #include <ws2def.h>
32 #define POCO_INVALID_SOCKET INVALID_SOCKET
33 #define poco_socket_t SOCKET
34 #define poco_socklen_t int
35 #define poco_ioctl_request_t int
36 #define poco_closesocket(s) closesocket(s)
37 #define POCO_EINTR WSAEINTR
38 #define POCO_EACCES WSAEACCES
39 #define POCO_EFAULT WSAEFAULT
40 #define POCO_EINVAL WSAEINVAL
41 #define POCO_EMFILE WSAEMFILE
42 #define POCO_EAGAIN WSAEWOULDBLOCK
43 #define POCO_EWOULDBLOCK WSAEWOULDBLOCK
44 #define POCO_EINPROGRESS WSAEINPROGRESS
45 #define POCO_EALREADY WSAEALREADY
46 #define POCO_ENOTSOCK WSAENOTSOCK
47 #define POCO_EDESTADDRREQ WSAEDESTADDRREQ
48 #define POCO_EMSGSIZE WSAEMSGSIZE
49 #define POCO_EPROTOTYPE WSAEPROTOTYPE
50 #define POCO_ENOPROTOOPT WSAENOPROTOOPT
51 #define POCO_EPROTONOSUPPORT WSAEPROTONOSUPPORT
52 #define POCO_ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
53 #define POCO_ENOTSUP WSAEOPNOTSUPP
54 #define POCO_EPFNOSUPPORT WSAEPFNOSUPPORT
55 #define POCO_EAFNOSUPPORT WSAEAFNOSUPPORT
56 #define POCO_EADDRINUSE WSAEADDRINUSE
57 #define POCO_EADDRNOTAVAIL WSAEADDRNOTAVAIL
58 #define POCO_ENETDOWN WSAENETDOWN
59 #define POCO_ENETUNREACH WSAENETUNREACH
60 #define POCO_ENETRESET WSAENETRESET
61 #define POCO_ECONNABORTED WSAECONNABORTED
62 #define POCO_ECONNRESET WSAECONNRESET
63 #define POCO_ENOBUFS WSAENOBUFS
64 #define POCO_EISCONN WSAEISCONN
65 #define POCO_ENOTCONN WSAENOTCONN
66 #define POCO_ESHUTDOWN WSAESHUTDOWN
67 #define POCO_ETIMEDOUT WSAETIMEDOUT
68 #define POCO_ECONNREFUSED WSAECONNREFUSED
69 #define POCO_EHOSTDOWN WSAEHOSTDOWN
70 #define POCO_EHOSTUNREACH WSAEHOSTUNREACH
71 #define POCO_ESYSNOTREADY WSASYSNOTREADY
72 #define POCO_ENOTINIT WSANOTINITIALISED
73 #define POCO_HOST_NOT_FOUND WSAHOST_NOT_FOUND
74 #define POCO_TRY_AGAIN WSATRY_AGAIN
75 #define POCO_NO_RECOVERY WSANO_RECOVERY
76 #define POCO_NO_DATA WSANO_DATA
77 #ifndef ADDRESS_FAMILY
78 #define ADDRESS_FAMILY USHORT
79 #endif
80#elif defined(POCO_VXWORKS)
81 #include <hostLib.h>
82 #include <ifLib.h>
83 #include <inetLib.h>
84 #include <ioLib.h>
85 #include <resolvLib.h>
86 #include <types.h>
87 #include <socket.h>
88 #include <netinet/tcp.h>
89 #define POCO_INVALID_SOCKET -1
90 #define poco_socket_t int
91 #define poco_socklen_t int
92 #define poco_ioctl_request_t int
93 #define poco_closesocket(s) ::close(s)
94 #define POCO_EINTR EINTR
95 #define POCO_EACCES EACCES
96 #define POCO_EFAULT EFAULT
97 #define POCO_EINVAL EINVAL
98 #define POCO_EMFILE EMFILE
99 #define POCO_EAGAIN EAGAIN
100 #define POCO_EWOULDBLOCK EWOULDBLOCK
101 #define POCO_EINPROGRESS EINPROGRESS
102 #define POCO_EALREADY EALREADY
103 #define POCO_ENOTSOCK ENOTSOCK
104 #define POCO_EDESTADDRREQ EDESTADDRREQ
105 #define POCO_EMSGSIZE EMSGSIZE
106 #define POCO_EPROTOTYPE EPROTOTYPE
107 #define POCO_ENOPROTOOPT ENOPROTOOPT
108 #define POCO_EPROTONOSUPPORT EPROTONOSUPPORT
109 #define POCO_ESOCKTNOSUPPORT ESOCKTNOSUPPORT
110 #define POCO_ENOTSUP ENOTSUP
111 #define POCO_EPFNOSUPPORT EPFNOSUPPORT
112 #define POCO_EAFNOSUPPORT EAFNOSUPPORT
113 #define POCO_EADDRINUSE EADDRINUSE
114 #define POCO_EADDRNOTAVAIL EADDRNOTAVAIL
115 #define POCO_ENETDOWN ENETDOWN
116 #define POCO_ENETUNREACH ENETUNREACH
117 #define POCO_ENETRESET ENETRESET
118 #define POCO_ECONNABORTED ECONNABORTED
119 #define POCO_ECONNRESET ECONNRESET
120 #define POCO_ENOBUFS ENOBUFS
121 #define POCO_EISCONN EISCONN
122 #define POCO_ENOTCONN ENOTCONN
123 #define POCO_ESHUTDOWN ESHUTDOWN
124 #define POCO_ETIMEDOUT ETIMEDOUT
125 #define POCO_ECONNREFUSED ECONNREFUSED
126 #define POCO_EHOSTDOWN EHOSTDOWN
127 #define POCO_EHOSTUNREACH EHOSTUNREACH
128 #define POCO_ESYSNOTREADY -4
129 #define POCO_ENOTINIT -5
130 #define POCO_HOST_NOT_FOUND HOST_NOT_FOUND
131 #define POCO_TRY_AGAIN TRY_AGAIN
132 #define POCO_NO_RECOVERY NO_RECOVERY
133 #define POCO_NO_DATA NO_DATA
134#elif defined(POCO_OS_FAMILY_UNIX)
135 #include <unistd.h>
136 #include <errno.h>
137 #include <sys/types.h>
138 #include <sys/socket.h>
139 #include <sys/un.h>
140 #include <sys/uio.h>
141 #include <fcntl.h>
142 #if POCO_OS != POCO_OS_HPUX
143 #include <sys/select.h>
144 #endif
145 #include <sys/ioctl.h>
146 #include <arpa/inet.h>
147 #include <netinet/in.h>
148 #include <netinet/tcp.h>
149 #include <netdb.h>
150 #if defined(POCO_OS_FAMILY_UNIX)
151 #if (POCO_OS == POCO_OS_LINUX) || (POCO_OS == POCO_OS_ANDROID)
152 // Net/src/NetworkInterface.cpp changed #include <linux/if.h> to #include <net/if.h>
153 // no more conflict, can use #include <net/if.h> here
154 #include <net/if.h>
155 #elif (POCO_OS == POCO_OS_HPUX)
156 extern "C"
157 {
158 #include <net/if.h>
159 }
160 #else
161 #include <net/if.h>
162 #endif
163 #endif
164 #if (POCO_OS == POCO_OS_SOLARIS) || (POCO_OS == POCO_OS_MAC_OS_X)
165 #include <sys/sockio.h>
166 #include <sys/filio.h>
167 #endif
168 #define POCO_INVALID_SOCKET -1
169 #define poco_socket_t int
170 #define poco_socklen_t socklen_t
171 #define poco_fcntl_request_t int
172 #if defined(POCO_OS_FAMILY_BSD)
173 #define poco_ioctl_request_t unsigned long
174 #else
175 #define poco_ioctl_request_t int
176 #endif
177 #define poco_closesocket(s) ::close(s)
178 #define POCO_EINTR EINTR
179 #define POCO_EACCES EACCES
180 #define POCO_EFAULT EFAULT
181 #define POCO_EINVAL EINVAL
182 #define POCO_EMFILE EMFILE
183 #define POCO_EAGAIN EAGAIN
184 #define POCO_EWOULDBLOCK EWOULDBLOCK
185 #define POCO_EINPROGRESS EINPROGRESS
186 #define POCO_EALREADY EALREADY
187 #define POCO_ENOTSOCK ENOTSOCK
188 #define POCO_EDESTADDRREQ EDESTADDRREQ
189 #define POCO_EMSGSIZE EMSGSIZE
190 #define POCO_EPROTOTYPE EPROTOTYPE
191 #define POCO_ENOPROTOOPT ENOPROTOOPT
192 #define POCO_EPROTONOSUPPORT EPROTONOSUPPORT
193 #if defined(ESOCKTNOSUPPORT)
194 #define POCO_ESOCKTNOSUPPORT ESOCKTNOSUPPORT
195 #else
196 #define POCO_ESOCKTNOSUPPORT -1
197 #endif
198 #define POCO_ENOTSUP ENOTSUP
199 #define POCO_EPFNOSUPPORT EPFNOSUPPORT
200 #define POCO_EAFNOSUPPORT EAFNOSUPPORT
201 #define POCO_EADDRINUSE EADDRINUSE
202 #define POCO_EADDRNOTAVAIL EADDRNOTAVAIL
203 #define POCO_ENETDOWN ENETDOWN
204 #define POCO_ENETUNREACH ENETUNREACH
205 #define POCO_ENETRESET ENETRESET
206 #define POCO_ECONNABORTED ECONNABORTED
207 #define POCO_ECONNRESET ECONNRESET
208 #define POCO_ENOBUFS ENOBUFS
209 #define POCO_EISCONN EISCONN
210 #define POCO_ENOTCONN ENOTCONN
211 #if defined(ESHUTDOWN)
212 #define POCO_ESHUTDOWN ESHUTDOWN
213 #else
214 #define POCO_ESHUTDOWN -2
215 #endif
216 #define POCO_ETIMEDOUT ETIMEDOUT
217 #define POCO_ECONNREFUSED ECONNREFUSED
218 #if defined(EHOSTDOWN)
219 #define POCO_EHOSTDOWN EHOSTDOWN
220 #else
221 #define POCO_EHOSTDOWN -3
222 #endif
223 #define POCO_EHOSTUNREACH EHOSTUNREACH
224 #define POCO_ESYSNOTREADY -4
225 #define POCO_ENOTINIT -5
226 #define POCO_HOST_NOT_FOUND HOST_NOT_FOUND
227 #define POCO_TRY_AGAIN TRY_AGAIN
228 #define POCO_NO_RECOVERY NO_RECOVERY
229 #define POCO_NO_DATA NO_DATA
230#endif
231
232
233#if defined(POCO_OS_FAMILY_BSD) || (POCO_OS == POCO_OS_TRU64) || (POCO_OS == POCO_OS_AIX) || (POCO_OS == POCO_OS_IRIX) || (POCO_OS == POCO_OS_QNX) || (POCO_OS == POCO_OS_VXWORKS)
234 #define POCO_HAVE_SALEN 1
235#endif
236
237
238#if POCO_OS != POCO_OS_VXWORKS && !defined(POCO_NET_NO_ADDRINFO)
239 #define POCO_HAVE_ADDRINFO 1
240#endif
241
242
243#if (POCO_OS == POCO_OS_HPUX) || (POCO_OS == POCO_OS_SOLARIS) || (POCO_OS == POCO_OS_WINDOWS_CE) || (POCO_OS == POCO_OS_CYGWIN)
244 #define POCO_BROKEN_TIMEOUTS 1
245#endif
246
247
248#if defined(POCO_HAVE_ADDRINFO)
249 #ifndef AI_PASSIVE
250 #define AI_PASSIVE 0
251 #endif
252 #ifndef AI_CANONNAME
253 #define AI_CANONNAME 0
254 #endif
255 #ifndef AI_NUMERICHOST
256 #define AI_NUMERICHOST 0
257 #endif
258 #ifndef AI_NUMERICSERV
259 #define AI_NUMERICSERV 0
260 #endif
261 #ifndef AI_ALL
262 #define AI_ALL 0
263 #endif
264 #ifndef AI_ADDRCONFIG
265 #define AI_ADDRCONFIG 0
266 #endif
267 #ifndef AI_V4MAPPED
268 #define AI_V4MAPPED 0
269 #endif
270#endif
271
272
273#if defined(POCO_HAVE_SALEN)
274 #define poco_set_sa_len(pSA, len) (pSA)->sa_len = (len)
275 #define poco_set_sin_len(pSA) (pSA)->sin_len = sizeof(struct sockaddr_in)
276 #if defined(POCO_HAVE_IPv6)
277 #define poco_set_sin6_len(pSA) (pSA)->sin6_len = sizeof(struct sockaddr_in6)
278 #endif
279 #if defined(POCO_OS_FAMILY_UNIX)
280 #define poco_set_sun_len(pSA, len) (pSA)->sun_len = (len)
281 #endif
282#else
283 #define poco_set_sa_len(pSA, len) (void) 0
284 #define poco_set_sin_len(pSA) (void) 0
285 #define poco_set_sin6_len(pSA) (void) 0
286 #define poco_set_sun_len(pSA, len) (void) 0
287#endif
288
289
290#ifndef INADDR_NONE
291 #define INADDR_NONE 0xffffffff
292#endif
293
294#ifndef INADDR_ANY
295 #define INADDR_ANY 0x00000000
296#endif
297
298#ifndef INADDR_BROADCAST
299 #define INADDR_BROADCAST 0xffffffff
300#endif
301
302#ifndef INADDR_LOOPBACK
303 #define INADDR_LOOPBACK 0x7f000001
304#endif
305
306#ifndef INADDR_UNSPEC_GROUP
307 #define INADDR_UNSPEC_GROUP 0xe0000000
308#endif
309
310#ifndef INADDR_ALLHOSTS_GROUP
311 #define INADDR_ALLHOSTS_GROUP 0xe0000001
312#endif
313
314#ifndef INADDR_ALLRTRS_GROUP
315 #define INADDR_ALLRTRS_GROUP 0xe0000002
316#endif
317
318#ifndef INADDR_MAX_LOCAL_GROUP
319 #define INADDR_MAX_LOCAL_GROUP 0xe00000ff
320#endif
321
322#if defined(POCO_ARCH_BIG_ENDIAN)
323 #define poco_ntoh_16(x) (x)
324 #define poco_ntoh_32(x) (x)
325#else
326 #define poco_ntoh_16(x)
327 ((((x) >> 8) & 0x00ff) | (((x) << 8) & 0xff00))
328 #define poco_ntoh_32(x)
329 ((((x) >> 24) & 0x000000ff) | (((x) >> 8) & 0x0000ff00) | (((x) << 8) & 0x00ff0000) | (((x) << 24) & 0xff000000))
330#endif
331#define poco_hton_16(x) poco_ntoh_16(x)
332#define poco_hton_32(x) poco_ntoh_32(x)
333
334
335#if !defined(s6_addr16)
336 #if defined(POCO_OS_FAMILY_WINDOWS)
337 #define s6_addr16 u.Word
338 #else
339 #define s6_addr16 __u6_addr.__u6_addr16
340 #endif
341#endif
342
343
344#if !defined(s6_addr32)
345 #if defined(POCO_OS_FAMILY_UNIX)
346 #if (POCO_OS == POCO_OS_SOLARIS)
347 #define s6_addr32 _S6_un._S6_u32
348 #else
349 #define s6_addr32 __u6_addr.__u6_addr32
350 #endif
351 #endif
352#endif
353
354
355namespace Poco {
356namespace Net {
357
358
359#if defined(POCO_OS_FAMILY_WINDOWS)
360 typedef WSABUF SocketBuf;
361#elif defined(POCO_OS_FAMILY_UNIX) // TODO: may need more refinement
362 typedef iovec SocketBuf;
363#endif
364
365typedef std::vector<SocketBuf> SocketBufVec;
366
368 /// AddressFamily::Family replaces the previously used IPAddress::Family
369 /// enumeration and is now used for IPAddress::Family and SocketAddress::Family.
370{
372 /// Possible address families for socket addresses.
373 {
375 /// IPv4 address family.
376 #if defined(POCO_HAVE_IPv6)
377 IPv6,
378 /// IPv6 address family.
379 #endif
380 #if defined(POCO_OS_FAMILY_UNIX)
382 /// UNIX domain socket address family. Available on UNIX/POSIX platforms only.
383 #endif
384 };
385};
386
387
388} } // namespace Poco::Net
389
390
391#endif // Net_SocketDefs_INCLUDED
#define ARK_API
Definition Base.h:9
#define POCO_EXTERNAL_OPENSSL
Definition Config.h:189
#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 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)
This class represents a X509 Certificate.
std::string displayText() const
Returns the exception code if defined.
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)
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.
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 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()
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
#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)