mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 18:40:27 +01:00
Merge branch 'master' of github.com:zeromq/libzmq
This commit is contained in:
commit
eacbd0c5df
1
.gitignore
vendored
1
.gitignore
vendored
@ -137,3 +137,4 @@ zeromq-*.tar.gz
|
||||
zeromq-*.zip
|
||||
core
|
||||
build
|
||||
test-suite.log
|
||||
|
@ -367,6 +367,7 @@ endif()
|
||||
|
||||
set(cxx-sources
|
||||
address.cpp
|
||||
client.cpp
|
||||
clock.cpp
|
||||
ctx.cpp
|
||||
curve_client.cpp
|
||||
@ -416,6 +417,7 @@ set(cxx-sources
|
||||
req.cpp
|
||||
router.cpp
|
||||
select.cpp
|
||||
server.cpp
|
||||
session_base.cpp
|
||||
signaler.cpp
|
||||
socket_base.cpp
|
||||
|
36
Makefile.am
36
Makefile.am
@ -26,6 +26,8 @@ src_libzmq_la_SOURCES = \
|
||||
src/atomic_counter.hpp \
|
||||
src/atomic_ptr.hpp \
|
||||
src/blob.hpp \
|
||||
src/client.cpp \
|
||||
src/client.hpp \
|
||||
src/clock.cpp \
|
||||
src/clock.hpp \
|
||||
src/command.hpp \
|
||||
@ -144,6 +146,8 @@ src_libzmq_la_SOURCES = \
|
||||
src/router.hpp \
|
||||
src/select.cpp \
|
||||
src/select.hpp \
|
||||
src/server.cpp \
|
||||
src/server.hpp \
|
||||
src/session_base.cpp \
|
||||
src/session_base.hpp \
|
||||
src/signaler.cpp \
|
||||
@ -208,6 +212,13 @@ src_libzmq_la_LDFLAGS = \
|
||||
-version-info @LTVER@ \
|
||||
@LIBZMQ_EXTRA_LDFLAGS@
|
||||
else
|
||||
if ON_CYGWIN
|
||||
src_libzmq_la_LDFLAGS = \
|
||||
-no-undefined \
|
||||
-avoid-version \
|
||||
-version-info @LTVER@ \
|
||||
@LIBZMQ_EXTRA_LDFLAGS@
|
||||
else
|
||||
if ON_ANDROID
|
||||
src_libzmq_la_LDFLAGS = \
|
||||
-avoid-version \
|
||||
@ -227,6 +238,7 @@ src_libzmq_la_LDFLAGS = \
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
src_libzmq_la_CPPFLAGS =
|
||||
src_libzmq_la_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@
|
||||
@ -242,6 +254,7 @@ src_libzmq_la_CPPFLAGS += ${pgm_CFLAGS}
|
||||
src_libzmq_la_LIBADD += ${pgm_LIBS}
|
||||
endif
|
||||
|
||||
if ENABLE_PERF
|
||||
noinst_PROGRAMS = \
|
||||
perf/local_lat \
|
||||
perf/remote_lat \
|
||||
@ -267,11 +280,14 @@ perf_inproc_lat_SOURCES = perf/inproc_lat.cpp
|
||||
|
||||
perf_inproc_thr_LDADD = src/libzmq.la
|
||||
perf_inproc_thr_SOURCES = perf/inproc_thr.cpp
|
||||
endif
|
||||
|
||||
if ENABLE_CURVE_KEYGEN
|
||||
bin_PROGRAMS = tools/curve_keygen
|
||||
|
||||
tools_curve_keygen_LDADD = src/libzmq.la
|
||||
tools_curve_keygen_SOURCES = tools/curve_keygen.cpp
|
||||
endif
|
||||
|
||||
#
|
||||
# tests
|
||||
@ -326,12 +342,14 @@ test_apps = \
|
||||
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_atomics \
|
||||
tests/test_client_server \
|
||||
tests/test_server_drop_more \
|
||||
tests/test_client_drop_more
|
||||
|
||||
tests_test_system_SOURCES = tests/test_system.cpp
|
||||
tests_test_system_LDADD = src/libzmq.la
|
||||
@ -488,9 +506,6 @@ 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
|
||||
|
||||
@ -506,7 +521,17 @@ tests_test_xpub_welcome_msg_LDADD = src/libzmq.la
|
||||
tests_test_atomics_SOURCES = tests/test_atomics.cpp
|
||||
tests_test_atomics_LDADD = src/libzmq.la
|
||||
|
||||
tests_test_client_server_SOURCES = tests/test_client_server.cpp
|
||||
tests_test_client_server_LDADD = src/libzmq.la
|
||||
|
||||
tests_test_server_drop_more_SOURCES = tests/test_server_drop_more.cpp
|
||||
tests_test_server_drop_more_LDADD = src/libzmq.la
|
||||
|
||||
tests_test_client_drop_more_SOURCES = tests/test_client_drop_more.cpp
|
||||
tests_test_client_drop_more_LDADD = src/libzmq.la
|
||||
|
||||
if !ON_MINGW
|
||||
if !ON_CYGWIN
|
||||
test_apps += \
|
||||
tests/test_shutdown_stress \
|
||||
tests/test_pair_ipc \
|
||||
@ -539,6 +564,7 @@ test_apps += tests/test_fork
|
||||
tests_test_fork_SOURCES = tests/test_fork.cpp
|
||||
tests_test_fork_LDADD = src/libzmq.la
|
||||
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
15
README.cygwin.md
Executable file
15
README.cygwin.md
Executable file
@ -0,0 +1,15 @@
|
||||
libzmq-cygwin
|
||||
=============
|
||||
|
||||
Definitive build fixes for cygwin (See https://github.com/zeromq/pyzmq/issues/113 for partial solution)
|
||||
|
||||
What's changed:
|
||||
./Makefile.am Add cygwin-specific target mostly the same as mingw
|
||||
./configure.ac Add cygwin-specific target mostly the same as mingw
|
||||
./tests/testutil.hpp Lengthen socket timeout to 121 seconds
|
||||
|
||||
What's new:
|
||||
./README.cygwin.md This file
|
||||
./builds/cygwin Folder for cygwin-specific build files
|
||||
./builds/cygwin/Makefile.cygwin Makefile for cygwin targets
|
||||
|
92
acinclude.m4
92
acinclude.m4
@ -586,8 +586,8 @@ dnl # LIBZMQ_CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found])
|
||||
dnl # Check if SOCK_CLOEXEC is supported #
|
||||
dnl ################################################################################
|
||||
AC_DEFUN([LIBZMQ_CHECK_SOCK_CLOEXEC], [{
|
||||
AC_MSG_CHECKING(whether SOCK_CLOEXEC is supported)
|
||||
AC_TRY_RUN([/* SOCK_CLOEXEC test */
|
||||
AC_CACHE_CHECK([whether SOCK_CLOEXEC is supported], [libzmq_cv_sock_cloexec],
|
||||
[AC_TRY_RUN([/* SOCK_CLOEXEC test */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
@ -597,9 +597,31 @@ int main (int argc, char *argv [])
|
||||
return (s == -1);
|
||||
}
|
||||
],
|
||||
[AC_MSG_RESULT(yes) ; libzmq_cv_sock_cloexec="yes" ; $1],
|
||||
[AC_MSG_RESULT(no) ; libzmq_cv_sock_cloexec="no" ; $2],
|
||||
[AC_MSG_RESULT(not during cross-compile) ; libzmq_cv_sock_cloexec="no"]
|
||||
[libzmq_cv_sock_cloexec="yes"],
|
||||
[libzmq_cv_sock_cloexec="no"],
|
||||
[libzmq_cv_sock_cloexec="not during cross-compile"]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "x$libzmq_cv_sock_cloexec" = "xyes"], [$1], [$2])
|
||||
}])
|
||||
|
||||
dnl ################################################################################
|
||||
dnl # LIBZMQ_CHECK_ATOMIC_INSTRINSICS([action-if-found], [action-if-not-found]) #
|
||||
dnl # Check if compiler supoorts __atomic_Xxx intrinsics #
|
||||
dnl ################################################################################
|
||||
AC_DEFUN([LIBZMQ_CHECK_ATOMIC_INTRINSICS], [{
|
||||
AC_MSG_CHECKING(whether compiler supports __atomic_Xxx intrinsics)
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
/* atomic intrinsics test */
|
||||
int v = 0;
|
||||
int main (int, char **)
|
||||
{
|
||||
int t = __atomic_add_fetch (&v, 1, __ATOMIC_ACQ_REL);
|
||||
return t;
|
||||
}
|
||||
])],
|
||||
[AC_MSG_RESULT(yes) ; libzmq_cv_has_atomic_instrisics="yes" ; $1],
|
||||
[AC_MSG_RESULT(no) ; libzmq_cv_has_atomic_instrisics="no" ; $2]
|
||||
)
|
||||
}])
|
||||
|
||||
@ -608,8 +630,8 @@ dnl # LIBZMQ_CHECK_SO_KEEPALIVE([action-if-found], [action-if-not-found])
|
||||
dnl # Check if SO_KEEPALIVE is supported #
|
||||
dnl ################################################################################
|
||||
AC_DEFUN([LIBZMQ_CHECK_SO_KEEPALIVE], [{
|
||||
AC_MSG_CHECKING(whether SO_KEEPALIVE is supported)
|
||||
AC_TRY_RUN([/* SO_KEEPALIVE test */
|
||||
AC_CACHE_CHECK([whether SO_KEEPALIVE is supported], [libzmq_cv_so_keepalive],
|
||||
[AC_TRY_RUN([/* SO_KEEPALIVE test */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
@ -622,10 +644,12 @@ int main (int argc, char *argv [])
|
||||
);
|
||||
}
|
||||
],
|
||||
[AC_MSG_RESULT(yes) ; libzmq_cv_so_keepalive="yes" ; $1],
|
||||
[AC_MSG_RESULT(no) ; libzmq_cv_so_keepalive="no" ; $2],
|
||||
[AC_MSG_RESULT(not during cross-compile) ; libzmq_cv_so_keepalive="no"]
|
||||
[libzmq_cv_so_keepalive="yes"],
|
||||
[libzmq_cv_so_keepalive="no"],
|
||||
[libzmq_cv_so_keepalive="not during cross-compile"]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "x$libzmq_cv_so_keepalive" = "xyes"], [$1], [$2])
|
||||
}])
|
||||
|
||||
dnl ################################################################################
|
||||
@ -633,8 +657,8 @@ dnl # LIBZMQ_CHECK_TCP_KEEPCNT([action-if-found], [action-if-not-found])
|
||||
dnl # Check if TCP_KEEPCNT is supported #
|
||||
dnl ################################################################################
|
||||
AC_DEFUN([LIBZMQ_CHECK_TCP_KEEPCNT], [{
|
||||
AC_MSG_CHECKING(whether TCP_KEEPCNT is supported)
|
||||
AC_TRY_RUN([/* TCP_KEEPCNT test */
|
||||
AC_CACHE_CHECK([whether TCP_KEEPCNT is supported], [libzmq_cv_tcp_keepcnt],
|
||||
[AC_TRY_RUN([/* TCP_KEEPCNT test */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@ -650,10 +674,12 @@ int main (int argc, char *argv [])
|
||||
);
|
||||
}
|
||||
],
|
||||
[AC_MSG_RESULT(yes) ; libzmq_cv_tcp_keepcnt="yes" ; $1],
|
||||
[AC_MSG_RESULT(no) ; libzmq_cv_tcp_keepcnt="no" ; $2],
|
||||
[AC_MSG_RESULT(not during cross-compile) ; libzmq_cv_tcp_keepcnt="no"]
|
||||
[libzmq_cv_tcp_keepcnt="yes"],
|
||||
[libzmq_cv_tcp_keepcnt="no"],
|
||||
[libzmq_cv_tcp_keepcnt="not during cross-compile"]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "x$libzmq_cv_tcp_keepcnt" = "xyes"], [$1], [$2])
|
||||
}])
|
||||
|
||||
dnl ################################################################################
|
||||
@ -661,8 +687,8 @@ dnl # LIBZMQ_CHECK_TCP_KEEPIDLE([action-if-found], [action-if-not-found])
|
||||
dnl # Check if TCP_KEEPIDLE is supported #
|
||||
dnl ################################################################################
|
||||
AC_DEFUN([LIBZMQ_CHECK_TCP_KEEPIDLE], [{
|
||||
AC_MSG_CHECKING(whether TCP_KEEPIDLE is supported)
|
||||
AC_TRY_RUN([/* TCP_KEEPIDLE test */
|
||||
AC_CACHE_CHECK([whether TCP_KEEPIDLE is supported], [libzmq_cv_tcp_keepidle],
|
||||
[AC_TRY_RUN([/* TCP_KEEPIDLE test */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@ -678,10 +704,12 @@ int main (int argc, char *argv [])
|
||||
);
|
||||
}
|
||||
],
|
||||
[AC_MSG_RESULT(yes) ; libzmq_cv_tcp_keepidle="yes" ; $1],
|
||||
[AC_MSG_RESULT(no) ; libzmq_cv_tcp_keepidle="no" ; $2],
|
||||
[AC_MSG_RESULT(not during cross-compile) ; libzmq_cv_tcp_keepidle="no"]
|
||||
[libzmq_cv_tcp_keepidle="yes"],
|
||||
[libzmq_cv_tcp_keepidle="no"],
|
||||
[libzmq_cv_tcp_keepidle="not during cross-compile"]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "x$libzmq_cv_tcp_keepidle" = "xyes"], [$1], [$2])
|
||||
}])
|
||||
|
||||
dnl ################################################################################
|
||||
@ -689,8 +717,8 @@ dnl # LIBZMQ_CHECK_TCP_KEEPINTVL([action-if-found], [action-if-not-found])
|
||||
dnl # Check if TCP_KEEPINTVL is supported #
|
||||
dnl ################################################################################
|
||||
AC_DEFUN([LIBZMQ_CHECK_TCP_KEEPINTVL], [{
|
||||
AC_MSG_CHECKING(whether TCP_KEEPINTVL is supported)
|
||||
AC_TRY_RUN([/* TCP_KEEPINTVL test */
|
||||
AC_CACHE_CHECK([whether TCP_KEEPINTVL is supported], [libzmq_cv_tcp_keepintvl],
|
||||
[AC_TRY_RUN([/* TCP_KEEPINTVL test */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@ -706,10 +734,12 @@ int main (int argc, char *argv [])
|
||||
);
|
||||
}
|
||||
],
|
||||
[AC_MSG_RESULT(yes) ; libzmq_cv_tcp_keepintvl="yes" ; $1],
|
||||
[AC_MSG_RESULT(no) ; libzmq_cv_tcp_keepintvl="no" ; $2],
|
||||
[AC_MSG_RESULT(not during cross-compile) ; libzmq_cv_tcp_keepintvl="no"]
|
||||
[libzmq_cv_tcp_keepintvl="yes"],
|
||||
[libzmq_cv_tcp_keepintvl="no"],
|
||||
[libzmq_cv_tcp_keepintvl="not during cross-compile"]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "x$libzmq_cv_tcp_keepintvl" = "xyes"], [$1], [$2])
|
||||
}])
|
||||
|
||||
dnl ################################################################################
|
||||
@ -717,8 +747,8 @@ dnl # LIBZMQ_CHECK_TCP_KEEPALIVE([action-if-found], [action-if-not-found])
|
||||
dnl # Check if TCP_KEEPALIVE is supported #
|
||||
dnl ################################################################################
|
||||
AC_DEFUN([LIBZMQ_CHECK_TCP_KEEPALIVE], [{
|
||||
AC_MSG_CHECKING(whether TCP_KEEPALIVE is supported)
|
||||
AC_TRY_RUN([/* TCP_KEEPALIVE test */
|
||||
AC_CACHE_CHECK([whether TCP_KEEPALIVE is supported], [libzmq_cv_tcp_keepalive],
|
||||
[AC_TRY_RUN([/* TCP_KEEPALIVE test */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@ -734,10 +764,12 @@ int main (int argc, char *argv [])
|
||||
);
|
||||
}
|
||||
],
|
||||
[AC_MSG_RESULT(yes) ; libzmq_cv_tcp_keepalive="yes" ; $1],
|
||||
[AC_MSG_RESULT(no) ; libzmq_cv_tcp_keepalive="no" ; $2],
|
||||
[AC_MSG_RESULT(not during cross-compile) ; libzmq_cv_tcp_keepalive="no"]
|
||||
[libzmq_cv_tcp_keepalive="yes"],
|
||||
[libzmq_cv_tcp_keepalive="no"],
|
||||
[libzmq_cv_tcp_keepalive="not during cross-compile"]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "x$libzmq_cv_tcp_keepalive" = "xyes"], [$1], [$2])
|
||||
}])
|
||||
|
||||
dnl ################################################################################
|
||||
|
47
builds/cygwin/Makefile.cygwin
Executable file
47
builds/cygwin/Makefile.cygwin
Executable file
@ -0,0 +1,47 @@
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -Os -g -DDLL_EXPORT -DFD_SETSIZE=4096 -DZMQ_USE_SELECT -I.
|
||||
LIBS=-lws2_32
|
||||
|
||||
OBJS = ctx.o reaper.o dist.o err.o \
|
||||
clock.o metadata.o random.o \
|
||||
object.o own.o \
|
||||
io_object.o io_thread.o \
|
||||
lb.o fq.o \
|
||||
address.o tcp_address.o ipc_address.o \
|
||||
ipc_connecter.o ipc_listener.o \
|
||||
tcp_connecter.o tcp_listener.o \
|
||||
mailbox.o msg.o mtrie.o \
|
||||
pipe.o precompiled.o proxy.o \
|
||||
signaler.o stream_engine.o \
|
||||
thread.o trie.o \
|
||||
ip.o tcp.o \
|
||||
pgm_socket.o pgm_receiver.o pgm_sender.o \
|
||||
raw_decoder.o raw_encoder.o \
|
||||
v1_decoder.o v1_encoder.o v2_decoder.o v2_encoder.o \
|
||||
socket_base.o session_base.o options.o \
|
||||
req.o rep.o push.o pull.o pub.o sub.o pair.o \
|
||||
dealer.o router.o xpub.o xsub.o stream.o \
|
||||
poller_base.o select.o poll.o epoll.o kqueue.o devpoll.o \
|
||||
curve_client.o curve_server.o \
|
||||
mechanism.o null_mechanism.o plain_client.o plain_server.o \
|
||||
zmq.o zmq_utils.o
|
||||
|
||||
%.o: ../../src/%.cpp
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
%.o: ../../perf/%.cpp
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
all: libzmq.dll
|
||||
|
||||
perf: inproc_lat.exe inproc_thr.exe local_lat.exe local_thr.exe remote_lat.exe remote_thr.exe
|
||||
|
||||
libzmq.dll: $(OBJS)
|
||||
g++ -shared -o $@ $^ -Wl,--out-implib,-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $@.a -Wl,--no-whole-archive $(LIBS)
|
||||
|
||||
%.exe: %.o libzmq.dll
|
||||
g++ -o $@ $^
|
||||
|
||||
clean:
|
||||
del *.o *.a *.dll *.exe
|
||||
|
@ -16,8 +16,15 @@ android_build_opts
|
||||
|
||||
# Use a temporary build directory
|
||||
cache="/tmp/android_build/${TOOLCHAIN_NAME}"
|
||||
rm -rf "${cache}"
|
||||
mkdir -p "${cache}"
|
||||
|
||||
# Check for environment variable to clear the prefix and do a clean build
|
||||
if [[ $ANDROID_BUILD_CLEAN ]]; then
|
||||
echo "Doing a clean build (removing previous build and depedencies)..."
|
||||
rm -rf "${ANDROID_BUILD_PREFIX}"/*
|
||||
fi
|
||||
|
||||
##
|
||||
# Build libsodium from latest release tarball
|
||||
|
||||
|
31
configure.ac
31
configure.ac
@ -134,6 +134,7 @@ libzmq_dso_visibility="yes"
|
||||
|
||||
# Platform specific checks
|
||||
libzmq_on_mingw32="no"
|
||||
libzmq_on_cygwin="no"
|
||||
libzmq_on_android="no"
|
||||
libzmq_on_linux="no"
|
||||
|
||||
@ -269,6 +270,8 @@ case "${host_os}" in
|
||||
# Define on Cygwin to enable all library features
|
||||
CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
|
||||
AC_DEFINE(ZMQ_HAVE_CYGWIN, 1, [Have Cygwin])
|
||||
libzmq_on_cygwin="yes"
|
||||
libzmq_dso_visibility="no"
|
||||
if test "x$enable_static" = "xyes"; then
|
||||
AC_MSG_ERROR([Building static libraries is not supported under Cygwin])
|
||||
fi
|
||||
@ -343,6 +346,22 @@ if test "x$zmq_enable_eventfd" = "xyes"; then
|
||||
[AC_DEFINE(ZMQ_HAVE_EVENTFD, 1, [Have eventfd extension.])])
|
||||
fi
|
||||
|
||||
# Conditionally build performance measurement tools
|
||||
AC_ARG_ENABLE([perf],
|
||||
[AS_HELP_STRING([--enable-perf], [Build performance measurement tools [default=yes].])],
|
||||
[zmq_enable_perf=$enableval],
|
||||
[zmq_enable_perf=yes])
|
||||
|
||||
AM_CONDITIONAL(ENABLE_PERF, test "x$zmq_enable_perf" = "xyes")
|
||||
|
||||
# Conditionally build curve key generation tool
|
||||
AC_ARG_ENABLE([curve-keygen],
|
||||
[AS_HELP_STRING([--enable-curve-keygen], [Build curve key-generation tool [default=yes].])],
|
||||
[zmq_enable_curve_keygen=$enableval],
|
||||
[zmq_enable_curve_keygen=yes])
|
||||
|
||||
AM_CONDITIONAL(ENABLE_CURVE_KEYGEN, test "x$zmq_enable_curve_keygen" = "xyes")
|
||||
|
||||
# Use c++ in subsequent tests
|
||||
AC_LANG_PUSH(C++)
|
||||
|
||||
@ -472,12 +491,22 @@ AC_LANG_POP([C++])
|
||||
|
||||
AM_CONDITIONAL(BUILD_TIPC, test "x$libzmq_tipc_support" = "xyes")
|
||||
AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes")
|
||||
AM_CONDITIONAL(ON_CYGWIN, test "x$libzmq_on_cygwin" = "xyes")
|
||||
AM_CONDITIONAL(ON_ANDROID, test "x$libzmq_on_android" = "xyes")
|
||||
AM_CONDITIONAL(ON_LINUX, test "x$libzmq_on_linux" = "xyes")
|
||||
|
||||
# Check for __atomic_Xxx compiler intrinsics
|
||||
AC_LANG_PUSH([C++])
|
||||
LIBZMQ_CHECK_ATOMIC_INTRINSICS([
|
||||
AC_DEFINE([ZMQ_HAVE_ATOMIC_INTRINSICS],
|
||||
[1],
|
||||
[Whether compiler has __atomic_Xxx intrinsics.])
|
||||
])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
# Checks for library functions.
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS(perror gettimeofday clock_gettime memset socket getifaddrs freeifaddrs fork)
|
||||
AC_CHECK_FUNCS(perror gettimeofday clock_gettime memset socket getifaddrs freeifaddrs fork posix_memalign)
|
||||
AC_CHECK_HEADERS([alloca.h])
|
||||
|
||||
LIBZMQ_CHECK_SOCK_CLOEXEC([
|
||||
|
@ -266,6 +266,29 @@ Default value:: 0 (false)
|
||||
Applicable socket types:: all, primarily when using TCP/IPC transports.
|
||||
|
||||
|
||||
ZMQ_INVERT_MATCHING: Retrieve inverted filtering status
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Returns the value of the 'ZMQ_INVERT_MATCHING' option. A value of `1`
|
||||
means the socket uses inverted prefix matching.
|
||||
|
||||
On 'PUB' and 'XPUB' sockets, this causes messages to be sent to all
|
||||
connected sockets 'except' those subscribed to a prefix that matches
|
||||
the message. On 'SUB' sockets, this causes only incoming messages that
|
||||
do 'not' match any of the socket's subscriptions to be received by the user.
|
||||
|
||||
Whenever 'ZMQ_INVERT_MATCHING' is set to 1 on a 'PUB' socket, all 'SUB'
|
||||
sockets connecting to it must also have the option set to 1. Failure to
|
||||
do so will have the 'SUB' sockets reject everything the 'PUB' socket sends
|
||||
them. 'XSUB' sockets do not need to do this because they do not filter
|
||||
incoming messages.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: int
|
||||
Option value unit:: 0,1
|
||||
Default value:: 0
|
||||
Applicable socket types:: ZMQ_PUB, ZMQ_XPUB, ZMQ_SUB
|
||||
|
||||
|
||||
ZMQ_IPV4ONLY: Retrieve IPv4-only socket override status
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Retrieve the IPv4-only option for the socket. This option is deprecated.
|
||||
@ -676,23 +699,6 @@ Option value unit:: N/A
|
||||
Default value:: not set
|
||||
Applicable socket types:: all, when using TCP transport
|
||||
|
||||
ZMQ_IDENTITY_FD: Retrieve FD associated with given identity
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The 'ZMQ_IDENTITY_FD' option shall retrieve the FD associated with given identity.
|
||||
call _zmq_getsockopt()_ with _option_value_ / _option_len_ pointing to memory
|
||||
holding the identity string. On return the start of _option_value_ buffer will be
|
||||
filled with file descriptor of the pipe with given identity if found. If the identity
|
||||
is not found ENOTSOCK is returned as _zmq_getsockopt()_ result. When the pipe is not
|
||||
using FD as lower transport you might get -1 as FD. NB: _option_value_ must be always
|
||||
big enough to hold sizeof(fd_t) bytes no matter how small the identity length is.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: character string/fd_t
|
||||
Option value unit:: N/A
|
||||
Default value:: not set
|
||||
Applicable socket types:: ROUTER
|
||||
|
||||
|
||||
RETURN VALUE
|
||||
------------
|
||||
|
@ -19,8 +19,22 @@ property specified by the 'property' argument for the message pointed to by
|
||||
the 'message' argument. Both the 'property' argument and the 'value'
|
||||
shall be NULL-terminated UTF8-encoded strings.
|
||||
|
||||
The following properties can be retrieved with the _zmq_msg_gets()_ function:
|
||||
Metadata is defined on a per-connection basis during the ZeroMQ connection
|
||||
handshake as specified in <rfc.zeromq.org/spec:37>.
|
||||
|
||||
The following ZMTP properties can be retrieved with the _zmq_msg_gets()_
|
||||
function:
|
||||
|
||||
Socket-Type
|
||||
Identity
|
||||
Resource
|
||||
|
||||
Additionally, when available for the underlying transport, the *Peer-Address*
|
||||
property will return the IP address of the remote endpoint as returned by
|
||||
getnameinfo(2).
|
||||
|
||||
Other properties may be defined based on the underlying security mechanism,
|
||||
see ZAP authenticated connection sample below.
|
||||
|
||||
RETURN VALUE
|
||||
------------
|
||||
|
@ -670,6 +670,19 @@ Default value:: -1 (infinite)
|
||||
Applicable socket types:: all
|
||||
|
||||
|
||||
ZMQ_STREAM_NOTIFY: send connect notifications
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Enables connect notifications on a STREAM socket, when set to 1. By default a
|
||||
STREAM socket does not notify new connections. When notifications are enabled,
|
||||
it delivers a zero-length message to signal new client connections.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: int
|
||||
Option value unit:: 0, 1
|
||||
Default value:: 0
|
||||
Applicable socket types:: ZMQ_STREAM
|
||||
|
||||
|
||||
ZMQ_SUBSCRIBE: Establish message filter
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
The 'ZMQ_SUBSCRIBE' option shall establish a new message filter on a 'ZMQ_SUB'
|
||||
@ -924,6 +937,29 @@ Option value unit:: boolean
|
||||
Default value:: 1 (true)
|
||||
Applicable socket types:: all, when using TCP transports.
|
||||
|
||||
|
||||
ZMQ_INVERT_MATCHING: Invert message filtering
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Reverses the filtering behavior of PUB-SUB sockets, when set to 1.
|
||||
|
||||
On 'PUB' and 'XPUB' sockets, this causes messages to be sent to all
|
||||
connected sockets 'except' those subscribed to a prefix that matches
|
||||
the message. On 'SUB' sockets, this causes only incoming messages that
|
||||
do 'not' match any of the socket's subscriptions to be received by the user.
|
||||
|
||||
Whenever 'ZMQ_INVERT_MATCHING' is set to 1 on a 'PUB' socket, all 'SUB'
|
||||
sockets connecting to it must also have the option set to 1. Failure to
|
||||
do so will have the 'SUB' sockets reject everything the 'PUB' socket sends
|
||||
them. 'XSUB' sockets do not need to do this because they do not filter
|
||||
incoming messages.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: int
|
||||
Option value unit:: 0,1
|
||||
Default value:: 0
|
||||
Applicable socket types:: ZMQ_PUB, ZMQ_XPUB, ZMQ_SUB
|
||||
|
||||
|
||||
RETURN VALUE
|
||||
------------
|
||||
The _zmq_setsockopt()_ function shall return zero if successful. Otherwise it
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -71,18 +71,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Define integer types needed for event interface */
|
||||
#define ZMQ_DEFINED_STDINT 1
|
||||
#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS
|
||||
# include <inttypes.h>
|
||||
#elif defined _MSC_VER && _MSC_VER < 1600
|
||||
# ifndef int32_t
|
||||
typedef __int32 int32_t;
|
||||
# endif
|
||||
# ifndef uint16_t
|
||||
typedef unsigned __int16 uint16_t;
|
||||
# endif
|
||||
# ifndef uint8_t
|
||||
typedef unsigned __int8 uint8_t;
|
||||
# endif
|
||||
#else
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
@ -204,7 +195,10 @@ ZMQ_EXPORT int zmq_ctx_destroy (void *context);
|
||||
/* 0MQ message definition. */
|
||||
/******************************************************************************/
|
||||
|
||||
typedef struct zmq_msg_t {unsigned char _ [48];} zmq_msg_t;
|
||||
/* union here ensures correct alignment on architectures that require it, e.g.
|
||||
* SPARC
|
||||
*/
|
||||
typedef union zmq_msg_t {unsigned char _ [64]; void *p; } zmq_msg_t;
|
||||
|
||||
typedef void (zmq_free_fn) (void *data, void *hint);
|
||||
|
||||
@ -223,6 +217,8 @@ ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg);
|
||||
ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property);
|
||||
ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval);
|
||||
ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property);
|
||||
ZMQ_EXPORT int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id);
|
||||
ZMQ_EXPORT uint32_t zmq_msg_get_routing_id(zmq_msg_t *msg);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
@ -242,6 +238,8 @@ ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property);
|
||||
#define ZMQ_XPUB 9
|
||||
#define ZMQ_XSUB 10
|
||||
#define ZMQ_STREAM 11
|
||||
#define ZMQ_SERVER 12
|
||||
#define ZMQ_CLIENT 13
|
||||
|
||||
/* Deprecated aliases */
|
||||
#define ZMQ_XREQ ZMQ_DEALER
|
||||
@ -301,12 +299,13 @@ ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property);
|
||||
#define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64
|
||||
#define ZMQ_GSSAPI_PLAINTEXT 65
|
||||
#define ZMQ_HANDSHAKE_IVL 66
|
||||
#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
|
||||
#define ZMQ_STREAM_NOTIFY 73
|
||||
#define ZMQ_INVERT_MATCHING 74
|
||||
|
||||
/* Message options */
|
||||
#define ZMQ_MORE 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
#if defined ZMQ_FORCE_MUTEXES
|
||||
#define ZMQ_ATOMIC_COUNTER_MUTEX
|
||||
#elif defined ZMQ_HAVE_ATOMIC_INTRINSICS
|
||||
#define ZMQ_ATOMIC_INTRINSIC
|
||||
#elif (defined __i386__ || defined __x86_64__) && defined __GNUC__
|
||||
#define ZMQ_ATOMIC_COUNTER_X86
|
||||
#elif defined __ARM_ARCH_7A__ && defined __GNUC__
|
||||
@ -83,6 +85,8 @@ namespace zmq
|
||||
|
||||
#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
|
||||
old_value = InterlockedExchangeAdd ((LONG*) &value, increment_);
|
||||
#elif defined ZMQ_ATOMIC_INTRINSIC
|
||||
old_value = __atomic_fetch_add(&value, increment_, __ATOMIC_ACQ_REL);
|
||||
#elif defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
|
||||
integer_t new_value = atomic_add_32_nv (&value, increment_);
|
||||
old_value = new_value - increment_;
|
||||
@ -125,6 +129,9 @@ namespace zmq
|
||||
LONG delta = - ((LONG) decrement);
|
||||
integer_t old = InterlockedExchangeAdd ((LONG*) &value, delta);
|
||||
return old - decrement != 0;
|
||||
#elif defined ZMQ_ATOMIC_INTRINSIC
|
||||
integer_t nv = __atomic_sub_fetch(&value, decrement, __ATOMIC_ACQ_REL);
|
||||
return nv != 0;
|
||||
#elif defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
|
||||
int32_t delta = - ((int32_t) decrement);
|
||||
integer_t nv = atomic_add_32_nv (&value, delta);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -24,6 +24,8 @@
|
||||
|
||||
#if defined ZMQ_FORCE_MUTEXES
|
||||
#define ZMQ_ATOMIC_PTR_MUTEX
|
||||
#elif defined ZMQ_HAVE_ATOMIC_INTRINSICS
|
||||
#define ZMQ_ATOMIC_PTR_INTRINSIC
|
||||
#elif (defined __i386__ || defined __x86_64__) && defined __GNUC__
|
||||
#define ZMQ_ATOMIC_PTR_X86
|
||||
#elif defined __ARM_ARCH_7A__ && defined __GNUC__
|
||||
@ -82,6 +84,8 @@ namespace zmq
|
||||
{
|
||||
#if defined ZMQ_ATOMIC_PTR_WINDOWS
|
||||
return (T*) InterlockedExchangePointer ((PVOID*) &ptr, val_);
|
||||
#elif defined ZMQ_ATOMIC_PTR_INTRINSIC
|
||||
return (T*) __atomic_exchange_n (&ptr, val_, __ATOMIC_ACQ_REL);
|
||||
#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
|
||||
return (T*) atomic_swap_ptr (&ptr, val_);
|
||||
#elif defined ZMQ_ATOMIC_PTR_TILE
|
||||
@ -127,6 +131,11 @@ namespace zmq
|
||||
#if defined ZMQ_ATOMIC_PTR_WINDOWS
|
||||
return (T*) InterlockedCompareExchangePointer (
|
||||
(volatile PVOID*) &ptr, val_, cmp_);
|
||||
#elif defined ZMQ_ATOMIC_PTR_INTRINSIC
|
||||
T *old = cmp_;
|
||||
__atomic_compare_exchange_n (&ptr, (volatile T**) &old, val_, false,
|
||||
__ATOMIC_RELEASE, __ATOMIC_ACQUIRE);
|
||||
return old;
|
||||
#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
|
||||
return (T*) atomic_cas_ptr (&ptr, cmp_, val_);
|
||||
#elif defined ZMQ_ATOMIC_PTR_TILE
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
102
src/client.cpp
Normal file
102
src/client.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
Copyright (c) 2007-2015 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 "client.hpp"
|
||||
#include "err.hpp"
|
||||
#include "msg.hpp"
|
||||
|
||||
zmq::client_t::client_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
|
||||
socket_base_t (parent_, tid_, sid_)
|
||||
{
|
||||
options.type = ZMQ_CLIENT;
|
||||
}
|
||||
|
||||
zmq::client_t::~client_t ()
|
||||
{
|
||||
}
|
||||
|
||||
void zmq::client_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
|
||||
{
|
||||
// subscribe_to_all_ is unused
|
||||
(void) subscribe_to_all_;
|
||||
|
||||
zmq_assert (pipe_);
|
||||
|
||||
fq.attach (pipe_);
|
||||
lb.attach (pipe_);
|
||||
}
|
||||
|
||||
int zmq::client_t::xsend (msg_t *msg_)
|
||||
{
|
||||
zmq_assert(!(msg_->flags () & msg_t::more));
|
||||
|
||||
return lb.sendpipe (msg_, NULL);
|
||||
}
|
||||
|
||||
int zmq::client_t::xrecv (msg_t *msg_)
|
||||
{
|
||||
int rc = fq.recvpipe (msg_, NULL);
|
||||
|
||||
// Drop any messages with more flag
|
||||
while (rc == 0 && msg_->flags () & msg_t::more) {
|
||||
|
||||
// drop all frames of the current multi-frame message
|
||||
rc = fq.recvpipe (msg_, NULL);
|
||||
|
||||
while (rc == 0 && msg_->flags () & msg_t::more)
|
||||
rc = fq.recvpipe (msg_, NULL);
|
||||
|
||||
// get the new message
|
||||
if (rc == 0)
|
||||
rc = fq.recvpipe (msg_, NULL);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool zmq::client_t::xhas_in ()
|
||||
{
|
||||
return fq.has_in ();
|
||||
}
|
||||
|
||||
bool zmq::client_t::xhas_out ()
|
||||
{
|
||||
return lb.has_out ();
|
||||
}
|
||||
|
||||
zmq::blob_t zmq::client_t::get_credential () const
|
||||
{
|
||||
return fq.get_credential ();
|
||||
}
|
||||
|
||||
void zmq::client_t::xread_activated (pipe_t *pipe_)
|
||||
{
|
||||
fq.activated (pipe_);
|
||||
}
|
||||
|
||||
void zmq::client_t::xwrite_activated (pipe_t *pipe_)
|
||||
{
|
||||
lb.activated (pipe_);
|
||||
}
|
||||
|
||||
void zmq::client_t::xpipe_terminated (pipe_t *pipe_)
|
||||
{
|
||||
fq.pipe_terminated (pipe_);
|
||||
lb.pipe_terminated (pipe_);
|
||||
}
|
71
src/client.hpp
Normal file
71
src/client.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (c) 2007-2015 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/>.
|
||||
*/
|
||||
|
||||
#ifndef __ZMQ_CLIENT_HPP_INCLUDED__
|
||||
#define __ZMQ_CLIENT_HPP_INCLUDED__
|
||||
|
||||
#include "socket_base.hpp"
|
||||
#include "session_base.hpp"
|
||||
#include "fq.hpp"
|
||||
#include "lb.hpp"
|
||||
|
||||
namespace zmq
|
||||
{
|
||||
|
||||
class ctx_t;
|
||||
class msg_t;
|
||||
class pipe_t;
|
||||
class io_thread_t;
|
||||
class socket_base_t;
|
||||
|
||||
class client_t :
|
||||
public socket_base_t
|
||||
{
|
||||
public:
|
||||
|
||||
client_t (zmq::ctx_t *parent_, uint32_t tid_, int sid);
|
||||
~client_t ();
|
||||
|
||||
protected:
|
||||
|
||||
// Overrides of functions from socket_base_t.
|
||||
void xattach_pipe (zmq::pipe_t *pipe_, bool subscribe_to_all_);
|
||||
int xsend (zmq::msg_t *msg_);
|
||||
int xrecv (zmq::msg_t *msg_);
|
||||
bool xhas_in ();
|
||||
bool xhas_out ();
|
||||
blob_t get_credential () const;
|
||||
void xread_activated (zmq::pipe_t *pipe_);
|
||||
void xwrite_activated (zmq::pipe_t *pipe_);
|
||||
void xpipe_terminated (zmq::pipe_t *pipe_);
|
||||
|
||||
private:
|
||||
|
||||
// Messages are fair-queued from inbound pipes. And load-balanced to
|
||||
// the outbound pipes.
|
||||
fq_t fq;
|
||||
lb_t lb;
|
||||
|
||||
client_t (const client_t &);
|
||||
const client_t &operator = (const client_t&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -33,7 +33,11 @@ namespace zmq
|
||||
|
||||
// This structure defines the commands that can be sent between threads.
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__declspec(align(64)) struct command_t
|
||||
#else
|
||||
struct command_t
|
||||
#endif
|
||||
{
|
||||
// Object to process the command.
|
||||
zmq::object_t *destination;
|
||||
@ -59,7 +63,8 @@ namespace zmq
|
||||
done
|
||||
} type;
|
||||
|
||||
union {
|
||||
union args_t
|
||||
{
|
||||
|
||||
// Sent to I/O thread to let it know that it should
|
||||
// terminate itself.
|
||||
@ -146,8 +151,11 @@ namespace zmq
|
||||
} done;
|
||||
|
||||
} args;
|
||||
#ifdef _MSC_VER
|
||||
};
|
||||
|
||||
#else
|
||||
} __attribute__((aligned(64)));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
18
src/dist.cpp
Executable file → Normal file
18
src/dist.cpp
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -69,6 +69,22 @@ void zmq::dist_t::match (pipe_t *pipe_)
|
||||
matching++;
|
||||
}
|
||||
|
||||
void zmq::dist_t::reverse_match ()
|
||||
{
|
||||
pipes_t::size_type prev_matching = matching;
|
||||
|
||||
// Reset matching to 0
|
||||
unmatch();
|
||||
|
||||
// Mark all matching pipes as not matching and vice-versa.
|
||||
// To do this, push all pipes that are eligible but not
|
||||
// matched - i.e. between "matching" and "eligible" -
|
||||
// to the beginning of the queue.
|
||||
for (pipes_t::size_type i = prev_matching; i < eligible; ++i) {
|
||||
pipes.swap(i, matching++);
|
||||
}
|
||||
}
|
||||
|
||||
void zmq::dist_t::unmatch ()
|
||||
{
|
||||
matching = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -50,6 +50,9 @@ namespace zmq
|
||||
// will send message also to this pipe.
|
||||
void match (zmq::pipe_t *pipe_);
|
||||
|
||||
// Marks all pipes that are not matched as matched and vice-versa.
|
||||
void reverse_match();
|
||||
|
||||
// Mark all pipes as non-matching.
|
||||
void unmatch ();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -20,8 +20,6 @@
|
||||
#ifndef __ZMQ_I_ENGINE_HPP_INCLUDED__
|
||||
#define __ZMQ_I_ENGINE_HPP_INCLUDED__
|
||||
|
||||
#include "fd.hpp"
|
||||
|
||||
namespace zmq
|
||||
{
|
||||
|
||||
@ -50,9 +48,6 @@ namespace zmq
|
||||
virtual void restart_output () = 0;
|
||||
|
||||
virtual void zap_msg_available () = 0;
|
||||
|
||||
// provide a way to link from engine to file descriptor
|
||||
virtual fd_t get_assoc_fd () { return retired_fd;};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -64,8 +64,8 @@ const char *zmq::mechanism_t::socket_type_string (int socket_type) const
|
||||
{
|
||||
static const char *names [] = {"PAIR", "PUB", "SUB", "REQ", "REP",
|
||||
"DEALER", "ROUTER", "PULL", "PUSH",
|
||||
"XPUB", "XSUB", "STREAM"};
|
||||
zmq_assert (socket_type >= 0 && socket_type <= 10);
|
||||
"XPUB", "XSUB", "STREAM", "SERVER", "CLIENT"};
|
||||
zmq_assert (socket_type >= 0 && socket_type <= 13);
|
||||
return names [socket_type];
|
||||
}
|
||||
|
||||
@ -177,6 +177,10 @@ bool zmq::mechanism_t::check_socket_type (const std::string& type_) const
|
||||
return type_ == "PUB" || type_ == "XPUB";
|
||||
case ZMQ_PAIR:
|
||||
return type_ == "PAIR";
|
||||
case ZMQ_SERVER:
|
||||
return type_ == "CLIENT";
|
||||
case ZMQ_CLIENT:
|
||||
return type_ == "CLIENT" || type_ == "SERVER";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -25,10 +25,6 @@ zmq::metadata_t::metadata_t (const dict_t &dict) :
|
||||
{
|
||||
}
|
||||
|
||||
zmq::metadata_t::~metadata_t ()
|
||||
{
|
||||
}
|
||||
|
||||
const char *zmq::metadata_t::get (const std::string &property) const
|
||||
{
|
||||
dict_t::const_iterator it = dict.find (property);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -30,29 +30,29 @@ namespace zmq
|
||||
class metadata_t
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::map <std::string, const std::string> dict_t;
|
||||
typedef std::map <std::string, std::string> dict_t;
|
||||
|
||||
metadata_t (const dict_t &dict);
|
||||
virtual ~metadata_t ();
|
||||
|
||||
// Returns pointer to property value or NULL if
|
||||
// property is not found.
|
||||
virtual const char *get (const std::string &property) const;
|
||||
const char *get (const std::string &property) const;
|
||||
|
||||
virtual void add_ref ();
|
||||
void add_ref ();
|
||||
|
||||
// Drop reference. Returns true iff the reference
|
||||
// counter drops to zero.
|
||||
virtual bool drop_ref ();
|
||||
bool drop_ref ();
|
||||
|
||||
private:
|
||||
metadata_t(const metadata_t&);
|
||||
metadata_t & operator=(const metadata_t&);
|
||||
|
||||
// Reference counter.
|
||||
atomic_counter_t ref_cnt;
|
||||
|
||||
// Dictionary holding metadata.
|
||||
const dict_t dict;
|
||||
dict_t dict;
|
||||
};
|
||||
|
||||
}
|
||||
|
19
src/msg.cpp
19
src/msg.cpp
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -46,6 +46,7 @@ int zmq::msg_t::init ()
|
||||
u.vsm.type = type_vsm;
|
||||
u.vsm.flags = 0;
|
||||
u.vsm.size = 0;
|
||||
u.vsm.routing_id = 0;
|
||||
file_desc = -1;
|
||||
return 0;
|
||||
}
|
||||
@ -58,11 +59,13 @@ int zmq::msg_t::init_size (size_t size_)
|
||||
u.vsm.type = type_vsm;
|
||||
u.vsm.flags = 0;
|
||||
u.vsm.size = (unsigned char) size_;
|
||||
u.vsm.routing_id = 0;
|
||||
}
|
||||
else {
|
||||
u.lmsg.metadata = NULL;
|
||||
u.lmsg.type = type_lmsg;
|
||||
u.lmsg.flags = 0;
|
||||
u.lmsg.routing_id = 0;
|
||||
u.lmsg.content =
|
||||
(content_t*) malloc (sizeof (content_t) + size_);
|
||||
if (unlikely (!u.lmsg.content)) {
|
||||
@ -95,11 +98,13 @@ int zmq::msg_t::init_data (void *data_, size_t size_, msg_free_fn *ffn_,
|
||||
u.cmsg.flags = 0;
|
||||
u.cmsg.data = data_;
|
||||
u.cmsg.size = size_;
|
||||
u.cmsg.routing_id = 0;
|
||||
}
|
||||
else {
|
||||
u.lmsg.metadata = NULL;
|
||||
u.lmsg.type = type_lmsg;
|
||||
u.lmsg.flags = 0;
|
||||
u.lmsg.routing_id = 0;
|
||||
u.lmsg.content = (content_t*) malloc (sizeof (content_t));
|
||||
if (!u.lmsg.content) {
|
||||
errno = ENOMEM;
|
||||
@ -121,6 +126,7 @@ int zmq::msg_t::init_delimiter ()
|
||||
u.delimiter.metadata = NULL;
|
||||
u.delimiter.type = type_delimiter;
|
||||
u.delimiter.flags = 0;
|
||||
u.delimiter.routing_id = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -377,3 +383,14 @@ bool zmq::msg_t::rm_refs (int refs_)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t zmq::msg_t::get_routing_id()
|
||||
{
|
||||
return u.base.routing_id;
|
||||
}
|
||||
|
||||
int zmq::msg_t::set_routing_id(uint32_t routing_id_)
|
||||
{
|
||||
u.base.routing_id = routing_id_;
|
||||
return 0;
|
||||
}
|
||||
|
21
src/msg.hpp
21
src/msg.hpp
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -79,6 +79,8 @@ namespace zmq
|
||||
bool is_delimiter () const;
|
||||
bool is_vsm ();
|
||||
bool is_cmsg ();
|
||||
uint32_t get_routing_id();
|
||||
int set_routing_id(uint32_t routing_id_);
|
||||
|
||||
// After calling this function you can copy the message in POD-style
|
||||
// refs_ times. No need to call copy.
|
||||
@ -92,8 +94,8 @@ namespace zmq
|
||||
|
||||
// Size in bytes of the largest message that is still copied around
|
||||
// rather than being reference-counted.
|
||||
enum { msg_t_size = 48 };
|
||||
enum { max_vsm_size = msg_t_size - (8 + sizeof (metadata_t *) + 3) };
|
||||
enum { msg_t_size = 64 };
|
||||
enum { max_vsm_size = msg_t_size - (8 + sizeof (metadata_t *) + 3 + sizeof(uint32_t)) };
|
||||
|
||||
// Shared message buffer. Message data are either allocated in one
|
||||
// continuous block along with this structure - thus avoiding one
|
||||
@ -136,9 +138,10 @@ namespace zmq
|
||||
union {
|
||||
struct {
|
||||
metadata_t *metadata;
|
||||
unsigned char unused [msg_t_size - (8 + sizeof (metadata_t *) + 2)];
|
||||
unsigned char unused [msg_t_size - (8 + sizeof (metadata_t *) + 2 + sizeof(uint32_t))];
|
||||
unsigned char type;
|
||||
unsigned char flags;
|
||||
uint32_t routing_id;
|
||||
} base;
|
||||
struct {
|
||||
metadata_t *metadata;
|
||||
@ -146,28 +149,32 @@ namespace zmq
|
||||
unsigned char size;
|
||||
unsigned char type;
|
||||
unsigned char flags;
|
||||
uint32_t routing_id;
|
||||
} vsm;
|
||||
struct {
|
||||
metadata_t *metadata;
|
||||
content_t *content;
|
||||
unsigned char unused [msg_t_size - (8 + sizeof (metadata_t *) + sizeof (content_t*) + 2)];
|
||||
unsigned char unused [msg_t_size - (8 + sizeof (metadata_t *) + sizeof (content_t*) + 2 + sizeof(uint32_t))];
|
||||
unsigned char type;
|
||||
unsigned char flags;
|
||||
uint32_t routing_id;
|
||||
} lmsg;
|
||||
struct {
|
||||
metadata_t *metadata;
|
||||
void* data;
|
||||
size_t size;
|
||||
unsigned char unused
|
||||
[msg_t_size - (8 + sizeof (metadata_t *) + sizeof (void*) + sizeof (size_t) + 2)];
|
||||
[msg_t_size - (8 + sizeof (metadata_t *) + sizeof (void*) + sizeof (size_t) + 2 + sizeof(uint32_t))];
|
||||
unsigned char type;
|
||||
unsigned char flags;
|
||||
uint32_t routing_id;
|
||||
} cmsg;
|
||||
struct {
|
||||
metadata_t *metadata;
|
||||
unsigned char unused [msg_t_size - (8 + sizeof (metadata_t *) + 2)];
|
||||
unsigned char unused [msg_t_size - (8 + sizeof (metadata_t *) + 2 + sizeof(uint32_t))];
|
||||
unsigned char type;
|
||||
unsigned char flags;
|
||||
uint32_t routing_id;
|
||||
} delimiter;
|
||||
} u;
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -45,8 +45,10 @@ zmq::options_t::options_t () :
|
||||
ipv6 (0),
|
||||
immediate (0),
|
||||
filter (false),
|
||||
invert_matching(false),
|
||||
recv_identity (false),
|
||||
raw_sock (false),
|
||||
raw_socket (false),
|
||||
raw_notify (false),
|
||||
tcp_keepalive (-1),
|
||||
tcp_keepalive_cnt (-1),
|
||||
tcp_keepalive_idle (-1),
|
||||
@ -499,6 +501,13 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
||||
}
|
||||
break;
|
||||
|
||||
case ZMQ_INVERT_MATCHING:
|
||||
if (is_int) {
|
||||
invert_matching = (value != 0);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
#if defined (ZMQ_ACT_MILITANT)
|
||||
// There are valid scenarios for probing with unknown socket option
|
||||
@ -845,6 +854,13 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
||||
}
|
||||
break;
|
||||
|
||||
case ZMQ_INVERT_MATCHING:
|
||||
if (is_int) {
|
||||
*value = invert_matching;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
#if defined (ZMQ_ACT_MILITANT)
|
||||
malformed = false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
@ -108,11 +108,17 @@ namespace zmq
|
||||
// If 1, (X)SUB socket should filter the messages. If 0, it should not.
|
||||
bool filter;
|
||||
|
||||
// If true, the subscription matching on (X)PUB and (X)SUB sockets
|
||||
// is reversed. Messages are sent to and received by non-matching
|
||||
// sockets.
|
||||
bool invert_matching;
|
||||
|
||||
// If true, the identity message is forwarded to the socket.
|
||||
bool recv_identity;
|
||||
|
||||
// if true, router socket accepts non-zmq tcp connections
|
||||
bool raw_sock;
|
||||
bool raw_socket;
|
||||
bool raw_notify; // Provide connect notifications
|
||||
|
||||
// Addres of SOCKS proxy
|
||||
std::string socks_proxy_address;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user