czmq-ffi-gen 0.9.2-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS +1 -0
- data/CHANGES.md +92 -0
- data/Gemfile +2 -0
- data/LICENSE +14 -0
- data/README.md +112 -0
- data/lib/czmq-ffi-gen.rb +7 -0
- data/lib/czmq-ffi-gen/czmq/ffi.rb +1210 -0
- data/lib/czmq-ffi-gen/czmq/ffi/version.rb +15 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +186 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +286 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +307 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +222 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +388 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +140 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +442 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +156 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +283 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +194 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +353 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +359 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +416 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +659 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +189 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +365 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +478 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +396 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +515 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +194 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +294 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +3479 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +203 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +203 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +221 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +227 -0
- data/lib/czmq-ffi-gen/errors.rb +12 -0
- data/lib/czmq-ffi-gen/gem_version.rb +5 -0
- data/lib/czmq-ffi-gen/legacy.rb +16 -0
- data/lib/czmq-ffi-gen/libzmq.rb +18 -0
- data/lib/czmq-ffi-gen/signals.rb +27 -0
- data/lib/czmq-ffi-gen/vendor.rb +5 -0
- data/lib/czmq-ffi-gen/versions.rb +19 -0
- data/vendor/local/bin/inproc_lat.exe +0 -0
- data/vendor/local/bin/inproc_thr.exe +0 -0
- data/vendor/local/bin/libczmq.dll +0 -0
- data/vendor/local/bin/libgcc_s_seh-1.dll +0 -0
- data/vendor/local/bin/libstdc++-6.dll +0 -0
- data/vendor/local/bin/libzmq.dll +0 -0
- data/vendor/local/bin/local_lat.exe +0 -0
- data/vendor/local/bin/local_thr.exe +0 -0
- data/vendor/local/bin/remote_lat.exe +0 -0
- data/vendor/local/bin/remote_thr.exe +0 -0
- data/vendor/local/include/czmq.h +31 -0
- data/vendor/local/include/czmq_library.h +199 -0
- data/vendor/local/include/czmq_prelude.h +641 -0
- data/vendor/local/include/readme.txt +83 -0
- data/vendor/local/include/sha1.h +76 -0
- data/vendor/local/include/sha1.inc_c +335 -0
- data/vendor/local/include/slre.h +92 -0
- data/vendor/local/include/slre.inc_c +660 -0
- data/vendor/local/include/zactor.h +76 -0
- data/vendor/local/include/zarmour.h +114 -0
- data/vendor/local/include/zauth.h +100 -0
- data/vendor/local/include/zauth_v2.h +88 -0
- data/vendor/local/include/zbeacon.h +86 -0
- data/vendor/local/include/zbeacon_v2.h +75 -0
- data/vendor/local/include/zcert.h +136 -0
- data/vendor/local/include/zcertstore.h +100 -0
- data/vendor/local/include/zchunk.h +163 -0
- data/vendor/local/include/zclock.h +73 -0
- data/vendor/local/include/zconfig.h +185 -0
- data/vendor/local/include/zctx.h +107 -0
- data/vendor/local/include/zdigest.h +65 -0
- data/vendor/local/include/zdir.h +149 -0
- data/vendor/local/include/zdir_patch.h +82 -0
- data/vendor/local/include/zfile.h +177 -0
- data/vendor/local/include/zframe.h +176 -0
- data/vendor/local/include/zgossip.h +95 -0
- data/vendor/local/include/zgossip_engine.inc +927 -0
- data/vendor/local/include/zgossip_msg.h +129 -0
- data/vendor/local/include/zhash.h +195 -0
- data/vendor/local/include/zhash_primes.inc +329 -0
- data/vendor/local/include/zhashx.h +298 -0
- data/vendor/local/include/ziflist.h +77 -0
- data/vendor/local/include/zlist.h +158 -0
- data/vendor/local/include/zlistx.h +205 -0
- data/vendor/local/include/zloop.h +168 -0
- data/vendor/local/include/zmonitor.h +73 -0
- data/vendor/local/include/zmonitor_v2.h +56 -0
- data/vendor/local/include/zmq.h +617 -0
- data/vendor/local/include/zmq_utils.h +48 -0
- data/vendor/local/include/zmsg.h +280 -0
- data/vendor/local/include/zmutex.h +55 -0
- data/vendor/local/include/zpoller.h +92 -0
- data/vendor/local/include/zproc.h +168 -0
- data/vendor/local/include/zproxy.h +111 -0
- data/vendor/local/include/zproxy_v2.h +62 -0
- data/vendor/local/include/zrex.h +82 -0
- data/vendor/local/include/zsock.h +912 -0
- data/vendor/local/include/zsock_option.inc +4126 -0
- data/vendor/local/include/zsocket.h +110 -0
- data/vendor/local/include/zsockopt.h +256 -0
- data/vendor/local/include/zstr.h +110 -0
- data/vendor/local/include/zsys.h +386 -0
- data/vendor/local/include/zthread.h +50 -0
- data/vendor/local/include/ztimerset.h +90 -0
- data/vendor/local/include/ztrie.h +106 -0
- data/vendor/local/include/zuuid.h +96 -0
- data/vendor/local/lib/libczmq.dll.a +0 -0
- data/vendor/local/lib/liblibzmq.dll.a +0 -0
- data/vendor/local/lib/libzmq-static.a +0 -0
- data/vendor/local/lib/pkgconfig/libczmq.pc +23 -0
- data/vendor/local/lib/pkgconfig/libzmq.pc +11 -0
- data/vendor/local/share/zmq/AUTHORS.txt +147 -0
- data/vendor/local/share/zmq/COPYING.LESSER.txt +181 -0
- data/vendor/local/share/zmq/COPYING.txt +674 -0
- data/vendor/local/share/zmq/NEWS.txt +978 -0
- metadata +230 -0
@@ -0,0 +1,307 @@
|
|
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
|
+
# work with CURVE security certificates
|
10
|
+
# @note This class is 100% generated using zproject.
|
11
|
+
class Zcert
|
12
|
+
# Raised when one tries to use an instance of {Zcert} 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
|
+
# @param ptr [::FFI::Pointer]
|
34
|
+
# @return [Proc]
|
35
|
+
def self.create_finalizer_for(ptr)
|
36
|
+
Proc.new do
|
37
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
38
|
+
ptr_ptr.write_pointer ptr
|
39
|
+
::CZMQ::FFI.zcert_destroy ptr_ptr
|
40
|
+
end
|
41
|
+
end
|
42
|
+
# @return [Boolean]
|
43
|
+
def null?
|
44
|
+
!@ptr or @ptr.null?
|
45
|
+
end
|
46
|
+
# Return internal pointer
|
47
|
+
# @return [::FFI::Pointer]
|
48
|
+
def __ptr
|
49
|
+
raise DestroyedError unless @ptr
|
50
|
+
@ptr
|
51
|
+
end
|
52
|
+
# So external Libraries can just pass the Object to a FFI function which expects a :pointer
|
53
|
+
alias_method :to_ptr, :__ptr
|
54
|
+
# Nullify internal pointer and return pointer pointer.
|
55
|
+
# @note This detaches the current instance from the native object
|
56
|
+
# and thus makes it unusable.
|
57
|
+
# @return [::FFI::MemoryPointer] the pointer pointing to a pointer
|
58
|
+
# pointing to the native object
|
59
|
+
def __ptr_give_ref
|
60
|
+
raise DestroyedError unless @ptr
|
61
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
62
|
+
ptr_ptr.write_pointer @ptr
|
63
|
+
__undef_finalizer if @finalizer
|
64
|
+
@ptr = nil
|
65
|
+
ptr_ptr
|
66
|
+
end
|
67
|
+
# Undefines the finalizer for this object.
|
68
|
+
# @note Only use this if you need to and can guarantee that the native
|
69
|
+
# object will be freed by other means.
|
70
|
+
# @return [void]
|
71
|
+
def __undef_finalizer
|
72
|
+
ObjectSpace.undefine_finalizer self
|
73
|
+
@finalizer = nil
|
74
|
+
end
|
75
|
+
|
76
|
+
# Create and initialize a new certificate in memory
|
77
|
+
# @return [CZMQ::Zcert]
|
78
|
+
def self.new()
|
79
|
+
ptr = ::CZMQ::FFI.zcert_new()
|
80
|
+
__new ptr
|
81
|
+
end
|
82
|
+
|
83
|
+
# Accepts public/secret key pair from caller
|
84
|
+
# @param public_key [::FFI::Pointer, #to_ptr]
|
85
|
+
# @param secret_key [::FFI::Pointer, #to_ptr]
|
86
|
+
# @return [CZMQ::Zcert]
|
87
|
+
def self.new_from(public_key, secret_key)
|
88
|
+
ptr = ::CZMQ::FFI.zcert_new_from(public_key, secret_key)
|
89
|
+
__new ptr
|
90
|
+
end
|
91
|
+
|
92
|
+
# Load certificate from file
|
93
|
+
# @param filename [String, #to_s, nil]
|
94
|
+
# @return [CZMQ::Zcert]
|
95
|
+
def self.load(filename)
|
96
|
+
ptr = ::CZMQ::FFI.zcert_load(filename)
|
97
|
+
__new ptr
|
98
|
+
end
|
99
|
+
|
100
|
+
# Destroy a certificate in memory
|
101
|
+
#
|
102
|
+
# @return [void]
|
103
|
+
def destroy()
|
104
|
+
return unless @ptr
|
105
|
+
self_p = __ptr_give_ref
|
106
|
+
result = ::CZMQ::FFI.zcert_destroy(self_p)
|
107
|
+
result
|
108
|
+
end
|
109
|
+
|
110
|
+
# Return public part of key pair as 32-byte binary string
|
111
|
+
#
|
112
|
+
# @return [::FFI::Pointer]
|
113
|
+
def public_key()
|
114
|
+
raise DestroyedError unless @ptr
|
115
|
+
self_p = @ptr
|
116
|
+
result = ::CZMQ::FFI.zcert_public_key(self_p)
|
117
|
+
result
|
118
|
+
end
|
119
|
+
|
120
|
+
# Return secret part of key pair as 32-byte binary string
|
121
|
+
#
|
122
|
+
# @return [::FFI::Pointer]
|
123
|
+
def secret_key()
|
124
|
+
raise DestroyedError unless @ptr
|
125
|
+
self_p = @ptr
|
126
|
+
result = ::CZMQ::FFI.zcert_secret_key(self_p)
|
127
|
+
result
|
128
|
+
end
|
129
|
+
|
130
|
+
# Return public part of key pair as Z85 armored string
|
131
|
+
#
|
132
|
+
# @return [String]
|
133
|
+
def public_txt()
|
134
|
+
raise DestroyedError unless @ptr
|
135
|
+
self_p = @ptr
|
136
|
+
result = ::CZMQ::FFI.zcert_public_txt(self_p)
|
137
|
+
result
|
138
|
+
end
|
139
|
+
|
140
|
+
# Return secret part of key pair as Z85 armored string
|
141
|
+
#
|
142
|
+
# @return [String]
|
143
|
+
def secret_txt()
|
144
|
+
raise DestroyedError unless @ptr
|
145
|
+
self_p = @ptr
|
146
|
+
result = ::CZMQ::FFI.zcert_secret_txt(self_p)
|
147
|
+
result
|
148
|
+
end
|
149
|
+
|
150
|
+
# Set certificate metadata from formatted string.
|
151
|
+
#
|
152
|
+
# @param name [String, #to_s, nil]
|
153
|
+
# @param format [String, #to_s, nil]
|
154
|
+
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
155
|
+
# @return [void]
|
156
|
+
def set_meta(name, format, *args)
|
157
|
+
raise DestroyedError unless @ptr
|
158
|
+
self_p = @ptr
|
159
|
+
result = ::CZMQ::FFI.zcert_set_meta(self_p, name, format, *args)
|
160
|
+
result
|
161
|
+
end
|
162
|
+
|
163
|
+
# Unset certificate metadata.
|
164
|
+
#
|
165
|
+
# @param name [String, #to_s, nil]
|
166
|
+
# @return [void]
|
167
|
+
def unset_meta(name)
|
168
|
+
raise DestroyedError unless @ptr
|
169
|
+
self_p = @ptr
|
170
|
+
result = ::CZMQ::FFI.zcert_unset_meta(self_p, name)
|
171
|
+
result
|
172
|
+
end
|
173
|
+
|
174
|
+
# Get metadata value from certificate; if the metadata value doesn't
|
175
|
+
# exist, returns NULL.
|
176
|
+
#
|
177
|
+
# @param name [String, #to_s, nil]
|
178
|
+
# @return [String]
|
179
|
+
def meta(name)
|
180
|
+
raise DestroyedError unless @ptr
|
181
|
+
self_p = @ptr
|
182
|
+
result = ::CZMQ::FFI.zcert_meta(self_p, name)
|
183
|
+
result
|
184
|
+
end
|
185
|
+
|
186
|
+
# Get list of metadata fields from certificate. Caller is responsible for
|
187
|
+
# destroying list. Caller should not modify the values of list items.
|
188
|
+
#
|
189
|
+
# @return [Zlist]
|
190
|
+
def meta_keys()
|
191
|
+
raise DestroyedError unless @ptr
|
192
|
+
self_p = @ptr
|
193
|
+
result = ::CZMQ::FFI.zcert_meta_keys(self_p)
|
194
|
+
result = Zlist.__new result, false
|
195
|
+
result
|
196
|
+
end
|
197
|
+
|
198
|
+
# Save full certificate (public + secret) to file for persistent storage
|
199
|
+
# This creates one public file and one secret file (filename + "_secret").
|
200
|
+
#
|
201
|
+
# @param filename [String, #to_s, nil]
|
202
|
+
# @return [Integer]
|
203
|
+
def save(filename)
|
204
|
+
raise DestroyedError unless @ptr
|
205
|
+
self_p = @ptr
|
206
|
+
result = ::CZMQ::FFI.zcert_save(self_p, filename)
|
207
|
+
result
|
208
|
+
end
|
209
|
+
|
210
|
+
# Save public certificate only to file for persistent storage
|
211
|
+
#
|
212
|
+
# @param filename [String, #to_s, nil]
|
213
|
+
# @return [Integer]
|
214
|
+
def save_public(filename)
|
215
|
+
raise DestroyedError unless @ptr
|
216
|
+
self_p = @ptr
|
217
|
+
result = ::CZMQ::FFI.zcert_save_public(self_p, filename)
|
218
|
+
result
|
219
|
+
end
|
220
|
+
|
221
|
+
# Save secret certificate only to file for persistent storage
|
222
|
+
#
|
223
|
+
# @param filename [String, #to_s, nil]
|
224
|
+
# @return [Integer]
|
225
|
+
def save_secret(filename)
|
226
|
+
raise DestroyedError unless @ptr
|
227
|
+
self_p = @ptr
|
228
|
+
result = ::CZMQ::FFI.zcert_save_secret(self_p, filename)
|
229
|
+
result
|
230
|
+
end
|
231
|
+
|
232
|
+
# Apply certificate to socket, i.e. use for CURVE security on socket.
|
233
|
+
# If certificate was loaded from public file, the secret key will be
|
234
|
+
# undefined, and this certificate will not work successfully.
|
235
|
+
#
|
236
|
+
# @param socket [::FFI::Pointer, #to_ptr]
|
237
|
+
# @return [void]
|
238
|
+
def apply(socket)
|
239
|
+
raise DestroyedError unless @ptr
|
240
|
+
self_p = @ptr
|
241
|
+
result = ::CZMQ::FFI.zcert_apply(self_p, socket)
|
242
|
+
result
|
243
|
+
end
|
244
|
+
|
245
|
+
# Return copy of certificate; if certificate is NULL or we exhausted
|
246
|
+
# heap memory, returns NULL.
|
247
|
+
#
|
248
|
+
# @return [Zcert]
|
249
|
+
def dup()
|
250
|
+
raise DestroyedError unless @ptr
|
251
|
+
self_p = @ptr
|
252
|
+
result = ::CZMQ::FFI.zcert_dup(self_p)
|
253
|
+
result = Zcert.__new result, true
|
254
|
+
result
|
255
|
+
end
|
256
|
+
|
257
|
+
# Return true if two certificates have the same keys
|
258
|
+
#
|
259
|
+
# @param compare [Zcert, #__ptr]
|
260
|
+
# @return [Boolean]
|
261
|
+
def eq(compare)
|
262
|
+
raise DestroyedError unless @ptr
|
263
|
+
self_p = @ptr
|
264
|
+
compare = compare.__ptr if compare
|
265
|
+
result = ::CZMQ::FFI.zcert_eq(self_p, compare)
|
266
|
+
result
|
267
|
+
end
|
268
|
+
|
269
|
+
# Print certificate contents to stdout
|
270
|
+
#
|
271
|
+
# @return [void]
|
272
|
+
def print()
|
273
|
+
raise DestroyedError unless @ptr
|
274
|
+
self_p = @ptr
|
275
|
+
result = ::CZMQ::FFI.zcert_print(self_p)
|
276
|
+
result
|
277
|
+
end
|
278
|
+
|
279
|
+
# Print certificate contents to open stream. This method is deprecated
|
280
|
+
# and you should use the print method.
|
281
|
+
#
|
282
|
+
# @param file [::FFI::Pointer, #to_ptr]
|
283
|
+
# @return [void]
|
284
|
+
def fprint(file)
|
285
|
+
raise DestroyedError unless @ptr
|
286
|
+
self_p = @ptr
|
287
|
+
result = ::CZMQ::FFI.zcert_fprint(self_p, file)
|
288
|
+
result
|
289
|
+
end
|
290
|
+
|
291
|
+
# Self test of this class
|
292
|
+
#
|
293
|
+
# @param verbose [Boolean]
|
294
|
+
# @return [void]
|
295
|
+
def self.test(verbose)
|
296
|
+
verbose = !(0==verbose||!verbose) # boolean
|
297
|
+
result = ::CZMQ::FFI.zcert_test(verbose)
|
298
|
+
result
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
################################################################################
|
305
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
306
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
307
|
+
################################################################################
|
@@ -0,0 +1,222 @@
|
|
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
|
+
# work with CURVE security certificate stores
|
10
|
+
# @note This class is 100% generated using zproject.
|
11
|
+
class Zcertstore
|
12
|
+
# Raised when one tries to use an instance of {Zcertstore} 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
|
+
# @param ptr [::FFI::Pointer]
|
34
|
+
# @return [Proc]
|
35
|
+
def self.create_finalizer_for(ptr)
|
36
|
+
Proc.new do
|
37
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
38
|
+
ptr_ptr.write_pointer ptr
|
39
|
+
::CZMQ::FFI.zcertstore_destroy ptr_ptr
|
40
|
+
end
|
41
|
+
end
|
42
|
+
# @return [Boolean]
|
43
|
+
def null?
|
44
|
+
!@ptr or @ptr.null?
|
45
|
+
end
|
46
|
+
# Return internal pointer
|
47
|
+
# @return [::FFI::Pointer]
|
48
|
+
def __ptr
|
49
|
+
raise DestroyedError unless @ptr
|
50
|
+
@ptr
|
51
|
+
end
|
52
|
+
# So external Libraries can just pass the Object to a FFI function which expects a :pointer
|
53
|
+
alias_method :to_ptr, :__ptr
|
54
|
+
# Nullify internal pointer and return pointer pointer.
|
55
|
+
# @note This detaches the current instance from the native object
|
56
|
+
# and thus makes it unusable.
|
57
|
+
# @return [::FFI::MemoryPointer] the pointer pointing to a pointer
|
58
|
+
# pointing to the native object
|
59
|
+
def __ptr_give_ref
|
60
|
+
raise DestroyedError unless @ptr
|
61
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
62
|
+
ptr_ptr.write_pointer @ptr
|
63
|
+
__undef_finalizer if @finalizer
|
64
|
+
@ptr = nil
|
65
|
+
ptr_ptr
|
66
|
+
end
|
67
|
+
# Undefines the finalizer for this object.
|
68
|
+
# @note Only use this if you need to and can guarantee that the native
|
69
|
+
# object will be freed by other means.
|
70
|
+
# @return [void]
|
71
|
+
def __undef_finalizer
|
72
|
+
ObjectSpace.undefine_finalizer self
|
73
|
+
@finalizer = nil
|
74
|
+
end
|
75
|
+
|
76
|
+
# Create a new callback of the following type:
|
77
|
+
# Loaders retrieve certificates from an arbitrary source.
|
78
|
+
# typedef void (zcertstore_loader) (
|
79
|
+
# zcertstore_t *self);
|
80
|
+
#
|
81
|
+
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
82
|
+
# FFI::Function object after passing it to a C function call,
|
83
|
+
# it may be garbage collected while C still holds the pointer,
|
84
|
+
# potentially resulting in a segmentation fault.
|
85
|
+
def self.loader
|
86
|
+
::FFI::Function.new :void, [:pointer], blocking: true do |self_|
|
87
|
+
self_ = Zcertstore.__new self_, false
|
88
|
+
result = yield self_
|
89
|
+
result
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Create a new callback of the following type:
|
94
|
+
# Destructor for loader state.
|
95
|
+
# typedef void (zcertstore_destructor) (
|
96
|
+
# void **self_p);
|
97
|
+
#
|
98
|
+
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
99
|
+
# FFI::Function object after passing it to a C function call,
|
100
|
+
# it may be garbage collected while C still holds the pointer,
|
101
|
+
# potentially resulting in a segmentation fault.
|
102
|
+
def self.destructor
|
103
|
+
::FFI::Function.new :void, [:pointer], blocking: true do |self_p|
|
104
|
+
result = yield self_p
|
105
|
+
result
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Create a new certificate store from a disk directory, loading and
|
110
|
+
# indexing all certificates in that location. The directory itself may be
|
111
|
+
# absent, and created later, or modified at any time. The certificate store
|
112
|
+
# is automatically refreshed on any zcertstore_lookup() call. If the
|
113
|
+
# location is specified as NULL, creates a pure-memory store, which you
|
114
|
+
# can work with by inserting certificates at runtime.
|
115
|
+
# @param location [String, #to_s, nil]
|
116
|
+
# @return [CZMQ::Zcertstore]
|
117
|
+
def self.new(location)
|
118
|
+
ptr = ::CZMQ::FFI.zcertstore_new(location)
|
119
|
+
__new ptr
|
120
|
+
end
|
121
|
+
|
122
|
+
# Destroy a certificate store object in memory. Does not affect anything
|
123
|
+
# stored on disk.
|
124
|
+
#
|
125
|
+
# @return [void]
|
126
|
+
def destroy()
|
127
|
+
return unless @ptr
|
128
|
+
self_p = __ptr_give_ref
|
129
|
+
result = ::CZMQ::FFI.zcertstore_destroy(self_p)
|
130
|
+
result
|
131
|
+
end
|
132
|
+
|
133
|
+
# Override the default disk loader with a custom loader fn.
|
134
|
+
#
|
135
|
+
# @param loader [::FFI::Pointer, #to_ptr]
|
136
|
+
# @param destructor [::FFI::Pointer, #to_ptr]
|
137
|
+
# @param state [::FFI::Pointer, #to_ptr]
|
138
|
+
# @return [void]
|
139
|
+
def set_loader(loader, destructor, state)
|
140
|
+
raise DestroyedError unless @ptr
|
141
|
+
self_p = @ptr
|
142
|
+
result = ::CZMQ::FFI.zcertstore_set_loader(self_p, loader, destructor, state)
|
143
|
+
result
|
144
|
+
end
|
145
|
+
|
146
|
+
# Look up certificate by public key, returns zcert_t object if found,
|
147
|
+
# else returns NULL. The public key is provided in Z85 text format.
|
148
|
+
#
|
149
|
+
# @param public_key [String, #to_s, nil]
|
150
|
+
# @return [Zcert]
|
151
|
+
def lookup(public_key)
|
152
|
+
raise DestroyedError unless @ptr
|
153
|
+
self_p = @ptr
|
154
|
+
result = ::CZMQ::FFI.zcertstore_lookup(self_p, public_key)
|
155
|
+
result = Zcert.__new result, false
|
156
|
+
result
|
157
|
+
end
|
158
|
+
|
159
|
+
# Insert certificate into certificate store in memory. Note that this
|
160
|
+
# does not save the certificate to disk. To do that, use zcert_save()
|
161
|
+
# directly on the certificate. Takes ownership of zcert_t object.
|
162
|
+
#
|
163
|
+
# @param cert_p [#__ptr_give_ref]
|
164
|
+
# @return [void]
|
165
|
+
def insert(cert_p)
|
166
|
+
raise DestroyedError unless @ptr
|
167
|
+
self_p = @ptr
|
168
|
+
cert_p = cert_p.__ptr_give_ref
|
169
|
+
result = ::CZMQ::FFI.zcertstore_insert(self_p, cert_p)
|
170
|
+
result
|
171
|
+
end
|
172
|
+
|
173
|
+
# Empty certificate hashtable. This wrapper exists to be friendly to bindings,
|
174
|
+
# which don't usually have access to struct internals.
|
175
|
+
#
|
176
|
+
# @return [void]
|
177
|
+
def empty()
|
178
|
+
raise DestroyedError unless @ptr
|
179
|
+
self_p = @ptr
|
180
|
+
result = ::CZMQ::FFI.zcertstore_empty(self_p)
|
181
|
+
result
|
182
|
+
end
|
183
|
+
|
184
|
+
# Print list of certificates in store to logging facility
|
185
|
+
#
|
186
|
+
# @return [void]
|
187
|
+
def print()
|
188
|
+
raise DestroyedError unless @ptr
|
189
|
+
self_p = @ptr
|
190
|
+
result = ::CZMQ::FFI.zcertstore_print(self_p)
|
191
|
+
result
|
192
|
+
end
|
193
|
+
|
194
|
+
# Print list of certificates in store to open stream. This method is
|
195
|
+
# deprecated, and you should use the print method.
|
196
|
+
#
|
197
|
+
# @param file [::FFI::Pointer, #to_ptr]
|
198
|
+
# @return [void]
|
199
|
+
def fprint(file)
|
200
|
+
raise DestroyedError unless @ptr
|
201
|
+
self_p = @ptr
|
202
|
+
result = ::CZMQ::FFI.zcertstore_fprint(self_p, file)
|
203
|
+
result
|
204
|
+
end
|
205
|
+
|
206
|
+
# Self test of this class
|
207
|
+
#
|
208
|
+
# @param verbose [Boolean]
|
209
|
+
# @return [void]
|
210
|
+
def self.test(verbose)
|
211
|
+
verbose = !(0==verbose||!verbose) # boolean
|
212
|
+
result = ::CZMQ::FFI.zcertstore_test(verbose)
|
213
|
+
result
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
################################################################################
|
220
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
221
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
222
|
+
################################################################################
|