czmq-ffi-gen 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES.md +9 -0
- data/README.md +15 -26
- data/lib/czmq-ffi-gen.rb +4 -2
- data/lib/czmq-ffi-gen/czmq/ffi.rb +105 -5
- data/lib/czmq-ffi-gen/czmq/ffi/version.rb +1 -1
- data/lib/czmq-ffi-gen/czmq/ffi/zargs.rb +26 -24
- data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +41 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +13 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +1 -1
- data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +29 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_client.rb +113 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_request.rb +312 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_response.rb +263 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_server.rb +135 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_server_connection.rb +91 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb +161 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +34 -1
- data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +11 -9
- data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +19 -5
- data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +461 -2
- data/lib/czmq-ffi-gen/czmq/ffi/zsys.rb +147 -1
- data/lib/czmq-ffi-gen/czmq_ffi_extensions.rb +16 -0
- data/lib/czmq-ffi-gen/gem_version.rb +1 -1
- data/lib/czmq-ffi-gen/libzmq.rb +29 -2
- data/lib/czmq-ffi-gen/versions.rb +1 -8
- metadata +22 -17
- data/lib/czmq-ffi-gen/legacy.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3ffd5d519db4e5f9bc36ef574bd6ebefe6bcf539ef98d8151a36c7c24354e055
|
4
|
+
data.tar.gz: 8ba3a88ae7a96d1f4ac92581d4c8506130432f32e212e8092647a9e9d98dc39d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 714bf8b301bb7b2d7968aa4649220458697355fb7a517b7a5a5f8495d15ddb67184311425cd73c29d46db2ad476b17ba9cc45c9982788ea277e3ab0bdbd9e2f1
|
7
|
+
data.tar.gz: a6e0ca8b78f8003d2d6c159efd217f69707992179e6de4d8a4a6e00296c0e023099f185c3275dfd831bdcb7cfb0af25099db670e9d7aad3dd2c0da8f69988a25
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
0.16.0 (11/20/2019)
|
2
|
+
-----
|
3
|
+
* relax gem dependencies
|
4
|
+
* update CZMQ low-level binding
|
5
|
+
* remove support for CZMQ 3
|
6
|
+
* add CZMQ::FFI::LibZMQ.zmq_has, .has?(cap), .has_curve?, .has_draft?
|
7
|
+
* add CZMQ::FFI:has_draft?
|
8
|
+
* add CZMQ::FFI::LibZMQ::VERSION
|
9
|
+
|
1
10
|
0.15.0 (03/04/2018)
|
2
11
|
-----
|
3
12
|
* update CZMQ low-level binding to include fixed errno for unsupported features (ENOTSUP)
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
[![
|
2
|
-
[![Dependency Status](https://gemnasium.com/paddor/czmq-ffi-gen.svg)](https://gemnasium.com/paddor/czmq-ffi-gen)
|
1
|
+
[![pipeline status](https://gitlab.com/paddor/czmq-ffi-gen/badges/master/pipeline.svg)](https://gitlab.com/paddor/czmq-ffi-gen/commits/master)
|
3
2
|
|
4
3
|
# Generated CZMQ::FFI
|
5
4
|
|
@@ -15,14 +14,13 @@ anything you want. :-)
|
|
15
14
|
This is generated code. It is generated from the API models in CZMQ using
|
16
15
|
[zproject](https://github.com/zeromq/zproject). It doesn't feel like Ruby. It's
|
17
16
|
not intended to be used directly. Instead, use
|
18
|
-
[CZTop](https://
|
17
|
+
[CZTop](https://gitlab.com/paddor/cztop), or write your own wrapper for this
|
19
18
|
library.
|
20
19
|
|
21
20
|
### Generated code isn't actually in this repository
|
22
|
-
The actual generated code lies in CZMQ, which is Git submodule of this
|
23
|
-
repository, registered under `vendor/czmq`.
|
24
|
-
|
25
|
-
So if you're not happy with any of the generated code, go have a closer look at
|
21
|
+
The actual generated code lies in CZMQ, which is a Git submodule of this
|
22
|
+
repository, registered under `vendor/czmq`. So if you're not happy with any of
|
23
|
+
the generated code, go have a closer look at
|
26
24
|
[CZMQ](https://github.com/zeromq/czmq) (or
|
27
25
|
[zproject](https://github.com/zeromq/zproject), which is used by CZMQ to
|
28
26
|
generate the low-level binding).
|
@@ -30,7 +28,7 @@ generate the low-level binding).
|
|
30
28
|
### API Documentation
|
31
29
|
For that same reason, API documentation of unreleased code (directly off this
|
32
30
|
repository), like
|
33
|
-
[rubydoc.info/github/paddor/czmq-ffi-gen](http://www.rubydoc.info/
|
31
|
+
[rubydoc.info/github/paddor/czmq-ffi-gen](http://www.rubydoc.info/gitlab/paddor/czmq-ffi-gen)
|
34
32
|
**does NOT include any of the generated code**. _Rubydoc.info_ doesn't check
|
35
33
|
out Git submodules as part of its documentation procedure.
|
36
34
|
|
@@ -44,16 +42,14 @@ for the API documentation **for the released gem**.
|
|
44
42
|
|
45
43
|
## Requirements
|
46
44
|
|
47
|
-
* CZMQ >= 4.
|
48
|
-
* ZMQ >= 4.
|
45
|
+
* CZMQ >= 4.1
|
46
|
+
* ZMQ >= 4.2
|
49
47
|
|
50
48
|
For security mechanisms like CURVE, you can use an external library:
|
51
49
|
* [libsodium](https://github.com/jedisct1/libsodium)
|
52
50
|
|
53
|
-
On
|
51
|
+
On macOS using homebrew, run:
|
54
52
|
|
55
|
-
$ brew install libsodium
|
56
|
-
$ brew install zmq --with-libsodium
|
57
53
|
$ brew install czmq
|
58
54
|
|
59
55
|
If you're running Linux, go check [this page](http://zeromq.org/distro:_start)
|
@@ -61,19 +57,12 @@ to get more help. Make sure to install CZMQ, not only ZMQ.
|
|
61
57
|
|
62
58
|
### Supported Rubies
|
63
59
|
|
64
|
-
|
65
|
-
for a list of Ruby versions against which czmq-ffi-gen is tested.
|
66
|
-
|
67
|
-
At the time of writing, these include:
|
68
|
-
|
69
|
-
* MRI 2.3, 2.2.4, 2.1.8
|
70
|
-
* Rubinius (HEAD)
|
71
|
-
* JRuby 9000 (HEAD)
|
60
|
+
The latest MRI (currently the 2.6 series) is tested on CI.
|
72
61
|
|
73
|
-
|
62
|
+
The following *SHOULD* work, but are untested:
|
63
|
+
* Rubinius
|
64
|
+
* JRuby 9000
|
74
65
|
|
75
|
-
* JRuby 1.7.x and MRI < 2.0
|
76
|
-
* doesn't work because of the use of the double splat operator (`**opts`)
|
77
66
|
|
78
67
|
## Installation
|
79
68
|
|
@@ -93,7 +82,7 @@ Or install it yourself as:
|
|
93
82
|
|
94
83
|
## Usage
|
95
84
|
|
96
|
-
Check out [CZTop](https://
|
85
|
+
Check out [CZTop](https://gitlab.com/paddor/cztop) or the API documentation to
|
97
86
|
see how this project can be used. :-)
|
98
87
|
|
99
88
|
## Development
|
@@ -106,4 +95,4 @@ prompt that will allow you to experiment.
|
|
106
95
|
|
107
96
|
The gem is available as open source under the terms of the [ISC
|
108
97
|
License](http://opensource.org/licenses/ISC). See the
|
109
|
-
[LICENSE](https://
|
98
|
+
[LICENSE](https://gitlab.com/paddor/cztop/blob/master/LICENSE) file.
|
data/lib/czmq-ffi-gen.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
require_relative "czmq-ffi-gen/gem_version"
|
1
2
|
require_relative "czmq-ffi-gen/vendor"
|
2
3
|
require_relative "czmq-ffi-gen/czmq/ffi"
|
3
|
-
require_relative "czmq-ffi-gen/
|
4
|
+
require_relative "czmq-ffi-gen/libzmq"
|
4
5
|
require_relative "czmq-ffi-gen/errors"
|
5
6
|
require_relative "czmq-ffi-gen/signals"
|
6
|
-
require_relative "czmq-ffi-gen/
|
7
|
+
require_relative "czmq-ffi-gen/czmq_ffi_extensions"
|
8
|
+
require_relative "czmq-ffi-gen/versions"
|
7
9
|
CZMQ::FFI.available? or raise LoadError, "libczmq is not available"
|
@@ -74,10 +74,10 @@ module CZMQ
|
|
74
74
|
attach_function :zargs_param_first, [:pointer], :string, **opts
|
75
75
|
attach_function :zargs_param_next, [:pointer], :string, **opts
|
76
76
|
attach_function :zargs_param_name, [:pointer], :string, **opts
|
77
|
-
attach_function :
|
78
|
-
attach_function :
|
79
|
-
attach_function :
|
80
|
-
attach_function :
|
77
|
+
attach_function :zargs_get, [:pointer, :string], :string, **opts
|
78
|
+
attach_function :zargs_getx, [:pointer, :string, :varargs], :string, **opts
|
79
|
+
attach_function :zargs_has, [:pointer, :string], :bool, **opts
|
80
|
+
attach_function :zargs_hasx, [:pointer, :string, :varargs], :bool, **opts
|
81
81
|
attach_function :zargs_print, [:pointer], :void, **opts
|
82
82
|
attach_function :zargs_test, [:bool], :void, **opts
|
83
83
|
|
@@ -140,6 +140,7 @@ module CZMQ
|
|
140
140
|
require_relative 'ffi/zcertstore'
|
141
141
|
|
142
142
|
attach_function :zchunk_new, [:pointer, :size_t], :pointer, **opts
|
143
|
+
attach_function :zchunk_frommem, [:pointer, :size_t, :pointer, :pointer], :pointer, **opts
|
143
144
|
attach_function :zchunk_destroy, [:pointer], :void, **opts
|
144
145
|
attach_function :zchunk_resize, [:pointer, :size_t], :void, **opts
|
145
146
|
attach_function :zchunk_size, [:pointer], :size_t, **opts
|
@@ -159,6 +160,7 @@ module CZMQ
|
|
159
160
|
attach_function :zchunk_strdup, [:pointer], :pointer, **opts
|
160
161
|
attach_function :zchunk_streq, [:pointer, :string], :bool, **opts
|
161
162
|
attach_function :zchunk_pack, [:pointer], :pointer, **opts
|
163
|
+
attach_function :zchunk_packx, [:pointer], :pointer, **opts
|
162
164
|
attach_function :zchunk_unpack, [:pointer], :pointer, **opts
|
163
165
|
attach_function :zchunk_digest, [:pointer], :string, **opts
|
164
166
|
attach_function :zchunk_fprint, [:pointer, :pointer], :void, **opts
|
@@ -181,6 +183,7 @@ module CZMQ
|
|
181
183
|
attach_function :zconfig_load, [:string], :pointer, **opts
|
182
184
|
attach_function :zconfig_loadf, [:string, :varargs], :pointer, **opts
|
183
185
|
attach_function :zconfig_destroy, [:pointer], :void, **opts
|
186
|
+
attach_function :zconfig_dup, [:pointer], :pointer, **opts
|
184
187
|
attach_function :zconfig_name, [:pointer], :pointer, **opts
|
185
188
|
attach_function :zconfig_value, [:pointer], :pointer, **opts
|
186
189
|
attach_function :zconfig_put, [:pointer, :string, :string], :void, **opts
|
@@ -284,6 +287,7 @@ module CZMQ
|
|
284
287
|
attach_function :zframe_new, [:pointer, :size_t], :pointer, **opts
|
285
288
|
attach_function :zframe_new_empty, [], :pointer, **opts
|
286
289
|
attach_function :zframe_from, [:string], :pointer, **opts
|
290
|
+
attach_function :zframe_frommem, [:pointer, :size_t, :pointer, :pointer], :pointer, **opts
|
287
291
|
attach_function :zframe_recv, [:pointer], :pointer, **opts
|
288
292
|
attach_function :zframe_destroy, [:pointer], :void, **opts
|
289
293
|
attach_function :zframe_send, [:pointer, :pointer, :int], :int, **opts
|
@@ -410,6 +414,7 @@ module CZMQ
|
|
410
414
|
require_relative 'ffi/zlist'
|
411
415
|
|
412
416
|
attach_function :zlistx_new, [], :pointer, **opts
|
417
|
+
attach_function :zlistx_unpack, [:pointer], :pointer, **opts
|
413
418
|
attach_function :zlistx_destroy, [:pointer], :void, **opts
|
414
419
|
attach_function :zlistx_add_start, [:pointer, :pointer], :pointer, **opts
|
415
420
|
attach_function :zlistx_add_end, [:pointer, :pointer], :pointer, **opts
|
@@ -437,6 +442,7 @@ module CZMQ
|
|
437
442
|
attach_function :zlistx_set_destructor, [:pointer, :pointer], :void, **opts
|
438
443
|
attach_function :zlistx_set_duplicator, [:pointer, :pointer], :void, **opts
|
439
444
|
attach_function :zlistx_set_comparator, [:pointer, :pointer], :void, **opts
|
445
|
+
attach_function :zlistx_pack, [:pointer], :pointer, **opts
|
440
446
|
attach_function :zlistx_test, [:bool], :void, **opts
|
441
447
|
|
442
448
|
require_relative 'ffi/zlistx'
|
@@ -530,7 +536,8 @@ module CZMQ
|
|
530
536
|
attach_function :zproc_returncode, [:pointer], :int, **opts
|
531
537
|
attach_function :zproc_pid, [:pointer], :int, **opts
|
532
538
|
attach_function :zproc_running, [:pointer], :bool, **opts
|
533
|
-
attach_function :zproc_wait, [:pointer, :
|
539
|
+
attach_function :zproc_wait, [:pointer, :int], :int, **opts
|
540
|
+
attach_function :zproc_shutdown, [:pointer, :int], :void, **opts
|
534
541
|
attach_function :zproc_actor, [:pointer], :pointer, **opts
|
535
542
|
attach_function :zproc_kill, [:pointer, :int], :void, **opts
|
536
543
|
attach_function :zproc_set_verbose, [:pointer, :bool], :void, **opts
|
@@ -581,6 +588,23 @@ module CZMQ
|
|
581
588
|
attach_function :zsock_leave, [:pointer, :string], :int, **opts
|
582
589
|
attach_function :zsock_is, [:pointer], :bool, **opts
|
583
590
|
attach_function :zsock_resolve, [:pointer], :pointer, **opts
|
591
|
+
attach_function :zsock_has_in, [:pointer], :bool, **opts
|
592
|
+
attach_function :zsock_router_notify, [:pointer], :int, **opts
|
593
|
+
attach_function :zsock_set_router_notify, [:pointer, :int], :void, **opts
|
594
|
+
attach_function :zsock_multicast_loop, [:pointer], :int, **opts
|
595
|
+
attach_function :zsock_set_multicast_loop, [:pointer, :int], :void, **opts
|
596
|
+
attach_function :zsock_metadata, [:pointer], :pointer, **opts
|
597
|
+
attach_function :zsock_set_metadata, [:pointer, :string], :void, **opts
|
598
|
+
attach_function :zsock_loopback_fastpath, [:pointer], :int, **opts
|
599
|
+
attach_function :zsock_set_loopback_fastpath, [:pointer, :int], :void, **opts
|
600
|
+
attach_function :zsock_zap_enforce_domain, [:pointer], :int, **opts
|
601
|
+
attach_function :zsock_set_zap_enforce_domain, [:pointer, :int], :void, **opts
|
602
|
+
attach_function :zsock_gssapi_principal_nametype, [:pointer], :int, **opts
|
603
|
+
attach_function :zsock_set_gssapi_principal_nametype, [:pointer, :int], :void, **opts
|
604
|
+
attach_function :zsock_gssapi_service_principal_nametype, [:pointer], :int, **opts
|
605
|
+
attach_function :zsock_set_gssapi_service_principal_nametype, [:pointer, :int], :void, **opts
|
606
|
+
attach_function :zsock_bindtodevice, [:pointer], :pointer, **opts
|
607
|
+
attach_function :zsock_set_bindtodevice, [:pointer, :string], :void, **opts
|
584
608
|
attach_function :zsock_heartbeat_ivl, [:pointer], :int, **opts
|
585
609
|
attach_function :zsock_set_heartbeat_ivl, [:pointer, :int], :void, **opts
|
586
610
|
attach_function :zsock_heartbeat_ttl, [:pointer], :int, **opts
|
@@ -761,6 +785,7 @@ module CZMQ
|
|
761
785
|
attach_function :zsys_file_mode_private, [], :void, **opts
|
762
786
|
attach_function :zsys_file_mode_default, [], :void, **opts
|
763
787
|
attach_function :zsys_version, [:pointer, :pointer, :pointer], :void, **opts
|
788
|
+
attach_function :zsys_sprintf_hint, [:int, :string, :varargs], :pointer, **opts
|
764
789
|
attach_function :zsys_sprintf, [:string, :varargs], :pointer, **opts
|
765
790
|
attach_function :zsys_vprintf, [:string, :pointer], :pointer, **opts
|
766
791
|
attach_function :zsys_udp_new, [:bool], (::FFI::Platform.unix? ? :int : :uint64), **opts
|
@@ -775,10 +800,16 @@ module CZMQ
|
|
775
800
|
attach_function :zsys_set_io_threads, [:size_t], :void, **opts
|
776
801
|
attach_function :zsys_set_thread_sched_policy, [:int], :void, **opts
|
777
802
|
attach_function :zsys_set_thread_priority, [:int], :void, **opts
|
803
|
+
attach_function :zsys_set_thread_name_prefix, [:int], :void, **opts
|
804
|
+
attach_function :zsys_thread_name_prefix, [], :int, **opts
|
805
|
+
attach_function :zsys_thread_affinity_cpu_add, [:int], :void, **opts
|
806
|
+
attach_function :zsys_thread_affinity_cpu_remove, [:int], :void, **opts
|
778
807
|
attach_function :zsys_set_max_sockets, [:size_t], :void, **opts
|
779
808
|
attach_function :zsys_socket_limit, [], :size_t, **opts
|
780
809
|
attach_function :zsys_set_max_msgsz, [:int], :void, **opts
|
781
810
|
attach_function :zsys_max_msgsz, [], :int, **opts
|
811
|
+
attach_function :zsys_set_zero_copy_recv, [:int], :void, **opts
|
812
|
+
attach_function :zsys_zero_copy_recv, [], :int, **opts
|
782
813
|
attach_function :zsys_set_file_stable_age_msec, [:pointer], :void, **opts
|
783
814
|
attach_function :zsys_file_stable_age_msec, [], :pointer, **opts
|
784
815
|
attach_function :zsys_set_linger, [:size_t], :void, **opts
|
@@ -796,6 +827,10 @@ module CZMQ
|
|
796
827
|
attach_function :zsys_ipv6_mcast_address, [], :string, **opts
|
797
828
|
attach_function :zsys_set_auto_use_fd, [:int], :void, **opts
|
798
829
|
attach_function :zsys_auto_use_fd, [], :int, **opts
|
830
|
+
attach_function :zsys_zprintf, [:string, :pointer], :pointer, **opts
|
831
|
+
attach_function :zsys_zprintf_error, [:string, :pointer], :pointer, **opts
|
832
|
+
attach_function :zsys_zplprintf, [:string, :pointer], :pointer, **opts
|
833
|
+
attach_function :zsys_zplprintf_error, [:string, :pointer], :pointer, **opts
|
799
834
|
attach_function :zsys_set_logident, [:string], :void, **opts
|
800
835
|
attach_function :zsys_set_logstream, [:pointer], :void, **opts
|
801
836
|
attach_function :zsys_set_logsender, [:string], :void, **opts
|
@@ -851,6 +886,71 @@ module CZMQ
|
|
851
886
|
attach_function :zuuid_test, [:bool], :void, **opts
|
852
887
|
|
853
888
|
require_relative 'ffi/zuuid'
|
889
|
+
|
890
|
+
attach_function :zhttp_client_new, [:bool], :pointer, **opts
|
891
|
+
attach_function :zhttp_client_destroy, [:pointer], :void, **opts
|
892
|
+
attach_function :zhttp_client_test, [:bool], :void, **opts
|
893
|
+
|
894
|
+
require_relative 'ffi/zhttp_client'
|
895
|
+
|
896
|
+
attach_function :zhttp_server_new, [:pointer], :pointer, **opts
|
897
|
+
attach_function :zhttp_server_destroy, [:pointer], :void, **opts
|
898
|
+
attach_function :zhttp_server_port, [:pointer], :int, **opts
|
899
|
+
attach_function :zhttp_server_test, [:bool], :void, **opts
|
900
|
+
|
901
|
+
require_relative 'ffi/zhttp_server'
|
902
|
+
|
903
|
+
attach_function :zhttp_server_options_new, [], :pointer, **opts
|
904
|
+
attach_function :zhttp_server_options_from_config, [:pointer], :pointer, **opts
|
905
|
+
attach_function :zhttp_server_options_destroy, [:pointer], :void, **opts
|
906
|
+
attach_function :zhttp_server_options_port, [:pointer], :int, **opts
|
907
|
+
attach_function :zhttp_server_options_set_port, [:pointer, :int], :void, **opts
|
908
|
+
attach_function :zhttp_server_options_backend_address, [:pointer], :string, **opts
|
909
|
+
attach_function :zhttp_server_options_set_backend_address, [:pointer, :string], :void, **opts
|
910
|
+
attach_function :zhttp_server_options_test, [:bool], :void, **opts
|
911
|
+
|
912
|
+
require_relative 'ffi/zhttp_server_options'
|
913
|
+
|
914
|
+
attach_function :zhttp_request_new, [], :pointer, **opts
|
915
|
+
attach_function :zhttp_request_destroy, [:pointer], :void, **opts
|
916
|
+
attach_function :zhttp_request_recv, [:pointer, :pointer], :pointer, **opts
|
917
|
+
attach_function :zhttp_request_send, [:pointer, :pointer, :int, :pointer, :pointer], :int, **opts
|
918
|
+
attach_function :zhttp_request_method, [:pointer], :string, **opts
|
919
|
+
attach_function :zhttp_request_set_method, [:pointer, :string], :void, **opts
|
920
|
+
attach_function :zhttp_request_url, [:pointer], :string, **opts
|
921
|
+
attach_function :zhttp_request_set_url, [:pointer, :string], :void, **opts
|
922
|
+
attach_function :zhttp_request_content_type, [:pointer], :string, **opts
|
923
|
+
attach_function :zhttp_request_set_content_type, [:pointer, :string], :void, **opts
|
924
|
+
attach_function :zhttp_request_content_length, [:pointer], :size_t, **opts
|
925
|
+
attach_function :zhttp_request_headers, [:pointer], :pointer, **opts
|
926
|
+
attach_function :zhttp_request_content, [:pointer], :string, **opts
|
927
|
+
attach_function :zhttp_request_get_content, [:pointer], :pointer, **opts
|
928
|
+
attach_function :zhttp_request_set_content, [:pointer, :pointer], :void, **opts
|
929
|
+
attach_function :zhttp_request_set_content_const, [:pointer, :string], :void, **opts
|
930
|
+
attach_function :zhttp_request_reset_content, [:pointer], :void, **opts
|
931
|
+
attach_function :zhttp_request_match, [:pointer, :string, :string, :varargs], :bool, **opts
|
932
|
+
attach_function :zhttp_request_test, [:bool], :void, **opts
|
933
|
+
|
934
|
+
require_relative 'ffi/zhttp_request'
|
935
|
+
|
936
|
+
attach_function :zhttp_response_new, [], :pointer, **opts
|
937
|
+
attach_function :zhttp_response_destroy, [:pointer], :void, **opts
|
938
|
+
attach_function :zhttp_response_send, [:pointer, :pointer, :pointer], :int, **opts
|
939
|
+
attach_function :zhttp_response_recv, [:pointer, :pointer, :pointer, :pointer], :int, **opts
|
940
|
+
attach_function :zhttp_response_content_type, [:pointer], :string, **opts
|
941
|
+
attach_function :zhttp_response_set_content_type, [:pointer, :string], :void, **opts
|
942
|
+
attach_function :zhttp_response_status_code, [:pointer], :uint32, **opts
|
943
|
+
attach_function :zhttp_response_set_status_code, [:pointer, :uint32], :void, **opts
|
944
|
+
attach_function :zhttp_response_headers, [:pointer], :pointer, **opts
|
945
|
+
attach_function :zhttp_response_content_length, [:pointer], :size_t, **opts
|
946
|
+
attach_function :zhttp_response_content, [:pointer], :string, **opts
|
947
|
+
attach_function :zhttp_response_get_content, [:pointer], :pointer, **opts
|
948
|
+
attach_function :zhttp_response_set_content, [:pointer, :pointer], :void, **opts
|
949
|
+
attach_function :zhttp_response_set_content_const, [:pointer, :string], :void, **opts
|
950
|
+
attach_function :zhttp_response_reset_content, [:pointer], :void, **opts
|
951
|
+
attach_function :zhttp_response_test, [:bool], :void, **opts
|
952
|
+
|
953
|
+
require_relative 'ffi/zhttp_response'
|
854
954
|
end
|
855
955
|
end
|
856
956
|
end
|
@@ -9,14 +9,17 @@ module CZMQ
|
|
9
9
|
# Platform independent command line argument parsing helpers
|
10
10
|
#
|
11
11
|
# There are two kind of elements provided by this class
|
12
|
-
#
|
13
|
-
#
|
12
|
+
# Named parameters, accessed by param_get and param_has methods
|
13
|
+
# * --named-parameter
|
14
|
+
# * --parameter with_value
|
15
|
+
# * -a val
|
16
|
+
# Positional arguments, accessed by zargs_first, zargs_next
|
14
17
|
#
|
15
18
|
# It DOES:
|
16
19
|
# * provide easy to use CLASS compatible API for accessing argv
|
17
20
|
# * is platform independent
|
18
21
|
# * provide getopt_long style -- argument, which delimits parameters from arguments
|
19
|
-
# * makes parameters
|
22
|
+
# * makes parameters position independent
|
20
23
|
#
|
21
24
|
# It does NOT
|
22
25
|
# * change argv
|
@@ -173,8 +176,7 @@ module CZMQ
|
|
173
176
|
result
|
174
177
|
end
|
175
178
|
|
176
|
-
# Return current parameter name, or NULL if there are no named
|
177
|
-
# parameters.
|
179
|
+
# Return current parameter name, or NULL if there are no named parameters.
|
178
180
|
#
|
179
181
|
# @return [String]
|
180
182
|
def param_name()
|
@@ -184,49 +186,49 @@ module CZMQ
|
|
184
186
|
result
|
185
187
|
end
|
186
188
|
|
187
|
-
# Return value of named parameter
|
188
|
-
# been specified, or special value for wich zargs_param_empty ()
|
189
|
-
# returns true.
|
189
|
+
# Return value of named parameter or NULL is it has no value (or was not specified)
|
190
190
|
#
|
191
|
-
# @param
|
191
|
+
# @param name [String, #to_s, nil]
|
192
192
|
# @return [String]
|
193
|
-
def
|
193
|
+
def get(name)
|
194
194
|
raise DestroyedError unless @ptr
|
195
195
|
self_p = @ptr
|
196
|
-
result = ::CZMQ::FFI.
|
196
|
+
result = ::CZMQ::FFI.zargs_get(self_p, name)
|
197
197
|
result
|
198
198
|
end
|
199
199
|
|
200
|
-
# Return value of
|
201
|
-
# been specified, or special value for wich zargs_param_empty ()
|
202
|
-
# returns true.
|
200
|
+
# Return value of one of parameter(s) or NULL is it has no value (or was not specified)
|
203
201
|
#
|
204
|
-
# @param
|
202
|
+
# @param name [String, #to_s, nil]
|
205
203
|
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
206
204
|
# @return [String]
|
207
|
-
def
|
205
|
+
def getx(name, *args)
|
208
206
|
raise DestroyedError unless @ptr
|
209
207
|
self_p = @ptr
|
210
|
-
result = ::CZMQ::FFI.
|
208
|
+
result = ::CZMQ::FFI.zargs_getx(self_p, name, *args)
|
211
209
|
result
|
212
210
|
end
|
213
211
|
|
214
|
-
# Returns true if
|
212
|
+
# Returns true if named parameter was specified on command line
|
215
213
|
#
|
214
|
+
# @param name [String, #to_s, nil]
|
216
215
|
# @return [Boolean]
|
217
|
-
def
|
216
|
+
def has(name)
|
218
217
|
raise DestroyedError unless @ptr
|
219
218
|
self_p = @ptr
|
220
|
-
result = ::CZMQ::FFI.
|
219
|
+
result = ::CZMQ::FFI.zargs_has(self_p, name)
|
221
220
|
result
|
222
221
|
end
|
223
222
|
|
224
|
-
# Returns true if parameter
|
223
|
+
# Returns true if named parameter(s) was specified on command line
|
225
224
|
#
|
226
|
-
# @param
|
225
|
+
# @param name [String, #to_s, nil]
|
226
|
+
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
227
227
|
# @return [Boolean]
|
228
|
-
def
|
229
|
-
|
228
|
+
def hasx(name, *args)
|
229
|
+
raise DestroyedError unless @ptr
|
230
|
+
self_p = @ptr
|
231
|
+
result = ::CZMQ::FFI.zargs_hasx(self_p, name, *args)
|
230
232
|
result
|
231
233
|
end
|
232
234
|
|
@@ -73,6 +73,22 @@ module CZMQ
|
|
73
73
|
@finalizer = nil
|
74
74
|
end
|
75
75
|
|
76
|
+
# Create a new callback of the following type:
|
77
|
+
# Destroy an item
|
78
|
+
# typedef void (zchunk_destructor_fn) (
|
79
|
+
# void **hint);
|
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.destructor_fn
|
86
|
+
::FFI::Function.new :void, [:pointer], blocking: true do |hint|
|
87
|
+
result = yield hint
|
88
|
+
result
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
76
92
|
# Create a new chunk of the specified size. If you specify the data, it
|
77
93
|
# is copied into the chunk. If you do not specify the data, the chunk is
|
78
94
|
# allocated and left empty, and you can then add data using zchunk_append.
|
@@ -85,6 +101,19 @@ module CZMQ
|
|
85
101
|
__new ptr
|
86
102
|
end
|
87
103
|
|
104
|
+
# Create a new chunk from memory. Take ownership of the memory and calling the destructor
|
105
|
+
# on destroy.
|
106
|
+
# @param data [::FFI::Pointer, #to_ptr]
|
107
|
+
# @param size [Integer, #to_int, #to_i]
|
108
|
+
# @param destructor [::FFI::Pointer, #to_ptr]
|
109
|
+
# @param hint [::FFI::Pointer, #to_ptr]
|
110
|
+
# @return [CZMQ::Zchunk]
|
111
|
+
def self.frommem(data, size, destructor, hint)
|
112
|
+
size = Integer(size)
|
113
|
+
ptr = ::CZMQ::FFI.zchunk_frommem(data, size, destructor, hint)
|
114
|
+
__new ptr
|
115
|
+
end
|
116
|
+
|
88
117
|
# Destroy a chunk
|
89
118
|
#
|
90
119
|
# @return [void]
|
@@ -317,6 +346,18 @@ module CZMQ
|
|
317
346
|
result
|
318
347
|
end
|
319
348
|
|
349
|
+
# Transform zchunk into a zframe that can be sent in a message.
|
350
|
+
# Take ownership of the chunk.
|
351
|
+
#
|
352
|
+
# @param self_p [#__ptr_give_ref]
|
353
|
+
# @return [Zframe]
|
354
|
+
def self.packx(self_p)
|
355
|
+
self_p = self_p.__ptr_give_ref
|
356
|
+
result = ::CZMQ::FFI.zchunk_packx(self_p)
|
357
|
+
result = Zframe.__new result, true
|
358
|
+
result
|
359
|
+
end
|
360
|
+
|
320
361
|
# Transform a zframe into a zchunk.
|
321
362
|
#
|
322
363
|
# @param frame [Zframe, #__ptr]
|