czmq-ffi-gen 0.13.0 → 0.14.0
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 +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
@@ -76,7 +76,7 @@ module CZMQ
|
|
76
76
|
# Create a new callback of the following type:
|
77
77
|
# Callback function for zhash_freefn method
|
78
78
|
# typedef void (zhash_free_fn) (
|
79
|
-
# void *data);
|
79
|
+
# void *data);
|
80
80
|
#
|
81
81
|
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
82
82
|
# FFI::Function object after passing it to a C function call,
|
@@ -97,8 +97,8 @@ module CZMQ
|
|
97
97
|
end
|
98
98
|
|
99
99
|
# Unpack binary frame into a new hash table. Packed data must follow format
|
100
|
-
# defined by zhash_pack. Hash table is set to autofree. An empty frame
|
101
|
-
# unpacks to an empty hash table.
|
100
|
+
# defined by zhash_pack. Hash table is set to autofree. An empty frame
|
101
|
+
# unpacks to an empty hash table.
|
102
102
|
# @param frame [Zframe, #__ptr]
|
103
103
|
# @return [CZMQ::Zhash]
|
104
104
|
def self.unpack(frame)
|
@@ -117,9 +117,9 @@ module CZMQ
|
|
117
117
|
result
|
118
118
|
end
|
119
119
|
|
120
|
-
# Insert item into hash table with specified key and item.
|
120
|
+
# Insert item into hash table with specified key and item.
|
121
121
|
# If key is already present returns -1 and leaves existing item unchanged
|
122
|
-
# Returns 0 on success.
|
122
|
+
# Returns 0 on success.
|
123
123
|
#
|
124
124
|
# @param key [String, #to_s, nil]
|
125
125
|
# @param item [::FFI::Pointer, #to_ptr]
|
@@ -131,8 +131,8 @@ module CZMQ
|
|
131
131
|
result
|
132
132
|
end
|
133
133
|
|
134
|
-
# Update item into hash table with specified key and item.
|
135
|
-
# If key is already present, destroys old item and inserts new one.
|
134
|
+
# Update item into hash table with specified key and item.
|
135
|
+
# If key is already present, destroys old item and inserts new one.
|
136
136
|
# Use free_fn method to ensure deallocator is properly called on item.
|
137
137
|
#
|
138
138
|
# @param key [String, #to_s, nil]
|
@@ -146,7 +146,7 @@ module CZMQ
|
|
146
146
|
end
|
147
147
|
|
148
148
|
# Remove an item specified by key from the hash table. If there was no such
|
149
|
-
# item, this function does nothing.
|
149
|
+
# item, this function does nothing.
|
150
150
|
#
|
151
151
|
# @param key [String, #to_s, nil]
|
152
152
|
# @return [void]
|
@@ -169,7 +169,7 @@ module CZMQ
|
|
169
169
|
end
|
170
170
|
|
171
171
|
# Reindexes an item from an old key to a new key. If there was no such
|
172
|
-
# item, does nothing. Returns 0 if successful, else -1.
|
172
|
+
# item, does nothing. Returns 0 if successful, else -1.
|
173
173
|
#
|
174
174
|
# @param old_key [String, #to_s, nil]
|
175
175
|
# @param new_key [String, #to_s, nil]
|
@@ -182,10 +182,10 @@ module CZMQ
|
|
182
182
|
end
|
183
183
|
|
184
184
|
# Set a free function for the specified hash table item. When the item is
|
185
|
-
# destroyed, the free function, if any, is called on that item.
|
186
|
-
# Use this when hash items are dynamically allocated, to ensure that
|
187
|
-
# you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
|
188
|
-
# Returns the item, or NULL if there is no such item.
|
185
|
+
# destroyed, the free function, if any, is called on that item.
|
186
|
+
# Use this when hash items are dynamically allocated, to ensure that
|
187
|
+
# you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
|
188
|
+
# Returns the item, or NULL if there is no such item.
|
189
189
|
#
|
190
190
|
# @param key [String, #to_s, nil]
|
191
191
|
# @param free_fn [::FFI::Pointer, #to_ptr]
|
@@ -207,10 +207,10 @@ module CZMQ
|
|
207
207
|
result
|
208
208
|
end
|
209
209
|
|
210
|
-
# Make copy of hash table; if supplied table is null, returns null.
|
211
|
-
# Does not copy items themselves. Rebuilds new table so may be slow on
|
210
|
+
# Make copy of hash table; if supplied table is null, returns null.
|
211
|
+
# Does not copy items themselves. Rebuilds new table so may be slow on
|
212
212
|
# very large tables. NOTE: only works with item values that are strings
|
213
|
-
# since there's no other way to know how to duplicate the item value.
|
213
|
+
# since there's no other way to know how to duplicate the item value.
|
214
214
|
#
|
215
215
|
# @return [Zhash]
|
216
216
|
def dup()
|
@@ -232,10 +232,10 @@ module CZMQ
|
|
232
232
|
result
|
233
233
|
end
|
234
234
|
|
235
|
-
# Simple iterator; returns first item in hash table, in no given order,
|
236
|
-
# or NULL if the table is empty. This method is simpler to use than the
|
235
|
+
# Simple iterator; returns first item in hash table, in no given order,
|
236
|
+
# or NULL if the table is empty. This method is simpler to use than the
|
237
237
|
# foreach() method, which is deprecated. To access the key for this item
|
238
|
-
# use zhash_cursor(). NOTE: do NOT modify the table while iterating.
|
238
|
+
# use zhash_cursor(). NOTE: do NOT modify the table while iterating.
|
239
239
|
#
|
240
240
|
# @return [::FFI::Pointer]
|
241
241
|
def first()
|
@@ -245,12 +245,12 @@ module CZMQ
|
|
245
245
|
result
|
246
246
|
end
|
247
247
|
|
248
|
-
# Simple iterator; returns next item in hash table, in no given order,
|
248
|
+
# Simple iterator; returns next item in hash table, in no given order,
|
249
249
|
# or NULL if the last item was already returned. Use this together with
|
250
|
-
# zhash_first() to process all items in a hash table. If you need the
|
251
|
-
# items in sorted order, use zhash_keys() and then zlist_sort(). To
|
252
|
-
# access the key for this item use zhash_cursor(). NOTE: do NOT modify
|
253
|
-
# the table while iterating.
|
250
|
+
# zhash_first() to process all items in a hash table. If you need the
|
251
|
+
# items in sorted order, use zhash_keys() and then zlist_sort(). To
|
252
|
+
# access the key for this item use zhash_cursor(). NOTE: do NOT modify
|
253
|
+
# the table while iterating.
|
254
254
|
#
|
255
255
|
# @return [::FFI::Pointer]
|
256
256
|
def next()
|
@@ -261,9 +261,9 @@ module CZMQ
|
|
261
261
|
end
|
262
262
|
|
263
263
|
# After a successful first/next method, returns the key for the item that
|
264
|
-
# was returned. This is a constant string that you may not modify or
|
265
|
-
# deallocate, and which lasts as long as the item in the hash. After an
|
266
|
-
# unsuccessful first/next, returns NULL.
|
264
|
+
# was returned. This is a constant string that you may not modify or
|
265
|
+
# deallocate, and which lasts as long as the item in the hash. After an
|
266
|
+
# unsuccessful first/next, returns NULL.
|
267
267
|
#
|
268
268
|
# @return [String]
|
269
269
|
def cursor()
|
@@ -273,9 +273,9 @@ module CZMQ
|
|
273
273
|
result
|
274
274
|
end
|
275
275
|
|
276
|
-
# Add a comment to hash table before saving to disk. You can add as many
|
276
|
+
# Add a comment to hash table before saving to disk. You can add as many
|
277
277
|
# comment lines as you like. These comment lines are discarded when loading
|
278
|
-
# the file. If you use a null format, all comments are deleted.
|
278
|
+
# the file. If you use a null format, all comments are deleted.
|
279
279
|
#
|
280
280
|
# @param format [String, #to_s, nil]
|
281
281
|
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
@@ -289,24 +289,24 @@ module CZMQ
|
|
289
289
|
|
290
290
|
# Serialize hash table to a binary frame that can be sent in a message.
|
291
291
|
# The packed format is compatible with the 'dictionary' type defined in
|
292
|
-
# http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
|
293
|
-
#
|
294
|
-
# ; A list of name/value pairs
|
295
|
-
# dictionary = dict-count *( dict-name dict-value )
|
296
|
-
# dict-count = number-4
|
297
|
-
# dict-value = longstr
|
298
|
-
# dict-name = string
|
299
|
-
#
|
300
|
-
# ; Strings are always length + text contents
|
301
|
-
# longstr = number-4 *VCHAR
|
302
|
-
# string = number-1 *VCHAR
|
303
|
-
#
|
304
|
-
# ; Numbers are unsigned integers in network byte order
|
305
|
-
# number-1 = 1OCTET
|
306
|
-
# number-4 = 4OCTET
|
307
|
-
#
|
308
|
-
# Comments are not included in the packed data. Item values MUST be
|
309
|
-
# strings.
|
292
|
+
# http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
|
293
|
+
#
|
294
|
+
# ; A list of name/value pairs
|
295
|
+
# dictionary = dict-count *( dict-name dict-value )
|
296
|
+
# dict-count = number-4
|
297
|
+
# dict-value = longstr
|
298
|
+
# dict-name = string
|
299
|
+
#
|
300
|
+
# ; Strings are always length + text contents
|
301
|
+
# longstr = number-4 *VCHAR
|
302
|
+
# string = number-1 *VCHAR
|
303
|
+
#
|
304
|
+
# ; Numbers are unsigned integers in network byte order
|
305
|
+
# number-1 = 1OCTET
|
306
|
+
# number-4 = 4OCTET
|
307
|
+
#
|
308
|
+
# Comments are not included in the packed data. Item values MUST be
|
309
|
+
# strings.
|
310
310
|
#
|
311
311
|
# @return [Zframe]
|
312
312
|
def pack()
|
@@ -318,8 +318,8 @@ module CZMQ
|
|
318
318
|
end
|
319
319
|
|
320
320
|
# Save hash table to a text file in name=value format. Hash values must be
|
321
|
-
# printable strings; keys may not contain '=' character. Returns 0 if OK,
|
322
|
-
# else -1 if a file error occurred.
|
321
|
+
# printable strings; keys may not contain '=' character. Returns 0 if OK,
|
322
|
+
# else -1 if a file error occurred.
|
323
323
|
#
|
324
324
|
# @param filename [String, #to_s, nil]
|
325
325
|
# @return [Integer]
|
@@ -330,9 +330,9 @@ module CZMQ
|
|
330
330
|
result
|
331
331
|
end
|
332
332
|
|
333
|
-
# Load hash table from a text file in name=value format; hash table must
|
333
|
+
# Load hash table from a text file in name=value format; hash table must
|
334
334
|
# already exist. Hash values must printable strings; keys may not contain
|
335
|
-
# '=' character. Returns 0 if OK, else -1 if a file was not readable.
|
335
|
+
# '=' character. Returns 0 if OK, else -1 if a file was not readable.
|
336
336
|
#
|
337
337
|
# @param filename [String, #to_s, nil]
|
338
338
|
# @return [Integer]
|
@@ -345,8 +345,8 @@ module CZMQ
|
|
345
345
|
|
346
346
|
# When a hash table was loaded from a file by zhash_load, this method will
|
347
347
|
# reload the file if it has been modified since, and is "stable", i.e. not
|
348
|
-
# still changing. Returns 0 if OK, -1 if there was an error reloading the
|
349
|
-
# file.
|
348
|
+
# still changing. Returns 0 if OK, -1 if there was an error reloading the
|
349
|
+
# file.
|
350
350
|
#
|
351
351
|
# @return [Integer]
|
352
352
|
def refresh()
|
@@ -357,7 +357,7 @@ module CZMQ
|
|
357
357
|
end
|
358
358
|
|
359
359
|
# Set hash for automatic value destruction. Note that this assumes that
|
360
|
-
# values are NULL-terminated strings. Do not use with different types.
|
360
|
+
# values are NULL-terminated strings. Do not use with different types.
|
361
361
|
#
|
362
362
|
# @return [void]
|
363
363
|
def autofree()
|
@@ -76,7 +76,7 @@ module CZMQ
|
|
76
76
|
# Create a new callback of the following type:
|
77
77
|
# Destroy an item
|
78
78
|
# typedef void (zhashx_destructor_fn) (
|
79
|
-
# void **item);
|
79
|
+
# void **item);
|
80
80
|
#
|
81
81
|
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
82
82
|
# FFI::Function object after passing it to a C function call,
|
@@ -92,7 +92,7 @@ module CZMQ
|
|
92
92
|
# Create a new callback of the following type:
|
93
93
|
# Duplicate an item
|
94
94
|
# typedef void * (zhashx_duplicator_fn) (
|
95
|
-
# const void *item);
|
95
|
+
# const void *item);
|
96
96
|
#
|
97
97
|
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
98
98
|
# FFI::Function object after passing it to a C function call,
|
@@ -107,7 +107,7 @@ module CZMQ
|
|
107
107
|
|
108
108
|
# Create a new callback of the following type:
|
109
109
|
# Compare two items, for sorting
|
110
|
-
# typedef int (zhashx_comparator_fn) (
|
110
|
+
# typedef int (zhashx_comparator_fn) (
|
111
111
|
# const void *item1, const void *item2);
|
112
112
|
#
|
113
113
|
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
@@ -125,7 +125,7 @@ module CZMQ
|
|
125
125
|
# Create a new callback of the following type:
|
126
126
|
# Destroy an item.
|
127
127
|
# typedef void (zhashx_free_fn) (
|
128
|
-
# void *data);
|
128
|
+
# void *data);
|
129
129
|
#
|
130
130
|
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
131
131
|
# FFI::Function object after passing it to a C function call,
|
@@ -141,7 +141,7 @@ module CZMQ
|
|
141
141
|
# Create a new callback of the following type:
|
142
142
|
# Hash function for keys.
|
143
143
|
# typedef size_t (zhashx_hash_fn) (
|
144
|
-
# const void *key);
|
144
|
+
# const void *key);
|
145
145
|
#
|
146
146
|
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
147
147
|
# FFI::Function object after passing it to a C function call,
|
@@ -156,10 +156,10 @@ module CZMQ
|
|
156
156
|
end
|
157
157
|
|
158
158
|
# Create a new callback of the following type:
|
159
|
-
# Serializes an item to a longstr.
|
159
|
+
# Serializes an item to a longstr.
|
160
160
|
# The caller takes ownership of the newly created object.
|
161
161
|
# typedef char * (zhashx_serializer_fn) (
|
162
|
-
# const void *item);
|
162
|
+
# const void *item);
|
163
163
|
#
|
164
164
|
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
165
165
|
# FFI::Function object after passing it to a C function call,
|
@@ -173,10 +173,10 @@ module CZMQ
|
|
173
173
|
end
|
174
174
|
|
175
175
|
# Create a new callback of the following type:
|
176
|
-
# Deserializes a longstr into an item.
|
176
|
+
# Deserializes a longstr into an item.
|
177
177
|
# The caller takes ownership of the newly created object.
|
178
178
|
# typedef void * (zhashx_deserializer_fn) (
|
179
|
-
# const char *item_str);
|
179
|
+
# const char *item_str);
|
180
180
|
#
|
181
181
|
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
182
182
|
# FFI::Function object after passing it to a C function call,
|
@@ -197,8 +197,8 @@ module CZMQ
|
|
197
197
|
end
|
198
198
|
|
199
199
|
# Unpack binary frame into a new hash table. Packed data must follow format
|
200
|
-
# defined by zhashx_pack. Hash table is set to autofree. An empty frame
|
201
|
-
# unpacks to an empty hash table.
|
200
|
+
# defined by zhashx_pack. Hash table is set to autofree. An empty frame
|
201
|
+
# unpacks to an empty hash table.
|
202
202
|
# @param frame [Zframe, #__ptr]
|
203
203
|
# @return [CZMQ::Zhashx]
|
204
204
|
def self.unpack(frame)
|
@@ -208,7 +208,7 @@ module CZMQ
|
|
208
208
|
end
|
209
209
|
|
210
210
|
# Same as unpack but uses a user-defined deserializer function to convert
|
211
|
-
# a longstr back into item format.
|
211
|
+
# a longstr back into item format.
|
212
212
|
# @param frame [Zframe, #__ptr]
|
213
213
|
# @param deserializer [::FFI::Pointer, #to_ptr]
|
214
214
|
# @return [CZMQ::Zhashx]
|
@@ -228,9 +228,9 @@ module CZMQ
|
|
228
228
|
result
|
229
229
|
end
|
230
230
|
|
231
|
-
# Insert item into hash table with specified key and item.
|
231
|
+
# Insert item into hash table with specified key and item.
|
232
232
|
# If key is already present returns -1 and leaves existing item unchanged
|
233
|
-
# Returns 0 on success.
|
233
|
+
# Returns 0 on success.
|
234
234
|
#
|
235
235
|
# @param key [::FFI::Pointer, #to_ptr]
|
236
236
|
# @param item [::FFI::Pointer, #to_ptr]
|
@@ -244,9 +244,9 @@ module CZMQ
|
|
244
244
|
|
245
245
|
# Update or insert item into hash table with specified key and item. If the
|
246
246
|
# key is already present, destroys old item and inserts new one. If you set
|
247
|
-
# a container item destructor, this is called on the old value. If the key
|
248
|
-
# was not already present, inserts a new item. Sets the hash cursor to the
|
249
|
-
# new item.
|
247
|
+
# a container item destructor, this is called on the old value. If the key
|
248
|
+
# was not already present, inserts a new item. Sets the hash cursor to the
|
249
|
+
# new item.
|
250
250
|
#
|
251
251
|
# @param key [::FFI::Pointer, #to_ptr]
|
252
252
|
# @param item [::FFI::Pointer, #to_ptr]
|
@@ -259,7 +259,7 @@ module CZMQ
|
|
259
259
|
end
|
260
260
|
|
261
261
|
# Remove an item specified by key from the hash table. If there was no such
|
262
|
-
# item, this function does nothing.
|
262
|
+
# item, this function does nothing.
|
263
263
|
#
|
264
264
|
# @param key [::FFI::Pointer, #to_ptr]
|
265
265
|
# @return [void]
|
@@ -270,9 +270,9 @@ module CZMQ
|
|
270
270
|
result
|
271
271
|
end
|
272
272
|
|
273
|
-
# Delete all items from the hash table. If the key destructor is
|
273
|
+
# Delete all items from the hash table. If the key destructor is
|
274
274
|
# set, calls it on every key. If the item destructor is set, calls
|
275
|
-
# it on every item.
|
275
|
+
# it on every item.
|
276
276
|
#
|
277
277
|
# @return [void]
|
278
278
|
def purge()
|
@@ -294,7 +294,7 @@ module CZMQ
|
|
294
294
|
end
|
295
295
|
|
296
296
|
# Reindexes an item from an old key to a new key. If there was no such
|
297
|
-
# item, does nothing. Returns 0 if successful, else -1.
|
297
|
+
# item, does nothing. Returns 0 if successful, else -1.
|
298
298
|
#
|
299
299
|
# @param old_key [::FFI::Pointer, #to_ptr]
|
300
300
|
# @param new_key [::FFI::Pointer, #to_ptr]
|
@@ -307,10 +307,10 @@ module CZMQ
|
|
307
307
|
end
|
308
308
|
|
309
309
|
# Set a free function for the specified hash table item. When the item is
|
310
|
-
# destroyed, the free function, if any, is called on that item.
|
311
|
-
# Use this when hash items are dynamically allocated, to ensure that
|
312
|
-
# you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
|
313
|
-
# Returns the item, or NULL if there is no such item.
|
310
|
+
# destroyed, the free function, if any, is called on that item.
|
311
|
+
# Use this when hash items are dynamically allocated, to ensure that
|
312
|
+
# you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
|
313
|
+
# Returns the item, or NULL if there is no such item.
|
314
314
|
#
|
315
315
|
# @param key [::FFI::Pointer, #to_ptr]
|
316
316
|
# @param free_fn [::FFI::Pointer, #to_ptr]
|
@@ -332,9 +332,9 @@ module CZMQ
|
|
332
332
|
result
|
333
333
|
end
|
334
334
|
|
335
|
-
# Return a zlistx_t containing the keys for the items in the
|
335
|
+
# Return a zlistx_t containing the keys for the items in the
|
336
336
|
# table. Uses the key_duplicator to duplicate all keys and sets the
|
337
|
-
# key_destructor as destructor for the list.
|
337
|
+
# key_destructor as destructor for the list.
|
338
338
|
#
|
339
339
|
# @return [Zlistx]
|
340
340
|
def keys()
|
@@ -345,9 +345,9 @@ module CZMQ
|
|
345
345
|
result
|
346
346
|
end
|
347
347
|
|
348
|
-
# Return a zlistx_t containing the values for the items in the
|
348
|
+
# Return a zlistx_t containing the values for the items in the
|
349
349
|
# table. Uses the duplicator to duplicate all items and sets the
|
350
|
-
# destructor as destructor for the list.
|
350
|
+
# destructor as destructor for the list.
|
351
351
|
#
|
352
352
|
# @return [Zlistx]
|
353
353
|
def values()
|
@@ -358,10 +358,10 @@ module CZMQ
|
|
358
358
|
result
|
359
359
|
end
|
360
360
|
|
361
|
-
# Simple iterator; returns first item in hash table, in no given order,
|
362
|
-
# or NULL if the table is empty. This method is simpler to use than the
|
361
|
+
# Simple iterator; returns first item in hash table, in no given order,
|
362
|
+
# or NULL if the table is empty. This method is simpler to use than the
|
363
363
|
# foreach() method, which is deprecated. To access the key for this item
|
364
|
-
# use zhashx_cursor(). NOTE: do NOT modify the table while iterating.
|
364
|
+
# use zhashx_cursor(). NOTE: do NOT modify the table while iterating.
|
365
365
|
#
|
366
366
|
# @return [::FFI::Pointer]
|
367
367
|
def first()
|
@@ -371,12 +371,12 @@ module CZMQ
|
|
371
371
|
result
|
372
372
|
end
|
373
373
|
|
374
|
-
# Simple iterator; returns next item in hash table, in no given order,
|
374
|
+
# Simple iterator; returns next item in hash table, in no given order,
|
375
375
|
# or NULL if the last item was already returned. Use this together with
|
376
|
-
# zhashx_first() to process all items in a hash table. If you need the
|
377
|
-
# items in sorted order, use zhashx_keys() and then zlistx_sort(). To
|
376
|
+
# zhashx_first() to process all items in a hash table. If you need the
|
377
|
+
# items in sorted order, use zhashx_keys() and then zlistx_sort(). To
|
378
378
|
# access the key for this item use zhashx_cursor(). NOTE: do NOT modify
|
379
|
-
# the table while iterating.
|
379
|
+
# the table while iterating.
|
380
380
|
#
|
381
381
|
# @return [::FFI::Pointer]
|
382
382
|
def next()
|
@@ -387,9 +387,9 @@ module CZMQ
|
|
387
387
|
end
|
388
388
|
|
389
389
|
# After a successful first/next method, returns the key for the item that
|
390
|
-
# was returned. This is a constant string that you may not modify or
|
391
|
-
# deallocate, and which lasts as long as the item in the hash. After an
|
392
|
-
# unsuccessful first/next, returns NULL.
|
390
|
+
# was returned. This is a constant string that you may not modify or
|
391
|
+
# deallocate, and which lasts as long as the item in the hash. After an
|
392
|
+
# unsuccessful first/next, returns NULL.
|
393
393
|
#
|
394
394
|
# @return [::FFI::Pointer]
|
395
395
|
def cursor()
|
@@ -399,9 +399,9 @@ module CZMQ
|
|
399
399
|
result
|
400
400
|
end
|
401
401
|
|
402
|
-
# Add a comment to hash table before saving to disk. You can add as many
|
402
|
+
# Add a comment to hash table before saving to disk. You can add as many
|
403
403
|
# comment lines as you like. These comment lines are discarded when loading
|
404
|
-
# the file. If you use a null format, all comments are deleted.
|
404
|
+
# the file. If you use a null format, all comments are deleted.
|
405
405
|
#
|
406
406
|
# @param format [String, #to_s, nil]
|
407
407
|
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
@@ -414,8 +414,8 @@ module CZMQ
|
|
414
414
|
end
|
415
415
|
|
416
416
|
# Save hash table to a text file in name=value format. Hash values must be
|
417
|
-
# printable strings; keys may not contain '=' character. Returns 0 if OK,
|
418
|
-
# else -1 if a file error occurred.
|
417
|
+
# printable strings; keys may not contain '=' character. Returns 0 if OK,
|
418
|
+
# else -1 if a file error occurred.
|
419
419
|
#
|
420
420
|
# @param filename [String, #to_s, nil]
|
421
421
|
# @return [Integer]
|
@@ -426,9 +426,9 @@ module CZMQ
|
|
426
426
|
result
|
427
427
|
end
|
428
428
|
|
429
|
-
# Load hash table from a text file in name=value format; hash table must
|
429
|
+
# Load hash table from a text file in name=value format; hash table must
|
430
430
|
# already exist. Hash values must printable strings; keys may not contain
|
431
|
-
# '=' character. Returns 0 if OK, else -1 if a file was not readable.
|
431
|
+
# '=' character. Returns 0 if OK, else -1 if a file was not readable.
|
432
432
|
#
|
433
433
|
# @param filename [String, #to_s, nil]
|
434
434
|
# @return [Integer]
|
@@ -440,9 +440,9 @@ module CZMQ
|
|
440
440
|
end
|
441
441
|
|
442
442
|
# When a hash table was loaded from a file by zhashx_load, this method will
|
443
|
-
# reload the file if it has been modified since, and is "stable", i.e. not
|
444
|
-
# still changing. Returns 0 if OK, -1 if there was an error reloading the
|
445
|
-
# file.
|
443
|
+
# reload the file if it has been modified since, and is "stable", i.e. not
|
444
|
+
# still changing. Returns 0 if OK, -1 if there was an error reloading the
|
445
|
+
# file.
|
446
446
|
#
|
447
447
|
# @return [Integer]
|
448
448
|
def refresh()
|
@@ -454,24 +454,24 @@ module CZMQ
|
|
454
454
|
|
455
455
|
# Serialize hash table to a binary frame that can be sent in a message.
|
456
456
|
# The packed format is compatible with the 'dictionary' type defined in
|
457
|
-
# http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
|
458
|
-
#
|
459
|
-
# ; A list of name/value pairs
|
460
|
-
# dictionary = dict-count *( dict-name dict-value )
|
461
|
-
# dict-count = number-4
|
462
|
-
# dict-value = longstr
|
463
|
-
# dict-name = string
|
464
|
-
#
|
465
|
-
# ; Strings are always length + text contents
|
466
|
-
# longstr = number-4 *VCHAR
|
467
|
-
# string = number-1 *VCHAR
|
468
|
-
#
|
469
|
-
# ; Numbers are unsigned integers in network byte order
|
470
|
-
# number-1 = 1OCTET
|
471
|
-
# number-4 = 4OCTET
|
472
|
-
#
|
473
|
-
# Comments are not included in the packed data. Item values MUST be
|
474
|
-
# strings.
|
457
|
+
# http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
|
458
|
+
#
|
459
|
+
# ; A list of name/value pairs
|
460
|
+
# dictionary = dict-count *( dict-name dict-value )
|
461
|
+
# dict-count = number-4
|
462
|
+
# dict-value = longstr
|
463
|
+
# dict-name = string
|
464
|
+
#
|
465
|
+
# ; Strings are always length + text contents
|
466
|
+
# longstr = number-4 *VCHAR
|
467
|
+
# string = number-1 *VCHAR
|
468
|
+
#
|
469
|
+
# ; Numbers are unsigned integers in network byte order
|
470
|
+
# number-1 = 1OCTET
|
471
|
+
# number-4 = 4OCTET
|
472
|
+
#
|
473
|
+
# Comments are not included in the packed data. Item values MUST be
|
474
|
+
# strings.
|
475
475
|
#
|
476
476
|
# @return [Zframe]
|
477
477
|
def pack()
|
@@ -483,7 +483,7 @@ module CZMQ
|
|
483
483
|
end
|
484
484
|
|
485
485
|
# Same as pack but uses a user-defined serializer function to convert items
|
486
|
-
# into longstr.
|
486
|
+
# into longstr.
|
487
487
|
#
|
488
488
|
# @param serializer [::FFI::Pointer, #to_ptr]
|
489
489
|
# @return [Zframe]
|
@@ -495,9 +495,9 @@ module CZMQ
|
|
495
495
|
result
|
496
496
|
end
|
497
497
|
|
498
|
-
# Make a copy of the list; items are duplicated if you set a duplicator
|
499
|
-
# for the list, otherwise not. Copying a null reference returns a null
|
500
|
-
# reference. Note that this method's behavior changed slightly for CZMQ
|
498
|
+
# Make a copy of the list; items are duplicated if you set a duplicator
|
499
|
+
# for the list, otherwise not. Copying a null reference returns a null
|
500
|
+
# reference. Note that this method's behavior changed slightly for CZMQ
|
501
501
|
# v3.x, as it does not set nor respect autofree. It does however let you
|
502
502
|
# duplicate any hash table safely. The old behavior is in zhashx_dup_v2.
|
503
503
|
#
|
@@ -511,7 +511,7 @@ module CZMQ
|
|
511
511
|
end
|
512
512
|
|
513
513
|
# Set a user-defined deallocator for hash items; by default items are not
|
514
|
-
# freed when the hash is destroyed.
|
514
|
+
# freed when the hash is destroyed.
|
515
515
|
#
|
516
516
|
# @param destructor [::FFI::Pointer, #to_ptr]
|
517
517
|
# @return [void]
|
@@ -523,7 +523,7 @@ module CZMQ
|
|
523
523
|
end
|
524
524
|
|
525
525
|
# Set a user-defined duplicator for hash items; by default items are not
|
526
|
-
# copied when the hash is duplicated.
|
526
|
+
# copied when the hash is duplicated.
|
527
527
|
#
|
528
528
|
# @param duplicator [::FFI::Pointer, #to_ptr]
|
529
529
|
# @return [void]
|
@@ -535,7 +535,7 @@ module CZMQ
|
|
535
535
|
end
|
536
536
|
|
537
537
|
# Set a user-defined deallocator for keys; by default keys are freed
|
538
|
-
# when the hash is destroyed using free().
|
538
|
+
# when the hash is destroyed using free().
|
539
539
|
#
|
540
540
|
# @param destructor [::FFI::Pointer, #to_ptr]
|
541
541
|
# @return [void]
|
@@ -547,7 +547,7 @@ module CZMQ
|
|
547
547
|
end
|
548
548
|
|
549
549
|
# Set a user-defined duplicator for keys; by default keys are duplicated
|
550
|
-
# using strdup.
|
550
|
+
# using strdup.
|
551
551
|
#
|
552
552
|
# @param duplicator [::FFI::Pointer, #to_ptr]
|
553
553
|
# @return [void]
|
@@ -559,7 +559,9 @@ module CZMQ
|
|
559
559
|
end
|
560
560
|
|
561
561
|
# Set a user-defined comparator for keys; by default keys are
|
562
|
-
# compared using strcmp.
|
562
|
+
# compared using strcmp.
|
563
|
+
# The callback function should return zero (0) on matching
|
564
|
+
# items.
|
563
565
|
#
|
564
566
|
# @param comparator [::FFI::Pointer, #to_ptr]
|
565
567
|
# @return [void]
|
@@ -570,8 +572,8 @@ module CZMQ
|
|
570
572
|
result
|
571
573
|
end
|
572
574
|
|
573
|
-
# Set a user-defined
|
574
|
-
#
|
575
|
+
# Set a user-defined hash function for keys; by default keys are
|
576
|
+
# hashed by a modified Bernstein hashing function.
|
575
577
|
#
|
576
578
|
# @param hasher [::FFI::Pointer, #to_ptr]
|
577
579
|
# @return [void]
|
@@ -582,10 +584,10 @@ module CZMQ
|
|
582
584
|
result
|
583
585
|
end
|
584
586
|
|
585
|
-
# Make copy of hash table; if supplied table is null, returns null.
|
586
|
-
# Does not copy items themselves. Rebuilds new table so may be slow on
|
587
|
+
# Make copy of hash table; if supplied table is null, returns null.
|
588
|
+
# Does not copy items themselves. Rebuilds new table so may be slow on
|
587
589
|
# very large tables. NOTE: only works with item values that are strings
|
588
|
-
# since there's no other way to know how to duplicate the item value.
|
590
|
+
# since there's no other way to know how to duplicate the item value.
|
589
591
|
#
|
590
592
|
# @return [Zhashx]
|
591
593
|
def dup_v2()
|
@@ -170,6 +170,36 @@ module CZMQ
|
|
170
170
|
result
|
171
171
|
end
|
172
172
|
|
173
|
+
# Get a list of network interfaces currently defined on the system
|
174
|
+
# Includes IPv6 interfaces
|
175
|
+
#
|
176
|
+
# @return [Ziflist]
|
177
|
+
def self.new_ipv6()
|
178
|
+
result = ::CZMQ::FFI.ziflist_new_ipv6()
|
179
|
+
result = Ziflist.__new result, true
|
180
|
+
result
|
181
|
+
end
|
182
|
+
|
183
|
+
# Reload network interfaces from system, including IPv6
|
184
|
+
#
|
185
|
+
# @return [void]
|
186
|
+
def reload_ipv6()
|
187
|
+
raise DestroyedError unless @ptr
|
188
|
+
self_p = @ptr
|
189
|
+
result = ::CZMQ::FFI.ziflist_reload_ipv6(self_p)
|
190
|
+
result
|
191
|
+
end
|
192
|
+
|
193
|
+
# Return true if the current interface uses IPv6
|
194
|
+
#
|
195
|
+
# @return [Boolean]
|
196
|
+
def is_ipv6()
|
197
|
+
raise DestroyedError unless @ptr
|
198
|
+
self_p = @ptr
|
199
|
+
result = ::CZMQ::FFI.ziflist_is_ipv6(self_p)
|
200
|
+
result
|
201
|
+
end
|
202
|
+
|
173
203
|
# Self test of this class.
|
174
204
|
#
|
175
205
|
# @param verbose [Boolean]
|