czmq-ffi-gen 0.9.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +1 -0
  3. data/CHANGES.md +88 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE +14 -0
  6. data/README.md +112 -0
  7. data/lib/czmq-ffi-gen.rb +7 -0
  8. data/lib/czmq-ffi-gen/czmq/ffi.rb +1210 -0
  9. data/lib/czmq-ffi-gen/czmq/ffi/version.rb +15 -0
  10. data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +186 -0
  11. data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +286 -0
  12. data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +307 -0
  13. data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +222 -0
  14. data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +388 -0
  15. data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +140 -0
  16. data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +442 -0
  17. data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +156 -0
  18. data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +283 -0
  19. data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +194 -0
  20. data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +353 -0
  21. data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +359 -0
  22. data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +416 -0
  23. data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +659 -0
  24. data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +189 -0
  25. data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +365 -0
  26. data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +478 -0
  27. data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +396 -0
  28. data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +515 -0
  29. data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +194 -0
  30. data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +294 -0
  31. data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +3479 -0
  32. data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +203 -0
  33. data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +203 -0
  34. data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +221 -0
  35. data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +227 -0
  36. data/lib/czmq-ffi-gen/errors.rb +12 -0
  37. data/lib/czmq-ffi-gen/gem_version.rb +5 -0
  38. data/lib/czmq-ffi-gen/legacy.rb +16 -0
  39. data/lib/czmq-ffi-gen/libzmq.rb +18 -0
  40. data/lib/czmq-ffi-gen/signals.rb +27 -0
  41. data/lib/czmq-ffi-gen/vendor.rb +5 -0
  42. data/lib/czmq-ffi-gen/versions.rb +19 -0
  43. data/vendor/local/bin/inproc_lat.exe +0 -0
  44. data/vendor/local/bin/inproc_thr.exe +0 -0
  45. data/vendor/local/bin/libczmq.dll +0 -0
  46. data/vendor/local/bin/libgcc_s_sjlj-1.dll +0 -0
  47. data/vendor/local/bin/libstdc++-6.dll +0 -0
  48. data/vendor/local/bin/libzmq.dll +0 -0
  49. data/vendor/local/bin/local_lat.exe +0 -0
  50. data/vendor/local/bin/local_thr.exe +0 -0
  51. data/vendor/local/bin/remote_lat.exe +0 -0
  52. data/vendor/local/bin/remote_thr.exe +0 -0
  53. data/vendor/local/include/czmq.h +31 -0
  54. data/vendor/local/include/czmq_library.h +199 -0
  55. data/vendor/local/include/czmq_prelude.h +641 -0
  56. data/vendor/local/include/readme.txt +83 -0
  57. data/vendor/local/include/sha1.h +76 -0
  58. data/vendor/local/include/sha1.inc_c +335 -0
  59. data/vendor/local/include/slre.h +92 -0
  60. data/vendor/local/include/slre.inc_c +660 -0
  61. data/vendor/local/include/zactor.h +76 -0
  62. data/vendor/local/include/zarmour.h +114 -0
  63. data/vendor/local/include/zauth.h +100 -0
  64. data/vendor/local/include/zauth_v2.h +88 -0
  65. data/vendor/local/include/zbeacon.h +86 -0
  66. data/vendor/local/include/zbeacon_v2.h +75 -0
  67. data/vendor/local/include/zcert.h +136 -0
  68. data/vendor/local/include/zcertstore.h +100 -0
  69. data/vendor/local/include/zchunk.h +163 -0
  70. data/vendor/local/include/zclock.h +73 -0
  71. data/vendor/local/include/zconfig.h +185 -0
  72. data/vendor/local/include/zctx.h +107 -0
  73. data/vendor/local/include/zdigest.h +65 -0
  74. data/vendor/local/include/zdir.h +149 -0
  75. data/vendor/local/include/zdir_patch.h +82 -0
  76. data/vendor/local/include/zfile.h +177 -0
  77. data/vendor/local/include/zframe.h +176 -0
  78. data/vendor/local/include/zgossip.h +95 -0
  79. data/vendor/local/include/zgossip_engine.inc +927 -0
  80. data/vendor/local/include/zgossip_msg.h +129 -0
  81. data/vendor/local/include/zhash.h +195 -0
  82. data/vendor/local/include/zhash_primes.inc +329 -0
  83. data/vendor/local/include/zhashx.h +298 -0
  84. data/vendor/local/include/ziflist.h +77 -0
  85. data/vendor/local/include/zlist.h +158 -0
  86. data/vendor/local/include/zlistx.h +205 -0
  87. data/vendor/local/include/zloop.h +168 -0
  88. data/vendor/local/include/zmonitor.h +73 -0
  89. data/vendor/local/include/zmonitor_v2.h +56 -0
  90. data/vendor/local/include/zmq.h +617 -0
  91. data/vendor/local/include/zmq_utils.h +48 -0
  92. data/vendor/local/include/zmsg.h +280 -0
  93. data/vendor/local/include/zmutex.h +55 -0
  94. data/vendor/local/include/zpoller.h +92 -0
  95. data/vendor/local/include/zproc.h +168 -0
  96. data/vendor/local/include/zproxy.h +111 -0
  97. data/vendor/local/include/zproxy_v2.h +62 -0
  98. data/vendor/local/include/zrex.h +82 -0
  99. data/vendor/local/include/zsock.h +912 -0
  100. data/vendor/local/include/zsock_option.inc +4126 -0
  101. data/vendor/local/include/zsocket.h +110 -0
  102. data/vendor/local/include/zsockopt.h +256 -0
  103. data/vendor/local/include/zstr.h +110 -0
  104. data/vendor/local/include/zsys.h +386 -0
  105. data/vendor/local/include/zthread.h +50 -0
  106. data/vendor/local/include/ztimerset.h +90 -0
  107. data/vendor/local/include/ztrie.h +106 -0
  108. data/vendor/local/include/zuuid.h +96 -0
  109. data/vendor/local/lib/libczmq.dll.a +0 -0
  110. data/vendor/local/lib/liblibzmq.dll.a +0 -0
  111. data/vendor/local/lib/libzmq-static.a +0 -0
  112. data/vendor/local/lib/pkgconfig/libczmq.pc +23 -0
  113. data/vendor/local/lib/pkgconfig/libzmq.pc +11 -0
  114. data/vendor/local/share/zmq/AUTHORS.txt +147 -0
  115. data/vendor/local/share/zmq/COPYING.LESSER.txt +181 -0
  116. data/vendor/local/share/zmq/COPYING.txt +674 -0
  117. data/vendor/local/share/zmq/NEWS.txt +978 -0
  118. metadata +230 -0
@@ -0,0 +1,386 @@
1
+ /* =========================================================================
2
+ zsys - system-level methods
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 __ZSYS_H_INCLUDED__
15
+ #define __ZSYS_H_INCLUDED__
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ // @interface
22
+ #define UDP_FRAME_MAX 255 // Max size of UDP frame
23
+
24
+ // Callback for interrupt signal handler
25
+ typedef void (zsys_handler_fn) (int signal_value);
26
+
27
+ // Initialize CZMQ zsys layer; this happens automatically when you create
28
+ // a socket or an actor; however this call lets you force initialization
29
+ // earlier, so e.g. logging is properly set-up before you start working.
30
+ // Not threadsafe, so call only from main thread. Safe to call multiple
31
+ // times. Returns global CZMQ context.
32
+ CZMQ_EXPORT void *
33
+ zsys_init (void);
34
+
35
+ // Optionally shut down the CZMQ zsys layer; this normally happens automatically
36
+ // when the process exits; however this call lets you force a shutdown
37
+ // earlier, avoiding any potential problems with atexit() ordering, especially
38
+ // with Windows dlls.
39
+ CZMQ_EXPORT void
40
+ zsys_shutdown (void);
41
+
42
+ // Get a new ZMQ socket, automagically creating a ZMQ context if this is
43
+ // the first time. Caller is responsible for destroying the ZMQ socket
44
+ // before process exits, to avoid a ZMQ deadlock. Note: you should not use
45
+ // this method in CZMQ apps, use zsock_new() instead.
46
+ // *** This is for CZMQ internal use only and may change arbitrarily ***
47
+ CZMQ_EXPORT void *
48
+ zsys_socket (int type, const char *filename, size_t line_nbr);
49
+
50
+ // Destroy/close a ZMQ socket. You should call this for every socket you
51
+ // create using zsys_socket().
52
+ // *** This is for CZMQ internal use only and may change arbitrarily ***
53
+ CZMQ_EXPORT int
54
+ zsys_close (void *handle, const char *filename, size_t line_nbr);
55
+
56
+ // Return ZMQ socket name for socket type
57
+ // *** This is for CZMQ internal use only and may change arbitrarily ***
58
+ CZMQ_EXPORT char *
59
+ zsys_sockname (int socktype);
60
+
61
+ // Create a pipe, which consists of two PAIR sockets connected over inproc.
62
+ // The pipe is configured to use the zsys_pipehwm setting. Returns the
63
+ // frontend socket successful, NULL if failed.
64
+ CZMQ_EXPORT zsock_t *
65
+ zsys_create_pipe (zsock_t **backend_p);
66
+
67
+ // Set interrupt handler; this saves the default handlers so that a
68
+ // zsys_handler_reset () can restore them. If you call this multiple times
69
+ // then the last handler will take affect. If handler_fn is NULL, disables
70
+ // default SIGINT/SIGTERM handling in CZMQ.
71
+ CZMQ_EXPORT void
72
+ zsys_handler_set (zsys_handler_fn *handler_fn);
73
+
74
+ // Reset interrupt handler, call this at exit if needed
75
+ CZMQ_EXPORT void
76
+ zsys_handler_reset (void);
77
+
78
+ // Set default interrupt handler, so Ctrl-C or SIGTERM will set
79
+ // zsys_interrupted. Idempotent; safe to call multiple times.
80
+ // *** This is for CZMQ internal use only and may change arbitrarily ***
81
+ CZMQ_EXPORT void
82
+ zsys_catch_interrupts (void);
83
+
84
+ // Return 1 if file exists, else zero
85
+ CZMQ_EXPORT bool
86
+ zsys_file_exists (const char *filename);
87
+
88
+ // Return size of file, or -1 if not found
89
+ CZMQ_EXPORT ssize_t
90
+ zsys_file_size (const char *filename);
91
+
92
+ // Return file modification time. Returns 0 if the file does not exist.
93
+ CZMQ_EXPORT time_t
94
+ zsys_file_modified (const char *filename);
95
+
96
+ // Return file mode; provides at least support for the POSIX S_ISREG(m)
97
+ // and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes.
98
+ // Returns a mode_t cast to int, or -1 in case of error.
99
+ CZMQ_EXPORT int
100
+ zsys_file_mode (const char *filename);
101
+
102
+ // Delete file. Does not complain if the file is absent
103
+ CZMQ_EXPORT int
104
+ zsys_file_delete (const char *filename);
105
+
106
+ // Check if file is 'stable'
107
+ CZMQ_EXPORT bool
108
+ zsys_file_stable (const char *filename);
109
+
110
+ // Create a file path if it doesn't exist. The file path is treated as a
111
+ // printf format.
112
+ CZMQ_EXPORT int
113
+ zsys_dir_create (const char *pathname, ...);
114
+
115
+ // Remove a file path if empty; the pathname is treated as printf format.
116
+ CZMQ_EXPORT int
117
+ zsys_dir_delete (const char *pathname, ...);
118
+
119
+ // Move to a specified working directory. Returns 0 if OK, -1 if this failed.
120
+ CZMQ_EXPORT int
121
+ zsys_dir_change (const char *pathname);
122
+
123
+ // Set private file creation mode; all files created from here will be
124
+ // readable/writable by the owner only.
125
+ CZMQ_EXPORT void
126
+ zsys_file_mode_private (void);
127
+
128
+ // Reset default file creation mode; all files created from here will use
129
+ // process file mode defaults.
130
+ CZMQ_EXPORT void
131
+ zsys_file_mode_default (void);
132
+
133
+ // Return the CZMQ version for run-time API detection; returns version
134
+ // number into provided fields, providing reference isn't null in each case.
135
+ CZMQ_EXPORT void
136
+ zsys_version (int *major, int *minor, int *patch);
137
+
138
+ // Format a string using printf formatting, returning a freshly allocated
139
+ // buffer. If there was insufficient memory, returns NULL. Free the returned
140
+ // string using zstr_free().
141
+ CZMQ_EXPORT char *
142
+ zsys_sprintf (const char *format, ...);
143
+
144
+ // Format a string with a va_list argument, returning a freshly allocated
145
+ // buffer. If there was insufficient memory, returns NULL. Free the returned
146
+ // string using zstr_free().
147
+ CZMQ_EXPORT char *
148
+ zsys_vprintf (const char *format, va_list argptr);
149
+
150
+ // Create UDP beacon socket; if the routable option is true, uses
151
+ // multicast (not yet implemented), else uses broadcast. This method
152
+ // and related ones might _eventually_ be moved to a zudp class.
153
+ // *** This is for CZMQ internal use only and may change arbitrarily ***
154
+ CZMQ_EXPORT SOCKET
155
+ zsys_udp_new (bool routable);
156
+
157
+ // Close a UDP socket
158
+ // *** This is for CZMQ internal use only and may change arbitrarily ***
159
+ CZMQ_EXPORT int
160
+ zsys_udp_close (SOCKET handle);
161
+
162
+ // Send zframe to UDP socket, return -1 if sending failed due to
163
+ // interface having disappeared (happens easily with WiFi)
164
+ // *** This is for CZMQ internal use only and may change arbitrarily ***
165
+ CZMQ_EXPORT int
166
+ zsys_udp_send (SOCKET udpsock, zframe_t *frame, inaddr_t *address, int addrlen);
167
+
168
+ // Receive zframe from UDP socket, and set address of peer that sent it
169
+ // The peername must be a char [INET_ADDRSTRLEN] array.
170
+ // *** This is for CZMQ internal use only and may change arbitrarily ***
171
+ CZMQ_EXPORT zframe_t *
172
+ zsys_udp_recv (SOCKET udpsock, char *peername, int peerlen);
173
+
174
+ // Handle an I/O error on some socket operation; will report and die on
175
+ // fatal errors, and continue silently on "try again" errors.
176
+ // *** This is for CZMQ internal use only and may change arbitrarily ***
177
+ CZMQ_EXPORT void
178
+ zsys_socket_error (const char *reason);
179
+
180
+ // Return current host name, for use in public tcp:// endpoints. Caller gets
181
+ // a freshly allocated string, should free it using zstr_free(). If the host
182
+ // name is not resolvable, returns NULL.
183
+ CZMQ_EXPORT char *
184
+ zsys_hostname (void);
185
+
186
+ // Move the current process into the background. The precise effect depends
187
+ // on the operating system. On POSIX boxes, moves to a specified working
188
+ // directory (if specified), closes all file handles, reopens stdin, stdout,
189
+ // and stderr to the null device, and sets the process to ignore SIGHUP. On
190
+ // Windows, does nothing. Returns 0 if OK, -1 if there was an error.
191
+ CZMQ_EXPORT int
192
+ zsys_daemonize (const char *workdir);
193
+
194
+ // Drop the process ID into the lockfile, with exclusive lock, and switch
195
+ // the process to the specified group and/or user. Any of the arguments
196
+ // may be null, indicating a no-op. Returns 0 on success, -1 on failure.
197
+ // Note if you combine this with zsys_daemonize, run after, not before
198
+ // that method, or the lockfile will hold the wrong process ID.
199
+ CZMQ_EXPORT int
200
+ zsys_run_as (const char *lockfile, const char *group, const char *user);
201
+
202
+ // Returns true if the underlying libzmq supports CURVE security.
203
+ // Uses a heuristic probe according to the version of libzmq being used.
204
+ CZMQ_EXPORT bool
205
+ zsys_has_curve (void);
206
+
207
+ // Configure the number of I/O threads that ZeroMQ will use. A good
208
+ // rule of thumb is one thread per gigabit of traffic in or out. The
209
+ // default is 1, sufficient for most applications. If the environment
210
+ // variable ZSYS_IO_THREADS is defined, that provides the default.
211
+ // Note that this method is valid only before any socket is created.
212
+ CZMQ_EXPORT void
213
+ zsys_set_io_threads (size_t io_threads);
214
+
215
+ // Configure the number of sockets that ZeroMQ will allow. The default
216
+ // is 1024. The actual limit depends on the system, and you can query it
217
+ // by using zsys_socket_limit (). A value of zero means "maximum".
218
+ // Note that this method is valid only before any socket is created.
219
+ CZMQ_EXPORT void
220
+ zsys_set_max_sockets (size_t max_sockets);
221
+
222
+ // Return maximum number of ZeroMQ sockets that the system will support.
223
+ CZMQ_EXPORT size_t
224
+ zsys_socket_limit (void);
225
+
226
+ // Configure the default linger timeout in msecs for new zsock instances.
227
+ // You can also set this separately on each zsock_t instance. The default
228
+ // linger time is zero, i.e. any pending messages will be dropped. If the
229
+ // environment variable ZSYS_LINGER is defined, that provides the default.
230
+ // Note that process exit will typically be delayed by the linger time.
231
+ CZMQ_EXPORT void
232
+ zsys_set_linger (size_t linger);
233
+
234
+ // Configure the default outgoing pipe limit (HWM) for new zsock instances.
235
+ // You can also set this separately on each zsock_t instance. The default
236
+ // HWM is 1,000, on all versions of ZeroMQ. If the environment variable
237
+ // ZSYS_SNDHWM is defined, that provides the default. Note that a value of
238
+ // zero means no limit, i.e. infinite memory consumption.
239
+ CZMQ_EXPORT void
240
+ zsys_set_sndhwm (size_t sndhwm);
241
+
242
+ // Configure the default incoming pipe limit (HWM) for new zsock instances.
243
+ // You can also set this separately on each zsock_t instance. The default
244
+ // HWM is 1,000, on all versions of ZeroMQ. If the environment variable
245
+ // ZSYS_RCVHWM is defined, that provides the default. Note that a value of
246
+ // zero means no limit, i.e. infinite memory consumption.
247
+ CZMQ_EXPORT void
248
+ zsys_set_rcvhwm (size_t rcvhwm);
249
+
250
+ // Configure the default HWM for zactor internal pipes; this is set on both
251
+ // ends of the pipe, for outgoing messages only (sndhwm). The default HWM is
252
+ // 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is
253
+ // defined, that provides the default. Note that a value of zero means no
254
+ // limit, i.e. infinite memory consumption.
255
+ CZMQ_EXPORT void
256
+ zsys_set_pipehwm (size_t pipehwm);
257
+
258
+ // Return the HWM for zactor internal pipes.
259
+ CZMQ_EXPORT size_t
260
+ zsys_pipehwm (void);
261
+
262
+ // Configure use of IPv6 for new zsock instances. By default sockets accept
263
+ // and make only IPv4 connections. When you enable IPv6, sockets will accept
264
+ // and connect to both IPv4 and IPv6 peers. You can override the setting on
265
+ // each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the
266
+ // environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the
267
+ // default. Note: has no effect on ZMQ v2.
268
+ CZMQ_EXPORT void
269
+ zsys_set_ipv6 (int ipv6);
270
+
271
+ // Return use of IPv6 for zsock instances.
272
+ CZMQ_EXPORT int
273
+ zsys_ipv6 (void);
274
+
275
+ // Set network interface name to use for broadcasts, particularly zbeacon.
276
+ // This lets the interface be configured for test environments where required.
277
+ // For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is
278
+ // the default when there is no specified interface. If the environment
279
+ // variable ZSYS_INTERFACE is set, use that as the default interface name.
280
+ // Setting the interface to "*" means "use all available interfaces".
281
+ CZMQ_EXPORT void
282
+ zsys_set_interface (const char *value);
283
+
284
+ // Return network interface to use for broadcasts, or "" if none was set.
285
+ CZMQ_EXPORT const char *
286
+ zsys_interface (void);
287
+
288
+ // Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon.
289
+ // This needs to be set IPv6 is enabled as IPv6 can have multiple addresses
290
+ // on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set,
291
+ // use that as the default IPv6 address.
292
+ CZMQ_EXPORT void
293
+ zsys_set_ipv6_address (const char *value);
294
+
295
+ // Return IPv6 address to use for zbeacon reception, or "" if none was set.
296
+ CZMQ_EXPORT const char *
297
+ zsys_ipv6_address (void);
298
+
299
+ // Set IPv6 milticast address to use for sending zbeacon messages. This needs
300
+ // to be set if IPv6 is enabled. If the environment variable
301
+ // ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast
302
+ // address.
303
+ CZMQ_EXPORT void
304
+ zsys_set_ipv6_mcast_address (const char *value);
305
+
306
+ // Return IPv6 multicast address to use for sending zbeacon, or "" if none was
307
+ // set.
308
+ CZMQ_EXPORT const char *
309
+ zsys_ipv6_mcast_address (void);
310
+
311
+ // Configure the automatic use of pre-allocated FDs when creating new sockets.
312
+ // If 0 (default), nothing will happen. Else, when a new socket is bound, the
313
+ // system API will be used to check if an existing pre-allocated FD with a
314
+ // matching port (if TCP) or path (if IPC) exists, and if it does it will be
315
+ // set via the ZMQ_USE_FD socket option so that the library will use it
316
+ // instead of creating a new socket.
317
+ CZMQ_EXPORT void
318
+ zsys_set_auto_use_fd (int auto_use_fd);
319
+
320
+ // Return use of automatic pre-allocated FDs for zsock instances.
321
+ CZMQ_EXPORT int
322
+ zsys_auto_use_fd (void);
323
+
324
+ // Set log identity, which is a string that prefixes all log messages sent
325
+ // by this process. The log identity defaults to the environment variable
326
+ // ZSYS_LOGIDENT, if that is set.
327
+ CZMQ_EXPORT void
328
+ zsys_set_logident (const char *value);
329
+
330
+ // Set stream to receive log traffic. By default, log traffic is sent to
331
+ // stdout. If you set the stream to NULL, no stream will receive the log
332
+ // traffic (it may still be sent to the system facility).
333
+ CZMQ_EXPORT void
334
+ zsys_set_logstream (FILE *stream);
335
+
336
+ // Sends log output to a PUB socket bound to the specified endpoint. To
337
+ // collect such log output, create a SUB socket, subscribe to the traffic
338
+ // you care about, and connect to the endpoint. Log traffic is sent as a
339
+ // single string frame, in the same format as when sent to stdout. The
340
+ // log system supports a single sender; multiple calls to this method will
341
+ // bind the same sender to multiple endpoints. To disable the sender, call
342
+ // this method with a null argument.
343
+ CZMQ_EXPORT void
344
+ zsys_set_logsender (const char *endpoint);
345
+
346
+ // Enable or disable logging to the system facility (syslog on POSIX boxes,
347
+ // event log on Windows). By default this is disabled.
348
+ CZMQ_EXPORT void
349
+ zsys_set_logsystem (bool logsystem);
350
+
351
+ // Log error condition - highest priority
352
+ CZMQ_EXPORT void
353
+ zsys_error (const char *format, ...);
354
+
355
+ // Log warning condition - high priority
356
+ CZMQ_EXPORT void
357
+ zsys_warning (const char *format, ...);
358
+
359
+ // Log normal, but significant, condition - normal priority
360
+ CZMQ_EXPORT void
361
+ zsys_notice (const char *format, ...);
362
+
363
+ // Log informational message - low priority
364
+ CZMQ_EXPORT void
365
+ zsys_info (const char *format, ...);
366
+
367
+ // Log debug-level message - lowest priority
368
+ CZMQ_EXPORT void
369
+ zsys_debug (const char *format, ...);
370
+
371
+ // Self test of this class
372
+ CZMQ_EXPORT void
373
+ zsys_test (bool verbose);
374
+
375
+ // Global signal indicator, TRUE when user presses Ctrl-C or the process
376
+ // gets a SIGTERM signal.
377
+ CZMQ_EXPORT extern volatile int zsys_interrupted;
378
+ // Deprecated name for this variable
379
+ CZMQ_EXPORT extern volatile int zctx_interrupted;
380
+ // @end
381
+
382
+ #ifdef __cplusplus
383
+ }
384
+ #endif
385
+
386
+ #endif
@@ -0,0 +1,50 @@
1
+ /* =========================================================================
2
+ zthread - working with system threads (deprecated)
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 __ZTHREAD_H_INCLUDED__
15
+ #define __ZTHREAD_H_INCLUDED__
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ // @interface
22
+ // Detached threads follow POSIX pthreads API
23
+ typedef void *(zthread_detached_fn) (void *args);
24
+
25
+ // Attached threads get context and pipe from parent
26
+ typedef void (zthread_attached_fn) (void *args, zctx_t *ctx, void *pipe);
27
+
28
+ // Create a detached thread. A detached thread operates autonomously
29
+ // and is used to simulate a separate process. It gets no ctx, and no
30
+ // pipe.
31
+ CZMQ_EXPORT int
32
+ zthread_new (zthread_detached_fn *thread_fn, void *args);
33
+
34
+ // Create an attached thread. An attached thread gets a ctx and a PAIR
35
+ // pipe back to its parent. It must monitor its pipe, and exit if the
36
+ // pipe becomes unreadable. Do not destroy the ctx, the thread does this
37
+ // automatically when it ends.
38
+ CZMQ_EXPORT void *
39
+ zthread_fork (zctx_t *ctx, zthread_attached_fn *thread_fn, void *args);
40
+
41
+ // Self test of this class
42
+ CZMQ_EXPORT void
43
+ zthread_test (bool verbose);
44
+ // @end
45
+
46
+ #ifdef __cplusplus
47
+ }
48
+ #endif
49
+
50
+ #endif
@@ -0,0 +1,90 @@
1
+ /* =========================================================================
2
+ ztimerset - timer set
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 ZTIMERSET_H_INCLUDED
15
+ #define ZTIMERSET_H_INCLUDED
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ // @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
22
+ // @warning Please edit the model at "api/ztimerset.api" to make changes.
23
+ // @interface
24
+ // This is a draft class, and may change without notice. It is disabled in
25
+ // stable builds by default. If you use this in applications, please ask
26
+ // for it to be pushed to stable state. Use --enable-drafts to enable.
27
+ #ifdef CZMQ_BUILD_DRAFT_API
28
+ // Callback function for timer event.
29
+ typedef void (ztimerset_fn) (
30
+ int timer_id, void *arg);
31
+
32
+ // *** Draft method, for development use, may change without warning ***
33
+ // Create new timer set.
34
+ CZMQ_EXPORT ztimerset_t *
35
+ ztimerset_new (void);
36
+
37
+ // *** Draft method, for development use, may change without warning ***
38
+ // Destroy a timer set
39
+ CZMQ_EXPORT void
40
+ ztimerset_destroy (ztimerset_t **self_p);
41
+
42
+ // *** Draft method, for development use, may change without warning ***
43
+ // Add a timer to the set. Returns timer id if OK, -1 on failure.
44
+ CZMQ_EXPORT int
45
+ ztimerset_add (ztimerset_t *self, size_t interval, ztimerset_fn handler, void *arg);
46
+
47
+ // *** Draft method, for development use, may change without warning ***
48
+ // Cancel a timer. Returns 0 if OK, -1 on failure.
49
+ CZMQ_EXPORT int
50
+ ztimerset_cancel (ztimerset_t *self, int timer_id);
51
+
52
+ // *** Draft method, for development use, may change without warning ***
53
+ // Set timer interval. Returns 0 if OK, -1 on failure.
54
+ // This method is slow, canceling the timer and adding a new one yield better performance.
55
+ CZMQ_EXPORT int
56
+ ztimerset_set_interval (ztimerset_t *self, int timer_id, size_t interval);
57
+
58
+ // *** Draft method, for development use, may change without warning ***
59
+ // Reset timer to start interval counting from current time. Returns 0 if OK, -1 on failure.
60
+ // This method is slow, canceling the timer and adding a new one yield better performance.
61
+ CZMQ_EXPORT int
62
+ ztimerset_reset (ztimerset_t *self, int timer_id);
63
+
64
+ // *** Draft method, for development use, may change without warning ***
65
+ // Return the time until the next interval.
66
+ // Should be used as timeout parameter for the zpoller wait method.
67
+ // The timeout is in msec.
68
+ CZMQ_EXPORT int
69
+ ztimerset_timeout (ztimerset_t *self);
70
+
71
+ // *** Draft method, for development use, may change without warning ***
72
+ // Invoke callback function of all timers which their interval has elapsed.
73
+ // Should be call after zpoller wait method.
74
+ // Returns 0 if OK, -1 on failure.
75
+ CZMQ_EXPORT int
76
+ ztimerset_execute (ztimerset_t *self);
77
+
78
+ // *** Draft method, for development use, may change without warning ***
79
+ // Self test of this class.
80
+ CZMQ_EXPORT void
81
+ ztimerset_test (bool verbose);
82
+
83
+ #endif // CZMQ_BUILD_DRAFT_API
84
+ // @end
85
+
86
+ #ifdef __cplusplus
87
+ }
88
+ #endif
89
+
90
+ #endif