Merge branch 'master' of github.com:zeromq/libzmq

This commit is contained in:
Mário Kašuba 2014-12-26 19:21:37 +01:00
commit 4b4adbbc1d
71 changed files with 2677 additions and 999 deletions

170
.gitignore vendored
View File

@ -21,93 +21,96 @@ autom4te.cache
.*
*~
.*~
tools/curve_keygen
tests/test_resource
tests/test_ipc_wildcard
tests/test_stream_empty
tests/test_stream_timeout
tests/test_issue_566
tests/test_ctx_destroy
tests/test_term_endpoint
tests/test_system
tests/test_monitor
tests/test_last_endpoint
tests/test_pair_inproc
tests/test_pair_ipc
tests/test_pair_tcp
tests/test_reqrep_inproc
tests/test_reqrep_ipc
tests/test_reqrep_tcp
tests/test_shutdown_stress
tests/test_hwm
tests/test_timeo
tests/test_reqrep_device
tests/test_reqrep_drop
tests/test_sub_forward
tests/test_invalid_rep
tests/test_msg_flags
tests/test_ts_context
tests/test_connect_resolve
tests/test_immediate
tests/test_term_endpoint
tests/test_router_mandatory
tests/test_disconnect_inproc
tests/test_raw_sock
tests/test_disconnect_inproc
tests/test_ctx_options
tests/test_iov
tests/test_security
tests/test_security_curve
tests/test_probe_router
tests/test_stream
tests/test_spec_dealer
tests/test_spec_pushpull
tests/test_spec_rep
tests/test_spec_req
tests/test_spec_router
tests/test_req_correlate
tests/test_req_relaxed
tests/test_fork
tests/test_conflate
tests/test_inproc_connect
tests/test_linger
tests/test_security_null
tests/test_security_plain
tests/test_proxy
tests/test_abstract_ipc
tests/test_filter_ipc
tests/test_connect_delay_tipc
tests/test_pair_tipc
tests/test_reqrep_device_tipc
tests/test_reqrep_tipc
tests/test_router_handover
tests/test_router_mandatory_tipc
tests/test_shutdown_stress_tipc
tests/test_sub_forward_tipc
tests/test_term_endpoint_tipc
tests/test_many_sockets
tests/test_diffserv
tests/test_connect_rid
tests/test_srcfd
tests/test_stream_disconnect
tests/test_proxy_chain
tests/test_bind_src_address
tests/test_metadata
tests/test_id2fd
tests/test_capabilities
tests/test_hwm_pubsub
tests/test_router_mandatory_hwm
tests/test_xpub_nodrop
curve_keygen
test_resource
test_ipc_wildcard
test_stream_empty
test_stream_timeout
test_issue_566
test_ctx_destroy
test_term_endpoint
test_system
test_monitor
test_last_endpoint
test_pair_inproc
test_pair_ipc
test_pair_tcp
test_reqrep_inproc
test_reqrep_ipc
test_reqrep_tcp
test_shutdown_stress
test_hwm
test_timeo
test_reqrep_device
test_reqrep_drop
test_sub_forward
test_invalid_rep
test_msg_flags
test_ts_context
test_connect_resolve
test_immediate
test_term_endpoint
test_router_mandatory
test_disconnect_inproc
test_raw_sock
test_disconnect_inproc
test_ctx_options
test_iov
test_security
test_security_curve
test_probe_router
test_stream
test_spec_dealer
test_spec_pushpull
test_spec_rep
test_spec_req
test_spec_router
test_req_correlate
test_req_relaxed
test_fork
test_conflate
test_inproc_connect
test_linger
test_security_null
test_security_plain
test_proxy
test_abstract_ipc
test_filter_ipc
test_connect_delay_tipc
test_pair_tipc
test_reqrep_device_tipc
test_reqrep_tipc
test_router_handover
test_router_mandatory_tipc
test_shutdown_stress_tipc
test_sub_forward_tipc
test_term_endpoint_tipc
test_many_sockets
test_diffserv
test_connect_rid
test_srcfd
test_stream_disconnect
test_proxy_chain
test_bind_src_address
test_metadata
test_id2fd
test_capabilities
test_hwm_pubsub
test_router_mandatory_hwm
test_xpub_nodrop
test_xpub_manual
test_xpub_welcome_msg
test_atomics
tests/test*.log
tests/test*.trs
src/platform.hpp*
src/stamp-h1
perf/local_lat
perf/local_thr
perf/remote_lat
perf/remote_thr
perf/inproc_lat
perf/inproc_thr
local_lat
local_thr
remote_lat
remote_thr
inproc_lat
inproc_thr
doc/*.1
doc/*.3
doc/*.7
@ -124,6 +127,7 @@ builds/msvc/**/*.user
builds/msvc/**/*Debug
builds/msvc/**/*Release
builds/redhat/zeromq.spec
builds/qt-android/prefix/
packaging/nuget/*.nupkg
foreign/openpgm/*
!foreign/openpgm/*.tar.bz2

View File

@ -2,14 +2,9 @@
language: c
# Build required projects first
before_script:
env:
- BUILD_TYPE=default
- BUILD_TYPE=qt-android
# libsodium
- git clone git://github.com/jedisct1/libsodium.git
- ( cd libsodium; ./autogen.sh; ./configure; make check; sudo make install; sudo ldconfig )
# Build and check this project
script:
- ./autogen.sh && ./configure && make && make check
- sudo make install
# Build and check this project according to the BUILD_TYPE
script: ./ci_build.sh

View File

@ -105,6 +105,7 @@ Lourens Naudé
Hardeep Singh
André Caron
Tim Mossbarger
Doron Somech
Credits
=======

View File

@ -1,26 +1,619 @@
ACLOCAL_AMFLAGS = -I config
if BUILD_PGM
SUBDIRS = foreign/openpgm src doc perf tests tools
SUBDIRS = doc
DIST_SUBDIRS = builds/msvc doc
pkgconfig_DATA = src/libzmq.pc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include
#
# libraries/binaries
#
lib_LTLIBRARIES = src/libzmq.la
include_HEADERS = \
include/zmq.h \
include/zmq_utils.h
src_libzmq_la_SOURCES = \
src/address.cpp \
src/address.hpp \
src/array.hpp \
src/atomic_counter.hpp \
src/atomic_ptr.hpp \
src/blob.hpp \
src/clock.cpp \
src/clock.hpp \
src/command.hpp \
src/config.hpp \
src/ctx.cpp \
src/ctx.hpp \
src/curve_client.cpp \
src/curve_client.hpp \
src/curve_server.cpp \
src/curve_server.hpp \
src/dbuffer.hpp \
src/dealer.cpp \
src/dealer.hpp \
src/decoder.hpp \
src/devpoll.cpp \
src/devpoll.hpp \
src/dist.cpp \
src/dist.hpp \
src/encoder.hpp \
src/epoll.cpp \
src/epoll.hpp \
src/err.cpp \
src/err.hpp \
src/fd.hpp \
src/fq.cpp \
src/fq.hpp \
src/gssapi_mechanism_base.cpp \
src/gssapi_mechanism_base.hpp \
src/gssapi_client.cpp \
src/gssapi_client.hpp \
src/gssapi_server.cpp \
src/gssapi_server.hpp \
src/i_encoder.hpp \
src/i_engine.hpp \
src/i_decoder.hpp \
src/i_poll_events.hpp \
src/io_object.cpp \
src/io_object.hpp \
src/io_thread.cpp \
src/io_thread.hpp \
src/ip.cpp \
src/ip.hpp \
src/ipc_address.cpp \
src/ipc_address.hpp \
src/ipc_connecter.cpp \
src/ipc_connecter.hpp \
src/ipc_listener.cpp \
src/ipc_listener.hpp \
src/kqueue.cpp \
src/kqueue.hpp \
src/lb.cpp \
src/lb.hpp \
src/likely.hpp \
src/mailbox.cpp \
src/mailbox.hpp \
src/mechanism.cpp \
src/mechanism.hpp \
src/metadata.cpp \
src/metadata.hpp \
src/msg.cpp \
src/msg.hpp \
src/mtrie.cpp \
src/mtrie.hpp \
src/mutex.hpp \
src/norm_engine.cpp \
src/norm_engine.hpp \
src/null_mechanism.cpp \
src/null_mechanism.hpp \
src/object.cpp \
src/object.hpp \
src/options.cpp \
src/options.hpp \
src/own.cpp \
src/own.hpp \
src/pair.cpp \
src/pair.hpp \
src/pgm_receiver.cpp \
src/pgm_receiver.hpp \
src/pgm_sender.cpp \
src/pgm_sender.hpp \
src/pgm_socket.cpp \
src/pgm_socket.hpp \
src/pipe.cpp \
src/pipe.hpp \
src/plain_client.cpp \
src/plain_client.hpp \
src/plain_server.cpp \
src/plain_server.hpp \
src/platform.hpp \
src/poll.cpp \
src/poll.hpp \
src/poller.hpp \
src/poller_base.cpp \
src/poller_base.hpp \
src/proxy.cpp \
src/proxy.hpp \
src/pub.cpp \
src/pub.hpp \
src/pull.cpp \
src/pull.hpp \
src/push.cpp \
src/push.hpp \
src/random.cpp \
src/random.hpp \
src/raw_decoder.cpp \
src/raw_decoder.hpp \
src/raw_encoder.cpp \
src/raw_encoder.hpp \
src/reaper.cpp \
src/reaper.hpp \
src/rep.cpp \
src/rep.hpp \
src/req.cpp \
src/req.hpp \
src/router.cpp \
src/router.hpp \
src/select.cpp \
src/select.hpp \
src/session_base.cpp \
src/session_base.hpp \
src/signaler.cpp \
src/signaler.hpp \
src/socket_base.cpp \
src/socket_base.hpp \
src/socks.cpp \
src/socks.hpp \
src/socks_connecter.cpp \
src/socks_connecter.hpp \
src/stdint.hpp \
src/stream.cpp \
src/stream.hpp \
src/stream_engine.cpp \
src/stream_engine.hpp \
src/sub.cpp \
src/sub.hpp \
src/tcp.cpp \
src/tcp.hpp \
src/tcp_address.cpp \
src/tcp_address.hpp \
src/tcp_connecter.cpp \
src/tcp_connecter.hpp \
src/tcp_listener.cpp \
src/tcp_listener.hpp \
src/thread.cpp \
src/thread.hpp \
src/tipc_address.cpp \
src/tipc_address.hpp \
src/tipc_connecter.cpp \
src/tipc_connecter.hpp \
src/tipc_listener.cpp \
src/tipc_listener.hpp \
src/trie.cpp \
src/trie.hpp \
src/v1_decoder.cpp \
src/v1_decoder.hpp \
src/v2_decoder.cpp \
src/v2_decoder.hpp \
src/v1_encoder.cpp \
src/v1_encoder.hpp \
src/v2_encoder.cpp \
src/v2_encoder.hpp \
src/v2_protocol.hpp \
src/windows.hpp \
src/wire.hpp \
src/xpub.hpp \
src/xpub.cpp \
src/xsub.cpp \
src/xsub.hpp \
src/ypipe.hpp \
src/ypipe_base.hpp \
src/ypipe_conflate.hpp \
src/yqueue.hpp \
src/zmq.cpp \
src/zmq_utils.cpp
if ON_MINGW
src_libzmq_la_LDFLAGS = \
-no-undefined \
-avoid-version \
-version-info @LTVER@ \
@LIBZMQ_EXTRA_LDFLAGS@
else
SUBDIRS = src doc perf tests tools
if ON_ANDROID
src_libzmq_la_LDFLAGS = \
-avoid-version \
-version-info @LTVER@ \
@LIBZMQ_EXTRA_LDFLAGS@
else
if ON_LINUX
src_libzmq_la_LDFLAGS = \
-version-info @LTVER@ \
@LIBZMQ_EXTRA_LDFLAGS@ \
-Wl,--version-script=$(srcdir)/src/libzmq.vers
else
src_libzmq_la_LDFLAGS = \
-version-info @LTVER@ \
@LIBZMQ_EXTRA_LDFLAGS@ \
-Wl
endif
endif
endif
DIST_SUBDIRS = foreign/openpgm src doc perf tests tools builds/msvc
src_libzmq_la_CPPFLAGS =
src_libzmq_la_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@
src_libzmq_la_LIBADD =
if HAVE_SODIUM
src_libzmq_la_CPPFLAGS += ${sodium_CFLAGS}
src_libzmq_la_LIBADD += ${sodium_LIBS}
endif
if HAVE_PGM
src_libzmq_la_CPPFLAGS += ${pgm_CFLAGS}
src_libzmq_la_LIBADD += ${pgm_LIBS}
endif
noinst_PROGRAMS = \
perf/local_lat \
perf/remote_lat \
perf/local_thr \
perf/remote_thr \
perf/inproc_lat \
perf/inproc_thr
perf_local_lat_LDADD = src/libzmq.la
perf_local_lat_SOURCES = perf/local_lat.cpp
perf_remote_lat_LDADD = src/libzmq.la
perf_remote_lat_SOURCES = perf/remote_lat.cpp
perf_local_thr_LDADD = src/libzmq.la
perf_local_thr_SOURCES = perf/local_thr.cpp
perf_remote_thr_LDADD = src/libzmq.la
perf_remote_thr_SOURCES = perf/remote_thr.cpp
perf_inproc_lat_LDADD = src/libzmq.la
perf_inproc_lat_SOURCES = perf/inproc_lat.cpp
perf_inproc_thr_LDADD = src/libzmq.la
perf_inproc_thr_SOURCES = perf/inproc_thr.cpp
bin_PROGRAMS = tools/curve_keygen
tools_curve_keygen_LDADD = src/libzmq.la
tools_curve_keygen_SOURCES = tools/curve_keygen.cpp
#
# tests
#
test_apps = \
tests/test_system \
tests/test_pair_inproc \
tests/test_pair_tcp \
tests/test_reqrep_inproc \
tests/test_reqrep_tcp \
tests/test_hwm \
tests/test_hwm_pubsub \
tests/test_reqrep_device \
tests/test_sub_forward \
tests/test_invalid_rep \
tests/test_msg_flags \
tests/test_connect_resolve \
tests/test_immediate \
tests/test_last_endpoint \
tests/test_term_endpoint \
tests/test_srcfd \
tests/test_monitor \
tests/test_router_mandatory \
tests/test_router_mandatory_hwm \
tests/test_router_handover \
tests/test_probe_router \
tests/test_stream \
tests/test_stream_empty \
tests/test_stream_disconnect \
tests/test_stream_timeout \
tests/test_disconnect_inproc \
tests/test_ctx_options \
tests/test_ctx_destroy \
tests/test_security_null \
tests/test_security_plain \
tests/test_security_curve \
tests/test_iov \
tests/test_spec_req \
tests/test_spec_rep \
tests/test_spec_dealer \
tests/test_spec_router \
tests/test_spec_pushpull \
tests/test_req_correlate \
tests/test_req_relaxed \
tests/test_conflate \
tests/test_inproc_connect \
tests/test_issue_566 \
tests/test_proxy \
tests/test_many_sockets \
tests/test_ipc_wildcard \
tests/test_diffserv \
tests/test_connect_rid \
tests/test_bind_src_address \
tests/test_metadata \
tests/test_id2fd \
tests/test_capabilities \
tests/test_xpub_nodrop \
tests/test_xpub_manual \
tests/test_xpub_welcome_msg \
tests/test_atomics
tests_test_system_SOURCES = tests/test_system.cpp
tests_test_system_LDADD = src/libzmq.la
tests_test_pair_inproc_SOURCES = \
tests/test_pair_inproc.cpp \
tests/testutil.hpp
tests_test_pair_inproc_LDADD = src/libzmq.la
tests_test_pair_tcp_SOURCES = \
tests/test_pair_tcp.cpp \
tests/testutil.hpp
tests_test_pair_tcp_LDADD = src/libzmq.la
tests_test_reqrep_inproc_SOURCES = \
tests/test_reqrep_inproc.cpp \
tests/testutil.hpp
tests_test_reqrep_inproc_LDADD = src/libzmq.la
tests_test_reqrep_tcp_SOURCES = \
tests/test_reqrep_tcp.cpp \
tests/testutil.hpp
tests_test_reqrep_tcp_LDADD = src/libzmq.la
tests_test_hwm_SOURCES = tests/test_hwm.cpp
tests_test_hwm_LDADD = src/libzmq.la
tests_test_hwm_pubsub_SOURCES = tests/test_hwm_pubsub.cpp
tests_test_hwm_pubsub_LDADD = src/libzmq.la
tests_test_reqrep_device_SOURCES = tests/test_reqrep_device.cpp
tests_test_reqrep_device_LDADD = src/libzmq.la
tests_test_sub_forward_SOURCES = tests/test_sub_forward.cpp
tests_test_sub_forward_LDADD = src/libzmq.la
tests_test_invalid_rep_SOURCES = tests/test_invalid_rep.cpp
tests_test_invalid_rep_LDADD = src/libzmq.la
tests_test_msg_flags_SOURCES = tests/test_msg_flags.cpp
tests_test_msg_flags_LDADD = src/libzmq.la
tests_test_connect_resolve_SOURCES = tests/test_connect_resolve.cpp
tests_test_connect_resolve_LDADD = src/libzmq.la
tests_test_immediate_SOURCES = tests/test_immediate.cpp
tests_test_immediate_LDADD = src/libzmq.la
tests_test_last_endpoint_SOURCES = tests/test_last_endpoint.cpp
tests_test_last_endpoint_LDADD = src/libzmq.la
tests_test_term_endpoint_SOURCES = tests/test_term_endpoint.cpp
tests_test_term_endpoint_LDADD = src/libzmq.la
tests_test_srcfd_SOURCES = tests/test_srcfd.cpp
tests_test_srcfd_LDADD = src/libzmq.la
tests_test_monitor_SOURCES = tests/test_monitor.cpp
tests_test_monitor_LDADD = src/libzmq.la
tests_test_router_mandatory_SOURCES = tests/test_router_mandatory.cpp
tests_test_router_mandatory_LDADD = src/libzmq.la
tests_test_router_mandatory_hwm_SOURCES = tests/test_router_mandatory_hwm.cpp
tests_test_router_mandatory_hwm_LDADD = src/libzmq.la
tests_test_router_handover_SOURCES = tests/test_router_handover.cpp
tests_test_router_handover_LDADD = src/libzmq.la
tests_test_probe_router_SOURCES = tests/test_probe_router.cpp
tests_test_probe_router_LDADD = src/libzmq.la
tests_test_stream_SOURCES = tests/test_stream.cpp
tests_test_stream_LDADD = src/libzmq.la
tests_test_stream_empty_SOURCES = tests/test_stream_empty.cpp
tests_test_stream_empty_LDADD = src/libzmq.la
tests_test_stream_timeout_SOURCES = tests/test_stream_timeout.cpp
tests_test_stream_timeout_LDADD = src/libzmq.la
tests_test_stream_disconnect_SOURCES = tests/test_stream_disconnect.cpp
tests_test_stream_disconnect_LDADD = src/libzmq.la
tests_test_disconnect_inproc_SOURCES = tests/test_disconnect_inproc.cpp
tests_test_disconnect_inproc_LDADD = src/libzmq.la
tests_test_ctx_options_SOURCES = tests/test_ctx_options.cpp
tests_test_ctx_options_LDADD = src/libzmq.la
tests_test_iov_SOURCES = tests/test_iov.cpp
tests_test_iov_LDADD = src/libzmq.la
tests_test_ctx_destroy_SOURCES = tests/test_ctx_destroy.cpp
tests_test_ctx_destroy_LDADD = src/libzmq.la
tests_test_security_null_SOURCES = tests/test_security_null.cpp
tests_test_security_null_LDADD = src/libzmq.la
tests_test_security_plain_SOURCES = tests/test_security_plain.cpp
tests_test_security_plain_LDADD = src/libzmq.la
tests_test_security_curve_SOURCES = tests/test_security_curve.cpp
tests_test_security_curve_LDADD = src/libzmq.la
tests_test_spec_req_SOURCES = tests/test_spec_req.cpp
tests_test_spec_req_LDADD = src/libzmq.la
tests_test_spec_rep_SOURCES = tests/test_spec_rep.cpp
tests_test_spec_rep_LDADD = src/libzmq.la
tests_test_spec_dealer_SOURCES = tests/test_spec_dealer.cpp
tests_test_spec_dealer_LDADD = src/libzmq.la
tests_test_spec_router_SOURCES = tests/test_spec_router.cpp
tests_test_spec_router_LDADD = src/libzmq.la
tests_test_spec_pushpull_SOURCES = tests/test_spec_pushpull.cpp
tests_test_spec_pushpull_LDADD = src/libzmq.la
tests_test_req_correlate_SOURCES = tests/test_req_correlate.cpp
tests_test_req_correlate_LDADD = src/libzmq.la
tests_test_req_relaxed_SOURCES = tests/test_req_relaxed.cpp
tests_test_req_relaxed_LDADD = src/libzmq.la
tests_test_conflate_SOURCES = tests/test_conflate.cpp
tests_test_conflate_LDADD = src/libzmq.la
tests_test_inproc_connect_SOURCES = tests/test_inproc_connect.cpp
tests_test_inproc_connect_LDADD = src/libzmq.la
tests_test_issue_566_SOURCES = tests/test_issue_566.cpp
tests_test_issue_566_LDADD = src/libzmq.la
tests_test_proxy_SOURCES = tests/test_proxy.cpp
tests_test_proxy_LDADD = src/libzmq.la
tests_test_many_sockets_SOURCES = tests/test_many_sockets.cpp
tests_test_many_sockets_LDADD = src/libzmq.la
tests_test_ipc_wildcard_SOURCES = tests/test_ipc_wildcard.cpp
tests_test_ipc_wildcard_LDADD = src/libzmq.la
tests_test_diffserv_SOURCES = tests/test_diffserv.cpp
tests_test_diffserv_LDADD = src/libzmq.la
tests_test_connect_rid_SOURCES = tests/test_connect_rid.cpp
tests_test_connect_rid_LDADD = src/libzmq.la
tests_test_bind_src_address_SOURCES = tests/test_bind_src_address.cpp
tests_test_bind_src_address_LDADD = src/libzmq.la
tests_test_metadata_SOURCES = tests/test_metadata.cpp
tests_test_metadata_LDADD = src/libzmq.la
tests_test_id2fd_SOURCES = tests/test_id2fd.cpp
tests_test_id2fd_LDADD = src/libzmq.la
tests_test_capabilities_SOURCES = tests/test_capabilities.cpp
tests_test_capabilities_LDADD = src/libzmq.la
tests_test_xpub_nodrop_SOURCES = tests/test_xpub_nodrop.cpp
tests_test_xpub_nodrop_LDADD = src/libzmq.la
tests_test_xpub_manual_SOURCES = tests/test_xpub_manual.cpp
tests_test_xpub_manual_LDADD = src/libzmq.la
tests_test_xpub_welcome_msg_SOURCES = tests/test_xpub_welcome_msg.cpp
tests_test_xpub_welcome_msg_LDADD = src/libzmq.la
tests_test_atomics_SOURCES = tests/test_atomics.cpp
tests_test_atomics_LDADD = src/libzmq.la
if !ON_MINGW
test_apps += \
tests/test_shutdown_stress \
tests/test_pair_ipc \
tests/test_reqrep_ipc \
tests/test_timeo \
tests/test_filter_ipc
tests_test_shutdown_stress_SOURCES = tests/test_shutdown_stress.cpp
tests_test_shutdown_stress_LDADD = src/libzmq.la
tests_test_pair_ipc_SOURCES = \
tests/test_pair_ipc.cpp \
tests/testutil.hpp
tests_test_pair_ipc_LDADD = src/libzmq.la
tests_test_reqrep_ipc_SOURCES = \
tests/test_reqrep_ipc.cpp \
tests/testutil.hpp
tests_test_reqrep_ipc_LDADD = src/libzmq.la
tests_test_timeo_SOURCES = tests/test_timeo.cpp
tests_test_timeo_LDADD = src/libzmq.la
tests_test_filter_ipc_SOURCES = tests/test_filter_ipc.cpp
tests_test_filter_ipc_LDADD = src/libzmq.la
if HAVE_FORK
test_apps += tests/test_fork
tests_test_fork_SOURCES = tests/test_fork.cpp
tests_test_fork_LDADD = src/libzmq.la
endif
endif
if BUILD_TIPC
test_apps += \
tests/test_connect_delay_tipc \
tests/test_pair_tipc \
tests/test_reqrep_device_tipc \
tests/test_reqrep_tipc \
tests/test_router_mandatory_tipc \
tests/test_shutdown_stress_tipc \
tests/test_sub_forward_tipc \
tests/test_term_endpoint_tipc
tests_test_connect_delay_tipc_SOURCES = tests/test_connect_delay_tipc.cpp
tests_test_connect_delay_tipc_LDADD = src/libzmq.la
tests_test_pair_tipc_SOURCES = tests/test_pair_tipc.cpp
tests_test_pair_tipc_LDADD = src/libzmq.la
tests_test_reqrep_device_tipc_SOURCES = tests/test_reqrep_device_tipc.cpp
tests_test_reqrep_device_tipc_LDADD = src/libzmq.la
tests_test_reqrep_tipc_SOURCES = tests/test_reqrep_tipc.cpp
tests_test_reqrep_tipc_LDADD = src/libzmq.la
tests_test_router_mandatory_tipc_SOURCES = tests/test_router_mandatory_tipc.cpp
tests_test_router_mandatory_tipc_LDADD = src/libzmq.la
tests_test_shutdown_stress_tipc_SOURCES = tests/test_shutdown_stress_tipc.cpp
tests_test_shutdown_stress_tipc_LDADD = src/libzmq.la
tests_test_sub_forward_tipc_SOURCES = tests/test_sub_forward_tipc.cpp
tests_test_sub_forward_tipc_LDADD = src/libzmq.la
tests_test_term_endpoint_tipc_SOURCES = tests/test_term_endpoint_tipc.cpp
tests_test_term_endpoint_tipc_LDADD = src/libzmq.la
endif
if ON_LINUX
test_apps += tests/test_abstract_ipc
tests_test_abstract_ipc_SOURCES = tests/test_abstract_ipc.cpp
tests_test_abstract_ipc_LDADD = src/libzmq.la
endif
check_PROGRAMS = ${test_apps}
# Run the test cases
TESTS = $(test_apps)
XFAIL_TESTS =
if !ON_LINUX
XFAIL_TESTS += tests/test_abstract_ipc
endif
EXTRA_DIST = \
CMakeLists.txt \
autogen.sh \
version.sh \
MAINTAINERS \
foreign/openpgm/@pgm_basename@.tar.gz
src/libzmq.pc.cmake.in \
src/libzmq.vers \
tools/curve_keygen.cpp
MAINTAINERCLEANFILES = \
$(srcdir)/aclocal.m4 \
$(srcdir)/autom4te.cache \
$(srcdir)/configure \
$(srcdir)/aclocal.m4 \
$(srcdir)/autom4te.cache \
$(srcdir)/configure \
`find "$(srcdir)" -type f -name Makefile.in -print`
dist-hook:
-rm $(distdir)/src/platform.hpp
@if test -d "$(srcdir)/.git"; \
then \
echo Creating ChangeLog && \
@ -34,8 +627,7 @@ dist-hook:
echo A git clone is required to generate a ChangeLog >&2; \
fi
-cp $(top_srcdir)/builds/redhat/zeromq.spec $(distdir)/zeromq.spec
-rm -rf $(distdir)/foreign/openpgm/build-staging
distclean-local:
-rm -rf $(top_srcdir)/foreign/openpgm/build-staging
maintainer-clean-local:
-rm -rf $(top_srcdir)/config

55
NEWS
View File

@ -1,3 +1,58 @@
0MQ version 4.1.0 rc1, released on 2014/10/14
=============================================
* Many changes, see ChangeLog.
0MQ version 4.0.5 stable, released on 2014/10/14
================================================
* Fixed #1191; CURVE mechanism does not verify short term nonces.
* Fixed #1190; stream_engine is vulnerable to downgrade attacks.
* Fixed #1088; assertion failure for WSAENOTSOCK on Windows.
* Fixed #1015; race condition while connecting inproc sockets.
* Fixed #994; bump so library number to 4.0.0
* Fixed #939, assertion failed: !more (fq.cpp:99) after many ZAP requests.
* Fixed #872; lost first part of message over inproc://.
* Fixed #797, keep-alive on Windows.
0MQ version 4.0.4 stable, released on 2014/03/10
================================================
Bug Fixes
---------
* Fixed #909; out of tree build issue on Linux.
* Fixed #888; hangs on terminate when inproc connected but never bound.
* Fixed #868; assertion failure at ip.cpp:137 when using port scanner.
* Fixed #818; fix timestamp counter on s390/s390x.
* Fixed #817; only export zmq_* symbols.
* Fixed #797; fixed setting TCP keepalive on Windows.
* Fixed #775; compile error on Windows.
* Fixed #763; when talking to a ZMTP v1 peer (libzmq 2.2), a socket would
send an extra identity frame at the start of the connection.
* Fixed LIBZMQ-576 - Crash closing a socket after zmq_msg_send returns
EAGAIN (reverts LIBZMQ-497)
* Fixed LIBZMQ-584; subscription filters getting lost on reconnection.
0MQ version 4.0.3 stable, released on 2013/11/24
================================================

View File

@ -72,29 +72,29 @@ PERF_DIST = vs2008/local_lat/local_lat.vcproj \
vs2013/inproc_lat/inproc_lat.props \
vs2013/inproc_thr/inproc_thr.props
PROPERTIES_DIST = properties/Common.props
properties/DebugDEXE.props
properties/DebugDLL.props
properties/DebugLEXE.props
properties/DebugLIB.props
properties/DebugLTCG.props
properties/Debug.props
properties/DebugSEXE.props
properties/DLL.props
properties/EXE.props
properties/LIB.props
properties/Link.props
properties/LTCG.props
properties/Messages.props
properties/Output.props
properties/ReleaseDEXE.props
properties/ReleaseDLL.props
properties/ReleaseLEXE.props
properties/ReleaseLIB.props
properties/ReleaseLTCG.props
properties/Release.props
properties/ReleaseSEXE.props
properties/Win32.props
PROPERTIES_DIST = properties/Common.props \
properties/DebugDEXE.props \
properties/DebugDLL.props \
properties/DebugLEXE.props \
properties/DebugLIB.props \
properties/DebugLTCG.props \
properties/Debug.props \
properties/DebugSEXE.props \
properties/DLL.props \
properties/EXE.props \
properties/LIB.props \
properties/Link.props \
properties/LTCG.props \
properties/Messages.props \
properties/Output.props \
properties/ReleaseDEXE.props \
properties/ReleaseDLL.props \
properties/ReleaseLEXE.props \
properties/ReleaseLIB.props \
properties/ReleaseLTCG.props \
properties/Release.props \
properties/ReleaseSEXE.props \
properties/Win32.props \
properties/x64.props
PRECOMPILED_DIST = ../../src/precompiled.hpp \

View File

@ -0,0 +1,307 @@
#!/usr/bin/env bash
#
# Copyright (c) 2014, Joe Eli McIlvain
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
#
###
#
# https://github.com/jemc/android_build_helper
# android_build_helper.sh
#
# The following is a helper script for setting up android builds for
# "native" libraries maintained with an autotools build system.
# It merely helps to create the proper cross-compile environment.
# It makes no attempt to wrap the library or make it accessible to Java code;
# the intention is to make the bare library available to other "native" code.
#
# To get the latest version of this script, please download from:
# https://github.com/jemc/android_build_helper
#
# You are free to modify this script, but if you add improvements,
# please consider submitting a pull request to the aforementioned upstream
# repository for the benefit of other users.
#
# Get directory of current script (if not already set)
# This directory is also the basis for the build directories the get created.
if [ -z "$ANDROID_BUILD_DIR" ]; then
ANDROID_BUILD_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
fi
# Set up a variable to hold the global failure reasons, separated by newlines
# (Empty string indicates no failure)
ANDROID_BUILD_FAIL=()
function android_build_check_fail {
if [ ! ${#ANDROID_BUILD_FAIL[@]} -eq 0 ]; then
echo "Android build failed for the following reasons:"
for reason in "${ANDROID_BUILD_FAIL[@]}"; do
local formatted_reason=" ${reason}"
echo "${formatted_reason}"
done
exit 1
fi
}
function android_build_env {
##
# Check that necessary environment variables are set
if [ -z "$ANDROID_NDK_ROOT" ]; then
ANDROID_BUILD_FAIL+=("Please set the ANDROID_NDK_ROOT environment variable")
ANDROID_BUILD_FAIL+=(" (eg. \"/home/user/android/android-ndk-r9d\")")
fi
if [ -z "$TOOLCHAIN_PATH" ]; then
ANDROID_BUILD_FAIL+=("Please set the TOOLCHAIN_PATH environment variable")
ANDROID_BUILD_FAIL+=(" (eg. \"/home/user/android/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin\")")
fi
if [ -z "$TOOLCHAIN_NAME" ]; then
ANDROID_BUILD_FAIL+=("Please set the TOOLCHAIN_NAME environment variable")
ANDROID_BUILD_FAIL+=(" (eg. \"arm-linux-androideabi-4.8\")")
fi
if [ -z "$TOOLCHAIN_HOST" ]; then
ANDROID_BUILD_FAIL+=("Please set the TOOLCHAIN_HOST environment variable")
ANDROID_BUILD_FAIL+=(" (eg. \"arm-linux-androideabi\")")
fi
if [ -z "$TOOLCHAIN_ARCH" ]; then
ANDROID_BUILD_FAIL+=("Please set the TOOLCHAIN_ARCH environment variable")
ANDROID_BUILD_FAIL+=(" (eg. \"arm\")")
fi
android_build_check_fail
##
# Check that directories given by environment variables exist
if [ ! -d "$ANDROID_NDK_ROOT" ]; then
ANDROID_BUILD_FAIL+=("The ANDROID_NDK_ROOT directory does not exist")
ANDROID_BUILD_FAIL+=(" ${ANDROID_NDK_ROOT}")
fi
if [ ! -d "$TOOLCHAIN_PATH" ]; then
ANDROID_BUILD_FAIL+=("The TOOLCHAIN_PATH directory does not exist")
ANDROID_BUILD_FAIL+=(" ${TOOLCHAIN_PATH}")
fi
##
# Set up some local variables and check them
ANDROID_BUILD_SYSROOT="${ANDROID_NDK_ROOT}/platforms/android-9/arch-${TOOLCHAIN_ARCH}"
if [ ! -d "$ANDROID_BUILD_SYSROOT" ]; then
ANDROID_BUILD_FAIL+=("The ANDROID_BUILD_SYSROOT directory does not exist")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_SYSROOT}")
fi
ANDROID_BUILD_PREFIX="${ANDROID_BUILD_DIR}/prefix/${TOOLCHAIN_NAME}"
mkdir -p "$ANDROID_BUILD_PREFIX" || {
ANDROID_BUILD_FAIL+=("Failed to make ANDROID_BUILD_PREFIX directory")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_PREFIX}")
}
android_build_check_fail
}
function _android_build_opts_process_binaries {
local CPP="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-cpp"
local CC="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-gcc"
local CXX="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-g++"
local LD="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ld"
local AS="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-as"
local AR="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ar"
local RANLIB="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ranlib"
if [ ! -x "${CPP}" ]; then
ANDROID_BUILD_FAIL+=("The CPP binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${CPP}")
fi
if [ ! -x "${CC}" ]; then
ANDROID_BUILD_FAIL+=("The CC binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${CC}")
fi
if [ ! -x "${CXX}" ]; then
ANDROID_BUILD_FAIL+=("The CXX binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${CXX}")
fi
if [ ! -x "${LD}" ]; then
ANDROID_BUILD_FAIL+=("The LD binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${LD}")
fi
if [ ! -x "${AS}" ]; then
ANDROID_BUILD_FAIL+=("The AS binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${AS}")
fi
if [ ! -x "${AR}" ]; then
ANDROID_BUILD_FAIL+=("The AR binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${AR}")
fi
if [ ! -x "${RANLIB}" ]; then
ANDROID_BUILD_FAIL+=("The RANLIB binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${RANLIB}")
fi
ANDROID_BUILD_OPTS+=("CPP=${CPP}")
ANDROID_BUILD_OPTS+=("CC=${CC}")
ANDROID_BUILD_OPTS+=("CXX=${CXX}")
ANDROID_BUILD_OPTS+=("LD=${LD}")
ANDROID_BUILD_OPTS+=("AS=${AS}")
ANDROID_BUILD_OPTS+=("AR=${AR}")
ANDROID_BUILD_OPTS+=("RANLIB=${RANLIB}")
android_build_check_fail
}
function _android_build_opts_process_cxx_stl {
case "${ANDROID_BUILD_CXXSTL}" in
stlport_static)
LIBS+=" -lstlport_static"
CPPFLAGS+=" -I${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/stlport"
case "${TOOLCHAIN_ARCH}" in
arm)
LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/libs/armeabi"
;;
x86)
LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/libs/x86"
;;
mips)
LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/libs/mips"
;;
*)
ANDROID_BUILD_FAIL+=("Unknown combination for ANDROID_BUILD_CXXSTL and TOOLCHAIN_ARCH")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_CXXSTL}")
ANDROID_BUILD_FAIL+=(" ${TOOLCHAIN_ARCH}")
;;
esac
;;
gnustl_shared_48)
LIBS+=" -lgnustl_shared"
CPPFLAGS+=" -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.8/include"
case "${TOOLCHAIN_ARCH}" in
arm)
LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi"
CPPFLAGS+=" -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include"
;;
x86)
LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86"
CPPFLAGS+=" -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include"
;;
mips)
LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips"
CPPFLAGS+=" -I${ANDROID_NDK_ROOT}/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include"
;;
*)
ANDROID_BUILD_FAIL+=("Unknown combination for ANDROID_BUILD_CXXSTL and TOOLCHAIN_ARCH")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_CXXSTL}")
ANDROID_BUILD_FAIL+=(" ${TOOLCHAIN_ARCH}")
;;
esac
;;
'');;
*)
ANDROID_BUILD_FAIL+=("Unknown value for ANDROID_BUILD_CXXSTL")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_CXXSTL}")
;;
esac
}
# Set the ANDROID_BUILD_OPTS variable to a bash array of configure options
function android_build_opts {
ANDROID_BUILD_OPTS=()
local CFLAGS="--sysroot=${ANDROID_BUILD_SYSROOT} -I${ANDROID_BUILD_PREFIX}/include"
local CPPFLAGS="--sysroot=${ANDROID_BUILD_SYSROOT} -I${ANDROID_BUILD_PREFIX}/include"
local CXXFLAGS="--sysroot=${ANDROID_BUILD_SYSROOT} -I${ANDROID_BUILD_PREFIX}/include"
local LDFLAGS="-L${ANDROID_BUILD_PREFIX}/lib"
local LIBS="-lc -lgcc -ldl"
_android_build_opts_process_binaries
_android_build_opts_process_cxx_stl
ANDROID_BUILD_OPTS+=("CFLAGS=${CFLAGS} ${ANDROID_BUILD_EXTRA_CFLAGS}")
ANDROID_BUILD_OPTS+=("CPPFLAGS=${CPPFLAGS} ${ANDROID_BUILD_EXTRA_CPPFLAGS}")
ANDROID_BUILD_OPTS+=("CXXFLAGS=${CXXFLAGS} ${ANDROID_BUILD_EXTRA_CXXFLAGS}")
ANDROID_BUILD_OPTS+=("LDFLAGS=${LDFLAGS} ${ANDROID_BUILD_EXTRA_LDFLAGS}")
ANDROID_BUILD_OPTS+=("LIBS=${LIBS} ${ANDROID_BUILD_EXTRA_LIBS}")
ANDROID_BUILD_OPTS+=("PKG_CONFIG_PATH=${ANDROID_BUILD_PREFIX}/lib/pkgconfig")
ANDROID_BUILD_OPTS+=("--host=${TOOLCHAIN_HOST}")
ANDROID_BUILD_OPTS+=("--prefix=${ANDROID_BUILD_PREFIX}")
android_build_check_fail
}
# Parse readelf output to verify the correct linking of libraries.
# The first argument should be the soname of the newly built library.
# The rest of the arguments should be the sonames of dependencies.
# All sonames should be unversioned for android (no trailing numbers).
function android_build_verify_so {
local soname="$1"
shift # Get rid of first argument - the rest represent dependencies
local sofile="${ANDROID_BUILD_PREFIX}/lib/${soname}"
if [ ! -f "${sofile}" ]; then
ANDROID_BUILD_FAIL+=("Found no library named ${soname}")
ANDROID_BUILD_FAIL+=(" ${sofile}")
fi
android_build_check_fail
local elfoutput=$(readelf -d ${sofile})
local soname_regexp='soname: \[([[:alnum:]\.]+)\]'
if [[ $elfoutput =~ $soname_regexp ]]; then
local parsed_soname="${BASH_REMATCH[1]}"
if [ "${parsed_soname}" != "${soname}" ]; then
ANDROID_BUILD_FAIL+=("Actual soname of library ${soname} is incorrect (or versioned):")
ANDROID_BUILD_FAIL+=(" ${parsed_soname}")
fi
else
ANDROID_BUILD_FAIL+=("Failed to meaningfully parse readelf output for library ${soname}:")
ANDROID_BUILD_FAIL+=(" ${elfoutput}")
fi
for dep_soname do
if [[ $elfoutput != *"library: [${dep_soname}]"* ]]; then
ANDROID_BUILD_FAIL+=("Library ${soname} was expected to be linked to library with soname:")
ANDROID_BUILD_FAIL+=(" ${dep_soname}")
fi
done
android_build_check_fail
}

56
builds/qt-android/build.sh Executable file
View File

@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Use directory of current script as the build directory and working directory
cd "$( dirname "${BASH_SOURCE[0]}" )"
ANDROID_BUILD_DIR="$(pwd)"
# Get access to android_build functions and variables
source ${ANDROID_BUILD_DIR}/android_build_helper.sh
# Choose a C++ standard library implementation from the ndk
ANDROID_BUILD_CXXSTL="gnustl_shared_48"
# Set up android build environment and set ANDROID_BUILD_OPTS array
android_build_env
android_build_opts
# Use a temporary build directory
cache="/tmp/android_build/${TOOLCHAIN_NAME}"
mkdir -p "${cache}"
##
# Build libsodium from latest release tarball
(android_build_verify_so "libsodium.so" &> /dev/null) || {
rm -rf "${cache}/libsodium"
(cd "${cache}" && mkdir libsodium \
&& wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz\
-O "${cache}/libsodium.tar.gz" \
&& tar -C libsodium -xf libsodium.tar.gz --strip=1) || exit 1
(cd "${cache}/libsodium" && ./autogen.sh \
&& ./configure "${ANDROID_BUILD_OPTS[@]}" --disable-soname-versions \
&& make \
&& make install) || exit 1
}
##
# Build libzmq from local source
LIBTOOL_EXTRA_LDFLAGS='-avoid-version'
(android_build_verify_so "libzmq.so" "libsodium.so" &> /dev/null) || {
rm -rf "${cache}/libzmq"
(cp -r ../.. "${cache}/libzmq" && cd "${cache}/libzmq" && make clean)
(cd "${cache}/libzmq" && ./autogen.sh \
&& ./configure "${ANDROID_BUILD_OPTS[@]}" --with-libsodium=yes \
&& make \
&& make install) || exit 1
}
##
# Verify shared libraries in prefix
android_build_verify_so "libsodium.so"
android_build_verify_so "libzmq.so" "libsodium.so"

14
builds/qt-android/ci_build.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
(cd '/tmp' \
&& wget http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2 \
&& tar -xf android-ndk-r9-linux-x86_64.tar.bz2 \
&& mv android-ndk-r9 android-ndk)
export ANDROID_NDK_ROOT="/tmp/android-ndk"
export TOOLCHAIN_PATH="/tmp/android-ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin"
export TOOLCHAIN_NAME="arm-linux-androideabi-4.8"
export TOOLCHAIN_HOST="arm-linux-androideabi"
export TOOLCHAIN_ARCH="arm"
source ./build.sh

View File

@ -11,20 +11,36 @@ Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: gcc, make, gcc-c++, libstdc++-devel, asciidoc, xmlto
Requires: libstdc++
%if %{?rhel}%{!?rhel:0} >= 6
BuildRequires: libuuid-devel
Requires: libuuid
%elseif %{?rhel}%{!?rhel:0} >= 5
BuildRequires: e2fsprogs-devel
Requires: e2fsprogs
%else
BuildRequires: uuid-devel
Requires: uuid
%endif
#
# Conditional build options
# Default values are:
# --without-libgssapi_krb5
# --without-libsodium
# --without-pgm
#
# If neither macro exists, use the default value.
%{!?_with_libgssapi_krb5: %{!?_without_libgssapi_krb5: %define _without_libgssapi_krb5 --without-liblibgssapi_krb5}}
%{!?_with_libsodium: %{!?_without_libsodium: %define _without_libsodium --without-libsodium}}
%{!?_with_pgm: %{!?_without_pgm: %define _without_pgm --without-pgm}}
# It's an error if both --with and --without options are specified
%{?_with_libgssapi_krb5: %{?_without_libgssapi_krb5: %{error: both _with_libgssapi_krb5 and _without_libgssapi_krb5}}}
%{?_with_libsodium: %{?_without_libsodium: %{error: both _with_libsodium and _without_libsodium}}}
%{?_with_pgm: %{?_without_pgm: %{error: both _with_pgm and _without_pgm}}}
%{?_with_libgssapi_krb5:BuildRequires: krb5-devel}
%{?_with_libgssapi_krb5:Requires: krb5-libs}
%{?_with_libsodium:BuildRequires: libsodium-devel}
%{?_with_libsodium:Requires: libsodium}
%{?_with_pgm:BuildRequires: openpgm-devel}
%{?_with_pgm:Requires: openpgm}
# Build pgm only on supported archs
%ifarch pentium3 pentium4 athlon i386 i486 i586 i686 x86_64
BuildRequires: python, perl
%{!?_with_pic: %{!?_without_pic: %define _with_pic --with-pic}}
%{!?_with_gnu_ld: %{!?_without_gnu_ld: %define _with_gnu_ld --with-gnu_ld}}
%endif
%description
@ -56,11 +72,17 @@ This package contains ZeroMQ related development libraries and header files.
%setup -q
%build
%ifarch pentium3 pentium4 athlon i386 i486 i586 i686 x86_64
%configure --with-pgm --with-pic --with-gnu-ld
%else
%configure
%endif
%configure \
%{?_with_libsodium} \
%{?_without_libsodium} \
%{?_with_pgm} \
%{?_without_pgm} \
%{?_with_libgssapi_krb5} \
%{?_without_libgssapi_krb5} \
%{?_with_pic} \
%{?_without_pic} \
%{?_with_gnu_ld} \
%{?_without_gnu_ld}
%{__make} %{?_smp_mflags}
@ -159,6 +181,13 @@ This package contains ZeroMQ related development libraries and header files.
%{_mandir}/man7/zmq_tipc.7.gz
%changelog
* Sat Oct 25 2014 Phillip Mienk <mienkphi@gmail.com>
- Add --with/--without libgssapi_krb5 support following J.T.Conklin's pattern
* Sat Oct 18 2014 J.T. Conklin <jtc@acorntoolworks.com>
- Add --with/--without pgm support
- Add --with/--without libsodium support
* Tue Jun 10 2014 Tristian Celestin <tristian.celestin@outlook.com> 4.0.4
- Updated packaged files

15
ci_build.sh Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
if [ $BUILD_TYPE == "default" ]; then
# Build required projects first
# libsodium
git clone git://github.com/jedisct1/libsodium.git
( cd libsodium; ./autogen.sh; ./configure; make check; sudo make install; sudo ldconfig )
# Build and check this project
./autogen.sh && ./configure --with-libsodium=yes && make && make check
sudo make install
else
cd ./builds/${BUILD_TYPE} && ./ci_build.sh
fi

View File

@ -11,7 +11,8 @@ AC_INIT([zeromq],[m4_esyscmd([./version.sh])],[zeromq-dev@lists.zeromq.org])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AC_CONFIG_HEADERS([src/platform.hpp])
AM_INIT_AUTOMAKE(tar-ustar dist-zip foreign)
AM_INIT_AUTOMAKE(foreign subdir-objects tar-ustar dist-zip)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# This lets us use PACKAGE_VERSION in Makefiles
@ -47,6 +48,8 @@ AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_SED
AC_PROG_AWK
PKG_PROG_PKG_CONFIG
m4_pattern_forbid([^PKG_[A-Z_]+$], [missing some pkg-config macros (pkg-config package)])
# Libtool configuration for different targets. See acinclude.m4
AC_ARG_VAR([XMLTO], [Path to xmlto command])
@ -63,80 +66,48 @@ LIBZMQ_CHECK_ENABLE_DEBUG
# Check wheter to enable code coverage
LIBZMQ_WITH_GCOV
AC_MSG_CHECKING([if TIPC is available and supports nonblocking connect])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/tipc.h>
]],[[
struct sockaddr_tipc topsrv;
int sd = socket(AF_TIPC, SOCK_SEQPACKET, 0);
if (sd == -EAFNOSUPPORT) {
return 1;
}
memset(&topsrv, 0, sizeof(topsrv));
topsrv.family = AF_TIPC;
topsrv.addrtype = TIPC_ADDR_NAME;
topsrv.addr.name.name.type = TIPC_TOP_SRV;
topsrv.addr.name.name.instance = TIPC_TOP_SRV;
fcntl(sd, F_SETFL, O_NONBLOCK);
if (connect(sd, (struct sockaddr *)&topsrv,
sizeof(topsrv)) != 0) {
if (errno != EINPROGRESS)
return -1;
}]])
],
[libzmq_tipc_support=yes],
[libzmq_tipc_support=no],
[libzmq_tipc_support=no])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/tipc.h>
]],[[
struct sockaddr_tipc topsrv;
int sd = socket(AF_TIPC, SOCK_SEQPACKET, 0);
if (sd == -EAFNOSUPPORT) {
return 1;
}
memset(&topsrv, 0, sizeof(topsrv));
topsrv.family = AF_TIPC;
topsrv.addrtype = TIPC_ADDR_NAME;
topsrv.addr.name.name.type = TIPC_TOP_SRV;
topsrv.addr.name.name.instance = TIPC_TOP_SRV;
fcntl(sd, F_SETFL, O_NONBLOCK);
if (connect(sd, (struct sockaddr *)&topsrv, sizeof(topsrv)) != 0) {
if (errno != EINPROGRESS)
return -1;
}
]])
],
[libzmq_tipc_support=yes],
[libzmq_tipc_support=no],
[libzmq_tipc_support=no])
AC_MSG_RESULT([$libzmq_tipc_support])
# Allow libsodium to be installed in a custom path:
AC_ARG_WITH([libsodium],
[AS_HELP_STRING([--with-libsodium],
[Specify libsodium prefix])],
[zmq_search_libsodium="yes"],
[])
if test "x$zmq_search_libsodium" = "xyes"; then
if test -r "${with_libsodium}/include/sodium.h"; then
CPPFLAGS="-I${with_libsodium}/include ${CPPFLAGS}"
LDFLAGS="-L${with_libsodium}/lib ${LDFLAGS}"
fi
fi
AC_ARG_WITH([libsodium-include-dir],
[AS_HELP_STRING([--with-libsodium-include-dir],
[Specify libsodium include prefix])],
[zmq_search_libsodium_include="yes"],
[])
if test "x$zmq_search_libsodium_include" = "xyes"; then
if test -r "${with_libsodium_include_dir}/sodium.h"; then
CPPFLAGS="-I${with_libsodium_include_dir}/include ${CPPFLAGS}"
fi
fi
AC_ARG_WITH([libsodium_lib_dir],
[AS_HELP_STRING([--with-libsodium-lib-dir],
[Specify libsodium library prefix])],
[zmq_search_libsodium_lib="yes"],
[])
if test "x$zmq_search_libsodium_lib" = "xyes"; then
if test -r "${with_libsodium_lib_dir}/libsodium.{a|so|dylib}"; then
LDFLAGS="-L${with_libsodium}/lib ${LDFLAGS}"
fi
fi
AC_ARG_WITH([relaxed],
[AS_HELP_STRING([--with-relaxed],
[Switch off pedantic compiler])],
[zmq_relaxed="yes"],
[])
[AS_HELP_STRING([--with-relaxed],
[Switch off pedantic compiler])],
[zmq_relaxed="yes"],
[])
if test "x$zmq_relaxed" = "xyes"; then
libzmq_pedantic="no"
@ -145,10 +116,10 @@ else
fi
AC_ARG_WITH([militant],
[AS_HELP_STRING([--with-militant],
[Enable militant API assertions])],
[zmq_militant="yes"],
[])
[AS_HELP_STRING([--with-militant],
[Enable militant API assertions])],
[zmq_militant="yes"],
[])
if test "x$zmq_militant" = "xyes"; then
AC_DEFINE(ZMQ_ACT_MILITANT, 1, [Enable militant API assertions])
@ -310,13 +281,6 @@ esac
# Checks for libraries
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([rt], [clock_gettime])
if test "x$zmq_search_libsodium" = "xyes"; then
AC_CHECK_LIB([sodium], [sodium_init],,AC_MSG_ERROR(libsodium is not installed. Install it or don't pass --with-libsodium to configure script))
else
AC_CHECK_LIB([sodium], [sodium_init],,AC_MSG_WARN(libsodium is needed for CURVE security))
fi
AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],,AC_MSG_WARN(libgssapi_krb5 is needed for GSSAPI security))
#
# Check if the compiler supports -fvisibility=hidden flag. MinGW32 uses __declspec
@ -343,12 +307,23 @@ LIBZMQ_CHECK_DOC_BUILD
# Check polling system
LIBZMQ_CHECK_POLLER([CPPFLAGS="${CPPFLAGS} -D${libzmq_cv_poller_flag}"],
[AC_MSG_ERROR([Unable to continue without polling system])])
[AC_MSG_ERROR([Unable to continue without polling system])])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(errno.h arpa/inet.h netinet/tcp.h netinet/in.h stddef.h \
stdlib.h string.h sys/socket.h sys/time.h time.h unistd.h limits.h)
AC_CHECK_HEADERS(\
errno.h \
time.h \
unistd.h \
limits.h \
stddef.h \
stdlib.h \
string.h \
arpa/inet.h \
netinet/tcp.h \
netinet/in.h \
sys/socket.h \
sys/time.h)
# Check if we have ifaddrs.h header file.
AC_CHECK_HEADERS(ifaddrs.h, [AC_DEFINE(ZMQ_HAVE_IFADDRS, 1, [Have ifaddrs.h header.])])
@ -357,25 +332,36 @@ AC_CHECK_HEADERS(ifaddrs.h, [AC_DEFINE(ZMQ_HAVE_IFADDRS, 1, [Have ifaddrs.h head
AC_CHECK_HEADERS(sys/uio.h, [AC_DEFINE(ZMQ_HAVE_UIO, 1, [Have uio.h header.])])
# Force not to use eventfd
AC_ARG_ENABLE([eventfd], [AS_HELP_STRING([--disable-eventfd], [disable eventfd [default=no]])],
[zmq_disable_eventfd=yes], [zmq_disable_eventfd=no])
AC_ARG_ENABLE([eventfd],
[AS_HELP_STRING([--disable-eventfd], [disable eventfd [default=no]])],
[zmq_enable_eventfd=$enableval],
[zmq_enable_eventfd=yes])
if test "x$zmq_disable_eventfd" != "xyes"; then
if test "x$zmq_enable_eventfd" = "xyes"; then
# Check if we have eventfd.h header file.
AC_CHECK_HEADERS(sys/eventfd.h,
[AC_DEFINE(ZMQ_HAVE_EVENTFD, 1, [Have eventfd extension.])])
[AC_DEFINE(ZMQ_HAVE_EVENTFD, 1, [Have eventfd extension.])])
fi
# Use c++ in subsequent tests
AC_LANG_PUSH(C++)
AC_CHECK_DECLS([SO_PEERCRED], [AC_DEFINE(ZMQ_HAVE_SO_PEERCRED, 1, [Have SO_PEERCRED socket option])], [], [#include <sys/socket.h>])
AC_CHECK_DECLS([LOCAL_PEERCRED], [AC_DEFINE(ZMQ_HAVE_LOCAL_PEERCRED, 1, [Have LOCAL_PEERCRED socket option])], [], [#include <sys/socket.h>])
AC_CHECK_DECLS([SO_PEERCRED],
[AC_DEFINE(ZMQ_HAVE_SO_PEERCRED, 1, [Have SO_PEERCRED socket option])],
[],
[#include <sys/socket.h>])
AC_CHECK_DECLS([LOCAL_PEERCRED],
[AC_DEFINE(ZMQ_HAVE_LOCAL_PEERCRED, 1, [Have LOCAL_PEERCRED socket option])],
[],
[#include <sys/socket.h>])
AM_CONDITIONAL(HAVE_IPC_PEERCRED, test "x$ac_cv_have_decl_SO_PEERCRED" = "xyes" || test "x$ac_cv_have_decl_LOCAL_PEERCRED" = "xyes")
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
# Checks for typedefs, structures, and compiler characteristics.
if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
dnl 279: controlling expression is constant
@ -386,117 +372,89 @@ else
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
fi
AC_HEADER_TIME
AC_TYPE_UINT32_T
AC_C_VOLATILE
# PGM extension
libzmq_pgm_ext="no"
# build using libgssapi_krb5
AC_ARG_WITH([libgssapi_krb5], [AS_HELP_STRING([--with-libgssapi_krb5],
[require libzmq build with libgssapi_krb5 [default=no]])],
[require_libgssapi_krb5_ext=$withval],
[require_libgssapi_krb5_ext=no])
pgm_basename="libpgm-5.2.122~dfsg"
# conditionally require libgssapi_krb5
if test "x$require_libgssapi_krb5_ext" != "xno"; then
AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],,
AC_MSG_ERROR(libgssapi_krb5 is needed for GSSAPI security))
fi
AC_ARG_WITH([pgm], [AS_HELP_STRING([--with-pgm],
[build libzmq with PGM extension [default=no]])],
[with_pgm_ext=$withval], [with_pgm_ext=no])
# build using libsodium
have_sodium_library="no"
# build using system pgm
AC_ARG_WITH([system-pgm], [AS_HELP_STRING([--with-system-pgm],
AC_ARG_WITH([libsodium], [AS_HELP_STRING([--with-libsodium],
[require libzmq build with libsodium. Requires pkg-config [default=no]])],
[require_libsodium_ext=$withval],
[require_libsodium_ext=yes])
# conditionally require libsodium package
if test "x$require_libsodium_ext" != "xno"; then
PKG_CHECK_MODULES([sodium], [libsodium], [have_sodium_library="yes"])
fi
if test "x$have_sodium_library" != "xno"; then
AC_DEFINE(HAVE_LIBSODIUM, 1, [The libsodium library is to be used.])
fi
AM_CONDITIONAL(HAVE_SODIUM, test "x$have_sodium_library" != "xno")
# build using pgm
have_pgm_library="no"
AC_ARG_WITH([pgm], [AS_HELP_STRING([--with-pgm],
[build libzmq with PGM extension. Requires pkg-config [default=no]])],
[with_system_pgm_ext=yes], [with_system_pgm_ext=no])
if test "x$with_pgm_ext" != "xno" -a "x$with_system_pgm_ext" != "xno"; then
AC_MSG_ERROR([--with-pgm and --with-system-pgm cannot be specified together])
fi
[with_pgm_ext=$withval],
[with_pgm_ext=no])
# conditionally require pgm package
if test "x$with_pgm_ext" != "xno"; then
# This allows placing the tar.gz to foreign/openpgm
# and using ./configure --with-pgm=libpgm-x.y.z
if test "x$with_pgm_ext" != "xyes"; then
pgm_basename="$with_pgm_ext"
fi
# Unpack libpgm
AC_MSG_NOTICE([Unpacking ${pgm_basename}.tar.gz])
libzmq_pwd=`pwd`
cd foreign/openpgm
if ! (gzip -dc "${pgm_basename}.tar.gz" || echo "failed") | ${am__untar}; then
AC_MSG_ERROR([cannot unpack the foreign/openpgm/${pgm_basename}.tar.gz file])
fi
cd "${libzmq_pwd}"
if test -d foreign/openpgm/build-staging; then
rm -rf foreign/openpgm/build-staging
fi
mv foreign/openpgm/${pgm_basename} foreign/openpgm/build-staging
pgm_srcdir=foreign/openpgm/build-staging/openpgm/pgm
if ! test -d foreign/openpgm/build-staging/openpgm/pgm/config; then
mkdir foreign/openpgm/build-staging/openpgm/pgm/config
fi
# DSO symbol visibility for openpgm
AC_LANG_PUSH([C])
LIBZMQ_CHECK_LANG_VISIBILITY([ac_configure_args="CFLAGS='$libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag' ${ac_configure_args}"])
AC_LANG_POP([C])
pgm_subdir=build-staging/openpgm/pgm
AC_SUBST(pgm_subdir)
AC_SUBST(pgm_srcdir)
AC_CONFIG_SUBDIRS([foreign/openpgm/build-staging/openpgm/pgm/])
# Success!
AC_DEFINE(ZMQ_HAVE_OPENPGM, 1, [Have OpenPGM extension])
libzmq_pgm_ext="yes"
PKG_CHECK_MODULES([pgm], [openpgm-5.2 >= 5.2], [ have_pgm_library="yes" ],
[PKG_CHECK_MODULES([pgm], [openpgm-5.1 >= 5.1],
[ have_pgm_library="yes" ])])
fi
# Build with system openpgm
if test "x$with_system_pgm_ext" != "xno"; then
m4_ifdef([PKG_CHECK_MODULES], [
have_pgm_system_library="no"
PKG_CHECK_MODULES([OpenPGM], [openpgm-5.2 >= 5.2],
[ have_pgm_system_library="yes" ],
[PKG_CHECK_MODULES([OpenPGM], [openpgm-5.1 >= 5.1],
[ have_pgm_system_library="yes" ])
]
)
if test "x$have_pgm_system_library" = "xyes"; then
AC_DEFINE(ZMQ_HAVE_OPENPGM, 1, [Have OpenPGM extension])
LIBZMQ_EXTRA_CXXFLAGS="$OpenPGM_CFLAGS $LIBZMQ_EXTRA_CXXFLAGS"
LIBS="$OpenPGM_LIBS $LIBS"
fi
],
[AC_MSG_ERROR([--with-system-pgm requires a working pkg-config installation])])
if test "x$have_pgm_library" = "xyes"; then
AC_DEFINE(ZMQ_HAVE_OPENPGM, [1], [Have OpenPGM extension])
fi
AC_SUBST(pgm_basename)
AM_CONDITIONAL(HAVE_PGM, test "x$have_pgm_library" = "xyes")
# This uses "--with-norm" to point to the "norm" directory
# for "norm/include" and "norm/lib"
#(if "--with-norm=yes" is given, then assume installed on system)
AC_ARG_WITH([norm], [AS_HELP_STRING([--with-norm],
[build libzmq with NORM protocol extension, optionally specifying norm path [default=no]])],
[with_norm_ext=$withval], [with_norm_ext=no])
AC_ARG_WITH([norm],
[AS_HELP_STRING([--with-norm],
[build libzmq with NORM protocol extension, optionally specifying norm path [default=no]])],
[with_norm_ext=$withval],
[with_norm_ext=no])
AC_MSG_CHECKING("with_norm_ext = ${with_norm_ext}")
if test "x$with_norm_ext" != "xno"; then
if test "x$with_norm_ext" != "xno"; then
AC_DEFINE(ZMQ_HAVE_NORM, 1, [Have NORM protocol extension])
if test "x$wwith_norm_ext" != "xyes"; then
norm_path="${with_norm_ext}"
LIBZMQ_EXTRA_CXXFLAGS="-I${norm_path}/include ${LIBZMQ_EXTRA_CXXFLAGS}"
LIBZMQ_EXTRA_LDFLAGS="-I${norm_path}/include ${LIBZMQ_EXTRA_LDFLAGS}"
fi
LIBS="-lnorm $LIBS"
fi
# Set -Wall, -Werror and -pedantic
AC_LANG_PUSH([C++])
@ -513,7 +471,6 @@ fi
AC_LANG_POP([C++])
AM_CONDITIONAL(BUILD_TIPC, test "x$libzmq_tipc_support" = "xyes")
AM_CONDITIONAL(BUILD_PGM, test "x$libzmq_pgm_ext" = "xyes")
AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes")
AM_CONDITIONAL(ON_ANDROID, test "x$libzmq_on_android" = "xyes")
AM_CONDITIONAL(ON_LINUX, test "x$libzmq_on_linux" = "xyes")
@ -522,38 +479,43 @@ AM_CONDITIONAL(ON_LINUX, test "x$libzmq_on_linux" = "xyes")
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(perror gettimeofday clock_gettime memset socket getifaddrs freeifaddrs fork)
AC_CHECK_HEADERS([alloca.h])
LIBZMQ_CHECK_SOCK_CLOEXEC([AC_DEFINE(
[ZMQ_HAVE_SOCK_CLOEXEC],
[1],
[Whether SOCK_CLOEXEC is defined and functioning.])
])
LIBZMQ_CHECK_SOCK_CLOEXEC([
AC_DEFINE([ZMQ_HAVE_SOCK_CLOEXEC],
[1],
[Whether SOCK_CLOEXEC is defined and functioning.])
])
# TCP keep-alives Checks.
LIBZMQ_CHECK_SO_KEEPALIVE([AC_DEFINE(
[ZMQ_HAVE_SO_KEEPALIVE],
[1],
[Whether SO_KEEPALIVE is supported.])
])
LIBZMQ_CHECK_TCP_KEEPCNT([AC_DEFINE(
[ZMQ_HAVE_TCP_KEEPCNT],
[1],
[Whether TCP_KEEPCNT is supported.])
])
LIBZMQ_CHECK_TCP_KEEPIDLE([AC_DEFINE(
[ZMQ_HAVE_TCP_KEEPIDLE],
[1],
[Whether TCP_KEEPIDLE is supported.])
])
LIBZMQ_CHECK_TCP_KEEPINTVL([AC_DEFINE(
[ZMQ_HAVE_TCP_KEEPINTVL],
[1],
[Whether TCP_KEEPINTVL is supported.])
])
LIBZMQ_CHECK_TCP_KEEPALIVE([AC_DEFINE(
[ZMQ_HAVE_TCP_KEEPALIVE],
[1],
[Whether TCP_KEEPALIVE is supported.])
])
LIBZMQ_CHECK_SO_KEEPALIVE([
AC_DEFINE([ZMQ_HAVE_SO_KEEPALIVE],
[1],
[Whether SO_KEEPALIVE is supported.])
])
LIBZMQ_CHECK_TCP_KEEPCNT([
AC_DEFINE([ZMQ_HAVE_TCP_KEEPCNT],
[1],
[Whether TCP_KEEPCNT is supported.])
])
LIBZMQ_CHECK_TCP_KEEPIDLE([
AC_DEFINE([ZMQ_HAVE_TCP_KEEPIDLE],
[1],
[Whether TCP_KEEPIDLE is supported.])
])
LIBZMQ_CHECK_TCP_KEEPINTVL([
AC_DEFINE([ZMQ_HAVE_TCP_KEEPINTVL],
[1],
[Whether TCP_KEEPINTVL is supported.])
])
LIBZMQ_CHECK_TCP_KEEPALIVE([
AC_DEFINE([ZMQ_HAVE_TCP_KEEPALIVE],
[1],
[Whether TCP_KEEPALIVE is supported.])
])
AM_CONDITIONAL(HAVE_FORK, test "x$ac_cv_func_fork" = "xyes")
@ -562,14 +524,19 @@ AC_SUBST(LIBZMQ_EXTRA_CFLAGS)
AC_SUBST(LIBZMQ_EXTRA_CXXFLAGS)
AC_SUBST(LIBZMQ_EXTRA_LDFLAGS)
AC_CONFIG_FILES([Makefile \
src/Makefile \
# set pkgconfigdir, allow override
AC_ARG_WITH([pkgconfigdir],
AS_HELP_STRING([--with-pkgconfigdir=PATH],
[Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
[pkgconfigdir="$withval"],
[pkgconfigdir='${libdir}/pkgconfig'])
AC_SUBST([pkgconfigdir])
AC_CONFIG_FILES([ \
Makefile \
src/libzmq.pc \
doc/Makefile \
perf/Makefile \
tests/Makefile \
tools/Makefile \
builds/msvc/Makefile \
foreign/openpgm/Makefile \
builds/redhat/zeromq.spec])
AC_OUTPUT

View File

@ -1,3 +1,6 @@
#
# documentation
#
MAN3 = zmq_bind.3 zmq_unbind.3 zmq_connect.3 zmq_disconnect.3 zmq_close.3 \
zmq_ctx_new.3 zmq_ctx_term.3 zmq_ctx_get.3 zmq_ctx_set.3 zmq_ctx_shutdown.3 \
zmq_msg_init.3 zmq_msg_init_data.3 zmq_msg_init_size.3 \
@ -10,9 +13,13 @@ MAN3 = zmq_bind.3 zmq_unbind.3 zmq_connect.3 zmq_disconnect.3 zmq_close.3 \
zmq_errno.3 zmq_strerror.3 zmq_version.3 \
zmq_sendmsg.3 zmq_recvmsg.3 \
zmq_proxy.3 zmq_proxy_steerable.3 \
zmq_z85_encode.3 zmq_z85_decode.3 zmq_curve_keypair.3 zmq_has.3
zmq_z85_encode.3 zmq_z85_decode.3 zmq_curve_keypair.3 \
zmq_has.3 \
zmq_atomic_counter_new.3 zmq_atomic_counter_set.3 \
zmq_atomic_counter_inc.3 zmq_atomic_counter_dec.3 \
zmq_atomic_counter_value.3 zmq_atomic_counter_destroy.3
MAN7 = zmq.7 zmq_tcp.7 zmq_pgm.7 zmq_epgm.7 zmq_inproc.7 zmq_ipc.7 \
MAN7 = zmq.7 zmq_tcp.7 zmq_pgm.7 zmq_inproc.7 zmq_ipc.7 \
zmq_null.7 zmq_plain.7 zmq_curve.7 zmq_tipc.7
MAN_DOC = $(MAN1) $(MAN3) $(MAN7)
@ -21,20 +28,17 @@ MAN_TXT = $(MAN3:%.3=%.txt)
MAN_TXT += $(MAN7:%.7=%.txt)
MAN_HTML = $(MAN_TXT:%.txt=%.html)
MAINTAINERCLEANFILES = $(MAN_DOC) $(MAN_HTML)
EXTRA_DIST = asciidoc.conf $(MAN_TXT)
if BUILD_DOC
EXTRA_DIST += $(MAN_HTML)
if INSTALL_MAN
dist_man_MANS = $(MAN_DOC)
endif
EXTRA_DIST = asciidoc.conf $(MAN_TXT)
if BUILD_DOC
EXTRA_DIST += $(MAN_HTML)
endif
MAINTAINERCLEANFILES = $(MAN_DOC) $(MAN_HTML)
dist-hook : $(MAN_DOC) $(MAN_HTML)
if BUILD_DOC
SUFFIXES=.html .txt .xml .3 .7
.txt.html:
@ -49,6 +53,6 @@ SUFFIXES=.html .txt .xml .3 .7
xmlto man $<
.xml.7:
xmlto man $<
zmq_epgm.7: zmq_pgm.7
cp $< $@
endif
dist-hook : $(MAN_DOC) $(MAN_HTML)

View File

@ -55,7 +55,7 @@ Individual 0MQ 'sockets' are _not_ thread safe except in the case where full
memory barriers are issued when migrating a socket from one thread to another.
In practice this means applications can create a socket in one thread with
_zmq_socket()_ and then pass it to a _newly created_ thread as part of thread
initialization, for example via a structure passed as an argument to
initialisation, for example via a structure passed as an argument to
_pthread_create()_.
@ -132,7 +132,7 @@ Sending and receiving messages::
linkzmq:zmq_recv[3]
linkzmq:zmq_send_const[3]
Monitoring socket events:
Monitoring socket events::
linkzmq:zmq_socket_monitor[3]
.Input/output multiplexing
@ -187,13 +187,11 @@ Plain-text authentication using username and password::
Elliptic curve authentication and encryption::
linkzmq:zmq_curve[7]
Generate a CURVE keypair in armored text format:
Generate a CURVE keypair in armored text format::
linkzmq:zmq_curve_keypair[3]
Convert an armored key into a 32-byte binary key:
Converting keys to/from armoured text strings::
linkzmq:zmq_z85_decode[3]
Convert a 32-byte binary CURVE key to an armored text string:
linkzmq:zmq_z85_encode[3]
@ -213,6 +211,19 @@ The _zmq_strerror()_ function is provided to translate 0MQ-specific error codes
into error message strings; for details refer to linkzmq:zmq_strerror[3].
UTILITY
-------
The following utility functions are provided:
Working with atomic counters::
linkzmq:zmq_atomic_counter_new[3]
linkzmq:zmq_atomic_counter_set[3]
linkzmq:zmq_atomic_counter_inc[3]
linkzmq:zmq_atomic_counter_dec[3]
linkzmq:zmq_atomic_counter_value[3]
linkzmq:zmq_atomic_counter_destroy[3]
MISCELLANEOUS
-------------
The following miscellaneous functions are provided:

View File

@ -0,0 +1,62 @@
zmq_atomic_counter_dec(3)
=========================
NAME
----
zmq_atomic_counter_dec - decrement an atomic counter
SYNOPSIS
--------
*int zmq_atomic_counter_dec (void *counter);*
DESCRIPTION
-----------
The _zmq_atomic_counter_dec_ function decrements an atomic counter in
a threadsafe fashion. This function uses platform specific atomic
operations.
RETURN VALUE
------------
The _zmq_atomic_counter_dec()_ function returns 1 if the counter is
greater than zero after decrementing, or zero if the counter reached
zero.
EXAMPLE
-------
.Test code for atomic counters
----
void *counter = zmq_atomic_counter_new ();
assert (zmq_atomic_counter_value (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 1);
assert (zmq_atomic_counter_inc (counter) == 2);
assert (zmq_atomic_counter_value (counter) == 3);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_set (counter, 2);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_destroy (&counter);
return 0;
----
SEE ALSO
--------
linkzmq:zmq_atomic_counter_new[3]
linkzmq:zmq_atomic_counter_set[3]
linkzmq:zmq_atomic_counter_inc[3]
linkzmq:zmq_atomic_counter_value[3]
linkzmq:zmq_atomic_counter_destroy[3]
AUTHORS
-------
This page was written by the 0MQ community. To make a change please
read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.

View File

@ -0,0 +1,62 @@
zmq_atomic_counter_destroy(3)
=============================
NAME
----
zmq_atomic_counter_destroy - destroy an atomic counter
SYNOPSIS
--------
*void zmq_atomic_counter_destroy (void **counter_p);*
DESCRIPTION
-----------
The _zmq_atomic_counter_destroy_ function destroys an atomic counter and
nullifies its reference. Pass the address of an atomic counter (void **)
rather than the counter itself. You must destroy all counters that you
create, to avoid memory leakage. This function uses platform specific
atomic operations.
RETURN VALUE
------------
The _zmq_atomic_counter_destroy()_ function has no return value.
EXAMPLE
-------
.Test code for atomic counters
----
void *counter = zmq_atomic_counter_new ();
assert (zmq_atomic_counter_value (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 1);
assert (zmq_atomic_counter_inc (counter) == 2);
assert (zmq_atomic_counter_value (counter) == 3);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_set (counter, 2);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_destroy (&counter);
return 0;
----
SEE ALSO
--------
linkzmq:zmq_atomic_counter_new[3]
linkzmq:zmq_atomic_counter_set[3]
linkzmq:zmq_atomic_counter_inc[3]
linkzmq:zmq_atomic_counter_dec[3]
linkzmq:zmq_atomic_counter_value[3]
AUTHORS
-------
This page was written by the 0MQ community. To make a change please
read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.

View File

@ -0,0 +1,61 @@
zmq_atomic_counter_inc(3)
=========================
NAME
----
zmq_atomic_counter_inc - increment an atomic counter
SYNOPSIS
--------
*int zmq_atomic_counter_inc (void *counter);*
DESCRIPTION
-----------
The _zmq_atomic_counter_inc_ function increments an atomic counter in a
threadsafe fashion. This function uses platform specific atomic
operations.
RETURN VALUE
------------
The _zmq_atomic_counter_inc()_ function returns the old value of the
counter, before incrementing.
EXAMPLE
-------
.Test code for atomic counters
----
void *counter = zmq_atomic_counter_new ();
assert (zmq_atomic_counter_value (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 1);
assert (zmq_atomic_counter_inc (counter) == 2);
assert (zmq_atomic_counter_value (counter) == 3);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_set (counter, 2);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_destroy (&counter);
return 0;
----
SEE ALSO
--------
linkzmq:zmq_atomic_counter_new[3]
linkzmq:zmq_atomic_counter_set[3]
linkzmq:zmq_atomic_counter_dec[3]
linkzmq:zmq_atomic_counter_value[3]
linkzmq:zmq_atomic_counter_destroy[3]
AUTHORS
-------
This page was written by the 0MQ community. To make a change please
read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.

View File

@ -0,0 +1,62 @@
zmq_atomic_counter_new(3)
=========================
NAME
----
zmq_atomic_counter_new - create a new atomic counter
SYNOPSIS
--------
*void *zmq_atomic_counter_new (void);*
DESCRIPTION
-----------
The _zmq_atomic_counter_new_ function creates a new atomic counter. You
can use this in multithreaded applications to do, for example, reference
counting of shared objects. The atomic counter is at least 32 bits large.
This function uses platform specific atomic operations.
RETURN VALUE
------------
The _zmq_atomic_counter_new()_ function returns the new atomic counter
if successful. Otherwise it returns NULL.
EXAMPLE
-------
.Test code for atomic counters
----
void *counter = zmq_atomic_counter_new ();
assert (zmq_atomic_counter_value (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 1);
assert (zmq_atomic_counter_inc (counter) == 2);
assert (zmq_atomic_counter_value (counter) == 3);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_set (counter, 2);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_destroy (&counter);
return 0;
----
SEE ALSO
--------
linkzmq:zmq_atomic_counter_set[3]
linkzmq:zmq_atomic_counter_inc[3]
linkzmq:zmq_atomic_counter_dec[3]
linkzmq:zmq_atomic_counter_value[3]
linkzmq:zmq_atomic_counter_destroy[3]
AUTHORS
-------
This page was written by the 0MQ community. To make a change please
read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.

View File

@ -0,0 +1,61 @@
zmq_atomic_counter_set(3)
=========================
NAME
----
zmq_atomic_counter_set - set atomic counter to new value
SYNOPSIS
--------
*void zmq_atomic_counter_set (void *counter, int value);*
DESCRIPTION
-----------
The _zmq_atomic_counter_set_ function sets the counter to a new value,
in a threadsafe fashion. The largest value that is guaranteed to work
across all platforms is 2^31-1. This function uses platform specific
atomic operations.
RETURN VALUE
------------
The _zmq_atomic_counter_set()_ function has no return value.
EXAMPLE
-------
.Test code for atomic counters
----
void *counter = zmq_atomic_counter_new ();
assert (zmq_atomic_counter_value (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 1);
assert (zmq_atomic_counter_inc (counter) == 2);
assert (zmq_atomic_counter_value (counter) == 3);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_set (counter, 2);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_destroy (&counter);
return 0;
----
SEE ALSO
--------
linkzmq:zmq_atomic_counter_new[3]
linkzmq:zmq_atomic_counter_inc[3]
linkzmq:zmq_atomic_counter_dec[3]
linkzmq:zmq_atomic_counter_value[3]
linkzmq:zmq_atomic_counter_destroy[3]
AUTHORS
-------
This page was written by the 0MQ community. To make a change please
read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.

View File

@ -0,0 +1,60 @@
zmq_atomic_counter_value(3)
===========================
NAME
----
zmq_atomic_counter_value - return value of atomic counter
SYNOPSIS
--------
*int zmq_atomic_counter_value (void *counter);*
DESCRIPTION
-----------
The _zmq_atomic_counter_value_ function returns the value of an atomic
counter. This function uses platform specific atomic operations.
RETURN VALUE
------------
The _zmq_atomic_counter_value()_ function returns the new atomic counter
if successful. Otherwise it returns NULL.
EXAMPLE
-------
.Test code for atomic counters
----
void *counter = zmq_atomic_counter_new ();
assert (zmq_atomic_counter_value (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 1);
assert (zmq_atomic_counter_inc (counter) == 2);
assert (zmq_atomic_counter_value (counter) == 3);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_set (counter, 2);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_destroy (&counter);
return 0;
----
SEE ALSO
--------
linkzmq:zmq_atomic_counter_new[3]
linkzmq:zmq_atomic_counter_set[3]
linkzmq:zmq_atomic_counter_inc[3]
linkzmq:zmq_atomic_counter_dec[3]
linkzmq:zmq_atomic_counter_destroy[3]
AUTHORS
-------
This page was written by the 0MQ community. To make a change please
read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.

View File

@ -33,7 +33,7 @@ Context termination is performed in the following steps:
peer, or the socket's linger period set with the _ZMQ_LINGER_ socket
option has expired.
For further details regarding socket linger behavior refer to the _ZMQ_LINGER_
For further details regarding socket linger behaviour refer to the _ZMQ_LINGER_
option in linkzmq:zmq_setsockopt[3].
This function is deprecated by linkzmq:zmq_ctx_term[3].

View File

@ -40,6 +40,12 @@ ZMQ_IPV6: Set IPv6 option
~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_IPV6' argument returns the IPv6 option for the context.
ZMQ_BLOCKY: Get blocky setting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_BLOCKY' argument returns 1 if the context will block on terminate,
zero if the "block forever on context termination" gambit was disabled by
setting ZMQ_BLOCKY to false on all new contexts.
RETURN VALUE
------------
@ -63,6 +69,10 @@ zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 256);
int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS);
assert (max_sockets == 256);
----
.Switching off the context deadlock gambit
----
zmq_ctx_set (ctx, ZMQ_BLOCKY, false);
----
SEE ALSO

View File

@ -21,6 +21,21 @@ The _zmq_ctx_set()_ function shall set the option specified by the
The _zmq_ctx_set()_ function accepts the following options:
ZMQ_BLOCKY: Fix blocky behavior
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
By default the context will block, forever, on a zmq_ctx_term call. The
assumption behind this behavior is that abrupt termination will cause
message loss. Most real applications use some form of handshaking to ensure
applications receive termination messages, and then terminate the context
with 'ZMQ_LINGER' set to zero on all sockets. This setting is an easier way
to get the same result. When 'ZMQ_BLOCKY' is set to false, all new sockets
are given a linger timeout of zero. You must still close all sockets before
calling zmq_term.
[horizontal]
Default value:: false (old behavior)
ZMQ_IO_THREADS: Set number of I/O threads
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_IO_THREADS' argument specifies the size of the 0MQ thread pool to

View File

@ -23,8 +23,8 @@ Context termination is performed in the following steps:
exception of _zmq_close()_, any further operations on sockets open within
'context' shall fail with an error code of ETERM.
2. After interrupting all blocking calls, _zmq_ctx_term()_ shall _block_ until the
following conditions are satisfied:
2. After interrupting all blocking calls, _zmq_ctx_term()_ shall _block_ until
the following conditions are satisfied:
* All sockets open within 'context' have been closed with _zmq_close()_.
@ -33,7 +33,7 @@ Context termination is performed in the following steps:
peer, or the socket's linger period set with the _ZMQ_LINGER_ socket
option has expired.
For further details regarding socket linger behavior refer to the _ZMQ_LINGER_
For further details regarding socket linger behaviour refer to the _ZMQ_LINGER_
option in linkzmq:zmq_setsockopt[3].
This function replaces the deprecated function linkzmq:zmq_term[3].

View File

@ -1 +0,0 @@
zmq_pgm.txt

View File

@ -676,7 +676,7 @@ Option value unit:: N/A
Default value:: not set
Applicable socket types:: all, when using TCP transport
ZMQ_IDENTITY_FD: Retrieve FD associated with igven identity
ZMQ_IDENTITY_FD: Retrieve FD associated with given identity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_IDENTITY_FD' option shall retrieve the FD associated with given identity.

View File

@ -23,10 +23,10 @@ CLIENT AND SERVER ROLES
A socket using GSSAPI can be either client or server, but not both.
To become either a GSSAPI client or server, the application sets the
ZMQ_GSSAPI_PRINCIPAL option to provide the socket with the name of the pricipal
ZMQ_GSSAPI_PRINCIPAL option to provide the socket with the name of the principal
for whom GSSAPI credentials should be acquired.
To become a GSSAPI server, the application addtionally sets the
To become a GSSAPI server, the application additionally sets the
ZMQ_GSSAPI_SERVER option on the socket.
To become a GSSAPI client, the application sets additionally sets the

View File

@ -35,13 +35,13 @@ operating system namespace used by the 'ipc' implementation, and must fulfill
any restrictions placed by the operating system on the format and length of a
'pathname'.
When the address is `*`, _zmq_bind()_ shall generate a unique temporary
When the address is wild-card `*`, _zmq_bind()_ shall generate a unique temporary
pathname. The caller should retrieve this pathname using the ZMQ_LAST_ENDPOINT
socket option. See linkzmq:zmq_getsockopt[3] for details.
NOTE: any existing binding to the same endpoint shall be overridden. That is,
if a second process binds to an endpoint already bound by a process, this
will succeed and the first process will lose its binding. In this behavior,
will succeed and the first process will lose its binding. In this behaviour,
the 'ipc' transport is not consistent with the 'tcp' or 'inproc' transports.
NOTE: the endpoint pathname must be writable by the process. When the endpoint
@ -57,6 +57,12 @@ NOTE: IPC pathnames have a maximum size that depends on the operating system.
On Linux, the maximum is 113 characters including the "ipc://" prefix (107
characters for the real path name).
Unbinding wild-card address from a socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When wild-card `*` 'endpoint' was used in _zmq_bind()_, the caller should use
real 'endpoint' obtained from the ZMQ_LAST_ENDPOINT socket option to unbind
this 'endpoint' from a socket using _zmq_unbind()_.
Connecting a socket
~~~~~~~~~~~~~~~~~~~
When connecting a 'socket' to a peer address using _zmq_connect()_ with the

View File

@ -16,7 +16,7 @@ DESCRIPTION
-----------
The _zmq_msg_copy()_ function shall copy the message object referenced by 'src'
to the message object referenced by 'dest'. The original content of 'dest', if
any, shall be released. You must initialize 'dest' before copying to it.
any, shall be released. You must initialise 'dest' before copying to it.
CAUTION: The implementation may choose not to physically copy the message
content, rather to share the underlying buffer between 'src' and 'dest'. Avoid

View File

@ -22,7 +22,7 @@ CAUTION: Never access 'zmq_msg_t' members directly, instead always use the
_zmq_msg_ family of functions.
CAUTION: The functions _zmq_msg_init()_, _zmq_msg_init_data()_ and
_zmq_msg_init_size()_ are mutually exclusive. Never initialize the same
_zmq_msg_init_size()_ are mutually exclusive. Never initialise the same
'zmq_msg_t' twice.

View File

@ -36,7 +36,7 @@ will not be freed, and this may cause a memory leak.
CAUTION: The functions _zmq_msg_init()_, _zmq_msg_init_data()_ and
_zmq_msg_init_size()_ are mutually exclusive. Never initialize the same
_zmq_msg_init_size()_ are mutually exclusive. Never initialise the same
'zmq_msg_t' twice.

View File

@ -26,7 +26,7 @@ CAUTION: Never access 'zmq_msg_t' members directly, instead always use the
_zmq_msg_ family of functions.
CAUTION: The functions _zmq_msg_init()_, _zmq_msg_init_data()_ and
_zmq_msg_init_size()_ are mutually exclusive. Never initialize the same
_zmq_msg_init_size()_ are mutually exclusive. Never initialise the same
'zmq_msg_t' twice.

View File

@ -69,6 +69,13 @@ condition is present on the socket specified by 'fd'. For 0MQ sockets this flag
has no effect if set in 'events', and shall never be returned in 'revents' by
_zmq_poll()_.
*ZMQ_POLLPRI*::
For 0MQ sockets this flags is of no use. For standard sockets this means there
is urgent data to read. Refer to the POLLPRI flag for more informations.
For file descriptor, refer to your use case: as an example, GPIO interrupts
are signaled through a POLLPRI event.
This flag has no effect on Windows.
NOTE: The _zmq_poll()_ function may be implemented or emulated using operating
system interfaces other than _poll()_, and as such may be subject to the limits
of those interfaces in ways not defined in this documentation.

View File

@ -73,7 +73,7 @@ The 'ZMQ_CONNECT_RID' option sets the peer id of the next host connected
via the zmq_connect() call, and immediately readies that connection for
data transfer with the named id. This option applies only to the first
subsequent call to zmq_connect(), calls thereafter use default connection
behavior.
behaviour.
Typical use is to set this socket option ahead of each zmq_connect() attempt
to a new host. Each connection MUST be assigned a unique name. Assigning a
@ -197,7 +197,7 @@ Applicable socket types:: all, when using TCP transport
ZMQ_GSSAPI_PRINCIPAL: Set name of GSSAPI principal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the name of the pricipal for whom GSSAPI credentials should be acquired.
Sets the name of the principal for whom GSSAPI credentials should be acquired.
[horizontal]
Option value type:: character string
@ -221,7 +221,7 @@ Applicable socket types:: all, when using TCP transport
ZMQ_GSSAPI_SERVICE_PRINCIPAL: Set name of GSSAPI service principal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the name of the pricipal of the GSSAPI server to which a GSSAPI client
Sets the name of the principal of the GSSAPI server to which a GSSAPI client
intends to connect.
[horizontal]
@ -283,77 +283,6 @@ Default value:: 0 (false)
Applicable socket types:: all, only for connection-oriented transports.
ZMQ_IPC_FILTER_GID: Assign group ID filters to allow new IPC connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign an arbitrary number of filters that will be applied for each new IPC
transport connection on a listening socket. If no IPC filters are applied, then
the IPC transport allows connections from any process. If at least one UID,
GID, or PID filter is applied then new connection credentials should be
matched. To clear all GID filters call zmq_setsockopt(socket,
ZMQ_IPC_FILTER_GID, NULL, 0).
NOTE: GID filters are only available on platforms supporting SO_PEERCRED or
LOCAL_PEERCRED socket options (currently only Linux and later versions of
OS X).
[horizontal]
Option value type:: gid_t
Option value unit:: N/A
Default value:: no filters (allow from all)
Applicable socket types:: all listening sockets, when using IPC transports.
ZMQ_IPC_FILTER_PID: Assign process ID filters to allow new IPC connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign an arbitrary number of filters that will be applied for each new IPC
transport connection on a listening socket. If no IPC filters are applied, then
the IPC transport allows connections from any process. If at least one UID,
GID, or PID filter is applied then new connection credentials should be
matched. To clear all PID filters call zmq_setsockopt(socket,
ZMQ_IPC_FILTER_PID, NULL, 0).
NOTE: PID filters are only available on platforms supporting the SO_PEERCRED
socket option (currently only Linux).
[horizontal]
Option value type:: pid_t
Option value unit:: N/A
Default value:: no filters (allow from all)
Applicable socket types:: all listening sockets, when using IPC transports.
ZMQ_IPC_FILTER_UID: Assign user ID filters to allow new IPC connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign an arbitrary number of filters that will be applied for each new IPC
transport connection on a listening socket. If no IPC filters are applied, then
the IPC transport allows connections from any process. If at least one UID,
GID, or PID filter is applied then new connection credentials should be
matched. To clear all UID filters call zmq_setsockopt(socket,
ZMQ_IPC_FILTER_UID, NULL, 0).
NOTE: UID filters are only available on platforms supporting SO_PEERCRED or
LOCAL_PEERCRED socket options (currently only Linux and later versions of
OS X).
[horizontal]
Option value type:: uid_t
Option value unit:: N/A
Default value:: no filters (allow from all)
Applicable socket types:: all listening sockets, when using IPC transports.
ZMQ_IPV4ONLY: Use IPv4-only on socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set the IPv4-only option for the socket. This option is deprecated.
Please use the ZMQ_IPV6 option.
[horizontal]
Option value type:: int
Option value unit:: boolean
Default value:: 1 (true)
Applicable socket types:: all, when using TCP transports.
ZMQ_IPV6: Enable IPv6 on socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set the IPv6 option for the socket. A value of `1` means IPv6 is
@ -377,7 +306,7 @@ linkzmq:zmq_disconnect[3] or closed with linkzmq:zmq_close[3], and further
affects the termination of the socket's context with linkzmq:zmq_term[3]. The
following outlines the different behaviours:
* The default value of '-1' specifies an infinite linger period. Pending
* A value of '-1' specifies an infinite linger period. Pending
messages shall not be discarded after a call to _zmq_disconnect()_ or
_zmq_close()_; attempting to terminate the socket's context with _zmq_term()_
shall block until all pending messages have been sent to a peer.
@ -394,7 +323,7 @@ following outlines the different behaviours:
[horizontal]
Option value type:: int
Option value unit:: milliseconds
Default value:: -1 (infinite)
Default value:: 30000 (thirty seconds)
Applicable socket types:: all
@ -601,7 +530,7 @@ Applicable socket types:: all, when using multicast transports
ZMQ_REQ_CORRELATE: match replies with requests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The default behavior of REQ sockets is to rely on the ordering of messages to
The default behaviour of REQ sockets is to rely on the ordering of messages to
match requests and responses and that is usually sufficient. When this option
is set to 1, the REQ socket will prefix outgoing messages with an extra frame
containing a request id. That means the full message is (request id, 0,
@ -654,7 +583,7 @@ Applicable socket types:: ZMQ_ROUTER
ZMQ_ROUTER_MANDATORY: accept only routable messages on ROUTER sockets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the ROUTER socket behavior when an unroutable message is encountered. A
Sets the ROUTER socket behaviour when an unroutable message is encountered. A
value of `0` is the default and discards the message silently when it cannot be
routed or the peers SNDHWM is reached. A value of `1` returns an
'EHOSTUNREACH' error code if the message cannot be routed or 'EAGAIN' error
@ -760,25 +689,6 @@ Default value:: N/A
Applicable socket types:: ZMQ_SUB
ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign an arbitrary number of filters that will be applied for each new TCP
transport connection on a listening socket. If no filters are applied, then
the TCP transport allows connections from any IP address. If at least one
filter is applied then new connection source ip should be matched. To clear
all filters call zmq_setsockopt(socket, ZMQ_TCP_ACCEPT_FILTER, NULL, 0).
Filter is a null-terminated string with ipv6 or ipv4 CIDR.
NOTE: This option is deprecated, please use authentication via the ZAP API
and IP address whitelisting / blacklisting.
[horizontal]
Option value type:: binary data
Option value unit:: N/A
Default value:: no filters (allow from all)
Applicable socket types:: all listening sockets, when using TCP transports.
ZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Override 'SO_KEEPALIVE' socket option (where supported by OS).
@ -833,7 +743,7 @@ ZMQ_TOS: Set the Type-of-Service on socket
Sets the ToS fields (Differentiated services (DS) and Explicit Congestion
Notification (ECN) field of the IP header. The ToS field is typically used
to specify a packets priority. The availability of this option is dependent
on intermediate network equipment that inspect the ToS field andprovide a
on intermediate network equipment that inspect the ToS field and provide a
path for low-delay, high-throughput, highly-reliable service, etc.
[horizontal]
@ -860,7 +770,7 @@ Applicable socket types:: ZMQ_SUB
ZMQ_XPUB_VERBOSE: provide all subscription messages on XPUB sockets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the 'XPUB' socket behavior on new subscriptions and unsubscriptions.
Sets the 'XPUB' socket behaviour on new subscriptions and unsubscriptions.
A value of '0' is the default and passes only new subscription messages to
upstream. A value of '1' passes all subscription messages upstream.
@ -870,6 +780,36 @@ Option value unit:: 0, 1
Default value:: 0
Applicable socket types:: ZMQ_XPUB
ZMQ_XPUB_MANUAL: change the subscription handling to manual
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the 'XPUB' socket subscription handling mode manual/automatic.
A value of '0' is the default and subscription requests will be handled automatically.
A value of '1' will change the subscription requests handling to manual,
with manual mode subscription requests are not added to the subscription list.
To add subscription the user need to call setsockopt with ZMQ_SUBSCRIBE on XPUB socket.
[horizontal]
Option value type:: int
Option value unit:: 0, 1
Default value:: 0
Applicable socket types:: ZMQ_XPUB
ZMQ_WELCOME_MSG: set welcome message that will be received by subscriber when connecting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets a welcome message the will be recieved by subscriber when connecting.
Subscriber must subscribe to the Welcome message before connecting.
Welcome message will also be sent on reconnecting.
For welcome message to work well user must poll on incoming subscription messages on the XPUB socket and handle them.
Use NULL and lenght of zero to disable welcome message.
[horizontal]
Option value type:: binary data
Option value unit:: N/A
Default value:: NULL
Applicable socket types:: ZMQ_XPUB
ZMQ_ZAP_DOMAIN: Set RFC 27 authentication domain
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -886,6 +826,104 @@ Default value:: not set
Applicable socket types:: all, when using TCP transport
ZMQ_TCP_ACCEPT_FILTER: Assign filters to allow new TCP connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign an arbitrary number of filters that will be applied for each new TCP
transport connection on a listening socket. If no filters are applied, then
the TCP transport allows connections from any IP address. If at least one
filter is applied then new connection source ip should be matched. To clear
all filters call zmq_setsockopt(socket, ZMQ_TCP_ACCEPT_FILTER, NULL, 0).
Filter is a null-terminated string with ipv6 or ipv4 CIDR.
NOTE: This option is deprecated, please use authentication via the ZAP API
and IP address whitelisting / blacklisting.
[horizontal]
Option value type:: binary data
Option value unit:: N/A
Default value:: no filters (allow from all)
Applicable socket types:: all listening sockets, when using TCP transports.
ZMQ_IPC_FILTER_GID: Assign group ID filters to allow new IPC connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign an arbitrary number of filters that will be applied for each new IPC
transport connection on a listening socket. If no IPC filters are applied, then
the IPC transport allows connections from any process. If at least one UID,
GID, or PID filter is applied then new connection credentials should be
matched. To clear all GID filters call zmq_setsockopt(socket,
ZMQ_IPC_FILTER_GID, NULL, 0).
NOTE: GID filters are only available on platforms supporting SO_PEERCRED or
LOCAL_PEERCRED socket options (currently only Linux and later versions of
OS X).
NOTE: This option is deprecated, please use authentication via the ZAP API
and IPC whitelisting / blacklisting.
[horizontal]
Option value type:: gid_t
Option value unit:: N/A
Default value:: no filters (allow from all)
Applicable socket types:: all listening sockets, when using IPC transports.
ZMQ_IPC_FILTER_PID: Assign process ID filters to allow new IPC connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign an arbitrary number of filters that will be applied for each new IPC
transport connection on a listening socket. If no IPC filters are applied, then
the IPC transport allows connections from any process. If at least one UID,
GID, or PID filter is applied then new connection credentials should be
matched. To clear all PID filters call zmq_setsockopt(socket,
ZMQ_IPC_FILTER_PID, NULL, 0).
NOTE: PID filters are only available on platforms supporting the SO_PEERCRED
socket option (currently only Linux).
NOTE: This option is deprecated, please use authentication via the ZAP API
and IPC whitelisting / blacklisting.
[horizontal]
Option value type:: pid_t
Option value unit:: N/A
Default value:: no filters (allow from all)
Applicable socket types:: all listening sockets, when using IPC transports.
ZMQ_IPC_FILTER_UID: Assign user ID filters to allow new IPC connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign an arbitrary number of filters that will be applied for each new IPC
transport connection on a listening socket. If no IPC filters are applied, then
the IPC transport allows connections from any process. If at least one UID,
GID, or PID filter is applied then new connection credentials should be
matched. To clear all UID filters call zmq_setsockopt(socket,
ZMQ_IPC_FILTER_UID, NULL, 0).
NOTE: UID filters are only available on platforms supporting SO_PEERCRED or
LOCAL_PEERCRED socket options (currently only Linux and later versions of
OS X).
NOTE: This option is deprecated, please use authentication via the ZAP API
and IPC whitelisting / blacklisting.
[horizontal]
Option value type:: uid_t
Option value unit:: N/A
Default value:: no filters (allow from all)
Applicable socket types:: all listening sockets, when using IPC transports.
ZMQ_IPV4ONLY: Use IPv4-only on socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set the IPv4-only option for the socket. This option is deprecated.
Please use the ZMQ_IPV6 option.
[horizontal]
Option value type:: int
Option value unit:: boolean
Default value:: 1 (true)
Applicable socket types:: all, when using TCP transports.
RETURN VALUE
------------
The _zmq_setsockopt()_ function shall return zero if successful. Otherwise it

View File

@ -131,7 +131,7 @@ get_monitor_event (void *monitor, int *value, char **address)
zmq_msg_t msg;
zmq_msg_init (&msg);
if (zmq_msg_recv (&msg, monitor, 0) == -1)
return -1; // Interruped, presumably
return -1; // Interrupted, presumably
assert (zmq_msg_more (&msg));
uint8_t *data = (uint8_t *) zmq_msg_data (&msg);
@ -142,7 +142,7 @@ get_monitor_event (void *monitor, int *value, char **address)
// Second frame in message contains event address
zmq_msg_init (&msg);
if (zmq_msg_recv (&msg, monitor, 0) == -1)
return -1; // Interruped, presumably
return -1; // Interrupted, presumably
assert (!zmq_msg_more (&msg));
if (address) {

View File

@ -46,6 +46,11 @@ When using ephemeral ports, the caller should retrieve the actual assigned
port using the ZMQ_LAST_ENDPOINT socket option. See linkzmq:zmq_getsockopt[3]
for details.
Unbinding wild-card address from a socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When wild-card `*` 'endpoint' was used in _zmq_bind()_, the caller should use
real 'endpoint' obtained from the ZMQ_LAST_ENDPOINT socket option to unbind
this 'endpoint' from a socket using _zmq_unbind()_.
Connecting a socket
~~~~~~~~~~~~~~~~~~~

View File

@ -20,6 +20,12 @@ argument.
The 'endpoint' argument is as described in linkzmq:zmq_bind[3]
Unbinding wild-card address from a socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When wild-card `*` 'endpoint' (described in linkzmq:zmq_tcp[7] and
linkzmq:zmq_ipc[7]) was used in _zmq_bind()_, the caller should use
real 'endpoint' obtained from the ZMQ_LAST_ENDPOINT socket option
to unbind this 'endpoint' from a socket.
RETURN VALUE
------------
@ -36,8 +42,8 @@ The 0MQ 'context' associated with the specified 'socket' was terminated.
The provided 'socket' was invalid.
EXAMPLE
-------
EXAMPLES
--------
.Unbind a subscriber socket from a TCP transport
----
/* Create a ZMQ_SUB socket */
@ -51,6 +57,23 @@ rc = zmq_unbind (socket, "tcp://127.0.0.1:5555");
assert (rc == 0);
----
.Unbind wild-card `*` binded socket
----
/* Create a ZMQ_SUB socket */
void *socket = zmq_socket (context, ZMQ_SUB);
assert (socket);
/* Bind it to the system-assigned ephemeral port using a TCP transport */
rc = zmq_bind (socket, "tcp://127.0.0.1:*");
assert (rc == 0);
/* Obtain real endpoint */
const size_t buf_size = 32;
char buf[buf_size];
rc = zmq_getsockopt (socket, ZMQ_LAST_ENDPOINT, buf, (size_t *)&buf_size);
assert (rc == 0);
/* Unbind socket by real endpoint */
rc = zmq_unbind (socket, buf);
assert (rc == 0);
----
SEE ALSO
--------

View File

@ -1,8 +0,0 @@
SUBDIRS = $(pgm_subdir)
DIST_SUBDIRS =
# Override Automake's installation targets with the command ":" that does nothing.
install:; @:
install-exec:; @:
install-data:; @:
uninstall:; @:
dist:; @;

View File

@ -30,7 +30,7 @@
/* Version macros for compile-time API version detection */
#define ZMQ_VERSION_MAJOR 4
#define ZMQ_VERSION_MINOR 1
#define ZMQ_VERSION_MINOR 2
#define ZMQ_VERSION_PATCH 0
#define ZMQ_MAKE_VERSION(major, minor, patch) \
@ -276,7 +276,6 @@ ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property);
#define ZMQ_TCP_KEEPALIVE_CNT 35
#define ZMQ_TCP_KEEPALIVE_IDLE 36
#define ZMQ_TCP_KEEPALIVE_INTVL 37
#define ZMQ_TCP_ACCEPT_FILTER 38
#define ZMQ_IMMEDIATE 39
#define ZMQ_XPUB_VERBOSE 40
#define ZMQ_ROUTER_RAW 41
@ -296,9 +295,6 @@ ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property);
#define ZMQ_ZAP_DOMAIN 55
#define ZMQ_ROUTER_HANDOVER 56
#define ZMQ_TOS 57
#define ZMQ_IPC_FILTER_PID 58
#define ZMQ_IPC_FILTER_UID 59
#define ZMQ_IPC_FILTER_GID 60
#define ZMQ_CONNECT_RID 61
#define ZMQ_GSSAPI_SERVER 62
#define ZMQ_GSSAPI_PRINCIPAL 63
@ -308,6 +304,9 @@ ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property);
#define ZMQ_IDENTITY_FD 67
#define ZMQ_SOCKS_PROXY 68
#define ZMQ_XPUB_NODROP 69
#define ZMQ_BLOCKY 70
#define ZMQ_XPUB_MANUAL 71
#define ZMQ_XPUB_WELCOME_MSG 72
/* Message options */
#define ZMQ_MORE 1
@ -325,6 +324,10 @@ ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property);
#define ZMQ_GSSAPI 3
/* Deprecated options and aliases */
#define ZMQ_TCP_ACCEPT_FILTER 38
#define ZMQ_IPC_FILTER_PID 58
#define ZMQ_IPC_FILTER_UID 59
#define ZMQ_IPC_FILTER_GID 60
#define ZMQ_IPV4ONLY 31
#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE
#define ZMQ_NOBLOCK ZMQ_DONTWAIT
@ -373,6 +376,7 @@ ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events);
#define ZMQ_POLLIN 1
#define ZMQ_POLLOUT 2
#define ZMQ_POLLERR 4
#define ZMQ_POLLPRI 8
typedef struct zmq_pollitem_t
{
@ -429,6 +433,17 @@ ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, const char *string);
/* Returns 0 on success. */
ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key);
/******************************************************************************/
/* Atomic utility methods */
/******************************************************************************/
ZMQ_EXPORT void *zmq_atomic_counter_new (void);
ZMQ_EXPORT void zmq_atomic_counter_set (void *counter, int value);
ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter);
ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter);
ZMQ_EXPORT int zmq_atomic_counter_value (void *counter);
ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p);
/******************************************************************************/
/* These functions are not documented by man pages -- use at your own risk. */

View File

@ -1,22 +0,0 @@
AM_CPPFLAGS = -I$(top_builddir)/include \
-I$(top_srcdir)/include
noinst_PROGRAMS = local_lat remote_lat local_thr remote_thr inproc_lat inproc_thr
local_lat_LDADD = $(top_builddir)/src/libzmq.la
local_lat_SOURCES = local_lat.cpp
remote_lat_LDADD = $(top_builddir)/src/libzmq.la
remote_lat_SOURCES = remote_lat.cpp
local_thr_LDADD = $(top_builddir)/src/libzmq.la
local_thr_SOURCES = local_thr.cpp
remote_thr_LDADD = $(top_builddir)/src/libzmq.la
remote_thr_SOURCES = remote_thr.cpp
inproc_lat_LDADD = $(top_builddir)/src/libzmq.la
inproc_lat_SOURCES = inproc_lat.cpp
inproc_thr_LDADD = $(top_builddir)/src/libzmq.la
inproc_thr_SOURCES = inproc_thr.cpp

View File

@ -1,219 +0,0 @@
lib_LTLIBRARIES = libzmq.la
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libzmq.pc
include_HEADERS = ../include/zmq.h ../include/zmq_utils.h
libzmq_la_SOURCES = \
address.hpp \
array.hpp \
atomic_counter.hpp \
atomic_ptr.hpp \
blob.hpp \
clock.hpp \
command.hpp \
config.hpp \
ctx.hpp \
curve_client.hpp \
curve_server.hpp \
decoder.hpp \
devpoll.hpp \
dist.hpp \
encoder.hpp \
epoll.hpp \
err.hpp \
fd.hpp \
fq.hpp \
gssapi_mechanism_base.hpp \
gssapi_client.hpp \
gssapi_server.hpp \
i_encoder.hpp \
i_decoder.hpp \
i_engine.hpp \
i_poll_events.hpp \
io_object.hpp \
io_thread.hpp \
ip.hpp \
ipc_address.hpp \
ipc_connecter.hpp \
ipc_listener.hpp \
i_engine.hpp \
i_poll_events.hpp \
kqueue.hpp \
lb.hpp \
likely.hpp \
mailbox.hpp \
mechanism.hpp \
metadata.hpp \
msg.hpp \
mtrie.hpp \
mutex.hpp \
norm_engine.hpp \
null_mechanism.hpp \
object.hpp \
options.hpp \
own.hpp \
pgm_receiver.hpp \
pgm_sender.hpp \
pgm_socket.hpp \
pipe.hpp \
plain_client.hpp \
plain_server.hpp \
platform.hpp \
poll.hpp \
poller.hpp \
poller_base.hpp \
pair.hpp \
proxy.hpp \
pub.hpp \
pull.hpp \
push.hpp \
random.hpp \
reaper.hpp \
rep.hpp \
req.hpp \
select.hpp \
session_base.hpp \
signaler.hpp \
socket_base.hpp \
socks.hpp \
socks_connecter.hpp \
stdint.hpp \
stream.hpp \
stream_engine.hpp \
sub.hpp \
tcp.hpp \
tcp_address.hpp \
tcp_connecter.hpp \
tcp_listener.hpp \
thread.hpp \
trie.hpp \
windows.hpp \
wire.hpp \
xpub.hpp \
router.hpp \
dealer.hpp \
xsub.hpp \
ypipe.hpp \
ypipe_base.hpp \
yqueue.hpp \
address.cpp \
clock.cpp \
ctx.cpp \
curve_client.cpp \
curve_server.cpp \
devpoll.cpp \
dist.cpp \
epoll.cpp \
err.cpp \
fq.cpp \
gssapi_mechanism_base.cpp \
gssapi_client.cpp \
gssapi_server.cpp \
io_object.cpp \
io_thread.cpp \
ip.cpp \
ipc_address.cpp \
ipc_connecter.cpp \
ipc_listener.cpp \
kqueue.cpp \
lb.cpp \
mailbox.cpp \
mechanism.cpp \
metadata.cpp \
msg.cpp \
mtrie.cpp \
norm_engine.cpp \
null_mechanism.cpp \
object.cpp \
options.cpp \
own.cpp \
pair.cpp \
pgm_receiver.cpp \
pgm_sender.cpp \
pgm_socket.cpp \
pipe.cpp \
plain_client.cpp \
plain_server.cpp \
poll.cpp \
poller_base.cpp \
pull.cpp \
push.cpp \
proxy.cpp \
reaper.cpp \
pub.cpp \
random.cpp \
rep.cpp \
req.cpp \
select.cpp \
session_base.cpp \
signaler.cpp \
socket_base.cpp \
socks.cpp \
socks_connecter.cpp \
stream.cpp \
stream_engine.cpp \
sub.cpp \
tcp.cpp \
tcp_address.cpp \
tcp_connecter.cpp \
tcp_listener.cpp \
thread.cpp \
trie.cpp \
xpub.cpp \
router.cpp \
dealer.cpp \
v1_decoder.cpp \
v1_encoder.cpp \
v1_decoder.hpp \
v1_encoder.hpp \
v2_decoder.cpp \
v2_decoder.hpp \
v2_encoder.cpp \
v2_encoder.hpp \
v2_protocol.hpp \
xsub.cpp \
zmq.cpp \
zmq_utils.cpp \
raw_decoder.hpp \
raw_decoder.cpp \
raw_encoder.hpp \
raw_encoder.cpp \
ypipe_conflate.hpp \
dbuffer.hpp \
tipc_address.cpp \
tipc_address.hpp \
tipc_listener.cpp \
tipc_listener.hpp \
tipc_connecter.cpp \
tipc_connecter.hpp
if ON_MINGW
libzmq_la_LDFLAGS = -no-undefined -avoid-version -version-info @LTVER@ @LIBZMQ_EXTRA_LDFLAGS@
else
if ON_ANDROID
libzmq_la_LDFLAGS = -avoid-version -version-info @LTVER@ @LIBZMQ_EXTRA_LDFLAGS@
else
if ON_LINUX
libzmq_la_LDFLAGS = -version-info @LTVER@ @LIBZMQ_EXTRA_LDFLAGS@ -Wl,--version-script=$(srcdir)/libzmq.vers
else
libzmq_la_LDFLAGS = -version-info @LTVER@ @LIBZMQ_EXTRA_LDFLAGS@ -Wl
endif
endif
endif
libzmq_la_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@
if BUILD_PGM
libzmq_la_CPPFLAGS = -I$(top_srcdir)/@pgm_srcdir@/include/
libzmq_la_LIBADD = $(top_srcdir)/@pgm_srcdir@/libpgm_noinst.la
endif
dist-hook:
-rm $(distdir)/platform.hpp
EXTRA_DIST = \
libzmq.pc.cmake.in \
libzmq.vers

View File

@ -65,6 +65,7 @@ zmq::ctx_t::ctx_t () :
slots (NULL),
max_sockets (clipped_maxsocket (ZMQ_MAX_SOCKETS_DFLT)),
io_thread_count (ZMQ_IO_THREADS_DFLT),
blocky (true),
ipv6 (false),
thread_priority (ZMQ_THREAD_PRIORITY_DFLT),
thread_sched_policy (ZMQ_THREAD_SCHED_POLICY_DFLT)
@ -222,6 +223,12 @@ int zmq::ctx_t::set (int option_, int optval_)
thread_sched_policy = optval_;
opt_sync.unlock();
}
else
if (option_ == ZMQ_BLOCKY && optval_ >= 0) {
opt_sync.lock ();
blocky = (optval_ != 0);
opt_sync.unlock ();
}
else {
errno = EINVAL;
rc = -1;
@ -243,6 +250,9 @@ int zmq::ctx_t::get (int option_)
else
if (option_ == ZMQ_IPV6)
rc = ipv6;
else
if (option_ == ZMQ_BLOCKY)
rc = blocky;
else {
errno = EINVAL;
rc = -1;

View File

@ -187,6 +187,9 @@ namespace zmq
// Number of I/O threads to launch.
int io_thread_count;
// Does context wait (possibly forever) on termination?
bool blocky;
// Is IPv6 enabled on this context?
bool ipv6;

View File

@ -38,6 +38,7 @@ zmq::curve_client_t::curve_client_t (const options_t &options_) :
cn_peer_nonce(1),
sync()
{
int rc;
memcpy (public_key, options_.curve_public_key, crypto_box_PUBLICKEYBYTES);
memcpy (secret_key, options_.curve_secret_key, crypto_box_SECRETKEYBYTES);
memcpy (server_key, options_.curve_server_key, crypto_box_PUBLICKEYBYTES);
@ -47,12 +48,12 @@ zmq::curve_client_t::curve_client_t (const options_t &options_) :
unsigned char tmpbytes[4];
randombytes(tmpbytes, 4);
#else
// todo check return code
sodium_init();
rc = sodium_init ();
zmq_assert (rc != -1);
#endif
// Generate short-term key pair
const int rc = crypto_box_keypair (cn_public, cn_secret);
rc = crypto_box_keypair (cn_public, cn_secret);
zmq_assert (rc == 0);
}

View File

@ -42,6 +42,7 @@ zmq::curve_server_t::curve_server_t (session_base_t *session_,
cn_peer_nonce(1),
sync()
{
int rc;
// Fetch our secret key from socket options
memcpy (secret_key, options_.curve_secret_key, crypto_box_SECRETKEYBYTES);
scoped_lock_t lock (sync);
@ -50,12 +51,12 @@ zmq::curve_server_t::curve_server_t (session_base_t *session_,
unsigned char tmpbytes[4];
randombytes(tmpbytes, 4);
#else
// todo check return code
sodium_init();
rc = sodium_init ();
zmq_assert (rc != -1);
#endif
// Generate short-term key pair
const int rc = crypto_box_keypair (cn_public, cn_secret);
rc = crypto_box_keypair (cn_public, cn_secret);
zmq_assert (rc == 0);
}

View File

@ -376,19 +376,21 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
}
else
if (optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
zmq_z85_decode (curve_public_key, (char *) optval_);
mechanism = ZMQ_CURVE;
return 0;
if (zmq_z85_decode (curve_public_key, (char *) optval_)) {
mechanism = ZMQ_CURVE;
return 0;
}
}
else
// Deprecated, not symmetrical with zmq_getsockopt
if (optvallen_ == CURVE_KEYSIZE_Z85) {
char z85_key [41];
char z85_key [CURVE_KEYSIZE_Z85 + 1];
memcpy (z85_key, (char *) optval_, CURVE_KEYSIZE_Z85);
z85_key [CURVE_KEYSIZE_Z85] = 0;
zmq_z85_decode (curve_public_key, z85_key);
mechanism = ZMQ_CURVE;
return 0;
if (zmq_z85_decode (curve_public_key, z85_key)) {
mechanism = ZMQ_CURVE;
return 0;
}
}
break;
@ -400,19 +402,21 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
}
else
if (optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
zmq_z85_decode (curve_secret_key, (char *) optval_);
mechanism = ZMQ_CURVE;
return 0;
if (zmq_z85_decode (curve_secret_key, (char *) optval_)) {
mechanism = ZMQ_CURVE;
return 0;
}
}
else
// Deprecated, not symmetrical with zmq_getsockopt
if (optvallen_ == CURVE_KEYSIZE_Z85) {
char z85_key [41];
char z85_key [CURVE_KEYSIZE_Z85 + 1];
memcpy (z85_key, (char *) optval_, CURVE_KEYSIZE_Z85);
z85_key [CURVE_KEYSIZE_Z85] = 0;
zmq_z85_decode (curve_secret_key, z85_key);
mechanism = ZMQ_CURVE;
return 0;
if (zmq_z85_decode (curve_secret_key, z85_key)) {
mechanism = ZMQ_CURVE;
return 0;
}
}
break;
@ -425,21 +429,23 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
}
else
if (optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
zmq_z85_decode (curve_server_key, (char *) optval_);
mechanism = ZMQ_CURVE;
as_server = 0;
return 0;
if (zmq_z85_decode (curve_server_key, (char *) optval_)) {
mechanism = ZMQ_CURVE;
as_server = 0;
return 0;
}
}
else
// Deprecated, not symmetrical with zmq_getsockopt
if (optvallen_ == CURVE_KEYSIZE_Z85) {
char z85_key [41];
char z85_key [CURVE_KEYSIZE_Z85 + 1];
memcpy (z85_key, (char *) optval_, CURVE_KEYSIZE_Z85);
z85_key [CURVE_KEYSIZE_Z85] = 0;
zmq_z85_decode (curve_server_key, z85_key);
mechanism = ZMQ_CURVE;
as_server = 0;
return 0;
if (zmq_z85_decode (curve_server_key, z85_key)) {
mechanism = ZMQ_CURVE;
as_server = 0;
return 0;
}
}
break;
# endif

View File

@ -197,6 +197,7 @@ void zmq::pgm_sender_t::out_event ()
if (has_tx_timer) {
cancel_timer (tx_timer_id);
set_pollout (handle);
has_tx_timer = false;
}
@ -210,8 +211,10 @@ void zmq::pgm_sender_t::out_event ()
zmq_assert (nbytes == 0);
if (errno == ENOMEM) {
// Stop polling handle and wait for tx timeout
const long timeout = pgm_socket.get_tx_timeout ();
add_timer (timeout, tx_timer_id);
reset_pollout (handle);
has_tx_timer = true;
}
else
@ -228,7 +231,9 @@ void zmq::pgm_sender_t::timer_event (int token)
}
else
if (token == tx_timer_id) {
// Restart polling handle and retry sending
has_tx_timer = false;
set_pollout (handle);
out_event ();
}
else

View File

@ -388,7 +388,7 @@ void zmq::pipe_t::terminate (bool delay_)
state = term_ack_sent;
}
// If there are pending messages still availabe, do nothing.
// If there are pending messages still available, do nothing.
else
if (state == waiting_for_delimiter) {
}

View File

@ -98,10 +98,10 @@ namespace zmq
// Remove unfinished parts of the outbound message from the pipe.
void rollback ();
// Flush the messages downsteam.
// Flush the messages downstream.
void flush ();
// Temporaraily disconnects the inbound message stream and drops
// Temporarily disconnects the inbound message stream and drops
// all the messages on the fly. Causes 'hiccuped' event to be generated
// in the peer.
void hiccup ();
@ -181,7 +181,7 @@ namespace zmq
// active: common state before any termination begins,
// delimiter_received: delimiter was read from pipe before
// term command was received,
// waiting_fo_delimiter: term command was already received
// waiting_for_delimiter: term command was already received
// from the peer but there are still pending messages to read,
// term_ack_sent: all pending messages were already read and
// all we are waiting for is ack from the peer,

View File

@ -331,6 +331,14 @@ int zmq::session_base_t::zap_connect ()
return 0;
}
bool zmq::session_base_t::zap_enabled ()
{
return (
options.mechanism != ZMQ_NULL ||
(options.mechanism == ZMQ_NULL && options.zap_domain.length() > 0)
);
}
void zmq::session_base_t::process_attach (i_engine *engine_)
{
zmq_assert (engine_ != NULL);
@ -494,7 +502,7 @@ void zmq::session_base_t::start_connecting (bool wait_)
// Create the connecter object.
if (addr->protocol == "tcp") {
if (options.socks_proxy_address != "") {
if (!options.socks_proxy_address.empty()) {
address_t *proxy_address = new (std::nothrow)
address_t ("tcp", options.socks_proxy_address);
alloc_assert (proxy_address);

View File

@ -69,6 +69,7 @@ namespace zmq
int push_msg (msg_t *msg_);
int zap_connect ();
bool zap_enabled ();
// Fetches a message. Returns 0 if successful; -1 otherwise.
// The caller is responsible for freeing the message when no

View File

@ -143,6 +143,7 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_) :
{
options.socket_id = sid_;
options.ipv6 = (parent_->get (ZMQ_IPV6) != 0);
options.linger = parent_->get (ZMQ_BLOCKY)? -1: 0;
}
zmq::socket_base_t::~socket_base_t ()
@ -401,7 +402,7 @@ int zmq::socket_base_t::bind (const char *addr_)
// Save last endpoint URI
listener->get_address (last_endpoint);
add_endpoint (addr_, (own_t *) listener, NULL);
add_endpoint (last_endpoint.c_str (), (own_t *) listener, NULL);
return 0;
}
@ -420,7 +421,7 @@ int zmq::socket_base_t::bind (const char *addr_)
// Save last endpoint URI
listener->get_address (last_endpoint);
add_endpoint (addr_, (own_t *) listener, NULL);
add_endpoint (last_endpoint.c_str (), (own_t *) listener, NULL);
return 0;
}
#endif
@ -505,9 +506,6 @@ int zmq::socket_base_t::connect (const char *addr_)
int rc = pipepair (parents, new_pipes, hwms, conflates);
errno_assert (rc == 0);
// Attach local end of the pipe to this socket object.
attach_pipe (new_pipes [0]);
if (!peer.socket) {
// The peer doesn't exist yet so we don't know whether
// to send the identity message or not. To resolve this,
@ -556,6 +554,9 @@ int zmq::socket_base_t::connect (const char *addr_)
send_bind (peer.socket, new_pipes [1], false);
}
// Attach local end of the pipe to this socket object.
attach_pipe (new_pipes [0]);
// Save last endpoint URI
last_endpoint.assign (addr_);

View File

@ -96,7 +96,7 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_,
int family = get_peer_ip_address (s, peer_address);
if (family == 0)
peer_address = "";
peer_address.clear();
#if defined ZMQ_HAVE_SO_PEERCRED
else
if (family == PF_UNIX) {
@ -534,6 +534,12 @@ bool zmq::stream_engine_t::handshake ()
// Is the peer using ZMTP/1.0 with no revision number?
// If so, we send and receive rest of identity message
if (greeting_recv [0] != 0xff || !(greeting_recv [9] & 0x01)) {
if (session->zap_enabled ()) {
// reject ZMTP 1.0 connections if ZAP is enabled
error (protocol_error);
return false;
}
encoder = new (std::nothrow) v1_encoder_t (out_batch_size);
alloc_assert (encoder);
@ -575,6 +581,12 @@ bool zmq::stream_engine_t::handshake ()
}
else
if (greeting_recv [revision_pos] == ZMTP_1_0) {
if (session->zap_enabled ()) {
// reject ZMTP 1.0 connections if ZAP is enabled
error (protocol_error);
return false;
}
encoder = new (std::nothrow) v1_encoder_t (
out_batch_size);
alloc_assert (encoder);
@ -585,6 +597,12 @@ bool zmq::stream_engine_t::handshake ()
}
else
if (greeting_recv [revision_pos] == ZMTP_2_0) {
if (session->zap_enabled ()) {
// reject ZMTP 2.0 connections if ZAP is enabled
error (protocol_error);
return false;
}
encoder = new (std::nothrow) v2_encoder_t (out_batch_size);
alloc_assert (encoder);
@ -642,6 +660,18 @@ bool zmq::stream_engine_t::handshake ()
}
#endif
else {
// Temporary support for security debugging
char mechanism [21];
memcpy (mechanism, greeting_recv + 12, 20);
mechanism [20] = 0;
printf ("LIBZMQ I: security failure, self=%s peer=%s\n",
options.mechanism == ZMQ_NULL? "NULL":
options.mechanism == ZMQ_PLAIN? "PLAIN":
options.mechanism == ZMQ_CURVE? "CURVE":
options.mechanism == ZMQ_GSSAPI? "GSSAPI":
"OTHER",
mechanism);
error (protocol_error);
return false;
}
@ -781,7 +811,7 @@ void zmq::stream_engine_t::mechanism_ready ()
it = zap_properties.begin ();
while (it != zap_properties.end ()) {
properties.insert (properties_t::value_type (it->first, it->second));
it++;
++it;
}
// Add ZMTP properties.
@ -789,7 +819,7 @@ void zmq::stream_engine_t::mechanism_ready ()
it = zmtp_properties.begin ();
while (it != zmtp_properties.end ()) {
properties.insert (properties_t::value_type (it->first, it->second));
it++;
++it;
}
zmq_assert (metadata == NULL);

View File

@ -28,24 +28,40 @@ zmq::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_),
verbose (false),
more (false),
lossy (true)
lossy (true),
manual(false),
welcome_msg ()
{
options.type = ZMQ_XPUB;
last_pipe = NULL;
options.type = ZMQ_XPUB;
welcome_msg.init();
}
zmq::xpub_t::~xpub_t ()
{
welcome_msg.close();
}
void zmq::xpub_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{
zmq_assert (pipe_);
dist.attach (pipe_);
// If subscribe_to_all_ is specified, the caller would like to subscribe
// to all data on this pipe, implicitly.
if (subscribe_to_all_)
subscriptions.add (NULL, 0, pipe_);
subscriptions.add (NULL, 0, pipe_);
// if welcome message exist
if (welcome_msg.size() > 0)
{
msg_t copy;
copy.init();
copy.copy(welcome_msg);
pipe_->write(&copy);
pipe_->flush();
}
// The pipe is active when attached. Let's read the subscriptions from
// it, if any.
@ -60,19 +76,28 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
// Apply the subscription to the trie
unsigned char *const data = (unsigned char *) sub.data ();
const size_t size = sub.size ();
if (size > 0 && (*data == 0 || *data == 1)) {
bool unique;
if (*data == 0)
unique = subscriptions.rm (data + 1, size - 1, pipe_);
else
unique = subscriptions.add (data + 1, size - 1, pipe_);
if (size > 0 && (*data == 0 || *data == 1)) {
if (manual)
{
last_pipe = pipe_;
pending_data.push_back(blob_t(data, size));
pending_flags.push_back(0);
}
else
{
bool unique;
if (*data == 0)
unique = subscriptions.rm(data + 1, size - 1, pipe_);
else
unique = subscriptions.add(data + 1, size - 1, pipe_);
// If the subscription is not a duplicate store it so that it can be
// passed to used on next recv call. (Unsubscribe is not verbose.)
if (options.type == ZMQ_XPUB && (unique || (*data && verbose))) {
pending_data.push_back (blob_t (data, size));
pending_flags.push_back (0);
}
// If the subscription is not a duplicate store it so that it can be
// passed to used on next recv call. (Unsubscribe is not verbose.)
if (options.type == ZMQ_XPUB && (unique || (*data && verbose))) {
pending_data.push_back(blob_t(data, size));
pending_flags.push_back(0);
}
}
}
else {
// Process user message coming upstream from xsub socket
@ -90,16 +115,42 @@ void zmq::xpub_t::xwrite_activated (pipe_t *pipe_)
int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
size_t optvallen_)
{
if (optvallen_ != sizeof (int) || *static_cast <const int*> (optval_) < 0) {
errno = EINVAL;
return -1;
}
if (option_ == ZMQ_XPUB_VERBOSE)
verbose = (*static_cast <const int*> (optval_) != 0);
else
if (option_ == ZMQ_XPUB_NODROP)
lossy = (*static_cast <const int*> (optval_) == 0);
{
if (option_ == ZMQ_XPUB_VERBOSE || option_ == ZMQ_XPUB_NODROP || option_ == ZMQ_XPUB_MANUAL)
{
if (optvallen_ != sizeof(int) || *static_cast <const int*> (optval_) < 0) {
errno = EINVAL;
return -1;
}
if (option_ == ZMQ_XPUB_VERBOSE)
verbose = (*static_cast <const int*> (optval_) != 0);
else
if (option_ == ZMQ_XPUB_NODROP)
lossy = (*static_cast <const int*> (optval_) == 0);
else
if (option_ == ZMQ_XPUB_MANUAL)
manual = (*static_cast <const int*> (optval_) != 0);
}
else
if (option_ == ZMQ_SUBSCRIBE && manual && last_pipe != NULL)
subscriptions.add((unsigned char *)optval_, optvallen_, last_pipe);
else
if (option_ == ZMQ_UNSUBSCRIBE && manual && last_pipe != NULL)
subscriptions.rm((unsigned char *)optval_, optvallen_, last_pipe);
else
if (option_ == ZMQ_XPUB_WELCOME_MSG) {
welcome_msg.close();
if (optvallen_ > 0) {
welcome_msg.init_size(optvallen_);
unsigned char *data = (unsigned char*)welcome_msg.data();
memcpy(data, optval_, optvallen_);
}
else
welcome_msg.init();
}
else {
errno = EINVAL;
return -1;
@ -189,7 +240,8 @@ void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
// to be retrived by the user later on.
blob_t unsub (size_ + 1, 0);
unsub [0] = 0;
memcpy (&unsub [1], data_, size_);
if (size_ > 0)
memcpy (&unsub [1], data_, size_);
self->pending_data.push_back (unsub);
self->pending_flags.push_back (0);
}

View File

@ -82,6 +82,15 @@ namespace zmq
// Drop messages if HWM reached, otherwise return with EAGAIN
bool lossy;
// Subscriptions will not bed added automatically, only after calling set option with ZMQ_SUBSCRIBE or ZMQ_UNSUBSCRIBE
bool manual;
// Last pipe send subscription message, only used if xpub is on manual
pipe_t *last_pipe;
// Welcome message to send to pipe when attached
msg_t welcome_msg;
// List of pending (un)subscriptions, ie. those that were already
// applied to the trie, but not yet received by the user.
typedef std::basic_string <unsigned char> blob_t;

View File

@ -722,7 +722,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
pollfds [i].fd = items_ [i].fd;
pollfds [i].events =
(items_ [i].events & ZMQ_POLLIN ? POLLIN : 0) |
(items_ [i].events & ZMQ_POLLOUT ? POLLOUT : 0);
(items_ [i].events & ZMQ_POLLOUT ? POLLOUT : 0) |
(items_ [i].events & ZMQ_POLLPRI ? POLLPRI : 0);
}
}
@ -781,7 +782,9 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
items_ [i].revents |= ZMQ_POLLIN;
if (pollfds [i].revents & POLLOUT)
items_ [i].revents |= ZMQ_POLLOUT;
if (pollfds [i].revents & ~(POLLIN | POLLOUT))
if (pollfds [i].revents & POLLPRI)
items_ [i].revents |= ZMQ_POLLPRI;
if (pollfds [i].revents & ~(POLLIN | POLLOUT | POLLPRI))
items_ [i].revents |= ZMQ_POLLERR;
}

View File

@ -22,6 +22,8 @@
#include "clock.hpp"
#include "err.hpp"
#include "thread.hpp"
#include "atomic_counter.hpp"
#include "atomic_ptr.hpp"
#include <assert.h>
#include "../include/zmq_utils.h"
@ -204,3 +206,51 @@ int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
return -1;
#endif
}
// --------------------------------------------------------------------------
// Initialize a new atomic counter, which is set to zero
void *zmq_atomic_counter_new (void)
{
zmq::atomic_counter_t *counter = new zmq::atomic_counter_t;
alloc_assert (counter);
return counter;
}
// Se the value of the atomic counter
void zmq_atomic_counter_set (void *counter_, int value_)
{
((zmq::atomic_counter_t *) counter_)->set (value_);
}
// Increment the atomic counter, and return the old value
int zmq_atomic_counter_inc (void *counter_)
{
return ((zmq::atomic_counter_t *) counter_)->add (1);
}
// Decrement the atomic counter and return 1 (if counter >= 1), or
// 0 if counter hit zero.
int zmq_atomic_counter_dec (void *counter_)
{
return ((zmq::atomic_counter_t *) counter_)->sub (1)? 1: 0;
}
// Return actual value of atomic counter
int zmq_atomic_counter_value (void *counter_)
{
return ((zmq::atomic_counter_t *) counter_)->get ();
}
// Destroy atomic counter, and set reference to NULL
void zmq_atomic_counter_destroy (void **counter_p_)
{
delete ((zmq::atomic_counter_t *) *counter_p_);
*counter_p_ = NULL;
}

View File

@ -1,165 +0,0 @@
AM_CPPFLAGS = -I$(top_builddir)/include \
-I$(top_srcdir)/include
LDADD = $(top_builddir)/src/libzmq.la
noinst_PROGRAMS = test_system \
test_pair_inproc \
test_pair_tcp \
test_reqrep_inproc \
test_reqrep_tcp \
test_hwm \
test_hwm_pubsub \
test_reqrep_device \
test_sub_forward \
test_invalid_rep \
test_msg_flags \
test_connect_resolve \
test_immediate \
test_last_endpoint \
test_term_endpoint \
test_srcfd \
test_monitor \
test_router_mandatory \
test_router_mandatory_hwm \
test_router_handover \
test_probe_router \
test_stream \
test_stream_empty \
test_stream_disconnect \
test_stream_timeout \
test_disconnect_inproc \
test_ctx_options \
test_ctx_destroy \
test_security_null \
test_security_plain \
test_security_curve \
test_iov \
test_spec_req \
test_spec_rep \
test_spec_dealer \
test_spec_router \
test_spec_pushpull \
test_req_correlate \
test_req_relaxed \
test_conflate \
test_inproc_connect \
test_issue_566 \
test_proxy \
test_many_sockets \
test_ipc_wildcard \
test_diffserv \
test_connect_rid \
test_bind_src_address \
test_metadata \
test_id2fd \
test_capabilities \
test_xpub_nodrop
if !ON_MINGW
noinst_PROGRAMS += test_shutdown_stress \
test_pair_ipc \
test_reqrep_ipc \
test_timeo \
test_filter_ipc
if HAVE_FORK
noinst_PROGRAMS += test_fork
endif
endif
if BUILD_TIPC
noinst_PROGRAMS += test_connect_delay_tipc \
test_pair_tipc \
test_reqrep_device_tipc \
test_reqrep_tipc \
test_router_mandatory_tipc \
test_shutdown_stress_tipc \
test_sub_forward_tipc \
test_term_endpoint_tipc
endif
if ON_LINUX
noinst_PROGRAMS += test_abstract_ipc
endif
test_system_SOURCES = test_system.cpp
test_pair_inproc_SOURCES = test_pair_inproc.cpp testutil.hpp
test_pair_tcp_SOURCES = test_pair_tcp.cpp testutil.hpp
test_reqrep_inproc_SOURCES = test_reqrep_inproc.cpp testutil.hpp
test_reqrep_tcp_SOURCES = test_reqrep_tcp.cpp testutil.hpp
test_hwm_SOURCES = test_hwm.cpp
test_hwm_pubsub_SOURCES = test_hwm_pubsub.cpp
test_reqrep_device_SOURCES = test_reqrep_device.cpp
test_sub_forward_SOURCES = test_sub_forward.cpp
test_invalid_rep_SOURCES = test_invalid_rep.cpp
test_msg_flags_SOURCES = test_msg_flags.cpp
test_connect_resolve_SOURCES = test_connect_resolve.cpp
test_immediate_SOURCES = test_immediate.cpp
test_last_endpoint_SOURCES = test_last_endpoint.cpp
test_term_endpoint_SOURCES = test_term_endpoint.cpp
test_srcfd_SOURCES = test_srcfd.cpp
test_monitor_SOURCES = test_monitor.cpp
test_router_mandatory_SOURCES = test_router_mandatory.cpp
test_router_mandatory_hwm_SOURCES = test_router_mandatory_hwm.cpp
test_router_handover_SOURCES = test_router_handover.cpp
test_probe_router_SOURCES = test_probe_router.cpp
test_stream_SOURCES = test_stream.cpp
test_stream_empty_SOURCES = test_stream_empty.cpp
test_stream_timeout_SOURCES = test_stream_timeout.cpp
test_stream_disconnect_SOURCES = test_stream_disconnect.cpp
test_disconnect_inproc_SOURCES = test_disconnect_inproc.cpp
test_ctx_options_SOURCES = test_ctx_options.cpp
test_iov_SOURCES = test_iov.cpp
test_ctx_destroy_SOURCES = test_ctx_destroy.cpp
test_security_null_SOURCES = test_security_null.cpp
test_security_plain_SOURCES = test_security_plain.cpp
test_security_curve_SOURCES = test_security_curve.cpp
test_spec_req_SOURCES = test_spec_req.cpp
test_spec_rep_SOURCES = test_spec_rep.cpp
test_spec_dealer_SOURCES = test_spec_dealer.cpp
test_spec_router_SOURCES = test_spec_router.cpp
test_spec_pushpull_SOURCES = test_spec_pushpull.cpp
test_req_correlate_SOURCES = test_req_correlate.cpp
test_req_relaxed_SOURCES = test_req_relaxed.cpp
test_conflate_SOURCES = test_conflate.cpp
test_inproc_connect_SOURCES = test_inproc_connect.cpp
test_issue_566_SOURCES = test_issue_566.cpp
test_proxy_SOURCES = test_proxy.cpp
test_abstract_ipc_SOURCES = test_abstract_ipc.cpp
test_many_sockets_SOURCES = test_many_sockets.cpp
test_ipc_wildcard_SOURCES = test_ipc_wildcard.cpp
test_diffserv_SOURCES = test_diffserv.cpp
test_connect_rid_SOURCES = test_connect_rid.cpp
test_bind_src_address_SOURCES = test_bind_src_address.cpp
test_metadata_SOURCES = test_metadata.cpp
test_id2fd_SOURCES = test_id2fd.cpp
test_capabilities_SOURCES = test_capabilities.cpp
test_xpub_nodrop_SOURCES = test_xpub_nodrop.cpp
if !ON_MINGW
test_shutdown_stress_SOURCES = test_shutdown_stress.cpp
test_pair_ipc_SOURCES = test_pair_ipc.cpp testutil.hpp
test_reqrep_ipc_SOURCES = test_reqrep_ipc.cpp testutil.hpp
test_timeo_SOURCES = test_timeo.cpp
if HAVE_FORK
test_fork_SOURCES = test_fork.cpp
endif
test_filter_ipc_SOURCES = test_filter_ipc.cpp
endif
if BUILD_TIPC
test_connect_delay_tipc_SOURCES = test_connect_delay_tipc.cpp
test_pair_tipc_SOURCES = test_pair_tipc.cpp
test_reqrep_device_tipc_SOURCES = test_reqrep_device_tipc.cpp
test_reqrep_tipc_SOURCES = test_reqrep_tipc.cpp
test_router_mandatory_tipc_SOURCES = test_router_mandatory_tipc.cpp
test_shutdown_stress_tipc_SOURCES = test_shutdown_stress_tipc.cpp
test_sub_forward_tipc_SOURCES = test_sub_forward_tipc.cpp
test_term_endpoint_tipc_SOURCES = test_term_endpoint_tipc.cpp
endif
# Run the test cases
TESTS = $(noinst_PROGRAMS)
XFAIL_TESTS =
if !ON_LINUX
XFAIL_TESTS += test_abstract_ipc
endif

38
tests/test_atomics.cpp Normal file
View File

@ -0,0 +1,38 @@
/*
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "testutil.hpp"
int main (void)
{
void *counter = zmq_atomic_counter_new ();
assert (zmq_atomic_counter_value (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 0);
assert (zmq_atomic_counter_inc (counter) == 1);
assert (zmq_atomic_counter_inc (counter) == 2);
assert (zmq_atomic_counter_value (counter) == 3);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_set (counter, 2);
assert (zmq_atomic_counter_dec (counter) == 1);
assert (zmq_atomic_counter_dec (counter) == 0);
zmq_atomic_counter_destroy (&counter);
return 0;
}

View File

@ -43,15 +43,26 @@ int main (void)
assert (zmq_ctx_get (ctx, ZMQ_IPV6) == 1);
void *router = zmq_socket (ctx, ZMQ_ROUTER);
int ipv6;
int value;
size_t optsize = sizeof (int);
rc = zmq_getsockopt (router, ZMQ_IPV6, &ipv6, &optsize);
rc = zmq_getsockopt (router, ZMQ_IPV6, &value, &optsize);
assert (rc == 0);
assert (ipv6);
assert (value == 1);
rc = zmq_getsockopt (router, ZMQ_LINGER, &value, &optsize);
assert (rc == 0);
assert (value == -1);
rc = zmq_close (router);
assert (rc == 0);
rc = zmq_ctx_set (ctx, ZMQ_BLOCKY, false);
assert (zmq_ctx_get (ctx, ZMQ_BLOCKY) == 0);
router = zmq_socket (ctx, ZMQ_ROUTER);
rc = zmq_getsockopt (router, ZMQ_LINGER, &value, &optsize);
assert (rc == 0);
assert (value == 0);
rc = zmq_close (router);
assert (rc == 0);
rc = zmq_ctx_term (ctx);
assert (rc == 0);

View File

@ -25,8 +25,10 @@ zmq_msg_init(&msg) && printf("zmq_msg_init: %s\n", zmq_strerror(errno)); \
zmq_msg_init_size (&msg, size + 1) && printf("zmq_msg_init_size: %s\n",zmq_strerror(errno)); \
memcpy(zmq_msg_data(&msg), data, size + 1);
int publicationsReceived = 0;
bool isSubscribed = false;
// TODO: this code fails to meet our style guidelines, and needs rewriting
static int publicationsReceived = 0;
static bool isSubscribed = false;
int main(int, char**) {
setup_test_environment();

View File

@ -122,8 +122,8 @@ int main (void)
// Get the group and supplimental groups of the process owner
gid_t groups[100];
int ngroups = getgroups(100, groups);
assert (ngroups != -1 && ngroups != 0);
gid_t group = getgid(), supgroup = groups[0], notgroup = groups[ngroups - 1] + 1;
assert (ngroups != -1);
gid_t group = getgid(), supgroup = group, notgroup = group + 1;
for (int i = 0; i < ngroups; i++) {
if (supgroup == group && group != groups[i])
supgroup = groups[i];

View File

@ -18,6 +18,17 @@
*/
#include "testutil.hpp"
#if defined (ZMQ_HAVE_WINDOWS)
# include <winsock2.h>
# include <ws2tcpip.h>
# include <stdexcept>
# define close closesocket
#else
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <unistd.h>
#endif
// We'll generate random test keys at startup
static char client_public [41];
@ -217,7 +228,46 @@ int main (void)
assert (rc == 0);
expect_bounce_fail (server, client);
close_zero_linger (client);
// Unauthenticated messages from a vanilla socket shouldn't be received
struct sockaddr_in ip4addr;
int s;
ip4addr.sin_family = AF_INET;
ip4addr.sin_port = htons (9998);
inet_pton (AF_INET, "127.0.0.1", &ip4addr.sin_addr);
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
rc = connect (s, (struct sockaddr*) &ip4addr, sizeof (ip4addr));
assert (rc > -1);
// send anonymous ZMTP/1.0 greeting
send (s, "\x01\x00", 2, 0);
// send sneaky message that shouldn't be received
send (s, "\x08\x00sneaky\0", 9, 0);
int timeout = 150;
zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout));
char *buf = s_recv (server);
if (buf != NULL) {
printf ("Received unauthenticated message: %s\n", buf);
assert (buf == NULL);
}
close (s);
// Check return codes for invalid buffer sizes
client = zmq_socket (ctx, ZMQ_DEALER);
assert (client);
errno = 0;
rc = zmq_setsockopt (client, ZMQ_CURVE_SERVERKEY, server_public, 123);
assert (rc == -1 && errno == EINVAL);
errno = 0;
rc = zmq_setsockopt (client, ZMQ_CURVE_PUBLICKEY, client_public, 123);
assert (rc == -1 && errno == EINVAL);
errno = 0;
rc = zmq_setsockopt (client, ZMQ_CURVE_SECRETKEY, client_secret, 123);
assert (rc == -1 && errno == EINVAL);
rc = zmq_close (client);
assert (rc == 0);
// Shutdown
rc = zmq_close (server);
assert (rc == 0);

View File

@ -18,6 +18,17 @@
*/
#include "testutil.hpp"
#if defined (ZMQ_HAVE_WINDOWS)
# include <winsock2.h>
# include <ws2tcpip.h>
# include <stdexcept>
# define close closesocket
#else
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <unistd.h>
#endif
static void
zap_handler (void *handler)
@ -124,6 +135,38 @@ int main (void)
close_zero_linger (client);
close_zero_linger (server);
// Unauthenticated messages from a vanilla socket shouldn't be received
server = zmq_socket (ctx, ZMQ_DEALER);
assert (server);
rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5);
assert (rc == 0);
rc = zmq_bind (server, "tcp://127.0.0.1:9003");
assert (rc == 0);
struct sockaddr_in ip4addr;
int s;
ip4addr.sin_family = AF_INET;
ip4addr.sin_port = htons(9003);
inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr);
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
rc = connect (s, (struct sockaddr*) &ip4addr, sizeof ip4addr);
assert (rc > -1);
// send anonymous ZMTP/1.0 greeting
send (s, "\x01\x00", 2, 0);
// send sneaky message that shouldn't be received
send (s, "\x08\x00sneaky\0", 9, 0);
int timeout = 150;
zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout));
char *buf = s_recv (server);
if (buf != NULL) {
printf ("Received unauthenticated message: %s\n", buf);
assert (buf == NULL);
}
close (s);
close_zero_linger (server);
// Shutdown
rc = zmq_ctx_term (ctx);
assert (rc == 0);

View File

@ -18,6 +18,17 @@
*/
#include "testutil.hpp"
#if defined (ZMQ_HAVE_WINDOWS)
# include <winsock2.h>
# include <ws2tcpip.h>
# include <stdexcept>
# define close closesocket
#else
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <unistd.h>
#endif
static void
zap_handler (void *ctx)
@ -137,6 +148,30 @@ int main (void)
expect_bounce_fail (server, client);
close_zero_linger (client);
// Unauthenticated messages from a vanilla socket shouldn't be received
struct sockaddr_in ip4addr;
int s;
ip4addr.sin_family = AF_INET;
ip4addr.sin_port = htons (9998);
inet_pton (AF_INET, "127.0.0.1", &ip4addr.sin_addr);
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
rc = connect (s, (struct sockaddr*) &ip4addr, sizeof (ip4addr));
assert (rc > -1);
// send anonymous ZMTP/1.0 greeting
send (s, "\x01\x00", 2, 0);
// send sneaky message that shouldn't be received
send (s, "\x08\x00sneaky\0", 9, 0);
int timeout = 150;
zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout));
char *buf = s_recv (server);
if (buf != NULL) {
printf ("Received unauthenticated message: %s\n", buf);
assert (buf == NULL);
}
close (s);
// Shutdown
rc = zmq_close (server);
assert (rc == 0);

View File

@ -23,8 +23,13 @@ int main (void)
{
setup_test_environment();
int rc;
char buf[32];
const size_t buf_size = 32;
char buf[buf_size];
const char *ep = "tcp://127.0.0.1:5560";
const char *ep_wc_tcp = "tcp://127.0.0.1:*";
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
const char *ep_wc_ipc = "ipc://*";
#endif
// Create infrastructure.
void *ctx = zmq_ctx_new ();
@ -100,5 +105,53 @@ int main (void)
rc = zmq_ctx_term (ctx);
assert (rc == 0);
// Create infrastructure (wild-card binding)
ctx = zmq_ctx_new ();
assert (ctx);
push = zmq_socket (ctx, ZMQ_PUSH);
assert (push);
rc = zmq_bind (push, ep_wc_tcp);
assert (rc == 0);
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
pull = zmq_socket (ctx, ZMQ_PULL);
assert (pull);
rc = zmq_bind (pull, ep_wc_ipc);
assert (rc == 0);
#endif
// Unbind sockets binded by wild-card address
rc = zmq_getsockopt (push, ZMQ_LAST_ENDPOINT, buf, (size_t *)&buf_size);
assert (rc == 0);
rc = zmq_unbind (push, buf);
assert (rc == 0);
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
rc = zmq_getsockopt (pull, ZMQ_LAST_ENDPOINT, buf, (size_t *)&buf_size);
assert (rc == 0);
rc = zmq_unbind (pull, buf);
assert (rc == 0);
#endif
// Create infrastructure (wild-card binding)
ctx = zmq_ctx_new ();
assert (ctx);
push = zmq_socket (ctx, ZMQ_PUSH);
assert (push);
rc = zmq_bind (push, ep_wc_tcp);
assert (rc == 0);
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
pull = zmq_socket (ctx, ZMQ_PULL);
assert (pull);
rc = zmq_bind (pull, ep_wc_ipc);
assert (rc == 0);
#endif
// Sockets binded by wild-card address can't be unbinded by wild-card address
rc = zmq_unbind (push, ep_wc_tcp);
assert (rc == -1 && zmq_errno () == ENOENT);
#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
rc = zmq_unbind (pull, ep_wc_ipc);
assert (rc == -1 && zmq_errno () == ENOENT);
#endif
return 0;
}

View File

@ -0,0 +1,82 @@
/*
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "testutil.hpp"
int main (void)
{
setup_test_environment();
void *ctx = zmq_ctx_new ();
assert (ctx);
// Create a publisher
void *pub = zmq_socket (ctx, ZMQ_XPUB);
assert (pub);
int rc = zmq_bind (pub, "inproc://soname");
assert (rc == 0);
// set pub socket options
int manual = 1;
rc = zmq_setsockopt(pub, ZMQ_XPUB_MANUAL, &manual, 4);
assert (rc == 0);
// Create a subscriber
void *sub = zmq_socket (ctx, ZMQ_XSUB);
assert (sub);
rc = zmq_connect (sub, "inproc://soname");
assert (rc == 0);
// Subscribe for A
char subscription[2] = { 1, 'A'};
rc = zmq_send_const(sub, subscription, 2, 0);
assert (rc == 2);
char buffer[2];
// Receive subscriptions from subscriber
rc = zmq_recv(pub, buffer, 2, 0);
assert(rc == 2);
assert(buffer[0] == 1);
assert(buffer[1] == 'A');
// Subscribe socket for B instead
rc = zmq_setsockopt(pub, ZMQ_SUBSCRIBE, "B", 1);
assert(rc == 0);
// Sending A message and B Message
rc = zmq_send_const(pub, "A", 1, 0);
assert(rc == 1);
rc = zmq_send_const(pub, "B", 1, 0);
assert(rc == 1);
rc = zmq_recv(sub, buffer, 1, ZMQ_DONTWAIT);
assert(rc == 1);
assert(buffer[0] == 'B');
// Clean up.
rc = zmq_close (pub);
assert (rc == 0);
rc = zmq_close (sub);
assert (rc == 0);
rc = zmq_ctx_term (ctx);
assert (rc == 0);
return 0 ;
}

View File

@ -0,0 +1,71 @@
/*
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "testutil.hpp"
int main (void)
{
setup_test_environment();
void *ctx = zmq_ctx_new ();
assert (ctx);
// Create a publisher
void *pub = zmq_socket (ctx, ZMQ_XPUB);
assert (pub);
int rc = zmq_bind (pub, "inproc://soname");
assert (rc == 0);
// set pub socket options
rc = zmq_setsockopt(pub, ZMQ_XPUB_WELCOME_MSG, "W", 1);
assert (rc == 0);
// Create a subscriber
void *sub = zmq_socket (ctx, ZMQ_SUB);
// Subscribe to the welcome message
rc = zmq_setsockopt(sub, ZMQ_SUBSCRIBE, "W", 1);
assert(rc == 0);
assert (sub);
rc = zmq_connect (sub, "inproc://soname");
assert (rc == 0);
char buffer[2];
// Receive the welcome subscription
rc = zmq_recv(pub, buffer, 2, 0);
assert(rc == 2);
assert(buffer[0] == 1);
assert(buffer[1] == 'W');
// Receive the welcome message
rc = zmq_recv(sub, buffer, 1, 0);
assert(rc == 1);
assert(buffer[0] == 'W');
// Clean up.
rc = zmq_close (pub);
assert (rc == 0);
rc = zmq_close (sub);
assert (rc == 0);
rc = zmq_ctx_term (ctx);
assert (rc == 0);
return 0 ;
}

View File

@ -27,7 +27,7 @@
// This defines the settle time used in tests; raise this if we
// get test failures on slower systems due to binds/connects not
// settled. Tested to work reliably at 1 msec on a fast PC.
#define SETTLE_TIME 10 // In msec
#define SETTLE_TIME 50 // In msec
#undef NDEBUG
#include <time.h>

View File

@ -1,9 +0,0 @@
EXTRA_DIST = curve_keygen.cpp
AM_CPPFLAGS = -I$(top_srcdir)/include
bin_PROGRAMS = curve_keygen
curve_keygen_LDADD = $(top_builddir)/src/libzmq.la
curve_keygen_SOURCES = curve_keygen.cpp