czmq-ffi-gen 0.9.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/AUTHORS +1 -0
- data/CHANGES.md +88 -0
- data/Gemfile +2 -0
- data/LICENSE +14 -0
- data/README.md +112 -0
- data/lib/czmq-ffi-gen.rb +7 -0
- data/lib/czmq-ffi-gen/czmq/ffi.rb +1210 -0
- data/lib/czmq-ffi-gen/czmq/ffi/version.rb +15 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +186 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +286 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +307 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +222 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +388 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +140 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +442 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +156 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +283 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +194 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +353 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +359 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +416 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +659 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +189 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +365 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +478 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +396 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +515 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +194 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +294 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +3479 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +203 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +203 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +221 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +227 -0
- data/lib/czmq-ffi-gen/errors.rb +12 -0
- data/lib/czmq-ffi-gen/gem_version.rb +5 -0
- data/lib/czmq-ffi-gen/legacy.rb +16 -0
- data/lib/czmq-ffi-gen/libzmq.rb +18 -0
- data/lib/czmq-ffi-gen/signals.rb +27 -0
- data/lib/czmq-ffi-gen/vendor.rb +5 -0
- data/lib/czmq-ffi-gen/versions.rb +19 -0
- data/vendor/local/bin/inproc_lat.exe +0 -0
- data/vendor/local/bin/inproc_thr.exe +0 -0
- data/vendor/local/bin/libczmq.dll +0 -0
- data/vendor/local/bin/libgcc_s_sjlj-1.dll +0 -0
- data/vendor/local/bin/libstdc++-6.dll +0 -0
- data/vendor/local/bin/libzmq.dll +0 -0
- data/vendor/local/bin/local_lat.exe +0 -0
- data/vendor/local/bin/local_thr.exe +0 -0
- data/vendor/local/bin/remote_lat.exe +0 -0
- data/vendor/local/bin/remote_thr.exe +0 -0
- data/vendor/local/include/czmq.h +31 -0
- data/vendor/local/include/czmq_library.h +199 -0
- data/vendor/local/include/czmq_prelude.h +641 -0
- data/vendor/local/include/readme.txt +83 -0
- data/vendor/local/include/sha1.h +76 -0
- data/vendor/local/include/sha1.inc_c +335 -0
- data/vendor/local/include/slre.h +92 -0
- data/vendor/local/include/slre.inc_c +660 -0
- data/vendor/local/include/zactor.h +76 -0
- data/vendor/local/include/zarmour.h +114 -0
- data/vendor/local/include/zauth.h +100 -0
- data/vendor/local/include/zauth_v2.h +88 -0
- data/vendor/local/include/zbeacon.h +86 -0
- data/vendor/local/include/zbeacon_v2.h +75 -0
- data/vendor/local/include/zcert.h +136 -0
- data/vendor/local/include/zcertstore.h +100 -0
- data/vendor/local/include/zchunk.h +163 -0
- data/vendor/local/include/zclock.h +73 -0
- data/vendor/local/include/zconfig.h +185 -0
- data/vendor/local/include/zctx.h +107 -0
- data/vendor/local/include/zdigest.h +65 -0
- data/vendor/local/include/zdir.h +149 -0
- data/vendor/local/include/zdir_patch.h +82 -0
- data/vendor/local/include/zfile.h +177 -0
- data/vendor/local/include/zframe.h +176 -0
- data/vendor/local/include/zgossip.h +95 -0
- data/vendor/local/include/zgossip_engine.inc +927 -0
- data/vendor/local/include/zgossip_msg.h +129 -0
- data/vendor/local/include/zhash.h +195 -0
- data/vendor/local/include/zhash_primes.inc +329 -0
- data/vendor/local/include/zhashx.h +298 -0
- data/vendor/local/include/ziflist.h +77 -0
- data/vendor/local/include/zlist.h +158 -0
- data/vendor/local/include/zlistx.h +205 -0
- data/vendor/local/include/zloop.h +168 -0
- data/vendor/local/include/zmonitor.h +73 -0
- data/vendor/local/include/zmonitor_v2.h +56 -0
- data/vendor/local/include/zmq.h +617 -0
- data/vendor/local/include/zmq_utils.h +48 -0
- data/vendor/local/include/zmsg.h +280 -0
- data/vendor/local/include/zmutex.h +55 -0
- data/vendor/local/include/zpoller.h +92 -0
- data/vendor/local/include/zproc.h +168 -0
- data/vendor/local/include/zproxy.h +111 -0
- data/vendor/local/include/zproxy_v2.h +62 -0
- data/vendor/local/include/zrex.h +82 -0
- data/vendor/local/include/zsock.h +912 -0
- data/vendor/local/include/zsock_option.inc +4126 -0
- data/vendor/local/include/zsocket.h +110 -0
- data/vendor/local/include/zsockopt.h +256 -0
- data/vendor/local/include/zstr.h +110 -0
- data/vendor/local/include/zsys.h +386 -0
- data/vendor/local/include/zthread.h +50 -0
- data/vendor/local/include/ztimerset.h +90 -0
- data/vendor/local/include/ztrie.h +106 -0
- data/vendor/local/include/zuuid.h +96 -0
- data/vendor/local/lib/libczmq.dll.a +0 -0
- data/vendor/local/lib/liblibzmq.dll.a +0 -0
- data/vendor/local/lib/libzmq-static.a +0 -0
- data/vendor/local/lib/pkgconfig/libczmq.pc +23 -0
- data/vendor/local/lib/pkgconfig/libzmq.pc +11 -0
- data/vendor/local/share/zmq/AUTHORS.txt +147 -0
- data/vendor/local/share/zmq/COPYING.LESSER.txt +181 -0
- data/vendor/local/share/zmq/COPYING.txt +674 -0
- data/vendor/local/share/zmq/NEWS.txt +978 -0
- metadata +230 -0
@@ -0,0 +1,641 @@
|
|
1
|
+
/* =========================================================================
|
2
|
+
czmq_prelude.h - CZMQ environment
|
3
|
+
|
4
|
+
Copyright (c) the Contributors as noted in the AUTHORS file.
|
5
|
+
This file is part of CZMQ, the high-level C binding for 0MQ:
|
6
|
+
http://czmq.zeromq.org.
|
7
|
+
|
8
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
9
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
10
|
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
11
|
+
=========================================================================
|
12
|
+
*/
|
13
|
+
|
14
|
+
#ifndef __CZMQ_PRELUDE_H_INCLUDED__
|
15
|
+
#define __CZMQ_PRELUDE_H_INCLUDED__
|
16
|
+
|
17
|
+
//- Establish the compiler and computer system ------------------------------
|
18
|
+
/*
|
19
|
+
* Defines zero or more of these symbols, for use in any non-portable
|
20
|
+
* code:
|
21
|
+
*
|
22
|
+
* __WINDOWS__ Microsoft C/C++ with Windows calls
|
23
|
+
* __MSDOS__ System is MS-DOS (set if __WINDOWS__ set)
|
24
|
+
* __VMS__ System is VAX/VMS or Alpha/OpenVMS
|
25
|
+
* __UNIX__ System is UNIX
|
26
|
+
* __OS2__ System is OS/2
|
27
|
+
*
|
28
|
+
* __IS_32BIT__ OS/compiler is 32 bits
|
29
|
+
* __IS_64BIT__ OS/compiler is 64 bits
|
30
|
+
*
|
31
|
+
* When __UNIX__ is defined, we also define exactly one of these:
|
32
|
+
*
|
33
|
+
* __UTYPE_AUX Apple AUX
|
34
|
+
* __UTYPE_BEOS BeOS
|
35
|
+
* __UTYPE_BSDOS BSD/OS
|
36
|
+
* __UTYPE_DECALPHA Digital UNIX (Alpha)
|
37
|
+
* __UTYPE_IBMAIX IBM RS/6000 AIX
|
38
|
+
* __UTYPE_FREEBSD FreeBSD
|
39
|
+
* __UTYPE_HPUX HP/UX
|
40
|
+
* __UTYPE_ANDROID Android
|
41
|
+
* __UTYPE_LINUX Linux
|
42
|
+
* __UTYPE_GNU GNU/Hurd
|
43
|
+
* __UTYPE_MIPS MIPS (BSD 4.3/System V mixture)
|
44
|
+
* __UTYPE_NETBSD NetBSD
|
45
|
+
* __UTYPE_NEXT NeXT
|
46
|
+
* __UTYPE_OPENBSD OpenBSD
|
47
|
+
* __UTYPE_OSX Apple Macintosh OS X
|
48
|
+
* __UTYPE_IOS Apple iOS
|
49
|
+
* __UTYPE_QNX QNX
|
50
|
+
* __UTYPE_IRIX Silicon Graphics IRIX
|
51
|
+
* __UTYPE_SINIX SINIX-N (Siemens-Nixdorf Unix)
|
52
|
+
* __UTYPE_SUNOS SunOS
|
53
|
+
* __UTYPE_SUNSOLARIS Sun Solaris
|
54
|
+
* __UTYPE_UNIXWARE SCO UnixWare
|
55
|
+
* ... these are the ones I know about so far.
|
56
|
+
* __UTYPE_GENERIC Any other UNIX
|
57
|
+
*
|
58
|
+
* When __VMS__ is defined, we may define one or more of these:
|
59
|
+
*
|
60
|
+
* __VMS_XOPEN Supports XOPEN functions
|
61
|
+
*/
|
62
|
+
|
63
|
+
#if (defined (__64BIT__) || defined (__x86_64__))
|
64
|
+
# define __IS_64BIT__ // May have 64-bit OS/compiler
|
65
|
+
#else
|
66
|
+
# define __IS_32BIT__ // Else assume 32-bit OS/compiler
|
67
|
+
#endif
|
68
|
+
|
69
|
+
#if (defined WIN32 || defined _WIN32)
|
70
|
+
# undef __WINDOWS__
|
71
|
+
# define __WINDOWS__
|
72
|
+
# undef __MSDOS__
|
73
|
+
# define __MSDOS__
|
74
|
+
#endif
|
75
|
+
|
76
|
+
#if (defined WINDOWS || defined _WINDOWS || defined __WINDOWS__)
|
77
|
+
# undef __WINDOWS__
|
78
|
+
# define __WINDOWS__
|
79
|
+
# undef __MSDOS__
|
80
|
+
# define __MSDOS__
|
81
|
+
// Stop cheeky warnings about "deprecated" functions like fopen
|
82
|
+
# if _MSC_VER >= 1500
|
83
|
+
# undef _CRT_SECURE_NO_DEPRECATE
|
84
|
+
# define _CRT_SECURE_NO_DEPRECATE
|
85
|
+
# pragma warning(disable: 4996)
|
86
|
+
# endif
|
87
|
+
#endif
|
88
|
+
|
89
|
+
// MSDOS Microsoft C
|
90
|
+
// _MSC_VER Microsoft C
|
91
|
+
#if (defined (MSDOS) || defined (_MSC_VER))
|
92
|
+
# undef __MSDOS__
|
93
|
+
# define __MSDOS__
|
94
|
+
# if (defined (_DEBUG) && !defined (DEBUG))
|
95
|
+
# define DEBUG
|
96
|
+
# endif
|
97
|
+
#endif
|
98
|
+
|
99
|
+
#if (defined (__EMX__) && defined (__i386__))
|
100
|
+
# undef __OS2__
|
101
|
+
# define __OS2__
|
102
|
+
#endif
|
103
|
+
|
104
|
+
// VMS VAX C (VAX/VMS)
|
105
|
+
// __VMS Dec C (Alpha/OpenVMS)
|
106
|
+
// __vax__ gcc
|
107
|
+
#if (defined (VMS) || defined (__VMS) || defined (__vax__))
|
108
|
+
# undef __VMS__
|
109
|
+
# define __VMS__
|
110
|
+
# if (__VMS_VER >= 70000000)
|
111
|
+
# define __VMS_XOPEN
|
112
|
+
# endif
|
113
|
+
#endif
|
114
|
+
|
115
|
+
// Try to define a __UTYPE_xxx symbol...
|
116
|
+
// unix SunOS at least
|
117
|
+
// __unix__ gcc
|
118
|
+
// _POSIX_SOURCE is various UNIX systems, maybe also VAX/VMS
|
119
|
+
#if (defined (unix) || defined (__unix__) || defined (_POSIX_SOURCE))
|
120
|
+
# if (!defined (__VMS__))
|
121
|
+
# undef __UNIX__
|
122
|
+
# define __UNIX__
|
123
|
+
# if (defined (__alpha)) // Digital UNIX is 64-bit
|
124
|
+
# undef __IS_32BIT__
|
125
|
+
# define __IS_64BIT__
|
126
|
+
# define __UTYPE_DECALPHA
|
127
|
+
# endif
|
128
|
+
# endif
|
129
|
+
#endif
|
130
|
+
|
131
|
+
#if (defined (_AUX))
|
132
|
+
# define __UTYPE_AUX
|
133
|
+
# define __UNIX__
|
134
|
+
#elif (defined (__BEOS__))
|
135
|
+
# define __UTYPE_BEOS
|
136
|
+
# define __UNIX__
|
137
|
+
#elif (defined (__hpux))
|
138
|
+
# define __UTYPE_HPUX
|
139
|
+
# define __UNIX__
|
140
|
+
# define _INCLUDE_HPUX_SOURCE
|
141
|
+
# define _INCLUDE_XOPEN_SOURCE
|
142
|
+
# define _INCLUDE_POSIX_SOURCE
|
143
|
+
#elif (defined (_AIX) || defined (AIX))
|
144
|
+
# define __UTYPE_IBMAIX
|
145
|
+
# define __UNIX__
|
146
|
+
#elif (defined (BSD) || defined (bsd))
|
147
|
+
# define __UTYPE_BSDOS
|
148
|
+
# define __UNIX__
|
149
|
+
#elif (defined (__ANDROID__))
|
150
|
+
# define __UTYPE_ANDROID
|
151
|
+
# define __UNIX__
|
152
|
+
#elif (defined (LINUX) || defined (linux) || defined (__linux__))
|
153
|
+
# define __UTYPE_LINUX
|
154
|
+
# define __UNIX__
|
155
|
+
# ifndef __NO_CTYPE
|
156
|
+
# define __NO_CTYPE // Suppress warnings on tolower()
|
157
|
+
# endif
|
158
|
+
# ifndef _DEFAULT_SOURCE
|
159
|
+
# define _DEFAULT_SOURCE // Include stuff from 4.3 BSD Unix
|
160
|
+
# endif
|
161
|
+
#elif (defined (__GNU__))
|
162
|
+
# define __UTYPE_GNU
|
163
|
+
# define __UNIX__
|
164
|
+
#elif (defined (Mips))
|
165
|
+
# define __UTYPE_MIPS
|
166
|
+
# define __UNIX__
|
167
|
+
#elif (defined (FreeBSD) || defined (__FreeBSD__))
|
168
|
+
# define __UTYPE_FREEBSD
|
169
|
+
# define __UNIX__
|
170
|
+
#elif (defined (NetBSD) || defined (__NetBSD__))
|
171
|
+
# define __UTYPE_NETBSD
|
172
|
+
# define __UNIX__
|
173
|
+
#elif (defined (OpenBSD) || defined (__OpenBSD__))
|
174
|
+
# define __UTYPE_OPENBSD
|
175
|
+
# define __UNIX__
|
176
|
+
#elif (defined (APPLE) || defined (__APPLE__))
|
177
|
+
# include <TargetConditionals.h>
|
178
|
+
# define __UNIX__
|
179
|
+
# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
180
|
+
# define __UTYPE_IOS
|
181
|
+
# else
|
182
|
+
# define __UTYPE_OSX
|
183
|
+
# endif
|
184
|
+
#elif (defined (NeXT))
|
185
|
+
# define __UTYPE_NEXT
|
186
|
+
# define __UNIX__
|
187
|
+
#elif (defined (__QNX__))
|
188
|
+
# define __UTYPE_QNX
|
189
|
+
# define __UNIX__
|
190
|
+
#elif (defined (sgi))
|
191
|
+
# define __UTYPE_IRIX
|
192
|
+
# define __UNIX__
|
193
|
+
#elif (defined (sinix))
|
194
|
+
# define __UTYPE_SINIX
|
195
|
+
# define __UNIX__
|
196
|
+
#elif (defined (SOLARIS) || defined (__SRV4))
|
197
|
+
# define __UTYPE_SUNSOLARIS
|
198
|
+
# define __UNIX__
|
199
|
+
#elif (defined (SUNOS) || defined (SUN) || defined (sun))
|
200
|
+
# define __UTYPE_SUNOS
|
201
|
+
# define __UNIX__
|
202
|
+
#elif (defined (__USLC__) || defined (UnixWare))
|
203
|
+
# define __UTYPE_UNIXWARE
|
204
|
+
# define __UNIX__
|
205
|
+
#elif (defined (__CYGWIN__))
|
206
|
+
# define __UTYPE_CYGWIN
|
207
|
+
# define __UNIX__
|
208
|
+
#elif (defined (__UNIX__))
|
209
|
+
# define __UTYPE_GENERIC
|
210
|
+
#endif
|
211
|
+
|
212
|
+
//- Always include ZeroMQ headers -------------------------------------------
|
213
|
+
|
214
|
+
#include "zmq.h"
|
215
|
+
#if (ZMQ_VERSION < ZMQ_MAKE_VERSION (4, 2, 0))
|
216
|
+
# include "zmq_utils.h"
|
217
|
+
#endif
|
218
|
+
|
219
|
+
//- Standard ANSI include files ---------------------------------------------
|
220
|
+
|
221
|
+
#include <ctype.h>
|
222
|
+
#include <limits.h>
|
223
|
+
#include <stdarg.h>
|
224
|
+
#include <stdio.h>
|
225
|
+
#include <stdlib.h>
|
226
|
+
#include <stddef.h>
|
227
|
+
#include <string.h>
|
228
|
+
#include <time.h>
|
229
|
+
#include <errno.h>
|
230
|
+
#include <float.h>
|
231
|
+
#include <math.h>
|
232
|
+
#include <signal.h>
|
233
|
+
#include <setjmp.h>
|
234
|
+
#include <assert.h>
|
235
|
+
|
236
|
+
//- System-specific include files -------------------------------------------
|
237
|
+
|
238
|
+
#if (defined (__MSDOS__))
|
239
|
+
# if (defined (__WINDOWS__))
|
240
|
+
# if (_WIN32_WINNT < 0x0600)
|
241
|
+
# undef _WIN32_WINNT
|
242
|
+
# define _WIN32_WINNT 0x0600
|
243
|
+
# endif
|
244
|
+
# if (!defined (FD_SETSIZE))
|
245
|
+
# define FD_SETSIZE 1024 // Max. filehandles/sockets
|
246
|
+
# endif
|
247
|
+
# include <direct.h>
|
248
|
+
# include <winsock2.h>
|
249
|
+
# include <windows.h>
|
250
|
+
# include <process.h>
|
251
|
+
# include <ws2tcpip.h> // For getnameinfo ()
|
252
|
+
# include <iphlpapi.h> // For GetAdaptersAddresses ()
|
253
|
+
# endif
|
254
|
+
# include <malloc.h>
|
255
|
+
# include <dos.h>
|
256
|
+
# include <io.h>
|
257
|
+
# include <fcntl.h>
|
258
|
+
# include <sys/types.h>
|
259
|
+
# include <sys/stat.h>
|
260
|
+
# include <sys/utime.h>
|
261
|
+
# include <share.h>
|
262
|
+
#endif
|
263
|
+
|
264
|
+
#if (defined (__UNIX__))
|
265
|
+
# include <fcntl.h>
|
266
|
+
# include <netdb.h>
|
267
|
+
# include <unistd.h>
|
268
|
+
# include <pthread.h>
|
269
|
+
# include <dirent.h>
|
270
|
+
# include <pwd.h>
|
271
|
+
# include <grp.h>
|
272
|
+
# include <utime.h>
|
273
|
+
# include <inttypes.h>
|
274
|
+
# include <syslog.h>
|
275
|
+
# include <sys/types.h>
|
276
|
+
# include <sys/param.h>
|
277
|
+
# include <sys/socket.h>
|
278
|
+
# include <sys/time.h>
|
279
|
+
# include <sys/stat.h>
|
280
|
+
# include <sys/ioctl.h>
|
281
|
+
# include <sys/file.h>
|
282
|
+
# include <sys/wait.h>
|
283
|
+
# include <sys/un.h>
|
284
|
+
# include <sys/uio.h> // Let CZMQ build with libzmq/3.x
|
285
|
+
# include <netinet/in.h> // Must come before arpa/inet.h
|
286
|
+
# if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) \
|
287
|
+
&& (!defined (__UTYPE_HPUX))
|
288
|
+
# include <ifaddrs.h>
|
289
|
+
# endif
|
290
|
+
# if defined (__UTYPE_SUNSOLARIS) || defined (__UTYPE_SUNOS)
|
291
|
+
# include <sys/sockio.h>
|
292
|
+
# endif
|
293
|
+
# if (!defined (__UTYPE_BEOS))
|
294
|
+
# include <arpa/inet.h>
|
295
|
+
# if (!defined (TCP_NODELAY))
|
296
|
+
# include <netinet/tcp.h>
|
297
|
+
# endif
|
298
|
+
# endif
|
299
|
+
# if (defined (__UTYPE_IBMAIX) || defined(__UTYPE_QNX))
|
300
|
+
# include <sys/select.h>
|
301
|
+
# endif
|
302
|
+
# if (defined (__UTYPE_BEOS))
|
303
|
+
# include <NetKit.h>
|
304
|
+
# endif
|
305
|
+
# if ((defined (_XOPEN_REALTIME) && (_XOPEN_REALTIME >= 1)) \
|
306
|
+
|| (defined (_POSIX_VERSION) && (_POSIX_VERSION >= 199309L)))
|
307
|
+
# include <sched.h>
|
308
|
+
# endif
|
309
|
+
# if (defined (__UTYPE_OSX) || defined (__UTYPE_IOS))
|
310
|
+
# include <mach/clock.h>
|
311
|
+
# include <mach/mach.h> // For monotonic clocks
|
312
|
+
# endif
|
313
|
+
# if (defined (__UTYPE_OSX))
|
314
|
+
# include <crt_externs.h> // For _NSGetEnviron()
|
315
|
+
# endif
|
316
|
+
# if (defined (__UTYPE_ANDROID))
|
317
|
+
# include <android/log.h>
|
318
|
+
# endif
|
319
|
+
# if (defined (__UTYPE_LINUX) && defined (HAVE_LIBSYSTEMD))
|
320
|
+
# include <systemd/sd-daemon.h>
|
321
|
+
# endif
|
322
|
+
#endif
|
323
|
+
|
324
|
+
#if (defined (__VMS__))
|
325
|
+
# if (!defined (vaxc))
|
326
|
+
# include <fcntl.h> // Not provided by Vax C
|
327
|
+
# endif
|
328
|
+
# include <netdb.h>
|
329
|
+
# include <unistd.h>
|
330
|
+
# include <pthread.h>
|
331
|
+
# include <unixio.h>
|
332
|
+
# include <unixlib.h>
|
333
|
+
# include <types.h>
|
334
|
+
# include <file.h>
|
335
|
+
# include <socket.h>
|
336
|
+
# include <dirent.h>
|
337
|
+
# include <time.h>
|
338
|
+
# include <pwd.h>
|
339
|
+
# include <stat.h>
|
340
|
+
# include <in.h>
|
341
|
+
# include <inet.h>
|
342
|
+
#endif
|
343
|
+
|
344
|
+
#if (defined (__OS2__))
|
345
|
+
# include <sys/types.h> // Required near top
|
346
|
+
# include <fcntl.h>
|
347
|
+
# include <malloc.h>
|
348
|
+
# include <netdb.h>
|
349
|
+
# include <unistd.h>
|
350
|
+
# include <pthread.h>
|
351
|
+
# include <dirent.h>
|
352
|
+
# include <pwd.h>
|
353
|
+
# include <grp.h>
|
354
|
+
# include <io.h>
|
355
|
+
# include <process.h>
|
356
|
+
# include <sys/param.h>
|
357
|
+
# include <sys/socket.h>
|
358
|
+
# include <sys/select.h>
|
359
|
+
# include <sys/time.h>
|
360
|
+
# include <sys/stat.h>
|
361
|
+
# include <sys/ioctl.h>
|
362
|
+
# include <sys/file.h>
|
363
|
+
# include <sys/wait.h>
|
364
|
+
# include <netinet/in.h> // Must come before arpa/inet.h
|
365
|
+
# include <arpa/inet.h>
|
366
|
+
# include <utime.h>
|
367
|
+
# if (!defined (TCP_NODELAY))
|
368
|
+
# include <netinet/tcp.h>
|
369
|
+
# endif
|
370
|
+
#endif
|
371
|
+
|
372
|
+
// Add missing defines for non-POSIX systems
|
373
|
+
#ifndef S_IRUSR
|
374
|
+
# define S_IRUSR S_IREAD
|
375
|
+
#endif
|
376
|
+
#ifndef S_IWUSR
|
377
|
+
# define S_IWUSR S_IWRITE
|
378
|
+
#endif
|
379
|
+
#ifndef S_ISDIR
|
380
|
+
# define S_ISDIR(m) (((m) & S_IFDIR) != 0)
|
381
|
+
#endif
|
382
|
+
#ifndef S_ISREG
|
383
|
+
# define S_ISREG(m) (((m) & S_IFREG) != 0)
|
384
|
+
#endif
|
385
|
+
|
386
|
+
|
387
|
+
//- Check compiler data type sizes ------------------------------------------
|
388
|
+
|
389
|
+
#if (UCHAR_MAX != 0xFF)
|
390
|
+
# error "Cannot compile: must change definition of 'byte'."
|
391
|
+
#endif
|
392
|
+
#if (USHRT_MAX != 0xFFFFU)
|
393
|
+
# error "Cannot compile: must change definition of 'dbyte'."
|
394
|
+
#endif
|
395
|
+
#if (UINT_MAX != 0xFFFFFFFFU)
|
396
|
+
# error "Cannot compile: must change definition of 'qbyte'."
|
397
|
+
#endif
|
398
|
+
|
399
|
+
//- Data types --------------------------------------------------------------
|
400
|
+
|
401
|
+
typedef unsigned char byte; // Single unsigned byte = 8 bits
|
402
|
+
typedef unsigned short dbyte; // Double byte = 16 bits
|
403
|
+
typedef unsigned int qbyte; // Quad byte = 32 bits
|
404
|
+
typedef struct sockaddr_in inaddr_t; // Internet socket address structure
|
405
|
+
typedef struct sockaddr_in6 in6addr_t; // Internet 6 socket address structure
|
406
|
+
|
407
|
+
// Common structure to hold inaddr_t and in6addr_t with length
|
408
|
+
typedef struct {
|
409
|
+
union {
|
410
|
+
inaddr_t __addr; // IPv4 address
|
411
|
+
in6addr_t __addr6; // IPv6 address
|
412
|
+
} __inaddr_u;
|
413
|
+
#define ipv4addr __inaddr_u.__addr
|
414
|
+
#define ipv6addr __inaddr_u.__addr6
|
415
|
+
int inaddrlen;
|
416
|
+
} inaddr_storage_t;
|
417
|
+
|
418
|
+
//- Inevitable macros -------------------------------------------------------
|
419
|
+
|
420
|
+
#define streq(s1,s2) (!strcmp ((s1), (s2)))
|
421
|
+
#define strneq(s1,s2) (strcmp ((s1), (s2)))
|
422
|
+
|
423
|
+
// Provide random number from 0..(num-1)
|
424
|
+
#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) \
|
425
|
+
|| (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS))
|
426
|
+
# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0))
|
427
|
+
#else
|
428
|
+
# define randof(num) (int) ((float) (num) * random () / (RAND_MAX + 1.0))
|
429
|
+
#endif
|
430
|
+
|
431
|
+
// Windows MSVS doesn't have stdbool
|
432
|
+
#if (defined (_MSC_VER))
|
433
|
+
# if (!defined (__cplusplus) && (!defined (true)))
|
434
|
+
# define true 1
|
435
|
+
# define false 0
|
436
|
+
typedef char bool;
|
437
|
+
# endif
|
438
|
+
#else
|
439
|
+
# include <stdbool.h>
|
440
|
+
#endif
|
441
|
+
|
442
|
+
//- A number of POSIX and C99 keywords and data types -----------------------
|
443
|
+
// CZMQ uses uint for array indices; equivalent to unsigned int, but more
|
444
|
+
// convenient in code. We define it in czmq_prelude.h on systems that do
|
445
|
+
// not define it by default.
|
446
|
+
|
447
|
+
#if (defined (__WINDOWS__))
|
448
|
+
# if (!defined (__cplusplus) && (!defined (inline)))
|
449
|
+
# define inline __inline
|
450
|
+
# endif
|
451
|
+
# define strtoull _strtoui64
|
452
|
+
# define atoll _atoi64
|
453
|
+
# define srandom srand
|
454
|
+
# define TIMEZONE _timezone
|
455
|
+
# if (!defined (__MINGW32__))
|
456
|
+
# define snprintf _snprintf
|
457
|
+
# define vsnprintf _vsnprintf
|
458
|
+
# endif
|
459
|
+
typedef unsigned long ulong;
|
460
|
+
typedef unsigned int uint;
|
461
|
+
# if (!defined (__MINGW32__))
|
462
|
+
typedef int mode_t;
|
463
|
+
# if !defined (_SSIZE_T_DEFINED)
|
464
|
+
typedef intptr_t ssize_t;
|
465
|
+
# define _SSIZE_T_DEFINED
|
466
|
+
# endif
|
467
|
+
# endif
|
468
|
+
# if ((!defined (__MINGW32__) \
|
469
|
+
|| (defined (__MINGW32__) && defined (__IS_64BIT__))) \
|
470
|
+
&& !defined (ZMQ_DEFINED_STDINT))
|
471
|
+
typedef __int8 int8_t;
|
472
|
+
typedef __int16 int16_t;
|
473
|
+
typedef __int32 int32_t;
|
474
|
+
typedef __int64 int64_t;
|
475
|
+
typedef unsigned __int8 uint8_t;
|
476
|
+
typedef unsigned __int16 uint16_t;
|
477
|
+
typedef unsigned __int32 uint32_t;
|
478
|
+
typedef unsigned __int64 uint64_t;
|
479
|
+
# endif
|
480
|
+
typedef uint32_t in_addr_t;
|
481
|
+
# if (!defined (PRId8))
|
482
|
+
# define PRId8 "d"
|
483
|
+
# endif
|
484
|
+
# if (!defined (PRId16))
|
485
|
+
# define PRId16 "d"
|
486
|
+
# endif
|
487
|
+
# if (!defined (PRId32))
|
488
|
+
# define PRId32 "d"
|
489
|
+
# endif
|
490
|
+
# if (!defined (PRId64))
|
491
|
+
# define PRId64 "I64d"
|
492
|
+
# endif
|
493
|
+
# if (!defined (PRIu8))
|
494
|
+
# define PRIu8 "u"
|
495
|
+
# endif
|
496
|
+
# if (!defined (PRIu16))
|
497
|
+
# define PRIu16 "u"
|
498
|
+
# endif
|
499
|
+
# if (!defined (PRIu32))
|
500
|
+
# define PRIu32 "u"
|
501
|
+
# endif
|
502
|
+
# if (!defined (PRIu64))
|
503
|
+
# define PRIu64 "I64u"
|
504
|
+
# endif
|
505
|
+
# if (!defined (va_copy))
|
506
|
+
// MSVC does not support C99's va_copy so we use a regular assignment
|
507
|
+
# define va_copy(dest,src) (dest) = (src)
|
508
|
+
# endif
|
509
|
+
#elif (defined (__UTYPE_OSX))
|
510
|
+
typedef unsigned long ulong;
|
511
|
+
typedef unsigned int uint;
|
512
|
+
// This fixes header-order dependence problem with some Linux versions
|
513
|
+
#elif (defined (__UTYPE_LINUX))
|
514
|
+
# if (__STDC_VERSION__ >= 199901L && !defined (__USE_MISC))
|
515
|
+
typedef unsigned int uint;
|
516
|
+
# endif
|
517
|
+
#endif
|
518
|
+
|
519
|
+
//- Non-portable declaration specifiers -------------------------------------
|
520
|
+
|
521
|
+
// For thread-local storage
|
522
|
+
#if defined (__WINDOWS__)
|
523
|
+
# define CZMQ_THREADLS __declspec(thread)
|
524
|
+
#else
|
525
|
+
# define CZMQ_THREADLS __thread
|
526
|
+
#endif
|
527
|
+
|
528
|
+
// Replacement for malloc() which asserts if we run out of heap, and
|
529
|
+
// which zeroes the allocated block.
|
530
|
+
static inline void *
|
531
|
+
safe_malloc (size_t size, const char *file, unsigned line)
|
532
|
+
{
|
533
|
+
// printf ("%s:%u %08d\n", file, line, (int) size);
|
534
|
+
void *mem = calloc (1, size);
|
535
|
+
if (mem == NULL) {
|
536
|
+
fprintf (stderr, "FATAL ERROR at %s:%u\n", file, line);
|
537
|
+
fprintf (stderr, "OUT OF MEMORY (malloc returned NULL)\n");
|
538
|
+
fflush (stderr);
|
539
|
+
abort ();
|
540
|
+
}
|
541
|
+
return mem;
|
542
|
+
}
|
543
|
+
|
544
|
+
// Define _ZMALLOC_DEBUG if you need to trace memory leaks using e.g. mtrace,
|
545
|
+
// otherwise all allocations will claim to come from czmq_prelude.h. For best
|
546
|
+
// results, compile all classes so you see dangling object allocations.
|
547
|
+
// _ZMALLOC_PEDANTIC does the same thing, but its intention is to propagate
|
548
|
+
// out of memory condition back up the call stack.
|
549
|
+
#if defined (_ZMALLOC_DEBUG) || defined (_ZMALLOC_PEDANTIC)
|
550
|
+
# define zmalloc(size) calloc(1,(size))
|
551
|
+
#else
|
552
|
+
# define zmalloc(size) safe_malloc((size), __FILE__, __LINE__)
|
553
|
+
#endif
|
554
|
+
|
555
|
+
// GCC supports validating format strings for functions that act like printf
|
556
|
+
#if defined (__GNUC__) && (__GNUC__ >= 2)
|
557
|
+
# define CHECK_PRINTF(a) __attribute__((format (printf, a, a + 1)))
|
558
|
+
#else
|
559
|
+
# define CHECK_PRINTF(a)
|
560
|
+
#endif
|
561
|
+
|
562
|
+
// Lets us write code that compiles both on Windows and normal platforms
|
563
|
+
#if !defined (__WINDOWS__)
|
564
|
+
typedef int SOCKET;
|
565
|
+
# define closesocket close
|
566
|
+
# define INVALID_SOCKET -1
|
567
|
+
# define SOCKET_ERROR -1
|
568
|
+
# define O_BINARY 0
|
569
|
+
#endif
|
570
|
+
|
571
|
+
//- Include non-portable header files based on platform.h -------------------
|
572
|
+
|
573
|
+
#if defined (HAVE_LINUX_WIRELESS_H)
|
574
|
+
# include <linux/wireless.h>
|
575
|
+
// This would normally come from net/if.h
|
576
|
+
unsigned int if_nametoindex (const char *ifname);
|
577
|
+
#else
|
578
|
+
# if defined (HAVE_NET_IF_H)
|
579
|
+
# include <net/if.h>
|
580
|
+
# endif
|
581
|
+
# if defined (HAVE_NET_IF_MEDIA_H)
|
582
|
+
# include <net/if_media.h>
|
583
|
+
# endif
|
584
|
+
#endif
|
585
|
+
|
586
|
+
#if defined (__WINDOWS__) && !defined (HAVE_UUID)
|
587
|
+
# define HAVE_UUID 1
|
588
|
+
#endif
|
589
|
+
#if defined (__UTYPE_OSX) && !defined (HAVE_UUID)
|
590
|
+
# define HAVE_UUID 1
|
591
|
+
#endif
|
592
|
+
#if defined (HAVE_UUID)
|
593
|
+
# if defined (__UTYPE_FREEBSD) || defined (__UTYPE_NETBSD)
|
594
|
+
# include <uuid.h>
|
595
|
+
# elif defined __UTYPE_HPUX
|
596
|
+
# include <dce/uuid.h>
|
597
|
+
# elif defined (__UNIX__)
|
598
|
+
# include <uuid/uuid.h>
|
599
|
+
# endif
|
600
|
+
#endif
|
601
|
+
|
602
|
+
// ZMQ compatibility macros
|
603
|
+
|
604
|
+
#if ZMQ_VERSION_MAJOR == 4
|
605
|
+
# define ZMQ_POLL_MSEC 1 // zmq_poll is msec
|
606
|
+
|
607
|
+
#elif ZMQ_VERSION_MAJOR == 3
|
608
|
+
# define ZMQ_POLL_MSEC 1 // zmq_poll is msec
|
609
|
+
# if ZMQ_VERSION_MINOR < 2
|
610
|
+
# define zmq_ctx_new zmq_init
|
611
|
+
# endif
|
612
|
+
# define zmq_ctx_term zmq_term
|
613
|
+
|
614
|
+
#elif ZMQ_VERSION_MAJOR == 2
|
615
|
+
# define ZMQ_POLL_MSEC 1000 // zmq_poll is usec
|
616
|
+
# define zmq_sendmsg zmq_send // Smooth out 2.x changes
|
617
|
+
# define zmq_recvmsg zmq_recv
|
618
|
+
# define zmq_ctx_new zmq_init
|
619
|
+
# define zmq_ctx_term zmq_term
|
620
|
+
# define zmq_msg_send(m,s,f) zmq_sendmsg ((s),(m),(f))
|
621
|
+
# define zmq_msg_recv(m,s,f) zmq_recvmsg ((s),(m),(f))
|
622
|
+
// Older libzmq APIs may be missing some aspects of libzmq v3.0
|
623
|
+
# ifndef ZMQ_ROUTER
|
624
|
+
# define ZMQ_ROUTER ZMQ_XREP
|
625
|
+
# endif
|
626
|
+
# ifndef ZMQ_DEALER
|
627
|
+
# define ZMQ_DEALER ZMQ_XREQ
|
628
|
+
# endif
|
629
|
+
# ifndef ZMQ_DONTWAIT
|
630
|
+
# define ZMQ_DONTWAIT ZMQ_NOBLOCK
|
631
|
+
# endif
|
632
|
+
# ifndef ZMQ_XSUB
|
633
|
+
# error "please upgrade your libzmq from http://zeromq.org"
|
634
|
+
# endif
|
635
|
+
# if ZMQ_VERSION_MINOR == 0 \
|
636
|
+
|| (ZMQ_VERSION_MINOR == 1 && ZMQ_VERSION_PATCH < 7)
|
637
|
+
# error "CZMQ requires at least libzmq/2.1.7 stable"
|
638
|
+
# endif
|
639
|
+
#endif
|
640
|
+
|
641
|
+
#endif
|