rbczmq 1.6.2 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -3
- data/.gitmodules +6 -0
- data/.travis.yml +5 -1
- data/CHANGELOG.rdoc +15 -0
- data/Gemfile.lock +2 -2
- data/README.rdoc +5 -2
- data/Rakefile +8 -3
- data/ext/czmq/.gitignore +52 -0
- data/ext/czmq/.travis.yml +18 -0
- data/ext/czmq/AUTHORS +9 -0
- data/ext/czmq/COPYING +674 -0
- data/ext/czmq/COPYING.LESSER +178 -0
- data/ext/czmq/ChangeLog +0 -0
- data/ext/czmq/Makefile.am +22 -0
- data/ext/czmq/NEWS +263 -0
- data/ext/czmq/README +0 -0
- data/ext/czmq/README.md +1122 -0
- data/ext/czmq/README.txt +327 -0
- data/ext/czmq/autogen.sh +46 -0
- data/ext/czmq/builds/android/Android.mk +35 -0
- data/ext/czmq/builds/android/Application.mk +1 -0
- data/ext/czmq/builds/android/build.sh +59 -0
- data/ext/czmq/builds/android/clean.sh +26 -0
- data/ext/czmq/builds/mingw32/Makefile.mingw32 +38 -0
- data/ext/czmq/builds/mingw32/platform.h +0 -0
- data/ext/czmq/builds/msvc/.gitignore +18 -0
- data/ext/czmq/builds/msvc/README.txt +17 -0
- data/ext/czmq/builds/msvc/czmq.sln +69 -0
- data/ext/czmq/builds/msvc/czmq.vcproj +2246 -0
- data/ext/czmq/builds/msvc/czmq.vcxproj +329 -0
- data/ext/czmq/builds/msvc/czmq.vcxproj.filters +117 -0
- data/ext/czmq/builds/msvc/czmq11.sln +36 -0
- data/ext/czmq/builds/msvc/czmq_selftest.vcproj +840 -0
- data/ext/czmq/builds/msvc/czmq_selftest.vcxproj +189 -0
- data/ext/czmq/builds/msvc/czmq_selftest.vcxproj.filters +14 -0
- data/ext/czmq/c +520 -0
- data/ext/czmq/configure.ac +229 -0
- data/ext/czmq/doc/Makefile.am +49 -0
- data/ext/czmq/doc/asciidoc.conf +57 -0
- data/ext/czmq/doc/czmq.txt +334 -0
- data/ext/czmq/doc/mkman +100 -0
- data/ext/czmq/doc/mksite +65 -0
- data/ext/czmq/doc/wdput +43 -0
- data/ext/czmq/doc/xml2wd.pl +242 -0
- data/ext/czmq/doc/zbeacon.txt +173 -0
- data/ext/czmq/doc/zclock.txt +51 -0
- data/ext/czmq/doc/zconfig.txt +92 -0
- data/ext/czmq/doc/zctx.txt +111 -0
- data/ext/czmq/doc/zfile.txt +77 -0
- data/ext/czmq/doc/zframe.txt +222 -0
- data/ext/czmq/doc/zhash.txt +225 -0
- data/ext/czmq/doc/zlist.txt +176 -0
- data/ext/czmq/doc/zloop.txt +106 -0
- data/ext/czmq/doc/zmsg.txt +315 -0
- data/ext/czmq/doc/zmutex.txt +54 -0
- data/ext/czmq/doc/zsocket.txt +110 -0
- data/ext/czmq/doc/zsockopt.txt +528 -0
- data/ext/czmq/doc/zstr.txt +80 -0
- data/ext/czmq/doc/zsys.txt +44 -0
- data/ext/czmq/doc/zthread.txt +126 -0
- data/ext/czmq/doc/ztree.txt +236 -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 +64 -0
- data/ext/czmq/include/czmq_prelude.h +504 -0
- data/ext/czmq/include/zbeacon.h +91 -0
- data/ext/czmq/include/zclock.h +56 -0
- data/ext/czmq/include/zconfig.h +117 -0
- data/ext/czmq/include/zctx.h +96 -0
- data/ext/czmq/include/zfile.h +82 -0
- data/ext/czmq/include/zframe.h +145 -0
- data/ext/czmq/include/zhash.h +127 -0
- data/ext/czmq/include/zlist.h +113 -0
- data/ext/czmq/include/zloop.h +98 -0
- data/ext/czmq/include/zmsg.h +165 -0
- data/ext/czmq/include/zmutex.h +62 -0
- data/ext/czmq/include/zsocket.h +104 -0
- data/ext/czmq/include/zsockopt.h +249 -0
- data/ext/czmq/include/zstr.h +69 -0
- data/ext/czmq/include/zsys.h +66 -0
- data/ext/czmq/include/zthread.h +62 -0
- data/ext/czmq/include/ztree.h +133 -0
- data/ext/czmq/mkdoc +14 -0
- data/ext/czmq/model/generate +2 -0
- data/ext/czmq/model/sockopts.xml +101 -0
- data/ext/czmq/notes.txt +21 -0
- data/ext/czmq/scripts/sockopts.gsl +325 -0
- data/ext/czmq/src/Makefile.am +61 -0
- data/ext/czmq/src/czmq_selftest.c +60 -0
- data/ext/czmq/src/libczmq.pc.in +11 -0
- data/ext/czmq/src/selftest +7 -0
- data/ext/czmq/src/selftest.cfg +5 -0
- data/ext/czmq/src/valgrind.supp +14 -0
- data/ext/czmq/src/vg +2 -0
- data/ext/czmq/src/zbeacon.c +787 -0
- data/ext/czmq/src/zclock.c +143 -0
- data/ext/czmq/src/zconfig.c +691 -0
- data/ext/czmq/src/zctx.c +287 -0
- data/ext/czmq/src/zfile.c +237 -0
- data/ext/czmq/src/zframe.c +551 -0
- data/ext/czmq/src/zhash.c +664 -0
- data/ext/czmq/src/zlist.c +459 -0
- data/ext/czmq/src/zloop.c +496 -0
- data/ext/czmq/src/zmsg.c +854 -0
- data/ext/czmq/src/zmutex.c +134 -0
- data/ext/czmq/src/zsocket.c +313 -0
- data/ext/czmq/src/zsockopt.c +1756 -0
- data/ext/czmq/src/zstr.c +297 -0
- data/ext/czmq/src/zsys.c +136 -0
- data/ext/czmq/src/zthread.c +269 -0
- data/ext/czmq/src/ztree.c +888 -0
- data/ext/czmq/version.sh +21 -0
- data/ext/rbczmq/extconf.rb +1 -18
- data/ext/rbczmq/poller.c +4 -1
- data/ext/rbczmq/socket.c +28 -5
- data/ext/rbczmq/socket.h +1 -0
- data/ext/zeromq/AUTHORS +110 -0
- data/ext/zeromq/CMakeLists.txt +392 -0
- data/ext/zeromq/COPYING +674 -0
- data/ext/zeromq/COPYING.LESSER +179 -0
- data/ext/zeromq/INSTALL +246 -0
- data/ext/zeromq/MAINTAINERS +56 -0
- data/ext/zeromq/Makefile.am +40 -0
- data/ext/zeromq/NEWS +333 -0
- data/ext/zeromq/README +39 -0
- data/ext/zeromq/acinclude.m4 +930 -0
- data/ext/zeromq/autogen.sh +45 -0
- data/ext/zeromq/branding.bmp +0 -0
- data/ext/zeromq/builds/msvc/Makefile.am +33 -0
- data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat.vcproj +176 -0
- data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat.vcxproj +87 -0
- data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcproj +176 -0
- data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcxproj +87 -0
- data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat.vcproj +176 -0
- data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat.vcxproj +87 -0
- data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcproj +176 -0
- data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcxproj +87 -0
- data/ext/zeromq/builds/msvc/errno.cpp +32 -0
- data/ext/zeromq/builds/msvc/errno.hpp +56 -0
- data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcproj +174 -0
- data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcxproj +86 -0
- data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcproj +174 -0
- data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcxproj +86 -0
- data/ext/zeromq/builds/msvc/libzmq/libzmq.vcproj +804 -0
- data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj +252 -0
- data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj.filters +431 -0
- data/ext/zeromq/builds/msvc/msvc.sln +89 -0
- data/ext/zeromq/builds/msvc/msvc10.sln +116 -0
- data/ext/zeromq/builds/msvc/platform.hpp +32 -0
- data/ext/zeromq/builds/msvc/properties/Common.props +21 -0
- data/ext/zeromq/builds/msvc/properties/Debug.props +19 -0
- data/ext/zeromq/builds/msvc/properties/Dynamic.props +20 -0
- data/ext/zeromq/builds/msvc/properties/Executable.props +19 -0
- data/ext/zeromq/builds/msvc/properties/Precompiled.props +14 -0
- data/ext/zeromq/builds/msvc/properties/Release.props +22 -0
- data/ext/zeromq/builds/msvc/properties/Win32.props +12 -0
- data/ext/zeromq/builds/msvc/properties/Win32_Release.props +17 -0
- data/ext/zeromq/builds/msvc/properties/WithOpenPGM.props +12 -0
- data/ext/zeromq/builds/msvc/properties/ZeroMQ.props +23 -0
- data/ext/zeromq/builds/msvc/properties/x64.props +12 -0
- data/ext/zeromq/builds/redhat/zeromq.spec.in +160 -0
- data/ext/zeromq/builds/valgrind/valgrind.supp +14 -0
- data/ext/zeromq/builds/valgrind/vg +1 -0
- data/ext/zeromq/cmake/Modules/TestZMQVersion.cmake +35 -0
- data/ext/zeromq/cmake/Modules/zmq_version.cpp +31 -0
- data/ext/zeromq/cmake/NSIS.template32.in +952 -0
- data/ext/zeromq/cmake/NSIS.template64.in +960 -0
- data/ext/zeromq/configure.in +428 -0
- data/ext/zeromq/doc/Makefile.am +51 -0
- data/ext/zeromq/doc/asciidoc.conf +56 -0
- data/ext/zeromq/doc/zmq.txt +233 -0
- data/ext/zeromq/doc/zmq_bind.txt +102 -0
- data/ext/zeromq/doc/zmq_close.txt +52 -0
- data/ext/zeromq/doc/zmq_connect.txt +98 -0
- data/ext/zeromq/doc/zmq_ctx_destroy.txt +66 -0
- data/ext/zeromq/doc/zmq_ctx_get.txt +67 -0
- data/ext/zeromq/doc/zmq_ctx_new.txt +49 -0
- data/ext/zeromq/doc/zmq_ctx_set.txt +75 -0
- data/ext/zeromq/doc/zmq_disconnect.txt +67 -0
- data/ext/zeromq/doc/zmq_epgm.txt +162 -0
- data/ext/zeromq/doc/zmq_errno.txt +50 -0
- data/ext/zeromq/doc/zmq_getsockopt.txt +516 -0
- data/ext/zeromq/doc/zmq_init.txt +52 -0
- data/ext/zeromq/doc/zmq_inproc.txt +85 -0
- data/ext/zeromq/doc/zmq_ipc.txt +85 -0
- data/ext/zeromq/doc/zmq_msg_close.txt +55 -0
- data/ext/zeromq/doc/zmq_msg_copy.txt +57 -0
- data/ext/zeromq/doc/zmq_msg_data.txt +48 -0
- data/ext/zeromq/doc/zmq_msg_get.txt +72 -0
- data/ext/zeromq/doc/zmq_msg_init.txt +65 -0
- data/ext/zeromq/doc/zmq_msg_init_data.txt +85 -0
- data/ext/zeromq/doc/zmq_msg_init_size.txt +58 -0
- data/ext/zeromq/doc/zmq_msg_more.txt +63 -0
- data/ext/zeromq/doc/zmq_msg_move.txt +52 -0
- data/ext/zeromq/doc/zmq_msg_recv.txt +125 -0
- data/ext/zeromq/doc/zmq_msg_send.txt +122 -0
- data/ext/zeromq/doc/zmq_msg_set.txt +45 -0
- data/ext/zeromq/doc/zmq_msg_size.txt +48 -0
- data/ext/zeromq/doc/zmq_pgm.txt +162 -0
- data/ext/zeromq/doc/zmq_poll.txt +132 -0
- data/ext/zeromq/doc/zmq_proxy.txt +97 -0
- data/ext/zeromq/doc/zmq_recv.txt +93 -0
- data/ext/zeromq/doc/zmq_recvmsg.txt +123 -0
- data/ext/zeromq/doc/zmq_send.txt +100 -0
- data/ext/zeromq/doc/zmq_sendmsg.txt +119 -0
- data/ext/zeromq/doc/zmq_setsockopt.txt +523 -0
- data/ext/zeromq/doc/zmq_socket.txt +369 -0
- data/ext/zeromq/doc/zmq_socket_monitor.txt +288 -0
- data/ext/zeromq/doc/zmq_strerror.txt +55 -0
- data/ext/zeromq/doc/zmq_tcp.txt +101 -0
- data/ext/zeromq/doc/zmq_term.txt +66 -0
- data/ext/zeromq/doc/zmq_unbind.txt +65 -0
- data/ext/zeromq/doc/zmq_version.txt +53 -0
- data/ext/zeromq/foreign/openpgm/Makefile.am +8 -0
- data/ext/zeromq/foreign/openpgm/libpgm-5.1.118~dfsg.tar.gz +0 -0
- data/ext/zeromq/include/zmq.h +402 -0
- data/ext/zeromq/include/zmq_utils.h +64 -0
- data/ext/zeromq/installer.ico +0 -0
- data/ext/zeromq/perf/Makefile.am +22 -0
- data/ext/zeromq/perf/inproc_lat.cpp +233 -0
- data/ext/zeromq/perf/inproc_thr.cpp +241 -0
- data/ext/zeromq/perf/local_lat.cpp +109 -0
- data/ext/zeromq/perf/local_thr.cpp +133 -0
- data/ext/zeromq/perf/remote_lat.cpp +122 -0
- data/ext/zeromq/perf/remote_thr.cpp +105 -0
- data/ext/zeromq/src/Makefile.am +171 -0
- data/ext/zeromq/src/address.cpp +78 -0
- data/ext/zeromq/src/address.hpp +52 -0
- data/ext/zeromq/src/array.hpp +155 -0
- data/ext/zeromq/src/atomic_counter.hpp +197 -0
- data/ext/zeromq/src/atomic_ptr.hpp +196 -0
- data/ext/zeromq/src/blob.hpp +129 -0
- data/ext/zeromq/src/clock.cpp +147 -0
- data/ext/zeromq/src/clock.hpp +60 -0
- data/ext/zeromq/src/command.hpp +154 -0
- data/ext/zeromq/src/config.hpp +89 -0
- data/ext/zeromq/src/ctx.cpp +352 -0
- data/ext/zeromq/src/ctx.hpp +173 -0
- data/ext/zeromq/src/dealer.cpp +133 -0
- data/ext/zeromq/src/dealer.hpp +92 -0
- data/ext/zeromq/src/decoder.cpp +166 -0
- data/ext/zeromq/src/decoder.hpp +248 -0
- data/ext/zeromq/src/devpoll.cpp +190 -0
- data/ext/zeromq/src/devpoll.hpp +105 -0
- data/ext/zeromq/src/dist.cpp +194 -0
- data/ext/zeromq/src/dist.hpp +105 -0
- data/ext/zeromq/src/encoder.cpp +102 -0
- data/ext/zeromq/src/encoder.hpp +200 -0
- data/ext/zeromq/src/epoll.cpp +178 -0
- data/ext/zeromq/src/epoll.hpp +101 -0
- data/ext/zeromq/src/err.cpp +291 -0
- data/ext/zeromq/src/err.hpp +155 -0
- data/ext/zeromq/src/fd.hpp +45 -0
- data/ext/zeromq/src/fq.cpp +141 -0
- data/ext/zeromq/src/fq.hpp +74 -0
- data/ext/zeromq/src/i_decoder.hpp +49 -0
- data/ext/zeromq/src/i_encoder.hpp +55 -0
- data/ext/zeromq/src/i_engine.hpp +55 -0
- data/ext/zeromq/src/i_msg_sink.hpp +43 -0
- data/ext/zeromq/src/i_msg_source.hpp +44 -0
- data/ext/zeromq/src/i_poll_events.hpp +47 -0
- data/ext/zeromq/src/io_object.cpp +108 -0
- data/ext/zeromq/src/io_object.hpp +81 -0
- data/ext/zeromq/src/io_thread.cpp +104 -0
- data/ext/zeromq/src/io_thread.hpp +91 -0
- data/ext/zeromq/src/ip.cpp +109 -0
- data/ext/zeromq/src/ip.hpp +41 -0
- data/ext/zeromq/src/ipc_address.cpp +84 -0
- data/ext/zeromq/src/ipc_address.hpp +67 -0
- data/ext/zeromq/src/ipc_connecter.cpp +265 -0
- data/ext/zeromq/src/ipc_connecter.hpp +128 -0
- data/ext/zeromq/src/ipc_listener.cpp +206 -0
- data/ext/zeromq/src/ipc_listener.hpp +99 -0
- data/ext/zeromq/src/kqueue.cpp +201 -0
- data/ext/zeromq/src/kqueue.hpp +107 -0
- data/ext/zeromq/src/lb.cpp +148 -0
- data/ext/zeromq/src/lb.hpp +73 -0
- data/ext/zeromq/src/libzmq.pc.in +10 -0
- data/ext/zeromq/src/likely.hpp +33 -0
- data/ext/zeromq/src/mailbox.cpp +87 -0
- data/ext/zeromq/src/mailbox.hpp +75 -0
- data/ext/zeromq/src/msg.cpp +299 -0
- data/ext/zeromq/src/msg.hpp +148 -0
- data/ext/zeromq/src/mtrie.cpp +428 -0
- data/ext/zeromq/src/mtrie.hpp +93 -0
- data/ext/zeromq/src/mutex.hpp +118 -0
- data/ext/zeromq/src/object.cpp +393 -0
- data/ext/zeromq/src/object.hpp +134 -0
- data/ext/zeromq/src/options.cpp +562 -0
- data/ext/zeromq/src/options.hpp +135 -0
- data/ext/zeromq/src/own.cpp +206 -0
- data/ext/zeromq/src/own.hpp +145 -0
- data/ext/zeromq/src/pair.cpp +136 -0
- data/ext/zeromq/src/pair.hpp +79 -0
- data/ext/zeromq/src/pgm_receiver.cpp +283 -0
- data/ext/zeromq/src/pgm_receiver.hpp +141 -0
- data/ext/zeromq/src/pgm_sender.cpp +218 -0
- data/ext/zeromq/src/pgm_sender.hpp +113 -0
- data/ext/zeromq/src/pgm_socket.cpp +706 -0
- data/ext/zeromq/src/pgm_socket.hpp +124 -0
- data/ext/zeromq/src/pipe.cpp +447 -0
- data/ext/zeromq/src/pipe.hpp +207 -0
- data/ext/zeromq/src/poll.cpp +176 -0
- data/ext/zeromq/src/poll.hpp +105 -0
- data/ext/zeromq/src/poller.hpp +82 -0
- data/ext/zeromq/src/poller_base.cpp +99 -0
- data/ext/zeromq/src/poller_base.hpp +86 -0
- data/ext/zeromq/src/precompiled.cpp +21 -0
- data/ext/zeromq/src/precompiled.hpp +47 -0
- data/ext/zeromq/src/proxy.cpp +150 -0
- data/ext/zeromq/src/proxy.hpp +32 -0
- data/ext/zeromq/src/pub.cpp +57 -0
- data/ext/zeromq/src/pub.hpp +69 -0
- data/ext/zeromq/src/pull.cpp +79 -0
- data/ext/zeromq/src/pull.hpp +81 -0
- data/ext/zeromq/src/push.cpp +76 -0
- data/ext/zeromq/src/push.hpp +80 -0
- data/ext/zeromq/src/random.cpp +52 -0
- data/ext/zeromq/src/random.hpp +37 -0
- data/ext/zeromq/src/reaper.cpp +117 -0
- data/ext/zeromq/src/reaper.hpp +80 -0
- data/ext/zeromq/src/rep.cpp +137 -0
- data/ext/zeromq/src/rep.hpp +80 -0
- data/ext/zeromq/src/req.cpp +185 -0
- data/ext/zeromq/src/req.hpp +91 -0
- data/ext/zeromq/src/router.cpp +364 -0
- data/ext/zeromq/src/router.hpp +138 -0
- data/ext/zeromq/src/select.cpp +216 -0
- data/ext/zeromq/src/select.hpp +126 -0
- data/ext/zeromq/src/session_base.cpp +503 -0
- data/ext/zeromq/src/session_base.hpp +156 -0
- data/ext/zeromq/src/signaler.cpp +406 -0
- data/ext/zeromq/src/signaler.hpp +63 -0
- data/ext/zeromq/src/socket_base.cpp +1236 -0
- data/ext/zeromq/src/socket_base.hpp +255 -0
- data/ext/zeromq/src/stdint.hpp +63 -0
- data/ext/zeromq/src/stream_engine.cpp +594 -0
- data/ext/zeromq/src/stream_engine.hpp +149 -0
- data/ext/zeromq/src/sub.cpp +93 -0
- data/ext/zeromq/src/sub.hpp +71 -0
- data/ext/zeromq/src/tcp.cpp +131 -0
- data/ext/zeromq/src/tcp.hpp +38 -0
- data/ext/zeromq/src/tcp_address.cpp +613 -0
- data/ext/zeromq/src/tcp_address.hpp +100 -0
- data/ext/zeromq/src/tcp_connecter.cpp +319 -0
- data/ext/zeromq/src/tcp_connecter.hpp +123 -0
- data/ext/zeromq/src/tcp_listener.cpp +293 -0
- data/ext/zeromq/src/tcp_listener.hpp +91 -0
- data/ext/zeromq/src/thread.cpp +107 -0
- data/ext/zeromq/src/thread.hpp +79 -0
- data/ext/zeromq/src/trie.cpp +337 -0
- data/ext/zeromq/src/trie.hpp +79 -0
- data/ext/zeromq/src/v1_decoder.cpp +162 -0
- data/ext/zeromq/src/v1_decoder.hpp +68 -0
- data/ext/zeromq/src/v1_encoder.cpp +103 -0
- data/ext/zeromq/src/v1_encoder.hpp +60 -0
- data/ext/zeromq/src/v1_protocol.hpp +43 -0
- data/ext/zeromq/src/version.rc.in +93 -0
- data/ext/zeromq/src/windows.hpp +181 -0
- data/ext/zeromq/src/wire.hpp +99 -0
- data/ext/zeromq/src/xpub.cpp +200 -0
- data/ext/zeromq/src/xpub.hpp +110 -0
- data/ext/zeromq/src/xsub.cpp +242 -0
- data/ext/zeromq/src/xsub.hpp +108 -0
- data/ext/zeromq/src/ypipe.hpp +210 -0
- data/ext/zeromq/src/yqueue.hpp +199 -0
- data/ext/zeromq/src/zmq.cpp +1058 -0
- data/ext/zeromq/src/zmq_utils.cpp +61 -0
- data/ext/zeromq/tests/Makefile.am +55 -0
- data/ext/zeromq/tests/test_connect_delay.cpp +260 -0
- data/ext/zeromq/tests/test_connect_resolve.cpp +54 -0
- data/ext/zeromq/tests/test_disconnect_inproc.cpp +120 -0
- data/ext/zeromq/tests/test_hwm.cpp +83 -0
- data/ext/zeromq/tests/test_invalid_rep.cpp +92 -0
- data/ext/zeromq/tests/test_last_endpoint.cpp +60 -0
- data/ext/zeromq/tests/test_monitor.cpp +289 -0
- data/ext/zeromq/tests/test_msg_flags.cpp +78 -0
- data/ext/zeromq/tests/test_pair_inproc.cpp +53 -0
- data/ext/zeromq/tests/test_pair_ipc.cpp +53 -0
- data/ext/zeromq/tests/test_pair_tcp.cpp +54 -0
- data/ext/zeromq/tests/test_reqrep_device.cpp +143 -0
- data/ext/zeromq/tests/test_reqrep_inproc.cpp +53 -0
- data/ext/zeromq/tests/test_reqrep_ipc.cpp +53 -0
- data/ext/zeromq/tests/test_reqrep_tcp.cpp +54 -0
- data/ext/zeromq/tests/test_router_mandatory.cpp +62 -0
- data/ext/zeromq/tests/test_shutdown_stress.cpp +93 -0
- data/ext/zeromq/tests/test_sub_forward.cpp +99 -0
- data/ext/zeromq/tests/test_term_endpoint.cpp +118 -0
- data/ext/zeromq/tests/test_timeo.cpp +119 -0
- data/ext/zeromq/tests/testutil.hpp +77 -0
- data/ext/zeromq/version.sh +21 -0
- data/lib/zmq/version.rb +1 -1
- data/rbczmq.gemspec +16 -3
- data/test/test_socket.rb +13 -1
- metadata +398 -9
- checksums.yaml +0 -15
- data/ext/czmq-1.4.1.tar.gz +0 -0
- data/ext/zeromq-3.2.3.tar.gz +0 -0
@@ -0,0 +1,229 @@
|
|
1
|
+
# -*- Autoconf -*-
|
2
|
+
# Process this file with autoconf to produce a configure script.
|
3
|
+
AC_PREREQ(2.61)
|
4
|
+
#
|
5
|
+
# The version number is extracted from include/czmq.h using
|
6
|
+
# the version.sh script. Hence, it should be updated there.
|
7
|
+
# The version in git should reflect the *next* version planned.
|
8
|
+
#
|
9
|
+
AC_INIT([czmq],[m4_esyscmd([./version.sh czmq])],[zeromq-dev@lists.zeromq.org])
|
10
|
+
|
11
|
+
AC_CONFIG_AUX_DIR(config)
|
12
|
+
AC_CONFIG_MACRO_DIR(config)
|
13
|
+
AC_CONFIG_HEADERS([src/platform.h])
|
14
|
+
AM_INIT_AUTOMAKE(tar-ustar)
|
15
|
+
|
16
|
+
# This defines PACKAGE_VERSION_... in src/platform.h
|
17
|
+
PV_MAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
|
18
|
+
PV_MINOR=`echo $PACKAGE_VERSION | cut -d . -f 2`
|
19
|
+
PV_PATCH=`echo $PACKAGE_VERSION | cut -d . -f 3`
|
20
|
+
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],[$PV_MAJOR],
|
21
|
+
[CZMQ major version])
|
22
|
+
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],[$PV_MINOR],
|
23
|
+
[CZMQ minor version])
|
24
|
+
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCH],[$PV_PATCH],
|
25
|
+
[CZMQ patchlevel])
|
26
|
+
# This lets us use PACKAGE_VERSION in Makefiles
|
27
|
+
AC_SUBST(PACKAGE_VERSION)
|
28
|
+
|
29
|
+
#
|
30
|
+
# Libtool -version-info (ABI version)
|
31
|
+
#
|
32
|
+
# Currently 1.0.0 ("stable"). Don't change this unless you
|
33
|
+
# know exactly what you're doing and have read and understand
|
34
|
+
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
35
|
+
#
|
36
|
+
# libczmq -version-info
|
37
|
+
LTVER="1:0:0"
|
38
|
+
AC_SUBST(LTVER)
|
39
|
+
|
40
|
+
# Capture c flags
|
41
|
+
CZMQ_ORIG_CFLAGS="${CFLAGS:-none}"
|
42
|
+
|
43
|
+
# Checks for programs
|
44
|
+
AC_PROG_CC
|
45
|
+
AC_PROG_CC_C99
|
46
|
+
AM_PROG_CC_C_O
|
47
|
+
AC_LIBTOOL_WIN32_DLL
|
48
|
+
AC_PROG_LIBTOOL
|
49
|
+
AC_PROG_SED
|
50
|
+
AC_PROG_AWK
|
51
|
+
|
52
|
+
# Checks for libraries
|
53
|
+
AC_CHECK_LIB([pthread], [pthread_create])
|
54
|
+
|
55
|
+
# Code coverage
|
56
|
+
AC_ARG_WITH(gcov, [AS_HELP_STRING([--with-gcov=yes/no],
|
57
|
+
[With GCC Code Coverage reporting.])],
|
58
|
+
[CZMQ_GCOV="$withval"])
|
59
|
+
|
60
|
+
if test "x${CZMQ_GCOV}" == "xyes"; then
|
61
|
+
CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
|
62
|
+
|
63
|
+
if test "x${CZMQ_ORIG_CFLAGS}" != "xnone"; then
|
64
|
+
CFLAGS="${CFLAGS} ${CZMQ_ORIG_CFLAGS}"
|
65
|
+
fi
|
66
|
+
fi
|
67
|
+
|
68
|
+
# libzmq integration
|
69
|
+
AC_ARG_WITH([libzmq],
|
70
|
+
[AS_HELP_STRING([--with-libzmq],
|
71
|
+
[Specify libzmq prefix])],
|
72
|
+
[czmq_search_libzmq="yes"],
|
73
|
+
[])
|
74
|
+
|
75
|
+
if test "x$czmq_search_libzmq" = "xyes"; then
|
76
|
+
if test -r "${with_libzmq}/include/zmq.h"; then
|
77
|
+
CFLAGS="-I${with_libzmq}/include ${CFLAGS}"
|
78
|
+
LDFLAGS="-L${with_libzmq}/lib ${LDFLAGS}"
|
79
|
+
else
|
80
|
+
AC_MSG_ERROR([${with_libzmq}/include/zmq.h not found. Please check libzmq prefix])
|
81
|
+
fi
|
82
|
+
fi
|
83
|
+
|
84
|
+
AC_CHECK_LIB(zmq, zmq_init, ,[AC_MSG_ERROR([cannot link with -lzmq, install libzmq.])])
|
85
|
+
|
86
|
+
AC_MSG_CHECKING([whether libzmq installation works])
|
87
|
+
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <zmq.h>],
|
88
|
+
[zmq_init(1);])
|
89
|
+
],
|
90
|
+
[AC_MSG_RESULT([yes])],
|
91
|
+
[AC_MSG_ERROR([no. Please specify libzmq installation prefix using --with-libzmq])])
|
92
|
+
|
93
|
+
# Platform specific checks
|
94
|
+
czmq_on_mingw32="no"
|
95
|
+
czmq_on_android="no"
|
96
|
+
|
97
|
+
# Host speciffic checks
|
98
|
+
AC_CANONICAL_HOST
|
99
|
+
|
100
|
+
# Determine whether or not documentation should be built and installed.
|
101
|
+
czmq_build_doc="yes"
|
102
|
+
czmq_install_man="yes"
|
103
|
+
|
104
|
+
# Check for asciidoc and xmlto and don't build the docs if these are not installed.
|
105
|
+
AC_CHECK_PROG(czmq_have_asciidoc, asciidoc, yes, no)
|
106
|
+
AC_CHECK_PROG(czmq_have_xmlto, xmlto, yes, no)
|
107
|
+
if test "x$czmq_have_asciidoc" = "xno" -o "x$czmq_have_xmlto" = "xno"; then
|
108
|
+
czmq_build_doc="no"
|
109
|
+
# Tarballs built with 'make dist' ship with prebuilt documentation.
|
110
|
+
if ! test -f doc/czmq.7; then
|
111
|
+
czmq_install_man="no"
|
112
|
+
AC_MSG_WARN([You are building an unreleased version of libczmq and asciidoc or xmlto are not installed.])
|
113
|
+
AC_MSG_WARN([Documentation will not be built and manual pages will not be installed.])
|
114
|
+
fi
|
115
|
+
fi
|
116
|
+
AC_MSG_CHECKING([whether to build documentation])
|
117
|
+
AC_MSG_RESULT([$czmq_build_doc])
|
118
|
+
AC_MSG_CHECKING([whether to install manpages])
|
119
|
+
AC_MSG_RESULT([$czmq_install_man])
|
120
|
+
|
121
|
+
# Set some default features required by libczmq code.
|
122
|
+
CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
|
123
|
+
|
124
|
+
# OS-specific tests
|
125
|
+
case "${host_os}" in
|
126
|
+
*linux*)
|
127
|
+
# Define on Linux to enable all library features
|
128
|
+
CPPFLAGS="-D_GNU_SOURCE -DLINUX $CPPFLAGS"
|
129
|
+
AC_DEFINE(CZMQ_HAVE_LINUX, 1, [Have Linux OS])
|
130
|
+
|
131
|
+
case "${host_os}" in
|
132
|
+
*android*)
|
133
|
+
AC_DEFINE(CZMQ_HAVE_ANDROID, 1, [Have Android OS])
|
134
|
+
czmq_on_android="yes"
|
135
|
+
;;
|
136
|
+
esac
|
137
|
+
;;
|
138
|
+
*solaris*)
|
139
|
+
# Define on Solaris to enable all library features
|
140
|
+
CPPFLAGS="-D_PTHREADS $CPPFLAGS"
|
141
|
+
AC_DEFINE(CZMQ_HAVE_SOLARIS, 1, [Have Solaris OS])
|
142
|
+
CFLAGS="${CFLAGS} -lsocket"
|
143
|
+
;;
|
144
|
+
*freebsd*)
|
145
|
+
# Define on FreeBSD to enable all library features
|
146
|
+
CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS"
|
147
|
+
AC_DEFINE(CZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS])
|
148
|
+
;;
|
149
|
+
*darwin*)
|
150
|
+
# Define on Darwin to enable all library features
|
151
|
+
CPPFLAGS="-D_DARWIN_C_SOURCE $CPPFLAGS"
|
152
|
+
AC_DEFINE(CZMQ_HAVE_OSX, 1, [Have DarwinOSX OS])
|
153
|
+
;;
|
154
|
+
*netbsd*)
|
155
|
+
# Define on NetBSD to enable all library features
|
156
|
+
CPPFLAGS="-D_NETBSD_SOURCE $CPPFLAGS"
|
157
|
+
AC_DEFINE(CZMQ_HAVE_NETBSD, 1, [Have NetBSD OS])
|
158
|
+
;;
|
159
|
+
*openbsd*)
|
160
|
+
# Define on OpenBSD to enable all library features
|
161
|
+
CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS"
|
162
|
+
AC_DEFINE(CZMQ_HAVE_OPENBSD, 1, [Have OpenBSD OS])
|
163
|
+
;;
|
164
|
+
*nto-qnx*)
|
165
|
+
AC_DEFINE(CZMQ_HAVE_QNXNTO, 1, [Have QNX Neutrino OS])
|
166
|
+
;;
|
167
|
+
*aix*)
|
168
|
+
AC_DEFINE(CZMQ_HAVE_AIX, 1, [Have AIX OS])
|
169
|
+
;;
|
170
|
+
*hpux*)
|
171
|
+
# Define on HP-UX to enable all library features
|
172
|
+
CPPFLAGS="-D_POSIX_C_SOURCE=200112L"
|
173
|
+
AC_DEFINE(CZMQ_HAVE_HPUX, 1, [Have HPUX OS])
|
174
|
+
;;
|
175
|
+
*mingw32*)
|
176
|
+
AC_DEFINE(CZMQ_HAVE_WINDOWS, 1, [Have Windows OS])
|
177
|
+
AC_DEFINE(CZMQ_HAVE_MINGW32, 1, [Have MinGW32])
|
178
|
+
AC_CHECK_HEADERS(windows.h)
|
179
|
+
czmq_on_mingw32="yes"
|
180
|
+
czmq_install_man="no"
|
181
|
+
;;
|
182
|
+
*cygwin*)
|
183
|
+
# Define on Cygwin to enable all library features
|
184
|
+
CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
|
185
|
+
AC_DEFINE(CZMQ_HAVE_CYGWIN, 1, [Have Cygwin])
|
186
|
+
;;
|
187
|
+
*)
|
188
|
+
AC_MSG_ERROR([unsupported system: ${host_os}.])
|
189
|
+
;;
|
190
|
+
esac
|
191
|
+
|
192
|
+
# Checks for header files.
|
193
|
+
AC_HEADER_STDC
|
194
|
+
AC_CHECK_HEADERS(errno.h arpa/inet.h netinet/tcp.h netinet/in.h stddef.h \
|
195
|
+
stdlib.h string.h sys/socket.h sys/time.h unistd.h limits.h ifaddrs.h)
|
196
|
+
AC_CHECK_HEADERS([net/if.h net/if_media.h linux/wireless.h], [], [],
|
197
|
+
[
|
198
|
+
#ifdef HAVE_SYS_SOCKET_H
|
199
|
+
# include <sys/socket.h>
|
200
|
+
#endif
|
201
|
+
])
|
202
|
+
|
203
|
+
# Checks for typedefs, structures, and compiler characteristics.
|
204
|
+
AC_HEADER_STDBOOL
|
205
|
+
AC_C_CONST
|
206
|
+
AC_C_INLINE
|
207
|
+
AC_TYPE_SIZE_T
|
208
|
+
AC_TYPE_SSIZE_T
|
209
|
+
AC_HEADER_TIME
|
210
|
+
AC_TYPE_UINT32_T
|
211
|
+
AC_C_VOLATILE
|
212
|
+
|
213
|
+
# These options are GNU compiler specific.
|
214
|
+
if test "x$GCC" = "xyes"; then
|
215
|
+
CPPFLAGS="-pedantic -Werror -Wall ${CPPFLAGS}"
|
216
|
+
fi
|
217
|
+
|
218
|
+
AM_CONDITIONAL(ON_MINGW, test "x$czmq_on_mingw32" = "xyes")
|
219
|
+
AM_CONDITIONAL(ON_ANDROID, test "x$czmq_on_android" = "xyes")
|
220
|
+
AM_CONDITIONAL(INSTALL_MAN, test "x$czmq_install_man" = "xyes")
|
221
|
+
AM_CONDITIONAL(BUILD_DOC, test "x$czmq_build_doc" = "xyes")
|
222
|
+
|
223
|
+
# Checks for library functions.
|
224
|
+
AC_TYPE_SIGNAL
|
225
|
+
AC_CHECK_FUNCS(perror gettimeofday memset getifaddrs freeifaddrs)
|
226
|
+
|
227
|
+
# Specify output files
|
228
|
+
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile src/libczmq.pc])
|
229
|
+
AC_OUTPUT
|
@@ -0,0 +1,49 @@
|
|
1
|
+
MAN1 =
|
2
|
+
MAN3 = zbeacon.3 \
|
3
|
+
zclock.3 \
|
4
|
+
zconfig.3 \
|
5
|
+
zctx.3 \
|
6
|
+
zfile.3 \
|
7
|
+
zframe.3 \
|
8
|
+
zhash.3 \
|
9
|
+
zlist.3 \
|
10
|
+
zloop.3 \
|
11
|
+
zmsg.3 \
|
12
|
+
zmutex.3 \
|
13
|
+
zsocket.3 \
|
14
|
+
zsockopt.3 \
|
15
|
+
zstr.3 \
|
16
|
+
zsys.3 \
|
17
|
+
zthread.3 \
|
18
|
+
ztree.3
|
19
|
+
MAN7 = czmq.7
|
20
|
+
MAN_DOC = $(MAN1) $(MAN3) $(MAN7)
|
21
|
+
|
22
|
+
MAN_TXT = $(MAN1:%.1=%.txt)
|
23
|
+
MAN_TXT += $(MAN3:%.3=%.txt)
|
24
|
+
MAN_TXT += $(MAN7:%.7=%.txt)
|
25
|
+
|
26
|
+
if INSTALL_MAN
|
27
|
+
dist_man_MANS = $(MAN_DOC)
|
28
|
+
endif
|
29
|
+
|
30
|
+
EXTRA_DIST = asciidoc.conf mkman $(MAN_TXT)
|
31
|
+
|
32
|
+
MAINTAINERCLEANFILES = $(MAN_DOC)
|
33
|
+
|
34
|
+
dist-hook : $(MAN_DOC)
|
35
|
+
|
36
|
+
if BUILD_DOC
|
37
|
+
SUFFIXES=.txt .xml .1 .3 .7
|
38
|
+
|
39
|
+
.txt.xml:
|
40
|
+
$(srcdir)/mkman $<
|
41
|
+
asciidoc -d manpage -b docbook -f $(srcdir)/asciidoc.conf \
|
42
|
+
-aczmq_version=@PACKAGE_VERSION@ -o$@ $<
|
43
|
+
.xml.1:
|
44
|
+
xmlto man $<
|
45
|
+
.xml.3:
|
46
|
+
xmlto man $<
|
47
|
+
.xml.7:
|
48
|
+
xmlto man $<
|
49
|
+
endif
|
@@ -0,0 +1,57 @@
|
|
1
|
+
[paradef-default]
|
2
|
+
literal-style=template="literalparagraph"
|
3
|
+
|
4
|
+
[macros]
|
5
|
+
(?su)[\\]?(?P<name>linkczmq):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
|
6
|
+
|
7
|
+
ifdef::backend-docbook[]
|
8
|
+
[linkczmq-inlinemacro]
|
9
|
+
{0%{target}}
|
10
|
+
{0#<citerefentry>}
|
11
|
+
{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
|
12
|
+
{0#</citerefentry>}
|
13
|
+
endif::backend-docbook[]
|
14
|
+
|
15
|
+
ifdef::backend-xhtml11[]
|
16
|
+
[linkczmq-inlinemacro]
|
17
|
+
<a href="{target}.html">{target}{0?({0})}</a>
|
18
|
+
endif::backend-xhtml11[]
|
19
|
+
|
20
|
+
ifdef::doctype-manpage[]
|
21
|
+
ifdef::backend-docbook[]
|
22
|
+
[header]
|
23
|
+
template::[header-declarations]
|
24
|
+
<refentry>
|
25
|
+
<refmeta>
|
26
|
+
<refentrytitle>{mantitle}</refentrytitle>
|
27
|
+
<manvolnum>{manvolnum}</manvolnum>
|
28
|
+
<refmiscinfo class="source">CZMQ</refmiscinfo>
|
29
|
+
<refmiscinfo class="version">{czmq_version}</refmiscinfo>
|
30
|
+
<refmiscinfo class="manual">CZMQ Manual</refmiscinfo>
|
31
|
+
</refmeta>
|
32
|
+
<refnamediv>
|
33
|
+
<refname>{manname}</refname>
|
34
|
+
<refpurpose>{manpurpose}</refpurpose>
|
35
|
+
</refnamediv>
|
36
|
+
[footer]
|
37
|
+
<refsect1 id="_authors">
|
38
|
+
<title>AUTHORS</title>
|
39
|
+
<simpara>The CZMQ manual was written by Pieter Hintjens<<ulink url="mailto:ph@imatix.com">ph@imatix.com</ulink>>.</simpara>
|
40
|
+
</refsect1>
|
41
|
+
<refsect1 id="_resources">
|
42
|
+
<title>RESOURCES</title>
|
43
|
+
<simpara>Main web site: <ulink url="http://czmq.zeromq.org/">http://czmq.zeromq.org/</ulink></simpara>
|
44
|
+
<simpara>Report bugs to the 0MQ development mailing list: <<ulink url="mailto:zeromq-dev@lists.zeromq.org">zeromq-dev@lists.zeromq.org</ulink>></simpara>
|
45
|
+
</refsect1>
|
46
|
+
<refsect1 id="_copyright">
|
47
|
+
<title>COPYRIGHT</title>
|
48
|
+
<simpara>Copyright (c) 1991-2010 iMatix Corporation and contributors. License LGPLv3+: GNU LGPL 3 or later <<ulink url="http://gnu.org/licenses/lgpl.html">http://gnu.org/licenses/lgpl.html</ulink>>. This is free software: you are free to change it and redistribute it. There is NO WARRANTY, to the extent permitted by law. For details see the files <literal>COPYING</literal> and <literal>COPYING.LESSER</literal> included with the CZMQ distribution.</simpara>
|
49
|
+
</refsect1>
|
50
|
+
</refentry>
|
51
|
+
endif::backend-docbook[]
|
52
|
+
endif::doctype-manpage[]
|
53
|
+
|
54
|
+
[replacements]
|
55
|
+
ifdef::backend-xhtml11[]
|
56
|
+
0MQ=ØMQ
|
57
|
+
endif::backend-xhtml11[]
|
@@ -0,0 +1,334 @@
|
|
1
|
+
czmq(7)
|
2
|
+
=======
|
3
|
+
|
4
|
+
|
5
|
+
NAME
|
6
|
+
----
|
7
|
+
czmq - high-level C binding for ØMQ
|
8
|
+
|
9
|
+
|
10
|
+
SYNOPSIS
|
11
|
+
--------
|
12
|
+
----
|
13
|
+
#include <czmq.h>
|
14
|
+
|
15
|
+
cc ['flags'] 'files' -lzmq -lczmq ['libraries']
|
16
|
+
----
|
17
|
+
|
18
|
+
|
19
|
+
DESCRIPTION
|
20
|
+
-----------
|
21
|
+
|
22
|
+
Scope and Goals
|
23
|
+
~~~~~~~~~~~~~~~
|
24
|
+
|
25
|
+
CZMQ has these goals:
|
26
|
+
|
27
|
+
* To wrap the ØMQ core API in semantics that are natural and lead to shorter, more readable applications.
|
28
|
+
* To hide the differences between versions of ØMQ.
|
29
|
+
* To provide a space for development of more sophisticated API semantics.
|
30
|
+
|
31
|
+
Ownership and License
|
32
|
+
~~~~~~~~~~~~~~~~~~~~~
|
33
|
+
|
34
|
+
CZMQ is maintained by Pieter Hintjens. Its other authors and contributors are listed in the AUTHORS file. It is held by the ZeroMQ organization at github.com.
|
35
|
+
|
36
|
+
The authors of CZMQ grant you free use of this software under the terms of the GNU Lesser General Public License (LGPL). For details see the files `COPYING` and `COPYING.LESSER` in this directory.
|
37
|
+
|
38
|
+
Contributing
|
39
|
+
~~~~~~~~~~~~
|
40
|
+
|
41
|
+
To submit an issue use the issue tracker at http://github.com/zeromq/czmq/issues. All discussion happens on the zeromq-dev list or #zeromq IRC channel at irc.freenode.net.
|
42
|
+
|
43
|
+
The proper way to submit patches is to clone this repository, make your changes, and use git to create a patch or a pull request. See http://www.zeromq.org/docs:contributing. All contributors are listed in AUTHORS.
|
44
|
+
|
45
|
+
All classes are maintained by a single person, who is the responsible editor for that class and who is named in the header as such. This is usually the originator of the class. When several people collaborate on a class, one single person is always the lead maintainer and the one to blame when it breaks.
|
46
|
+
|
47
|
+
The general rule is, if you contribute code to CZMQ you must be willing to maintain it as long as there are users of it. Code with no active maintainer will in general be deprecated and/or removed.
|
48
|
+
|
49
|
+
USING CZMQ
|
50
|
+
----------
|
51
|
+
|
52
|
+
Building and Installing
|
53
|
+
~~~~~~~~~~~~~~~~~~~~~~~
|
54
|
+
|
55
|
+
CZMQ uses autotools for packaging. To build from git (all example commands are for Linux):
|
56
|
+
----
|
57
|
+
git clone git://github.com/zeromq/czmq.git
|
58
|
+
cd czmq
|
59
|
+
sh autogen.sh
|
60
|
+
./configure
|
61
|
+
make all
|
62
|
+
sudo make install
|
63
|
+
sudo ldconfig
|
64
|
+
----
|
65
|
+
|
66
|
+
You will need the pkg-config, libtool, and autoreconf packages. Set the LD_LIBRARY_PATH to /usr/local/libs unless you install elsewhere.
|
67
|
+
|
68
|
+
After building, you can run the CZMQ selftests:
|
69
|
+
----
|
70
|
+
cd src
|
71
|
+
./czmq_selftest
|
72
|
+
----
|
73
|
+
|
74
|
+
Linking with an Application
|
75
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
76
|
+
|
77
|
+
Include `czmq.h` in your application and link with CZMQ. Here is a typical gcc link command:
|
78
|
+
----
|
79
|
+
gcc -lczmq -lzmq myapp.c -o myapp
|
80
|
+
----
|
81
|
+
|
82
|
+
You should read `czmq.h`. This file includes `zmq.h` and the system header files that typical ØMQ applications will need. The provided 'c' shell script lets you write simple portable build scripts:
|
83
|
+
----
|
84
|
+
c -lczmq -lzmq -l myapp
|
85
|
+
----
|
86
|
+
|
87
|
+
The Class Model
|
88
|
+
~~~~~~~~~~~~~~~
|
89
|
+
|
90
|
+
CZMQ consists of classes, each class consisting of a .h and a .c. Classes may depend on other classes.
|
91
|
+
|
92
|
+
`czmq.h` includes all classes header files, all the time. For the user, CZMQ forms one single package. All classes start by including `czmq.h`. All applications that use CZMQ start by including `czmq.h`. `czmq.h` also defines a limited number of small, useful macros and typedefs that have proven useful for writing clearer C code.
|
93
|
+
|
94
|
+
All classes (with some exceptions) are based on a flat C class system and follow these rules (where 'zclass' is the class name):
|
95
|
+
|
96
|
+
* Class typedef: `zclass_t`
|
97
|
+
* Constructor: `zclass_new`
|
98
|
+
* Destructor: `zclass_destroy`
|
99
|
+
* Property methods: `zclass_property_set`, `zclass_property`
|
100
|
+
* Class structures are private (defined in the .c source but not the .h)
|
101
|
+
* Properties are accessed only via methods named as described above.
|
102
|
+
* In the class source code the object is always called `self`.
|
103
|
+
* The constructor may take arbitrary arguments, and returns NULL on failure, or a new object.
|
104
|
+
* The destructor takes a pointer to an object reference and nullifies it.
|
105
|
+
|
106
|
+
Return values for methods are:
|
107
|
+
|
108
|
+
* For methods that return an object reference, either the reference, or NULL on failure.
|
109
|
+
* For methods that signal success/failure, a return value of 0 means sucess, -1 failure.
|
110
|
+
|
111
|
+
Private/static functions in a class are named `s_functionname` and are not exported via the header file.
|
112
|
+
|
113
|
+
All classes (with some exceptions) have a test method called `zclass_test`.
|
114
|
+
|
115
|
+
Design Ideology
|
116
|
+
---------------
|
117
|
+
|
118
|
+
The Problem with C
|
119
|
+
~~~~~~~~~~~~~~~~~~
|
120
|
+
|
121
|
+
C has the significant advantage of being a small language that, if we take a little care with formatting and naming, can be easily interchanged between developers. Every C developer will use much the same 90% of the language. Larger languages like C++ provide powerful abstractions like STL containers but at the cost of interchange.
|
122
|
+
|
123
|
+
The huge problem with C is that any realistic application needs packages of functionality to bring the language up to the levels we expect for the 21st century. Much can be done by using external libraries but every additional library is a dependency that makes the resulting applications harder to build and port. While C itself is a highly portable language (and can be made more so by careful use of the preprocessor), most C libraries consider themselves part of the operating system, and as such do not attempt to be portable.
|
124
|
+
|
125
|
+
The answer to this, as we learned from building enterprise-level C applications at iMatix from 1995-2005, is to create our own fully portable, high-quality libraries of pre-packaged functionality, in C. Doing this right solves both the requirements of richness of the language, and of portability of the final applications.
|
126
|
+
|
127
|
+
A Simple Class Model
|
128
|
+
~~~~~~~~~~~~~~~~~~~~
|
129
|
+
|
130
|
+
C has no standard API style. It is one thing to write a useful component, but something else to provide an API that is consistent and obvious across many components. We learned from building OpenAMQ (http://www.openamq.org), a messaging client and server of 0.5M LoC, that a consistent model for extending C makes life for the application developer much easier.
|
131
|
+
|
132
|
+
The general model is that of a class (the source package) that provides objects (in fact C structures). The application creates objects and then works with them. When done, the application destroys the object. In C, we tend to use the same name for the object as the class, when we can, and it looks like this (to take a fictitious CZMQ class):
|
133
|
+
----
|
134
|
+
zregexp_t *regexp = zregexp_new (regexp_string);
|
135
|
+
if (!regexp)
|
136
|
+
printf ("E: invalid regular expression: %s\n", regexp_string);
|
137
|
+
else
|
138
|
+
if (zregexp_match (regexp, input_buffer))
|
139
|
+
printf ("I: successful match for %s\n", input buffer);
|
140
|
+
zregexp_destroy (&regexp);
|
141
|
+
----
|
142
|
+
|
143
|
+
As far as the C program is concerned, the object is a reference to a structure (not a void pointer). We pass the object reference to all methods, since this is still C. We could do weird stuff like put method addresses into the structure so that we can emulate a C++ syntax but it's not worthwhile. The goal is not to emulate an OO system, it's simply to gain consistency. The constructor returns an object reference, or NULL if it fails. The destructor nullifies the class pointer, and is idempotent.
|
144
|
+
|
145
|
+
What we aim at here is the simplest possible consistent syntax.
|
146
|
+
|
147
|
+
No model is fully consistent, and classes can define their own rules if it helps make a better result. For example:
|
148
|
+
|
149
|
+
* Some classes may not be opaque. For example, we have cases of generated serialization classes that encode and decode structures to/from binary buffers. It feels clumsy to have to use methods to access the properties of these classes.
|
150
|
+
|
151
|
+
* While every class has a new method that is the formal constructor, some methods may also act as constructors. For example, a "dup" method might take one object and return a second object.
|
152
|
+
|
153
|
+
* While every class has a destroy method that is the formal destructor, some methods may also act as destructors. For example, a method that sends an object may also destroy the object (so that ownership of any buffers can passed to background threads). Such methods take the same "pointer to a reference" argument as the destroy method.
|
154
|
+
|
155
|
+
Naming Style
|
156
|
+
~~~~~~~~~~~~
|
157
|
+
|
158
|
+
CZMQ aims for short, consistent names, following the theory that names we use most often should be shortest. Classes get one-word names, unless they are part of a family of classes in which case they may be two words, the first being the family name. Methods, similarly, get one-word names and we aim for consistency across classes (so a method that does something semantically similar in two classes will get the same name in both). So the canonical name for any method is:
|
159
|
+
----
|
160
|
+
zclassname_methodname
|
161
|
+
----
|
162
|
+
|
163
|
+
And the reader can easily parse this without needing special syntax to separate the class name from the method name.
|
164
|
+
|
165
|
+
Containers
|
166
|
+
~~~~~~~~~~
|
167
|
+
|
168
|
+
After a long experiment with containers, we've decided that we need exactly two containers:
|
169
|
+
|
170
|
+
* A singly-linked list.
|
171
|
+
* A hash table using text keys.
|
172
|
+
|
173
|
+
These are zlist and zhash, respectively. Both store void pointers, with no attempt to manage the details of contained objects. You can use these containers to create lists of lists, hashes of lists, hashes of hashes, etc.
|
174
|
+
|
175
|
+
We assume that at some point we'll need to switch to a doubly-linked list.
|
176
|
+
|
177
|
+
Portability
|
178
|
+
~~~~~~~~~~~
|
179
|
+
|
180
|
+
Creating a portable C application can be rewarding in terms of maintaining a single code base across many platforms, and keeping (expensive) system-specific knowledge separate from application developers. In most projects (like ØMQ core), there is no portability layer and application code does conditional compilation for all mixes of platforms. This leads to quite messy code.
|
181
|
+
|
182
|
+
czmq acts as a portability layer, similar to but thinner than libraries like the [Apache Portable Runtime](http://apr.apache.org) (APR).
|
183
|
+
|
184
|
+
These are the places a C application is subject to arbitrary system differences:
|
185
|
+
|
186
|
+
* Different compilers may offer slightly different variants of the C language, often lacking specific types or using neat non-portable names. Windows is a big culprit here. We solve this by 'patching' the language in czmq_prelude.h, e.g. defining int64_t on Windows.
|
187
|
+
* System header files are inconsistent, i.e. you need to include different files depending on the OS type and version. We solve this by pulling in all necessary header files in czmq_prelude.h. This is a proven brute-force approach that increases recompilation times but eliminates a major source of pain.
|
188
|
+
* System libraries are inconsistent, i.e. you need to link with different libraries depending on the OS type and version. We solve this with an external compilation tool, 'C', which detects the OS type and version (at runtime) and builds the necessary link commands.
|
189
|
+
* System functions are inconsistent, i.e. you need to call different functions depending, again, on OS type and version. We solve this by building small abstract classes that handle specific areas of functionality, and doing conditional compilation in these.
|
190
|
+
|
191
|
+
An example of the last:
|
192
|
+
----
|
193
|
+
#if (defined (__UNIX__))
|
194
|
+
pid = GetCurrentProcessId();
|
195
|
+
#elif (defined (__WINDOWS__))
|
196
|
+
pid = getpid ();
|
197
|
+
#else
|
198
|
+
pid = 0;
|
199
|
+
#endif
|
200
|
+
----
|
201
|
+
|
202
|
+
CZMQ uses the GNU autotools system, so non-portable code can use the macros this defines. It can also use macros defined by the czmq_prelude.h header file.
|
203
|
+
|
204
|
+
Technical Aspects
|
205
|
+
~~~~~~~~~~~~~~~~~
|
206
|
+
|
207
|
+
* *Thread safety*: the use of opaque structures is thread safe, though ØMQ applications should not share state between threads in any case.
|
208
|
+
* *Name spaces*: we prefix class names with `z`, which ensures that all exported functions are globally safe.
|
209
|
+
* *Library versioning*: we don't make any attempt to version the library at this stage. Classes are in our experience highly stable once they are built and tested, the only changes typically being added methods.
|
210
|
+
* *Performance*: for critical path processing, you may want to avoid creating and destroying classes. However on modern Linux systems the heap allocator is very fast. Individual classes can choose whether or not to nullify their data on allocation.
|
211
|
+
* *Self-testing*: every class has a `selftest` method that runs through the methods of the class. In theory, calling all selftest functions of all classes does a full unit test of the library. The `czmq_selftest` application does this.
|
212
|
+
* *Memory management*: CZMQ classes do not use any special memory management techiques to detect leaks. We've done this in the past but it makes the code relatively complex. Instead, we do memory leak testing using tools like valgrind.
|
213
|
+
|
214
|
+
Under the Hood
|
215
|
+
--------------
|
216
|
+
|
217
|
+
Adding a New Class
|
218
|
+
~~~~~~~~~~~~~~~~~~
|
219
|
+
|
220
|
+
If you define a new CZMQ class `myclass` you need to:
|
221
|
+
|
222
|
+
* Write the `zmyclass.c` and `zmyclass.h` source files, in `src` and `include` respectively.
|
223
|
+
* Add`#include <zmyclass.h>` to `include/czmq.h`.
|
224
|
+
* Add the myclass header and test call to `src/czmq_selftest.c`.
|
225
|
+
* Add a reference documentation to 'doc/zmyclass.txt'.
|
226
|
+
* Add myclass to 'src/Makefile.am` and `doc/Makefile.am`.
|
227
|
+
|
228
|
+
The `bin/newclass.sh` shell script will automate these steps for you.
|
229
|
+
|
230
|
+
Coding Style
|
231
|
+
~~~~~~~~~~~~
|
232
|
+
|
233
|
+
In general the zctx class defines the style for the whole library. The overriding rules for coding style are consistency, clarity, and ease of maintenance. We use the C99 standard for syntax including principally:
|
234
|
+
|
235
|
+
* The // comment style.
|
236
|
+
* Variables definitions placed in or before the code that uses them.
|
237
|
+
|
238
|
+
So while ANSI C code might say:
|
239
|
+
----
|
240
|
+
zblob_t *file_buffer; /* Buffer for our file */
|
241
|
+
... (100 lines of code)
|
242
|
+
file_buffer = zblob_new ();
|
243
|
+
...
|
244
|
+
----
|
245
|
+
|
246
|
+
The style in CZMQ would be:
|
247
|
+
----
|
248
|
+
zblob_t *file_buffer = zblob_new ();
|
249
|
+
----
|
250
|
+
|
251
|
+
Assertions
|
252
|
+
~~~~~~~~~~
|
253
|
+
|
254
|
+
We use assertions heavily to catch bad argument values. The CZMQ classes do not attempt to validate arguments and report errors; bad arguments are treated as fatal application programming errors.
|
255
|
+
|
256
|
+
We also use assertions heavily on calls to system functions that are never supposed to fail, where failure is to be treated as a fatal non-recoverable error (e.g. running out of memory).
|
257
|
+
|
258
|
+
Assertion code should always take this form:
|
259
|
+
----
|
260
|
+
int rc = some_function (arguments);
|
261
|
+
assert (rc == 0);
|
262
|
+
----
|
263
|
+
|
264
|
+
Rather than the side-effect form:
|
265
|
+
----
|
266
|
+
assert (some_function (arguments) == 0);
|
267
|
+
----
|
268
|
+
|
269
|
+
Since assertions may be removed by an optimizing compiler.
|
270
|
+
|
271
|
+
Documentation
|
272
|
+
~~~~~~~~~~~~~
|
273
|
+
|
274
|
+
Man pages are generated from the class header and source files via the doc/mkman tool, and similar functionality in the gitdown tool (http://github.com/imatix/gitdown). The header file for a class must wrap its interface as follows (example is from include/zclock.h):
|
275
|
+
----
|
276
|
+
// @interface
|
277
|
+
// Sleep for a number of milliseconds
|
278
|
+
void
|
279
|
+
zclock_sleep (int msecs);
|
280
|
+
|
281
|
+
// Return current system clock as milliseconds
|
282
|
+
int64_t
|
283
|
+
zclock_time (void);
|
284
|
+
|
285
|
+
// Self test of this class
|
286
|
+
int
|
287
|
+
zclock_test (Bool verbose);
|
288
|
+
// @end
|
289
|
+
----
|
290
|
+
|
291
|
+
The source file for a class must provide documentation as follows:
|
292
|
+
----
|
293
|
+
/*
|
294
|
+
@header
|
295
|
+
...short explanation of class...
|
296
|
+
@discuss
|
297
|
+
...longer discussion of how it works...
|
298
|
+
@end
|
299
|
+
*/
|
300
|
+
----
|
301
|
+
|
302
|
+
The source file for a class then provides the self test example as follows:
|
303
|
+
----
|
304
|
+
// @selftest
|
305
|
+
int64_t start = zclock_time ();
|
306
|
+
zclock_sleep (10);
|
307
|
+
assert ((zclock_time () - start) >= 10);
|
308
|
+
// @end
|
309
|
+
----
|
310
|
+
|
311
|
+
The template for man pages is in doc/mkman.
|
312
|
+
|
313
|
+
Development
|
314
|
+
~~~~~~~~~~~
|
315
|
+
|
316
|
+
CZMQ is developed through a test-driven process that guarantees no memory violations or leaks in the code:
|
317
|
+
|
318
|
+
* Modify a class or method.
|
319
|
+
* Update the test method for that class.
|
320
|
+
* Run the 'selftest' script, which uses the Valgrind memcheck tool.
|
321
|
+
* Repeat until perfect.
|
322
|
+
|
323
|
+
Porting CZMQ
|
324
|
+
~~~~~~~~~~~~
|
325
|
+
|
326
|
+
When you try CZMQ on an OS that it's not been used on (ever, or for a while), you will hit code that does not compile. In some cases the patches are trivial, in other cases (usually when porting to Windows), the work needed to build equivalent functionality may be quite heavy. In any case, the benefit is that once ported, the functionality is available to all applications.
|
327
|
+
|
328
|
+
Before attempting to patch code for portability, please read the `czmq_prelude.h` header file. There are several typical types of changes you may need to make to get functionality working on a specific operating system:
|
329
|
+
|
330
|
+
* Defining typedefs which are missing on that specific compiler: do this in czmq_prelude.h.
|
331
|
+
* Defining macros that rename exotic library functions to more conventional names: do this in czmq_prelude.h.
|
332
|
+
* Reimplementing specific methods to use a non-standard API: this is typically needed on Windows. Do this in the relevant class, using #ifdefs to properly differentiate code for different platforms.
|
333
|
+
|
334
|
+
The canonical 'standard operating system' for all CZMQ code is Linux, gcc, POSIX.
|