rbczmq 1.7.1 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitmodules +1 -1
- data/CHANGELOG.rdoc +4 -0
- data/Gemfile.lock +1 -1
- data/README.rdoc +5 -4
- data/ext/czmq/.gitignore +5 -0
- data/ext/czmq/.travis.yml +10 -1
- data/ext/czmq/AUTHORS +2 -0
- data/ext/czmq/COPYING.LESSER +3 -0
- data/ext/czmq/Makefile.am +13 -3
- data/ext/czmq/NEWS +132 -0
- data/ext/czmq/README.md +1553 -615
- data/ext/czmq/README.txt +188 -72
- data/ext/czmq/addons/Makefile.am +9 -0
- data/ext/czmq/addons/makecert.c +72 -0
- data/ext/czmq/builds/mingw32/Makefile.mingw32 +11 -3
- data/ext/czmq/builds/msvc/.gitignore +4 -1
- data/ext/czmq/builds/msvc/czmq.vcproj +4 -0
- data/ext/czmq/builds/msvc/czmq.vcxproj +6 -1
- data/ext/czmq/builds/msvc/czmq.vcxproj.filters +4 -1
- data/ext/{zeromq/cmake/Modules/zmq_version.cpp → czmq/builds/msvc/platform.h} +10 -9
- data/ext/czmq/configure.ac +64 -5
- data/ext/czmq/doc/Makefile.am +8 -1
- data/ext/czmq/doc/mkmans +17 -0
- data/ext/czmq/doc/zauth.txt +191 -0
- data/ext/czmq/doc/zbeacon.txt +13 -22
- data/ext/czmq/doc/zcert.txt +122 -0
- data/ext/czmq/doc/zcertstore.txt +107 -0
- data/ext/czmq/doc/zchunk.txt +77 -0
- data/ext/czmq/doc/zclock.txt +8 -0
- data/ext/czmq/doc/zconfig.txt +9 -63
- data/ext/czmq/doc/zctx.txt +26 -7
- data/ext/czmq/doc/zdir.txt +83 -0
- data/ext/czmq/doc/zfile.txt +130 -35
- data/ext/czmq/doc/zframe.txt +6 -39
- data/ext/czmq/doc/zhash.txt +55 -10
- data/ext/czmq/doc/zlist.txt +2 -4
- data/ext/czmq/doc/zloop.txt +7 -1
- data/ext/czmq/doc/zmsg.txt +75 -32
- data/ext/czmq/doc/zpoller.txt +88 -0
- data/ext/czmq/doc/zsocket.txt +50 -1
- data/ext/czmq/doc/zsockopt.txt +185 -251
- data/ext/czmq/doc/zstr.txt +14 -3
- data/ext/czmq/doc/zsys.txt +89 -1
- data/ext/czmq/doc/ztree.txt +21 -11
- data/ext/czmq/examples/security/LICENSE +18 -0
- data/ext/czmq/examples/security/README.txt +9 -0
- data/ext/czmq/examples/security/grasslands.c +29 -0
- data/ext/czmq/examples/security/hello.c +10 -0
- data/ext/czmq/examples/security/ironhouse.c +55 -0
- data/ext/czmq/examples/security/ironhouse2.c +103 -0
- data/ext/czmq/examples/security/stonehouse.c +51 -0
- data/ext/czmq/examples/security/strawhouse.c +44 -0
- data/ext/czmq/examples/security/woodhouse.c +40 -0
- data/ext/czmq/images/README_1.png +0 -0
- data/ext/czmq/images/README_2.png +0 -0
- data/ext/czmq/include/czmq.h +10 -4
- data/ext/czmq/include/czmq_prelude.h +42 -42
- data/ext/czmq/include/zauth.h +97 -0
- data/ext/czmq/include/zbeacon.h +0 -5
- data/ext/czmq/include/zcert.h +118 -0
- data/ext/czmq/include/zcertstore.h +78 -0
- data/ext/czmq/include/zchunk.h +87 -0
- data/ext/czmq/include/zclock.h +4 -0
- data/ext/czmq/include/zconfig.h +21 -12
- data/ext/czmq/include/zctx.h +34 -11
- data/ext/czmq/include/zdir.h +90 -0
- data/ext/czmq/include/zfile.h +104 -25
- data/ext/czmq/include/zframe.h +7 -20
- data/ext/czmq/include/zhash.h +13 -0
- data/ext/czmq/include/zlist.h +0 -4
- data/ext/czmq/include/zloop.h +5 -5
- data/ext/czmq/include/zmsg.h +59 -29
- data/ext/czmq/include/zmutex.h +5 -0
- data/ext/czmq/include/zpoller.h +72 -0
- data/ext/czmq/include/zsocket.h +12 -15
- data/ext/czmq/include/zsockopt.h +124 -121
- data/ext/czmq/include/zstr.h +12 -9
- data/ext/czmq/include/zsys.h +50 -2
- data/ext/czmq/mkdoc +1 -1
- data/ext/czmq/model/sockopts.xml +101 -21
- data/ext/czmq/scripts/sockopts.gsl +95 -41
- data/ext/czmq/src/Makefile.am +13 -0
- data/ext/czmq/src/czmq_selftest.c +16 -10
- data/ext/czmq/src/selftest +2 -2
- data/ext/czmq/src/zauth.c +714 -0
- data/ext/czmq/src/zbeacon.c +27 -35
- data/ext/czmq/src/zcert.c +463 -0
- data/ext/czmq/src/zcertstore.c +265 -0
- data/ext/czmq/src/zchunk.c +207 -0
- data/ext/czmq/src/zclock.c +18 -0
- data/ext/czmq/src/zconfig.c +116 -99
- data/ext/czmq/src/zctx.c +103 -18
- data/ext/czmq/src/zdir.c +409 -0
- data/ext/czmq/src/zfile.c +421 -130
- data/ext/czmq/src/zframe.c +28 -127
- data/ext/czmq/src/zhash.c +255 -139
- data/ext/czmq/src/zlist.c +2 -8
- data/ext/czmq/src/zloop.c +40 -13
- data/ext/czmq/src/zmsg.c +109 -141
- data/ext/czmq/src/zmutex.c +27 -1
- data/ext/czmq/src/zpoller.c +218 -0
- data/ext/czmq/src/zsocket.c +53 -66
- data/ext/czmq/src/zsockopt.c +2337 -682
- data/ext/czmq/src/zstr.c +48 -118
- data/ext/czmq/src/zsys.c +270 -3
- data/ext/czmq/src/zthread.c +2 -2
- data/ext/czmq/src/ztree.c +179 -180
- data/ext/rbczmq/beacon.c +1 -1
- data/ext/rbczmq/context.c +12 -3
- data/ext/rbczmq/context.h +7 -0
- data/ext/rbczmq/extconf.rb +13 -4
- data/ext/rbczmq/pollitem.c +1 -1
- data/ext/rbczmq/socket.c +34 -24
- data/ext/rbczmq/socket.h +3 -2
- data/ext/zeromq/AUTHORS +17 -3
- data/ext/zeromq/CMakeLists.txt +742 -339
- data/ext/zeromq/COPYING.LESSER +2 -0
- data/ext/zeromq/Makefile.am +3 -3
- data/ext/zeromq/NEWS +130 -1
- data/ext/zeromq/{README → README.md} +8 -9
- data/ext/zeromq/builds/cmake/Modules/FindAsciiDoc.cmake +24 -0
- data/ext/zeromq/builds/cmake/Modules/TestZMQVersion.cmake +18 -0
- data/ext/zeromq/builds/cmake/Modules/ZMQSourceRunChecks.cmake +129 -0
- data/ext/zeromq/{cmake → builds/cmake}/NSIS.template32.in +1 -1
- data/ext/zeromq/{cmake → builds/cmake}/NSIS.template64.in +1 -1
- data/ext/zeromq/builds/cmake/platform.hpp.in +88 -0
- data/ext/zeromq/builds/mingw32/Makefile.mingw32 +47 -0
- data/ext/zeromq/{src/i_msg_sink.hpp → builds/mingw32/platform.hpp} +10 -21
- data/ext/zeromq/builds/msvc/Makefile.am +5 -2
- data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat.vcxproj +1 -1
- data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat11.vcxproj +91 -0
- data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcproj +2 -0
- data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcxproj +21 -1
- data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr11.vcxproj +111 -0
- data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat.vcxproj +1 -1
- data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat11.vcxproj +91 -0
- data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcproj +2 -0
- data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcxproj +21 -1
- data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr11.vcxproj +111 -0
- data/ext/zeromq/builds/msvc/errno.cpp +1 -1
- data/ext/zeromq/builds/msvc/errno.hpp +1 -1
- data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcproj +176 -174
- data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcxproj +21 -1
- data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat11.vcxproj +110 -0
- data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcproj +176 -174
- data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcxproj +21 -1
- data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr11.vcxproj +110 -0
- data/ext/zeromq/builds/msvc/libzmq/libzmq.vcproj +997 -804
- data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj +78 -2
- data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj.filters +42 -6
- data/ext/zeromq/builds/msvc/libzmq/libzmq11.vcxproj +362 -0
- data/ext/zeromq/builds/msvc/msvc.sln +6 -0
- data/ext/zeromq/builds/msvc/msvc10.sln +36 -2
- data/ext/zeromq/builds/msvc/msvc11.sln +150 -0
- data/ext/zeromq/builds/msvc/properties/Static.props +15 -0
- data/ext/zeromq/builds/msvc/properties/ZeroMQ.props +0 -1
- data/ext/zeromq/builds/msvc/properties/ZeroMQ_Static.props +23 -0
- data/ext/zeromq/builds/redhat/zeromq.spec.in +2 -1
- data/ext/zeromq/{configure.in → configure.ac} +74 -15
- data/ext/zeromq/doc/Makefile.am +6 -4
- data/ext/zeromq/doc/zmq.txt +30 -3
- data/ext/zeromq/doc/zmq_bind.txt +2 -2
- data/ext/zeromq/doc/zmq_close.txt +2 -2
- data/ext/zeromq/doc/zmq_connect.txt +9 -7
- data/ext/zeromq/doc/zmq_ctx_destroy.txt +4 -3
- data/ext/zeromq/doc/zmq_ctx_get.txt +8 -3
- data/ext/zeromq/doc/zmq_ctx_new.txt +3 -2
- data/ext/zeromq/doc/zmq_ctx_set.txt +13 -1
- data/ext/zeromq/doc/zmq_ctx_shutdown.txt +52 -0
- data/ext/zeromq/doc/zmq_ctx_term.txt +67 -0
- data/ext/zeromq/doc/zmq_curve.txt +92 -0
- data/ext/zeromq/doc/zmq_curve_keypair.txt +56 -0
- data/ext/zeromq/doc/zmq_disconnect.txt +2 -2
- data/ext/zeromq/doc/zmq_epgm.txt +5 -4
- data/ext/zeromq/doc/zmq_errno.txt +2 -2
- data/ext/zeromq/doc/zmq_getsockopt.txt +149 -24
- data/ext/zeromq/doc/zmq_init.txt +2 -2
- data/ext/zeromq/doc/zmq_inproc.txt +2 -2
- data/ext/zeromq/doc/zmq_ipc.txt +10 -5
- data/ext/zeromq/doc/zmq_msg_close.txt +4 -3
- data/ext/zeromq/doc/zmq_msg_copy.txt +2 -2
- data/ext/zeromq/doc/zmq_msg_data.txt +2 -2
- data/ext/zeromq/doc/zmq_msg_get.txt +3 -3
- data/ext/zeromq/doc/zmq_msg_init.txt +2 -2
- data/ext/zeromq/doc/zmq_msg_init_data.txt +2 -2
- data/ext/zeromq/doc/zmq_msg_init_size.txt +2 -2
- data/ext/zeromq/doc/zmq_msg_more.txt +6 -4
- data/ext/zeromq/doc/zmq_msg_move.txt +2 -2
- data/ext/zeromq/doc/zmq_msg_recv.txt +3 -4
- data/ext/zeromq/doc/zmq_msg_send.txt +10 -7
- data/ext/zeromq/doc/zmq_msg_set.txt +2 -1
- data/ext/zeromq/doc/zmq_msg_size.txt +2 -2
- data/ext/zeromq/doc/zmq_null.txt +27 -0
- data/ext/zeromq/doc/zmq_pgm.txt +5 -4
- data/ext/zeromq/doc/zmq_plain.txt +37 -0
- data/ext/zeromq/doc/zmq_poll.txt +2 -6
- data/ext/zeromq/doc/zmq_proxy.txt +2 -1
- data/ext/zeromq/doc/zmq_recv.txt +2 -5
- data/ext/zeromq/doc/zmq_recvmsg.txt +3 -5
- data/ext/zeromq/doc/zmq_send.txt +9 -7
- data/ext/zeromq/doc/zmq_send_const.txt +103 -0
- data/ext/zeromq/doc/zmq_sendmsg.txt +8 -8
- data/ext/zeromq/doc/zmq_setsockopt.txt +291 -37
- data/ext/zeromq/doc/zmq_socket.txt +92 -21
- data/ext/zeromq/doc/zmq_socket_monitor.txt +102 -131
- data/ext/zeromq/doc/zmq_strerror.txt +3 -2
- data/ext/zeromq/doc/zmq_tcp.txt +4 -2
- data/ext/zeromq/doc/zmq_term.txt +3 -3
- data/ext/zeromq/doc/zmq_unbind.txt +2 -2
- data/ext/zeromq/doc/zmq_version.txt +3 -2
- data/ext/zeromq/doc/zmq_z85_decode.txt +50 -0
- data/ext/zeromq/doc/zmq_z85_encode.txt +57 -0
- data/ext/zeromq/foreign/openpgm/libpgm-5.2.122~dfsg.tar.gz +0 -0
- data/ext/zeromq/include/zmq.h +179 -136
- data/ext/zeromq/include/zmq_utils.h +44 -3
- data/ext/zeromq/perf/inproc_lat.cpp +2 -4
- data/ext/zeromq/perf/inproc_thr.cpp +1 -1
- data/ext/zeromq/perf/local_lat.cpp +1 -3
- data/ext/zeromq/perf/local_thr.cpp +1 -3
- data/ext/zeromq/perf/remote_lat.cpp +1 -3
- data/ext/zeromq/perf/remote_thr.cpp +1 -8
- data/ext/zeromq/src/Makefile.am +26 -7
- data/ext/zeromq/src/address.cpp +7 -8
- data/ext/zeromq/src/address.hpp +1 -2
- data/ext/zeromq/src/array.hpp +1 -3
- data/ext/zeromq/src/atomic_counter.hpp +11 -3
- data/ext/zeromq/src/atomic_ptr.hpp +9 -3
- data/ext/zeromq/src/blob.hpp +2 -2
- data/ext/zeromq/src/clock.cpp +3 -4
- data/ext/zeromq/src/clock.hpp +1 -2
- data/ext/zeromq/src/command.hpp +2 -3
- data/ext/zeromq/src/config.hpp +1 -3
- data/ext/zeromq/src/ctx.cpp +154 -15
- data/ext/zeromq/src/ctx.hpp +34 -3
- data/ext/zeromq/src/curve_client.cpp +410 -0
- data/ext/zeromq/src/curve_client.hpp +109 -0
- data/ext/zeromq/src/curve_server.cpp +629 -0
- data/ext/zeromq/src/curve_server.hpp +120 -0
- data/ext/zeromq/src/dbuffer.hpp +134 -0
- data/ext/zeromq/src/dealer.cpp +52 -60
- data/ext/zeromq/src/dealer.hpp +12 -26
- data/ext/zeromq/src/decoder.hpp +27 -102
- data/ext/zeromq/src/devpoll.cpp +1 -3
- data/ext/zeromq/src/devpoll.hpp +1 -3
- data/ext/zeromq/src/dist.cpp +17 -15
- data/ext/zeromq/src/dist.hpp +5 -6
- data/ext/zeromq/src/encoder.hpp +32 -52
- data/ext/zeromq/src/epoll.cpp +1 -3
- data/ext/zeromq/src/epoll.hpp +1 -3
- data/ext/zeromq/src/err.cpp +2 -4
- data/ext/zeromq/src/err.hpp +7 -4
- data/ext/zeromq/src/fd.hpp +1 -2
- data/ext/zeromq/src/fq.cpp +2 -5
- data/ext/zeromq/src/fq.hpp +2 -4
- data/ext/zeromq/src/i_decoder.hpp +11 -9
- data/ext/zeromq/src/i_encoder.hpp +7 -11
- data/ext/zeromq/src/i_engine.hpp +3 -3
- data/ext/zeromq/src/i_poll_events.hpp +1 -3
- data/ext/zeromq/src/io_object.cpp +1 -3
- data/ext/zeromq/src/io_object.hpp +1 -3
- data/ext/zeromq/src/io_thread.cpp +1 -3
- data/ext/zeromq/src/io_thread.hpp +1 -3
- data/ext/zeromq/src/ip.cpp +46 -5
- data/ext/zeromq/src/ip.hpp +7 -4
- data/ext/zeromq/src/ipc_address.cpp +13 -2
- data/ext/zeromq/src/ipc_address.hpp +1 -2
- data/ext/zeromq/src/ipc_connecter.cpp +3 -3
- data/ext/zeromq/src/ipc_connecter.hpp +1 -2
- data/ext/zeromq/src/ipc_listener.cpp +15 -10
- data/ext/zeromq/src/ipc_listener.hpp +1 -2
- data/ext/zeromq/src/kqueue.cpp +11 -3
- data/ext/zeromq/src/kqueue.hpp +7 -3
- data/ext/zeromq/src/lb.cpp +13 -11
- data/ext/zeromq/src/lb.hpp +10 -5
- data/ext/zeromq/src/libzmq.pc.cmake.in +10 -0
- data/ext/zeromq/src/likely.hpp +1 -2
- data/ext/zeromq/src/mailbox.cpp +1 -4
- data/ext/zeromq/src/mailbox.hpp +8 -3
- data/ext/zeromq/src/mechanism.cpp +163 -0
- data/ext/zeromq/src/mechanism.hpp +101 -0
- data/ext/zeromq/src/msg.cpp +38 -18
- data/ext/zeromq/src/msg.hpp +19 -7
- data/ext/zeromq/src/mtrie.cpp +16 -14
- data/ext/zeromq/src/mtrie.hpp +1 -3
- data/ext/zeromq/src/mutex.hpp +42 -3
- data/ext/zeromq/src/null_mechanism.cpp +282 -0
- data/ext/zeromq/src/null_mechanism.hpp +65 -0
- data/ext/zeromq/src/object.cpp +29 -3
- data/ext/zeromq/src/object.hpp +8 -5
- data/ext/zeromq/src/options.cpp +557 -485
- data/ext/zeromq/src/options.hpp +38 -24
- data/ext/zeromq/src/own.cpp +1 -2
- data/ext/zeromq/src/own.hpp +1 -2
- data/ext/zeromq/src/pair.cpp +8 -25
- data/ext/zeromq/src/pair.hpp +5 -22
- data/ext/zeromq/src/pgm_receiver.cpp +80 -67
- data/ext/zeromq/src/pgm_receiver.hpp +11 -10
- data/ext/zeromq/src/pgm_sender.cpp +37 -16
- data/ext/zeromq/src/pgm_sender.hpp +12 -6
- data/ext/zeromq/src/pgm_socket.cpp +8 -8
- data/ext/zeromq/src/pgm_socket.hpp +1 -4
- data/ext/zeromq/src/pipe.cpp +110 -72
- data/ext/zeromq/src/pipe.hpp +36 -27
- data/ext/zeromq/src/plain_mechanism.cpp +482 -0
- data/ext/zeromq/src/plain_mechanism.hpp +88 -0
- data/ext/zeromq/src/poll.cpp +1 -3
- data/ext/zeromq/src/poll.hpp +1 -3
- data/ext/zeromq/src/poller.hpp +1 -3
- data/ext/zeromq/src/poller_base.cpp +3 -3
- data/ext/zeromq/src/poller_base.hpp +1 -2
- data/ext/zeromq/src/precompiled.cpp +1 -2
- data/ext/zeromq/src/precompiled.hpp +1 -2
- data/ext/zeromq/src/proxy.cpp +1 -2
- data/ext/zeromq/src/proxy.hpp +1 -2
- data/ext/zeromq/src/pub.cpp +2 -16
- data/ext/zeromq/src/pub.hpp +2 -19
- data/ext/zeromq/src/pull.cpp +7 -24
- data/ext/zeromq/src/pull.hpp +4 -21
- data/ext/zeromq/src/push.cpp +8 -22
- data/ext/zeromq/src/push.hpp +4 -21
- data/ext/zeromq/src/random.cpp +1 -2
- data/ext/zeromq/src/random.hpp +1 -2
- data/ext/zeromq/src/raw_decoder.cpp +63 -0
- data/ext/zeromq/src/raw_decoder.hpp +66 -0
- data/ext/zeromq/src/raw_encoder.cpp +40 -0
- data/ext/zeromq/src/raw_encoder.hpp +60 -0
- data/ext/zeromq/src/reaper.cpp +12 -2
- data/ext/zeromq/src/reaper.hpp +6 -2
- data/ext/zeromq/src/rep.cpp +7 -21
- data/ext/zeromq/src/rep.hpp +3 -20
- data/ext/zeromq/src/req.cpp +132 -38
- data/ext/zeromq/src/req.hpp +27 -8
- data/ext/zeromq/src/router.cpp +109 -65
- data/ext/zeromq/src/router.hpp +9 -23
- data/ext/zeromq/src/select.cpp +1 -3
- data/ext/zeromq/src/select.hpp +1 -3
- data/ext/zeromq/src/session_base.cpp +164 -118
- data/ext/zeromq/src/session_base.hpp +29 -22
- data/ext/zeromq/src/signaler.cpp +127 -19
- data/ext/zeromq/src/signaler.hpp +20 -3
- data/ext/zeromq/src/socket_base.cpp +167 -134
- data/ext/zeromq/src/socket_base.hpp +18 -20
- data/ext/zeromq/src/stdint.hpp +1 -2
- data/ext/zeromq/src/stream.cpp +257 -0
- data/ext/zeromq/src/stream.hpp +97 -0
- data/ext/zeromq/src/stream_engine.cpp +405 -157
- data/ext/zeromq/src/stream_engine.hpp +72 -23
- data/ext/zeromq/src/sub.cpp +5 -18
- data/ext/zeromq/src/sub.hpp +2 -19
- data/ext/zeromq/src/tcp.cpp +23 -3
- data/ext/zeromq/src/tcp.hpp +7 -3
- data/ext/zeromq/src/tcp_address.cpp +35 -46
- data/ext/zeromq/src/tcp_address.hpp +7 -12
- data/ext/zeromq/src/tcp_connecter.cpp +10 -5
- data/ext/zeromq/src/tcp_connecter.hpp +1 -3
- data/ext/zeromq/src/tcp_listener.cpp +19 -8
- data/ext/zeromq/src/tcp_listener.hpp +1 -3
- data/ext/zeromq/src/thread.cpp +2 -4
- data/ext/zeromq/src/thread.hpp +1 -3
- data/ext/zeromq/src/trie.cpp +122 -125
- data/ext/zeromq/src/trie.hpp +1 -4
- data/ext/zeromq/src/v1_decoder.cpp +77 -91
- data/ext/zeromq/src/v1_decoder.hpp +10 -21
- data/ext/zeromq/src/v1_encoder.cpp +24 -62
- data/ext/zeromq/src/v1_encoder.hpp +7 -18
- data/ext/zeromq/src/v2_decoder.cpp +142 -0
- data/ext/zeromq/src/v2_decoder.hpp +57 -0
- data/ext/zeromq/src/v2_encoder.cpp +67 -0
- data/ext/zeromq/src/{i_msg_source.hpp → v2_encoder.hpp} +20 -15
- data/ext/zeromq/src/{v1_protocol.hpp → v2_protocol.hpp} +7 -11
- data/ext/zeromq/src/windows.hpp +2 -4
- data/ext/zeromq/src/wire.hpp +5 -6
- data/ext/zeromq/src/xpub.cpp +37 -46
- data/ext/zeromq/src/xpub.hpp +7 -23
- data/ext/zeromq/src/xsub.cpp +26 -40
- data/ext/zeromq/src/xsub.hpp +5 -21
- data/ext/zeromq/src/ypipe.hpp +3 -4
- data/ext/zeromq/src/ypipe_base.hpp +44 -0
- data/ext/zeromq/src/ypipe_conflate.hpp +127 -0
- data/ext/zeromq/src/yqueue.hpp +3 -7
- data/ext/zeromq/src/zmq.cpp +76 -96
- data/ext/zeromq/src/zmq_utils.cpp +146 -8
- data/ext/zeromq/tests/Makefile.am +56 -8
- data/ext/zeromq/tests/test_abstract_ipc.cpp +57 -0
- data/ext/zeromq/tests/test_conflate.cpp +75 -0
- data/ext/zeromq/tests/test_connect_resolve.cpp +14 -15
- data/ext/zeromq/tests/test_ctx_destroy.cpp +90 -0
- data/ext/zeromq/tests/test_ctx_options.cpp +52 -0
- data/ext/zeromq/tests/test_disconnect_inproc.cpp +35 -30
- data/ext/zeromq/tests/test_fork.cpp +81 -0
- data/ext/zeromq/tests/test_hwm.cpp +251 -35
- data/ext/zeromq/tests/test_immediate.cpp +229 -0
- data/ext/zeromq/tests/test_inproc_connect.cpp +339 -0
- data/ext/zeromq/tests/test_invalid_rep.cpp +9 -13
- data/ext/zeromq/tests/test_iov.cpp +106 -0
- data/ext/zeromq/tests/test_issue_566.cpp +85 -0
- data/ext/zeromq/tests/test_last_endpoint.cpp +14 -18
- data/ext/zeromq/tests/test_linger.cpp +93 -0
- data/ext/zeromq/tests/test_monitor.cpp +112 -129
- data/ext/zeromq/tests/test_msg_flags.cpp +17 -16
- data/ext/zeromq/tests/test_pair_inproc.cpp +25 -7
- data/ext/zeromq/tests/test_pair_ipc.cpp +4 -7
- data/ext/zeromq/tests/test_pair_tcp.cpp +4 -8
- data/ext/zeromq/tests/test_probe_router.cpp +72 -0
- data/ext/zeromq/tests/test_req_correlate.cpp +177 -0
- data/ext/zeromq/tests/test_req_relaxed.cpp +116 -0
- data/ext/zeromq/tests/test_reqrep_device.cpp +9 -17
- data/ext/zeromq/tests/test_reqrep_inproc.cpp +4 -7
- data/ext/zeromq/tests/test_reqrep_ipc.cpp +4 -7
- data/ext/zeromq/tests/test_reqrep_tcp.cpp +4 -8
- data/ext/zeromq/tests/test_router_mandatory.cpp +41 -22
- data/ext/zeromq/tests/test_security_curve.cpp +212 -0
- data/ext/zeromq/tests/test_security_null.cpp +148 -0
- data/ext/zeromq/tests/test_security_plain.cpp +150 -0
- data/ext/zeromq/tests/test_shutdown_stress.cpp +10 -23
- data/ext/zeromq/tests/test_spec_dealer.cpp +254 -0
- data/ext/zeromq/tests/test_spec_pushpull.cpp +293 -0
- data/ext/zeromq/tests/test_spec_rep.cpp +155 -0
- data/ext/zeromq/tests/test_spec_req.cpp +253 -0
- data/ext/zeromq/tests/test_spec_router.cpp +204 -0
- data/ext/zeromq/tests/test_stream.cpp +228 -0
- data/ext/zeromq/tests/test_sub_forward.cpp +14 -22
- data/ext/zeromq/tests/test_system.cpp +82 -0
- data/ext/zeromq/tests/test_term_endpoint.cpp +17 -31
- data/ext/zeromq/tests/test_timeo.cpp +34 -78
- data/ext/zeromq/tests/testutil.hpp +211 -26
- data/ext/zeromq/tools/Makefile.am +9 -0
- data/ext/zeromq/tools/curve_keygen.c +58 -0
- data/lib/zmq/version.rb +1 -1
- data/test/test_socket.rb +4 -3
- metadata +114 -15
- data/ext/zeromq/cmake/Modules/TestZMQVersion.cmake +0 -35
- data/ext/zeromq/foreign/openpgm/libpgm-5.1.118~dfsg.tar.gz +0 -0
- data/ext/zeromq/src/decoder.cpp +0 -166
- data/ext/zeromq/src/encoder.cpp +0 -102
- data/ext/zeromq/tests/test_connect_delay.cpp +0 -260
@@ -1,7 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c)
|
3
|
-
Copyright (c) 2007-2009 iMatix Corporation
|
4
|
-
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
|
2
|
+
Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
|
5
3
|
|
6
4
|
This file is part of 0MQ.
|
7
5
|
|
@@ -21,19 +19,21 @@
|
|
21
19
|
|
22
20
|
#include "platform.hpp"
|
23
21
|
|
24
|
-
#include "../include/zmq_utils.h"
|
25
|
-
|
26
|
-
#include <stdlib.h>
|
27
|
-
|
28
|
-
#include "stdint.hpp"
|
29
22
|
#include "clock.hpp"
|
30
23
|
#include "err.hpp"
|
24
|
+
#include "thread.hpp"
|
25
|
+
#include <assert.h>
|
26
|
+
#include "../include/zmq_utils.h"
|
31
27
|
|
32
28
|
#if !defined ZMQ_HAVE_WINDOWS
|
33
29
|
#include <unistd.h>
|
34
30
|
#else
|
35
31
|
#include "windows.hpp"
|
36
32
|
#endif
|
33
|
+
#ifdef HAVE_LIBSODIUM
|
34
|
+
# include <sodium.h>
|
35
|
+
#endif
|
36
|
+
|
37
37
|
|
38
38
|
void zmq_sleep (int seconds_)
|
39
39
|
{
|
@@ -59,3 +59,141 @@ unsigned long zmq_stopwatch_stop (void *watch_)
|
|
59
59
|
free (watch_);
|
60
60
|
return (unsigned long) (end - start);
|
61
61
|
}
|
62
|
+
|
63
|
+
void *zmq_threadstart(zmq_thread_fn* func, void* arg)
|
64
|
+
{
|
65
|
+
zmq::thread_t* thread = new zmq::thread_t;
|
66
|
+
thread->start(func, arg);
|
67
|
+
return thread;
|
68
|
+
}
|
69
|
+
|
70
|
+
void zmq_threadclose(void* thread)
|
71
|
+
{
|
72
|
+
zmq::thread_t* pThread = static_cast<zmq::thread_t*>(thread);
|
73
|
+
pThread->stop();
|
74
|
+
delete pThread;
|
75
|
+
}
|
76
|
+
|
77
|
+
// Z85 codec, taken from 0MQ RFC project, implements RFC32 Z85 encoding
|
78
|
+
|
79
|
+
// Maps base 256 to base 85
|
80
|
+
static char encoder [85 + 1] = {
|
81
|
+
"0123456789" "abcdefghij" "klmnopqrst" "uvwxyzABCD"
|
82
|
+
"EFGHIJKLMN" "OPQRSTUVWX" "YZ.-:+=^!/" "*?&<>()[]{"
|
83
|
+
"}@%$#"
|
84
|
+
};
|
85
|
+
|
86
|
+
// Maps base 85 to base 256
|
87
|
+
// We chop off lower 32 and higher 128 ranges
|
88
|
+
static uint8_t decoder [96] = {
|
89
|
+
0x00, 0x44, 0x00, 0x54, 0x53, 0x52, 0x48, 0x00,
|
90
|
+
0x4B, 0x4C, 0x46, 0x41, 0x00, 0x3F, 0x3E, 0x45,
|
91
|
+
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
92
|
+
0x08, 0x09, 0x40, 0x00, 0x49, 0x42, 0x4A, 0x47,
|
93
|
+
0x51, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A,
|
94
|
+
0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32,
|
95
|
+
0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
|
96
|
+
0x3B, 0x3C, 0x3D, 0x4D, 0x00, 0x4E, 0x43, 0x00,
|
97
|
+
0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
|
98
|
+
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
|
99
|
+
0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
|
100
|
+
0x21, 0x22, 0x23, 0x4F, 0x00, 0x50, 0x00, 0x00
|
101
|
+
};
|
102
|
+
|
103
|
+
// --------------------------------------------------------------------------
|
104
|
+
// Encode a binary frame as a string; destination string MUST be at least
|
105
|
+
// size * 5 / 4 bytes long plus 1 byte for the null terminator. Returns
|
106
|
+
// dest. Size must be a multiple of 4.
|
107
|
+
// Returns NULL and sets errno = EINVAL for invalid input.
|
108
|
+
|
109
|
+
char *zmq_z85_encode (char *dest, uint8_t *data, size_t size)
|
110
|
+
{
|
111
|
+
if (size % 4 != 0) {
|
112
|
+
errno = EINVAL;
|
113
|
+
return NULL;
|
114
|
+
}
|
115
|
+
unsigned int char_nbr = 0;
|
116
|
+
unsigned int byte_nbr = 0;
|
117
|
+
uint32_t value = 0;
|
118
|
+
while (byte_nbr < size) {
|
119
|
+
// Accumulate value in base 256 (binary)
|
120
|
+
value = value * 256 + data [byte_nbr++];
|
121
|
+
if (byte_nbr % 4 == 0) {
|
122
|
+
// Output value in base 85
|
123
|
+
unsigned int divisor = 85 * 85 * 85 * 85;
|
124
|
+
while (divisor) {
|
125
|
+
dest [char_nbr++] = encoder [value / divisor % 85];
|
126
|
+
divisor /= 85;
|
127
|
+
}
|
128
|
+
value = 0;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
assert (char_nbr == size * 5 / 4);
|
132
|
+
dest [char_nbr] = 0;
|
133
|
+
return dest;
|
134
|
+
}
|
135
|
+
|
136
|
+
|
137
|
+
// --------------------------------------------------------------------------
|
138
|
+
// Decode an encoded string into a binary frame; dest must be at least
|
139
|
+
// strlen (string) * 4 / 5 bytes long. Returns dest. strlen (string)
|
140
|
+
// must be a multiple of 5.
|
141
|
+
// Returns NULL and sets errno = EINVAL for invalid input.
|
142
|
+
|
143
|
+
uint8_t *zmq_z85_decode (uint8_t *dest, char *string)
|
144
|
+
{
|
145
|
+
|
146
|
+
if (strlen (string) % 5 != 0) {
|
147
|
+
errno = EINVAL;
|
148
|
+
return NULL;
|
149
|
+
}
|
150
|
+
unsigned int byte_nbr = 0;
|
151
|
+
unsigned int char_nbr = 0;
|
152
|
+
uint32_t value = 0;
|
153
|
+
while (char_nbr < strlen (string)) {
|
154
|
+
// Accumulate value in base 85
|
155
|
+
value = value * 85 + decoder [(uint8_t) string [char_nbr++] - 32];
|
156
|
+
if (char_nbr % 5 == 0) {
|
157
|
+
// Output value in base 256
|
158
|
+
unsigned int divisor = 256 * 256 * 256;
|
159
|
+
while (divisor) {
|
160
|
+
dest [byte_nbr++] = value / divisor % 256;
|
161
|
+
divisor /= 256;
|
162
|
+
}
|
163
|
+
value = 0;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
assert (byte_nbr == strlen (string) * 4 / 5);
|
167
|
+
return dest;
|
168
|
+
}
|
169
|
+
|
170
|
+
// --------------------------------------------------------------------------
|
171
|
+
// Generate a public/private keypair with libsodium.
|
172
|
+
// Generated keys will be 40 byte z85-encoded strings.
|
173
|
+
// Returns 0 on success, -1 on failure, setting errno.
|
174
|
+
// Sets errno = ENOTSUP in the absence of libsodium.
|
175
|
+
|
176
|
+
int zmq_curve_keypair (char* z85_public_key, char *z85_secret_key)
|
177
|
+
{
|
178
|
+
#ifdef HAVE_LIBSODIUM
|
179
|
+
# if crypto_box_PUBLICKEYBYTES != 32 \
|
180
|
+
|| crypto_box_SECRETKEYBYTES != 32
|
181
|
+
# error "libsodium not built correctly"
|
182
|
+
# endif
|
183
|
+
|
184
|
+
uint8_t public_key [32];
|
185
|
+
uint8_t secret_key [32];
|
186
|
+
|
187
|
+
int rc = crypto_box_keypair (public_key, secret_key);
|
188
|
+
// is there a sensible errno to set here?
|
189
|
+
if (rc) return rc;
|
190
|
+
|
191
|
+
zmq_z85_encode (z85_public_key, public_key, 32);
|
192
|
+
zmq_z85_encode (z85_secret_key, secret_key, 32);
|
193
|
+
|
194
|
+
return 0;
|
195
|
+
#else // requires libsodium
|
196
|
+
errno = ENOTSUP;
|
197
|
+
return -1;
|
198
|
+
#endif
|
199
|
+
}
|
@@ -3,7 +3,8 @@ INCLUDES = -I$(top_builddir)/include \
|
|
3
3
|
|
4
4
|
LDADD = $(top_builddir)/src/libzmq.la
|
5
5
|
|
6
|
-
noinst_PROGRAMS =
|
6
|
+
noinst_PROGRAMS = test_system \
|
7
|
+
test_pair_inproc \
|
7
8
|
test_pair_tcp \
|
8
9
|
test_reqrep_inproc \
|
9
10
|
test_reqrep_tcp \
|
@@ -13,21 +14,42 @@ noinst_PROGRAMS = test_pair_inproc \
|
|
13
14
|
test_invalid_rep \
|
14
15
|
test_msg_flags \
|
15
16
|
test_connect_resolve \
|
16
|
-
|
17
|
+
test_immediate \
|
17
18
|
test_last_endpoint \
|
18
19
|
test_term_endpoint \
|
20
|
+
test_linger \
|
19
21
|
test_monitor \
|
20
22
|
test_router_mandatory \
|
21
|
-
|
22
|
-
|
23
|
+
test_probe_router \
|
24
|
+
test_stream \
|
25
|
+
test_disconnect_inproc \
|
26
|
+
test_ctx_options \
|
27
|
+
test_ctx_destroy \
|
28
|
+
test_security_null \
|
29
|
+
test_security_plain \
|
30
|
+
test_security_curve \
|
31
|
+
test_iov \
|
32
|
+
test_spec_req \
|
33
|
+
test_spec_rep \
|
34
|
+
test_spec_dealer \
|
35
|
+
test_spec_router \
|
36
|
+
test_spec_pushpull \
|
37
|
+
test_req_correlate \
|
38
|
+
test_req_relaxed \
|
39
|
+
test_conflate \
|
40
|
+
test_inproc_connect \
|
41
|
+
test_issue_566 \
|
42
|
+
test_abstract_ipc
|
23
43
|
|
24
44
|
if !ON_MINGW
|
25
45
|
noinst_PROGRAMS += test_shutdown_stress \
|
26
46
|
test_pair_ipc \
|
27
47
|
test_reqrep_ipc \
|
28
|
-
test_timeo
|
48
|
+
test_timeo \
|
49
|
+
test_fork
|
29
50
|
endif
|
30
51
|
|
52
|
+
test_system_SOURCES = test_system.cpp
|
31
53
|
test_pair_inproc_SOURCES = test_pair_inproc.cpp testutil.hpp
|
32
54
|
test_pair_tcp_SOURCES = test_pair_tcp.cpp testutil.hpp
|
33
55
|
test_reqrep_inproc_SOURCES = test_reqrep_inproc.cpp testutil.hpp
|
@@ -36,20 +58,46 @@ test_hwm_SOURCES = test_hwm.cpp
|
|
36
58
|
test_reqrep_device_SOURCES = test_reqrep_device.cpp
|
37
59
|
test_sub_forward_SOURCES = test_sub_forward.cpp
|
38
60
|
test_invalid_rep_SOURCES = test_invalid_rep.cpp
|
61
|
+
test_linger_SOURCES = test_linger.cpp
|
39
62
|
test_msg_flags_SOURCES = test_msg_flags.cpp
|
40
63
|
test_connect_resolve_SOURCES = test_connect_resolve.cpp
|
41
|
-
|
64
|
+
test_immediate_SOURCES = test_immediate.cpp
|
42
65
|
test_last_endpoint_SOURCES = test_last_endpoint.cpp
|
43
66
|
test_term_endpoint_SOURCES = test_term_endpoint.cpp
|
44
67
|
test_monitor_SOURCES = test_monitor.cpp
|
45
|
-
test_disconnect_inproc_SOURCES = test_disconnect_inproc.cpp
|
46
68
|
test_router_mandatory_SOURCES = test_router_mandatory.cpp
|
47
|
-
|
69
|
+
test_probe_router_SOURCES = test_probe_router.cpp
|
70
|
+
test_stream_SOURCES = test_stream.cpp
|
71
|
+
test_disconnect_inproc_SOURCES = test_disconnect_inproc.cpp
|
72
|
+
test_ctx_options_SOURCES = test_ctx_options.cpp
|
73
|
+
test_iov_SOURCES = test_iov.cpp
|
74
|
+
test_ctx_destroy_SOURCES = test_ctx_destroy.cpp
|
75
|
+
test_security_null_SOURCES = test_security_null.cpp
|
76
|
+
test_security_plain_SOURCES = test_security_plain.cpp
|
77
|
+
test_security_curve_SOURCES = test_security_curve.cpp
|
78
|
+
test_spec_req_SOURCES = test_spec_req.cpp
|
79
|
+
test_spec_rep_SOURCES = test_spec_rep.cpp
|
80
|
+
test_spec_dealer_SOURCES = test_spec_dealer.cpp
|
81
|
+
test_spec_router_SOURCES = test_spec_router.cpp
|
82
|
+
test_spec_pushpull_SOURCES = test_spec_pushpull.cpp
|
83
|
+
test_req_correlate_SOURCES = test_req_correlate.cpp
|
84
|
+
test_req_relaxed_SOURCES = test_req_relaxed.cpp
|
85
|
+
test_conflate_SOURCES = test_conflate.cpp
|
86
|
+
test_inproc_connect_SOURCES = test_inproc_connect.cpp
|
87
|
+
test_issue_566_SOURCES = test_issue_566.cpp
|
88
|
+
test_abstract_ipc_SOURCES = test_abstract_ipc.cpp
|
48
89
|
if !ON_MINGW
|
49
90
|
test_shutdown_stress_SOURCES = test_shutdown_stress.cpp
|
50
91
|
test_pair_ipc_SOURCES = test_pair_ipc.cpp testutil.hpp
|
51
92
|
test_reqrep_ipc_SOURCES = test_reqrep_ipc.cpp testutil.hpp
|
52
93
|
test_timeo_SOURCES = test_timeo.cpp
|
94
|
+
test_fork_SOURCES = test_fork.cpp
|
53
95
|
endif
|
54
96
|
|
97
|
+
# Run the test cases
|
55
98
|
TESTS = $(noinst_PROGRAMS)
|
99
|
+
XFAIL_TESTS = test_linger
|
100
|
+
|
101
|
+
if !ON_LINUX
|
102
|
+
XFAIL_TESTS += test_abstract_ipc
|
103
|
+
endif
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
|
3
|
+
|
4
|
+
This file is part of 0MQ.
|
5
|
+
|
6
|
+
0MQ is free software; you can redistribute it and/or modify it under
|
7
|
+
the terms of the GNU Lesser General Public License as published by
|
8
|
+
the Free Software Foundation; either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
0MQ is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
17
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
*/
|
19
|
+
|
20
|
+
#include "testutil.hpp"
|
21
|
+
|
22
|
+
int main (void)
|
23
|
+
{
|
24
|
+
setup_test_environment();
|
25
|
+
void *ctx = zmq_ctx_new ();
|
26
|
+
assert (ctx);
|
27
|
+
|
28
|
+
void *sb = zmq_socket (ctx, ZMQ_PAIR);
|
29
|
+
assert (sb);
|
30
|
+
int rc = zmq_bind (sb, "ipc://@/tmp/tester");
|
31
|
+
assert (rc == 0);
|
32
|
+
|
33
|
+
char endpoint[200];
|
34
|
+
size_t size = sizeof(endpoint);
|
35
|
+
rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &size);
|
36
|
+
assert (rc == 0);
|
37
|
+
rc = strncmp(endpoint, "ipc://@/tmp/tester", size);
|
38
|
+
assert (rc == 0);
|
39
|
+
|
40
|
+
void *sc = zmq_socket (ctx, ZMQ_PAIR);
|
41
|
+
assert (sc);
|
42
|
+
rc = zmq_connect (sc, "ipc://@/tmp/tester");
|
43
|
+
assert (rc == 0);
|
44
|
+
|
45
|
+
bounce (sb, sc);
|
46
|
+
|
47
|
+
rc = zmq_close (sc);
|
48
|
+
assert (rc == 0);
|
49
|
+
|
50
|
+
rc = zmq_close (sb);
|
51
|
+
assert (rc == 0);
|
52
|
+
|
53
|
+
rc = zmq_ctx_term (ctx);
|
54
|
+
assert (rc == 0);
|
55
|
+
|
56
|
+
return 0 ;
|
57
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
|
3
|
+
|
4
|
+
This file is part of 0MQ.
|
5
|
+
|
6
|
+
0MQ is free software; you can redistribute it and/or modify it under
|
7
|
+
the terms of the GNU Lesser General Public License as published by
|
8
|
+
the Free Software Foundation; either version 3 of the License, or
|
9
|
+
(at your option) any later version.
|
10
|
+
|
11
|
+
0MQ is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
17
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
*/
|
19
|
+
|
20
|
+
#include "testutil.hpp"
|
21
|
+
|
22
|
+
int main (int argc, char *argv [])
|
23
|
+
{
|
24
|
+
const char *bind_to = "tcp://127.0.0.1:5555";
|
25
|
+
|
26
|
+
int rc;
|
27
|
+
|
28
|
+
void* ctx = zmq_init (1);
|
29
|
+
assert (ctx);
|
30
|
+
|
31
|
+
void* s_in = zmq_socket (ctx, ZMQ_PULL);
|
32
|
+
assert (s_in);
|
33
|
+
|
34
|
+
int conflate = 1;
|
35
|
+
rc = zmq_setsockopt (s_in, ZMQ_CONFLATE, &conflate, sizeof(conflate));
|
36
|
+
assert (rc == 0);
|
37
|
+
|
38
|
+
rc = zmq_bind (s_in, bind_to);
|
39
|
+
assert (rc == 0);
|
40
|
+
|
41
|
+
void* s_out = zmq_socket (ctx, ZMQ_PUSH);
|
42
|
+
assert (s_out);
|
43
|
+
|
44
|
+
rc = zmq_connect (s_out, bind_to);
|
45
|
+
assert (rc == 0);
|
46
|
+
|
47
|
+
int message_count = 20;
|
48
|
+
|
49
|
+
for (int j = 0; j < message_count; ++j) {
|
50
|
+
rc = zmq_send(s_out, (void*)&j, sizeof(int), 0);
|
51
|
+
if (rc < 0) {
|
52
|
+
printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno));
|
53
|
+
return -1;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
zmq_sleep (1);
|
58
|
+
|
59
|
+
int payload_recved = 0;
|
60
|
+
rc = zmq_recv(s_in, (void*)&payload_recved, sizeof(int), 0);
|
61
|
+
assert (rc > 0);
|
62
|
+
assert (payload_recved == message_count - 1);
|
63
|
+
|
64
|
+
|
65
|
+
rc = zmq_close (s_in);
|
66
|
+
assert (rc == 0);
|
67
|
+
|
68
|
+
rc = zmq_close (s_out);
|
69
|
+
assert (rc == 0);
|
70
|
+
|
71
|
+
rc = zmq_term (ctx);
|
72
|
+
assert (rc == 0);
|
73
|
+
|
74
|
+
return 0;
|
75
|
+
}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c)
|
3
|
-
Copyright (c) 2012 Other contributors as noted in the AUTHORS file
|
2
|
+
Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
|
4
3
|
|
5
4
|
This file is part of 0MQ.
|
6
5
|
|
@@ -18,36 +17,36 @@
|
|
18
17
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
18
|
*/
|
20
19
|
|
21
|
-
#include "
|
22
|
-
#include <stdio.h>
|
23
|
-
#include <errno.h>
|
24
|
-
|
25
|
-
#undef NDEBUG
|
26
|
-
#include <assert.h>
|
20
|
+
#include "testutil.hpp"
|
27
21
|
|
28
22
|
int main (void)
|
29
23
|
{
|
30
|
-
|
31
|
-
|
32
|
-
void *ctx = zmq_init (1);
|
24
|
+
setup_test_environment();
|
25
|
+
void *ctx = zmq_ctx_new ();
|
33
26
|
assert (ctx);
|
34
27
|
|
35
|
-
// Create pair of socket, each with high watermark of 2. Thus the total
|
36
|
-
// buffer space should be 4 messages.
|
37
28
|
void *sock = zmq_socket (ctx, ZMQ_PUB);
|
38
29
|
assert (sock);
|
39
30
|
|
40
31
|
int rc = zmq_connect (sock, "tcp://localhost:1234");
|
41
32
|
assert (rc == 0);
|
42
33
|
|
43
|
-
rc = zmq_connect (sock, "tcp://
|
34
|
+
rc = zmq_connect (sock, "tcp://localhost:invalid");
|
44
35
|
assert (rc == -1);
|
45
36
|
assert (errno == EINVAL);
|
46
37
|
|
38
|
+
rc = zmq_connect (sock, "tcp://in val id:1234");
|
39
|
+
assert (rc == -1);
|
40
|
+
assert (errno == EINVAL);
|
41
|
+
|
42
|
+
rc = zmq_connect (sock, "invalid://localhost:1234");
|
43
|
+
assert (rc == -1);
|
44
|
+
assert (errno == EPROTONOSUPPORT);
|
45
|
+
|
47
46
|
rc = zmq_close (sock);
|
48
47
|
assert (rc == 0);
|
49
48
|
|
50
|
-
rc =
|
49
|
+
rc = zmq_ctx_term (ctx);
|
51
50
|
assert (rc == 0);
|
52
51
|
|
53
52
|
return 0;
|