czmq-ffi-gen 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +8 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +40 -7
- data/lib/czmq-ffi-gen/czmq/ffi/zargs.rb +259 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +3 -3
- data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +15 -6
- data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +25 -11
- data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +18 -18
- data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +6 -6
- data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +27 -17
- data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +4 -4
- data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +36 -36
- data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +1 -1
- data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +27 -19
- data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +22 -21
- data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +54 -54
- data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +82 -80
- data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +30 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +30 -30
- data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +44 -44
- data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +39 -39
- data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +46 -46
- data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +16 -16
- data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +237 -34
- data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +1201 -973
- data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +58 -19
- data/lib/czmq-ffi-gen/czmq/ffi/zsys.rb +836 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +6 -6
- data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +10 -10
- data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +4 -4
- data/lib/czmq-ffi-gen/czmq/ffi.rb +224 -698
- data/lib/czmq-ffi-gen/gem_version.rb +1 -1
- data/lib/czmq-ffi-gen/vendor.rb +9 -1
- metadata +5 -3
@@ -30,12 +30,13 @@ module CZMQ
|
|
30
30
|
ObjectSpace.define_finalizer self, @finalizer
|
31
31
|
end
|
32
32
|
end
|
33
|
+
# @param ptr [::FFI::Pointer]
|
33
34
|
# @return [Proc]
|
34
35
|
def self.create_finalizer_for(ptr)
|
35
36
|
Proc.new do
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
38
|
+
ptr_ptr.write_pointer ptr
|
39
|
+
::CZMQ::FFI.zproc_destroy ptr_ptr
|
39
40
|
end
|
40
41
|
end
|
41
42
|
# @return [Boolean]
|
@@ -72,8 +73,210 @@ module CZMQ
|
|
72
73
|
@finalizer = nil
|
73
74
|
end
|
74
75
|
|
76
|
+
# Create a new zproc.
|
77
|
+
# NOTE: On Windows and with libzmq3 and libzmq2 this function
|
78
|
+
# returns NULL. Code needs to be ported there.
|
79
|
+
# @return [CZMQ::Zproc]
|
80
|
+
def self.new()
|
81
|
+
ptr = ::CZMQ::FFI.zproc_new()
|
82
|
+
__new ptr
|
83
|
+
end
|
84
|
+
|
85
|
+
# Destroy zproc, wait until process ends.
|
86
|
+
#
|
87
|
+
# @return [void]
|
88
|
+
def destroy()
|
89
|
+
return unless @ptr
|
90
|
+
self_p = __ptr_give_ref
|
91
|
+
result = ::CZMQ::FFI.zproc_destroy(self_p)
|
92
|
+
result
|
93
|
+
end
|
94
|
+
|
95
|
+
# Setup the command line arguments, the first item must be an (absolute) filename
|
96
|
+
# to run.
|
97
|
+
#
|
98
|
+
# @param args [Zlistx, #__ptr]
|
99
|
+
# @return [void]
|
100
|
+
def set_args(args)
|
101
|
+
raise DestroyedError unless @ptr
|
102
|
+
self_p = @ptr
|
103
|
+
args = args.__ptr if args
|
104
|
+
result = ::CZMQ::FFI.zproc_set_args(self_p, args)
|
105
|
+
result
|
106
|
+
end
|
107
|
+
|
108
|
+
# Setup the environment variables for the process.
|
109
|
+
#
|
110
|
+
# @param args [Zhashx, #__ptr]
|
111
|
+
# @return [void]
|
112
|
+
def set_env(args)
|
113
|
+
raise DestroyedError unless @ptr
|
114
|
+
self_p = @ptr
|
115
|
+
args = args.__ptr if args
|
116
|
+
result = ::CZMQ::FFI.zproc_set_env(self_p, args)
|
117
|
+
result
|
118
|
+
end
|
119
|
+
|
120
|
+
# Connects process stdin with a readable ('>', connect) zeromq socket. If
|
121
|
+
# socket argument is NULL, zproc creates own managed pair of inproc
|
122
|
+
# sockets. The writable one is then accessbile via zproc_stdin method.
|
123
|
+
#
|
124
|
+
# @param socket [::FFI::Pointer, #to_ptr]
|
125
|
+
# @return [void]
|
126
|
+
def set_stdin(socket)
|
127
|
+
raise DestroyedError unless @ptr
|
128
|
+
self_p = @ptr
|
129
|
+
result = ::CZMQ::FFI.zproc_set_stdin(self_p, socket)
|
130
|
+
result
|
131
|
+
end
|
132
|
+
|
133
|
+
# Connects process stdout with a writable ('@', bind) zeromq socket. If
|
134
|
+
# socket argument is NULL, zproc creates own managed pair of inproc
|
135
|
+
# sockets. The readable one is then accessbile via zproc_stdout method.
|
136
|
+
#
|
137
|
+
# @param socket [::FFI::Pointer, #to_ptr]
|
138
|
+
# @return [void]
|
139
|
+
def set_stdout(socket)
|
140
|
+
raise DestroyedError unless @ptr
|
141
|
+
self_p = @ptr
|
142
|
+
result = ::CZMQ::FFI.zproc_set_stdout(self_p, socket)
|
143
|
+
result
|
144
|
+
end
|
145
|
+
|
146
|
+
# Connects process stderr with a writable ('@', bind) zeromq socket. If
|
147
|
+
# socket argument is NULL, zproc creates own managed pair of inproc
|
148
|
+
# sockets. The readable one is then accessbile via zproc_stderr method.
|
149
|
+
#
|
150
|
+
# @param socket [::FFI::Pointer, #to_ptr]
|
151
|
+
# @return [void]
|
152
|
+
def set_stderr(socket)
|
153
|
+
raise DestroyedError unless @ptr
|
154
|
+
self_p = @ptr
|
155
|
+
result = ::CZMQ::FFI.zproc_set_stderr(self_p, socket)
|
156
|
+
result
|
157
|
+
end
|
158
|
+
|
159
|
+
# Return subprocess stdin writable socket. NULL for
|
160
|
+
# not initialized or external sockets.
|
161
|
+
#
|
162
|
+
# @return [::FFI::Pointer]
|
163
|
+
def stdin()
|
164
|
+
raise DestroyedError unless @ptr
|
165
|
+
self_p = @ptr
|
166
|
+
result = ::CZMQ::FFI.zproc_stdin(self_p)
|
167
|
+
result
|
168
|
+
end
|
169
|
+
|
170
|
+
# Return subprocess stdout readable socket. NULL for
|
171
|
+
# not initialized or external sockets.
|
172
|
+
#
|
173
|
+
# @return [::FFI::Pointer]
|
174
|
+
def stdout()
|
175
|
+
raise DestroyedError unless @ptr
|
176
|
+
self_p = @ptr
|
177
|
+
result = ::CZMQ::FFI.zproc_stdout(self_p)
|
178
|
+
result
|
179
|
+
end
|
180
|
+
|
181
|
+
# Return subprocess stderr readable socket. NULL for
|
182
|
+
# not initialized or external sockets.
|
183
|
+
#
|
184
|
+
# @return [::FFI::Pointer]
|
185
|
+
def stderr()
|
186
|
+
raise DestroyedError unless @ptr
|
187
|
+
self_p = @ptr
|
188
|
+
result = ::CZMQ::FFI.zproc_stderr(self_p)
|
189
|
+
result
|
190
|
+
end
|
191
|
+
|
192
|
+
# Starts the process.
|
193
|
+
#
|
194
|
+
# @return [Integer]
|
195
|
+
def run()
|
196
|
+
raise DestroyedError unless @ptr
|
197
|
+
self_p = @ptr
|
198
|
+
result = ::CZMQ::FFI.zproc_run(self_p)
|
199
|
+
result
|
200
|
+
end
|
201
|
+
|
202
|
+
# process exit code
|
203
|
+
#
|
204
|
+
# @return [Integer]
|
205
|
+
def returncode()
|
206
|
+
raise DestroyedError unless @ptr
|
207
|
+
self_p = @ptr
|
208
|
+
result = ::CZMQ::FFI.zproc_returncode(self_p)
|
209
|
+
result
|
210
|
+
end
|
211
|
+
|
212
|
+
# PID of the process
|
213
|
+
#
|
214
|
+
# @return [Integer]
|
215
|
+
def pid()
|
216
|
+
raise DestroyedError unless @ptr
|
217
|
+
self_p = @ptr
|
218
|
+
result = ::CZMQ::FFI.zproc_pid(self_p)
|
219
|
+
result
|
220
|
+
end
|
221
|
+
|
222
|
+
# return true if process is running, false if not yet started or finished
|
223
|
+
#
|
224
|
+
# @return [Boolean]
|
225
|
+
def running()
|
226
|
+
raise DestroyedError unless @ptr
|
227
|
+
self_p = @ptr
|
228
|
+
result = ::CZMQ::FFI.zproc_running(self_p)
|
229
|
+
result
|
230
|
+
end
|
231
|
+
|
232
|
+
# wait or poll process status, return return code
|
233
|
+
#
|
234
|
+
# @param hang [Boolean]
|
235
|
+
# @return [Integer]
|
236
|
+
def wait(hang)
|
237
|
+
raise DestroyedError unless @ptr
|
238
|
+
self_p = @ptr
|
239
|
+
hang = !(0==hang||!hang) # boolean
|
240
|
+
result = ::CZMQ::FFI.zproc_wait(self_p, hang)
|
241
|
+
result
|
242
|
+
end
|
243
|
+
|
244
|
+
# return internal actor, usefull for the polling if process died
|
245
|
+
#
|
246
|
+
# @return [::FFI::Pointer]
|
247
|
+
def actor()
|
248
|
+
raise DestroyedError unless @ptr
|
249
|
+
self_p = @ptr
|
250
|
+
result = ::CZMQ::FFI.zproc_actor(self_p)
|
251
|
+
result
|
252
|
+
end
|
253
|
+
|
254
|
+
# send a signal to the subprocess
|
255
|
+
#
|
256
|
+
# @param signal [Integer, #to_int, #to_i]
|
257
|
+
# @return [void]
|
258
|
+
def kill(signal)
|
259
|
+
raise DestroyedError unless @ptr
|
260
|
+
self_p = @ptr
|
261
|
+
signal = Integer(signal)
|
262
|
+
result = ::CZMQ::FFI.zproc_kill(self_p, signal)
|
263
|
+
result
|
264
|
+
end
|
265
|
+
|
266
|
+
# set verbose mode
|
267
|
+
#
|
268
|
+
# @param verbose [Boolean]
|
269
|
+
# @return [void]
|
270
|
+
def set_verbose(verbose)
|
271
|
+
raise DestroyedError unless @ptr
|
272
|
+
self_p = @ptr
|
273
|
+
verbose = !(0==verbose||!verbose) # boolean
|
274
|
+
result = ::CZMQ::FFI.zproc_set_verbose(self_p, verbose)
|
275
|
+
result
|
276
|
+
end
|
277
|
+
|
75
278
|
# Returns CZMQ version as a single 6-digit integer encoding the major
|
76
|
-
# version (x 10000), the minor version (x 100) and the patch.
|
279
|
+
# version (x 10000), the minor version (x 100) and the patch.
|
77
280
|
#
|
78
281
|
# @return [Integer]
|
79
282
|
def self.czmq_version()
|
@@ -83,7 +286,7 @@ module CZMQ
|
|
83
286
|
|
84
287
|
# Returns true if the process received a SIGINT or SIGTERM signal.
|
85
288
|
# It is good practice to use this method to exit any infinite loop
|
86
|
-
# processing messages.
|
289
|
+
# processing messages.
|
87
290
|
#
|
88
291
|
# @return [Boolean]
|
89
292
|
def self.interrupted()
|
@@ -100,7 +303,7 @@ module CZMQ
|
|
100
303
|
end
|
101
304
|
|
102
305
|
# Return current host name, for use in public tcp:// endpoints.
|
103
|
-
# If the host name is not resolvable, returns NULL.
|
306
|
+
# If the host name is not resolvable, returns NULL.
|
104
307
|
#
|
105
308
|
# @return [::FFI::AutoPointer]
|
106
309
|
def self.hostname()
|
@@ -109,12 +312,12 @@ module CZMQ
|
|
109
312
|
result
|
110
313
|
end
|
111
314
|
|
112
|
-
# Move the current process into the background. The precise effect
|
315
|
+
# Move the current process into the background. The precise effect
|
113
316
|
# depends on the operating system. On POSIX boxes, moves to a specified
|
114
|
-
# working directory (if specified), closes all file handles, reopens
|
317
|
+
# working directory (if specified), closes all file handles, reopens
|
115
318
|
# stdin, stdout, and stderr to the null device, and sets the process to
|
116
319
|
# ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there
|
117
|
-
# was an error.
|
320
|
+
# was an error.
|
118
321
|
#
|
119
322
|
# @param workdir [String, #to_s, nil]
|
120
323
|
# @return [void]
|
@@ -123,12 +326,12 @@ module CZMQ
|
|
123
326
|
result
|
124
327
|
end
|
125
328
|
|
126
|
-
# Drop the process ID into the lockfile, with exclusive lock, and
|
127
|
-
# switch the process to the specified group and/or user. Any of the
|
128
|
-
# arguments may be null, indicating a no-op. Returns 0 on success,
|
129
|
-
# -1 on failure. Note if you combine this with zsys_daemonize, run
|
329
|
+
# Drop the process ID into the lockfile, with exclusive lock, and
|
330
|
+
# switch the process to the specified group and/or user. Any of the
|
331
|
+
# arguments may be null, indicating a no-op. Returns 0 on success,
|
332
|
+
# -1 on failure. Note if you combine this with zsys_daemonize, run
|
130
333
|
# after, not before that method, or the lockfile will hold the wrong
|
131
|
-
# process ID.
|
334
|
+
# process ID.
|
132
335
|
#
|
133
336
|
# @param lockfile [String, #to_s, nil]
|
134
337
|
# @param group [String, #to_s, nil]
|
@@ -139,11 +342,11 @@ module CZMQ
|
|
139
342
|
result
|
140
343
|
end
|
141
344
|
|
142
|
-
# Configure the number of I/O threads that ZeroMQ will use. A good
|
143
|
-
# rule of thumb is one thread per gigabit of traffic in or out. The
|
345
|
+
# Configure the number of I/O threads that ZeroMQ will use. A good
|
346
|
+
# rule of thumb is one thread per gigabit of traffic in or out. The
|
144
347
|
# default is 1, sufficient for most applications. If the environment
|
145
|
-
# variable ZSYS_IO_THREADS is defined, that provides the default.
|
146
|
-
# Note that this method is valid only before any socket is created.
|
348
|
+
# variable ZSYS_IO_THREADS is defined, that provides the default.
|
349
|
+
# Note that this method is valid only before any socket is created.
|
147
350
|
#
|
148
351
|
# @param io_threads [Integer, #to_int, #to_i]
|
149
352
|
# @return [void]
|
@@ -153,10 +356,10 @@ module CZMQ
|
|
153
356
|
result
|
154
357
|
end
|
155
358
|
|
156
|
-
# Configure the number of sockets that ZeroMQ will allow. The default
|
359
|
+
# Configure the number of sockets that ZeroMQ will allow. The default
|
157
360
|
# is 1024. The actual limit depends on the system, and you can query it
|
158
|
-
# by using zsys_socket_limit (). A value of zero means "maximum".
|
159
|
-
# Note that this method is valid only before any socket is created.
|
361
|
+
# by using zsys_socket_limit (). A value of zero means "maximum".
|
362
|
+
# Note that this method is valid only before any socket is created.
|
160
363
|
#
|
161
364
|
# @param max_sockets [Integer, #to_int, #to_i]
|
162
365
|
# @return [void]
|
@@ -166,12 +369,12 @@ module CZMQ
|
|
166
369
|
result
|
167
370
|
end
|
168
371
|
|
169
|
-
# Set network interface name to use for broadcasts, particularly zbeacon.
|
372
|
+
# Set network interface name to use for broadcasts, particularly zbeacon.
|
170
373
|
# This lets the interface be configured for test environments where required.
|
171
|
-
# For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is
|
172
|
-
# the default when there is no specified interface. If the environment
|
173
|
-
# variable ZSYS_INTERFACE is set, use that as the default interface name.
|
174
|
-
# Setting the interface to "*" means "use all available interfaces".
|
374
|
+
# For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is
|
375
|
+
# the default when there is no specified interface. If the environment
|
376
|
+
# variable ZSYS_INTERFACE is set, use that as the default interface name.
|
377
|
+
# Setting the interface to "*" means "use all available interfaces".
|
175
378
|
#
|
176
379
|
# @param value [String, #to_s, nil]
|
177
380
|
# @return [void]
|
@@ -189,8 +392,8 @@ module CZMQ
|
|
189
392
|
end
|
190
393
|
|
191
394
|
# Set log identity, which is a string that prefixes all log messages sent
|
192
|
-
# by this process. The log identity defaults to the environment variable
|
193
|
-
# ZSYS_LOGIDENT, if that is set.
|
395
|
+
# by this process. The log identity defaults to the environment variable
|
396
|
+
# ZSYS_LOGIDENT, if that is set.
|
194
397
|
#
|
195
398
|
# @param value [String, #to_s, nil]
|
196
399
|
# @return [void]
|
@@ -199,13 +402,13 @@ module CZMQ
|
|
199
402
|
result
|
200
403
|
end
|
201
404
|
|
202
|
-
# Sends log output to a PUB socket bound to the specified endpoint. To
|
203
|
-
# collect such log output, create a SUB socket, subscribe to the traffic
|
204
|
-
# you care about, and connect to the endpoint. Log traffic is sent as a
|
205
|
-
# single string frame, in the same format as when sent to stdout. The
|
405
|
+
# Sends log output to a PUB socket bound to the specified endpoint. To
|
406
|
+
# collect such log output, create a SUB socket, subscribe to the traffic
|
407
|
+
# you care about, and connect to the endpoint. Log traffic is sent as a
|
408
|
+
# single string frame, in the same format as when sent to stdout. The
|
206
409
|
# log system supports a single sender; multiple calls to this method will
|
207
410
|
# bind the same sender to multiple endpoints. To disable the sender, call
|
208
|
-
# this method with a null argument.
|
411
|
+
# this method with a null argument.
|
209
412
|
#
|
210
413
|
# @param endpoint [String, #to_s, nil]
|
211
414
|
# @return [void]
|
@@ -215,7 +418,7 @@ module CZMQ
|
|
215
418
|
end
|
216
419
|
|
217
420
|
# Enable or disable logging to the system facility (syslog on POSIX boxes,
|
218
|
-
# event log on Windows). By default this is disabled.
|
421
|
+
# event log on Windows). By default this is disabled.
|
219
422
|
#
|
220
423
|
# @param logsystem [Boolean]
|
221
424
|
# @return [void]
|