qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1
28
30
31#ifndef QB_IO_CONFIG_HPP
32#define QB_IO_CONFIG_HPP
33/*
34** Uncomment or add compiler flag -DQB_HEADER_ONLY to enable qb core implementation
35*header
36** only
37*/
38// #define QB_HEADER_ONLY 1
39
47#ifndef QB_ENABLE_UDS
48#define QB_ENABLE_UDS 1
49#endif
50
51/*
52** Uncomment or add compiler flag -DQB_NT_COMPAT_GAI for earlier versions of Windows XP
53** see:
54*https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo
55*/
56// #define QB_NT_COMPAT_GAI 1
57
64#if defined(QB_HEADER_ONLY)
65#define QB__DECL inline
66#else
67#define QB__DECL
68#endif
69
77#if !defined(_WIN32) || QB__64BITS
78#define QB_INTEROP_DECL
79#else
80#define QB_INTEROP_DECL __stdcall
81#endif
82
90#define QB_ARRAYSIZE(A) (sizeof(A) / sizeof((A)[0]))
91
99#define QB_SSIZEOF(T) static_cast<int>(sizeof(T))
100
101// clang-format off
111#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
112# define QB_OBSOLETE_DEPRECATE(_Replacement) __attribute__((deprecated))
113#elif _MSC_VER >= 1400 // vs 2005 or higher
114# define QB_OBSOLETE_DEPRECATE(_Replacement) \
115 __declspec(deprecated("This function will be removed in the future. Consider using " #_Replacement " instead."))
116#else
117# define QB_OBSOLETE_DEPRECATE(_Replacement)
118#endif
119// clang-format on
120
121#if defined(UE_BUILD_DEBUG) || defined(UE_BUILD_DEVELOPMENT) || \
122 defined(UE_BUILD_TEST) || defined(UE_BUILD_SHIPPING) || defined(UE_SERVER)
123#define QB_INSIDE_UNREAL 1
124#endif // Unreal Engine 4 bullshit
125
126/*
127** The qb version macros
128*/
135#define QB_VERSION_NUM 0x033705
136
143#define QB_DEFAULT_MULTICAST_TTL (int) 128
144
151#define QB_INET_BUFFER_SIZE 65536
152
160#define QB_MAX_PDU_BUFFER_SIZE static_cast<int>(1 * 1024 * 1024)
161
169#define QB_UNPACK_MAX_STRIP 32
170
171#ifdef _WIN32
172#if !defined(WIN32_LEAN_AND_MEAN)
173#define WIN32_LEAN_AND_MEAN
174#endif
175#ifndef NOMINMAX
176#define NOMINMAX
177#endif
178#include <WinSock2.h>
179#include <Windows.h>
180#include <io.h>
181#if defined(_WIN32) && !defined(_WINSTORE)
182#include <Mstcpip.h>
183#include <Mswsock.h>
184#endif
185#include <Ws2tcpip.h>
186#if defined(QB_NT_COMPAT_GAI)
187#include <Wspiapi.h>
188#endif
189#if QB__HAS_UDS
190#include <afunix.h>
191#endif
192typedef SOCKET socket_type;
193typedef int socklen_t;
194#define FD_TO_SOCKET(fd) _get_osfhandle(fd)
195#define OPEN_FD_FROM_SOCKET(sock) _open_osfhandle(sock, 0)
196#define poll WSAPoll
197#pragma comment(lib, "ws2_32.lib")
198
199#undef gai_strerror
200#else
201#include <netdb.h>
202#include <signal.h>
203#include <sys/ioctl.h>
204#include <sys/poll.h>
205#include <sys/types.h>
206#include <unistd.h>
207#if defined(__linux__)
208#include <sys/epoll.h>
209#endif
210#include <arpa/inet.h>
211#include <net/if.h>
212#include <netinet/in.h>
213#include <netinet/tcp.h>
214#include <sys/select.h>
215#include <sys/socket.h>
216#include <sys/un.h>
217#if !defined(SD_RECEIVE)
225#define SD_RECEIVE SHUT_RD
226#endif
227#if !defined(SD_SEND)
235#define SD_SEND SHUT_WR
236#endif
237#if !defined(SD_BOTH)
245#define SD_BOTH SHUT_RDWR
246#endif
247#if !defined(closesocket)
254#define closesocket close
255#endif
256#if !defined(ioctlsocket)
263#define ioctlsocket ioctl
264#endif
265#if defined(__linux__)
266#define SO_NOSIGPIPE MSG_NOSIGNAL
267#endif
274typedef int socket_type;
283#define FD_TO_SOCKET(fd) fd
292#define OPEN_FD_FROM_SOCKET(sock) sock
293#undef socket
294#endif
301#define SD_NONE -1
302
303#include <fcntl.h> // common platform header
304
305// redefine socket error code for posix api
306#ifdef _WIN32
307#undef EWOULDBLOCK
308#undef EINPROGRESS
309#undef EALREADY
310#undef ENOTSOCK
311#undef EDESTADDRREQ
312#undef EMSGSIZE
313#undef EPROTOTYPE
314#undef ENOPROTOOPT
315#undef EPROTONOSUPPORT
316#undef ESOCKTNOSUPPORT
317#undef EOPNOTSUPP
318#undef EPFNOSUPPORT
319#undef EAFNOSUPPORT
320#undef EADDRINUSE
321#undef EADDRNOTAVAIL
322#undef ENETDOWN
323#undef ENETUNREACH
324#undef ENETRESET
325#undef ECONNABORTED
326#undef ECONNRESET
327#undef ENOBUFS
328#undef EISCONN
329#undef ENOTCONN
330#undef ESHUTDOWN
331#undef ETOOMANYREFS
332#undef ETIMEDOUT
333#undef ECONNREFUSED
334#undef ELOOP
335#undef ENAMETOOLONG
336#undef EHOSTDOWN
337#undef EHOSTUNREACH
338#undef ENOTEMPTY
339#undef EPROCLIM
340#undef EUSERS
341#undef EDQUOT
342#undef ESTALE
343#undef EREMOTE
344#undef EBADF
345#undef EFAULT
346#undef EAGAIN
347
348#define EWOULDBLOCK WSAEWOULDBLOCK
349#define EINPROGRESS WSAEINPROGRESS
350#define EALREADY WSAEALREADY
351#define ENOTSOCK WSAENOTSOCK
352#define EDESTADDRREQ WSAEDESTADDRREQ
353#define EMSGSIZE WSAEMSGSIZE
354#define EPROTOTYPE WSAEPROTOTYPE
355#define ENOPROTOOPT WSAENOPROTOOPT
356#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
357#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
358#define EOPNOTSUPP WSAEOPNOTSUPP
359#define EPFNOSUPPORT WSAEPFNOSUPPORT
360#define EAFNOSUPPORT WSAEAFNOSUPPORT
361#define EADDRINUSE WSAEADDRINUSE
362#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
363#define ENETDOWN WSAENETDOWN
364#define ENETUNREACH WSAENETUNREACH
365#define ENETRESET WSAENETRESET
366#define ECONNABORTED WSAECONNABORTED
367#define ECONNRESET WSAECONNRESET
368#define ENOBUFS WSAENOBUFS
369#define EISCONN WSAEISCONN
370#define ENOTCONN WSAENOTCONN
371#define ESHUTDOWN WSAESHUTDOWN
372#define ETOOMANYREFS WSAETOOMANYREFS
373#define ETIMEDOUT WSAETIMEDOUT
374#define ECONNREFUSED WSAECONNREFUSED
375#define ELOOP WSAELOOP
376#define ENAMETOOLONG WSAENAMETOOLONG
377#define EHOSTDOWN WSAEHOSTDOWN
378#define EHOSTUNREACH WSAEHOSTUNREACH
379#define ENOTEMPTY WSAENOTEMPTY
380#define EPROCLIM WSAEPROCLIM
381#define EUSERS WSAEUSERS
382#define EDQUOT WSAEDQUOT
383#define ESTALE WSAESTALE
384#define EREMOTE WSAEREMOTE
385#define EBADF WSAEBADF
386#define EFAULT WSAEFAULT
387#define EAGAIN WSATRY_AGAIN
388#endif
389
390#if !defined(MAXNS)
397#define MAXNS 3
398#endif
399
406#define IN_MAX_ADDRSTRLEN INET6_ADDRSTRLEN
407
408#endif
Platform, compiler, and C++ feature detection macros for the QB Framework.
int socket_type
Cross-platform socket handle type.
Definition config.h:274
System signal event handler for asynchronous I/O.