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
@@ -0,0 +1,142 @@
|
|
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 <stdlib.h>
|
21
|
+
#include <string.h>
|
22
|
+
|
23
|
+
#include "platform.hpp"
|
24
|
+
#ifdef ZMQ_HAVE_WINDOWS
|
25
|
+
#include "windows.hpp"
|
26
|
+
#endif
|
27
|
+
|
28
|
+
#include "v2_protocol.hpp"
|
29
|
+
#include "v2_decoder.hpp"
|
30
|
+
#include "likely.hpp"
|
31
|
+
#include "wire.hpp"
|
32
|
+
#include "err.hpp"
|
33
|
+
|
34
|
+
zmq::v2_decoder_t::v2_decoder_t (size_t bufsize_, int64_t maxmsgsize_) :
|
35
|
+
decoder_base_t <v2_decoder_t> (bufsize_),
|
36
|
+
msg_flags (0),
|
37
|
+
maxmsgsize (maxmsgsize_)
|
38
|
+
{
|
39
|
+
int rc = in_progress.init ();
|
40
|
+
errno_assert (rc == 0);
|
41
|
+
|
42
|
+
// At the beginning, read one byte and go to flags_ready state.
|
43
|
+
next_step (tmpbuf, 1, &v2_decoder_t::flags_ready);
|
44
|
+
}
|
45
|
+
|
46
|
+
zmq::v2_decoder_t::~v2_decoder_t ()
|
47
|
+
{
|
48
|
+
int rc = in_progress.close ();
|
49
|
+
errno_assert (rc == 0);
|
50
|
+
}
|
51
|
+
|
52
|
+
int zmq::v2_decoder_t::flags_ready ()
|
53
|
+
{
|
54
|
+
msg_flags = 0;
|
55
|
+
if (tmpbuf [0] & v2_protocol_t::more_flag)
|
56
|
+
msg_flags |= msg_t::more;
|
57
|
+
if (tmpbuf [0] & v2_protocol_t::command_flag)
|
58
|
+
msg_flags |= msg_t::command;
|
59
|
+
|
60
|
+
// The payload length is either one or eight bytes,
|
61
|
+
// depending on whether the 'large' bit is set.
|
62
|
+
if (tmpbuf [0] & v2_protocol_t::large_flag)
|
63
|
+
next_step (tmpbuf, 8, &v2_decoder_t::eight_byte_size_ready);
|
64
|
+
else
|
65
|
+
next_step (tmpbuf, 1, &v2_decoder_t::one_byte_size_ready);
|
66
|
+
|
67
|
+
return 0;
|
68
|
+
}
|
69
|
+
|
70
|
+
int zmq::v2_decoder_t::one_byte_size_ready ()
|
71
|
+
{
|
72
|
+
// Message size must not exceed the maximum allowed size.
|
73
|
+
if (maxmsgsize >= 0)
|
74
|
+
if (unlikely (tmpbuf [0] > static_cast <uint64_t> (maxmsgsize))) {
|
75
|
+
errno = EMSGSIZE;
|
76
|
+
return -1;
|
77
|
+
}
|
78
|
+
|
79
|
+
// in_progress is initialised at this point so in theory we should
|
80
|
+
// close it before calling zmq_msg_init_size, however, it's a 0-byte
|
81
|
+
// message and thus we can treat it as uninitialised...
|
82
|
+
int rc = in_progress.init_size (tmpbuf [0]);
|
83
|
+
if (unlikely (rc)) {
|
84
|
+
errno_assert (errno == ENOMEM);
|
85
|
+
rc = in_progress.init ();
|
86
|
+
errno_assert (rc == 0);
|
87
|
+
errno = ENOMEM;
|
88
|
+
return -1;
|
89
|
+
}
|
90
|
+
|
91
|
+
in_progress.set_flags (msg_flags);
|
92
|
+
next_step (in_progress.data (), in_progress.size (),
|
93
|
+
&v2_decoder_t::message_ready);
|
94
|
+
|
95
|
+
return 0;
|
96
|
+
}
|
97
|
+
|
98
|
+
int zmq::v2_decoder_t::eight_byte_size_ready ()
|
99
|
+
{
|
100
|
+
// The payload size is encoded as 64-bit unsigned integer.
|
101
|
+
// The most significant byte comes first.
|
102
|
+
const uint64_t msg_size = get_uint64 (tmpbuf);
|
103
|
+
|
104
|
+
// Message size must not exceed the maximum allowed size.
|
105
|
+
if (maxmsgsize >= 0)
|
106
|
+
if (unlikely (msg_size > static_cast <uint64_t> (maxmsgsize))) {
|
107
|
+
errno = EMSGSIZE;
|
108
|
+
return -1;
|
109
|
+
}
|
110
|
+
|
111
|
+
// Message size must fit into size_t data type.
|
112
|
+
if (unlikely (msg_size != static_cast <size_t> (msg_size))) {
|
113
|
+
errno = EMSGSIZE;
|
114
|
+
return -1;
|
115
|
+
}
|
116
|
+
|
117
|
+
// in_progress is initialised at this point so in theory we should
|
118
|
+
// close it before calling init_size, however, it's a 0-byte
|
119
|
+
// message and thus we can treat it as uninitialised.
|
120
|
+
int rc = in_progress.init_size (static_cast <size_t> (msg_size));
|
121
|
+
if (unlikely (rc)) {
|
122
|
+
errno_assert (errno == ENOMEM);
|
123
|
+
rc = in_progress.init ();
|
124
|
+
errno_assert (rc == 0);
|
125
|
+
errno = ENOMEM;
|
126
|
+
return -1;
|
127
|
+
}
|
128
|
+
|
129
|
+
in_progress.set_flags (msg_flags);
|
130
|
+
next_step (in_progress.data (), in_progress.size (),
|
131
|
+
&v2_decoder_t::message_ready);
|
132
|
+
|
133
|
+
return 0;
|
134
|
+
}
|
135
|
+
|
136
|
+
int zmq::v2_decoder_t::message_ready ()
|
137
|
+
{
|
138
|
+
// Message is completely read. Signal this to the caller
|
139
|
+
// and prepare to decode next message.
|
140
|
+
next_step (tmpbuf, 1, &v2_decoder_t::flags_ready);
|
141
|
+
return 1;
|
142
|
+
}
|
@@ -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
|
+
#ifndef __ZMQ_V2_DECODER_HPP_INCLUDED__
|
21
|
+
#define __ZMQ_V2_DECODER_HPP_INCLUDED__
|
22
|
+
|
23
|
+
#include "decoder.hpp"
|
24
|
+
|
25
|
+
namespace zmq
|
26
|
+
{
|
27
|
+
// Decoder for ZMTP/2.x framing protocol. Converts data stream into messages.
|
28
|
+
class v2_decoder_t : public decoder_base_t <v2_decoder_t>
|
29
|
+
{
|
30
|
+
public:
|
31
|
+
|
32
|
+
v2_decoder_t (size_t bufsize_, int64_t maxmsgsize_);
|
33
|
+
virtual ~v2_decoder_t ();
|
34
|
+
|
35
|
+
// i_decoder interface.
|
36
|
+
virtual msg_t *msg () { return &in_progress; }
|
37
|
+
|
38
|
+
private:
|
39
|
+
|
40
|
+
int flags_ready ();
|
41
|
+
int one_byte_size_ready ();
|
42
|
+
int eight_byte_size_ready ();
|
43
|
+
int message_ready ();
|
44
|
+
|
45
|
+
unsigned char tmpbuf [8];
|
46
|
+
unsigned char msg_flags;
|
47
|
+
msg_t in_progress;
|
48
|
+
|
49
|
+
const int64_t maxmsgsize;
|
50
|
+
|
51
|
+
v2_decoder_t (const v2_decoder_t&);
|
52
|
+
void operator = (const v2_decoder_t&);
|
53
|
+
};
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
#endif
|
@@ -0,0 +1,67 @@
|
|
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 "v2_protocol.hpp"
|
21
|
+
#include "v2_encoder.hpp"
|
22
|
+
#include "likely.hpp"
|
23
|
+
#include "wire.hpp"
|
24
|
+
|
25
|
+
zmq::v2_encoder_t::v2_encoder_t (size_t bufsize_) :
|
26
|
+
encoder_base_t <v2_encoder_t> (bufsize_)
|
27
|
+
{
|
28
|
+
// Write 0 bytes to the batch and go to message_ready state.
|
29
|
+
next_step (NULL, 0, &v2_encoder_t::message_ready, true);
|
30
|
+
}
|
31
|
+
|
32
|
+
zmq::v2_encoder_t::~v2_encoder_t ()
|
33
|
+
{
|
34
|
+
}
|
35
|
+
|
36
|
+
void zmq::v2_encoder_t::message_ready ()
|
37
|
+
{
|
38
|
+
// Encode flags.
|
39
|
+
unsigned char &protocol_flags = tmpbuf [0];
|
40
|
+
protocol_flags = 0;
|
41
|
+
if (in_progress->flags () & msg_t::more)
|
42
|
+
protocol_flags |= v2_protocol_t::more_flag;
|
43
|
+
if (in_progress->size () > 255)
|
44
|
+
protocol_flags |= v2_protocol_t::large_flag;
|
45
|
+
if (in_progress->flags () & msg_t::command)
|
46
|
+
protocol_flags |= v2_protocol_t::command_flag;
|
47
|
+
|
48
|
+
// Encode the message length. For messages less then 256 bytes,
|
49
|
+
// the length is encoded as 8-bit unsigned integer. For larger
|
50
|
+
// messages, 64-bit unsigned integer in network byte order is used.
|
51
|
+
const size_t size = in_progress->size ();
|
52
|
+
if (unlikely (size > 255)) {
|
53
|
+
put_uint64 (tmpbuf + 1, size);
|
54
|
+
next_step (tmpbuf, 9, &v2_encoder_t::size_ready, false);
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
tmpbuf [1] = static_cast <uint8_t> (size);
|
58
|
+
next_step (tmpbuf, 2, &v2_encoder_t::size_ready, false);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
void zmq::v2_encoder_t::size_ready ()
|
63
|
+
{
|
64
|
+
// Write message body into the buffer.
|
65
|
+
next_step (in_progress->data (), in_progress->size (),
|
66
|
+
&v2_encoder_t::message_ready, true);
|
67
|
+
}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2007-
|
3
|
-
Copyright (c) 2007-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,27 +17,33 @@
|
|
18
17
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
18
|
*/
|
20
19
|
|
21
|
-
#ifndef
|
22
|
-
#define
|
20
|
+
#ifndef __ZMQ_V2_ENCODER_HPP_INCLUDED__
|
21
|
+
#define __ZMQ_V2_ENCODER_HPP_INCLUDED__
|
22
|
+
|
23
|
+
#include "encoder.hpp"
|
23
24
|
|
24
25
|
namespace zmq
|
25
26
|
{
|
27
|
+
// Encoder for 0MQ framing protocol. Converts messages into data stream.
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
+
class v2_encoder_t : public encoder_base_t <v2_encoder_t>
|
30
|
+
{
|
31
|
+
public:
|
29
32
|
|
30
|
-
|
33
|
+
v2_encoder_t (size_t bufsize_);
|
34
|
+
virtual ~v2_encoder_t ();
|
31
35
|
|
32
|
-
|
33
|
-
{
|
34
|
-
virtual ~i_msg_source () {}
|
36
|
+
private:
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
// longer used.
|
39
|
-
virtual int pull_msg (msg_t *msg_) = 0;
|
40
|
-
};
|
38
|
+
void size_ready ();
|
39
|
+
void message_ready ();
|
41
40
|
|
41
|
+
unsigned char tmpbuf [9];
|
42
|
+
|
43
|
+
v2_encoder_t (const v2_encoder_t&);
|
44
|
+
const v2_encoder_t &operator = (const v2_encoder_t&);
|
45
|
+
};
|
42
46
|
}
|
43
47
|
|
44
48
|
#endif
|
49
|
+
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2007-
|
3
|
-
Copyright (c) 2007-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,26 +17,23 @@
|
|
18
17
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
18
|
*/
|
20
19
|
|
21
|
-
#ifndef
|
22
|
-
#define
|
20
|
+
#ifndef __ZMQ_V2_PROTOCOL_HPP_INCLUDED__
|
21
|
+
#define __ZMQ_V2_PROTOCOL_HPP_INCLUDED__
|
23
22
|
|
24
23
|
namespace zmq
|
25
24
|
{
|
26
|
-
|
27
|
-
|
28
|
-
class v1_protocol_t
|
25
|
+
// Definition of constants for ZMTP/2.0 transport protocol.
|
26
|
+
class v2_protocol_t
|
29
27
|
{
|
30
28
|
public:
|
31
29
|
// Message flags.
|
32
30
|
enum
|
33
31
|
{
|
34
32
|
more_flag = 1,
|
35
|
-
large_flag = 2
|
33
|
+
large_flag = 2,
|
34
|
+
command_flag = 4
|
36
35
|
};
|
37
|
-
|
38
36
|
};
|
39
|
-
|
40
37
|
}
|
41
38
|
|
42
39
|
#endif
|
43
|
-
|
data/ext/zeromq/src/windows.hpp
CHANGED
@@ -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
|
|
@@ -170,7 +168,7 @@
|
|
170
168
|
|
171
169
|
#include <ws2tcpip.h>
|
172
170
|
#include <ipexport.h>
|
173
|
-
#if !defined
|
171
|
+
#if !defined _WIN32_WCE
|
174
172
|
#include <process.h>
|
175
173
|
#endif
|
176
174
|
|
data/ext/zeromq/src/wire.hpp
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2007-
|
3
|
-
Copyright (c) 2007-2011 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
|
|
@@ -34,7 +33,7 @@ namespace zmq
|
|
34
33
|
*buffer_ = value;
|
35
34
|
}
|
36
35
|
|
37
|
-
inline uint8_t get_uint8 (unsigned char *buffer_)
|
36
|
+
inline uint8_t get_uint8 (const unsigned char *buffer_)
|
38
37
|
{
|
39
38
|
return *buffer_;
|
40
39
|
}
|
@@ -45,7 +44,7 @@ namespace zmq
|
|
45
44
|
buffer_ [1] = (unsigned char) (value & 0xff);
|
46
45
|
}
|
47
46
|
|
48
|
-
inline uint16_t get_uint16 (unsigned char *buffer_)
|
47
|
+
inline uint16_t get_uint16 (const unsigned char *buffer_)
|
49
48
|
{
|
50
49
|
return
|
51
50
|
(((uint16_t) buffer_ [0]) << 8) |
|
@@ -60,7 +59,7 @@ namespace zmq
|
|
60
59
|
buffer_ [3] = (unsigned char) (value & 0xff);
|
61
60
|
}
|
62
61
|
|
63
|
-
inline uint32_t get_uint32 (unsigned char *buffer_)
|
62
|
+
inline uint32_t get_uint32 (const unsigned char *buffer_)
|
64
63
|
{
|
65
64
|
return
|
66
65
|
(((uint32_t) buffer_ [0]) << 24) |
|
@@ -81,7 +80,7 @@ namespace zmq
|
|
81
80
|
buffer_ [7] = (unsigned char) (value & 0xff);
|
82
81
|
}
|
83
82
|
|
84
|
-
inline uint64_t get_uint64 (unsigned char *buffer_)
|
83
|
+
inline uint64_t get_uint64 (const unsigned char *buffer_)
|
85
84
|
{
|
86
85
|
return
|
87
86
|
(((uint64_t) buffer_ [0]) << 56) |
|
data/ext/zeromq/src/xpub.cpp
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c)
|
3
|
-
Copyright (c) 2011 VMware, Inc.
|
4
|
-
Copyright (c) 2010-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
|
|
@@ -38,14 +36,14 @@ zmq::xpub_t::~xpub_t ()
|
|
38
36
|
{
|
39
37
|
}
|
40
38
|
|
41
|
-
void zmq::xpub_t::xattach_pipe (pipe_t *pipe_, bool
|
39
|
+
void zmq::xpub_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
|
42
40
|
{
|
43
41
|
zmq_assert (pipe_);
|
44
42
|
dist.attach (pipe_);
|
45
43
|
|
46
|
-
// If
|
44
|
+
// If subscribe_to_all_ is specified, the caller would like to subscribe
|
47
45
|
// to all data on this pipe, implicitly.
|
48
|
-
if (
|
46
|
+
if (subscribe_to_all_)
|
49
47
|
subscriptions.add (NULL, 0, pipe_);
|
50
48
|
|
51
49
|
// The pipe is active when attached. Let's read the subscriptions from
|
@@ -58,9 +56,8 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
|
|
58
56
|
// There are some subscriptions waiting. Let's process them.
|
59
57
|
msg_t sub;
|
60
58
|
while (pipe_->read (&sub)) {
|
61
|
-
|
62
|
-
|
63
|
-
unsigned char *const data = (unsigned char*) sub.data ();
|
59
|
+
// Apply the subscription to the trie
|
60
|
+
unsigned char *const data = (unsigned char *) sub.data ();
|
64
61
|
const size_t size = sub.size ();
|
65
62
|
if (size > 0 && (*data == 0 || *data == 1)) {
|
66
63
|
bool unique;
|
@@ -71,10 +68,16 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
|
|
71
68
|
|
72
69
|
// If the subscription is not a duplicate store it so that it can be
|
73
70
|
// passed to used on next recv call. (Unsubscribe is not verbose.)
|
74
|
-
if (options.type == ZMQ_XPUB && (unique || (*data && verbose)))
|
75
|
-
|
71
|
+
if (options.type == ZMQ_XPUB && (unique || (*data && verbose))) {
|
72
|
+
pending_data.push_back (blob_t (data, size));
|
73
|
+
pending_flags.push_back (0);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
// Process user message coming upstream from xsub socket
|
78
|
+
pending_data.push_back (blob_t (data, size));
|
79
|
+
pending_flags.push_back (sub.flags ());
|
76
80
|
}
|
77
|
-
|
78
81
|
sub.close ();
|
79
82
|
}
|
80
83
|
}
|
@@ -95,18 +98,18 @@ int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
|
|
95
98
|
errno = EINVAL;
|
96
99
|
return -1;
|
97
100
|
}
|
98
|
-
verbose = *static_cast <const int*> (optval_);
|
101
|
+
verbose = (*static_cast <const int*> (optval_) != 0);
|
99
102
|
return 0;
|
100
103
|
}
|
101
104
|
|
102
|
-
void zmq::xpub_t::
|
105
|
+
void zmq::xpub_t::xpipe_terminated (pipe_t *pipe_)
|
103
106
|
{
|
104
107
|
// Remove the pipe from the trie. If there are topics that nobody
|
105
108
|
// is interested in anymore, send corresponding unsubscriptions
|
106
109
|
// upstream.
|
107
110
|
subscriptions.rm (pipe_, send_unsubscription, this);
|
108
111
|
|
109
|
-
dist.
|
112
|
+
dist.pipe_terminated (pipe_);
|
110
113
|
}
|
111
114
|
|
112
115
|
void zmq::xpub_t::mark_as_matching (pipe_t *pipe_, void *arg_)
|
@@ -115,7 +118,7 @@ void zmq::xpub_t::mark_as_matching (pipe_t *pipe_, void *arg_)
|
|
115
118
|
self->dist.match (pipe_);
|
116
119
|
}
|
117
120
|
|
118
|
-
int zmq::xpub_t::xsend (msg_t *msg_
|
121
|
+
int zmq::xpub_t::xsend (msg_t *msg_)
|
119
122
|
{
|
120
123
|
bool msg_more = msg_->flags () & msg_t::more ? true : false;
|
121
124
|
|
@@ -126,7 +129,7 @@ int zmq::xpub_t::xsend (msg_t *msg_, int flags_)
|
|
126
129
|
|
127
130
|
// Send the message to all the pipes that were marked as matching
|
128
131
|
// in the previous step.
|
129
|
-
int rc = dist.send_to_matching (msg_
|
132
|
+
int rc = dist.send_to_matching (msg_);
|
130
133
|
if (rc != 0)
|
131
134
|
return rc;
|
132
135
|
|
@@ -145,30 +148,30 @@ bool zmq::xpub_t::xhas_out ()
|
|
145
148
|
return dist.has_out ();
|
146
149
|
}
|
147
150
|
|
148
|
-
int zmq::xpub_t::xrecv (msg_t *msg_
|
151
|
+
int zmq::xpub_t::xrecv (msg_t *msg_)
|
149
152
|
{
|
150
|
-
// flags_ is unused
|
151
|
-
(void)flags_;
|
152
|
-
|
153
153
|
// If there is at least one
|
154
|
-
if (
|
154
|
+
if (pending_data.empty ()) {
|
155
155
|
errno = EAGAIN;
|
156
156
|
return -1;
|
157
157
|
}
|
158
158
|
|
159
159
|
int rc = msg_->close ();
|
160
160
|
errno_assert (rc == 0);
|
161
|
-
rc = msg_->init_size (
|
161
|
+
rc = msg_->init_size (pending_data.front ().size ());
|
162
162
|
errno_assert (rc == 0);
|
163
|
-
memcpy (msg_->data (),
|
164
|
-
|
165
|
-
|
163
|
+
memcpy (msg_->data (),
|
164
|
+
pending_data.front ().data (),
|
165
|
+
pending_data.front ().size ());
|
166
|
+
msg_->set_flags (pending_flags.front ());
|
167
|
+
pending_data.pop_front ();
|
168
|
+
pending_flags.pop_front ();
|
166
169
|
return 0;
|
167
170
|
}
|
168
171
|
|
169
172
|
bool zmq::xpub_t::xhas_in ()
|
170
173
|
{
|
171
|
-
return !
|
174
|
+
return !pending_data.empty ();
|
172
175
|
}
|
173
176
|
|
174
177
|
void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
|
@@ -177,24 +180,12 @@ void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
|
|
177
180
|
xpub_t *self = (xpub_t*) arg_;
|
178
181
|
|
179
182
|
if (self->options.type != ZMQ_PUB) {
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
183
|
+
// Place the unsubscription to the queue of pending (un)sunscriptions
|
184
|
+
// to be retrived by the user later on.
|
185
|
+
blob_t unsub (size_ + 1, 0);
|
186
|
+
unsub [0] = 0;
|
187
|
+
memcpy (&unsub [1], data_, size_);
|
188
|
+
self->pending_data.push_back (unsub);
|
189
|
+
self->pending_flags.push_back (0);
|
187
190
|
}
|
188
191
|
}
|
189
|
-
|
190
|
-
zmq::xpub_session_t::xpub_session_t (io_thread_t *io_thread_, bool connect_,
|
191
|
-
socket_base_t *socket_, const options_t &options_,
|
192
|
-
const address_t *addr_) :
|
193
|
-
session_base_t (io_thread_, connect_, socket_, options_, addr_)
|
194
|
-
{
|
195
|
-
}
|
196
|
-
|
197
|
-
zmq::xpub_session_t::~xpub_session_t ()
|
198
|
-
{
|
199
|
-
}
|
200
|
-
|