czmq-ffi-gen 0.13.0-x86-mingw32 → 0.14.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -0
  3. data/lib/czmq-ffi-gen/czmq/ffi.rb +224 -698
  4. data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +40 -7
  5. data/lib/czmq-ffi-gen/czmq/ffi/zargs.rb +259 -0
  6. data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +3 -3
  7. data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +15 -6
  8. data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +25 -11
  9. data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +18 -18
  10. data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +6 -6
  11. data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +27 -17
  12. data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +4 -4
  13. data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +36 -36
  14. data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +1 -1
  15. data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +27 -19
  16. data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +22 -21
  17. data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +54 -54
  18. data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +82 -80
  19. data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +30 -0
  20. data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +30 -30
  21. data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +44 -44
  22. data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +39 -39
  23. data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +46 -46
  24. data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +16 -16
  25. data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +237 -34
  26. data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +1201 -973
  27. data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +58 -19
  28. data/lib/czmq-ffi-gen/czmq/ffi/zsys.rb +836 -0
  29. data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +6 -6
  30. data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +10 -10
  31. data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +4 -4
  32. data/lib/czmq-ffi-gen/gem_version.rb +1 -1
  33. data/lib/czmq-ffi-gen/vendor.rb +9 -1
  34. data/vendor/local/bin/inproc_lat.exe +0 -0
  35. data/vendor/local/bin/inproc_thr.exe +0 -0
  36. data/vendor/local/bin/libczmq.dll +0 -0
  37. data/vendor/local/bin/libzmq.dll +0 -0
  38. data/vendor/local/bin/local_lat.exe +0 -0
  39. data/vendor/local/bin/local_thr.exe +0 -0
  40. data/vendor/local/bin/remote_lat.exe +0 -0
  41. data/vendor/local/bin/remote_thr.exe +0 -0
  42. data/vendor/local/bin/zmakecert.exe +0 -0
  43. data/vendor/local/include/czmq_library.h +18 -9
  44. data/vendor/local/include/czmq_prelude.h +104 -16
  45. data/vendor/local/include/zactor.h +25 -7
  46. data/vendor/local/include/zarmour.h +3 -3
  47. data/vendor/local/include/zcert.h +11 -6
  48. data/vendor/local/include/zcertstore.h +18 -9
  49. data/vendor/local/include/zchunk.h +18 -18
  50. data/vendor/local/include/zclock.h +6 -6
  51. data/vendor/local/include/zconfig.h +25 -16
  52. data/vendor/local/include/zdigest.h +4 -4
  53. data/vendor/local/include/zdir.h +36 -36
  54. data/vendor/local/include/zdir_patch.h +1 -1
  55. data/vendor/local/include/zfile.h +27 -19
  56. data/vendor/local/include/zframe.h +22 -21
  57. data/vendor/local/include/zgossip.h +5 -5
  58. data/vendor/local/include/zgossip_engine.inc +103 -22
  59. data/vendor/local/include/zgossip_msg.h +28 -30
  60. data/vendor/local/include/zhash.h +53 -53
  61. data/vendor/local/include/zhashx.h +75 -73
  62. data/vendor/local/include/ziflist.h +22 -1
  63. data/vendor/local/include/zlist.h +28 -28
  64. data/vendor/local/include/zlistx.h +41 -41
  65. data/vendor/local/include/zloop.h +36 -36
  66. data/vendor/local/include/zmsg.h +46 -46
  67. data/vendor/local/include/zpoller.h +16 -16
  68. data/vendor/local/include/zsock.h +414 -364
  69. data/vendor/local/include/zsock_option.inc +234 -1062
  70. data/vendor/local/include/zstr.h +44 -19
  71. data/vendor/local/include/zsys.h +63 -19
  72. data/vendor/local/include/zuuid.h +4 -4
  73. data/vendor/local/lib/libczmq.dll.a +0 -0
  74. data/vendor/local/lib/liblibzmq.dll.a +0 -0
  75. data/vendor/local/lib/pkgconfig/libczmq.pc +1 -1
  76. metadata +6 -3
@@ -73,8 +73,8 @@ module CZMQ
73
73
  end
74
74
 
75
75
  # Receive C string from socket. Caller must free returned string using
76
- # zstr_free(). Returns NULL if the context is being terminated or the
77
- # process was interrupted.
76
+ # zstr_free(). Returns NULL if the context is being terminated or the
77
+ # process was interrupted.
78
78
  #
79
79
  # @param source [::FFI::Pointer, #to_ptr]
80
80
  # @return [::FFI::AutoPointer]
@@ -84,13 +84,13 @@ module CZMQ
84
84
  result
85
85
  end
86
86
 
87
- # Receive a series of strings (until NULL) from multipart data.
88
- # Each string is allocated and filled with string data; if there
89
- # are not enough frames, unallocated strings are set to NULL.
90
- # Returns -1 if the message could not be read, else returns the
87
+ # Receive a series of strings (until NULL) from multipart data.
88
+ # Each string is allocated and filled with string data; if there
89
+ # are not enough frames, unallocated strings are set to NULL.
90
+ # Returns -1 if the message could not be read, else returns the
91
91
  # number of strings filled, zero or more. Free each returned string
92
- # using zstr_free(). If not enough strings are provided, remaining
93
- # multipart frames in the message are dropped.
92
+ # using zstr_free(). If not enough strings are provided, remaining
93
+ # multipart frames in the message are dropped.
94
94
  #
95
95
  # @param source [::FFI::Pointer, #to_ptr]
96
96
  # @param string_p [::FFI::Pointer, #to_ptr]
@@ -101,10 +101,23 @@ module CZMQ
101
101
  result
102
102
  end
103
103
 
104
- # Send a C string to a socket, as a frame. The string is sent without
104
+ # De-compress and receive C string from socket, received as a message
105
+ # with two frames: size of the uncompressed string, and the string itself.
106
+ # Caller must free returned string using zstr_free(). Returns NULL if the
107
+ # context is being terminated or the process was interrupted.
108
+ #
109
+ # @param source [::FFI::Pointer, #to_ptr]
110
+ # @return [::FFI::AutoPointer]
111
+ def self.recv_compress(source)
112
+ result = ::CZMQ::FFI.zstr_recv_compress(source)
113
+ result = ::FFI::AutoPointer.new(result, LibC.method(:free))
114
+ result
115
+ end
116
+
117
+ # Send a C string to a socket, as a frame. The string is sent without
105
118
  # trailing null byte; to read this you can use zstr_recv, or a similar
106
- # method that adds a null terminator on the received string. String
107
- # may be NULL, which is sent as "".
119
+ # method that adds a null terminator on the received string. String
120
+ # may be NULL, which is sent as "".
108
121
  #
109
122
  # @param dest [::FFI::Pointer, #to_ptr]
110
123
  # @param string [String, #to_s, nil]
@@ -115,7 +128,7 @@ module CZMQ
115
128
  end
116
129
 
117
130
  # Send a C string to a socket, as zstr_send(), with a MORE flag, so that
118
- # you can send further strings in the same multi-part message.
131
+ # you can send further strings in the same multi-part message.
119
132
  #
120
133
  # @param dest [::FFI::Pointer, #to_ptr]
121
134
  # @param string [String, #to_s, nil]
@@ -126,8 +139,8 @@ module CZMQ
126
139
  end
127
140
 
128
141
  # Send a formatted string to a socket. Note that you should NOT use
129
- # user-supplied strings in the format (they may contain '%' which
130
- # will create security holes).
142
+ # user-supplied strings in the format (they may contain '%' which
143
+ # will create security holes).
131
144
  #
132
145
  # @param dest [::FFI::Pointer, #to_ptr]
133
146
  # @param format [String, #to_s, nil]
@@ -138,9 +151,9 @@ module CZMQ
138
151
  result
139
152
  end
140
153
 
141
- # Send a formatted string to a socket, as for zstr_sendf(), with a
154
+ # Send a formatted string to a socket, as for zstr_sendf(), with a
142
155
  # MORE flag, so that you can send further strings in the same multi-part
143
- # message.
156
+ # message.
144
157
  #
145
158
  # @param dest [::FFI::Pointer, #to_ptr]
146
159
  # @param format [String, #to_s, nil]
@@ -151,7 +164,7 @@ module CZMQ
151
164
  result
152
165
  end
153
166
 
154
- # Send a series of strings (until NULL) as multipart data
167
+ # Send a series of strings (until NULL) as multipart data
155
168
  # Returns 0 if the strings could be sent OK, or -1 on error.
156
169
  #
157
170
  # @param dest [::FFI::Pointer, #to_ptr]
@@ -163,8 +176,34 @@ module CZMQ
163
176
  result
164
177
  end
165
178
 
179
+ # Compress and send a C string to a socket, as a message with two frames:
180
+ # size of the uncompressed string, and the string itself. The string is
181
+ # sent without trailing null byte; to read this you can use
182
+ # zstr_recv_compress, or a similar method that de-compresses and adds a
183
+ # null terminator on the received string.
184
+ #
185
+ # @param dest [::FFI::Pointer, #to_ptr]
186
+ # @param string [String, #to_s, nil]
187
+ # @return [Integer]
188
+ def self.send_compress(dest, string)
189
+ result = ::CZMQ::FFI.zstr_send_compress(dest, string)
190
+ result
191
+ end
192
+
193
+ # Compress and send a C string to a socket, as zstr_send_compress(),
194
+ # with a MORE flag, so that you can send further strings in the same
195
+ # multi-part message.
196
+ #
197
+ # @param dest [::FFI::Pointer, #to_ptr]
198
+ # @param string [String, #to_s, nil]
199
+ # @return [Integer]
200
+ def self.sendm_compress(dest, string)
201
+ result = ::CZMQ::FFI.zstr_sendm_compress(dest, string)
202
+ result
203
+ end
204
+
166
205
  # Accepts a void pointer and returns a fresh character string. If source
167
- # is null, returns an empty string.
206
+ # is null, returns an empty string.
168
207
  #
169
208
  # @param source [::FFI::Pointer, #to_ptr]
170
209
  # @return [::FFI::AutoPointer]
@@ -175,7 +214,7 @@ module CZMQ
175
214
  end
176
215
 
177
216
  # Free a provided string, and nullify the parent pointer. Safe to call on
178
- # a null pointer.
217
+ # a null pointer.
179
218
  #
180
219
  # @param string_p [::FFI::Pointer, #to_ptr]
181
220
  # @return [void]
@@ -0,0 +1,836 @@
1
+ ################################################################################
2
+ # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
3
+ # Read the zproject/README.md for information about making permanent changes. #
4
+ ################################################################################
5
+
6
+ module CZMQ
7
+ module FFI
8
+
9
+ #
10
+ # @note This class is 100% generated using zproject.
11
+ class Zsys
12
+ # Raised when one tries to use an instance of {Zsys} after
13
+ # the internal pointer to the native object has been nullified.
14
+ class DestroyedError < RuntimeError; end
15
+
16
+ # Boilerplate for self pointer, initializer, and finalizer
17
+ class << self
18
+ alias :__new :new
19
+ end
20
+ # Attaches the pointer _ptr_ to this instance and defines a finalizer for
21
+ # it if necessary.
22
+ # @param ptr [::FFI::Pointer]
23
+ # @param finalize [Boolean]
24
+ def initialize(ptr, finalize = true)
25
+ @ptr = ptr
26
+ if @ptr.null?
27
+ @ptr = nil # Remove null pointers so we don't have to test for them.
28
+ elsif finalize
29
+ @finalizer = self.class.create_finalizer_for @ptr
30
+ ObjectSpace.define_finalizer self, @finalizer
31
+ end
32
+ end
33
+ # @return [Proc]
34
+ def self.create_finalizer_for(ptr)
35
+ Proc.new do
36
+ "WARNING: "\
37
+ "Objects of type #{self} cannot be destroyed implicitly. "\
38
+ "Please call the correct destroy method with the relevant arguments."
39
+ end
40
+ end
41
+ # @return [Boolean]
42
+ def null?
43
+ !@ptr or @ptr.null?
44
+ end
45
+ # Return internal pointer
46
+ # @return [::FFI::Pointer]
47
+ def __ptr
48
+ raise DestroyedError unless @ptr
49
+ @ptr
50
+ end
51
+ # So external Libraries can just pass the Object to a FFI function which expects a :pointer
52
+ alias_method :to_ptr, :__ptr
53
+ # Nullify internal pointer and return pointer pointer.
54
+ # @note This detaches the current instance from the native object
55
+ # and thus makes it unusable.
56
+ # @return [::FFI::MemoryPointer] the pointer pointing to a pointer
57
+ # pointing to the native object
58
+ def __ptr_give_ref
59
+ raise DestroyedError unless @ptr
60
+ ptr_ptr = ::FFI::MemoryPointer.new :pointer
61
+ ptr_ptr.write_pointer @ptr
62
+ __undef_finalizer if @finalizer
63
+ @ptr = nil
64
+ ptr_ptr
65
+ end
66
+ # Undefines the finalizer for this object.
67
+ # @note Only use this if you need to and can guarantee that the native
68
+ # object will be freed by other means.
69
+ # @return [void]
70
+ def __undef_finalizer
71
+ ObjectSpace.undefine_finalizer self
72
+ @finalizer = nil
73
+ end
74
+
75
+ # Create a new callback of the following type:
76
+ # Callback for interrupt signal handler
77
+ # typedef void (zsys_handler_fn) (
78
+ # int signal_value);
79
+ #
80
+ # @note WARNING: If your Ruby code doesn't retain a reference to the
81
+ # FFI::Function object after passing it to a C function call,
82
+ # it may be garbage collected while C still holds the pointer,
83
+ # potentially resulting in a segmentation fault.
84
+ def self.handler_fn
85
+ ::FFI::Function.new :void, [:int], blocking: true do |signal_value|
86
+ result = yield signal_value
87
+ result
88
+ end
89
+ end
90
+
91
+ # Initialize CZMQ zsys layer; this happens automatically when you create
92
+ # a socket or an actor; however this call lets you force initialization
93
+ # earlier, so e.g. logging is properly set-up before you start working.
94
+ # Not threadsafe, so call only from main thread. Safe to call multiple
95
+ # times. Returns global CZMQ context.
96
+ #
97
+ # @return [::FFI::Pointer]
98
+ def self.init()
99
+ result = ::CZMQ::FFI.zsys_init()
100
+ result
101
+ end
102
+
103
+ # Optionally shut down the CZMQ zsys layer; this normally happens automatically
104
+ # when the process exits; however this call lets you force a shutdown
105
+ # earlier, avoiding any potential problems with atexit() ordering, especially
106
+ # with Windows dlls.
107
+ #
108
+ # @return [void]
109
+ def self.shutdown()
110
+ result = ::CZMQ::FFI.zsys_shutdown()
111
+ result
112
+ end
113
+
114
+ # Get a new ZMQ socket, automagically creating a ZMQ context if this is
115
+ # the first time. Caller is responsible for destroying the ZMQ socket
116
+ # before process exits, to avoid a ZMQ deadlock. Note: you should not use
117
+ # this method in CZMQ apps, use zsock_new() instead.
118
+ # *** This is for CZMQ internal use only and may change arbitrarily ***
119
+ #
120
+ # @param type [Integer, #to_int, #to_i]
121
+ # @param filename [String, #to_s, nil]
122
+ # @param line_nbr [Integer, #to_int, #to_i]
123
+ # @return [::FFI::Pointer]
124
+ def self.socket(type, filename, line_nbr)
125
+ type = Integer(type)
126
+ line_nbr = Integer(line_nbr)
127
+ result = ::CZMQ::FFI.zsys_socket(type, filename, line_nbr)
128
+ result
129
+ end
130
+
131
+ # Destroy/close a ZMQ socket. You should call this for every socket you
132
+ # create using zsys_socket().
133
+ # *** This is for CZMQ internal use only and may change arbitrarily ***
134
+ #
135
+ # @param handle [::FFI::Pointer, #to_ptr]
136
+ # @param filename [String, #to_s, nil]
137
+ # @param line_nbr [Integer, #to_int, #to_i]
138
+ # @return [Integer]
139
+ def self.close(handle, filename, line_nbr)
140
+ line_nbr = Integer(line_nbr)
141
+ result = ::CZMQ::FFI.zsys_close(handle, filename, line_nbr)
142
+ result
143
+ end
144
+
145
+ # Return ZMQ socket name for socket type
146
+ # *** This is for CZMQ internal use only and may change arbitrarily ***
147
+ #
148
+ # @param socktype [Integer, #to_int, #to_i]
149
+ # @return [::FFI::Pointer]
150
+ def self.sockname(socktype)
151
+ socktype = Integer(socktype)
152
+ result = ::CZMQ::FFI.zsys_sockname(socktype)
153
+ result
154
+ end
155
+
156
+ # Create a pipe, which consists of two PAIR sockets connected over inproc.
157
+ # The pipe is configured to use the zsys_pipehwm setting. Returns the
158
+ # frontend socket successful, NULL if failed.
159
+ #
160
+ # @param backend_p [#__ptr_give_ref]
161
+ # @return [Zsock]
162
+ def self.create_pipe(backend_p)
163
+ backend_p = backend_p.__ptr_give_ref
164
+ result = ::CZMQ::FFI.zsys_create_pipe(backend_p)
165
+ result = Zsock.__new result, false
166
+ result
167
+ end
168
+
169
+ # Set interrupt handler; this saves the default handlers so that a
170
+ # zsys_handler_reset () can restore them. If you call this multiple times
171
+ # then the last handler will take affect. If handler_fn is NULL, disables
172
+ # default SIGINT/SIGTERM handling in CZMQ.
173
+ #
174
+ # @param handler_fn [::FFI::Pointer, #to_ptr]
175
+ # @return [void]
176
+ def self.handler_set(handler_fn)
177
+ result = ::CZMQ::FFI.zsys_handler_set(handler_fn)
178
+ result
179
+ end
180
+
181
+ # Reset interrupt handler, call this at exit if needed
182
+ #
183
+ # @return [void]
184
+ def self.handler_reset()
185
+ result = ::CZMQ::FFI.zsys_handler_reset()
186
+ result
187
+ end
188
+
189
+ # Set default interrupt handler, so Ctrl-C or SIGTERM will set
190
+ # zsys_interrupted. Idempotent; safe to call multiple times.
191
+ # Can be supressed by ZSYS_SIGHANDLER=false
192
+ # *** This is for CZMQ internal use only and may change arbitrarily ***
193
+ #
194
+ # @return [void]
195
+ def self.catch_interrupts()
196
+ result = ::CZMQ::FFI.zsys_catch_interrupts()
197
+ result
198
+ end
199
+
200
+ # Return 1 if file exists, else zero
201
+ #
202
+ # @param filename [String, #to_s, nil]
203
+ # @return [Boolean]
204
+ def self.file_exists(filename)
205
+ result = ::CZMQ::FFI.zsys_file_exists(filename)
206
+ result
207
+ end
208
+
209
+ # Return file modification time. Returns 0 if the file does not exist.
210
+ #
211
+ # @param filename [String, #to_s, nil]
212
+ # @return [::FFI::Pointer]
213
+ def self.file_modified(filename)
214
+ result = ::CZMQ::FFI.zsys_file_modified(filename)
215
+ result
216
+ end
217
+
218
+ # Return file mode; provides at least support for the POSIX S_ISREG(m)
219
+ # and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes.
220
+ # Returns a mode_t cast to int, or -1 in case of error.
221
+ #
222
+ # @param filename [String, #to_s, nil]
223
+ # @return [Integer]
224
+ def self.file_mode(filename)
225
+ result = ::CZMQ::FFI.zsys_file_mode(filename)
226
+ result
227
+ end
228
+
229
+ # Delete file. Does not complain if the file is absent
230
+ #
231
+ # @param filename [String, #to_s, nil]
232
+ # @return [Integer]
233
+ def self.file_delete(filename)
234
+ result = ::CZMQ::FFI.zsys_file_delete(filename)
235
+ result
236
+ end
237
+
238
+ # Check if file is 'stable'
239
+ #
240
+ # @param filename [String, #to_s, nil]
241
+ # @return [Boolean]
242
+ def self.file_stable(filename)
243
+ result = ::CZMQ::FFI.zsys_file_stable(filename)
244
+ result
245
+ end
246
+
247
+ # Create a file path if it doesn't exist. The file path is treated as
248
+ # printf format.
249
+ #
250
+ # @param pathname [String, #to_s, nil]
251
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
252
+ # @return [Integer]
253
+ def self.dir_create(pathname, *args)
254
+ result = ::CZMQ::FFI.zsys_dir_create(pathname, *args)
255
+ result
256
+ end
257
+
258
+ # Remove a file path if empty; the pathname is treated as printf format.
259
+ #
260
+ # @param pathname [String, #to_s, nil]
261
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
262
+ # @return [Integer]
263
+ def self.dir_delete(pathname, *args)
264
+ result = ::CZMQ::FFI.zsys_dir_delete(pathname, *args)
265
+ result
266
+ end
267
+
268
+ # Move to a specified working directory. Returns 0 if OK, -1 if this failed.
269
+ #
270
+ # @param pathname [String, #to_s, nil]
271
+ # @return [Integer]
272
+ def self.dir_change(pathname)
273
+ result = ::CZMQ::FFI.zsys_dir_change(pathname)
274
+ result
275
+ end
276
+
277
+ # Set private file creation mode; all files created from here will be
278
+ # readable/writable by the owner only.
279
+ #
280
+ # @return [void]
281
+ def self.file_mode_private()
282
+ result = ::CZMQ::FFI.zsys_file_mode_private()
283
+ result
284
+ end
285
+
286
+ # Reset default file creation mode; all files created from here will use
287
+ # process file mode defaults.
288
+ #
289
+ # @return [void]
290
+ def self.file_mode_default()
291
+ result = ::CZMQ::FFI.zsys_file_mode_default()
292
+ result
293
+ end
294
+
295
+ # Return the CZMQ version for run-time API detection; returns version
296
+ # number into provided fields, providing reference isn't null in each case.
297
+ #
298
+ # @param major [::FFI::Pointer, #to_ptr]
299
+ # @param minor [::FFI::Pointer, #to_ptr]
300
+ # @param patch [::FFI::Pointer, #to_ptr]
301
+ # @return [void]
302
+ def self.version(major, minor, patch)
303
+ result = ::CZMQ::FFI.zsys_version(major, minor, patch)
304
+ result
305
+ end
306
+
307
+ # Format a string using printf formatting, returning a freshly allocated
308
+ # buffer. If there was insufficient memory, returns NULL. Free the returned
309
+ # string using zstr_free().
310
+ #
311
+ # @param format [String, #to_s, nil]
312
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
313
+ # @return [::FFI::Pointer]
314
+ def self.sprintf(format, *args)
315
+ result = ::CZMQ::FFI.zsys_sprintf(format, *args)
316
+ result
317
+ end
318
+
319
+ # Format a string with a va_list argument, returning a freshly allocated
320
+ # buffer. If there was insufficient memory, returns NULL. Free the returned
321
+ # string using zstr_free().
322
+ #
323
+ # @param format [String, #to_s, nil]
324
+ # @param argptr [::FFI::Pointer, #to_ptr]
325
+ # @return [::FFI::Pointer]
326
+ def self.vprintf(format, argptr)
327
+ result = ::CZMQ::FFI.zsys_vprintf(format, argptr)
328
+ result
329
+ end
330
+
331
+ # Create UDP beacon socket; if the routable option is true, uses
332
+ # multicast (not yet implemented), else uses broadcast. This method
333
+ # and related ones might _eventually_ be moved to a zudp class.
334
+ # *** This is for CZMQ internal use only and may change arbitrarily ***
335
+ #
336
+ # @param routable [Boolean]
337
+ # @return [Integer or FFI::Pointer]
338
+ def self.udp_new(routable)
339
+ routable = !(0==routable||!routable) # boolean
340
+ result = ::CZMQ::FFI.zsys_udp_new(routable)
341
+ result
342
+ end
343
+
344
+ # Close a UDP socket
345
+ # *** This is for CZMQ internal use only and may change arbitrarily ***
346
+ #
347
+ # @param handle [Integer or FFI::Pointer]
348
+ # @return [Integer]
349
+ def self.udp_close(handle)
350
+ result = ::CZMQ::FFI.zsys_udp_close(handle)
351
+ result
352
+ end
353
+
354
+ # Send zframe to UDP socket, return -1 if sending failed due to
355
+ # interface having disappeared (happens easily with WiFi)
356
+ # *** This is for CZMQ internal use only and may change arbitrarily ***
357
+ #
358
+ # @param udpsock [Integer or FFI::Pointer]
359
+ # @param frame [Zframe, #__ptr]
360
+ # @param address [::FFI::Pointer, #to_ptr]
361
+ # @param addrlen [Integer, #to_int, #to_i]
362
+ # @return [Integer]
363
+ def self.udp_send(udpsock, frame, address, addrlen)
364
+ frame = frame.__ptr if frame
365
+ addrlen = Integer(addrlen)
366
+ result = ::CZMQ::FFI.zsys_udp_send(udpsock, frame, address, addrlen)
367
+ result
368
+ end
369
+
370
+ # Receive zframe from UDP socket, and set address of peer that sent it
371
+ # The peername must be a char [INET_ADDRSTRLEN] array if IPv6 is disabled or
372
+ # NI_MAXHOST if it's enabled. Returns NULL when failing to get peer address.
373
+ # *** This is for CZMQ internal use only and may change arbitrarily ***
374
+ #
375
+ # @param udpsock [Integer or FFI::Pointer]
376
+ # @param peername [::FFI::Pointer, #to_ptr]
377
+ # @param peerlen [Integer, #to_int, #to_i]
378
+ # @return [Zframe]
379
+ def self.udp_recv(udpsock, peername, peerlen)
380
+ peerlen = Integer(peerlen)
381
+ result = ::CZMQ::FFI.zsys_udp_recv(udpsock, peername, peerlen)
382
+ result = Zframe.__new result, false
383
+ result
384
+ end
385
+
386
+ # Handle an I/O error on some socket operation; will report and die on
387
+ # fatal errors, and continue silently on "try again" errors.
388
+ # *** This is for CZMQ internal use only and may change arbitrarily ***
389
+ #
390
+ # @param reason [String, #to_s, nil]
391
+ # @return [void]
392
+ def self.socket_error(reason)
393
+ result = ::CZMQ::FFI.zsys_socket_error(reason)
394
+ result
395
+ end
396
+
397
+ # Return current host name, for use in public tcp:// endpoints. Caller gets
398
+ # a freshly allocated string, should free it using zstr_free(). If the host
399
+ # name is not resolvable, returns NULL.
400
+ #
401
+ # @return [::FFI::Pointer]
402
+ def self.hostname()
403
+ result = ::CZMQ::FFI.zsys_hostname()
404
+ result
405
+ end
406
+
407
+ # Move the current process into the background. The precise effect depends
408
+ # on the operating system. On POSIX boxes, moves to a specified working
409
+ # directory (if specified), closes all file handles, reopens stdin, stdout,
410
+ # and stderr to the null device, and sets the process to ignore SIGHUP. On
411
+ # Windows, does nothing. Returns 0 if OK, -1 if there was an error.
412
+ #
413
+ # @param workdir [String, #to_s, nil]
414
+ # @return [Integer]
415
+ def self.daemonize(workdir)
416
+ result = ::CZMQ::FFI.zsys_daemonize(workdir)
417
+ result
418
+ end
419
+
420
+ # Drop the process ID into the lockfile, with exclusive lock, and switch
421
+ # the process to the specified group and/or user. Any of the arguments
422
+ # may be null, indicating a no-op. Returns 0 on success, -1 on failure.
423
+ # Note if you combine this with zsys_daemonize, run after, not before
424
+ # that method, or the lockfile will hold the wrong process ID.
425
+ #
426
+ # @param lockfile [String, #to_s, nil]
427
+ # @param group [String, #to_s, nil]
428
+ # @param user [String, #to_s, nil]
429
+ # @return [Integer]
430
+ def self.run_as(lockfile, group, user)
431
+ result = ::CZMQ::FFI.zsys_run_as(lockfile, group, user)
432
+ result
433
+ end
434
+
435
+ # Returns true if the underlying libzmq supports CURVE security.
436
+ # Uses a heuristic probe according to the version of libzmq being used.
437
+ #
438
+ # @return [Boolean]
439
+ def self.has_curve()
440
+ result = ::CZMQ::FFI.zsys_has_curve()
441
+ result
442
+ end
443
+
444
+ # Configure the number of I/O threads that ZeroMQ will use. A good
445
+ # rule of thumb is one thread per gigabit of traffic in or out. The
446
+ # default is 1, sufficient for most applications. If the environment
447
+ # variable ZSYS_IO_THREADS is defined, that provides the default.
448
+ # Note that this method is valid only before any socket is created.
449
+ #
450
+ # @param io_threads [Integer, #to_int, #to_i]
451
+ # @return [void]
452
+ def self.set_io_threads(io_threads)
453
+ io_threads = Integer(io_threads)
454
+ result = ::CZMQ::FFI.zsys_set_io_threads(io_threads)
455
+ result
456
+ end
457
+
458
+ # Configure the scheduling policy of the ZMQ context thread pool.
459
+ # Not available on Windows. See the sched_setscheduler man page or sched.h
460
+ # for more information. If the environment variable ZSYS_THREAD_SCHED_POLICY
461
+ # is defined, that provides the default.
462
+ # Note that this method is valid only before any socket is created.
463
+ #
464
+ # @param policy [Integer, #to_int, #to_i]
465
+ # @return [void]
466
+ def self.set_thread_sched_policy(policy)
467
+ policy = Integer(policy)
468
+ result = ::CZMQ::FFI.zsys_set_thread_sched_policy(policy)
469
+ result
470
+ end
471
+
472
+ # Configure the scheduling priority of the ZMQ context thread pool.
473
+ # Not available on Windows. See the sched_setscheduler man page or sched.h
474
+ # for more information. If the environment variable ZSYS_THREAD_PRIORITY is
475
+ # defined, that provides the default.
476
+ # Note that this method is valid only before any socket is created.
477
+ #
478
+ # @param priority [Integer, #to_int, #to_i]
479
+ # @return [void]
480
+ def self.set_thread_priority(priority)
481
+ priority = Integer(priority)
482
+ result = ::CZMQ::FFI.zsys_set_thread_priority(priority)
483
+ result
484
+ end
485
+
486
+ # Configure the number of sockets that ZeroMQ will allow. The default
487
+ # is 1024. The actual limit depends on the system, and you can query it
488
+ # by using zsys_socket_limit (). A value of zero means "maximum".
489
+ # Note that this method is valid only before any socket is created.
490
+ #
491
+ # @param max_sockets [Integer, #to_int, #to_i]
492
+ # @return [void]
493
+ def self.set_max_sockets(max_sockets)
494
+ max_sockets = Integer(max_sockets)
495
+ result = ::CZMQ::FFI.zsys_set_max_sockets(max_sockets)
496
+ result
497
+ end
498
+
499
+ # Return maximum number of ZeroMQ sockets that the system will support.
500
+ #
501
+ # @return [Integer]
502
+ def self.socket_limit()
503
+ result = ::CZMQ::FFI.zsys_socket_limit()
504
+ result
505
+ end
506
+
507
+ # Configure the maximum allowed size of a message sent.
508
+ # The default is INT_MAX.
509
+ #
510
+ # @param max_msgsz [Integer, #to_int, #to_i]
511
+ # @return [void]
512
+ def self.set_max_msgsz(max_msgsz)
513
+ max_msgsz = Integer(max_msgsz)
514
+ result = ::CZMQ::FFI.zsys_set_max_msgsz(max_msgsz)
515
+ result
516
+ end
517
+
518
+ # Return maximum message size.
519
+ #
520
+ # @return [Integer]
521
+ def self.max_msgsz()
522
+ result = ::CZMQ::FFI.zsys_max_msgsz()
523
+ result
524
+ end
525
+
526
+ # Configure the threshold value of filesystem object age per st_mtime
527
+ # that should elapse until we consider that object "stable" at the
528
+ # current zclock_time() moment.
529
+ # The default is S_DEFAULT_ZSYS_FILE_STABLE_AGE_MSEC defined in zsys.c
530
+ # which generally depends on host OS, with fallback value of 5000.
531
+ #
532
+ # @param file_stable_age_msec [::FFI::Pointer, #to_ptr]
533
+ # @return [void]
534
+ def self.set_file_stable_age_msec(file_stable_age_msec)
535
+ result = ::CZMQ::FFI.zsys_set_file_stable_age_msec(file_stable_age_msec)
536
+ result
537
+ end
538
+
539
+ # Return current threshold value of file stable age in msec.
540
+ # This can be used in code that chooses to wait for this timeout
541
+ # before testing if a filesystem object is "stable" or not.
542
+ #
543
+ # @return [::FFI::Pointer]
544
+ def self.file_stable_age_msec()
545
+ result = ::CZMQ::FFI.zsys_file_stable_age_msec()
546
+ result
547
+ end
548
+
549
+ # Configure the default linger timeout in msecs for new zsock instances.
550
+ # You can also set this separately on each zsock_t instance. The default
551
+ # linger time is zero, i.e. any pending messages will be dropped. If the
552
+ # environment variable ZSYS_LINGER is defined, that provides the default.
553
+ # Note that process exit will typically be delayed by the linger time.
554
+ #
555
+ # @param linger [Integer, #to_int, #to_i]
556
+ # @return [void]
557
+ def self.set_linger(linger)
558
+ linger = Integer(linger)
559
+ result = ::CZMQ::FFI.zsys_set_linger(linger)
560
+ result
561
+ end
562
+
563
+ # Configure the default outgoing pipe limit (HWM) for new zsock instances.
564
+ # You can also set this separately on each zsock_t instance. The default
565
+ # HWM is 1,000, on all versions of ZeroMQ. If the environment variable
566
+ # ZSYS_SNDHWM is defined, that provides the default. Note that a value of
567
+ # zero means no limit, i.e. infinite memory consumption.
568
+ #
569
+ # @param sndhwm [Integer, #to_int, #to_i]
570
+ # @return [void]
571
+ def self.set_sndhwm(sndhwm)
572
+ sndhwm = Integer(sndhwm)
573
+ result = ::CZMQ::FFI.zsys_set_sndhwm(sndhwm)
574
+ result
575
+ end
576
+
577
+ # Configure the default incoming pipe limit (HWM) for new zsock instances.
578
+ # You can also set this separately on each zsock_t instance. The default
579
+ # HWM is 1,000, on all versions of ZeroMQ. If the environment variable
580
+ # ZSYS_RCVHWM is defined, that provides the default. Note that a value of
581
+ # zero means no limit, i.e. infinite memory consumption.
582
+ #
583
+ # @param rcvhwm [Integer, #to_int, #to_i]
584
+ # @return [void]
585
+ def self.set_rcvhwm(rcvhwm)
586
+ rcvhwm = Integer(rcvhwm)
587
+ result = ::CZMQ::FFI.zsys_set_rcvhwm(rcvhwm)
588
+ result
589
+ end
590
+
591
+ # Configure the default HWM for zactor internal pipes; this is set on both
592
+ # ends of the pipe, for outgoing messages only (sndhwm). The default HWM is
593
+ # 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is
594
+ # defined, that provides the default. Note that a value of zero means no
595
+ # limit, i.e. infinite memory consumption.
596
+ #
597
+ # @param pipehwm [Integer, #to_int, #to_i]
598
+ # @return [void]
599
+ def self.set_pipehwm(pipehwm)
600
+ pipehwm = Integer(pipehwm)
601
+ result = ::CZMQ::FFI.zsys_set_pipehwm(pipehwm)
602
+ result
603
+ end
604
+
605
+ # Return the HWM for zactor internal pipes.
606
+ #
607
+ # @return [Integer]
608
+ def self.pipehwm()
609
+ result = ::CZMQ::FFI.zsys_pipehwm()
610
+ result
611
+ end
612
+
613
+ # Configure use of IPv6 for new zsock instances. By default sockets accept
614
+ # and make only IPv4 connections. When you enable IPv6, sockets will accept
615
+ # and connect to both IPv4 and IPv6 peers. You can override the setting on
616
+ # each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the
617
+ # environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the
618
+ # default. Note: has no effect on ZMQ v2.
619
+ #
620
+ # @param ipv6 [Integer, #to_int, #to_i]
621
+ # @return [void]
622
+ def self.set_ipv6(ipv6)
623
+ ipv6 = Integer(ipv6)
624
+ result = ::CZMQ::FFI.zsys_set_ipv6(ipv6)
625
+ result
626
+ end
627
+
628
+ # Return use of IPv6 for zsock instances.
629
+ #
630
+ # @return [Integer]
631
+ def self.ipv6()
632
+ result = ::CZMQ::FFI.zsys_ipv6()
633
+ result
634
+ end
635
+
636
+ # Set network interface name to use for broadcasts, particularly zbeacon.
637
+ # This lets the interface be configured for test environments where required.
638
+ # For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is
639
+ # the default when there is no specified interface. If the environment
640
+ # variable ZSYS_INTERFACE is set, use that as the default interface name.
641
+ # Setting the interface to "*" means "use all available interfaces".
642
+ #
643
+ # @param value [String, #to_s, nil]
644
+ # @return [void]
645
+ def self.set_interface(value)
646
+ result = ::CZMQ::FFI.zsys_set_interface(value)
647
+ result
648
+ end
649
+
650
+ # Return network interface to use for broadcasts, or "" if none was set.
651
+ #
652
+ # @return [String]
653
+ def self.interface()
654
+ result = ::CZMQ::FFI.zsys_interface()
655
+ result
656
+ end
657
+
658
+ # Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon.
659
+ # This needs to be set IPv6 is enabled as IPv6 can have multiple addresses
660
+ # on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set,
661
+ # use that as the default IPv6 address.
662
+ #
663
+ # @param value [String, #to_s, nil]
664
+ # @return [void]
665
+ def self.set_ipv6_address(value)
666
+ result = ::CZMQ::FFI.zsys_set_ipv6_address(value)
667
+ result
668
+ end
669
+
670
+ # Return IPv6 address to use for zbeacon reception, or "" if none was set.
671
+ #
672
+ # @return [String]
673
+ def self.ipv6_address()
674
+ result = ::CZMQ::FFI.zsys_ipv6_address()
675
+ result
676
+ end
677
+
678
+ # Set IPv6 milticast address to use for sending zbeacon messages. This needs
679
+ # to be set if IPv6 is enabled. If the environment variable
680
+ # ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast
681
+ # address.
682
+ #
683
+ # @param value [String, #to_s, nil]
684
+ # @return [void]
685
+ def self.set_ipv6_mcast_address(value)
686
+ result = ::CZMQ::FFI.zsys_set_ipv6_mcast_address(value)
687
+ result
688
+ end
689
+
690
+ # Return IPv6 multicast address to use for sending zbeacon, or "" if none was
691
+ # set.
692
+ #
693
+ # @return [String]
694
+ def self.ipv6_mcast_address()
695
+ result = ::CZMQ::FFI.zsys_ipv6_mcast_address()
696
+ result
697
+ end
698
+
699
+ # Configure the automatic use of pre-allocated FDs when creating new sockets.
700
+ # If 0 (default), nothing will happen. Else, when a new socket is bound, the
701
+ # system API will be used to check if an existing pre-allocated FD with a
702
+ # matching port (if TCP) or path (if IPC) exists, and if it does it will be
703
+ # set via the ZMQ_USE_FD socket option so that the library will use it
704
+ # instead of creating a new socket.
705
+ #
706
+ # @param auto_use_fd [Integer, #to_int, #to_i]
707
+ # @return [void]
708
+ def self.set_auto_use_fd(auto_use_fd)
709
+ auto_use_fd = Integer(auto_use_fd)
710
+ result = ::CZMQ::FFI.zsys_set_auto_use_fd(auto_use_fd)
711
+ result
712
+ end
713
+
714
+ # Return use of automatic pre-allocated FDs for zsock instances.
715
+ #
716
+ # @return [Integer]
717
+ def self.auto_use_fd()
718
+ result = ::CZMQ::FFI.zsys_auto_use_fd()
719
+ result
720
+ end
721
+
722
+ # Set log identity, which is a string that prefixes all log messages sent
723
+ # by this process. The log identity defaults to the environment variable
724
+ # ZSYS_LOGIDENT, if that is set.
725
+ #
726
+ # @param value [String, #to_s, nil]
727
+ # @return [void]
728
+ def self.set_logident(value)
729
+ result = ::CZMQ::FFI.zsys_set_logident(value)
730
+ result
731
+ end
732
+
733
+ # Set stream to receive log traffic. By default, log traffic is sent to
734
+ # stdout. If you set the stream to NULL, no stream will receive the log
735
+ # traffic (it may still be sent to the system facility).
736
+ #
737
+ # @param stream [::FFI::Pointer, #to_ptr]
738
+ # @return [void]
739
+ def self.set_logstream(stream)
740
+ result = ::CZMQ::FFI.zsys_set_logstream(stream)
741
+ result
742
+ end
743
+
744
+ # Sends log output to a PUB socket bound to the specified endpoint. To
745
+ # collect such log output, create a SUB socket, subscribe to the traffic
746
+ # you care about, and connect to the endpoint. Log traffic is sent as a
747
+ # single string frame, in the same format as when sent to stdout. The
748
+ # log system supports a single sender; multiple calls to this method will
749
+ # bind the same sender to multiple endpoints. To disable the sender, call
750
+ # this method with a null argument.
751
+ #
752
+ # @param endpoint [String, #to_s, nil]
753
+ # @return [void]
754
+ def self.set_logsender(endpoint)
755
+ result = ::CZMQ::FFI.zsys_set_logsender(endpoint)
756
+ result
757
+ end
758
+
759
+ # Enable or disable logging to the system facility (syslog on POSIX boxes,
760
+ # event log on Windows). By default this is disabled.
761
+ #
762
+ # @param logsystem [Boolean]
763
+ # @return [void]
764
+ def self.set_logsystem(logsystem)
765
+ logsystem = !(0==logsystem||!logsystem) # boolean
766
+ result = ::CZMQ::FFI.zsys_set_logsystem(logsystem)
767
+ result
768
+ end
769
+
770
+ # Log error condition - highest priority
771
+ #
772
+ # @param format [String, #to_s, nil]
773
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
774
+ # @return [void]
775
+ def self.error(format, *args)
776
+ result = ::CZMQ::FFI.zsys_error(format, *args)
777
+ result
778
+ end
779
+
780
+ # Log warning condition - high priority
781
+ #
782
+ # @param format [String, #to_s, nil]
783
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
784
+ # @return [void]
785
+ def self.warning(format, *args)
786
+ result = ::CZMQ::FFI.zsys_warning(format, *args)
787
+ result
788
+ end
789
+
790
+ # Log normal, but significant, condition - normal priority
791
+ #
792
+ # @param format [String, #to_s, nil]
793
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
794
+ # @return [void]
795
+ def self.notice(format, *args)
796
+ result = ::CZMQ::FFI.zsys_notice(format, *args)
797
+ result
798
+ end
799
+
800
+ # Log informational message - low priority
801
+ #
802
+ # @param format [String, #to_s, nil]
803
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
804
+ # @return [void]
805
+ def self.info(format, *args)
806
+ result = ::CZMQ::FFI.zsys_info(format, *args)
807
+ result
808
+ end
809
+
810
+ # Log debug-level message - lowest priority
811
+ #
812
+ # @param format [String, #to_s, nil]
813
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
814
+ # @return [void]
815
+ def self.debug(format, *args)
816
+ result = ::CZMQ::FFI.zsys_debug(format, *args)
817
+ result
818
+ end
819
+
820
+ # Self test of this class.
821
+ #
822
+ # @param verbose [Boolean]
823
+ # @return [void]
824
+ def self.test(verbose)
825
+ verbose = !(0==verbose||!verbose) # boolean
826
+ result = ::CZMQ::FFI.zsys_test(verbose)
827
+ result
828
+ end
829
+ end
830
+ end
831
+ end
832
+
833
+ ################################################################################
834
+ # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
835
+ # Read the zproject/README.md for information about making permanent changes. #
836
+ ################################################################################