summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:01:47 +0900
committerMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:01:47 +0900
commit4a7aad06d95701cf232198093ce396dcdbb53e5b (patch)
tree8ced8929e603a179d9434099244dfd782e705d5e
parent1fc63e4dbcf1438eb571d720f57be68852f820f7 (diff)
ZeroMQ renamed to Crossroads
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r--MAINTAINERS56
-rw-r--r--Makefile.am1
-rw-r--r--NEWS153
-rw-r--r--README25
-rw-r--r--acinclude.m4452
-rwxr-xr-xautogen.sh22
-rw-r--r--builds/msvc/Makefile.am4
-rw-r--r--builds/msvc/libzmq/libzmq.vcproj2
-rw-r--r--builds/msvc/platform.hpp16
-rw-r--r--builds/msvc/properties/WithOpenPGM.props4
-rw-r--r--configure.in164
-rw-r--r--doc/Makefile.am22
-rw-r--r--doc/asciidoc.conf18
-rw-r--r--doc/xs.txt187
-rw-r--r--doc/xs_bind.txt (renamed from doc/zmq_bind.txt)46
-rw-r--r--doc/xs_close.txt52
-rw-r--r--doc/xs_connect.txt (renamed from doc/zmq_connect.txt)50
l---------doc/xs_epgm.txt (renamed from doc/zmq_epgm.txt)0
-rw-r--r--doc/xs_errno.txt50
-rw-r--r--doc/xs_getmsgopt.txt (renamed from doc/zmq_getmsgopt.txt)44
-rw-r--r--doc/xs_getsockopt.txt (renamed from doc/zmq_getsockopt.txt)198
-rw-r--r--doc/xs_init.txt (renamed from doc/zmq_init.txt)24
-rw-r--r--doc/xs_inproc.txt (renamed from doc/zmq_inproc.txt)48
-rw-r--r--doc/xs_ipc.txt (renamed from doc/zmq_ipc.txt)34
-rw-r--r--doc/xs_msg_close.txt55
-rw-r--r--doc/xs_msg_copy.txt57
-rw-r--r--doc/xs_msg_data.txt48
-rw-r--r--doc/xs_msg_init.txt65
-rw-r--r--doc/xs_msg_init_data.txt85
-rw-r--r--doc/xs_msg_init_size.txt58
-rw-r--r--doc/xs_msg_move.txt52
-rw-r--r--doc/xs_msg_size.txt48
-rw-r--r--doc/xs_pgm.txt (renamed from doc/zmq_pgm.txt)62
-rw-r--r--doc/xs_poll.txt129
-rw-r--r--doc/xs_recv.txt (renamed from doc/zmq_recv.txt)50
-rw-r--r--doc/xs_recvmsg.txt (renamed from doc/zmq_recvmsg.txt)70
-rw-r--r--doc/xs_send.txt (renamed from doc/zmq_send.txt)56
-rw-r--r--doc/xs_sendmsg.txt (renamed from doc/zmq_sendmsg.txt)68
-rw-r--r--doc/xs_setsockopt.txt (renamed from doc/zmq_setsockopt.txt)201
-rw-r--r--doc/xs_socket.txt (renamed from doc/zmq_socket.txt)248
-rw-r--r--doc/xs_strerror.txt55
-rw-r--r--doc/xs_tcp.txt (renamed from doc/zmq_tcp.txt)44
-rw-r--r--doc/xs_term.txt65
-rw-r--r--doc/xs_version.txt53
-rw-r--r--doc/zmq.txt217
-rw-r--r--doc/zmq_close.txt52
-rw-r--r--doc/zmq_errno.txt50
-rw-r--r--doc/zmq_msg_close.txt55
-rw-r--r--doc/zmq_msg_copy.txt57
-rw-r--r--doc/zmq_msg_data.txt48
-rw-r--r--doc/zmq_msg_init.txt65
-rw-r--r--doc/zmq_msg_init_data.txt85
-rw-r--r--doc/zmq_msg_init_size.txt58
-rw-r--r--doc/zmq_msg_move.txt52
-rw-r--r--doc/zmq_msg_size.txt48
-rw-r--r--doc/zmq_poll.txt129
-rw-r--r--doc/zmq_strerror.txt55
-rw-r--r--doc/zmq_term.txt65
-rw-r--r--doc/zmq_version.txt53
-rw-r--r--include/xs.h246
-rw-r--r--include/xs_utils.h (renamed from include/zmq_utils.h)30
-rw-r--r--include/zmq.h246
-rw-r--r--perf/Makefile.am12
-rw-r--r--perf/inproc_lat.cpp104
-rw-r--r--perf/inproc_thr.cpp104
-rw-r--r--perf/local_lat.cpp54
-rw-r--r--perf/local_thr.cpp60
-rw-r--r--perf/remote_lat.cpp58
-rw-r--r--perf/remote_thr.cpp52
-rw-r--r--src/Makefile.am22
-rw-r--r--src/array.hpp14
-rw-r--r--src/atomic_counter.hpp70
-rw-r--r--src/atomic_ptr.hpp70
-rw-r--r--src/blob.hpp14
-rw-r--r--src/clock.cpp22
-rw-r--r--src/clock.hpp14
-rw-r--r--src/command.hpp24
-rw-r--r--src/config.hpp14
-rw-r--r--src/ctx.cpp76
-rw-r--r--src/ctx.hpp38
-rw-r--r--src/decoder.cpp26
-rw-r--r--src/decoder.hpp23
-rw-r--r--src/devpoll.cpp40
-rw-r--r--src/devpoll.hpp20
-rw-r--r--src/dist.cpp36
-rw-r--r--src/dist.hpp32
-rw-r--r--src/encoder.cpp18
-rw-r--r--src/encoder.hpp21
-rw-r--r--src/epoll.cpp34
-rw-r--r--src/epoll.hpp20
-rw-r--r--src/err.cpp28
-rw-r--r--src/err.hpp50
-rw-r--r--src/fd.hpp17
-rw-r--r--src/fq.cpp28
-rw-r--r--src/fq.hpp14
-rw-r--r--src/i_engine.hpp16
-rw-r--r--src/i_poll_events.hpp18
-rw-r--r--src/io_object.cpp50
-rw-r--r--src/io_object.hpp18
-rw-r--r--src/io_thread.cpp36
-rw-r--r--src/io_thread.hpp16
-rw-r--r--src/ip.cpp42
-rw-r--r--src/ip.hpp14
-rw-r--r--src/ipc_address.cpp20
-rw-r--r--src/ipc_address.hpp16
-rw-r--r--src/ipc_connecter.cpp48
-rw-r--r--src/ipc_connecter.hpp18
-rw-r--r--src/ipc_listener.cpp32
-rw-r--r--src/ipc_listener.hpp22
-rw-r--r--src/kqueue.cpp40
-rw-r--r--src/kqueue.hpp20
-rw-r--r--src/lb.cpp28
-rw-r--r--src/lb.hpp14
-rw-r--r--src/libxs.pc.in (renamed from src/libzmq.pc.in)6
-rw-r--r--src/likely.hpp12
-rw-r--r--src/mailbox.cpp22
-rw-r--r--src/mailbox.hpp14
-rw-r--r--src/monitor.cpp24
-rw-r--r--src/monitor.hpp14
-rw-r--r--src/msg.cpp68
-rw-r--r--src/msg.hpp18
-rw-r--r--src/mtrie.cpp40
-rw-r--r--src/mtrie.hpp30
-rw-r--r--src/mutex.hpp18
-rw-r--r--src/object.cpp166
-rw-r--r--src/object.hpp72
-rw-r--r--src/options.cpp82
-rw-r--r--src/options.hpp12
-rw-r--r--src/own.cpp52
-rw-r--r--src/own.hpp20
-rw-r--r--src/pair.cpp40
-rw-r--r--src/pair.hpp30
-rw-r--r--src/pgm_receiver.cpp50
-rw-r--r--src/pgm_receiver.hpp26
-rw-r--r--src/pgm_sender.cpp44
-rw-r--r--src/pgm_sender.hpp24
-rw-r--r--src/pgm_socket.cpp146
-rw-r--r--src/pgm_socket.hpp16
-rw-r--r--src/pipe.cpp76
-rw-r--r--src/pipe.hpp28
-rw-r--r--src/poll.cpp36
-rw-r--r--src/poll.hpp20
-rw-r--r--src/poller.hpp80
-rw-r--r--src/poller_base.cpp26
-rw-r--r--src/poller_base.hpp20
-rw-r--r--src/precompiled.cpp8
-rw-r--r--src/precompiled.hpp16
-rw-r--r--src/pub.cpp20
-rw-r--r--src/pub.hpp20
-rw-r--r--src/pull.cpp28
-rw-r--r--src/pull.hpp24
-rw-r--r--src/push.cpp28
-rw-r--r--src/push.hpp24
-rw-r--r--src/random.cpp16
-rw-r--r--src/random.hpp14
-rw-r--r--src/reaper.cpp34
-rw-r--r--src/reaper.hpp18
-rw-r--r--src/rep.cpp26
-rw-r--r--src/rep.hpp22
-rw-r--r--src/req.cpp26
-rw-r--r--src/req.hpp22
-rw-r--r--src/select.cpp50
-rw-r--r--src/select.hpp22
-rw-r--r--src/session_base.cpp124
-rw-r--r--src/session_base.hpp40
-rw-r--r--src/signaler.cpp120
-rw-r--r--src/signaler.hpp14
-rw-r--r--src/socket_base.cpp174
-rw-r--r--src/socket_base.hpp30
-rw-r--r--src/stdint.hpp12
-rw-r--r--src/stream_engine.cpp62
-rw-r--r--src/stream_engine.hpp22
-rw-r--r--src/sub.cpp28
-rw-r--r--src/sub.hpp20
-rw-r--r--src/tcp_address.cpp82
-rw-r--r--src/tcp_address.hpp18
-rw-r--r--src/tcp_connecter.cpp58
-rw-r--r--src/tcp_connecter.hpp16
-rw-r--r--src/tcp_listener.cpp48
-rw-r--r--src/tcp_listener.hpp20
-rw-r--r--src/thread.cpp24
-rw-r--r--src/thread.hpp18
-rw-r--r--src/trie.cpp36
-rw-r--r--src/trie.hpp14
-rw-r--r--src/windows.hpp12
-rw-r--r--src/wire.hpp12
-rw-r--r--src/xpub.cpp44
-rw-r--r--src/xpub.hpp30
-rw-r--r--src/xrep.cpp56
-rw-r--r--src/xrep.hpp28
-rw-r--r--src/xreq.cpp38
-rw-r--r--src/xreq.hpp30
-rw-r--r--src/xs.cpp (renamed from src/zmq.cpp)339
-rw-r--r--src/xs_utils.cpp (renamed from src/zmq_utils.cpp)24
-rw-r--r--src/xsub.cpp62
-rw-r--r--src/xsub.hpp28
-rw-r--r--src/ypipe.hpp22
-rw-r--r--src/yqueue.hpp14
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/test_hwm.cpp36
-rw-r--r--tests/test_invalid_rep.cpp48
-rw-r--r--tests/test_msg_flags.cpp44
-rw-r--r--tests/test_pair_inproc.cpp22
-rw-r--r--tests/test_pair_ipc.cpp24
-rw-r--r--tests/test_pair_tcp.cpp24
-rw-r--r--tests/test_reqrep_device.cpp82
-rw-r--r--tests/test_reqrep_inproc.cpp24
-rw-r--r--tests/test_reqrep_ipc.cpp24
-rw-r--r--tests/test_reqrep_tcp.cpp24
-rw-r--r--tests/test_shutdown_stress.cpp26
-rw-r--r--tests/test_sub_forward.cpp56
-rw-r--r--tests/test_timeo.cpp70
-rw-r--r--tests/testutil.hpp38
-rwxr-xr-xversion.sh16
214 files changed, 5157 insertions, 5421 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
deleted file mode 100644
index 00f5030..0000000
--- a/MAINTAINERS
+++ /dev/null
@@ -1,56 +0,0 @@
-Component: Atomic Operations
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: Lock-free Algorithms
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: TCP transport
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: IPC transport
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: PGM transport
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: In-process transport
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: I/O Threads
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: Application Threads and Differnet Socket Types
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: Multiplexing (zmq_poll)
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: Generic Infrastructure (context, mailbox, command, pipe)
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: Documentation
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: Autotools build system
-Maintainer: Mikko Koppanen
-Contact: mikko.koppanen@gmail.com
-
-Component: MSVC build system
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
-Component: Performance tests
-Maintainer: Martin Sustrik
-Contact: sustrik@250bpm.com
-
diff --git a/Makefile.am b/Makefile.am
index 962a53e..3de2ff8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,7 +11,6 @@ DIST_SUBDIRS = foreign/openpgm src doc perf tests builds/msvc
EXTRA_DIST = \
autogen.sh \
version.sh \
- MAINTAINERS \
foreign/openpgm/@pgm_basename@.tar.gz
MAINTAINERCLEANFILES = \
$(srcdir)/aclocal.m4 \
diff --git a/NEWS b/NEWS
index b17272f..e69de29 100644
--- a/NEWS
+++ b/NEWS
@@ -1,153 +0,0 @@
-OMQ version 3.1.0 (beta), released on 2011/12/18
-================================================
-
-General information
--------------------
-
-Based on community consensus, the 0MQ 3.1.x release reverts a number of
-features introduced in version 3.0. The major reason for these changes is
-improving backward compatibility with 0MQ 2.1.x.
-
-Development of the 0MQ 3.0.x series will be discontinued, and users are
-encouraged to upgrade to 3.1.
-
-The 0MQ 3.1.x releases use ABI version 3.
-
-Reverted functionality
-----------------------
-
-The following functionality present in 0MQ 3.0 has been reverted:
-
-* Wire format changes. The 0MQ 3.1 wire format is identical to that of 0MQ
- 2.1.
-
-* LABELs and COMMANDs have been removed.
-
-* Explicit identies are re-introduced, however they can be used only for
- explicit routing, not for durable sockets.
-
-* The ZMQ_ROUTER and ZMQ_DEALER socket types are once again aliases for
- ZMQ_XREQ and ZMQ_XREP.
-
-New functionality
------------------
-
-* The zmq_getmsgopt() function has been introduced.
-
-* Experimental IPv6 support has been introduced. This is disabled by
- default, see the zmq_setsockopt() documentation for enabling it.
-
-Other changes
--------------
-
-* The default HWM for all socket types has been set to 1000.
-
-* Many bug fixes.
-
-Building
---------
-
-* The dependency on libuuid has been removed.
-
-* Support for building on Android, and with MSVC 10 has been added.
-
-0MQ version 3.0.0 (alpha), released on 2011/07/12
-=================================================
-
-New functionality
------------------
-
-* POSIX-compliant zmq_send and zmq_recv introduced (uses raw buffer
- instead of message object).
-
-* ZMQ_MULTICAST_HOPS socket option added. Sets the appropriate field in
- IP headers of PGM packets.
-
-* Subscription forwarding. Instead of filtering on consumer, the
- subscription is moved as far as possible towards the publisher and
- filtering is done there.
-
-* ZMQ_XPUB, ZMQ_XSUB introduced. Allow to create subscription-
- forwarding-friendly intermediate devices.
-
-* Add sockopt ZMQ_RCVTIMEO/ZMQ_SNDTIMEO. Allow to set timeout for
- blocking send/recv calls.
-
-* A new LABEL flag was added to the wire format. The flag distinguishes
- message parts used by 0MQ (labels) from user payload message parts.
-
-* There is a new wire format for the REQ/REP pattern. First, the empty
- bottom-of-the-stack message part is not needed any more, the LABEL
- flag is used instead. Secondly, peer IDs are 32-bit integers rather
- than 17-byte UUIDs.
-
-* The REQ socket now drops duplicate replies.
-
-* Outstanding requests & replies associated with a client are dropped
- when the clients dies. This is a performance optimisation.
-
-* Introduced ZMQ_ROUTER and ZMQ_DEALER sockets. These mimic the
- functionality of ZMQ_ROUTER and ZMQ_DEALER in 0MQ/2.1.x. Guarantees
- backward compatibility for exsiting code.
-
-* Removed dependency on OS socketpair buffer size. No more asserts in
- mailbox.cpp because of low system limit of sockepair buffer size.
-
-API improvements
-----------------
-
-* Obsolete constants ZMQ_UPSTREAM and ZMQ_DOWNSTREAM removed. Use
- ZMQ_PUSH and ZMQ_PULL instead.
-
-* Timeout in zmq_poll is in milliseconds instead of microseconds. This
- makes zmq_poll() compliant with POSIX poll()
-
-* ZMQ_MCAST_LOOP removed. There's no support for multicast over
- loopback any more. Use IPC or TCP isntead.
-
-* zmq_send/zmq_recv was renamed zmq_sendmsg/zmq_recvmsg.
-
-* ZMQ_RECOVERY_IVL and ZMQ_RECOVERY_IVL_MSEC reconciled. The new option
- is named ZMQ_RECOVERY_IVL and the unit is milliseconds.
-
-* Option types changed. Most of the numeric types are now represented
- as 'int'.
-
-* ZMQ_HWM split into ZMQ_SNDHWM and ZMQ_RCVHWM. This makes it possible
- to control message flow separately for each direction.
-
-* ZMQ_NOBLOCK renamed ZMQ_DONTWAIT. That makes it POSIX-compliant.
-
-Less is More
-------------
-
-* Pre-built devices and zmq_device() removed. Should be made available
- as a separate project(s).
-
-* ZMQ_SWAP removed. Writing data to disk should be done on top of 0MQ,
- on inside it.
-
-* C++ binding removed from the core. Now it's a separate project, same
- as any other binding.
-
-Bug fixes
----------
-
-* Many.
-
-Building
---------
-
-* Make pkg-config dependency conditional.
-
-Distribution
-------------
-
-* Removed Debian packaging, which is now available at packages.debian.org
- or via apt-get.
-
-
-Older versions
-==============
-
-* See NEWS in ZeroMQ 2.1.x repository at http://github.com/zeromq/zeromq2-1.
diff --git a/README b/README
index 58fe050..72af2bd 100644
--- a/README
+++ b/README
@@ -1,12 +1,11 @@
Welcome
-------
-The 0MQ lightweight messaging kernel is a library which extends the
-standard socket interfaces with features traditionally provided by
-specialised messaging middleware products. 0MQ sockets provide an
-abstraction of asynchronous message queues, multiple messaging patterns,
-message filtering (subscriptions), seamless access to multiple transport
-protocols and more.
+libxs is a library which extends the standard socket interfaces with features
+traditionally provided by specialised messaging middleware products. libxs
+sockets provide an abstraction of asynchronous message queues, multiple
+messaging patterns, message filtering (subscriptions), seamless access to
+multiple transport protocols and more.
Building and installation
@@ -19,21 +18,11 @@ Resources
---------
Extensive documentation is provided with the distribution. Refer to
-doc/zmq.html, or "man zmq" after you have installed 0MQ on your system.
-
-Website: http://www.zeromq.org/
-
-Development mailing list: zeromq-dev@lists.zeromq.org
-Announcements mailing list: zeromq-announce@lists.zeromq.org
-
-Git repository: http://github.com/zeromq/libzmq
-
-0MQ developers can also be found on the IRC channel #zeromq, on the
-Freenode network (irc.freenode.net).
+doc/xs.html, or "man xs" after you have installed libxs on your system.
Copying
-------
Free use of this software is granted under the terms of the GNU Lesser General
Public License (LGPL). For details see the files `COPYING` and `COPYING.LESSER`
-included with the 0MQ distribution.
+included with the libxs distribution.
diff --git a/acinclude.m4 b/acinclude.m4
index 537be18..531568d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,8 +1,8 @@
dnl ##############################################################################
-dnl # LIBZMQ_CONFIG_LIBTOOL #
+dnl # LIBXS_CONFIG_LIBTOOL #
dnl # Configure libtool. Requires AC_CANONICAL_HOST #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_CONFIG_LIBTOOL], [{
+AC_DEFUN([LIBXS_CONFIG_LIBTOOL], [{
AC_REQUIRE([AC_CANONICAL_HOST])
# Libtool configuration for different targets
@@ -19,192 +19,192 @@ AC_DEFUN([LIBZMQ_CONFIG_LIBTOOL], [{
}])
dnl ##############################################################################
-dnl # LIBZMQ_CHECK_LANG_ICC([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_LANG_ICC([action-if-found], [action-if-not-found]) #
dnl # Check if the current language is compiled using ICC #
dnl # Adapted from http://software.intel.com/en-us/forums/showthread.php?t=67984 #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_CHECK_LANG_ICC],
+AC_DEFUN([LIBXS_CHECK_LANG_ICC],
[AC_CACHE_CHECK([whether we are using Intel _AC_LANG compiler],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler],
[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#ifndef __INTEL_COMPILER
error if not ICC
#endif
]])],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler="yes" ; $1],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler="no" ; $2])
+ [libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler="yes" ; $1],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler="no" ; $2])
])])
dnl ##############################################################################
-dnl # LIBZMQ_CHECK_LANG_SUN_STUDIO([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_LANG_SUN_STUDIO([action-if-found], [action-if-not-found]) #
dnl # Check if the current language is compiled using Sun Studio #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_CHECK_LANG_SUN_STUDIO],
+AC_DEFUN([LIBXS_CHECK_LANG_SUN_STUDIO],
[AC_CACHE_CHECK([whether we are using Sun Studio _AC_LANG compiler],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler],
[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#if !defined(__SUNPRO_CC) && !defined(__SUNPRO_C)
error if not sun studio
#endif
]])],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler="yes" ; $1],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler="no" ; $2])
+ [libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler="yes" ; $1],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler="no" ; $2])
])])
dnl ##############################################################################
-dnl # LIBZMQ_CHECK_LANG_CLANG([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_LANG_CLANG([action-if-found], [action-if-not-found]) #
dnl # Check if the current language is compiled using clang #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_CHECK_LANG_CLANG],
+AC_DEFUN([LIBXS_CHECK_LANG_CLANG],
[AC_CACHE_CHECK([whether we are using clang _AC_LANG compiler],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_clang_compiler],
[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#ifndef __clang__
error if not clang
#endif
]])],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler="yes" ; $1],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler="no" ; $2])
+ [libxs_cv_[]_AC_LANG_ABBREV[]_clang_compiler="yes" ; $1],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_clang_compiler="no" ; $2])
])])
dnl ##############################################################################
-dnl # LIBZMQ_CHECK_LANG_GCC4([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_LANG_GCC4([action-if-found], [action-if-not-found]) #
dnl # Check if the current language is compiled using clang #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_CHECK_LANG_GCC4],
+AC_DEFUN([LIBXS_CHECK_LANG_GCC4],
[AC_CACHE_CHECK([whether we are using gcc >= 4 _AC_LANG compiler],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler],
[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#if (!defined __GNUC__ || __GNUC__ < 4)
error if not gcc4 or higher
#endif
]])],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler="yes" ; $1],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler="no" ; $2])
+ [libxs_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler="yes" ; $1],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler="no" ; $2])
])])
dnl ##############################################################################
-dnl # LIBZMQ_CHECK_DOC_BUILD #
+dnl # LIBXS_CHECK_DOC_BUILD #
dnl # Check whether to build documentation and install man-pages #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_CHECK_DOC_BUILD], [{
+AC_DEFUN([LIBXS_CHECK_DOC_BUILD], [{
# Allow user to disable doc build
AC_ARG_WITH([documentation], [AS_HELP_STRING([--without-documentation],
[disable documentation build even if asciidoc and xmlto are present [default=no]])])
if test "x$with_documentation" = "xno"; then
- libzmq_build_doc="no"
- libzmq_install_man="no"
+ libxs_build_doc="no"
+ libxs_install_man="no"
else
# Determine whether or not documentation should be built and installed.
- libzmq_build_doc="yes"
- libzmq_install_man="yes"
+ libxs_build_doc="yes"
+ libxs_install_man="yes"
# Check for asciidoc and xmlto and don't build the docs if these are not installed.
- AC_CHECK_PROG(libzmq_have_asciidoc, asciidoc, yes, no)
- AC_CHECK_PROG(libzmq_have_xmlto, xmlto, yes, no)
- if test "x$libzmq_have_asciidoc" = "xno" -o "x$libzmq_have_xmlto" = "xno"; then
- libzmq_build_doc="no"
+ AC_CHECK_PROG(libxs_have_asciidoc, asciidoc, yes, no)
+ AC_CHECK_PROG(libxs_have_xmlto, xmlto, yes, no)
+ if test "x$libxs_have_asciidoc" = "xno" -o "x$libxs_have_xmlto" = "xno"; then
+ libxs_build_doc="no"
# Tarballs built with 'make dist' ship with prebuilt documentation.
- if ! test -f doc/zmq.7; then
- libzmq_install_man="no"
- AC_MSG_WARN([You are building an unreleased version of 0MQ and asciidoc or xmlto are not installed.])
+ if ! test -f doc/xs.7; then
+ libxs_install_man="no"
+ AC_MSG_WARN([You are building an unreleased version of Crossroads and asciidoc or xmlto are not installed.])
AC_MSG_WARN([Documentation will not be built and manual pages will not be installed.])
fi
fi
# Do not install man pages if on mingw
- if test "x$libzmq_on_mingw32" = "xyes"; then
- libzmq_install_man="no"
+ if test "x$libxs_on_mingw32" = "xyes"; then
+ libxs_install_man="no"
fi
fi
AC_MSG_CHECKING([whether to build documentation])
- AC_MSG_RESULT([$libzmq_build_doc])
+ AC_MSG_RESULT([$libxs_build_doc])
AC_MSG_CHECKING([whether to install manpages])
- AC_MSG_RESULT([$libzmq_install_man])
+ AC_MSG_RESULT([$libxs_install_man])
- AM_CONDITIONAL(BUILD_DOC, test "x$libzmq_build_doc" = "xyes")
- AM_CONDITIONAL(INSTALL_MAN, test "x$libzmq_install_man" = "xyes")
+ AM_CONDITIONAL(BUILD_DOC, test "x$libxs_build_doc" = "xyes")
+ AM_CONDITIONAL(INSTALL_MAN, test "x$libxs_install_man" = "xyes")
}])
dnl ##############################################################################
-dnl # LIBZMQ_CHECK_LANG_COMPILER([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_LANG_COMPILER([action-if-found], [action-if-not-found]) #
dnl # Check that compiler for the current language actually works #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_CHECK_LANG_COMPILER], [{
+AC_DEFUN([LIBXS_CHECK_LANG_COMPILER], [{
# Test that compiler for the current language actually works
AC_CACHE_CHECK([whether the _AC_LANG compiler works],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_compiler_works],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works="yes" ; $1],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works="no" ; $2])
+ [libxs_cv_[]_AC_LANG_ABBREV[]_compiler_works="yes" ; $1],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_compiler_works="no" ; $2])
])
- if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works" != "xyes"; then
+ if test "x$libxs_cv_[]_AC_LANG_ABBREV[]_compiler_works" != "xyes"; then
AC_MSG_ERROR([Unable to find a working _AC_LANG compiler])
fi
}])
dnl ##############################################################################
-dnl # LIBZMQ_CHECK_COMPILERS #
+dnl # LIBXS_CHECK_COMPILERS #
dnl # Check compiler characteristics. This is so that we can AC_REQUIRE checks #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_CHECK_COMPILERS], [{
+AC_DEFUN([LIBXS_CHECK_COMPILERS], [{
# For that the compiler works and try to come up with the type
AC_LANG_PUSH([C])
- LIBZMQ_CHECK_LANG_COMPILER
+ LIBXS_CHECK_LANG_COMPILER
- LIBZMQ_CHECK_LANG_ICC
- LIBZMQ_CHECK_LANG_SUN_STUDIO
- LIBZMQ_CHECK_LANG_CLANG
- LIBZMQ_CHECK_LANG_GCC4
+ LIBXS_CHECK_LANG_ICC
+ LIBXS_CHECK_LANG_SUN_STUDIO
+ LIBXS_CHECK_LANG_CLANG
+ LIBXS_CHECK_LANG_GCC4
AC_LANG_POP([C])
AC_LANG_PUSH(C++)
- LIBZMQ_CHECK_LANG_COMPILER
+ LIBXS_CHECK_LANG_COMPILER
- LIBZMQ_CHECK_LANG_ICC
- LIBZMQ_CHECK_LANG_SUN_STUDIO
- LIBZMQ_CHECK_LANG_CLANG
- LIBZMQ_CHECK_LANG_GCC4
+ LIBXS_CHECK_LANG_ICC
+ LIBXS_CHECK_LANG_SUN_STUDIO
+ LIBXS_CHECK_LANG_CLANG
+ LIBXS_CHECK_LANG_GCC4
AC_LANG_POP([C++])
# Set GCC and GXX variables correctly
if test "x$GCC" = "xyes"; then
- if test "xyes" = "x$libzmq_cv_c_intel_compiler"; then
+ if test "xyes" = "x$libxs_cv_c_intel_compiler"; then
GCC="no"
fi
fi
if test "x$GXX" = "xyes"; then
- if test "xyes" = "x$libzmq_cv_cxx_intel_compiler"; then
+ if test "xyes" = "x$libxs_cv_cxx_intel_compiler"; then
GXX="no"
fi
fi
}])
dnl ############################################################################
-dnl # LIBZMQ_CHECK_LANG_FLAG([flag], [action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_LANG_FLAG([flag], [action-if-found], [action-if-not-found]) #
dnl # Check if the compiler supports given flag. Works for C and C++ #
-dnl # Sets libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_[FLAG]=yes/no #
+dnl # Sets libxs_cv_[]_AC_LANG_ABBREV[]_supports_flag_[FLAG]=yes/no #
dnl ############################################################################
-AC_DEFUN([LIBZMQ_CHECK_LANG_FLAG], [{
+AC_DEFUN([LIBXS_CHECK_LANG_FLAG], [{
AC_REQUIRE([AC_PROG_GREP])
AC_MSG_CHECKING([whether _AC_LANG compiler supports $1])
- libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save=$ac_[]_AC_LANG_ABBREV[]_werror_flag
+ libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag_save=$ac_[]_AC_LANG_ABBREV[]_werror_flag
ac_[]_AC_LANG_ABBREV[]_werror_flag="yes"
case "x[]_AC_LANG_ABBREV" in
xc)
- libzmq_cv_check_lang_flag_save_CFLAGS="$CFLAGS"
+ libxs_cv_check_lang_flag_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
;;
xcxx)
- libzmq_cv_check_lang_flag_save_CPPFLAGS="$CPPFLAGS"
+ libxs_cv_check_lang_flag_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $1"
;;
*)
@@ -217,18 +217,18 @@ AC_DEFUN([LIBZMQ_CHECK_LANG_FLAG], [{
# Remarks are not turned into errors even with -Werror on
[if ($GREP 'ignoring unknown' conftest.err ||
$GREP 'not supported' conftest.err) >/dev/null 2>&1; then
- eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="no"
+ eval AS_TR_SH(libxs_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="no"
else
- eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="yes"
+ eval AS_TR_SH(libxs_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="yes"
fi],
- [eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="no"])
+ [eval AS_TR_SH(libxs_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="no"])
case "x[]_AC_LANG_ABBREV" in
xc)
- CFLAGS="$libzmq_cv_check_lang_flag_save_CFLAGS"
+ CFLAGS="$libxs_cv_check_lang_flag_save_CFLAGS"
;;
xcxx)
- CPPFLAGS="$libzmq_cv_check_lang_flag_save_CPPFLAGS"
+ CPPFLAGS="$libxs_cv_check_lang_flag_save_CPPFLAGS"
;;
*)
# nothing to restore
@@ -236,42 +236,42 @@ AC_DEFUN([LIBZMQ_CHECK_LANG_FLAG], [{
esac
# Restore the werror flag
- ac_[]_AC_LANG_ABBREV[]_werror_flag=$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save
+ ac_[]_AC_LANG_ABBREV[]_werror_flag=$libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag_save
# Call the action as the flags are restored
- AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
+ AS_IF([eval test x$]AS_TR_SH(libxs_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
[AC_MSG_RESULT(yes) ; $2], [AC_MSG_RESULT(no) ; $3])
}])
dnl ####################################################################################
-dnl # LIBZMQ_CHECK_LANG_FLAG_PREPEND([flag], [action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_LANG_FLAG_PREPEND([flag], [action-if-found], [action-if-not-found]) #
dnl # Check if the compiler supports given flag. Works for C and C++ #
dnl # This macro prepends the flag to CFLAGS or CPPFLAGS accordingly #
-dnl # Sets libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_[FLAG]=yes/no #
+dnl # Sets libxs_cv_[]_AC_LANG_ABBREV[]_supports_flag_[FLAG]=yes/no #
dnl ####################################################################################
-AC_DEFUN([LIBZMQ_CHECK_LANG_FLAG_PREPEND], [{
- LIBZMQ_CHECK_LANG_FLAG([$1])
+AC_DEFUN([LIBXS_CHECK_LANG_FLAG_PREPEND], [{
+ LIBXS_CHECK_LANG_FLAG([$1])
case "x[]_AC_LANG_ABBREV" in
xc)
- AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
+ AS_IF([eval test x$]AS_TR_SH(libxs_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
[CFLAGS="$1 $CFLAGS"; $2], $3)
;;
xcxx)
- AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
+ AS_IF([eval test x$]AS_TR_SH(libxs_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
[CPPFLAGS="$1 $CPPFLAGS"; $2], $3)
;;
esac
}])
dnl ##############################################################################
-dnl # LIBZMQ_CHECK_ENABLE_DEBUG([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_ENABLE_DEBUG([action-if-found], [action-if-not-found]) #
dnl # Check whether to enable debug build and set compiler flags accordingly #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_CHECK_ENABLE_DEBUG], [{
+AC_DEFUN([LIBXS_CHECK_ENABLE_DEBUG], [{
# Require compiler specifics
- AC_REQUIRE([LIBZMQ_CHECK_COMPILERS])
+ AC_REQUIRE([LIBXS_CHECK_COMPILERS])
# This flag is checked also in
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
@@ -283,33 +283,33 @@ AC_DEFUN([LIBZMQ_CHECK_ENABLE_DEBUG], [{
# GCC, clang and ICC
if test "x$GCC" = "xyes" -o \
- "x$libzmq_cv_c_intel_compiler" = "xyes" -o \
- "x$libzmq_cv_c_clang_compiler" = "xyes"; then
+ "x$libxs_cv_c_intel_compiler" = "xyes" -o \
+ "x$libxs_cv_c_clang_compiler" = "xyes"; then
CFLAGS="-g -O0 "
- elif test "x$libzmq_cv_c_sun_studio_compiler" = "xyes"; then
+ elif test "x$libxs_cv_c_sun_studio_compiler" = "xyes"; then
CFLAGS="-g0 "
fi
# GCC, clang and ICC
if test "x$GXX" = "xyes" -o \
- "x$libzmq_cv_cxx_intel_compiler" = "xyes" -o \
- "x$libzmq_cv_cxx_clang_compiler" = "xyes"; then
+ "x$libxs_cv_cxx_intel_compiler" = "xyes" -o \
+ "x$libxs_cv_cxx_clang_compiler" = "xyes"; then
CPPFLAGS="-g -O0 "
CXXFLAGS="-g -O0 "
# Sun studio
- elif test "x$libzmq_cv_cxx_sun_studio_compiler" = "xyes"; then
+ elif test "x$libxs_cv_cxx_sun_studio_compiler" = "xyes"; then
CPPFLAGS="-g0 "
CXXFLAGS="-g0 "
fi
- if test "x$ZMQ_ORIG_CFLAGS" != "xnone"; then
- CFLAGS="${CFLAGS} ${ZMQ_ORIG_CFLAGS}"
+ if test "x$XS_ORIG_CFLAGS" != "xnone"; then
+ CFLAGS="${CFLAGS} ${XS_ORIG_CFLAGS}"
fi
- if test "x$ZMQ_ORIG_CPPFLAGS" != "xnone"; then
- CPPFLAGS="${CPPFLAGS} ${ZMQ_ORIG_CPPFLAGS}"
+ if test "x$XS_ORIG_CPPFLAGS" != "xnone"; then
+ CPPFLAGS="${CPPFLAGS} ${XS_ORIG_CPPFLAGS}"
fi
- if test "x$ZMQ_ORIG_CXXFLAGS" != "xnone"; then
- CXXFLAGS="${CXXFLAGS} ${ZMQ_ORIG_CXXFLAGS}"
+ if test "x$XS_ORIG_CXXFLAGS" != "xnone"; then
+ CXXFLAGS="${CXXFLAGS} ${XS_ORIG_CXXFLAGS}"
fi
AC_MSG_RESULT(yes)
else
@@ -318,54 +318,54 @@ AC_DEFUN([LIBZMQ_CHECK_ENABLE_DEBUG], [{
}])
dnl ##############################################################################
-dnl # LIBZMQ_WITH_GCOV([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_WITH_GCOV([action-if-found], [action-if-not-found]) #
dnl # Check whether to build with code coverage #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_WITH_GCOV], [{
+AC_DEFUN([LIBXS_WITH_GCOV], [{
# Require compiler specifics
- AC_REQUIRE([LIBZMQ_CHECK_COMPILERS])
+ AC_REQUIRE([LIBXS_CHECK_COMPILERS])
AC_ARG_WITH(gcov, [AS_HELP_STRING([--with-gcov=yes/no],
[With GCC Code Coverage reporting.])],
- [ZMQ_GCOV="$withval"])
+ [XS_GCOV="$withval"])
AC_MSG_CHECKING(whether to enable code coverage)
- if test "x$ZMQ_GCOV" = "xyes"; then
+ if test "x$XS_GCOV" = "xyes"; then
if test "x$GXX" != "xyes"; then
AC_MSG_ERROR([--with-gcov=yes works only with GCC])
fi
CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"
- if test "x${ZMQ_ORIG_CPPFLAGS}" != "xnone"; then
- CFLAGS="${CFLAGS} ${ZMQ_ORIG_CFLAGS}"
+ if test "x${XS_ORIG_CPPFLAGS}" != "xnone"; then
+ CFLAGS="${CFLAGS} ${XS_ORIG_CFLAGS}"
fi
CPPFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"
- if test "x${ZMQ_ORIG_CPPFLAGS}" != "xnone"; then
- CPPFLAGS="${CPPFLAGS} ${ZMQ_ORIG_CPPFLAGS}"
+ if test "x${XS_ORIG_CPPFLAGS}" != "xnone"; then
+ CPPFLAGS="${CPPFLAGS} ${XS_ORIG_CPPFLAGS}"
fi
CXXFLAGS="-fprofile-arcs"
- if test "x${ZMQ_ORIG_CXXFLAGS}" != "xnone"; then
- CXXFLAGS="${CXXFLAGS} ${ZMQ_ORIG_CXXFLAGS}"
+ if test "x${XS_ORIG_CXXFLAGS}" != "xnone"; then
+ CXXFLAGS="${CXXFLAGS} ${XS_ORIG_CXXFLAGS}"
fi
LIBS="-lgcov ${LIBS}"
fi
- AS_IF([test "x$ZMQ_GCOV" = "xyes"],
+ AS_IF([test "x$XS_GCOV" = "xyes"],
[AC_MSG_RESULT(yes) ; $1], [AC_MSG_RESULT(no) ; $2])
}])
dnl ##############################################################################
-dnl # LIBZMQ_CHECK_WITH_FLAG([flags], [macro]) #
+dnl # LIBXS_CHECK_WITH_FLAG([flags], [macro]) #
dnl # Runs a normal autoconf check with compiler flags #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_CHECK_WITH_FLAG], [{
- libzmq_check_with_flag_save_CFLAGS="$CFLAGS"
- libzmq_check_with_flag_save_CPPFLAGS="$CPPFLAGS"
+AC_DEFUN([LIBXS_CHECK_WITH_FLAG], [{
+ libxs_check_with_flag_save_CFLAGS="$CFLAGS"
+ libxs_check_with_flag_save_CPPFLAGS="$CPPFLAGS"
CFLAGS="$CFLAGS $1"
CPPFLAGS="$CPPFLAGS $1"
@@ -373,43 +373,43 @@ AC_DEFUN([LIBZMQ_CHECK_WITH_FLAG], [{
# Execute the macro
$2
- CFLAGS="$libzmq_check_with_flag_save_CFLAGS"
- CPPFLAGS="$libzmq_check_with_flag_save_CPPFLAGS"
+ CFLAGS="$libxs_check_with_flag_save_CFLAGS"
+ CPPFLAGS="$libxs_check_with_flag_save_CPPFLAGS"
}])
dnl ##############################################################################
-dnl # LIBZMQ_LANG_WALL([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_LANG_WALL([action-if-found], [action-if-not-found]) #
dnl # How to define -Wall for the current compiler #
-dnl # Sets libzmq_cv_[]_AC_LANG_ABBREV[]__wall_flag variable to found style #
+dnl # Sets libxs_cv_[]_AC_LANG_ABBREV[]__wall_flag variable to found style #
dnl ##############################################################################
-AC_DEFUN([LIBZMQ_LANG_WALL], [{
+AC_DEFUN([LIBXS_LANG_WALL], [{
AC_MSG_CHECKING([how to enable additional warnings for _AC_LANG compiler])
- libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag=""
+ libxs_cv_[]_AC_LANG_ABBREV[]_wall_flag=""
# C compilers
case "x[]_AC_LANG_ABBREV" in
xc)
# GCC, clang and ICC
if test "x$GCC" = "xyes" -o \
- "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes" -o \
- "x$libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag="-Wall"
+ "x$libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes" -o \
+ "x$libxs_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_wall_flag="-Wall"
# Sun studio
- elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag="-v"
+ elif test "x$libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_wall_flag="-v"
fi
;;
xcxx)
# GCC, clang and ICC
if test "x$GXX" = "xyes" -o \
- "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes" -o \
- "x$libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag="-Wall"
+ "x$libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes" -o \
+ "x$libxs_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_wall_flag="-Wall"
# Sun studio
- elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag="+w"
+ elif test "x$libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_wall_flag="+w"
fi
;;
*)
@@ -417,8 +417,8 @@ AC_DEFUN([LIBZMQ_LANG_WALL], [{
esac
# Call the action
- if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag" != "x"; then
- AC_MSG_RESULT([$libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag])
+ if test "x$libxs_cv_[]_AC_LANG_ABBREV[]_wall_flag" != "x"; then
+ AC_MSG_RESULT([$libxs_cv_[]_AC_LANG_ABBREV[]_wall_flag])
$1
else
AC_MSG_RESULT([not found])
@@ -427,36 +427,36 @@ AC_DEFUN([LIBZMQ_LANG_WALL], [{
}])
dnl ####################################################################
-dnl # LIBZMQ_LANG_STRICT([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_LANG_STRICT([action-if-found], [action-if-not-found]) #
dnl # Check how to turn on strict standards compliance #
dnl ####################################################################
-AC_DEFUN([LIBZMQ_LANG_STRICT], [{
+AC_DEFUN([LIBXS_LANG_STRICT], [{
AC_MSG_CHECKING([how to enable strict standards compliance in _AC_LANG compiler])
- libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag=""
+ libxs_cv_[]_AC_LANG_ABBREV[]_strict_flag=""
# C compilers
case "x[]_AC_LANG_ABBREV" in
xc)
# GCC, clang and ICC
- if test "x$GCC" = "xyes" -o "x$libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-pedantic"
- elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-strict-ansi"
+ if test "x$GCC" = "xyes" -o "x$libxs_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_strict_flag="-pedantic"
+ elif test "x$libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_strict_flag="-strict-ansi"
# Sun studio
- elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-Xc"
+ elif test "x$libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_strict_flag="-Xc"
fi
;;
xcxx)
# GCC, clang and ICC
- if test "x$GXX" = "xyes" -o "x$libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-pedantic"
- elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-strict-ansi"
+ if test "x$GXX" = "xyes" -o "x$libxs_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_strict_flag="-pedantic"
+ elif test "x$libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_strict_flag="-strict-ansi"
# Sun studio
- elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-compat=5"
+ elif test "x$libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_strict_flag="-compat=5"
fi
;;
*)
@@ -464,8 +464,8 @@ AC_DEFUN([LIBZMQ_LANG_STRICT], [{
esac
# Call the action
- if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag" != "x"; then
- AC_MSG_RESULT([$libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag])
+ if test "x$libxs_cv_[]_AC_LANG_ABBREV[]_strict_flag" != "x"; then
+ AC_MSG_RESULT([$libxs_cv_[]_AC_LANG_ABBREV[]_strict_flag])
$1
else
AC_MSG_RESULT([not found])
@@ -474,32 +474,32 @@ AC_DEFUN([LIBZMQ_LANG_STRICT], [{
}])
dnl ########################################################################
-dnl # LIBZMQ_LANG_WERROR([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_LANG_WERROR([action-if-found], [action-if-not-found]) #
dnl # Check how to turn warnings to errors #
dnl ########################################################################
-AC_DEFUN([LIBZMQ_LANG_WERROR], [{
+AC_DEFUN([LIBXS_LANG_WERROR], [{
AC_MSG_CHECKING([how to turn warnings to errors in _AC_LANG compiler])
- libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag=""
+ libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag=""
# C compilers
case "x[]_AC_LANG_ABBREV" in
xc)
# GCC, clang and ICC
- if test "x$GCC" = "xyes" -o "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-Werror"
+ if test "x$GCC" = "xyes" -o "x$libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag="-Werror"
# Sun studio
- elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-errwarn=%all"
+ elif test "x$libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag="-errwarn=%all"
fi
;;
xcxx)
# GCC, clang and ICC
- if test "x$GXX" = "xyes" -o "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-Werror"
+ if test "x$GXX" = "xyes" -o "x$libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag="-Werror"
# Sun studio
- elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
- libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-errwarn=%all"
+ elif test "x$libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
+ libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag="-errwarn=%all"
fi
;;
*)
@@ -507,8 +507,8 @@ AC_DEFUN([LIBZMQ_LANG_WERROR], [{
esac
# Call the action
- if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag" != "x"; then
- AC_MSG_RESULT([$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag])
+ if test "x$libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag" != "x"; then
+ AC_MSG_RESULT([$libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag])
$1
else
AC_MSG_RESULT([not found])
@@ -517,75 +517,75 @@ AC_DEFUN([LIBZMQ_LANG_WERROR], [{
}])
dnl ################################################################################
-dnl # LIBZMQ_CHECK_LANG_PRAGMA([pragma], [action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_LANG_PRAGMA([pragma], [action-if-found], [action-if-not-found]) #
dnl # Check if the compiler supports given pragma #
dnl ################################################################################
-AC_DEFUN([LIBZMQ_CHECK_LANG_PRAGMA], [{
+AC_DEFUN([LIBXS_CHECK_LANG_PRAGMA], [{
# Need to know how to enable all warnings
- LIBZMQ_LANG_WALL
+ LIBXS_LANG_WALL
AC_MSG_CHECKING([whether _AC_LANG compiler supports pragma $1])
# Save flags
- libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save=$ac_[]_AC_LANG_ABBREV[]_werror_flag
+ libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag_save=$ac_[]_AC_LANG_ABBREV[]_werror_flag
ac_[]_AC_LANG_ABBREV[]_werror_flag="yes"
if test "x[]_AC_LANG_ABBREV" = "xc"; then
- libzmq_cv_check_lang_pragma_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag"
+ libxs_cv_check_lang_pragma_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $libxs_cv_[]_AC_LANG_ABBREV[]_wall_flag"
elif test "x[]_AC_LANG_ABBREV" = "xcxx"; then
- libzmq_cv_check_lang_pragma_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag"
+ libxs_cv_check_lang_pragma_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $libxs_cv_[]_AC_LANG_ABBREV[]_wall_flag"
else
AC_MSG_WARN([testing compiler characteristic on an unknown language])
fi
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#pragma $1]])],
- [eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)="yes" ; AC_MSG_RESULT(yes)],
- [eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)="no" ; AC_MSG_RESULT(no)])
+ [eval AS_TR_SH(libxs_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)="yes" ; AC_MSG_RESULT(yes)],
+ [eval AS_TR_SH(libxs_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)="no" ; AC_MSG_RESULT(no)])
if test "x[]_AC_LANG_ABBREV" = "xc"; then
- CFLAGS="$libzmq_cv_check_lang_pragma_save_CFLAGS"
+ CFLAGS="$libxs_cv_check_lang_pragma_save_CFLAGS"
elif test "x[]_AC_LANG_ABBREV" = "xcxx"; then
- CPPFLAGS="$libzmq_cv_check_lang_pragma_save_CPPFLAGS"
+ CPPFLAGS="$libxs_cv_check_lang_pragma_save_CPPFLAGS"
fi
- ac_[]_AC_LANG_ABBREV[]_werror_flag=$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save
+ ac_[]_AC_LANG_ABBREV[]_werror_flag=$libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag_save
# Call the action as the flags are restored
- AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)[ = "xyes"],
+ AS_IF([eval test x$]AS_TR_SH(libxs_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)[ = "xyes"],
[$2], [$3])
}])
dnl ################################################################################
-dnl # LIBZMQ_CHECK_LANG_VISIBILITY([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_LANG_VISIBILITY([action-if-found], [action-if-not-found]) #
dnl # Check if the compiler supports dso visibility #
dnl ################################################################################
-AC_DEFUN([LIBZMQ_CHECK_LANG_VISIBILITY], [{
-
- libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag=""
-
- if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes" -o \
- "x$libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes" -o \
- "x$libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler" = "xyes"; then
- LIBZMQ_CHECK_LANG_FLAG([-fvisibility=hidden],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag="-fvisibility=hidden"])
- elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
- LIBZMQ_CHECK_LANG_FLAG([-xldscope=hidden],
- [libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag="-xldscope=hidden"])
+AC_DEFUN([LIBXS_CHECK_LANG_VISIBILITY], [{
+
+ libxs_cv_[]_AC_LANG_ABBREV[]_visibility_flag=""
+
+ if test "x$libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes" -o \
+ "x$libxs_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes" -o \
+ "x$libxs_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler" = "xyes"; then
+ LIBXS_CHECK_LANG_FLAG([-fvisibility=hidden],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_visibility_flag="-fvisibility=hidden"])
+ elif test "x$libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
+ LIBXS_CHECK_LANG_FLAG([-xldscope=hidden],
+ [libxs_cv_[]_AC_LANG_ABBREV[]_visibility_flag="-xldscope=hidden"])
fi
AC_MSG_CHECKING(whether _AC_LANG compiler supports dso visibility)
- AS_IF([test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag" != "x"],
+ AS_IF([test "x$libxs_cv_[]_AC_LANG_ABBREV[]_visibility_flag" != "x"],
[AC_MSG_RESULT(yes) ; $1], [AC_MSG_RESULT(no) ; $2])
}])
dnl ################################################################################
-dnl # LIBZMQ_CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_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_DEFUN([LIBXS_CHECK_SOCK_CLOEXEC], [{
AC_MSG_CHECKING(whether SOCK_CLOEXEC is supported)
AC_TRY_RUN([/* SOCK_CLOEXEC test */
#include <sys/types.h>
@@ -597,17 +597,17 @@ 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"]
+ [AC_MSG_RESULT(yes) ; libxs_cv_sock_cloexec="yes" ; $1],
+ [AC_MSG_RESULT(no) ; libxs_cv_sock_cloexec="no" ; $2],
+ [AC_MSG_RESULT(not during cross-compile) ; libxs_cv_sock_cloexec="no"]
)
}])
dnl ################################################################################
-dnl # LIBZMQ_CHECK_POLLER_KQUEUE([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_POLLER_KQUEUE([action-if-found], [action-if-not-found]) #
dnl # Checks kqueue polling system #
dnl ################################################################################
-AC_DEFUN([LIBZMQ_CHECK_POLLER_KQUEUE], [{
+AC_DEFUN([LIBXS_CHECK_POLLER_KQUEUE], [{
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
@@ -620,15 +620,15 @@ struct kevent t_kev;
kqueue();
]]
)],
- [libzmq_cv_have_poller_kqueue="yes" ; $1],
- [libzmq_cv_have_poller_kqueue="no" ; $2])
+ [libxs_cv_have_poller_kqueue="yes" ; $1],
+ [libxs_cv_have_poller_kqueue="no" ; $2])
}])
dnl ################################################################################
-dnl # LIBZMQ_CHECK_POLLER_EPOLL([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_POLLER_EPOLL([action-if-found], [action-if-not-found]) #
dnl # Checks epoll polling system #
dnl ################################################################################
-AC_DEFUN([LIBZMQ_CHECK_POLLER_EPOLL], [{
+AC_DEFUN([LIBXS_CHECK_POLLER_EPOLL], [{
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
@@ -639,15 +639,15 @@ struct epoll_event t_ev;
epoll_create(10);
]]
)],
- [libzmq_cv_have_poller_epoll="yes" ; $1],
- [libzmq_cv_have_poller_epoll="no" ; $2])
+ [libxs_cv_have_poller_epoll="yes" ; $1],
+ [libxs_cv_have_poller_epoll="no" ; $2])
}])
dnl ################################################################################
-dnl # LIBZMQ_CHECK_POLLER_DEVPOLL([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_POLLER_DEVPOLL([action-if-found], [action-if-not-found]) #
dnl # Checks devpoll polling system #
dnl ################################################################################
-AC_DEFUN([LIBZMQ_CHECK_POLLER_DEVPOLL], [{
+AC_DEFUN([LIBXS_CHECK_POLLER_DEVPOLL], [{
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
@@ -658,15 +658,15 @@ struct pollfd t_devpoll;
int fd = open("/dev/poll", O_RDWR);
]]
)],
- [libzmq_cv_have_poller_devpoll="yes" ; $1],
- [libzmq_cv_have_poller_devpoll="no" ; $2])
+ [libxs_cv_have_poller_devpoll="yes" ; $1],
+ [libxs_cv_have_poller_devpoll="no" ; $2])
}])
dnl ################################################################################
-dnl # LIBZMQ_CHECK_POLLER_POLL([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_POLLER_POLL([action-if-found], [action-if-not-found]) #
dnl # Checks poll polling system #
dnl ################################################################################
-AC_DEFUN([LIBZMQ_CHECK_POLLER_POLL], [{
+AC_DEFUN([LIBXS_CHECK_POLLER_POLL], [{
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
@@ -677,21 +677,21 @@ struct pollfd t_poll;
poll(&t_poll, 1, 1);
]]
)],
- [libzmq_cv_have_poller_poll="yes" ; $1],
- [libzmq_cv_have_poller_poll="no" ; $2])
+ [libxs_cv_have_poller_poll="yes" ; $1],
+ [libxs_cv_have_poller_poll="no" ; $2])
}])
dnl ################################################################################
-dnl # LIBZMQ_CHECK_POLLER_SELECT([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_POLLER_SELECT([action-if-found], [action-if-not-found]) #
dnl # Checks select polling system #
dnl ################################################################################
-AC_DEFUN([LIBZMQ_CHECK_POLLER_SELECT], [{
+AC_DEFUN([LIBXS_CHECK_POLLER_SELECT], [{
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "winsock2.h"
-#elif defined ZMQ_HAVE_OPENVMS
+#elif defined XS_HAVE_OPENVMS
#include <sys/types.h>
#include <sys/time.h>
#else
@@ -711,15 +711,15 @@ tv.tv_usec = 0;
select(1, &t_rfds, NULL, NULL, &tv);
]]
)],
- [libzmq_cv_have_poller_select="yes" ; $1],
- [libzmq_cv_have_poller_select="no" ; $2])
+ [libxs_cv_have_poller_select="yes" ; $1],
+ [libxs_cv_have_poller_select="no" ; $2])
}])
dnl ################################################################################
-dnl # LIBZMQ_CHECK_POLLER([action-if-found], [action-if-not-found]) #
+dnl # LIBXS_CHECK_POLLER([action-if-found], [action-if-not-found]) #
dnl # Choose polling system #
dnl ################################################################################
-AC_DEFUN([LIBZMQ_CHECK_POLLER], [{
+AC_DEFUN([LIBXS_CHECK_POLLER], [{
# Allow user to disable doc build
AC_ARG_WITH([poller], [AS_HELP_STRING([--with-poller],
@@ -730,7 +730,7 @@ AC_DEFUN([LIBZMQ_CHECK_POLLER], [{
case "${with_poller}" in
kqueue|epoll|devpoll|poll|select)
# User has chosen polling system
- libzmq_cv_poller="${with_poller}"
+ libxs_cv_poller="${with_poller}"
;;
*)
@@ -740,36 +740,36 @@ AC_DEFUN([LIBZMQ_CHECK_POLLER], [{
case "${subsystem}" in
kqueue)
- LIBZMQ_CHECK_POLLER_KQUEUE([libzmq_cv_poller=$subsystem], [])
+ LIBXS_CHECK_POLLER_KQUEUE([libxs_cv_poller=$subsystem], [])
;;
epoll)
- LIBZMQ_CHECK_POLLER_EPOLL([libzmq_cv_poller=$subsystem], [])
+ LIBXS_CHECK_POLLER_EPOLL([libxs_cv_poller=$subsystem], [])
;;
devpoll)
- LIBZMQ_CHECK_POLLER_DEVPOLL([libzmq_cv_poller=$subsystem], [])
+ LIBXS_CHECK_POLLER_DEVPOLL([libxs_cv_poller=$subsystem], [])
;;
poll)
- LIBZMQ_CHECK_POLLER_POLL([libzmq_cv_poller=$subsystem], [])
+ LIBXS_CHECK_POLLER_POLL([libxs_cv_poller=$subsystem], [])
;;
select)
- LIBZMQ_CHECK_POLLER_SELECT([libzmq_cv_poller=$subsystem], [])
+ LIBXS_CHECK_POLLER_SELECT([libxs_cv_poller=$subsystem], [])
;;
esac
- if test "x${libzmq_cv_poller}" != "x"; then
+ if test "x${libxs_cv_poller}" != "x"; then
break
fi
done
;;
esac
- libzmq_cv_poller_flag=`echo "ZMQ_FORCE_${libzmq_cv_poller}" | tr a-z A-Z`
+ libxs_cv_poller_flag=`echo "XS_FORCE_${libxs_cv_poller}" | tr a-z A-Z`
- AS_IF([test "x${libzmq_cv_poller}" != "x"],
- [AC_MSG_RESULT([using $libzmq_cv_poller]) ; $1], [AC_MSG_RESULT(no suitable polling system found) ; $2])
+ AS_IF([test "x${libxs_cv_poller}" != "x"],
+ [AC_MSG_RESULT([using $libxs_cv_poller]) ; $1], [AC_MSG_RESULT(no suitable polling system found) ; $2])
}])
diff --git a/autogen.sh b/autogen.sh
index 52a8812..2a563ab 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -3,20 +3,20 @@
# Copyright (c) 2007-2009 iMatix Corporation
# Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
#
-# This file is part of 0MQ.
+# This file is part of Crossroads project.
#
-# 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.
+# Crossroads 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.
+# Crossroads 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/>.
+# 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/>.
# Script to generate all required files from fresh git checkout.
diff --git a/builds/msvc/Makefile.am b/builds/msvc/Makefile.am
index 52331cb..8b16ccc 100644
--- a/builds/msvc/Makefile.am
+++ b/builds/msvc/Makefile.am
@@ -1,4 +1,4 @@
-LIBZMQ_DIST = libzmq/libzmq.vcproj libzmq/libzmq.vcxproj \
+LIBXS_DIST = libzmq/libzmq.vcproj libzmq/libzmq.vcxproj \
libzmq/libzmq.vcxproj.filters \
platform.hpp msvc.sln msvc10.sln
@@ -30,4 +30,4 @@ PROPERTIES_DIST = properties/Common.props \
PRECOMPILED_DIST = ../../src/precompiled.hpp \
../../src/precompiled.cpp
-EXTRA_DIST = $(LIBZMQ_DIST) $(PERF_DIST) $(PROPERTIES_DIST) $(PRECOMPILED_DIST)
+EXTRA_DIST = $(LIBXS_DIST) $(PERF_DIST) $(PROPERTIES_DIST) $(PRECOMPILED_DIST)
diff --git a/builds/msvc/libzmq/libzmq.vcproj b/builds/msvc/libzmq/libzmq.vcproj
index f93b422..71d6af0 100644
--- a/builds/msvc/libzmq/libzmq.vcproj
+++ b/builds/msvc/libzmq/libzmq.vcproj
@@ -190,7 +190,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../../../OpenPGM/include"
- PreprocessorDefinitions="ZMQ_HAVE_OPENPGM"
+ PreprocessorDefinitions="XS_HAVE_OPENPGM"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
diff --git a/builds/msvc/platform.hpp b/builds/msvc/platform.hpp
index 4af872c..e8a3324 100644
--- a/builds/msvc/platform.hpp
+++ b/builds/msvc/platform.hpp
@@ -1,15 +1,16 @@
/*
+ Copyright (c) 2012 250bpm s.r.o.
Copyright (c) 2007-2011 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,15 +19,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_PLATFORM_HPP_INCLUDED__
-#define __ZMQ_PLATFORM_HPP_INCLUDED__
+#ifndef __XS_PLATFORM_HPP_INCLUDED__
+#define __XS_PLATFORM_HPP_INCLUDED__
// This is the platform definition for the MSVC platform.
// As a first step of the build process it is copied to
-// zmq directory to take place of platform.hpp generated from
+// src directory to take place of platform.hpp generated from
// platform.hpp.in on platforms supported by GNU autotools.
-// Place any MSVC-specific definitions here.
-#define ZMQ_HAVE_WINDOWS
+#define XS_HAVE_WINDOWS
#endif
diff --git a/builds/msvc/properties/WithOpenPGM.props b/builds/msvc/properties/WithOpenPGM.props
index c920f58..2db4b14 100644
--- a/builds/msvc/properties/WithOpenPGM.props
+++ b/builds/msvc/properties/WithOpenPGM.props
@@ -6,7 +6,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
- <PreprocessorDefinitions>ZMQ_HAVE_OPENPGM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>XS_HAVE_OPENPGM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
-</Project> \ No newline at end of file
+</Project>
diff --git a/configure.in b/configure.in
index 0c8cc2f..382329f 100644
--- a/configure.in
+++ b/configure.in
@@ -2,11 +2,11 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
#
-# The 0MQ version number is extracted from include/zmq.h using
+# The Crossroads version number is extracted from include/xs.h using
# the version.sh script. Hence, it should be updated there.
# The version in git should reflect the *next* version planned.
#
-AC_INIT([zeromq],[m4_esyscmd([./version.sh])],[zeromq-dev@lists.zeromq.org])
+AC_INIT([libxs],[m4_esyscmd([./version.sh])])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
@@ -23,21 +23,14 @@ AC_SUBST(PACKAGE_VERSION)
# understand:
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
#
-# Changes:
-#
-# ZeroMQ versions prior to 2.1.0 use 0:0:0 (undefined)
-# ZeroMQ versions 2.1.x: 1:0:0 (ABI version 1)
-# ZeroMQ version 3.0: 2:0:0 (ABI version 2)
-# ZeroMQ version 3.1: 3:0:0 (ABI version 3)
-#
-# libzmq -version-info current:revision:age
-LTVER="3:0:0"
+# libxs -version-info current:revision:age
+LTVER="0:0:0"
AC_SUBST(LTVER)
# Take a copy of original flags
-ZMQ_ORIG_CFLAGS="${CFLAGS:-none}"
-ZMQ_ORIG_CPPFLAGS="${CPPFLAGS:-none}"
-ZMQ_ORIG_CXXFLAGS="${CXXFLAGS:-none}"
+XS_ORIG_CFLAGS="${CFLAGS:-none}"
+XS_ORIG_CPPFLAGS="${CPPFLAGS:-none}"
+XS_ORIG_CXXFLAGS="${CXXFLAGS:-none}"
# Checks for programs.
AC_PROG_CC
@@ -52,33 +45,33 @@ AC_ARG_VAR([XMLTO], [Path to xmlto command])
AC_PATH_PROG([XMLTO], [xmlto])
AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command])
AC_PATH_PROG([ASCIIDOC], [asciidoc])
-LIBZMQ_CONFIG_LIBTOOL
+LIBXS_CONFIG_LIBTOOL
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
# Check whether to build a with debug symbols
-LIBZMQ_CHECK_ENABLE_DEBUG
+LIBXS_CHECK_ENABLE_DEBUG
# Check wheter to enable code coverage
-LIBZMQ_WITH_GCOV
+LIBXS_WITH_GCOV
# Checks for libraries.
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([rt], [clock_gettime])
# Set pedantic
-libzmq_pedantic="yes"
+libxs_pedantic="yes"
# By default compiling with -Werror except OSX.
-libzmq_werror="yes"
+libxs_werror="yes"
# By default use DSO visibility
-libzmq_dso_visibility="yes"
+libxs_dso_visibility="yes"
# Whether we are on mingw or not.
-libzmq_on_mingw32="no"
+libxs_on_mingw32="no"
-# Set some default features required by 0MQ code.
+# Set some default features required by Crossroads code.
CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS"
# For host type checks
@@ -91,18 +84,18 @@ case "${host_os}" in
if test "x$GXX" = "xyes"; then
CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
fi
- AC_DEFINE(ZMQ_HAVE_LINUX, 1, [Have Linux OS])
+ AC_DEFINE(XS_HAVE_LINUX, 1, [Have Linux OS])
case "${host_os}" in
*android*)
- AC_DEFINE(ZMQ_HAVE_ANDROID, 1, [Have Android OS])
+ AC_DEFINE(XS_HAVE_ANDROID, 1, [Have Android OS])
;;
esac
;;
*solaris*)
# Define on Solaris to enable all library features
CPPFLAGS="-D_PTHREADS $CPPFLAGS"
- AC_DEFINE(ZMQ_HAVE_SOLARIS, 1, [Have Solaris OS])
+ AC_DEFINE(XS_HAVE_SOLARIS, 1, [Have Solaris OS])
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)
AC_MSG_CHECKING([whether atomic operations can be used])
@@ -116,32 +109,32 @@ case "${host_os}" in
AC_MSG_RESULT([$solaris_has_atomic])
# Solaris 8 does not have atomic operations exported to user space.
if test "x$solaris_has_atomic" = "xno"; then
- AC_DEFINE(ZMQ_FORCE_MUTEXES, 1, [Force to use mutexes])
+ AC_DEFINE(XS_FORCE_MUTEXES, 1, [Force to use mutexes])
fi
;;
*freebsd*)
# Define on FreeBSD to enable all library features
CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS"
- AC_DEFINE(ZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS])
+ AC_DEFINE(XS_HAVE_FREEBSD, 1, [Have FreeBSD OS])
;;
*darwin*)
# Define on Darwin to enable all library features
CPPFLAGS="-D_DARWIN_C_SOURCE $CPPFLAGS"
- libzmq_pedantic="no"
- libzmq_werror="no"
- AC_DEFINE(ZMQ_HAVE_OSX, 1, [Have DarwinOSX OS])
+ libxs_pedantic="no"
+ libxs_werror="no"
+ AC_DEFINE(XS_HAVE_OSX, 1, [Have DarwinOSX OS])
AC_LANG_PUSH([C++])
- LIBZMQ_CHECK_LANG_FLAG_PREPEND([-Wno-uninitialized])
+ LIBXS_CHECK_LANG_FLAG_PREPEND([-Wno-uninitialized])
AC_LANG_POP([C++])
;;
*netbsd*)
# Define on NetBSD to enable all library features
CPPFLAGS="-D_NETBSD_SOURCE $CPPFLAGS"
- AC_DEFINE(ZMQ_HAVE_NETBSD, 1, [Have NetBSD OS])
+ AC_DEFINE(XS_HAVE_NETBSD, 1, [Have NetBSD OS])
# NetBSD 5.0 and newer provides atomic operations but we can
# only use these on systems where PR #42842 has been fixed so
# we must try and link a test program using C++.
- libzmq_netbsd_has_atomic=no
+ libxs_netbsd_has_atomic=no
AC_MSG_CHECKING([whether atomic operations can be used])
AC_LANG_PUSH([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
@@ -149,35 +142,35 @@ case "${host_os}" in
[[uint32_t value;
atomic_cas_32 (&value, 0, 0);
return 0;]])],
- [libzmq_netbsd_has_atomic=yes],
- [libzmq_netbsd_has_atomic=no])
+ [libxs_netbsd_has_atomic=yes],
+ [libxs_netbsd_has_atomic=no])
AC_LANG_POP([C++])
- AC_MSG_RESULT([$libzmq_netbsd_has_atomic])
- if test "x$libzmq_netbsd_has_atomic" = "xno"; then
- AC_DEFINE(ZMQ_FORCE_MUTEXES, 1, [Force to use mutexes])
+ AC_MSG_RESULT([$libxs_netbsd_has_atomic])
+ if test "x$libxs_netbsd_has_atomic" = "xno"; then
+ AC_DEFINE(XS_FORCE_MUTEXES, 1, [Force to use mutexes])
fi
;;
*openbsd*)
# Define on OpenBSD to enable all library features
CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS"
- AC_DEFINE(ZMQ_HAVE_OPENBSD, 1, [Have OpenBSD OS])
+ AC_DEFINE(XS_HAVE_OPENBSD, 1, [Have OpenBSD OS])
;;
*nto-qnx*)
- libzmq_pedantic="no"
- AC_DEFINE(ZMQ_HAVE_QNXNTO, 1, [Have QNX Neutrino OS])
+ libxs_pedantic="no"
+ AC_DEFINE(XS_HAVE_QNXNTO, 1, [Have QNX Neutrino OS])
AC_CHECK_LIB(socket, socket)
;;
*aix*)
- AC_DEFINE(ZMQ_HAVE_AIX, 1, [Have AIX OS])
+ AC_DEFINE(XS_HAVE_AIX, 1, [Have AIX OS])
;;
*hpux*)
# Define on HP-UX to enable all library features
CPPFLAGS="-D_POSIX_C_SOURCE=200112L $CPPFLAGS"
- AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS])
+ AC_DEFINE(XS_HAVE_HPUX, 1, [Have HPUX OS])
;;
*mingw32*)
- AC_DEFINE(ZMQ_HAVE_WINDOWS, 1, [Have Windows OS])
- AC_DEFINE(ZMQ_HAVE_MINGW32, 1, [Have MinGW32])
+ AC_DEFINE(XS_HAVE_WINDOWS, 1, [Have Windows OS])
+ AC_DEFINE(XS_HAVE_MINGW32, 1, [Have MinGW32])
AC_CHECK_HEADERS(windows.h)
AC_CHECK_LIB(ws2_32, main, ,
[AC_MSG_ERROR([cannot link with ws2_32.dll.])])
@@ -187,10 +180,10 @@ case "${host_os}" in
[AC_MSG_ERROR([cannot link with iphlpapi.dll.])])
# mingw32 defines __int64_t as long long
AC_LANG_PUSH([C++])
- LIBZMQ_CHECK_LANG_FLAG_PREPEND([-Wno-long-long])
+ LIBXS_CHECK_LANG_FLAG_PREPEND([-Wno-long-long])
AC_LANG_POP([C++])
- libzmq_on_mingw32="yes"
- libzmq_dso_visibility="no"
+ libxs_on_mingw32="yes"
+ libxs_dso_visibility="no"
if test "x$enable_static" = "xyes"; then
AC_MSG_ERROR([Building static libraries is not supported under MinGW32])
@@ -199,7 +192,7 @@ case "${host_os}" in
*cygwin*)
# Define on Cygwin to enable all library features
CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
- AC_DEFINE(ZMQ_HAVE_CYGWIN, 1, [Have Cygwin])
+ AC_DEFINE(XS_HAVE_CYGWIN, 1, [Have Cygwin])
if test "x$enable_static" = "xyes"; then
AC_MSG_ERROR([Building static libraries is not supported under Cygwin])
fi
@@ -212,9 +205,9 @@ esac
#
# Check if the compiler supports -fvisibility=hidden flag. MinGW32 uses __declspec
#
-if test "x$libzmq_dso_visibility" = "xyes"; then
+if test "x$libxs_dso_visibility" = "xyes"; then
AC_LANG_PUSH([C++])
- LIBZMQ_CHECK_LANG_VISIBILITY([LIBZMQ_EXTRA_CXXFLAGS="$libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag ${LIBZMQ_EXTRA_CXXFLAGS}"])
+ LIBXS_CHECK_LANG_VISIBILITY([LIBXS_EXTRA_CXXFLAGS="$libxs_cv_[]_AC_LANG_ABBREV[]_visibility_flag ${LIBXS_EXTRA_CXXFLAGS}"])
AC_LANG_POP([C++])
fi
@@ -222,7 +215,7 @@ fi
case "${host_cpu}" in
*sparc*)
AC_LANG_PUSH([C++])
- LIBZMQ_CHECK_LANG_FLAG_PREPEND([-mcpu=v9])
+ LIBXS_CHECK_LANG_FLAG_PREPEND([-mcpu=v9])
AC_LANG_POP([C++])
;;
*)
@@ -230,10 +223,10 @@ case "${host_cpu}" in
esac
# Check whether to build docs / install man pages
-LIBZMQ_CHECK_DOC_BUILD
+LIBXS_CHECK_DOC_BUILD
# Check polling system
-LIBZMQ_CHECK_POLLER([CPPFLAGS="${CPPFLAGS} -D${libzmq_cv_poller_flag}"],
+LIBXS_CHECK_POLLER([CPPFLAGS="${CPPFLAGS} -D${libxs_cv_poller_flag}"],
[AC_MSG_ERROR([Unable to continue without polling system])])
# Checks for header files.
@@ -242,16 +235,15 @@ 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)
# Check if we have ifaddrs.h header file.
-AC_CHECK_HEADERS(ifaddrs.h, [AC_DEFINE(ZMQ_HAVE_IFADDRS, 1, [Have ifaddrs.h header.])])
+AC_CHECK_HEADERS(ifaddrs.h, [AC_DEFINE(XS_HAVE_IFADDRS, 1, [Have ifaddrs.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])
+ [xs_disable_eventfd=yes], [xs_disable_eventfd=no])
-if test "x$zmq_disable_eventfd" != "xyes"; then
+if test "x$xs_disable_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_CHECK_HEADERS(sys/eventfd.h, [AC_DEFINE(XS_HAVE_EVENTFD, 1, [Have eventfd extension.])])
fi
# Use c++ in subsequent tests
@@ -261,11 +253,11 @@ 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
+if test "x$libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
dnl 279: controlling expression is constant
dnl Fixes build with ICC 12.x
- LIBZMQ_CHECK_WITH_FLAG([-wd279], [AC_TYPE_SIZE_T])
- LIBZMQ_CHECK_WITH_FLAG([-wd279], [AC_TYPE_SSIZE_T])
+ LIBXS_CHECK_WITH_FLAG([-wd279], [AC_TYPE_SIZE_T])
+ LIBXS_CHECK_WITH_FLAG([-wd279], [AC_TYPE_SSIZE_T])
else
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
@@ -275,17 +267,17 @@ AC_TYPE_UINT32_T
AC_C_VOLATILE
# PGM extension
-libzmq_pgm_ext="no"
+libxs_pgm_ext="no"
pgm_basename="libpgm-5.1.118~dfsg"
AC_ARG_WITH([pgm], [AS_HELP_STRING([--with-pgm],
- [build libzmq with PGM extension [default=no]])],
+ [build libxs with PGM extension [default=no]])],
[with_pgm_ext=$withval], [with_pgm_ext=no])
# build using system pgm
AC_ARG_WITH([system-pgm], [AS_HELP_STRING([--with-system-pgm],
- [build libzmq with PGM extension. Requires pkg-config [default=no]])],
+ [build libxs 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
@@ -302,14 +294,14 @@ if test "x$with_pgm_ext" != "xno"; then
# Unpack libpgm
AC_MSG_NOTICE([Unpacking ${pgm_basename}.tar.gz])
- libzmq_pwd=`pwd`
+ libxs_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}"
+ cd "${libxs_pwd}"
if test -d foreign/openpgm/build-staging; then
rm -rf foreign/openpgm/build-staging
@@ -324,7 +316,7 @@ if test "x$with_pgm_ext" != "xno"; then
# 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}"])
+ LIBXS_CHECK_LANG_VISIBILITY([ac_configure_args="CFLAGS='$libxs_cv_[]_AC_LANG_ABBREV[]_visibility_flag' ${ac_configure_args}"])
AC_LANG_POP([C])
pgm_subdir=build-staging/openpgm/pgm
@@ -334,16 +326,16 @@ if test "x$with_pgm_ext" != "xno"; then
AC_CONFIG_SUBDIRS([foreign/openpgm/build-staging/openpgm/pgm/])
# Success!
- AC_DEFINE(ZMQ_HAVE_OPENPGM, 1, [Have OpenPGM extension])
- libzmq_pgm_ext="yes"
+ AC_DEFINE(XS_HAVE_OPENPGM, 1, [Have OpenPGM extension])
+ libxs_pgm_ext="yes"
fi
# Build with system openpgm
if test "x$with_system_pgm_ext" != "xno"; then
m4_ifdef([PKG_CHECK_MODULES], [
PKG_CHECK_MODULES([OpenPGM], [openpgm-5.1 >= 5.1])
- AC_DEFINE(ZMQ_HAVE_OPENPGM, 1, [Have OpenPGM extension])
- LIBZMQ_EXTRA_CXXFLAGS="$OpenPGM_CFLAGS $LIBZMQ_EXTRA_CXXFLAGS"
+ AC_DEFINE(XS_HAVE_OPENPGM, 1, [Have OpenPGM extension])
+ LIBXS_EXTRA_CXXFLAGS="$OpenPGM_CFLAGS $LIBXS_EXTRA_CXXFLAGS"
LIBS="$OpenPGM_LIBS $LIBS"
],
[AC_MSG_ERROR([--with-system-pgm requires a working pkg-config installation])])
@@ -355,37 +347,37 @@ AC_SUBST(pgm_basename)
AC_LANG_PUSH([C++])
# Check how to enable -Wall
-LIBZMQ_LANG_WALL([CPPFLAGS="$libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag $CPPFLAGS"])
+LIBXS_LANG_WALL([CPPFLAGS="$libxs_cv_[]_AC_LANG_ABBREV[]_wall_flag $CPPFLAGS"])
-if test "x$libzmq_werror" = "xyes" -a "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" != "xyes"; then
- LIBZMQ_LANG_WERROR([CPPFLAGS="$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag $CPPFLAGS"])
+if test "x$libxs_werror" = "xyes" -a "x$libxs_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" != "xyes"; then
+ LIBXS_LANG_WERROR([CPPFLAGS="$libxs_cv_[]_AC_LANG_ABBREV[]_werror_flag $CPPFLAGS"])
fi
-if test "x$libzmq_pedantic" = "xyes"; then
- LIBZMQ_LANG_STRICT([CPPFLAGS="$libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag $CPPFLAGS"])
+if test "x$libxs_pedantic" = "xyes"; then
+ LIBXS_LANG_STRICT([CPPFLAGS="$libxs_cv_[]_AC_LANG_ABBREV[]_strict_flag $CPPFLAGS"])
fi
AC_LANG_POP([C++])
-AM_CONDITIONAL(BUILD_PGM, test "x$libzmq_pgm_ext" = "xyes")
-AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes")
+AM_CONDITIONAL(BUILD_PGM, test "x$libxs_pgm_ext" = "xyes")
+AM_CONDITIONAL(ON_MINGW, test "x$libxs_on_mingw32" = "xyes")
# Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(perror gettimeofday clock_gettime memset socket getifaddrs freeifaddrs)
AC_CHECK_HEADERS([alloca.h])
-LIBZMQ_CHECK_SOCK_CLOEXEC([AC_DEFINE(
- [ZMQ_HAVE_SOCK_CLOEXEC],
+LIBXS_CHECK_SOCK_CLOEXEC([AC_DEFINE(
+ [XS_HAVE_SOCK_CLOEXEC],
[1],
[Whether SOCK_CLOEXEC is defined and functioning.])
])
-# Subst LIBZMQ_EXTRA_CFLAGS & CXXFLAGS & LDFLAGS
-AC_SUBST(LIBZMQ_EXTRA_CFLAGS)
-AC_SUBST(LIBZMQ_EXTRA_CXXFLAGS)
-AC_SUBST(LIBZMQ_EXTRA_LDFLAGS)
+# Subst LIBXS_EXTRA_CFLAGS & CXXFLAGS & LDFLAGS
+AC_SUBST(LIBXS_EXTRA_CFLAGS)
+AC_SUBST(LIBXS_EXTRA_CXXFLAGS)
+AC_SUBST(LIBXS_EXTRA_LDFLAGS)
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile
- perf/Makefile src/libzmq.pc \
+ perf/Makefile src/libxs.pc \
builds/msvc/Makefile tests/Makefile \
foreign/openpgm/Makefile \
builds/redhat/zeromq.spec])
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 103652f..af8d8f4 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,10 +1,10 @@
-MAN3 = zmq_bind.3 zmq_close.3 zmq_connect.3 zmq_init.3 \
- zmq_msg_close.3 zmq_msg_copy.3 zmq_msg_data.3 zmq_msg_init.3 \
- zmq_msg_init_data.3 zmq_msg_init_size.3 zmq_msg_move.3 zmq_msg_size.3 \
- zmq_poll.3 zmq_recv.3 zmq_send.3 zmq_setsockopt.3 zmq_socket.3 \
- zmq_strerror.3 zmq_term.3 zmq_version.3 zmq_getsockopt.3 zmq_errno.3 \
- zmq_sendmsg.3 zmq_recvmsg.3 zmq_getmsgopt.3
-MAN7 = zmq.7 zmq_tcp.7 zmq_pgm.7 zmq_epgm.7 zmq_inproc.7 zmq_ipc.7
+MAN3 = xs_bind.3 xs_close.3 xs_connect.3 xs_init.3 \
+ xs_msg_close.3 xs_msg_copy.3 xs_msg_data.3 xs_msg_init.3 \
+ xs_msg_init_data.3 xs_msg_init_size.3 xs_msg_move.3 xs_msg_size.3 \
+ xs_poll.3 xs_recv.3 xs_send.3 xs_setsockopt.3 xs_socket.3 \
+ xs_strerror.3 xs_term.3 xs_version.3 xs_getsockopt.3 xs_errno.3 \
+ xs_sendmsg.3 xs_recvmsg.3 xs_getmsgopt.3
+MAN7 = xs.7 xs_tcp.7 xs_pgm.7 xs_epgm.7 xs_inproc.7 xs_ipc.7
MAN_DOC = $(MAN1) $(MAN3) $(MAN7)
@@ -30,16 +30,16 @@ SUFFIXES=.html .txt .xml .3 .7
.txt.html:
asciidoc -d manpage -b xhtml11 -f $(srcdir)/asciidoc.conf \
- -azmq_version=@PACKAGE_VERSION@ -o$@ $<
+ -axs_version=@PACKAGE_VERSION@ -o$@ $<
.txt.xml:
asciidoc -d manpage -b docbook -f $(srcdir)/asciidoc.conf \
- -azmq_version=@PACKAGE_VERSION@ -o$@ $<
+ -axs_version=@PACKAGE_VERSION@ -o$@ $<
.xml.1:
xmlto man $<
.xml.3:
xmlto man $<
.xml.7:
xmlto man $<
-zmq_epgm.7: zmq_pgm.7
- cp zmq_pgm.7 $@
+xs_epgm.7: xs_pgm.7
+ cp xs_pgm.7 $@
endif
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
index d73d711..94cde95 100644
--- a/doc/asciidoc.conf
+++ b/doc/asciidoc.conf
@@ -2,10 +2,10 @@
literal-style=template="literalparagraph"
[macros]
-(?su)[\\]?(?P<name>linkzmq):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
+(?su)[\\]?(?P<name>linkxs):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
ifdef::backend-docbook[]
-[linkzmq-inlinemacro]
+[linkxs-inlinemacro]
{0%{target}}
{0#<citerefentry>}
{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
@@ -13,7 +13,7 @@ ifdef::backend-docbook[]
endif::backend-docbook[]
ifdef::backend-xhtml11[]
-[linkzmq-inlinemacro]
+[linkxs-inlinemacro]
<a href="{target}.html">{target}{0?({0})}</a>
endif::backend-xhtml11[]
@@ -25,9 +25,9 @@ template::[header-declarations]
<refmeta>
<refentrytitle>{mantitle}</refentrytitle>
<manvolnum>{manvolnum}</manvolnum>
-<refmiscinfo class="source">0MQ</refmiscinfo>
-<refmiscinfo class="version">{zmq_version}</refmiscinfo>
-<refmiscinfo class="manual">0MQ Manual</refmiscinfo>
+<refmiscinfo class="source">Crossroads</refmiscinfo>
+<refmiscinfo class="version">{xs_version}</refmiscinfo>
+<refmiscinfo class="manual">Crossroads Manual</refmiscinfo>
</refmeta>
<refnamediv>
<refname>{manname}</refname>
@@ -42,7 +42,7 @@ ifdef::backend-xhtml11[]
{disable-javascript%<div id="footnotes"><hr /></div>}
<div id="footer">
<div id="footer-text">
-ØMQ {zmq_version}<br />
+Crossroads {xs_version}<br />
Last updated {docdate} {doctime}
</div>
</div>
@@ -50,7 +50,3 @@ Last updated {docdate} {doctime}
</html>
endif::backend-xhtml11[]
-[replacements]
-ifdef::backend-xhtml11[]
-0MQ=ØMQ
-endif::backend-xhtml11[]
diff --git a/doc/xs.txt b/doc/xs.txt
new file mode 100644
index 0000000..635c7d5
--- /dev/null
+++ b/doc/xs.txt
@@ -0,0 +1,187 @@
+xs(7)
+=====
+
+
+NAME
+----
+xs - Crossroads, a lightweight messaging layer
+
+
+SYNOPSIS
+--------
+*#include <xs.h>*
+
+*cc* ['flags'] 'files' *-lxs* ['libraries']
+
+
+DESCRIPTION
+-----------
+Crossroads is a library which extends the standard
+socket interfaces with features traditionally provided by specialised
+_messaging middleware_ products. Crossroads sockets provide an abstraction of
+asynchronous _message queues_, multiple _messaging patterns_, message
+filtering (_subscriptions_), seamless access to multiple _transport protocols_
+and more.
+
+This documentation presents an overview of Crossroads concepts, describes how
+Crossroads abstract standard sockets and provides a reference manual for the
+functions provided by the Crossroads library.
+
+
+Context
+~~~~~~~
+Before using any Crossroads library functions the caller must initialise a
+'context' using _xs_init()_. The following functions are provided to handle
+initialisation and termination of a 'context':
+
+Initialise Crossroads context::
+ linkxs:xs_init[3]
+
+Terminate Crossroads context::
+ linkxs:xs_term[3]
+
+
+Thread safety
+^^^^^^^^^^^^^
+A 'context' is thread safe and may be shared among as many application
+threads as necessary, without any additional locking required on the part of
+the caller.
+
+Individual Crossroads '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 _xs_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
+_pthread_create()_.
+
+
+Multiple contexts
+^^^^^^^^^^^^^^^^^
+Multiple 'contexts' may coexist within a single application. Thus, an
+application can use Crossroads directly and at the same time make use of any
+number of additional libraries or components which themselves make use of
+Crossroads as long as the above guidelines regarding thread safety are adhered
+to.
+
+
+Messages
+~~~~~~~~
+A Crossroads message is a discrete unit of data passed between applications or
+components of the same application. Crossroads messages have no internal
+structure and from the point of view of Crossroads themselves they are
+considered to be opaque binary data.
+
+The following functions are provided to work with messages:
+
+Initialise a message::
+ linkxs:xs_msg_init[3]
+ linkxs:xs_msg_init_size[3]
+ linkxs:xs_msg_init_data[3]
+
+Release a message::
+ linkxs:xs_msg_close[3]
+
+Access message content::
+ linkxs:xs_msg_data[3]
+ linkxs:xs_msg_size[3]
+
+Message manipulation::
+ linkxs:xs_msg_copy[3]
+ linkxs:xs_msg_move[3]
+
+
+Sockets
+~~~~~~~
+Crossroads sockets present an abstraction of a asynchronous _message queue_,
+with the exact queueing semantics depending on the socket type in use. See
+linkxs:xs_socket[3] for the socket types provided.
+
+The following functions are provided to work with sockets:
+
+Creating a socket::
+ linkxs:xs_socket[3]
+
+Closing a socket::
+ linkxs:xs_close[3]
+
+Manipulating socket options::
+ linkxs:xs_getsockopt[3]
+ linkxs:xs_setsockopt[3]
+
+Establishing a message flow::
+ linkxs:xs_bind[3]
+ linkxs:xs_connect[3]
+
+Sending and receiving messages::
+ linkxs:xs_send[3]
+ linkxs:xs_recv[3]
+
+.Input/output multiplexing
+Crossroads provide a mechanism for applications to multiplex input/output events
+over a set containing both Crossroads sockets and standard sockets. This
+mechanism mirrors the standard _poll()_ system call, and is described in detail
+in linkxs:xs_poll[3].
+
+
+Transports
+~~~~~~~~~~
+A Crossroads socket can use multiple different underlying transport mechanisms.
+Each transport mechanism is suited to a particular purpose and has its own
+advantages and drawbacks.
+
+The following transport mechanisms are provided:
+
+Unicast transport using TCP::
+ linkxs:xs_tcp[7]
+
+Reliable multicast transport using PGM::
+ linkxs:xs_pgm[7]
+
+Local inter-process communication transport::
+ linkxs:xs_ipc[7]
+
+Local in-process (inter-thread) communication transport::
+ linkxs:xs_inproc[7]
+
+ERROR HANDLING
+--------------
+The Crossroads library functions handle errors using the standard conventions
+found on POSIX systems. Generally, this means that upon failure a Crossroads
+library function shall return either a NULL value (if returning a pointer) or
+a negative value (if returning an integer), and the actual error code shall be
+stored in the 'errno' variable.
+
+On non-POSIX systems some users may experience issues with retrieving the
+correct value of the 'errno' variable. The _xs_errno()_ function is provided
+to assist in these cases; for details refer to linkxs:xs_errno[3].
+
+The _xs_strerror()_ function is provided to translate Crossroads-specific error
+codes into error message strings; for details refer to linkxs:xs_strerror[3].
+
+
+MISCELLANEOUS
+-------------
+The following miscellaneous functions are provided:
+
+Report Crossroads library version::
+ linkxs:xs_version[3]
+
+
+LANGUAGE BINDINGS
+-----------------
+The Crossroads library provides interfaces suitable for calling from programs in
+any language; this documentation documents those interfaces as they would be
+used by C programmers. The intent is that programmers using Crossroads from
+other languages shall refer to this documentation alongside any documentation
+provided by the vendor of their language binding.
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
+
+COPYING
+-------
+Free use of Crossroads library is granted under the terms of the GNU Lesser
+General Public License (LGPL). For details see the files `COPYING` and
+`COPYING.LESSER` included with the Crossroads distribution.
diff --git a/doc/zmq_bind.txt b/doc/xs_bind.txt
index 58517ec..8cd49bc 100644
--- a/doc/zmq_bind.txt
+++ b/doc/xs_bind.txt
@@ -1,20 +1,20 @@
-zmq_bind(3)
-===========
+xs_bind(3)
+==========
NAME
----
-zmq_bind - accept connections on a socket
+xs_bind - accept connections on a socket
SYNOPSIS
--------
-*int zmq_bind (void '*socket', const char '*endpoint');*
+*int xs_bind (void '*socket', const char '*endpoint');*
DESCRIPTION
-----------
-The _zmq_bind()_ function shall create an endpoint for accepting connections
+The _xs_bind()_ function shall create an endpoint for accepting connections
and bind it to the socket referenced by the 'socket' argument.
The 'endpoint' argument is a string consisting of two parts as follows:
@@ -24,21 +24,21 @@ the underlying transport protocol selected.
The following transports are defined:
-'inproc':: local in-process (inter-thread) communication transport, see linkzmq:zmq_inproc[7]
-'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7]
-'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7]
-'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[7]
+'inproc':: local in-process (inter-thread) communication transport, see linkxs:xs_inproc[7]
+'ipc':: local inter-process communication transport, see linkxs:xs_ipc[7]
+'tcp':: unicast transport using TCP, see linkxs:xs_tcp[7]
+'pgm', 'epgm':: reliable multicast transport using PGM, see linkxs:xs_pgm[7]
-With the exception of 'ZMQ_PAIR' sockets, a single socket may be connected to
-multiple endpoints using _zmq_connect()_, while simultaneously accepting
+With the exception of 'XS_PAIR' sockets, a single socket may be connected to
+multiple endpoints using _xs_connect()_, while simultaneously accepting
incoming connections from multiple endpoints bound to the socket using
-_zmq_bind()_. Refer to linkzmq:zmq_socket[3] for a description of the exact
+_xs_bind()_. Refer to linkxs:xs_socket[3] for a description of the exact
semantics involved when connecting or binding a socket to multiple endpoints.
RETURN VALUE
------------
-The _zmq_bind()_ function shall return zero if successful. Otherwise it shall
+The _xs_bind()_ function shall return zero if successful. Otherwise it shall
return `-1` and set 'errno' to one of the values defined below.
@@ -57,7 +57,7 @@ The requested 'address' was not local.
*ENODEV*::
The requested 'address' specifies a nonexistent interface.
*ETERM*::
-The 0MQ 'context' associated with the specified 'socket' was terminated.
+The 'context' associated with the specified 'socket' was terminated.
*ENOTSOCK*::
The provided 'socket' was invalid.
*EMTHREAD*::
@@ -68,26 +68,26 @@ EXAMPLE
-------
.Binding a publisher socket to an in-process and a TCP transport
----
-/* Create a ZMQ_PUB socket */
-void *socket = zmq_socket (context, ZMQ_PUB);
+/* Create a XS_PUB socket */
+void *socket = xs_socket (context, XS_PUB);
assert (socket);
/* Bind it to a in-process transport with the address 'my_publisher' */
-int rc = zmq_bind (socket, "inproc://my_publisher");
+int rc = xs_bind (socket, "inproc://my_publisher");
assert (rc == 0);
/* Bind it to a TCP transport on port 5555 of the 'eth0' interface */
-rc = zmq_bind (socket, "tcp://eth0:5555");
+rc = xs_bind (socket, "tcp://eth0:5555");
assert (rc == 0);
----
SEE ALSO
--------
-linkzmq:zmq_connect[3]
-linkzmq:zmq_socket[3]
-linkzmq:zmq[7]
+linkxs:xs_connect[3]
+linkxs:xs_socket[3]
+linkxs:xs[7]
AUTHORS
-------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_close.txt b/doc/xs_close.txt
new file mode 100644
index 0000000..99b1ed8
--- /dev/null
+++ b/doc/xs_close.txt
@@ -0,0 +1,52 @@
+xs_close(3)
+===========
+
+
+NAME
+----
+xs_close - close Crossroads socket
+
+
+SYNOPSIS
+--------
+*int xs_close (void '*socket');*
+
+
+DESCRIPTION
+-----------
+The _xs_close()_ function shall destroy the socket referenced by the 'socket'
+argument. Any outstanding messages physically received from the network but not
+yet received by the application with _xs_recv()_ shall be discarded. The
+behaviour for discarding messages sent by the application with _xs_send()_ but
+not yet physically transferred to the network depends on the value of the
+_XS_LINGER_ socket option for the specified 'socket'.
+
+NOTE: The default setting of _XS_LINGER_ does not discard unsent messages;
+this behaviour may cause the application to block when calling _xs_term()_.
+For details refer to linkxs:xs_setsockopt[3] and linkxs:xs_term[3].
+
+
+RETURN VALUE
+------------
+The _xs_close()_ function shall return zero if successful. Otherwise it shall
+return `-1` and set 'errno' to one of the values defined below.
+
+
+ERRORS
+------
+*ENOTSOCK*::
+The provided 'socket' was invalid.
+
+
+SEE ALSO
+--------
+linkxs:xs_socket[3]
+linkxs:xs_term[3]
+linkxs:xs_setsockopt[3]
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_connect.txt b/doc/xs_connect.txt
index d0045c4..a0a6ae7 100644
--- a/doc/zmq_connect.txt
+++ b/doc/xs_connect.txt
@@ -1,20 +1,20 @@
-zmq_connect(3)
-==============
+xs_connect(3)
+=============
NAME
----
-zmq_connect - connect a socket
+xs_connect - connect a socket
SYNOPSIS
--------
-*int zmq_connect (void '*socket', const char '*endpoint');*
+*int xs_connect (void '*socket', const char '*endpoint');*
DESCRIPTION
-----------
-The _zmq_connect()_ function shall connect the socket referenced by the
+The _xs_connect()_ function shall connect the socket referenced by the
'socket' argument to the endpoint specified by the 'endpoint' argument.
The 'endpoint' argument is a string consisting of two parts as follows:
@@ -24,25 +24,25 @@ the underlying transport protocol selected.
The following transports are defined:
-'inproc':: local in-process (inter-thread) communication transport, see linkzmq:zmq_inproc[7]
-'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7]
-'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7]
-'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[7]
+'inproc':: local in-process (inter-thread) communication transport, see linkxs:xs_inproc[7]
+'ipc':: local inter-process communication transport, see linkxs:xs_ipc[7]
+'tcp':: unicast transport using TCP, see linkxs:xs_tcp[7]
+'pgm', 'epgm':: reliable multicast transport using PGM, see linkxs:xs_pgm[7]
-With the exception of 'ZMQ_PAIR' sockets, a single socket may be connected to
-multiple endpoints using _zmq_connect()_, while simultaneously accepting
+With the exception of 'XS_PAIR' sockets, a single socket may be connected to
+multiple endpoints using _xs_connect()_, while simultaneously accepting
incoming connections from multiple endpoints bound to the socket using
-_zmq_bind()_. Refer to linkzmq:zmq_socket[3] for a description of the exact
+_xs_bind()_. Refer to linkxs:xs_socket[3] for a description of the exact
semantics involved when connecting or binding a socket to multiple endpoints.
-NOTE: The connection will not be performed immediately but as needed by 0MQ.
-Thus a successful invocation of _zmq_connect()_ does not indicate that a
+NOTE: The connection will not be performed immediately but as needed by the
+library. Thus a successful invocation of _xs_connect()_ does not indicate that a
physical connection was or can actually be established.
RETURN VALUE
------------
-The _zmq_connect()_ function shall return zero if successful. Otherwise it
+The _xs_connect()_ function shall return zero if successful. Otherwise it
shall return `-1` and set 'errno' to one of the values defined below.
@@ -55,7 +55,7 @@ The requested 'transport' protocol is not supported.
*ENOCOMPATPROTO*::
The requested 'transport' protocol is not compatible with the socket type.
*ETERM*::
-The 0MQ 'context' associated with the specified 'socket' was terminated.
+The 'context' associated with the specified 'socket' was terminated.
*ENOTSOCK*::
The provided 'socket' was invalid.
*EMTHREAD*::
@@ -66,26 +66,26 @@ EXAMPLE
-------
.Connecting a subscriber socket to an in-process and a TCP transport
----
-/* Create a ZMQ_SUB socket */
-void *socket = zmq_socket (context, ZMQ_SUB);
+/* Create a XS_SUB socket */
+void *socket = xs_socket (context, XS_SUB);
assert (socket);
/* Connect it to an in-process transport with the address 'my_publisher' */
-int rc = zmq_connect (socket, "inproc://my_publisher");
+int rc = xs_connect (socket, "inproc://my_publisher");
assert (rc == 0);
/* Connect it to the host server001, port 5555 using a TCP transport */
-rc = zmq_connect (socket, "tcp://server001:5555");
+rc = xs_connect (socket, "tcp://server001:5555");
assert (rc == 0);
----
SEE ALSO
--------
-linkzmq:zmq_bind[3]
-linkzmq:zmq_socket[3]
-linkzmq:zmq[7]
+linkxs:xs_bind[3]
+linkxs:xs_socket[3]
+linkxs:xs[7]
AUTHORS
-------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_epgm.txt b/doc/xs_epgm.txt
index 4d58b1b..4d58b1b 120000
--- a/doc/zmq_epgm.txt
+++ b/doc/xs_epgm.txt
diff --git a/doc/xs_errno.txt b/doc/xs_errno.txt
new file mode 100644
index 0000000..b0cac77
--- /dev/null
+++ b/doc/xs_errno.txt
@@ -0,0 +1,50 @@
+xs_errno(3)
+===========
+
+
+NAME
+----
+xs_errno - retrieve value of errno for the calling thread
+
+
+SYNOPSIS
+--------
+*int xs_errno (void);*
+
+
+DESCRIPTION
+-----------
+The _xs_errno()_ function shall retrieve the value of the 'errno' variable for
+the calling thread.
+
+The _xs_errno()_ function is provided to assist users on non-POSIX systems who
+are experiencing issues with retrieving the correct value of 'errno' directly.
+Specifically, users on Win32 systems whose application is using a different C
+run-time library from the C run-time library in use by Crossroads will need to
+use _xs_errno()_ for correct operation.
+
+IMPORTANT: Users not experiencing issues with retrieving the correct value of
+'errno' should not use this function and should instead access the 'errno'
+variable directly.
+
+
+RETURN VALUE
+------------
+The _xs_errno()_ function shall return the value of the 'errno' variable for
+the calling thread.
+
+
+ERRORS
+------
+No errors are defined.
+
+
+SEE ALSO
+--------
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_getmsgopt.txt b/doc/xs_getmsgopt.txt
index a82c30c..4b06322 100644
--- a/doc/zmq_getmsgopt.txt
+++ b/doc/xs_getmsgopt.txt
@@ -1,35 +1,35 @@
-zmq_getmsgopt(3)
-================
+xs_getmsgopt(3)
+===============
NAME
----
-zmq_getmsgopt - retrieve message option
+xs_getmsgopt - retrieve message option
SYNOPSIS
--------
-*int zmq_getmsgopt (zmq_msg_t '*message', int 'option_name', void '*option_value', size_t '*option_len');*
+*int xs_getmsgopt (xs_msg_t '*message', int 'option_name', void '*option_value', size_t '*option_len');*
DESCRIPTION
-----------
-The _zmq_getmsgopt()_ function shall retrieve the value for the option
+The _xs_getmsgopt()_ function shall retrieve the value for the option
specified by the 'option_name' argument for the message pointed to by the
'message' argument, and store it in the buffer pointed to by the 'option_value'
argument. The 'option_len' argument is the size in bytes of the buffer pointed
-to by 'option_value'; upon successful completion _zmq_getsockopt()_ shall
+to by 'option_value'; upon successful completion _xs_getsockopt()_ shall
modify the 'option_len' argument to indicate the actual size of the option
value stored in the buffer.
-The following options can be retrieved with the _zmq_getmsgopt()_ function:
+The following options can be retrieved with the _xs_getmsgopt()_ function:
-*ZMQ_MORE*::
+*XS_MORE*::
Indicates that there are more message parts to follow after the 'message'.
RETURN VALUE
------------
-The _zmq_getmsgopt()_ function shall return zero if successful. Otherwise it
+The _xs_getmsgopt()_ function shall return zero if successful. Otherwise it
shall return `-1` and set 'errno' to one of the values defined below.
@@ -46,17 +46,17 @@ EXAMPLE
-------
.Receiving a multi-part message
----
-zmq_msg_t part;
+xs_msg_t part;
int more;
size_t more_size = sizeof (more);
while (true) {
- /* Create an empty 0MQ message to hold the message part */
- int rc = zmq_msg_init (&part);
+ /* Create an empty message to hold the message part */
+ int rc = xs_msg_init (&part);
assert (rc == 0);
/* Block until a message is available to be received from socket */
- rc = zmq_recvmsg (socket, &part, 0);
+ rc = xs_recvmsg (socket, &part, 0);
assert (rc != -1);
- rc = getmsgopt (&part, ZMQ_MORE, &more, &more_size);
+ rc = getmsgopt (&part, XS_MORE, &more, &more_size);
assert (rc == 0);
if (more) {
fprintf (stderr, "more\n");
@@ -65,21 +65,21 @@ while (true) {
fprintf (stderr, "end\n");
break;
}
- zmq_msg_close (part);
+ xs_msg_close (part);
}
----
SEE ALSO
--------
-linkzmq:zmq_msg_data[3]
-linkzmq:zmq_msg_init[3]
-linkzmq:zmq_msg_init_size[3]
-linkzmq:zmq_msg_init_data[3]
-linkzmq:zmq_msg_close[3]
-linkzmq:zmq[7]
+linkxs:xs_msg_data[3]
+linkxs:xs_msg_init[3]
+linkxs:xs_msg_init_size[3]
+linkxs:xs_msg_init_data[3]
+linkxs:xs_msg_close[3]
+linkxs:xs[7]
AUTHORS
-------
-The 0MQ documentation was written by Chuck Remes <cremes@mac.com>.
+This manual page was written by Chuck Remes <cremes@mac.com>.
diff --git a/doc/zmq_getsockopt.txt b/doc/xs_getsockopt.txt
index 50b80fd..e7ddb8e 100644
--- a/doc/zmq_getsockopt.txt
+++ b/doc/xs_getsockopt.txt
@@ -1,34 +1,34 @@
-zmq_getsockopt(3)
-=================
+xs_getsockopt(3)
+================
NAME
----
-zmq_getsockopt - get 0MQ socket options
+xs_getsockopt - get Crossroads socket option
SYNOPSIS
--------
-*int zmq_getsockopt (void '*socket', int 'option_name', void '*option_value', size_t '*option_len');*
+*int xs_getsockopt (void '*socket', int 'option_name', void '*option_value', size_t '*option_len');*
DESCRIPTION
-----------
-The _zmq_getsockopt()_ function shall retrieve the value for the option
-specified by the 'option_name' argument for the 0MQ socket pointed to by the
-'socket' argument, and store it in the buffer pointed to by the 'option_value'
-argument. The 'option_len' argument is the size in bytes of the buffer pointed
-to by 'option_value'; upon successful completion _zmq_getsockopt()_ shall
-modify the 'option_len' argument to indicate the actual size of the option
-value stored in the buffer.
+The _xs_getsockopt()_ function shall retrieve the value for the option
+specified by the 'option_name' argument for the Crossroads socket pointed to by
+the 'socket' argument, and store it in the buffer pointed to by the
+'option_value' argument. The 'option_len' argument is the size in bytes of the
+buffer pointed to by 'option_value'; upon successful completion
+_xs_getsockopt()_ shall modify the 'option_len' argument to indicate the actual
+size of the option value stored in the buffer.
-The following options can be retrieved with the _zmq_getsockopt()_ function:
+The following options can be retrieved with the _xs_getsockopt()_ function:
-ZMQ_TYPE: Retrieve socket type
+XS_TYPE: Retrieve socket type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_TYPE' option shall retrieve the socket type for the specified
+The 'XS_TYPE' option shall retrieve the socket type for the specified
'socket'. The socket type is specified at socket creation time and
cannot be modified afterwards.
@@ -39,13 +39,13 @@ Default value:: N/A
Applicable socket types:: all
-ZMQ_RCVMORE: More message data parts to follow
+XS_RCVMORE: More message data parts to follow
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RCVMORE' option shall return True (1) if the message part last
+The 'XS_RCVMORE' option shall return True (1) if the message part last
received from the 'socket' was a data part with more parts to follow. If there
are no data parts to follow, this option shall return False (0).
-Refer to linkzmq:zmq_send[3] and linkzmq:zmq_recv[3] for a detailed description
+Refer to linkxs:xs_send[3] and linkxs:xs_recv[3] for a detailed description
of multi-part messages.
[horizontal]
@@ -55,17 +55,17 @@ Default value:: N/A
Applicable socket types:: all
-ZMQ_SNDHWM: Retrieves high water mark for outbound messages
+XS_SNDHWM: Retrieves high water mark for outbound messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_SNDHWM' option shall return the high water mark for outbound messages
+The 'XS_SNDHWM' option shall return the high water mark for outbound messages
on the specified 'socket'. The high water mark is a hard limit on the maximum
-number of outstanding messages 0MQ shall queue in memory for any single peer
-that the specified 'socket' is communicating with.
+number of outstanding messages the library shall queue in memory for any single
+peer that the specified 'socket' is communicating with.
If this limit has been reached the socket shall enter an exceptional state and
-depending on the socket type, 0MQ shall take appropriate action such as
+depending on the socket type, the library shall take appropriate action such as
blocking or dropping sent messages. Refer to the individual socket descriptions
-in linkzmq:zmq_socket[3] for details on the exact action taken for each socket
+in linkxs:xs_socket[3] for details on the exact action taken for each socket
type.
[horizontal]
@@ -75,17 +75,17 @@ Default value:: 1000
Applicable socket types:: all
-ZMQ_RCVHWM: Retrieve high water mark for inbound messages
+XS_RCVHWM: Retrieve high water mark for inbound messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RCVHWM' option shall return the high water mark for inbound messages on
+The 'XS_RCVHWM' option shall return the high water mark for inbound messages on
the specified 'socket'. The high water mark is a hard limit on the maximum
-number of outstanding messages 0MQ shall queue in memory for any single peer
-that the specified 'socket' is communicating with.
+number of outstanding messages the library shall queue in memory for any single
+peer that the specified 'socket' is communicating with.
If this limit has been reached the socket shall enter an exceptional state and
-depending on the socket type, 0MQ shall take appropriate action such as
+depending on the socket type, the library shall take appropriate action such as
blocking or dropping sent messages. Refer to the individual socket descriptions
-in linkzmq:zmq_socket[3] for details on the exact action taken for each socket
+in linkxs:xs_socket[3] for details on the exact action taken for each socket
type.
[horizontal]
@@ -95,20 +95,20 @@ Default value:: 1000
Applicable socket types:: all
-ZMQ_AFFINITY: Retrieve I/O thread affinity
+XS_AFFINITY: Retrieve I/O thread affinity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_AFFINITY' option shall retrieve the I/O thread affinity for newly
+The 'XS_AFFINITY' option shall retrieve the I/O thread affinity for newly
created connections on the specified 'socket'.
-Affinity determines which threads from the 0MQ I/O thread pool associated with
-the socket's _context_ shall handle newly created connections. A value of zero
-specifies no affinity, meaning that work shall be distributed fairly among all
-0MQ I/O threads in the thread pool. For non-zero values, the lowest bit
+Affinity determines which threads from the Crossroads I/O thread pool associated
+with the socket's _context_ shall handle newly created connections. A value of
+zero specifies no affinity, meaning that work shall be distributed fairly among
+all I/O threads in the thread pool. For non-zero values, the lowest bit
corresponds to thread 1, second lowest bit to thread 2 and so on. For example,
a value of 3 specifies that subsequent connections on 'socket' shall be handled
exclusively by I/O threads 1 and 2.
-See also linkzmq:zmq_init[3] for details on allocating the number of I/O
+See also linkxs:xs_init[3] for details on allocating the number of I/O
threads for a specific _context_.
[horizontal]
@@ -117,15 +117,15 @@ Option value unit:: N/A (bitmap)
Default value:: 0
Applicable socket types:: N/A
-ZMQ_IDENTITY: Set socket identity
+XS_IDENTITY: Set socket identity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_IDENTITY' option shall retrieve the identity of the specified 'socket'.
+The 'XS_IDENTITY' option shall retrieve the identity of the specified 'socket'.
Socket identity is used only by request/reply pattern. Namely, it can be used
in tandem with ROUTER socket to route messages to the peer with specific
identity.
Identity should be at least one byte and at most 255 bytes long. Identities
-starting with binary zero are reserved for use by 0MQ infrastructure.
+starting with binary zero are reserved for use by Crossroads infrastructure.
[horizontal]
Option value type:: binary data
@@ -134,9 +134,9 @@ Default value:: NULL
Applicable socket types:: all
-ZMQ_RATE: Retrieve multicast data rate
+XS_RATE: Retrieve multicast data rate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RATE' option shall retrieve the maximum send or receive data rate for
+The 'XS_RATE' option shall retrieve the maximum send or receive data rate for
multicast transports using the specified 'socket'.
[horizontal]
@@ -146,9 +146,9 @@ Default value:: 100
Applicable socket types:: all, when using multicast transports
-ZMQ_RECOVERY_IVL: Get multicast recovery interval
+XS_RECOVERY_IVL: Get multicast recovery interval
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RECOVERY_IVL' option shall retrieve the recovery interval for
+The 'XS_RECOVERY_IVL' option shall retrieve the recovery interval for
multicast transports using the specified 'socket'. The recovery interval
determines the maximum time in milliseconds that a receiver can be absent from a
multicast group before unrecoverable data loss will occur.
@@ -160,9 +160,9 @@ Default value:: 10000
Applicable socket types:: all, when using multicast transports
-ZMQ_SNDBUF: Retrieve kernel transmit buffer size
+XS_SNDBUF: Retrieve kernel transmit buffer size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_SNDBUF' option shall retrieve the underlying kernel transmit buffer
+The 'XS_SNDBUF' option shall retrieve the underlying kernel transmit buffer
size for the specified 'socket'. A value of zero means that the OS default is
in effect. For details refer to your operating system documentation for the
'SO_SNDBUF' socket option.
@@ -174,9 +174,9 @@ Default value:: 0
Applicable socket types:: all
-ZMQ_RCVBUF: Retrieve kernel receive buffer size
+XS_RCVBUF: Retrieve kernel receive buffer size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RCVBUF' option shall retrieve the underlying kernel receive buffer
+The 'XS_RCVBUF' option shall retrieve the underlying kernel receive buffer
size for the specified 'socket'. A value of zero means that the OS default is
in effect. For details refer to your operating system documentation for the
'SO_RCVBUF' socket option.
@@ -188,26 +188,26 @@ Default value:: 0
Applicable socket types:: all
-ZMQ_LINGER: Retrieve linger period for socket shutdown
+XS_LINGER: Retrieve linger period for socket shutdown
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_LINGER' option shall retrieve the linger period for the specified
+The 'XS_LINGER' option shall retrieve the linger period for the specified
'socket'. The linger period determines how long pending messages which have
yet to be sent to a peer shall linger in memory after a socket is 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
+linkxs:xs_close[3], and further affects the termination of the socket's
+context with linkxs:xs_term[3]. The following outlines the different
behaviours:
* The default value of '-1' specifies an infinite linger period. Pending
- messages shall not be discarded after a call to _zmq_close()_; attempting to
- terminate the socket's context with _zmq_term()_ shall block until all
+ messages shall not be discarded after a call to _xs_close()_; attempting to
+ terminate the socket's context with _xs_term()_ shall block until all
pending messages have been sent to a peer.
* The value of '0' specifies no linger period. Pending messages shall be
- discarded immediately when the socket is closed with _zmq_close()_.
+ discarded immediately when the socket is closed with _xs_close()_.
* Positive values specify an upper bound for the linger period in milliseconds.
- Pending messages shall not be discarded after a call to _zmq_close()_;
- attempting to terminate the socket's context with _zmq_term()_ shall block
+ Pending messages shall not be discarded after a call to _xs_close()_;
+ attempting to terminate the socket's context with _xs_term()_ shall block
until either all pending messages have been sent to a peer, or the linger
period expires, after which any pending messages shall be discarded.
@@ -218,14 +218,14 @@ Default value:: -1 (infinite)
Applicable socket types:: all
-ZMQ_RECONNECT_IVL: Retrieve reconnection interval
+XS_RECONNECT_IVL: Retrieve reconnection interval
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RECONNECT_IVL' option shall retrieve the initial reconnection interval
-for the specified 'socket'. The reconnection interval is the period 0MQ shall
-wait between attempts to reconnect disconnected peers when using
+The 'XS_RECONNECT_IVL' option shall retrieve the initial reconnection interval
+for the specified 'socket'. The reconnection interval is the period the library
+shall wait between attempts to reconnect disconnected peers when using
connection-oriented transports.
-NOTE: The reconnection interval may be randomized by 0MQ to prevent
+NOTE: The reconnection interval may be randomized by the library to prevent
reconnection storms in topologies with a large number of peers per socket.
[horizontal]
@@ -235,28 +235,28 @@ Default value:: 100
Applicable socket types:: all, only for connection-oriented transports
-ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval
+XS_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RECONNECT_IVL_MAX' option shall retrieve the maximum reconnection
-interval for the specified 'socket'. This is the maximum period 0MQ shall wait
-between attempts to reconnect. On each reconnect attempt, the previous interval
-shall be doubled untill ZMQ_RECONNECT_IVL_MAX is reached. This allows for
-exponential backoff strategy. Default value means no exponential backoff is
-performed and reconnect interval calculations are only based on
-ZMQ_RECONNECT_IVL.
+The 'XS_RECONNECT_IVL_MAX' option shall retrieve the maximum reconnection
+interval for the specified 'socket'. This is the maximum period the library
+shall wait between attempts to reconnect. On each reconnect attempt, the
+previous interval shall be doubled untill XS_RECONNECT_IVL_MAX is reached. This
+allows for exponential backoff strategy. Default value means no exponential
+backoff is performed and reconnect interval calculations are only based on
+XS_RECONNECT_IVL.
-NOTE: Values less than ZMQ_RECONNECT_IVL will be ignored.
+NOTE: Values less than XS_RECONNECT_IVL will be ignored.
[horizontal]
Option value type:: int
Option value unit:: milliseconds
-Default value:: 0 (only use ZMQ_RECONNECT_IVL)
+Default value:: 0 (only use XS_RECONNECT_IVL)
Applicable socket types:: all, only for connection-oriented transport
-ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections
+XS_BACKLOG: Retrieve maximum length of the queue of outstanding connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_BACKLOG' option shall retrieve the maximum length of the queue of
+The 'XS_BACKLOG' option shall retrieve the maximum length of the queue of
outstanding peer connections for the specified 'socket'; this only applies to
connection-oriented transports. For details refer to your operating system
documentation for the 'listen' function.
@@ -268,11 +268,11 @@ Default value:: 100
Applicable socket types:: all, only for connection-oriented transports
-ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size
+XS_MAXMSGSIZE: Maximum acceptable inbound message size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The option shall retrieve limit for the inbound messages. If a peer sends
-a message larger than ZMQ_MAXMSGSIZE it is disconnected. Value of -1 means
+a message larger than XS_MAXMSGSIZE it is disconnected. Value of -1 means
'no limit'.
[horizontal]
@@ -282,7 +282,7 @@ Default value:: -1
Applicable socket types:: all
-ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets
+XS_MULTICAST_HOPS: Maximum network hops for multicast packets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The option shall retrieve time-to-live used for outbound multicast packets.
@@ -295,11 +295,11 @@ Default value:: 1
Applicable socket types:: all, when using multicast transports
-ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN
+XS_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retrieve the timeout for recv operation on the socket. If the value is `0`,
-_zmq_recv(3)_ will return immediately, with a EAGAIN error if there is no
+_xs_recv(3)_ will return immediately, with a EAGAIN error if there is no
message to receive. If the value is `-1`, it will block until a message is
available. For all other values, it will wait for a message for that amount
of time before returning with an EAGAIN error.
@@ -311,11 +311,11 @@ Default value:: -1 (infinite)
Applicable socket types:: all
-ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN
+XS_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retrieve the timeout for send operation on the socket. If the value is `0`,
-_zmq_send(3)_ will return immediately, with a EAGAIN error if the message
+_xs_send(3)_ will return immediately, with a EAGAIN error if the message
cannot be sent. If the value is `-1`, it will block until the message is sent.
For all other values, it will try to send the message for that amount of time
before returning with an EAGAIN error.
@@ -327,7 +327,7 @@ Default value:: -1 (infinite)
Applicable socket types:: all
-ZMQ_IPV4ONLY: Retrieve IPv4-only socket override status
+XS_IPV4ONLY: Retrieve IPv4-only socket override status
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retrieve the underlying native socket type. A value of `1` will use IPv4
@@ -342,18 +342,18 @@ Default value:: 1 (true)
Applicable socket types:: all, when using TCP transports.
-ZMQ_FD: Retrieve file descriptor associated with the socket
+XS_FD: Retrieve file descriptor associated with the socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_FD' option shall retrieve the file descriptor associated with the
+The 'XS_FD' option shall retrieve the file descriptor associated with the
specified 'socket'. The returned file descriptor can be used to integrate the
-socket into an existing event loop; the 0MQ library shall signal any pending
+socket into an existing event loop; the library shall signal any pending
events on the socket in an _edge-triggered_ fashion by making the file
descriptor become ready for reading.
NOTE: The ability to read from the returned file descriptor does not
necessarily indicate that messages are available to be read from, or can be
written to, the underlying socket; applications must retrieve the actual event
-state with a subsequent retrieval of the 'ZMQ_EVENTS' option.
+state with a subsequent retrieval of the 'XS_EVENTS' option.
CAUTION: The returned file descriptor is intended for use with a 'poll' or
similar system call only. Applications must never attempt to read or write data
@@ -366,23 +366,23 @@ Default value:: N/A
Applicable socket types:: all
-ZMQ_EVENTS: Retrieve socket event state
+XS_EVENTS: Retrieve socket event state
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_EVENTS' option shall retrieve the event state for the specified
+The 'XS_EVENTS' option shall retrieve the event state for the specified
'socket'. The returned value is a bit mask constructed by OR'ing a combination
of the following event flags:
-*ZMQ_POLLIN*::
+*XS_POLLIN*::
Indicates that at least one message may be received from the specified socket
without blocking.
-*ZMQ_POLLOUT*::
+*XS_POLLOUT*::
Indicates that at least one message may be sent to the specified socket without
blocking.
-The combination of a file descriptor returned by the 'ZMQ_FD' option being
+The combination of a file descriptor returned by the 'XS_FD' option being
ready for reading but no actual events returned by a subsequent retrieval of
-the 'ZMQ_EVENTS' option is valid; applications should simply ignore this case
+the 'XS_EVENTS' option is valid; applications should simply ignore this case
and restart their polling operation/event loop.
[horizontal]
@@ -394,7 +394,7 @@ Applicable socket types:: all
RETURN VALUE
------------
-The _zmq_getsockopt()_ function shall return zero if successful. Otherwise it
+The _xs_getsockopt()_ function shall return zero if successful. Otherwise it
shall return `-1` and set 'errno' to one of the values defined below.
@@ -406,7 +406,7 @@ _option_value_ is invalid, or the size of the buffer pointed to by
_option_value_, as specified by _option_len_, is insufficient for storing the
option value.
*ETERM*::
-The 0MQ 'context' associated with the specified 'socket' was terminated.
+The 'context' associated with the specified 'socket' was terminated.
*ENOTSOCK*::
The provided 'socket' was invalid.
*EINTR*::
@@ -420,19 +420,19 @@ EXAMPLE
/* Retrieve high water mark into sndhwm */
int sndhwm;
size_t sndhwm_size = sizeof (sndhwm);
-rc = zmq_getsockopt (socket, ZMQ_SNDHWM, &sndhwm, &sndhwm_size);
+rc = xs_getsockopt (socket, XS_SNDHWM, &sndhwm, &sndhwm_size);
assert (rc == 0);
----
SEE ALSO
--------
-linkzmq:zmq_setsockopt[3]
-linkzmq:zmq_socket[3]
-linkzmq:zmq[7]
+linkxs:xs_setsockopt[3]
+linkxs:xs_socket[3]
+linkxs:xs[7]
AUTHORS
-------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_init.txt b/doc/xs_init.txt
index 74f4b3e..e642824 100644
--- a/doc/zmq_init.txt
+++ b/doc/xs_init.txt
@@ -1,34 +1,34 @@
-zmq_init(3)
-===========
+xs_init(3)
+==========
NAME
----
-zmq_init - initialise 0MQ context
+xs_init - initialise Crossroads context
SYNOPSIS
--------
-*void *zmq_init (int 'io_threads');*
+*void *xs_init (int 'io_threads');*
DESCRIPTION
-----------
-The _zmq_init()_ function initialises a 0MQ 'context'.
+The _xs_init()_ function initialises a Crossroads 'context'.
-The 'io_threads' argument specifies the size of the 0MQ thread pool to handle
+The 'io_threads' argument specifies the size of the thread pool to handle
I/O operations. If your application is using only the 'inproc' transport for
messaging you may set this to zero, otherwise set it to at least one.
.Thread safety
-A 0MQ 'context' is thread safe and may be shared among as many application
+A 'context' is thread safe and may be shared among as many application
threads as necessary, without any additional locking required on the part of
the caller.
RETURN VALUE
------------
-The _zmq_init()_ function shall return an opaque handle to the initialised
+The _xs_init()_ function shall return an opaque handle to the initialised
'context' if successful. Otherwise it shall return NULL and set 'errno' to one
of the values defined below.
@@ -41,11 +41,11 @@ An invalid number of 'io_threads' was requested.
SEE ALSO
--------
-linkzmq:zmq[7]
-linkzmq:zmq_term[3]
+linkxs:xs[7]
+linkxs:xs_term[3]
AUTHORS
-------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_inproc.txt b/doc/xs_inproc.txt
index a2ae6e3..9ec255f 100644
--- a/doc/zmq_inproc.txt
+++ b/doc/xs_inproc.txt
@@ -1,26 +1,20 @@
-zmq_inproc(7)
-=============
+xs_inproc(7)
+============
NAME
----
-zmq_inproc - 0MQ local in-process (inter-thread) communication transport
+xs_inproc - local in-process (inter-thread) transport
SYNOPSIS
--------
The in-process transport passes messages via memory directly between threads
-sharing a single 0MQ 'context'.
-
-NOTE: No I/O threads are involved in passing messages using the 'inproc'
-transport. Therefore, if you are using a 0MQ 'context' for in-process messaging
-only you can initialise the 'context' with zero I/O threads. See
-linkzmq:zmq_init[3] for details.
-
+sharing a single 'context'.
ADDRESSING
----------
-A 0MQ address string consists of two parts as follows:
+A Crossroads address string consists of two parts as follows:
'transport'`://`'endpoint'. The 'transport' part specifies the underlying
transport protocol to use, and for the in-process transport shall be set to
`inproc`. The meaning of the 'endpoint' part for the in-process transport is
@@ -29,19 +23,19 @@ defined below.
Assigning a local address to a socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When assigning a local address to a 'socket' using _zmq_bind()_ with the
+When assigning a local address to a 'socket' using _xs_bind()_ with the
'inproc' transport, the 'endpoint' shall be interpreted as an arbitrary string
-identifying the 'name' to create. The 'name' must be unique within the 0MQ
+identifying the 'name' to create. The 'name' must be unique within the
'context' associated with the 'socket' and may be up to 256 characters in
length. No other restrictions are placed on the format of the 'name'.
Connecting a socket
~~~~~~~~~~~~~~~~~~~
-When connecting a 'socket' to a peer address using _zmq_connect()_ with the
+When connecting a 'socket' to a peer address using _xs_connect()_ with the
'inproc' transport, the 'endpoint' shall be interpreted as an arbitrary string
identifying the 'name' to connect to. The 'name' must have been previously
-created by assigning it to at least one 'socket' within the same 0MQ 'context'
+created by assigning it to at least one 'socket' within the same 'context'
as the 'socket' being connected.
@@ -55,35 +49,35 @@ EXAMPLES
.Assigning a local address to a socket
----
/* Assign the in-process name "#1" */
-rc = zmq_bind(socket, "inproc://#1");
+rc = xs_bind(socket, "inproc://#1");
assert (rc == 0);
/* Assign the in-process name "my-endpoint" */
-rc = zmq_bind(socket, "inproc://my-endpoint");
+rc = xs_bind(socket, "inproc://my-endpoint");
assert (rc == 0);
----
.Connecting a socket
----
/* Connect to the in-process name "#1" */
-rc = zmq_connect(socket, "inproc://#1");
+rc = xs_connect(socket, "inproc://#1");
assert (rc == 0);
/* Connect to the in-process name "my-endpoint" */
-rc = zmq_connect(socket, "inproc://my-endpoint");
+rc = xs_connect(socket, "inproc://my-endpoint");
assert (rc == 0);
----
SEE ALSO
--------
-linkzmq:zmq_bind[3]
-linkzmq:zmq_connect[3]
-linkzmq:zmq_ipc[7]
-linkzmq:zmq_tcp[7]
-linkzmq:zmq_pgm[7]
-linkzmq:zmq[7]
+linkxs:xs_bind[3]
+linkxs:xs_connect[3]
+linkxs:xs_ipc[7]
+linkxs:xs_tcp[7]
+linkxs:xs_pgm[7]
+linkxs:xs[7]
AUTHORS
-------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_ipc.txt b/doc/xs_ipc.txt
index 80109ee..f3c5147 100644
--- a/doc/zmq_ipc.txt
+++ b/doc/xs_ipc.txt
@@ -1,10 +1,10 @@
-zmq_ipc(7)
-==========
+xs_ipc(7)
+=========
NAME
----
-zmq_ipc - 0MQ local inter-process communication transport
+xs_ipc - local inter-process transport
SYNOPSIS
@@ -18,7 +18,7 @@ systems that provide UNIX domain sockets.
ADDRESSING
----------
-A 0MQ address string consists of two parts as follows:
+A Crossroads address string consists of two parts as follows:
'transport'`://`'endpoint'. The 'transport' part specifies the underlying
transport protocol to use, and for the inter-process transport shall be set to
`ipc`. The meaning of the 'endpoint' part for the inter-process transport is
@@ -27,7 +27,7 @@ defined below.
Assigning a local address to a socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When assigning a local address to a 'socket' using _zmq_bind()_ with the 'ipc'
+When assigning a local address to a 'socket' using _xs_bind()_ with the 'ipc'
transport, the 'endpoint' shall be interpreted as an arbitrary string
identifying the 'pathname' to create. The 'pathname' must be unique within the
operating system namespace used by the 'ipc' implementation, and must fulfill
@@ -36,11 +36,11 @@ any restrictions placed by the operating system on the format and length of a
Connecting a socket
~~~~~~~~~~~~~~~~~~~
-When connecting a 'socket' to a peer address using _zmq_connect()_ with the
+When connecting a 'socket' to a peer address using _xs_connect()_ with the
'ipc' transport, the 'endpoint' shall be interpreted as an arbitrary string
identifying the 'pathname' to connect to. The 'pathname' must have been
previously created within the operating system namespace by assigning it to a
-'socket' with _zmq_bind()_.
+'socket' with _xs_bind()_.
WIRE FORMAT
@@ -53,28 +53,28 @@ EXAMPLES
.Assigning a local address to a socket
----
/* Assign the pathname "/tmp/feeds/0" */
-rc = zmq_bind(socket, "ipc:///tmp/feeds/0");
+rc = xs_bind(socket, "ipc:///tmp/feeds/0");
assert (rc == 0);
----
.Connecting a socket
----
/* Connect to the pathname "/tmp/feeds/0" */
-rc = zmq_connect(socket, "ipc:///tmp/feeds/0");
+rc = xs_connect(socket, "ipc:///tmp/feeds/0");
assert (rc == 0);
----
SEE ALSO
--------
-linkzmq:zmq_bind[3]
-linkzmq:zmq_connect[3]
-linkzmq:zmq_inproc[7]
-linkzmq:zmq_tcp[7]
-linkzmq:zmq_pgm[7]
-linkzmq:zmq[7]
+linkxs:xs_bind[3]
+linkxs:xs_connect[3]
+linkxs:xs_inproc[7]
+linkxs:xs_tcp[7]
+linkxs:xs_pgm[7]
+linkxs:xs[7]
AUTHORS
-------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_msg_close.txt b/doc/xs_msg_close.txt
new file mode 100644
index 0000000..df20617
--- /dev/null
+++ b/doc/xs_msg_close.txt
@@ -0,0 +1,55 @@
+xs_msg_close(3)
+===============
+
+
+NAME
+----
+xs_msg_close - release Crossroads message
+
+
+SYNOPSIS
+--------
+*int xs_msg_close (xs_msg_t '*msg');*
+
+
+DESCRIPTION
+-----------
+The _xs_msg_close()_ function shall inform the Crossroads infrastructure that
+any resources associated with the message object referenced by 'msg' are no
+longer required and may be released. Actual release of resources associated with
+the message object shall be postponed by the library until all users of the
+message or underlying data buffer have indicated it is no longer required.
+
+Applications should ensure that _xs_msg_close()_ is called once a message is
+no longer required, otherwise memory leaks may occur.
+
+CAUTION: Never access 'xs_msg_t' members directly, instead always use the
+_xs_msg_ family of functions.
+
+
+RETURN VALUE
+------------
+The _xs_msg_close()_ function shall return zero if successful. Otherwise
+it shall return `-1` and set 'errno' to one of the values defined below.
+
+
+ERRORS
+------
+*EFAULT*::
+Invalid message.
+
+
+SEE ALSO
+--------
+linkxs:xs_msg_init[3]
+linkxs:xs_msg_init_size[3]
+linkxs:xs_msg_init_data[3]
+linkxs:xs_msg_data[3]
+linkxs:xs_msg_size[3]
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_msg_copy.txt b/doc/xs_msg_copy.txt
new file mode 100644
index 0000000..13a4298
--- /dev/null
+++ b/doc/xs_msg_copy.txt
@@ -0,0 +1,57 @@
+xs_msg_copy(3)
+==============
+
+
+NAME
+----
+xs_msg_copy - copy content of a message to another message
+
+
+SYNOPSIS
+--------
+*int xs_msg_copy (xs_msg_t '*dest', xs_msg_t '*src');*
+
+
+DESCRIPTION
+-----------
+The _xs_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.
+
+CAUTION: The implementation may choose not to physically copy the message
+content, rather to share the underlying buffer between 'src' and 'dest'. Avoid
+modifying message content after a message has been copied with
+_xs_msg_copy()_, doing so can result in undefined behaviour. If what you need
+is an actual hard copy, allocate a new message using _xs_msg_init_size()_ and
+copy the message content using _memcpy()_.
+
+CAUTION: Never access 'xs_msg_t' members directly, instead always use the
+_xs_msg_ family of functions.
+
+
+RETURN VALUE
+------------
+The _xs_msg_copy()_ function shall return zero if successful. Otherwise it
+shall return `-1` and set 'errno' to one of the values defined below.
+
+
+ERRORS
+------
+*EFAULT*::
+Invalid message.
+
+
+SEE ALSO
+--------
+linkxs:xs_msg_move[3]
+linkxs:xs_msg_init[3]
+linkxs:xs_msg_init_size[3]
+linkxs:xs_msg_init_data[3]
+linkxs:xs_msg_close[3]
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_msg_data.txt b/doc/xs_msg_data.txt
new file mode 100644
index 0000000..64b5295
--- /dev/null
+++ b/doc/xs_msg_data.txt
@@ -0,0 +1,48 @@
+xs_msg_data(3)
+==============
+
+
+NAME
+----
+xs_msg_data - retrieve pointer to message content
+
+
+SYNOPSIS
+--------
+*void *xs_msg_data (xs_msg_t '*msg');*
+
+
+DESCRIPTION
+-----------
+The _xs_msg_data()_ function shall return a pointer to the message content of
+the message object referenced by 'msg'.
+
+CAUTION: Never access 'xs_msg_t' members directly, instead always use the
+_xs_msg_ family of functions.
+
+
+RETURN VALUE
+------------
+Upon successful completion, _xs_msg_data()_ shall return a pointer to the
+message content.
+
+
+ERRORS
+------
+No errors are defined.
+
+
+SEE ALSO
+--------
+linkxs:xs_msg_size[3]
+linkxs:xs_msg_init[3]
+linkxs:xs_msg_init_size[3]
+linkxs:xs_msg_init_data[3]
+linkxs:xs_msg_close[3]
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_msg_init.txt b/doc/xs_msg_init.txt
new file mode 100644
index 0000000..8b33c8a
--- /dev/null
+++ b/doc/xs_msg_init.txt
@@ -0,0 +1,65 @@
+xs_msg_init(3)
+==============
+
+
+NAME
+----
+xs_msg_init - initialise empty Crossroads message
+
+
+SYNOPSIS
+--------
+*int xs_msg_init (xs_msg_t '*msg');*
+
+
+DESCRIPTION
+-----------
+The _xs_msg_init()_ function shall initialise the message object referenced by
+'msg' to represent an empty message. This function is most useful when called
+before receiving a message with _xs_recv()_.
+
+CAUTION: Never access 'xs_msg_t' members directly, instead always use the
+_xs_msg_ family of functions.
+
+CAUTION: The functions _xs_msg_init()_, _xs_msg_init_data()_ and
+_xs_msg_init_size()_ are mutually exclusive. Never initialize the same
+'xs_msg_t' twice.
+
+
+RETURN VALUE
+------------
+The _xs_msg_init()_ function shall return zero if successful. Otherwise it
+shall return `-1` and set 'errno' to one of the values defined below.
+
+
+ERRORS
+------
+No errors are defined.
+
+
+EXAMPLE
+-------
+.Receiving a message from a socket
+----
+xs_msg_t msg;
+rc = xs_msg_init (&msg);
+assert (rc == 0);
+rc = xs_recv (socket, &msg, 0);
+assert (rc == 0);
+----
+
+
+SEE ALSO
+--------
+linkxs:xs_msg_init_size[3]
+linkxs:xs_msg_init_data[3]
+linkxs:xs_msg_close[3]
+linkxs:xs_msg_data[3]
+linkxs:xs_msg_size[3]
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_msg_init_data.txt b/doc/xs_msg_init_data.txt
new file mode 100644
index 0000000..dbde0ea
--- /dev/null
+++ b/doc/xs_msg_init_data.txt
@@ -0,0 +1,85 @@
+xs_msg_init_data(3)
+===================
+
+
+NAME
+----
+xs_msg_init_data - initialise Crossroads message from a supplied buffer
+
+
+SYNOPSIS
+--------
+*typedef void (xs_free_fn) (void '*data', void '*hint');*
+
+*int xs_msg_init_data (xs_msg_t '*msg', void '*data', size_t 'size', xs_free_fn '*ffn', void '*hint');*
+
+
+DESCRIPTION
+-----------
+The _xs_msg_init_data()_ function shall initialise the message object
+referenced by 'msg' to represent the content referenced by the buffer located
+at address 'data', 'size' bytes long. No copy of 'data' shall be performed and
+the library shall take ownership of the supplied buffer.
+
+If provided, the deallocation function 'ffn' shall be called once the data
+buffer is no longer required by the library, with the 'data' and 'hint'
+arguments supplied to _xs_msg_init_data()_.
+
+CAUTION: Never access 'xs_msg_t' members directly, instead always use the
+_xs_msg_ family of functions.
+
+CAUTION: The deallocation function 'ffn' needs to be thread-safe, since it
+will be called from an arbitrary thread.
+
+CAUTION: The functions _xs_msg_init()_, _xs_msg_init_data()_ and
+_xs_msg_init_size()_ are mutually exclusive. Never initialize the same
+'xs_msg_t' twice.
+
+
+RETURN VALUE
+------------
+The _xs_msg_init_data()_ function shall return zero if successful. Otherwise
+it shall return `-1` and set 'errno' to one of the values defined below.
+
+
+ERRORS
+------
+*ENOMEM*::
+Insufficient storage space is available.
+
+
+
+EXAMPLE
+-------
+.Initialising a message from a supplied buffer
+----
+void my_free (void *data, void *hint)
+{
+ free (data);
+}
+
+ /* ... */
+
+void *data = malloc (6);
+assert (data);
+memcpy (data, "ABCDEF", 6);
+xs_msg_t msg;
+rc = xs_msg_init_data (&msg, data, 6, my_free, NULL);
+assert (rc == 0);
+----
+
+
+SEE ALSO
+--------
+linkxs:xs_msg_init_size[3]
+linkxs:xs_msg_init[3]
+linkxs:xs_msg_close[3]
+linkxs:xs_msg_data[3]
+linkxs:xs_msg_size[3]
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_msg_init_size.txt b/doc/xs_msg_init_size.txt
new file mode 100644
index 0000000..1e07c3c
--- /dev/null
+++ b/doc/xs_msg_init_size.txt
@@ -0,0 +1,58 @@
+xs_msg_init_size(3)
+===================
+
+
+NAME
+----
+xs_msg_init_size - initialise Crossroads message of a specified size
+
+
+SYNOPSIS
+--------
+*int xs_msg_init_size (xs_msg_t '*msg', size_t 'size');*
+
+
+DESCRIPTION
+-----------
+The _xs_msg_init_size()_ function shall allocate any resources required to
+store a message 'size' bytes long and initialise the message object referenced
+by 'msg' to represent the newly allocated message.
+
+The implementation shall choose whether to store message content on the stack
+(small messages) or on the heap (large messages). For performance reasons
+_xs_msg_init_size()_ shall not clear the message data.
+
+CAUTION: Never access 'xs_msg_t' members directly, instead always use the
+_xs_msg_ family of functions.
+
+CAUTION: The functions _xs_msg_init()_, _xs_msg_init_data()_ and
+_xs_msg_init_size()_ are mutually exclusive. Never initialize the same
+'xs_msg_t' twice.
+
+
+RETURN VALUE
+------------
+The _xs_msg_init_size()_ function shall return zero if successful. Otherwise
+it shall return `-1` and set 'errno' to one of the values defined below.
+
+
+ERRORS
+------
+*ENOMEM*::
+Insufficient storage space is available.
+
+
+SEE ALSO
+--------
+linkxs:xs_msg_init_data[3]
+linkxs:xs_msg_init[3]
+linkxs:xs_msg_close[3]
+linkxs:xs_msg_data[3]
+linkxs:xs_msg_size[3]
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_msg_move.txt b/doc/xs_msg_move.txt
new file mode 100644
index 0000000..d7930cf
--- /dev/null
+++ b/doc/xs_msg_move.txt
@@ -0,0 +1,52 @@
+xs_msg_move(3)
+==============
+
+
+NAME
+----
+xs_msg_move - move content of a message to another message
+
+
+SYNOPSIS
+--------
+*int xs_msg_move (xs_msg_t '*dest', xs_msg_t '*src');*
+
+
+DESCRIPTION
+-----------
+The _xs_msg_move()_ function shall move the content of the message object
+referenced by 'src' to the message object referenced by 'dest'. No actual
+copying of message content is performed, 'dest' is simply updated to reference
+the new content. 'src' becomes an empty message after calling _xs_msg_move()_.
+The original content of 'dest', if any, shall be released.
+
+CAUTION: Never access 'xs_msg_t' members directly, instead always use the
+_xs_msg_ family of functions.
+
+
+RETURN VALUE
+------------
+The _xs_msg_move()_ function shall return zero if successful. Otherwise it
+shall return `-1` and set 'errno' to one of the values defined below.
+
+
+ERRORS
+------
+*EFAULT*::
+Invalid message.
+
+
+SEE ALSO
+--------
+linkxs:xs_msg_copy[3]
+linkxs:xs_msg_init[3]
+linkxs:xs_msg_init_size[3]
+linkxs:xs_msg_init_data[3]
+linkxs:xs_msg_close[3]
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_msg_size.txt b/doc/xs_msg_size.txt
new file mode 100644
index 0000000..433d36e
--- /dev/null
+++ b/doc/xs_msg_size.txt
@@ -0,0 +1,48 @@
+xs_msg_size(3)
+==============
+
+
+NAME
+----
+xs_msg_size - retrieve message content size in bytes
+
+
+SYNOPSIS
+--------
+*size_t xs_msg_size (xs_msg_t '*msg');*
+
+
+DESCRIPTION
+-----------
+The _xs_msg_size()_ function shall return the size in bytes of the content of
+the message object referenced by 'msg'.
+
+CAUTION: Never access 'xs_msg_t' members directly, instead always use the
+_xs_msg_ family of functions.
+
+
+RETURN VALUE
+------------
+Upon successful completion, _xs_msg_size()_ shall return the size of the
+message content in bytes.
+
+
+ERRORS
+------
+No errors are defined.
+
+
+SEE ALSO
+--------
+linkxs:xs_msg_data[3]
+linkxs:xs_msg_init[3]
+linkxs:xs_msg_init_size[3]
+linkxs:xs_msg_init_data[3]
+linkxs:xs_msg_close[3]
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_pgm.txt b/doc/xs_pgm.txt
index d96d3ba..fcce19a 100644
--- a/doc/zmq_pgm.txt
+++ b/doc/xs_pgm.txt
@@ -1,10 +1,10 @@
-zmq_pgm(7)
-==========
+xs_pgm(7)
+=========
NAME
----
-zmq_pgm - 0MQ reliable multicast transport using PGM
+xs_pgm - reliable multicast transport via PGM protocol
SYNOPSIS
@@ -15,17 +15,17 @@ transport of data over IP networks.
DESCRIPTION
-----------
-0MQ implements two variants of PGM, the standard protocol where PGM datagrams
-are layered directly on top of IP datagrams as defined by RFC 3208 (the 'pgm'
-transport) and "Encapsulated PGM" where PGM datagrams are encapsulated inside
-UDP datagrams (the 'epgm' transport).
+Crossroads implement two variants of PGM, the standard protocol where PGM
+datagrams are layered directly on top of IP datagrams as defined by RFC 3208
+(the 'pgm' transport) and "Encapsulated PGM" where PGM datagrams are
+encapsulated inside UDP datagrams (the 'epgm' transport).
-The 'pgm' and 'epgm' transports can only be used with the 'ZMQ_PUB' and
-'ZMQ_SUB' socket types.
+The 'pgm' and 'epgm' transports can only be used with the 'XS_PUB' and
+'XS_SUB' socket types.
Further, PGM sockets are rate limited by default. For details, refer to the
-'ZMQ_RATE', and 'ZMQ_RECOVERY_IVL' options documented in
-linkzmq:zmq_setsockopt[3].
+'XS_RATE', and 'XS_RECOVERY_IVL' options documented in
+linkxs:xs_setsockopt[3].
CAUTION: The 'pgm' transport implementation requires access to raw IP sockets.
Additional privileges may be required on some operating systems for this
@@ -36,7 +36,7 @@ not require any special privileges.
ADDRESSING
----------
-A 0MQ address string consists of two parts as follows:
+A Crossroads address string consists of two parts as follows:
'transport'`://`'endpoint'. The 'transport' part specifies the underlying
transport protocol to use. For the standard PGM protocol, 'transport' shall be
set to `pgm`. For the "Encapsulated PGM" protocol 'transport' shall be set to
@@ -46,7 +46,7 @@ transport is defined below.
Connecting a socket
~~~~~~~~~~~~~~~~~~~
-When connecting a socket to a peer address using _zmq_connect()_ with the 'pgm'
+When connecting a socket to a peer address using _xs_connect()_ with the 'pgm'
or 'epgm' transport, the 'endpoint' shall be interpreted as an 'interface'
followed by a semicolon, followed by a 'multicast address', followed by a colon
and a port number.
@@ -68,17 +68,17 @@ representation.
WIRE FORMAT
-----------
-Consecutive PGM datagrams are interpreted by 0MQ as a single continuous stream
-of data where 0MQ messages are not necessarily aligned with PGM datagram
-boundaries and a single 0MQ message may span several PGM datagrams. This stream
-of data consists of 0MQ messages encapsulated in 'frames' as described in
-linkzmq:zmq_tcp[7].
+Consecutive PGM datagrams are interpreted by the library as a single continuous
+stream of data where messages are not necessarily aligned with PGM datagram
+boundaries and a single message may span several PGM datagrams. This stream
+of data consists of Crossroads messages encapsulated in 'frames' as described in
+linkxs:xs_tcp[7].
PGM datagram payload
~~~~~~~~~~~~~~~~~~~~
The following ABNF grammar represents the payload of a single PGM datagram as
-used by 0MQ:
+used by Crossroads:
....
datagram = (offset data)
@@ -105,8 +105,8 @@ The following diagram illustrates the layout of a single PGM datagram payload:
+------------------+----------------------+
....
-The following diagram further illustrates how three example 0MQ frames are laid
-out in consecutive PGM datagram payloads:
+The following diagram further illustrates how three example Crossroads frames
+are laid out in consecutive PGM datagram payloads:
....
First datagram payload
@@ -136,26 +136,26 @@ EXAMPLE
/* Connecting to the multicast address 239.192.1.1, port 5555, */
/* using the first Ethernet network interface on Linux */
/* and the Encapsulated PGM protocol */
-rc = zmq_connect(socket, "epgm://eth0;239.192.1.1:5555");
+rc = xs_connect(socket, "epgm://eth0;239.192.1.1:5555");
assert (rc == 0);
/* Connecting to the multicast address 239.192.1.1, port 5555, */
/* using the network interface with the address 192.168.1.1 */
/* and the standard PGM protocol */
-rc = zmq_connect(socket, "pgm://192.168.1.1;239.192.1.1:5555");
+rc = xs_connect(socket, "pgm://192.168.1.1;239.192.1.1:5555");
assert (rc == 0);
----
SEE ALSO
--------
-linkzmq:zmq_connect[3]
-linkzmq:zmq_setsockopt[3]
-linkzmq:zmq_tcp[7]
-linkzmq:zmq_ipc[7]
-linkzmq:zmq_inproc[7]
-linkzmq:zmq[7]
+linkxs:xs_connect[3]
+linkxs:xs_setsockopt[3]
+linkxs:xs_tcp[7]
+linkxs:xs_ipc[7]
+linkxs:xs_inproc[7]
+linkxs:xs[7]
AUTHORS
-------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_poll.txt b/doc/xs_poll.txt
new file mode 100644
index 0000000..37f7dc5
--- /dev/null
+++ b/doc/xs_poll.txt
@@ -0,0 +1,129 @@
+xs_poll(3)
+==========
+
+
+NAME
+----
+xs_poll - input/output multiplexing
+
+
+SYNOPSIS
+--------
+
+*int xs_poll (xs_pollitem_t '*items', int 'nitems', long 'timeout');*
+
+
+DESCRIPTION
+-----------
+The _xs_poll()_ function provides a mechanism for applications to multiplex
+input/output events in a level-triggered fashion over a set of sockets. Each
+member of the array pointed to by the 'items' argument is a *xs_pollitem_t*
+structure. The 'nitems' argument specifies the number of items in the 'items'
+array. The *xs_pollitem_t* structure is defined as follows:
+
+["literal", subs="quotes"]
+typedef struct
+{
+ void '*socket';
+ int 'fd';
+ short 'events';
+ short 'revents';
+} xs_pollitem_t;
+
+For each *xs_pollitem_t* item, _xs_poll()_ shall examine either the Crossroads
+socket referenced by 'socket' *or* the standard socket specified by the file
+descriptor 'fd', for the event(s) specified in 'events'. If both 'socket' and
+'fd' are set in a single *xs_pollitem_t*, the Crossroads socket referenced by
+'socket' shall take precedence and the value of 'fd' shall be ignored.
+
+For each *xs_pollitem_t* item, _xs_poll()_ shall first clear the 'revents'
+member, and then indicate any requested events that have occurred by setting the
+bit corresponding to the event condition in the 'revents' member.
+
+If none of the requested events have occurred on any *xs_pollitem_t* item,
+_xs_poll()_ shall wait 'timeout' milliseconds for an event to occur on
+any of the requested items. If the value of 'timeout' is `0`, _xs_poll()_
+shall return immediately. If the value of 'timeout' is `-1`, _xs_poll()_ shall
+block indefinitely until a requested event has occurred on at least one
+*xs_pollitem_t*.
+
+The 'events' and 'revents' members of *xs_pollitem_t* are bit masks constructed
+by OR'ing a combination of the following event flags:
+
+*XS_POLLIN*::
+For Crossroads sockets, at least one message may be received from the 'socket'
+without blocking. For standard sockets this is equivalent to the 'POLLIN' flag
+of the _poll()_ system call and generally means that at least one byte of data
+may be read from 'fd' without blocking.
+
+*XS_POLLOUT*::
+For Crossroads sockets, at least one message may be sent to the 'socket' without
+blocking. For standard sockets this is equivalent to the 'POLLOUT' flag of the
+_poll()_ system call and generally means that at least one byte of data may be
+written to 'fd' without blocking.
+
+*XS_POLLERR*::
+For standard sockets, this flag is passed through _xs_poll()_ to the
+underlying _poll()_ system call and generally means that some sort of error
+condition is present on the socket specified by 'fd'. For Crossroads sockets
+this flag has no effect if set in 'events', and shall never be returned in
+'revents' by _xs_poll()_.
+
+NOTE: The _xs_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.
+
+
+RETURN VALUE
+------------
+Upon successful completion, the _xs_poll()_ function shall return the number
+of *xs_pollitem_t* structures with events signaled in 'revents' or `0` if no
+events have been signaled. Upon failure, _xs_poll()_ shall return `-1` and set
+'errno' to one of the values defined below.
+
+
+ERRORS
+------
+*ETERM*::
+At least one of the members of the 'items' array refers to a 'socket' whose
+associated 'context' was terminated.
+*EFAULT*::
+The provided 'items' was not valid (NULL).
+*EINTR*::
+The operation was interrupted by delivery of a signal before any events were
+available.
+
+
+EXAMPLE
+-------
+.Polling indefinitely for input events on both a Crossroads socket and a standard socket.
+----
+xs_pollitem_t items [2];
+/* First item refers to Crossroads socket 'socket' */
+items[0].socket = socket;
+items[0].events = XS_POLLIN;
+/* Second item refers to standard socket 'fd' */
+items[1].socket = NULL;
+items[1].fd = fd;
+items[1].events = XS_POLLIN;
+/* Poll for events indefinitely */
+int rc = xs_poll (items, 2, -1);
+assert (rc >= 0);
+/* Returned events will be stored in items[].revents */
+----
+
+
+SEE ALSO
+--------
+linkxs:xs_socket[3]
+linkxs:xs_send[3]
+linkxs:xs_recv[3]
+linkxs:xs[7]
+
+Your operating system documentation for the _poll()_ system call.
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_recv.txt b/doc/xs_recv.txt
index 3a5be9c..26a6c54 100644
--- a/doc/zmq_recv.txt
+++ b/doc/xs_recv.txt
@@ -1,47 +1,47 @@
-zmq_recv(3)
-===========
+xs_recv(3)
+==========
NAME
----
-zmq_recv - receive a message part from a socket
+xs_recv - receive a message part from a socket
SYNOPSIS
--------
-*int zmq_recv (void '*socket', void '*buf', size_t 'len', int 'flags');*
+*int xs_recv (void '*socket', void '*buf', size_t 'len', int 'flags');*
DESCRIPTION
-----------
-The _zmq_recv()_ function shall receive a message from the socket referenced
+The _xs_recv()_ function shall receive a message from the socket referenced
by the 'socket' argument and store it in the buffer referenced by the 'buf'
argument. Any bytes exceeding the length specified by the 'len' argument shall
be truncated. If there are no messages available on the specified 'socket'
-the _zmq_recv()_ function shall block until the request can be satisfied.
+the _xs_recv()_ function shall block until the request can be satisfied.
The 'flags' argument is a combination of the flags defined below:
-*ZMQ_DONTWAIT*::
+*XS_DONTWAIT*::
Specifies that the operation should be performed in non-blocking mode. If there
-are no messages available on the specified 'socket', the _zmq_recv()_
+are no messages available on the specified 'socket', the _xs_recv()_
function shall fail with 'errno' set to EAGAIN.
Multi-part messages
~~~~~~~~~~~~~~~~~~~
-A 0MQ message is composed of 1 or more message parts. Each message
-part is an independent 'zmq_msg_t' in its own right. 0MQ ensures atomic
+A Crossroads message is composed of 1 or more message parts. Each message
+part is an independent 'xs_msg_t' in its own right. Crossroads ensure atomic
delivery of messages; peers shall receive either all _message parts_ of a
message or none at all. The total number of message parts is unlimited except
by available memory.
-An application that processes multipart messages must use the _ZMQ_RCVMORE_
-linkzmq:zmq_getsockopt[3] option after calling _zmq_recv()_ to determine if
+An application that processes multipart messages must use the _XS_RCVMORE_
+linkxs:xs_getsockopt[3] option after calling _xs_recv()_ to determine if
there are further parts to receive.
RETURN VALUE
------------
-The _zmq_recv()_ function shall return number of bytes in the message
+The _xs_recv()_ function shall return number of bytes in the message
if successful. Note that the value can exceed the value of the 'len' parameter
in case the message was truncated. If not successful the function shall return
`-1` and set 'errno' to one of the values defined below.
@@ -52,14 +52,14 @@ ERRORS
*EAGAIN*::
Non-blocking mode was requested and no messages are available at the moment.
*ENOTSUP*::
-The _zmq_recv()_ operation is not supported by this socket type.
+The _xs_recv()_ operation is not supported by this socket type.
*EFSM*::
-The _zmq_recv()_ operation cannot be performed on this socket at the moment
+The _xs_recv()_ operation cannot be performed on this socket at the moment
due to the socket not being in the appropriate state. This error may occur with
-socket types that switch between several states, such as ZMQ_REP. See the
-_messaging patterns_ section of linkzmq:zmq_socket[3] for more information.
+socket types that switch between several states, such as XS_REP. See the
+_messaging patterns_ section of linkxs:xs_socket[3] for more information.
*ETERM*::
-The 0MQ 'context' associated with the specified 'socket' was terminated.
+The 'context' associated with the specified 'socket' was terminated.
*ENOTSOCK*::
The provided 'socket' was invalid.
*EINTR*::
@@ -72,19 +72,19 @@ EXAMPLE
.Receiving a message from a socket
----
char buf [256];
-nbytes = zmq_recv (socket, buf, 256, 0);
+nbytes = xs_recv (socket, buf, 256, 0);
assert (nbytes != -1);
----
SEE ALSO
--------
-linkzmq:zmq_recvmsg[3]
-linkzmq:zmq_send[3]
-linkzmq:zmq_sendmsg[3]
-linkzmq:zmq_getsockopt[3]
-linkzmq:zmq_socket[7]
-linkzmq:zmq[7]
+linkxs:xs_recvmsg[3]
+linkxs:xs_send[3]
+linkxs:xs_sendmsg[3]
+linkxs:xs_getsockopt[3]
+linkxs:xs_socket[7]
+linkxs:xs[7]
AUTHORS
diff --git a/doc/zmq_recvmsg.txt b/doc/xs_recvmsg.txt
index b7575a0..735fed0 100644
--- a/doc/zmq_recvmsg.txt
+++ b/doc/xs_recvmsg.txt
@@ -1,48 +1,48 @@
-zmq_recvmsg(3)
-==============
+xs_recvmsg(3)
+=============
NAME
----
-zmq_recvmsg - receive a message part from a socket
+xs_recvmsg - receive a message part from a socket
SYNOPSIS
--------
-*int zmq_recvmsg (void '*socket', zmq_msg_t '*msg', int 'flags');*
+*int xs_recvmsg (void '*socket', xs_msg_t '*msg', int 'flags');*
DESCRIPTION
-----------
-The _zmq_recvmsg()_ function shall receive a message part from the socket
+The _xs_recvmsg()_ function shall receive a message part from the socket
referenced by the 'socket' argument and store it in the message referenced by
the 'msg' argument. Any content previously stored in 'msg' shall be properly
deallocated. If there are no message parts available on the specified 'socket'
-the _zmq_recvmsg()_ function shall block until the request can be satisfied.
+the _xs_recvmsg()_ function shall block until the request can be satisfied.
The 'flags' argument is a combination of the flags defined below:
-*ZMQ_DONTWAIT*::
+*XS_DONTWAIT*::
Specifies that the operation should be performed in non-blocking mode. If there
-are no messages available on the specified 'socket', the _zmq_recvmsg()_
+are no messages available on the specified 'socket', the _xs_recvmsg()_
function shall fail with 'errno' set to EAGAIN.
Multi-part messages
~~~~~~~~~~~~~~~~~~~
-A 0MQ message is composed of 1 or more message parts. Each message
-part is an independent 'zmq_msg_t' in its own right. 0MQ ensures atomic
+A Crossroads message is composed of 1 or more message parts. Each message
+part is an independent 'xs_msg_t' in its own right. Crossroads ensure atomic
delivery of messages; peers shall receive either all _message parts_ of a
message or none at all. The total number of message parts is unlimited except
by available memory.
-An application that processes multipart messages must use the _ZMQ_RCVMORE_
-linkzmq:zmq_getsockopt[3] option after calling _zmq_recvmsg()_ to determine if
+An application that processes multipart messages must use the _XS_RCVMORE_
+linkxs:xs_getsockopt[3] option after calling _xs_recvmsg()_ to determine if
there are further parts to receive.
RETURN VALUE
------------
-The _zmq_recvmsg()_ function shall return number of bytes in the message
+The _xs_recvmsg()_ function shall return number of bytes in the message
if successful. Otherwise it shall return `-1` and set 'errno' to one of the
values defined below.
@@ -52,14 +52,14 @@ ERRORS
*EAGAIN*::
Non-blocking mode was requested and no messages are available at the moment.
*ENOTSUP*::
-The _zmq_recvmsg()_ operation is not supported by this socket type.
+The _xs_recvmsg()_ operation is not supported by this socket type.
*EFSM*::
-The _zmq_recvmsg()_ operation cannot be performed on this socket at the moment
+The _xs_recvmsg()_ operation cannot be performed on this socket at the moment
due to the socket not being in the appropriate state. This error may occur with
-socket types that switch between several states, such as ZMQ_REP. See the
-_messaging patterns_ section of linkzmq:zmq_socket[3] for more information.
+socket types that switch between several states, such as XS_REP. See the
+_messaging patterns_ section of linkxs:xs_socket[3] for more information.
*ETERM*::
-The 0MQ 'context' associated with the specified 'socket' was terminated.
+The 'context' associated with the specified 'socket' was terminated.
*ENOTSOCK*::
The provided 'socket' was invalid.
*EINTR*::
@@ -73,15 +73,15 @@ EXAMPLE
-------
.Receiving a message from a socket
----
-/* Create an empty 0MQ message */
-zmq_msg_t msg;
-int rc = zmq_msg_init (&msg);
+/* Create an empty message */
+xs_msg_t msg;
+int rc = xs_msg_init (&msg);
assert (rc == 0);
/* Block until a message is available to be received from socket */
-rc = zmq_recvmsg (socket, &msg, 0);
+rc = xs_recvmsg (socket, &msg, 0);
assert (rc != -1);
/* Release message */
-zmq_msg_close (&msg);
+xs_msg_close (&msg);
----
.Receiving a multi-part message
@@ -89,29 +89,29 @@ zmq_msg_close (&msg);
int64_t more;
size_t more_size = sizeof more;
do {
- /* Create an empty 0MQ message to hold the message part */
- zmq_msg_t part;
- int rc = zmq_msg_init (&part);
+ /* Create an empty message to hold the message part */
+ xs_msg_t part;
+ int rc = xs_msg_init (&part);
assert (rc == 0);
/* Block until a message is available to be received from socket */
- rc = zmq_recvmsg (socket, &part, 0);
+ rc = xs_recvmsg (socket, &part, 0);
assert (rc != -1);
/* Determine if more message parts are to follow */
- rc = zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size);
+ rc = xs_getsockopt (socket, XS_RCVMORE, &more, &more_size);
assert (rc == 0);
- zmq_msg_close (&part);
+ xs_msg_close (&part);
} while (more);
----
SEE ALSO
--------
-linkzmq:zmq_recv[3]
-linkzmq:zmq_send[3]
-linkzmq:zmq_sendmsg[3]
-linkzmq:zmq_getsockopt[3]
-linkzmq:zmq_socket[7]
-linkzmq:zmq[7]
+linkxs:xs_recv[3]
+linkxs:xs_send[3]
+linkxs:xs_sendmsg[3]
+linkxs:xs_getsockopt[3]
+linkxs:xs_socket[7]
+linkxs:xs[7]
AUTHORS
diff --git a/doc/zmq_send.txt b/doc/xs_send.txt
index 58c761f..c5b7d74 100644
--- a/doc/zmq_send.txt
+++ b/doc/xs_send.txt
@@ -1,53 +1,53 @@
-zmq_send(3)
-===========
+xs_send(3)
+==========
NAME
----
-zmq_send - send a message part on a socket
+xs_send - send a message part on a socket
SYNOPSIS
--------
-*int zmq_send (void '*socket', void '*buf', size_t 'len', int 'flags');*
+*int xs_send (void '*socket', void '*buf', size_t 'len', int 'flags');*
DESCRIPTION
-----------
-The _zmq_send()_ function shall queue a message created from the buffer
+The _xs_send()_ function shall queue a message created from the buffer
referenced by the 'buf' and 'len' arguments. The 'flags' argument is
a combination of the flags defined below:
-*ZMQ_DONTWAIT*::
+*XS_DONTWAIT*::
Specifies that the operation should be performed in non-blocking mode. If the
-message cannot be queued on the 'socket', the _zmq_send()_ function shall
+message cannot be queued on the 'socket', the _xs_send()_ function shall
fail with 'errno' set to EAGAIN.
-*ZMQ_SNDMORE*::
+*XS_SNDMORE*::
Specifies that the message being sent is a multi-part message, and that further
message parts are to follow. Refer to the section regarding multi-part messages
below for a detailed description.
-NOTE: A successful invocation of _zmq_send()_ does not indicate that the
+NOTE: A successful invocation of _xs_send()_ does not indicate that the
message has been transmitted to the network, only that it has been queued on
-the 'socket' and 0MQ has assumed responsibility for the message.
+the 'socket' and Crossroads have assumed responsibility for the message.
Multi-part messages
~~~~~~~~~~~~~~~~~~~
-A 0MQ message is composed of 1 or more message parts. Each message
-part is an independent 'zmq_msg_t' in its own right. 0MQ ensures atomic
+A Crossroads message is composed of 1 or more message parts. Each message
+part is an independent 'xs_msg_t' in its own right. Crossroads ensure atomic
delivery of messages; peers shall receive either all _message parts_ of a
message or none at all. The total number of message parts is unlimited except
by available memory.
-An application that sends multipart messages must use the _ZMQ_SNDMORE_ flag
+An application that sends multipart messages must use the _XS_SNDMORE_ flag
when sending each data part except the final one.
RETURN VALUE
------------
-The _zmq_send()_ function shall return number of bytes in the message
+The _xs_send()_ function shall return number of bytes in the message
if successful. Otherwise it shall return `-1` and set 'errno' to one of the
values defined below.
@@ -57,14 +57,14 @@ ERRORS
*EAGAIN*::
Non-blocking mode was requested and the message cannot be sent at the moment.
*ENOTSUP*::
-The _zmq_send()_ operation is not supported by this socket type.
+The _xs_send()_ operation is not supported by this socket type.
*EFSM*::
-The _zmq_send()_ operation cannot be performed on this socket at the moment
+The _xs_send()_ operation cannot be performed on this socket at the moment
due to the socket not being in the appropriate state. This error may occur with
-socket types that switch between several states, such as ZMQ_REP. See the
-_messaging patterns_ section of linkzmq:zmq_socket[3] for more information.
+socket types that switch between several states, such as XS_REP. See the
+_messaging patterns_ section of linkxs:xs_socket[3] for more information.
*ETERM*::
-The 0MQ 'context' associated with the specified 'socket' was terminated.
+The 'context' associated with the specified 'socket' was terminated.
*ENOTSOCK*::
The provided 'socket' was invalid.
*EINTR*::
@@ -72,7 +72,7 @@ The operation was interrupted by delivery of a signal before the message was
sent.
*ECANTROUTE*::
Message cannot be routed to the destination specified as the peer is either
-dead or disconnected. This error makes sense only with ZMQ_ROUTER socket.
+dead or disconnected. This error makes sense only with XS_ROUTER socket.
EXAMPLE
@@ -80,22 +80,22 @@ EXAMPLE
.Sending a multi-part message
----
/* Send a multi-part message consisting of three parts to socket */
-rc = zmq_send (socket, "ABC", 3, ZMQ_SNDMORE);
+rc = xs_send (socket, "ABC", 3, XS_SNDMORE);
assert (rc == 3);
-rc = zmq_send (socket, "DEFGH", 5, ZMQ_SNDMORE);
+rc = xs_send (socket, "DEFGH", 5, XS_SNDMORE);
assert (rc == 5);
/* Final part; no more parts to follow */
-rc = zmq_send (socket, "JK", 2, 0);
+rc = xs_send (socket, "JK", 2, 0);
assert (rc == 2);
----
SEE ALSO
--------
-linkzmq:zmq_sendmsg[3]
-linkzmq:zmq_recv[3]
-linkzmq:zmq_recvmsg[3]
-linkzmq:zmq_socket[7]
-linkzmq:zmq[7]
+linkxs:xs_sendmsg[3]
+linkxs:xs_recv[3]
+linkxs:xs_recvmsg[3]
+linkxs:xs_socket[7]
+linkxs:xs[7]
AUTHORS
diff --git a/doc/zmq_sendmsg.txt b/doc/xs_sendmsg.txt
index 3c09bec..bf94ecd 100644
--- a/doc/zmq_sendmsg.txt
+++ b/doc/xs_sendmsg.txt
@@ -1,56 +1,56 @@
-zmq_sendmsg(3)
-==============
+xs_sendmsg(3)
+=============
NAME
----
-zmq_sendmsg - send a message part on a socket
+xs_sendmsg - send a message part on a socket
SYNOPSIS
--------
-*int zmq_sendmsg (void '*socket', zmq_msg_t '*msg', int 'flags');*
+*int xs_sendmsg (void '*socket', xs_msg_t '*msg', int 'flags');*
DESCRIPTION
-----------
-The _zmq_sendmsg()_ function shall queue the message referenced by the 'msg'
+The _xs_sendmsg()_ function shall queue the message referenced by the 'msg'
argument to be sent to the socket referenced by the 'socket' argument. The
'flags' argument is a combination of the flags defined below:
-*ZMQ_DONTWAIT*::
+*XS_DONTWAIT*::
Specifies that the operation should be performed in non-blocking mode. If the
-message cannot be queued on the 'socket', the _zmq_sendmsg()_ function shall
+message cannot be queued on the 'socket', the _xs_sendmsg()_ function shall
fail with 'errno' set to EAGAIN.
-*ZMQ_SNDMORE*::
+*XS_SNDMORE*::
Specifies that the message being sent is a multi-part message, and that further
message parts are to follow. Refer to the section regarding multi-part messages
below for a detailed description.
-The _zmq_msg_t_ structure passed to _zmq_sendmsg()_ is nullified during the
+The _xs_msg_t_ structure passed to _xs_sendmsg()_ is nullified during the
call. If you want to send the same message to multiple sockets you have to copy
-it using (e.g. using _zmq_msg_copy()_).
+it using (e.g. using _xs_msg_copy()_).
-NOTE: A successful invocation of _zmq_sendmsg()_ does not indicate that the
+NOTE: A successful invocation of _xs_sendmsg()_ does not indicate that the
message has been transmitted to the network, only that it has been queued on
-the 'socket' and 0MQ has assumed responsibility for the message.
+the 'socket' and Crossroads have assumed responsibility for the message.
Multi-part messages
~~~~~~~~~~~~~~~~~~~
-A 0MQ message is composed of 1 or more message parts. Each message
-part is an independent 'zmq_msg_t' in its own right. 0MQ ensures atomic
+A Crossroads message is composed of 1 or more message parts. Each message
+part is an independent 'xs_msg_t' in its own right. Crossroads ensure atomic
delivery of messages; peers shall receive either all _message parts_ of a
message or none at all. The total number of message parts is unlimited except
by available memory.
-An application that sends multipart messages must use the _ZMQ_SNDMORE_ flag
+An application that sends multipart messages must use the _XS_SNDMORE_ flag
when sending each data part except the final one.
RETURN VALUE
------------
-The _zmq_sendmsg()_ function shall return number of bytes in the message
+The _xs_sendmsg()_ function shall return number of bytes in the message
if successful. Otherwise it shall return `-1` and set 'errno' to one of the
values defined below.
@@ -60,14 +60,14 @@ ERRORS
*EAGAIN*::
Non-blocking mode was requested and the message cannot be sent at the moment.
*ENOTSUP*::
-The _zmq_sendmsg()_ operation is not supported by this socket type.
+The _xs_sendmsg()_ operation is not supported by this socket type.
*EFSM*::
-The _zmq_sendmsg()_ operation cannot be performed on this socket at the moment
+The _xs_sendmsg()_ operation cannot be performed on this socket at the moment
due to the socket not being in the appropriate state. This error may occur with
-socket types that switch between several states, such as ZMQ_REP. See the
-_messaging patterns_ section of linkzmq:zmq_socket[3] for more information.
+socket types that switch between several states, such as XS_REP. See the
+_messaging patterns_ section of linkxs:xs_socket[3] for more information.
*ETERM*::
-The 0MQ 'context' associated with the specified 'socket' was terminated.
+The 'context' associated with the specified 'socket' was terminated.
*ENOTSOCK*::
The provided 'socket' was invalid.
*EINTR*::
@@ -77,7 +77,7 @@ sent.
Invalid message.
*ECANTROUTE*::
Message cannot be routed to the destination specified as the peer is either
-dead or disconnected. This error makes sense only with ZMQ_ROUTER socket.
+dead or disconnected. This error makes sense only with XS_ROUTER socket.
EXAMPLE
@@ -85,33 +85,33 @@ EXAMPLE
.Filling in a message and sending it to a socket
----
/* Create a new message, allocating 6 bytes for message content */
-zmq_msg_t msg;
-int rc = zmq_msg_init_size (&msg, 6);
+xs_msg_t msg;
+int rc = xs_msg_init_size (&msg, 6);
assert (rc == 0);
/* Fill in message content with 'AAAAAA' */
-memset (zmq_msg_data (&msg), 'A', 6);
+memset (xs_msg_data (&msg), 'A', 6);
/* Send the message to the socket */
-rc = zmq_sendmsg (socket, &msg, 0);
+rc = xs_sendmsg (socket, &msg, 0);
assert (rc == 6);
----
.Sending a multi-part message
----
/* Send a multi-part message consisting of three parts to socket */
-rc = zmq_sendmsg (socket, &part1, ZMQ_SNDMORE);
-rc = zmq_sendmsg (socket, &part2, ZMQ_SNDMORE);
+rc = xs_sendmsg (socket, &part1, XS_SNDMORE);
+rc = xs_sendmsg (socket, &part2, XS_SNDMORE);
/* Final part; no more parts to follow */
-rc = zmq_sendmsg (socket, &part3, 0);
+rc = xs_sendmsg (socket, &part3, 0);
----
SEE ALSO
--------
-linkzmq:zmq_recv[3]
-linkzmq:zmq_recv[3]
-linkzmq:zmq_recvmsg[3]
-linkzmq:zmq_socket[7]
-linkzmq:zmq[7]
+linkxs:xs_recv[3]
+linkxs:xs_recv[3]
+linkxs:xs_recvmsg[3]
+linkxs:xs_socket[7]
+linkxs:xs[7]
AUTHORS
diff --git a/doc/zmq_setsockopt.txt b/doc/xs_setsockopt.txt
index ca8ced0..7cb91d2 100644
--- a/doc/zmq_setsockopt.txt
+++ b/doc/xs_setsockopt.txt
@@ -1,41 +1,41 @@
-zmq_setsockopt(3)
-=================
+xs_setsockopt(3)
+================
NAME
----
-zmq_setsockopt - set 0MQ socket options
+xs_setsockopt - set Crossroads socket options
SYNOPSIS
--------
-*int zmq_setsockopt (void '*socket', int 'option_name', const void '*option_value', size_t 'option_len');*
+*int xs_setsockopt (void '*socket', int 'option_name', const void '*option_value', size_t 'option_len');*
-Caution: All options, with the exception of ZMQ_SUBSCRIBE, ZMQ_UNSUBSCRIBE and
-ZMQ_LINGER, only take effect for subsequent socket bind/connects.
+Caution: All options, with the exception of XS_SUBSCRIBE, XS_UNSUBSCRIBE and
+XS_LINGER, only take effect for subsequent socket bind/connects.
DESCRIPTION
-----------
-The _zmq_setsockopt()_ function shall set the option specified by the
+The _xs_setsockopt()_ function shall set the option specified by the
'option_name' argument to the value pointed to by the 'option_value' argument
-for the 0MQ socket pointed to by the 'socket' argument. The 'option_len'
+for the Crossroads socket pointed to by the 'socket' argument. The 'option_len'
argument is the size of the option value in bytes.
-The following socket options can be set with the _zmq_setsockopt()_ function:
+The following socket options can be set with the _xs_setsockopt()_ function:
-ZMQ_SNDHWM: Set high water mark for outbound messages
+XS_SNDHWM: Set high water mark for outbound messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_SNDHWM' option shall set the high water mark for outbound messages on
+The 'XS_SNDHWM' option shall set the high water mark for outbound messages on
the specified 'socket'. The high water mark is a hard limit on the maximum
-number of outstanding messages 0MQ shall queue in memory for any single peer
-that the specified 'socket' is communicating with.
+number of outstanding messages the library shall queue in memory for any single
+peer that the specified 'socket' is communicating with.
If this limit has been reached the socket shall enter an exceptional state and
-depending on the socket type, 0MQ shall take appropriate action such as
+depending on the socket type, the library shall take appropriate action such as
blocking or dropping sent messages. Refer to the individual socket descriptions
-in linkzmq:zmq_socket[3] for details on the exact action taken for each socket
+in linkxs:xs_socket[3] for details on the exact action taken for each socket
type.
[horizontal]
@@ -45,17 +45,17 @@ Default value:: 1000
Applicable socket types:: all
-ZMQ_RCVHWM: Set high water mark for inbound messages
+XS_RCVHWM: Set high water mark for inbound messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RCVHWM' option shall set the high water mark for inbound messages on
+The 'XS_RCVHWM' option shall set the high water mark for inbound messages on
the specified 'socket'. The high water mark is a hard limit on the maximum
-number of outstanding messages 0MQ shall queue in memory for any single peer
-that the specified 'socket' is communicating with.
+number of outstanding messages the libray shall queue in memory for any single
+peer that the specified 'socket' is communicating with.
If this limit has been reached the socket shall enter an exceptional state and
-depending on the socket type, 0MQ shall take appropriate action such as
+depending on the socket type, the library shall take appropriate action such as
blocking or dropping sent messages. Refer to the individual socket descriptions
-in linkzmq:zmq_socket[3] for details on the exact action taken for each socket
+in linkxs:xs_socket[3] for details on the exact action taken for each socket
type.
[horizontal]
@@ -65,20 +65,20 @@ Default value:: 1000
Applicable socket types:: all
-ZMQ_AFFINITY: Set I/O thread affinity
+XS_AFFINITY: Set I/O thread affinity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_AFFINITY' option shall set the I/O thread affinity for newly created
+The 'XS_AFFINITY' option shall set the I/O thread affinity for newly created
connections on the specified 'socket'.
-Affinity determines which threads from the 0MQ I/O thread pool associated with
-the socket's _context_ shall handle newly created connections. A value of zero
-specifies no affinity, meaning that work shall be distributed fairly among all
-0MQ I/O threads in the thread pool. For non-zero values, the lowest bit
-corresponds to thread 1, second lowest bit to thread 2 and so on. For example,
-a value of 3 specifies that subsequent connections on 'socket' shall be handled
-exclusively by I/O threads 1 and 2.
+Affinity determines which threads from the Crossroads I/O thread pool associated
+with the socket's _context_ shall handle newly created connections. A value of
+zero specifies no affinity, meaning that work shall be distributed fairly among
+all Crossroads I/O threads in the thread pool. For non-zero values, the lowest
+bit corresponds to thread 1, second lowest bit to thread 2 and so on. For
+example, a value of 3 specifies that subsequent connections on 'socket' shall be
+handled exclusively by I/O threads 1 and 2.
-See also linkzmq:zmq_init[3] for details on allocating the number of I/O
+See also linkxs:xs_init[3] for details on allocating the number of I/O
threads for a specific _context_.
[horizontal]
@@ -88,49 +88,49 @@ Default value:: 0
Applicable socket types:: N/A
-ZMQ_SUBSCRIBE: Establish message filter
+XS_SUBSCRIBE: Establish message filter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_SUBSCRIBE' option shall establish a new message filter on a 'ZMQ_SUB'
-socket. Newly created 'ZMQ_SUB' sockets shall filter out all incoming messages,
+The 'XS_SUBSCRIBE' option shall establish a new message filter on a 'XS_SUB'
+socket. Newly created 'XS_SUB' sockets shall filter out all incoming messages,
therefore you should call this option to establish an initial message filter.
An empty 'option_value' of length zero shall subscribe to all incoming
messages. A non-empty 'option_value' shall subscribe to all messages beginning
with the specified prefix. Multiple filters may be attached to a single
-'ZMQ_SUB' socket, in which case a message shall be accepted if it matches at
+'XS_SUB' socket, in which case a message shall be accepted if it matches at
least one filter.
[horizontal]
Option value type:: binary data
Option value unit:: N/A
Default value:: N/A
-Applicable socket types:: ZMQ_SUB
+Applicable socket types:: XS_SUB
-ZMQ_UNSUBSCRIBE: Remove message filter
+XS_UNSUBSCRIBE: Remove message filter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_UNSUBSCRIBE' option shall remove an existing message filter on a
-'ZMQ_SUB' socket. The filter specified must match an existing filter previously
-established with the 'ZMQ_SUBSCRIBE' option. If the socket has several
-instances of the same filter attached the 'ZMQ_UNSUBSCRIBE' option shall remove
+The 'XS_UNSUBSCRIBE' option shall remove an existing message filter on a
+'XS_SUB' socket. The filter specified must match an existing filter previously
+established with the 'XS_SUBSCRIBE' option. If the socket has several
+instances of the same filter attached the 'XS_UNSUBSCRIBE' option shall remove
only one instance, leaving the rest in place and functional.
[horizontal]
Option value type:: binary data
Option value unit:: N/A
Default value:: N/A
-Applicable socket types:: ZMQ_SUB
+Applicable socket types:: XS_SUB
-ZMQ_IDENTITY: Set socket identity
+XS_IDENTITY: Set socket identity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_IDENTITY' option shall set the identity of the specified 'socket'.
+The 'XS_IDENTITY' option shall set the identity of the specified 'socket'.
Socket identity is used only by request/reply pattern. Namely, it can be used
in tandem with ROUTER socket to route messages to the peer with specific
identity.
Identity should be at least one byte and at most 255 bytes long. Identities
-starting with binary zero are reserved for use by 0MQ infrastructure.
+starting with binary zero are reserved for use by Crossroads infrastructure.
[horizontal]
Option value type:: binary data
@@ -139,10 +139,10 @@ Default value:: NULL
Applicable socket types:: all
-ZMQ_RATE: Set multicast data rate
+XS_RATE: Set multicast data rate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RATE' option shall set the maximum send or receive data rate for
-multicast transports such as linkzmq:zmq_pgm[7] using the specified 'socket'.
+The 'XS_RATE' option shall set the maximum send or receive data rate for
+multicast transports such as linkxs:xs_pgm[7] using the specified 'socket'.
[horizontal]
Option value type:: int
@@ -151,9 +151,9 @@ Default value:: 100
Applicable socket types:: all, when using multicast transports
-ZMQ_RECOVERY_IVL: Set multicast recovery interval
+XS_RECOVERY_IVL: Set multicast recovery interval
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RECOVERY_IVL' option shall set the recovery interval for multicast
+The 'XS_RECOVERY_IVL' option shall set the recovery interval for multicast
transports using the specified 'socket'. The recovery interval determines the
maximum time in milliseconds that a receiver can be absent from a multicast
group before unrecoverable data loss will occur.
@@ -168,9 +168,9 @@ Option value unit:: milliseconds
Default value:: 10000
Applicable socket types:: all, when using multicast transports
-ZMQ_SNDBUF: Set kernel transmit buffer size
+XS_SNDBUF: Set kernel transmit buffer size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_SNDBUF' option shall set the underlying kernel transmit buffer size
+The 'XS_SNDBUF' option shall set the underlying kernel transmit buffer size
for the 'socket' to the specified size in bytes. A value of zero means leave
the OS default unchanged. For details please refer to your operating system
documentation for the 'SO_SNDBUF' socket option.
@@ -182,9 +182,9 @@ Default value:: 0
Applicable socket types:: all
-ZMQ_RCVBUF: Set kernel receive buffer size
+XS_RCVBUF: Set kernel receive buffer size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RCVBUF' option shall set the underlying kernel receive buffer size for
+The 'XS_RCVBUF' option shall set the underlying kernel receive buffer size for
the 'socket' to the specified size in bytes. A value of zero means leave the
OS default unchanged. For details refer to your operating system documentation
for the 'SO_RCVBUF' socket option.
@@ -196,26 +196,26 @@ Default value:: 0
Applicable socket types:: all
-ZMQ_LINGER: Set linger period for socket shutdown
+XS_LINGER: Set linger period for socket shutdown
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_LINGER' option shall set the linger period for the specified 'socket'.
+The 'XS_LINGER' option shall set the linger period for the specified 'socket'.
The linger period determines how long pending messages which have yet to be
sent to a peer shall linger in memory after a socket is 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
+linkxs:xs_close[3], and further affects the termination of the socket's
+context with linkxs:xs_term[3]. The following outlines the different
behaviours:
* The default value of '-1' specifies an infinite linger period. Pending
- messages shall not be discarded after a call to _zmq_close()_; attempting to
- terminate the socket's context with _zmq_term()_ shall block until all
+ messages shall not be discarded after a call to _xs_close()_; attempting to
+ terminate the socket's context with _xs_term()_ shall block until all
pending messages have been sent to a peer.
* The value of '0' specifies no linger period. Pending messages shall be
- discarded immediately when the socket is closed with _zmq_close()_.
+ discarded immediately when the socket is closed with _xs_close()_.
* Positive values specify an upper bound for the linger period in milliseconds.
- Pending messages shall not be discarded after a call to _zmq_close()_;
- attempting to terminate the socket's context with _zmq_term()_ shall block
+ Pending messages shall not be discarded after a call to _xs_close()_;
+ attempting to terminate the socket's context with _xs_term()_ shall block
until either all pending messages have been sent to a peer, or the linger
period expires, after which any pending messages shall be discarded.
@@ -226,14 +226,14 @@ Default value:: -1 (infinite)
Applicable socket types:: all
-ZMQ_RECONNECT_IVL: Set reconnection interval
+XS_RECONNECT_IVL: Set reconnection interval
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RECONNECT_IVL' option shall set the initial reconnection interval for
-the specified 'socket'. The reconnection interval is the period 0MQ
+The 'XS_RECONNECT_IVL' option shall set the initial reconnection interval for
+the specified 'socket'. The reconnection interval is the period the library
shall wait between attempts to reconnect disconnected peers when using
connection-oriented transports.
-NOTE: The reconnection interval may be randomized by 0MQ to prevent
+NOTE: The reconnection interval may be randomized by the library to prevent
reconnection storms in topologies with a large number of peers per socket.
[horizontal]
@@ -243,27 +243,28 @@ Default value:: 100
Applicable socket types:: all, only for connection-oriented transports
-ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval
+XS_RECONNECT_IVL_MAX: Set maximum reconnection interval
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_RECONNECT_IVL_MAX' option shall set the maximum reconnection interval
-for the specified 'socket'. This is the maximum period 0MQ shall wait between
-attempts to reconnect. On each reconnect attempt, the previous interval shall be
-doubled untill ZMQ_RECONNECT_IVL_MAX is reached. This allows for exponential
-backoff strategy. Default value means no exponential backoff is performed and
-reconnect interval calculations are only based on ZMQ_RECONNECT_IVL.
+The 'XS_RECONNECT_IVL_MAX' option shall set the maximum reconnection interval
+for the specified 'socket'. This is the maximum period the library shall wait
+between attempts to reconnect. On each reconnect attempt, the previous interval
+shall be doubled untill XS_RECONNECT_IVL_MAX is reached. This allows for
+exponential backoff strategy. Default value means no exponential backoff is
+performed and reconnect interval calculations are only based on
+XS_RECONNECT_IVL.
-NOTE: Values less than ZMQ_RECONNECT_IVL will be ignored.
+NOTE: Values less than XS_RECONNECT_IVL will be ignored.
[horizontal]
Option value type:: int
Option value unit:: milliseconds
-Default value:: 0 (only use ZMQ_RECONNECT_IVL)
+Default value:: 0 (only use XS_RECONNECT_IVL)
Applicable socket types:: all, only for connection-oriented transports
-ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections
+XS_BACKLOG: Set maximum length of the queue of outstanding connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The 'ZMQ_BACKLOG' option shall set the maximum length of the queue of
+The 'XS_BACKLOG' option shall set the maximum length of the queue of
outstanding peer connections for the specified 'socket'; this only applies to
connection-oriented transports. For details refer to your operating system
documentation for the 'listen' function.
@@ -275,11 +276,11 @@ Default value:: 100
Applicable socket types:: all, only for connection-oriented transports.
-ZMQ_MAXMSGSIZE: Maximum acceptable inbound message size
+XS_MAXMSGSIZE: Maximum acceptable inbound message size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Limits the size of the inbound message. If a peer sends a message larger than
-ZMQ_MAXMSGSIZE it is disconnected. Value of -1 means 'no limit'.
+XS_MAXMSGSIZE it is disconnected. Value of -1 means 'no limit'.
[horizontal]
Option value type:: int64_t
@@ -288,7 +289,7 @@ Default value:: -1
Applicable socket types:: all
-ZMQ_MULTICAST_HOPS: Maximum network hops for multicast packets
+XS_MULTICAST_HOPS: Maximum network hops for multicast packets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the time-to-live field in every multicast packet sent from this socket.
@@ -302,11 +303,11 @@ Default value:: 1
Applicable socket types:: all, when using multicast transports
-ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN
+XS_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the timeout for receive operation on the socket. If the value is `0`,
-_zmq_recv(3)_ will return immediately, with a EAGAIN error if there is no
+_xs_recv(3)_ will return immediately, with a EAGAIN error if there is no
message to receive. If the value is `-1`, it will block until a message is
available. For all other values, it will wait for a message for that amount
of time before returning with an EAGAIN error.
@@ -318,11 +319,11 @@ Default value:: -1 (infinite)
Applicable socket types:: all
-ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN
+XS_SNDTIMEO: Maximum time before a send operation returns with EAGAIN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the timeout for send operation on the socket. If the value is `0`,
-_zmq_send(3)_ will return immediately, with a EAGAIN error if the message
+_xs_send(3)_ will return immediately, with a EAGAIN error if the message
cannot be sent. If the value is `-1`, it will block until the message is sent.
For all other values, it will try to send the message for that amount of time
before returning with an EAGAIN error.
@@ -334,7 +335,7 @@ Default value:: -1 (infinite)
Applicable socket types:: all
-ZMQ_IPV4ONLY: Use IPv4-only sockets
+XS_IPV4ONLY: Use IPv4-only sockets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the underlying native socket type. A value of `1` will use IPv4 sockets,
@@ -350,7 +351,7 @@ Applicable socket types:: all, when using TCP transports.
RETURN VALUE
------------
-The _zmq_setsockopt()_ function shall return zero if successful. Otherwise it
+The _xs_setsockopt()_ function shall return zero if successful. Otherwise it
shall return `-1` and set 'errno' to one of the values defined below.
@@ -360,7 +361,7 @@ ERRORS
The requested option _option_name_ is unknown, or the requested _option_len_ or
_option_value_ is invalid.
*ETERM*::
-The 0MQ 'context' associated with the specified 'socket' was terminated.
+The 'context' associated with the specified 'socket' was terminated.
*ENOTSOCK*::
The provided 'socket' was invalid.
*EINTR*::
@@ -369,13 +370,13 @@ The operation was interrupted by delivery of a signal.
EXAMPLE
-------
-.Subscribing to messages on a 'ZMQ_SUB' socket
+.Subscribing to messages on a 'XS_SUB' socket
----
/* Subscribe to all messages */
-rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "", 0);
+rc = xs_setsockopt (socket, XS_SUBSCRIBE, "", 0);
assert (rc == 0);
/* Subscribe to messages prefixed with "ANIMALS.CATS" */
-rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "ANIMALS.CATS", 12);
+rc = xs_setsockopt (socket, XS_SUBSCRIBE, "ANIMALS.CATS", 12);
----
.Setting I/O thread affinity
@@ -383,27 +384,27 @@ rc = zmq_setsockopt (socket, ZMQ_SUBSCRIBE, "ANIMALS.CATS", 12);
int64_t affinity;
/* Incoming connections on TCP port 5555 shall be handled by I/O thread 1 */
affinity = 1;
-rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof affinity);
+rc = xs_setsockopt (socket, XS_AFFINITY, &affinity, sizeof affinity);
assert (rc);
-rc = zmq_bind (socket, "tcp://lo:5555");
+rc = xs_bind (socket, "tcp://lo:5555");
assert (rc);
/* Incoming connections on TCP port 5556 shall be handled by I/O thread 2 */
affinity = 2;
-rc = zmq_setsockopt (socket, ZMQ_AFFINITY, &affinity, sizeof affinity);
+rc = xs_setsockopt (socket, XS_AFFINITY, &affinity, sizeof affinity);
assert (rc);
-rc = zmq_bind (socket, "tcp://lo:5556");
+rc = xs_bind (socket, "tcp://lo:5556");
assert (rc);
----
SEE ALSO
--------
-linkzmq:zmq_getsockopt[3]
-linkzmq:zmq_socket[3]
-linkzmq:zmq[7]
+linkxs:xs_getsockopt[3]
+linkxs:xs_socket[3]
+linkxs:xs[7]
AUTHORS
-------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_socket.txt b/doc/xs_socket.txt
index 39ddebf..217850f 100644
--- a/doc/zmq_socket.txt
+++ b/doc/xs_socket.txt
@@ -1,63 +1,63 @@
-zmq_socket(3)
-=============
+xs_socket(3)
+============
NAME
----
-zmq_socket - create 0MQ socket
+xs_socket - create Crossroads socket
SYNOPSIS
--------
-*void *zmq_socket (void '*context', int 'type');*
+*void *xs_socket (void '*context', int 'type');*
DESCRIPTION
-----------
-The 'zmq_socket()' function shall create a 0MQ socket within the specified
+The 'xs_socket()' function shall create a Crossroads socket within the specified
'context' and return an opaque handle to the newly created socket. The 'type'
argument specifies the socket type, which determines the semantics of
communication over the socket.
The newly created socket is initially unbound, and not associated with any
endpoints. In order to establish a message flow a socket must first be
-connected to at least one endpoint with linkzmq:zmq_connect[3], or at least one
+connected to at least one endpoint with linkxs:xs_connect[3], or at least one
endpoint must be created for accepting incoming connections with
-linkzmq:zmq_bind[3].
+linkxs:xs_bind[3].
.Key differences to conventional sockets
Generally speaking, conventional sockets present a _synchronous_ interface to
either connection-oriented reliable byte streams (SOCK_STREAM), or
-connection-less unreliable datagrams (SOCK_DGRAM). In comparison, 0MQ sockets
-present an abstraction of an asynchronous _message queue_, with the exact
-queueing semantics depending on the socket type in use. Where conventional
-sockets transfer streams of bytes or discrete datagrams, 0MQ sockets transfer
-discrete _messages_.
+connection-less unreliable datagrams (SOCK_DGRAM). In comparison, Crossroads
+sockets present an abstraction of an asynchronous _message queue_, with the
+exact queueing semantics depending on the socket type in use. Where conventional
+sockets transfer streams of bytes or discrete datagrams, Crossroads sockets
+transfer discrete _messages_.
-0MQ sockets being _asynchronous_ means that the timings of the physical
+Crossroads sockets being _asynchronous_ means that the timings of the physical
connection setup and tear down, reconnect and effective delivery are transparent
-to the user and organized by 0MQ itself. Further, messages may be _queued_ in
-the event that a peer is unavailable to receive them.
+to the user and organized by Crossroads library itself. Further, messages may
+be _queued_ in the event that a peer is unavailable to receive them.
Conventional sockets allow only strict one-to-one (two peers), many-to-one
(many clients, one server), or in some cases one-to-many (multicast)
-relationships. With the exception of 'ZMQ_PAIR', 0MQ sockets may be connected
-*to multiple endpoints* using _zmq_connect()_, while simultaneously accepting
-incoming connections *from multiple endpoints* bound to the socket using
-_zmq_bind()_, thus allowing many-to-many relationships.
+relationships. With the exception of 'XS_PAIR', Crossroads sockets may be
+connected *to multiple endpoints* using _xs_connect()_, while simultaneously
+accepting incoming connections *from multiple endpoints* bound to the socket
+using _xs_bind()_, thus allowing many-to-many relationships.
.Thread safety
-0MQ 'sockets' are _not_ thread safe. Applications MUST NOT use a socket
+Crossroads 'sockets' are _not_ thread safe. Applications MUST NOT use a socket
from multiple threads except after migrating a socket from one thread to
another with a "full fence" memory barrier.
.Socket types
-0MQ defines several messaging patterns which encapsulate exact semantics of
-a particular topology. For example, publush-subscribe pattern defines data
+Crossroads defines several messaging patterns which encapsulate exact semantics
+of a particular topology. For example, publush-subscribe pattern defines data
distribution trees while request-reply defines networks of shared stateless
services. Each pattern defines several socket types (roles in the pattern).
-The following sections present the socket types defined by 0MQ:
+The following sections present the socket types defined by Crossroads library:
Request-reply pattern
@@ -67,97 +67,97 @@ or more instances of a stateless _service_, and receiving subsequent replies
to each request sent.
-ZMQ_REQ
-^^^^^^^
-A socket of type 'ZMQ_REQ' is used by a _client_ to send requests to and
+XS_REQ
+^^^^^^
+A socket of type 'XS_REQ' is used by a _client_ to send requests to and
receive replies from a _service_. This socket type allows only an alternating
-sequence of _zmq_send(request)_ and subsequent _zmq_recv(reply)_ calls. Each
+sequence of _xs_send(request)_ and subsequent _xs_recv(reply)_ calls. Each
request sent is load-balanced among all _services_, and each reply received is
matched with the last issued request.
-When a 'ZMQ_REQ' socket enters an exceptional state due to having reached the
+When a 'XS_REQ' socket enters an exceptional state due to having reached the
high water mark for all _services_, or if there are no _services_ at all, then
-any linkzmq:zmq_send[3] operations on the socket shall block until the
+any linkxs:xs_send[3] operations on the socket shall block until the
exceptional state ends or at least one _service_ becomes available for sending;
messages are not discarded.
[horizontal]
-.Summary of ZMQ_REQ characteristics
-Compatible peer sockets:: 'ZMQ_REP'
+.Summary of XS_REQ characteristics
+Compatible peer sockets:: 'XS_REP'
Send/receive pattern:: Send, Receive, Send, Receive, ...
Outgoing routing strategy:: Load-balanced
Incoming routing strategy:: Last peer
-ZMQ_HWM option action:: Block
+XS_HWM option action:: Block
-ZMQ_REP
-^^^^^^^
-A socket of type 'ZMQ_REP' is used by a _service_ to receive requests from and
+XS_REP
+^^^^^^
+A socket of type 'XS_REP' is used by a _service_ to receive requests from and
send replies to a _client_. This socket type allows only an alternating
-sequence of _zmq_recv(request)_ and subsequent _zmq_send(reply)_ calls. Each
+sequence of _xs_recv(request)_ and subsequent _xs_send(reply)_ calls. Each
request received is fair-queued from among all _clients_, and each reply sent
is routed to the _client_ that issued the last request. If the original
requester doesn't exist any more the reply is silently discarded.
-When a 'ZMQ_REP' socket enters an exceptional state due to having reached the
+When a 'XS_REP' socket enters an exceptional state due to having reached the
high water mark for a _client_, then any replies sent to the _client_ in
question shall be dropped until the exceptional state ends.
[horizontal]
-.Summary of ZMQ_REP characteristics
-Compatible peer sockets:: 'ZMQ_REQ'
+.Summary of XS_REP characteristics
+Compatible peer sockets:: 'XS_REQ'
Send/receive pattern:: Receive, Send, Receive, Send, ...
Incoming routing strategy:: Fair-queued
Outgoing routing strategy:: Last peer
-ZMQ_HWM option action:: Drop
+XS_HWM option action:: Drop
-ZMQ_XREQ
-^^^^^^^^
-A socket of type 'ZMQ_XREQ' is a socket type underlying 'ZMQ_REQ'. It doesn't
-impose the strict order of sends and recvs as 'ZMQ_REQ' does and it is
+XS_XREQ
+^^^^^^^
+A socket of type 'XS_XREQ' is a socket type underlying 'XS_REQ'. It doesn't
+impose the strict order of sends and recvs as 'XS_REQ' does and it is
intended for use in intermediate devices in request-reply topologies.
Each message sent is load-balanced among all connected
peers, and each message received is fair-queued from all connected peers.
-When a 'ZMQ_XREQ' socket enters an exceptional state due to having reached the
+When a 'XS_XREQ' socket enters an exceptional state due to having reached the
high water mark for all peers, or if there are no peers at all, then any
-linkzmq:zmq_send[3] operations on the socket shall block until the exceptional
+linkxs:xs_send[3] operations on the socket shall block until the exceptional
state ends or at least one peer becomes available for sending; messages are not
discarded.
[horizontal]
-.Summary of ZMQ_XREQ characteristics
-Compatible peer sockets:: 'ZMQ_XREP', 'ZMQ_REP'
+.Summary of XS_XREQ characteristics
+Compatible peer sockets:: 'XS_XREP', 'XS_REP'
Send/receive pattern:: Unrestricted
Outgoing routing strategy:: Load-balanced
Incoming routing strategy:: Fair-queued
-ZMQ_HWM option action:: Block
+XS_HWM option action:: Block
-ZMQ_XREP
-^^^^^^^^
-A socket of type 'ZMQ_XREP' is a socket type underlying 'ZMQ_REP'. It doesn't
-impose the strict order of sends and recvs as 'ZMQ_REQ' does and it is
+XS_XREP
+^^^^^^^
+A socket of type 'XS_XREP' is a socket type underlying 'XS_REP'. It doesn't
+impose the strict order of sends and recvs as 'XS_REQ' does and it is
intended for use in intermediate devices in request-reply topologies.
Messages received are fair-queued from among all connected peers. The outbound
messages are routed to a specific peer, as explained below.
-When a 'ZMQ_XREP' socket enters an exceptional state due to having reached the
+When a 'XS_XREP' socket enters an exceptional state due to having reached the
high water mark for all peers, or if there are no peers at all, then any
messages sent to the socket shall be dropped until the exceptional state ends.
Likewise, any messages to be routed to a non-existent peer or a peer for which
the individual high water mark has been reached shall also be dropped.
[horizontal]
-.Summary of ZMQ_XREP characteristics
-Compatible peer sockets:: 'ZMQ_XREQ', 'ZMQ_REQ'
+.Summary of XS_XREP characteristics
+Compatible peer sockets:: 'XS_XREQ', 'XS_REQ'
Send/receive pattern:: Unrestricted
Outgoing routing strategy:: See text
Incoming routing strategy:: Fair-queued
-ZMQ_HWM option action:: Drop
+XS_HWM option action:: Drop
Publish-subscribe pattern
@@ -166,72 +166,72 @@ The publish-subscribe pattern is used for one-to-many distribution of data from
a single _publisher_ to multiple _subscribers_ in a fan out fashion.
-ZMQ_PUB
-^^^^^^^
-A socket of type 'ZMQ_PUB' is used by a _publisher_ to distribute data.
+XS_PUB
+^^^^^^
+A socket of type 'XS_PUB' is used by a _publisher_ to distribute data.
Messages sent are distributed in a fan out fashion to all connected peers.
-The linkzmq:zmq_recv[3] function is not implemented for this socket type.
+The linkxs:xs_recv[3] function is not implemented for this socket type.
-When a 'ZMQ_PUB' socket enters an exceptional state due to having reached the
+When a 'XS_PUB' socket enters an exceptional state due to having reached the
high water mark for a _subscriber_, then any messages that would be sent to the
_subscriber_ in question shall instead be dropped until the exceptional state
-ends. The _zmq_send()_ function shall never block for this socket type.
+ends. The _xs_send()_ function shall never block for this socket type.
[horizontal]
-.Summary of ZMQ_PUB characteristics
-Compatible peer sockets:: 'ZMQ_SUB', 'ZMQ_XSUB'
+.Summary of XS_PUB characteristics
+Compatible peer sockets:: 'XS_SUB', 'XS_XSUB'
Send/receive pattern:: Send only
Incoming routing strategy:: N/A
Outgoing routing strategy:: Fan out
-ZMQ_HWM option action:: Drop
+XS_HWM option action:: Drop
-ZMQ_SUB
-^^^^^^^
-A socket of type 'ZMQ_SUB' is used by a _subscriber_ to subscribe to data
-distributed by a _publisher_. Initially a 'ZMQ_SUB' socket is not subscribed to
-any messages, use the 'ZMQ_SUBSCRIBE' option of linkzmq:zmq_setsockopt[3] to
-specify which messages to subscribe to. The _zmq_send()_ function is not
+XS_SUB
+^^^^^^
+A socket of type 'XS_SUB' is used by a _subscriber_ to subscribe to data
+distributed by a _publisher_. Initially a 'XS_SUB' socket is not subscribed to
+any messages, use the 'XS_SUBSCRIBE' option of linkxs:xs_setsockopt[3] to
+specify which messages to subscribe to. The _xs_send()_ function is not
implemented for this socket type.
[horizontal]
-.Summary of ZMQ_SUB characteristics
-Compatible peer sockets:: 'ZMQ_PUB', 'ZMQ_XPUB'
+.Summary of XS_SUB characteristics
+Compatible peer sockets:: 'XS_PUB', 'XS_XPUB'
Send/receive pattern:: Receive only
Incoming routing strategy:: Fair-queued
Outgoing routing strategy:: N/A
-ZMQ_HWM option action:: Drop
+XS_HWM option action:: Drop
-ZMQ_XPUB
-^^^^^^^^
-Same as ZMQ_PUB except that you can receive subscriptions from the peers
+XS_XPUB
+^^^^^^^
+Same as XS_PUB except that you can receive subscriptions from the peers
in form of incoming messages. Subscription message is a byte 1 (for
subscriptions) or byte 0 (for unsubscriptions) followed by the subscription
body.
[horizontal]
-.Summary of ZMQ_XPUB characteristics
-Compatible peer sockets:: 'ZMQ_SUB', 'ZMQ_XSUB'
+.Summary of XS_XPUB characteristics
+Compatible peer sockets:: 'XS_SUB', 'XS_XSUB'
Send/receive pattern:: Send messages, receive subscriptions
Incoming routing strategy:: N/A
Outgoing routing strategy:: Fan out
-ZMQ_HWM option action:: Drop
+XS_HWM option action:: Drop
-ZMQ_XSUB
-^^^^^^^^
-Same as ZMQ_SUB except that you subscribe by sending subscription messages to
+XS_XSUB
+^^^^^^^
+Same as XS_SUB except that you subscribe by sending subscription messages to
the socket. Subscription message is a byte 1 (for subscriptions) or byte 0
(for unsubscriptions) followed by the subscription body.
[horizontal]
-.Summary of ZMQ_XSUB characteristics
-Compatible peer sockets:: 'ZMQ_PUB', 'ZMQ_XPUB'
+.Summary of XS_XSUB characteristics
+Compatible peer sockets:: 'XS_PUB', 'XS_XPUB'
Send/receive pattern:: Receive messages, send subscriptions
Incoming routing strategy:: Fair-queued
Outgoing routing strategy:: N/A
-ZMQ_HWM option action:: Drop
+XS_HWM option action:: Drop
Pipeline pattern
@@ -242,44 +242,44 @@ is connected to at least one _node_. When a pipeline stage is connected to
multiple _nodes_ data is load-balanced among all connected _nodes_.
-ZMQ_PUSH
-^^^^^^^^
-A socket of type 'ZMQ_PUSH' is used by a pipeline _node_ to send messages
+XS_PUSH
+^^^^^^^
+A socket of type 'XS_PUSH' is used by a pipeline _node_ to send messages
to downstream pipeline _nodes_. Messages are load-balanced to all connected
-downstream _nodes_. The _zmq_recv()_ function is not implemented for this
+downstream _nodes_. The _xs_recv()_ function is not implemented for this
socket type.
-When a 'ZMQ_PUSH' socket enters an exceptional state due to having reached the
+When a 'XS_PUSH' socket enters an exceptional state due to having reached the
high water mark for all downstream _nodes_, or if there are no downstream
-_nodes_ at all, then any linkzmq:zmq_send[3] operations on the socket shall
+_nodes_ at all, then any linkxs:xs_send[3] operations on the socket shall
block until the exceptional state ends or at least one downstream _node_
becomes available for sending; messages are not discarded.
[horizontal]
-.Summary of ZMQ_PUSH characteristics
-Compatible peer sockets:: 'ZMQ_PULL'
+.Summary of XS_PUSH characteristics
+Compatible peer sockets:: 'XS_PULL'
Direction:: Unidirectional
Send/receive pattern:: Send only
Incoming routing strategy:: N/A
Outgoing routing strategy:: Load-balanced
-ZMQ_HWM option action:: Block
+XS_HWM option action:: Block
-ZMQ_PULL
-^^^^^^^^
-A socket of type 'ZMQ_PULL' is used by a pipeline _node_ to receive messages
+XS_PULL
+^^^^^^^
+A socket of type 'XS_PULL' is used by a pipeline _node_ to receive messages
from upstream pipeline _nodes_. Messages are fair-queued from among all
-connected upstream _nodes_. The _zmq_send()_ function is not implemented for
+connected upstream _nodes_. The _xs_send()_ function is not implemented for
this socket type.
[horizontal]
-.Summary of ZMQ_PULL characteristics
-Compatible peer sockets:: 'ZMQ_PUSH'
+.Summary of XS_PULL characteristics
+Compatible peer sockets:: 'XS_PUSH'
Direction:: Unidirectional
Send/receive pattern:: Receive only
Incoming routing strategy:: Fair-queued
Outgoing routing strategy:: N/A
-ZMQ_HWM option action:: N/A
+XS_HWM option action:: N/A
Exclusive pair pattern
@@ -288,33 +288,33 @@ The exclusive pair is an advanced pattern used for communicating exclusively
between two peers.
-ZMQ_PAIR
-^^^^^^^^
-A socket of type 'ZMQ_PAIR' can only be connected to a single peer at any one
+XS_PAIR
+^^^^^^^
+A socket of type 'XS_PAIR' can only be connected to a single peer at any one
time. No message routing or filtering is performed on messages sent over a
-'ZMQ_PAIR' socket.
+'XS_PAIR' socket.
-When a 'ZMQ_PAIR' socket enters an exceptional state due to having reached the
+When a 'XS_PAIR' socket enters an exceptional state due to having reached the
high water mark for the connected peer, or if no peer is connected, then
-any linkzmq:zmq_send[3] operations on the socket shall block until the peer
+any linkxs:xs_send[3] operations on the socket shall block until the peer
becomes available for sending; messages are not discarded.
-NOTE: 'ZMQ_PAIR' sockets are experimental, and are currently missing several
+NOTE: 'XS_PAIR' sockets are experimental, and are currently missing several
features such as auto-reconnection.
[horizontal]
-.Summary of ZMQ_PAIR characteristics
-Compatible peer sockets:: 'ZMQ_PAIR'
+.Summary of XS_PAIR characteristics
+Compatible peer sockets:: 'XS_PAIR'
Direction:: Bidirectional
Send/receive pattern:: Unrestricted
Incoming routing strategy:: N/A
Outgoing routing strategy:: N/A
-ZMQ_HWM option action:: Block
+XS_HWM option action:: Block
RETURN VALUE
------------
-The _zmq_socket()_ function shall return an opaque handle to the newly created
+The _xs_socket()_ function shall return an opaque handle to the newly created
socket if successful. Otherwise, it shall return NULL and set 'errno' to one of
the values defined below.
@@ -326,22 +326,22 @@ The requested socket 'type' is invalid.
*EFAULT*::
The provided 'context' is invalid.
*EMFILE*::
-The limit on the total number of open 0MQ sockets has been reached.
+The limit on the total number of open Crossroads sockets has been reached.
*ETERM*::
The context specified was terminated.
SEE ALSO
--------
-linkzmq:zmq_init[3]
-linkzmq:zmq_setsockopt[3]
-linkzmq:zmq_bind[3]
-linkzmq:zmq_connect[3]
-linkzmq:zmq_send[3]
-linkzmq:zmq_recv[3]
-linkzmq:zmq[7]
+linkxs:xs_init[3]
+linkxs:xs_setsockopt[3]
+linkxs:xs_bind[3]
+linkxs:xs_connect[3]
+linkxs:xs_send[3]
+linkxs:xs_recv[3]
+linkxs:xs[7]
AUTHORS
-------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_strerror.txt b/doc/xs_strerror.txt
new file mode 100644
index 0000000..4fd517e
--- /dev/null
+++ b/doc/xs_strerror.txt
@@ -0,0 +1,55 @@
+xs_strerror(3)
+==============
+
+
+NAME
+----
+xs_strerror - get error message string
+
+
+SYNOPSIS
+--------
+*const char *xs_strerror (int 'errnum');*
+
+
+DESCRIPTION
+-----------
+The _xs_strerror()_ function shall return a pointer to an error message string
+corresponding to the error number specified by the 'errnum' argument.
+As Crossroads define additional error numbers over and above those defined
+by the operating system, applications should use _xs_strerror()_ in preference
+to the standard _strerror()_ function.
+
+
+RETURN VALUE
+------------
+The _xs_strerror()_ function shall return a pointer to an error message
+string.
+
+
+ERRORS
+------
+No errors are defined.
+
+
+EXAMPLE
+-------
+.Displaying an error message when the context cannot be initialised
+----
+void *ctx = xs_init (1, 1, 0);
+if (!ctx) {
+ printf ("Error occurred during xs_init(): %s\n", xs_strerror (errno));
+ abort ();
+}
+----
+
+
+SEE ALSO
+--------
+linkxs:xs[7]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_tcp.txt b/doc/xs_tcp.txt
index f5499d3..5d5cbca 100644
--- a/doc/zmq_tcp.txt
+++ b/doc/xs_tcp.txt
@@ -1,22 +1,22 @@
-zmq_tcp(7)
-==========
+xs_tcp(7)
+=========
NAME
----
-zmq_tcp - 0MQ unicast transport using TCP
+xs_tcp - Crossroads unicast transport using TCP
SYNOPSIS
--------
TCP is an ubiquitous, reliable, unicast transport. When connecting distributed
-applications over a network with 0MQ, using the TCP transport will likely be
-your first choice.
+applications over a network with Crossroads, using the TCP transport will likely
+be your first choice.
ADDRESSING
----------
-A 0MQ address string consists of two parts as follows:
+A Crossroads address string consists of two parts as follows:
'transport'`://`'endpoint'. The 'transport' part specifies the underlying
transport protocol to use, and for the TCP transport shall be set to `tcp`.
The meaning of the 'endpoint' part for the TCP transport is defined below.
@@ -24,7 +24,7 @@ The meaning of the 'endpoint' part for the TCP transport is defined below.
Assigning a local address to a socket
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When assigning a local address to a socket using _zmq_bind()_ with the 'tcp'
+When assigning a local address to a socket using _xs_bind()_ with the 'tcp'
transport, the 'endpoint' shall be interpreted as an 'interface' followed by a
colon and the TCP port number to use.
@@ -42,7 +42,7 @@ names exist, thus only the primary IP address may be used to specify an
Connecting a socket
~~~~~~~~~~~~~~~~~~~
-When connecting a socket to a peer address using _zmq_connect()_ with the 'tcp'
+When connecting a socket to a peer address using _xs_connect()_ with the 'tcp'
transport, the 'endpoint' shall be interpreted as a 'peer address' followed by
a colon and the TCP port number to use.
@@ -54,7 +54,7 @@ A 'peer address' may be specified by either of the following:
WIRE FORMAT
-----------
-0MQ messages are transmitted over TCP in frames consisting of an encoded
+Crossroads messages are transmitted over TCP in frames consisting of an encoded
'payload length', followed by a 'flags' field and the message body. The 'payload
length' is defined as the combined length in octets of the message body and the
'flags' field.
@@ -125,38 +125,38 @@ EXAMPLES
.Assigning a local address to a socket
----
/* TCP port 5555 on all available interfaces */
-rc = zmq_bind(socket, "tcp://*:5555");
+rc = xs_bind(socket, "tcp://*:5555");
assert (rc == 0);
/* TCP port 5555 on the local loop-back interface on all platforms */
-rc = zmq_bind(socket, "tcp://127.0.0.1:5555");
+rc = xs_bind(socket, "tcp://127.0.0.1:5555");
assert (rc == 0);
/* TCP port 5555 on the first Ethernet network interface on Linux */
-rc = zmq_bind(socket, "tcp://eth0:5555");
+rc = xs_bind(socket, "tcp://eth0:5555");
assert (rc == 0);
----
.Connecting a socket
----
/* Connecting using an IP address */
-rc = zmq_connect(socket, "tcp://192.168.1.1:5555");
+rc = xs_connect(socket, "tcp://192.168.1.1:5555");
assert (rc == 0);
/* Connecting using a DNS name */
-rc = zmq_connect(socket, "tcp://server1:5555");
+rc = xs_connect(socket, "tcp://server1:5555");
assert (rc == 0);
----
SEE ALSO
--------
-linkzmq:zmq_bind[3]
-linkzmq:zmq_connect[3]
-linkzmq:zmq_pgm[7]
-linkzmq:zmq_ipc[7]
-linkzmq:zmq_inproc[7]
-linkzmq:zmq[7]
+linkxs:xs_bind[3]
+linkxs:xs_connect[3]
+linkxs:xs_pgm[7]
+linkxs:xs_ipc[7]
+linkxs:xs_inproc[7]
+linkxs:xs[7]
AUTHORS
-------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_term.txt b/doc/xs_term.txt
new file mode 100644
index 0000000..a9b75bb
--- /dev/null
+++ b/doc/xs_term.txt
@@ -0,0 +1,65 @@
+xs_term(3)
+==========
+
+
+NAME
+----
+xs_term - terminate the context
+
+
+SYNOPSIS
+--------
+*int xs_term (void '*context');*
+
+
+DESCRIPTION
+-----------
+The _xs_term()_ function shall terminate the Crossroads context 'context'.
+
+Context termination is performed in the following steps:
+
+1. Any blocking operations currently in progress on sockets open within
+ 'context' shall return immediately with an error code of ETERM. With the
+ exception of _xs_close()_, any further operations on sockets open within
+ 'context' shall fail with an error code of ETERM.
+
+2. After interrupting all blocking calls, _xs_term()_ shall _block_ until the
+ following conditions are satisfied:
++
+ * All sockets open within 'context' have been closed with _xs_close()_.
+
+ * For each socket within 'context', all messages sent by the application
+ with _xs_send()_ have either been physically transferred to a network
+ peer, or the socket's linger period set with the _XS_LINGER_ socket
+ option has expired.
+
+For further details regarding socket linger behaviour refer to the _XS_LINGER_
+option in linkxs:xs_setsockopt[3].
+
+
+RETURN VALUE
+------------
+The _xs_term()_ function shall return zero if successful. Otherwise it shall
+return `-1` and set 'errno' to one of the values defined below.
+
+
+ERRORS
+------
+*EFAULT*::
+The provided 'context' was invalid.
+*EINTR*::
+Termination was interrupted by a signal. It can be restarted if needed.
+
+
+SEE ALSO
+--------
+linkxs:xs[7]
+linkxs:xs_init[3]
+linkxs:xs_close[3]
+linkxs:xs_setsockopt[3]
+
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/xs_version.txt b/doc/xs_version.txt
new file mode 100644
index 0000000..c13a080
--- /dev/null
+++ b/doc/xs_version.txt
@@ -0,0 +1,53 @@
+xs_version(3)
+=============
+
+
+NAME
+----
+xs_version - report Crossroads library version
+
+
+SYNOPSIS
+--------
+*void xs_version (int '*major', int '*minor', int '*patch');*
+
+
+DESCRIPTION
+-----------
+The _xs_version()_ function shall fill in the integer variables pointed to by
+the 'major', 'minor' and 'patch' arguments with the major, minor and patch level
+components of the Crossroads library version.
+
+This functionality is intended for applications or language bindings
+dynamically linking to the Crossroads library that wish to determine the actual
+version of the Crossroads library they are using.
+
+
+RETURN VALUE
+------------
+There is no return value.
+
+
+ERRORS
+------
+No errors are defined.
+
+
+EXAMPLE
+-------
+.Printing out the version of the Crossroads library
+----
+int major, minor, patch;
+xs_version (&major, &minor, &patch);
+printf ("Current Crossroads version is %d.%d.%d\n", major, minor, patch);
+----
+
+
+SEE ALSO
+--------
+linkxs:xs[7]
+
+AUTHORS
+-------
+The Crossroads documentation was written by Martin Sustrik <sustrik@250bpm.com>
+and Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq.txt b/doc/zmq.txt
deleted file mode 100644
index 7493ffd..0000000
--- a/doc/zmq.txt
+++ /dev/null
@@ -1,217 +0,0 @@
-zmq(7)
-======
-
-
-NAME
-----
-zmq - 0MQ lightweight messaging kernel
-
-
-SYNOPSIS
---------
-*#include <zmq.h>*
-
-*cc* ['flags'] 'files' *-lzmq* ['libraries']
-
-
-DESCRIPTION
------------
-The 0MQ lightweight messaging kernel is a library which extends the standard
-socket interfaces with features traditionally provided by specialised
-_messaging middleware_ products. 0MQ sockets provide an abstraction of
-asynchronous _message queues_, multiple _messaging patterns_, message
-filtering (_subscriptions_), seamless access to multiple _transport protocols_
-and more.
-
-This documentation presents an overview of 0MQ concepts, describes how 0MQ
-abstracts standard sockets and provides a reference manual for the functions
-provided by the 0MQ library.
-
-
-Context
-~~~~~~~
-Before using any 0MQ library functions the caller must initialise a 0MQ
-'context' using _zmq_init()_. The following functions are provided to handle
-initialisation and termination of a 'context':
-
-Initialise 0MQ context::
- linkzmq:zmq_init[3]
-
-Terminate 0MQ context::
- linkzmq:zmq_term[3]
-
-
-Thread safety
-^^^^^^^^^^^^^
-A 0MQ 'context' is thread safe and may be shared among as many application
-threads as necessary, without any additional locking required on the part of
-the caller.
-
-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
-_pthread_create()_.
-
-
-Multiple contexts
-^^^^^^^^^^^^^^^^^
-Multiple 'contexts' may coexist within a single application. Thus, an
-application can use 0MQ directly and at the same time make use of any number of
-additional libraries or components which themselves make use of 0MQ as long as
-the above guidelines regarding thread safety are adhered to.
-
-
-Messages
-~~~~~~~~
-A 0MQ message is a discrete unit of data passed between applications or
-components of the same application. 0MQ messages have no internal structure and
-from the point of view of 0MQ itself they are considered to be opaque binary
-data.
-
-The following functions are provided to work with messages:
-
-Initialise a message::
- linkzmq:zmq_msg_init[3]
- linkzmq:zmq_msg_init_size[3]
- linkzmq:zmq_msg_init_data[3]
-
-Release a message::
- linkzmq:zmq_msg_close[3]
-
-Access message content::
- linkzmq:zmq_msg_data[3]
- linkzmq:zmq_msg_size[3]
-
-Message manipulation::
- linkzmq:zmq_msg_copy[3]
- linkzmq:zmq_msg_move[3]
-
-
-Sockets
-~~~~~~~
-0MQ sockets present an abstraction of a asynchronous _message queue_, with the
-exact queueing semantics depending on the socket type in use. See
-linkzmq:zmq_socket[3] for the socket types provided.
-
-The following functions are provided to work with sockets:
-
-Creating a socket::
- linkzmq:zmq_socket[3]
-
-Closing a socket::
- linkzmq:zmq_close[3]
-
-Manipulating socket options::
- linkzmq:zmq_getsockopt[3]
- linkzmq:zmq_setsockopt[3]
-
-Establishing a message flow::
- linkzmq:zmq_bind[3]
- linkzmq:zmq_connect[3]
-
-Sending and receiving messages::
- linkzmq:zmq_send[3]
- linkzmq:zmq_recv[3]
-
-.Input/output multiplexing
-0MQ provides a mechanism for applications to multiplex input/output events over
-a set containing both 0MQ sockets and standard sockets. This mechanism mirrors
-the standard _poll()_ system call, and is described in detail in
-linkzmq:zmq_poll[3].
-
-
-Transports
-~~~~~~~~~~
-A 0MQ socket can use multiple different underlying transport mechanisms.
-Each transport mechanism is suited to a particular purpose and has its own
-advantages and drawbacks.
-
-The following transport mechanisms are provided:
-
-Unicast transport using TCP::
- linkzmq:zmq_tcp[7]
-
-Reliable multicast transport using PGM::
- linkzmq:zmq_pgm[7]
-
-Local inter-process communication transport::
- linkzmq:zmq_ipc[7]
-
-Local in-process (inter-thread) communication transport::
- linkzmq:zmq_inproc[7]
-
-
-Devices
-~~~~~~~
-Apart from the 0MQ library the 0MQ distribution includes 'devices' which are
-building blocks intended to serve as intermediate nodes in complex messaging
-topologies.
-
-The following devices are provided:
-
-Forwarder device for request-response messaging::
- linkzmq:zmq_queue[1]
-
-Forwarder device for publish-subscribe messaging::
- linkzmq:zmq_forwarder[1]
-
-Streamer device for parallelized pipeline messaging::
- linkzmq:zmq_streamer[1]
-
-
-ERROR HANDLING
---------------
-The 0MQ library functions handle errors using the standard conventions found on
-POSIX systems. Generally, this means that upon failure a 0MQ library function
-shall return either a NULL value (if returning a pointer) or a negative value
-(if returning an integer), and the actual error code shall be stored in the
-'errno' variable.
-
-On non-POSIX systems some users may experience issues with retrieving the
-correct value of the 'errno' variable. The _zmq_errno()_ function is provided
-to assist in these cases; for details refer to linkzmq:zmq_errno[3].
-
-The _zmq_strerror()_ function is provided to translate 0MQ-specific error codes
-into error message strings; for details refer to linkzmq:zmq_strerror[3].
-
-
-MISCELLANEOUS
--------------
-The following miscellaneous functions are provided:
-
-Report 0MQ library version::
- linkzmq:zmq_version[3]
-
-
-LANGUAGE BINDINGS
------------------
-The 0MQ library provides interfaces suitable for calling from programs in any
-language; this documentation documents those interfaces as they would be used
-by C programmers. The intent is that programmers using 0MQ from other languages
-shall refer to this documentation alongside any documentation provided by the
-vendor of their language binding.
-
-Language bindings (Python, Ruby, Java and more) are provided by members
-of the 0MQ community and pointers can be found on the 0MQ website.
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
-
-
-RESOURCES
----------
-Main web site: <http://www.zeromq.org/>
-
-Report bugs to the 0MQ development mailing list: <zeromq-dev@lists.zeromq.org>
-
-
-COPYING
--------
-Free use of this software is granted under the terms of the GNU Lesser General
-Public License (LGPL). For details see the files `COPYING` and `COPYING.LESSER`
-included with the 0MQ distribution.
diff --git a/doc/zmq_close.txt b/doc/zmq_close.txt
deleted file mode 100644
index b6dcf0c..0000000
--- a/doc/zmq_close.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-zmq_close(3)
-============
-
-
-NAME
-----
-zmq_close - close 0MQ socket
-
-
-SYNOPSIS
---------
-*int zmq_close (void '*socket');*
-
-
-DESCRIPTION
------------
-The _zmq_close()_ function shall destroy the socket referenced by the 'socket'
-argument. Any outstanding messages physically received from the network but not
-yet received by the application with _zmq_recv()_ shall be discarded. The
-behaviour for discarding messages sent by the application with _zmq_send()_ but
-not yet physically transferred to the network depends on the value of the
-_ZMQ_LINGER_ socket option for the specified 'socket'.
-
-NOTE: The default setting of _ZMQ_LINGER_ does not discard unsent messages;
-this behaviour may cause the application to block when calling _zmq_term()_.
-For details refer to linkzmq:zmq_setsockopt[3] and linkzmq:zmq_term[3].
-
-
-RETURN VALUE
-------------
-The _zmq_close()_ function shall return zero if successful. Otherwise it shall
-return `-1` and set 'errno' to one of the values defined below.
-
-
-ERRORS
-------
-*ENOTSOCK*::
-The provided 'socket' was invalid.
-
-
-SEE ALSO
---------
-linkzmq:zmq_socket[3]
-linkzmq:zmq_term[3]
-linkzmq:zmq_setsockopt[3]
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_errno.txt b/doc/zmq_errno.txt
deleted file mode 100644
index d40dfb4..0000000
--- a/doc/zmq_errno.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-zmq_errno(3)
-============
-
-
-NAME
-----
-zmq_errno - retrieve value of errno for the calling thread
-
-
-SYNOPSIS
---------
-*int zmq_errno (void);*
-
-
-DESCRIPTION
------------
-The _zmq_errno()_ function shall retrieve the value of the 'errno' variable for
-the calling thread.
-
-The _zmq_errno()_ function is provided to assist users on non-POSIX systems who
-are experiencing issues with retrieving the correct value of 'errno' directly.
-Specifically, users on Win32 systems whose application is using a different C
-run-time library from the C run-time library in use by 0MQ will need to use
-_zmq_errno()_ for correct operation.
-
-IMPORTANT: Users not experiencing issues with retrieving the correct value of
-'errno' should not use this function and should instead access the 'errno'
-variable directly.
-
-
-RETURN VALUE
-------------
-The _zmq_errno()_ function shall return the value of the 'errno' variable for
-the calling thread.
-
-
-ERRORS
-------
-No errors are defined.
-
-
-SEE ALSO
---------
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_msg_close.txt b/doc/zmq_msg_close.txt
deleted file mode 100644
index 1754500..0000000
--- a/doc/zmq_msg_close.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-zmq_msg_close(3)
-================
-
-
-NAME
-----
-zmq_msg_close - release 0MQ message
-
-
-SYNOPSIS
---------
-*int zmq_msg_close (zmq_msg_t '*msg');*
-
-
-DESCRIPTION
------------
-The _zmq_msg_close()_ function shall inform the 0MQ infrastructure that any
-resources associated with the message object referenced by 'msg' are no longer
-required and may be released. Actual release of resources associated with the
-message object shall be postponed by 0MQ until all users of the message or
-underlying data buffer have indicated it is no longer required.
-
-Applications should ensure that _zmq_msg_close()_ is called once a message is
-no longer required, otherwise memory leaks may occur.
-
-CAUTION: Never access 'zmq_msg_t' members directly, instead always use the
-_zmq_msg_ family of functions.
-
-
-RETURN VALUE
-------------
-The _zmq_msg_close()_ function shall return zero if successful. Otherwise
-it shall return `-1` and set 'errno' to one of the values defined below.
-
-
-ERRORS
-------
-*EFAULT*::
-Invalid message.
-
-
-SEE ALSO
---------
-linkzmq:zmq_msg_init[3]
-linkzmq:zmq_msg_init_size[3]
-linkzmq:zmq_msg_init_data[3]
-linkzmq:zmq_msg_data[3]
-linkzmq:zmq_msg_size[3]
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_msg_copy.txt b/doc/zmq_msg_copy.txt
deleted file mode 100644
index 56c93c1..0000000
--- a/doc/zmq_msg_copy.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-zmq_msg_copy(3)
-===============
-
-
-NAME
-----
-zmq_msg_copy - copy content of a message to another message
-
-
-SYNOPSIS
---------
-*int zmq_msg_copy (zmq_msg_t '*dest', zmq_msg_t '*src');*
-
-
-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.
-
-CAUTION: The implementation may choose not to physically copy the message
-content, rather to share the underlying buffer between 'src' and 'dest'. Avoid
-modifying message content after a message has been copied with
-_zmq_msg_copy()_, doing so can result in undefined behaviour. If what you need
-is an actual hard copy, allocate a new message using _zmq_msg_init_size()_ and
-copy the message content using _memcpy()_.
-
-CAUTION: Never access 'zmq_msg_t' members directly, instead always use the
-_zmq_msg_ family of functions.
-
-
-RETURN VALUE
-------------
-The _zmq_msg_copy()_ function shall return zero if successful. Otherwise it
-shall return `-1` and set 'errno' to one of the values defined below.
-
-
-ERRORS
-------
-*EFAULT*::
-Invalid message.
-
-
-SEE ALSO
---------
-linkzmq:zmq_msg_move[3]
-linkzmq:zmq_msg_init[3]
-linkzmq:zmq_msg_init_size[3]
-linkzmq:zmq_msg_init_data[3]
-linkzmq:zmq_msg_close[3]
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_msg_data.txt b/doc/zmq_msg_data.txt
deleted file mode 100644
index cf2e2da..0000000
--- a/doc/zmq_msg_data.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-zmq_msg_data(3)
-===============
-
-
-NAME
-----
-zmq_msg_data - retrieve pointer to message content
-
-
-SYNOPSIS
---------
-*void *zmq_msg_data (zmq_msg_t '*msg');*
-
-
-DESCRIPTION
------------
-The _zmq_msg_data()_ function shall return a pointer to the message content of
-the message object referenced by 'msg'.
-
-CAUTION: Never access 'zmq_msg_t' members directly, instead always use the
-_zmq_msg_ family of functions.
-
-
-RETURN VALUE
-------------
-Upon successful completion, _zmq_msg_data()_ shall return a pointer to the
-message content.
-
-
-ERRORS
-------
-No errors are defined.
-
-
-SEE ALSO
---------
-linkzmq:zmq_msg_size[3]
-linkzmq:zmq_msg_init[3]
-linkzmq:zmq_msg_init_size[3]
-linkzmq:zmq_msg_init_data[3]
-linkzmq:zmq_msg_close[3]
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_msg_init.txt b/doc/zmq_msg_init.txt
deleted file mode 100644
index a46c759..0000000
--- a/doc/zmq_msg_init.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-zmq_msg_init(3)
-===============
-
-
-NAME
-----
-zmq_msg_init - initialise empty 0MQ message
-
-
-SYNOPSIS
---------
-*int zmq_msg_init (zmq_msg_t '*msg');*
-
-
-DESCRIPTION
------------
-The _zmq_msg_init()_ function shall initialise the message object referenced by
-'msg' to represent an empty message. This function is most useful when called
-before receiving a message with _zmq_recv()_.
-
-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_t' twice.
-
-
-RETURN VALUE
-------------
-The _zmq_msg_init()_ function shall return zero if successful. Otherwise it
-shall return `-1` and set 'errno' to one of the values defined below.
-
-
-ERRORS
-------
-No errors are defined.
-
-
-EXAMPLE
--------
-.Receiving a message from a socket
-----
-zmq_msg_t msg;
-rc = zmq_msg_init (&msg);
-assert (rc == 0);
-rc = zmq_recv (socket, &msg, 0);
-assert (rc == 0);
-----
-
-
-SEE ALSO
---------
-linkzmq:zmq_msg_init_size[3]
-linkzmq:zmq_msg_init_data[3]
-linkzmq:zmq_msg_close[3]
-linkzmq:zmq_msg_data[3]
-linkzmq:zmq_msg_size[3]
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_msg_init_data.txt b/doc/zmq_msg_init_data.txt
deleted file mode 100644
index d38dffb..0000000
--- a/doc/zmq_msg_init_data.txt
+++ /dev/null
@@ -1,85 +0,0 @@
-zmq_msg_init_data(3)
-====================
-
-
-NAME
-----
-zmq_msg_init_data - initialise 0MQ message from a supplied buffer
-
-
-SYNOPSIS
---------
-*typedef void (zmq_free_fn) (void '*data', void '*hint');*
-
-*int zmq_msg_init_data (zmq_msg_t '*msg', void '*data', size_t 'size', zmq_free_fn '*ffn', void '*hint');*
-
-
-DESCRIPTION
------------
-The _zmq_msg_init_data()_ function shall initialise the message object
-referenced by 'msg' to represent the content referenced by the buffer located
-at address 'data', 'size' bytes long. No copy of 'data' shall be performed and
-0MQ shall take ownership of the supplied buffer.
-
-If provided, the deallocation function 'ffn' shall be called once the data
-buffer is no longer required by 0MQ, with the 'data' and 'hint' arguments
-supplied to _zmq_msg_init_data()_.
-
-CAUTION: Never access 'zmq_msg_t' members directly, instead always use the
-_zmq_msg_ family of functions.
-
-CAUTION: The deallocation function 'ffn' needs to be thread-safe, since it
-will be called from an arbitrary thread.
-
-CAUTION: The functions _zmq_msg_init()_, _zmq_msg_init_data()_ and
-_zmq_msg_init_size()_ are mutually exclusive. Never initialize the same
-'zmq_msg_t' twice.
-
-
-RETURN VALUE
-------------
-The _zmq_msg_init_data()_ function shall return zero if successful. Otherwise
-it shall return `-1` and set 'errno' to one of the values defined below.
-
-
-ERRORS
-------
-*ENOMEM*::
-Insufficient storage space is available.
-
-
-
-EXAMPLE
--------
-.Initialising a message from a supplied buffer
-----
-void my_free (void *data, void *hint)
-{
- free (data);
-}
-
- /* ... */
-
-void *data = malloc (6);
-assert (data);
-memcpy (data, "ABCDEF", 6);
-zmq_msg_t msg;
-rc = zmq_msg_init_data (&msg, data, 6, my_free, NULL);
-assert (rc == 0);
-----
-
-
-SEE ALSO
---------
-linkzmq:zmq_msg_init_size[3]
-linkzmq:zmq_msg_init[3]
-linkzmq:zmq_msg_close[3]
-linkzmq:zmq_msg_data[3]
-linkzmq:zmq_msg_size[3]
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_msg_init_size.txt b/doc/zmq_msg_init_size.txt
deleted file mode 100644
index e8412ae..0000000
--- a/doc/zmq_msg_init_size.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-zmq_msg_init_size(3)
-====================
-
-
-NAME
-----
-zmq_msg_init_size - initialise 0MQ message of a specified size
-
-
-SYNOPSIS
---------
-*int zmq_msg_init_size (zmq_msg_t '*msg', size_t 'size');*
-
-
-DESCRIPTION
------------
-The _zmq_msg_init_size()_ function shall allocate any resources required to
-store a message 'size' bytes long and initialise the message object referenced
-by 'msg' to represent the newly allocated message.
-
-The implementation shall choose whether to store message content on the stack
-(small messages) or on the heap (large messages). For performance reasons
-_zmq_msg_init_size()_ shall not clear the message data.
-
-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_t' twice.
-
-
-RETURN VALUE
-------------
-The _zmq_msg_init_size()_ function shall return zero if successful. Otherwise
-it shall return `-1` and set 'errno' to one of the values defined below.
-
-
-ERRORS
-------
-*ENOMEM*::
-Insufficient storage space is available.
-
-
-SEE ALSO
---------
-linkzmq:zmq_msg_init_data[3]
-linkzmq:zmq_msg_init[3]
-linkzmq:zmq_msg_close[3]
-linkzmq:zmq_msg_data[3]
-linkzmq:zmq_msg_size[3]
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_msg_move.txt b/doc/zmq_msg_move.txt
deleted file mode 100644
index 4d28b8b..0000000
--- a/doc/zmq_msg_move.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-zmq_msg_move(3)
-===============
-
-
-NAME
-----
-zmq_msg_move - move content of a message to another message
-
-
-SYNOPSIS
---------
-*int zmq_msg_move (zmq_msg_t '*dest', zmq_msg_t '*src');*
-
-
-DESCRIPTION
------------
-The _zmq_msg_move()_ function shall move the content of the message object
-referenced by 'src' to the message object referenced by 'dest'. No actual
-copying of message content is performed, 'dest' is simply updated to reference
-the new content. 'src' becomes an empty message after calling _zmq_msg_move()_.
-The original content of 'dest', if any, shall be released.
-
-CAUTION: Never access 'zmq_msg_t' members directly, instead always use the
-_zmq_msg_ family of functions.
-
-
-RETURN VALUE
-------------
-The _zmq_msg_move()_ function shall return zero if successful. Otherwise it
-shall return `-1` and set 'errno' to one of the values defined below.
-
-
-ERRORS
-------
-*EFAULT*::
-Invalid message.
-
-
-SEE ALSO
---------
-linkzmq:zmq_msg_copy[3]
-linkzmq:zmq_msg_init[3]
-linkzmq:zmq_msg_init_size[3]
-linkzmq:zmq_msg_init_data[3]
-linkzmq:zmq_msg_close[3]
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_msg_size.txt b/doc/zmq_msg_size.txt
deleted file mode 100644
index 4fb3f10..0000000
--- a/doc/zmq_msg_size.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-zmq_msg_size(3)
-===============
-
-
-NAME
-----
-zmq_msg_size - retrieve message content size in bytes
-
-
-SYNOPSIS
---------
-*size_t zmq_msg_size (zmq_msg_t '*msg');*
-
-
-DESCRIPTION
------------
-The _zmq_msg_size()_ function shall return the size in bytes of the content of
-the message object referenced by 'msg'.
-
-CAUTION: Never access 'zmq_msg_t' members directly, instead always use the
-_zmq_msg_ family of functions.
-
-
-RETURN VALUE
-------------
-Upon successful completion, _zmq_msg_size()_ shall return the size of the
-message content in bytes.
-
-
-ERRORS
-------
-No errors are defined.
-
-
-SEE ALSO
---------
-linkzmq:zmq_msg_data[3]
-linkzmq:zmq_msg_init[3]
-linkzmq:zmq_msg_init_size[3]
-linkzmq:zmq_msg_init_data[3]
-linkzmq:zmq_msg_close[3]
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_poll.txt b/doc/zmq_poll.txt
deleted file mode 100644
index ccdbaea..0000000
--- a/doc/zmq_poll.txt
+++ /dev/null
@@ -1,129 +0,0 @@
-zmq_poll(3)
-===========
-
-
-NAME
-----
-zmq_poll - input/output multiplexing
-
-
-SYNOPSIS
---------
-
-*int zmq_poll (zmq_pollitem_t '*items', int 'nitems', long 'timeout');*
-
-
-DESCRIPTION
------------
-The _zmq_poll()_ function provides a mechanism for applications to multiplex
-input/output events in a level-triggered fashion over a set of sockets. Each
-member of the array pointed to by the 'items' argument is a *zmq_pollitem_t*
-structure. The 'nitems' argument specifies the number of items in the 'items'
-array. The *zmq_pollitem_t* structure is defined as follows:
-
-["literal", subs="quotes"]
-typedef struct
-{
- void '*socket';
- int 'fd';
- short 'events';
- short 'revents';
-} zmq_pollitem_t;
-
-For each *zmq_pollitem_t* item, _zmq_poll()_ shall examine either the 0MQ
-socket referenced by 'socket' *or* the standard socket specified by the file
-descriptor 'fd', for the event(s) specified in 'events'. If both 'socket' and
-'fd' are set in a single *zmq_pollitem_t*, the 0MQ socket referenced by
-'socket' shall take precedence and the value of 'fd' shall be ignored.
-
-For each *zmq_pollitem_t* item, _zmq_poll()_ shall first clear the 'revents'
-member, and then indicate any requested events that have occurred by setting the
-bit corresponding to the event condition in the 'revents' member.
-
-If none of the requested events have occurred on any *zmq_pollitem_t* item,
-_zmq_poll()_ shall wait 'timeout' milliseconds for an event to occur on
-any of the requested items. If the value of 'timeout' is `0`, _zmq_poll()_
-shall return immediately. If the value of 'timeout' is `-1`, _zmq_poll()_ shall
-block indefinitely until a requested event has occurred on at least one
-*zmq_pollitem_t*.
-
-The 'events' and 'revents' members of *zmq_pollitem_t* are bit masks constructed
-by OR'ing a combination of the following event flags:
-
-*ZMQ_POLLIN*::
-For 0MQ sockets, at least one message may be received from the 'socket' without
-blocking. For standard sockets this is equivalent to the 'POLLIN' flag of the
-_poll()_ system call and generally means that at least one byte of data may be
-read from 'fd' without blocking.
-
-*ZMQ_POLLOUT*::
-For 0MQ sockets, at least one message may be sent to the 'socket' without
-blocking. For standard sockets this is equivalent to the 'POLLOUT' flag of the
-_poll()_ system call and generally means that at least one byte of data may be
-written to 'fd' without blocking.
-
-*ZMQ_POLLERR*::
-For standard sockets, this flag is passed through _zmq_poll()_ to the
-underlying _poll()_ system call and generally means that some sort of error
-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()_.
-
-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.
-
-
-RETURN VALUE
-------------
-Upon successful completion, the _zmq_poll()_ function shall return the number
-of *zmq_pollitem_t* structures with events signaled in 'revents' or `0` if no
-events have been signaled. Upon failure, _zmq_poll()_ shall return `-1` and set
-'errno' to one of the values defined below.
-
-
-ERRORS
-------
-*ETERM*::
-At least one of the members of the 'items' array refers to a 'socket' whose
-associated 0MQ 'context' was terminated.
-*EFAULT*::
-The provided 'items' was not valid (NULL).
-*EINTR*::
-The operation was interrupted by delivery of a signal before any events were
-available.
-
-
-EXAMPLE
--------
-.Polling indefinitely for input events on both a 0MQ socket and a standard socket.
-----
-zmq_pollitem_t items [2];
-/* First item refers to 0MQ socket 'socket' */
-items[0].socket = socket;
-items[0].events = ZMQ_POLLIN;
-/* Second item refers to standard socket 'fd' */
-items[1].socket = NULL;
-items[1].fd = fd;
-items[1].events = ZMQ_POLLIN;
-/* Poll for events indefinitely */
-int rc = zmq_poll (items, 2, -1);
-assert (rc >= 0);
-/* Returned events will be stored in items[].revents */
-----
-
-
-SEE ALSO
---------
-linkzmq:zmq_socket[3]
-linkzmq:zmq_send[3]
-linkzmq:zmq_recv[3]
-linkzmq:zmq[7]
-
-Your operating system documentation for the _poll()_ system call.
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_strerror.txt b/doc/zmq_strerror.txt
deleted file mode 100644
index 8cfcccd..0000000
--- a/doc/zmq_strerror.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-zmq_strerror(3)
-===============
-
-
-NAME
-----
-zmq_strerror - get 0MQ error message string
-
-
-SYNOPSIS
---------
-*const char *zmq_strerror (int 'errnum');*
-
-
-DESCRIPTION
------------
-The _zmq_strerror()_ function shall return a pointer to an error message string
-corresponding to the error number specified by the 'errnum' argument. As 0MQ
-defines additional error numbers over and above those defined by the operating
-system, applications should use _zmq_strerror()_ in preference to the standard
-_strerror()_ function.
-
-
-RETURN VALUE
-------------
-The _zmq_strerror()_ function shall return a pointer to an error message
-string.
-
-
-ERRORS
-------
-No errors are defined.
-
-
-EXAMPLE
--------
-.Displaying an error message when a 0MQ context cannot be initialised
-----
-void *ctx = zmq_init (1, 1, 0);
-if (!ctx) {
- printf ("Error occurred during zmq_init(): %s\n", zmq_strerror (errno));
- abort ();
-}
-----
-
-
-SEE ALSO
---------
-linkzmq:zmq[7]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_term.txt b/doc/zmq_term.txt
deleted file mode 100644
index ba8098d..0000000
--- a/doc/zmq_term.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-zmq_term(3)
-===========
-
-
-NAME
-----
-zmq_term - terminate 0MQ context
-
-
-SYNOPSIS
---------
-*int zmq_term (void '*context');*
-
-
-DESCRIPTION
------------
-The _zmq_term()_ function shall terminate the 0MQ context 'context'.
-
-Context termination is performed in the following steps:
-
-1. Any blocking operations currently in progress on sockets open within
- 'context' shall return immediately with an error code of ETERM. With the
- 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_term()_ shall _block_ until the
- following conditions are satisfied:
-+
- * All sockets open within 'context' have been closed with _zmq_close()_.
-
- * For each socket within 'context', all messages sent by the application
- with _zmq_send()_ have either been physically transferred to a network
- peer, or the socket's linger period set with the _ZMQ_LINGER_ socket
- option has expired.
-
-For further details regarding socket linger behaviour refer to the _ZMQ_LINGER_
-option in linkzmq:zmq_setsockopt[3].
-
-
-RETURN VALUE
-------------
-The _zmq_term()_ function shall return zero if successful. Otherwise it shall
-return `-1` and set 'errno' to one of the values defined below.
-
-
-ERRORS
-------
-*EFAULT*::
-The provided 'context' was invalid.
-*EINTR*::
-Termination was interrupted by a signal. It can be restarted if needed.
-
-
-SEE ALSO
---------
-linkzmq:zmq[7]
-linkzmq:zmq_init[3]
-linkzmq:zmq_close[3]
-linkzmq:zmq_setsockopt[3]
-
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/doc/zmq_version.txt b/doc/zmq_version.txt
deleted file mode 100644
index ef1388e..0000000
--- a/doc/zmq_version.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-zmq_version(3)
-==============
-
-
-NAME
-----
-zmq_version - report 0MQ library version
-
-
-SYNOPSIS
---------
-*void zmq_version (int '*major', int '*minor', int '*patch');*
-
-
-DESCRIPTION
------------
-The _zmq_version()_ function shall fill in the integer variables pointed to by
-the 'major', 'minor' and 'patch' arguments with the major, minor and patch level
-components of the 0MQ library version.
-
-This functionality is intended for applications or language bindings
-dynamically linking to the 0MQ library that wish to determine the actual
-version of the 0MQ library they are using.
-
-
-RETURN VALUE
-------------
-There is no return value.
-
-
-ERRORS
-------
-No errors are defined.
-
-
-EXAMPLE
--------
-.Printing out the version of the 0MQ library
-----
-int major, minor, patch;
-zmq_version (&major, &minor, &patch);
-printf ("Current 0MQ version is %d.%d.%d\n", major, minor, patch);
-----
-
-
-SEE ALSO
---------
-linkzmq:zmq[7]
-
-AUTHORS
--------
-The 0MQ documentation was written by Martin Sustrik <sustrik@250bpm.com> and
-Martin Lucina <martin@lucina.net>.
diff --git a/include/xs.h b/include/xs.h
new file mode 100644
index 0000000..05d98ab
--- /dev/null
+++ b/include/xs.h
@@ -0,0 +1,246 @@
+/*
+ Copyright (c) 2009-2012 250bpm s.r.o.
+ Copyright (c) 2007-2010 iMatix Corporation
+ Copyright (c) 2011 VMware, Inc.
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of Crossroads project.
+
+ Crossroads 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.
+
+ Crossroads 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 __XS_H_INCLUDED__
+#define __XS_H_INCLUDED__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <errno.h>
+#include <stddef.h>
+#if defined _WIN32
+#include <winsock2.h>
+#endif
+
+/* Handle DSO symbol visibility */
+#if defined _WIN32
+# if defined DLL_EXPORT
+# define XS_EXPORT __declspec(dllexport)
+# else
+# define XS_EXPORT __declspec(dllimport)
+# endif
+#else
+# if defined __SUNPRO_C || defined __SUNPRO_CC
+# define XS_EXPORT __global
+# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
+# define XS_EXPORT __attribute__ ((visibility("default")))
+# else
+# define XS_EXPORT
+# endif
+#endif
+
+/******************************************************************************/
+/* Crossroads versioning support. */
+/******************************************************************************/
+
+/* Version macros for compile-time API version detection */
+#define XS_VERSION_MAJOR 0
+#define XS_VERSION_MINOR 0
+#define XS_VERSION_PATCH 0
+
+#define XS_MAKE_VERSION(major, minor, patch) \
+ ((major) * 10000 + (minor) * 100 + (patch))
+#define XS_VERSION \
+ XS_MAKE_VERSION(XS_VERSION_MAJOR, XS_VERSION_MINOR, XS_VERSION_PATCH)
+
+/* Run-time API version detection */
+XS_EXPORT void xs_version (int *major, int *minor, int *patch);
+
+/******************************************************************************/
+/* Crossroads errors. */
+/******************************************************************************/
+
+/* A number random enough not to collide with different errno ranges on */
+/* different OSes. The assumption is that error_t is at least 32-bit type. */
+#define XS_HAUSNUMERO 156384712
+
+/* On Windows platform some of the standard POSIX errnos are not defined. */
+#ifndef ENOTSUP
+#define ENOTSUP (XS_HAUSNUMERO + 1)
+#endif
+#ifndef EPROTONOSUPPORT
+#define EPROTONOSUPPORT (XS_HAUSNUMERO + 2)
+#endif
+#ifndef ENOBUFS
+#define ENOBUFS (XS_HAUSNUMERO + 3)
+#endif
+#ifndef ENETDOWN
+#define ENETDOWN (XS_HAUSNUMERO + 4)
+#endif
+#ifndef EADDRINUSE
+#define EADDRINUSE (XS_HAUSNUMERO + 5)
+#endif
+#ifndef EADDRNOTAVAIL
+#define EADDRNOTAVAIL (XS_HAUSNUMERO + 6)
+#endif
+#ifndef ECONNREFUSED
+#define ECONNREFUSED (XS_HAUSNUMERO + 7)
+#endif
+#ifndef EINPROGRESS
+#define EINPROGRESS (XS_HAUSNUMERO + 8)
+#endif
+#ifndef ENOTSOCK
+#define ENOTSOCK (XS_HAUSNUMERO + 9)
+#endif
+#ifndef EAFNOSUPPORT
+#define EAFNOSUPPORT (XS_HAUSNUMERO + 10)
+#endif
+
+/* Native Crossroads error codes. */
+#define EFSM (XS_HAUSNUMERO + 51)
+#define ENOCOMPATPROTO (XS_HAUSNUMERO + 52)
+#define ETERM (XS_HAUSNUMERO + 53)
+#define EMTHREAD (XS_HAUSNUMERO + 54)
+
+/* This function retrieves the errno as it is known to Crossroads library. */
+/* The goal of this function is to make the code 100% portable, including */
+/* where Crossroads are compiled with certain CRT library (on Windows) is */
+/* linked to an application that uses different CRT library. */
+XS_EXPORT int xs_errno (void);
+
+/* Resolves system errors and Crossroads errors to human-readable string. */
+XS_EXPORT const char *xs_strerror (int errnum);
+
+/******************************************************************************/
+/* Crossroads message definition. */
+/******************************************************************************/
+
+typedef struct {unsigned char _ [32];} xs_msg_t;
+
+typedef void (xs_free_fn) (void *data, void *hint);
+
+XS_EXPORT int xs_msg_init (xs_msg_t *msg);
+XS_EXPORT int xs_msg_init_size (xs_msg_t *msg, size_t size);
+XS_EXPORT int xs_msg_init_data (xs_msg_t *msg, void *data,
+ size_t size, xs_free_fn *ffn, void *hint);
+XS_EXPORT int xs_msg_close (xs_msg_t *msg);
+XS_EXPORT int xs_msg_move (xs_msg_t *dest, xs_msg_t *src);
+XS_EXPORT int xs_msg_copy (xs_msg_t *dest, xs_msg_t *src);
+XS_EXPORT void *xs_msg_data (xs_msg_t *msg);
+XS_EXPORT size_t xs_msg_size (xs_msg_t *msg);
+XS_EXPORT int xs_getmsgopt (xs_msg_t *msg, int option, void *optval,
+ size_t *optvallen);
+
+/******************************************************************************/
+/* Crossroads infrastructure initialisation & termination. */
+/******************************************************************************/
+
+XS_EXPORT void *xs_init (int io_threads);
+XS_EXPORT int xs_term (void *context);
+
+/******************************************************************************/
+/* Crossroads socket definition. */
+/******************************************************************************/
+
+/* Socket types. */
+#define XS_PAIR 0
+#define XS_PUB 1
+#define XS_SUB 2
+#define XS_REQ 3
+#define XS_REP 4
+#define XS_XREQ 5
+#define XS_XREP 6
+#define XS_PULL 7
+#define XS_PUSH 8
+#define XS_XPUB 9
+#define XS_XSUB 10
+
+#define XS_ROUTER XS_XREP
+#define XS_DEALER XS_XREQ
+
+/* Socket options. */
+#define XS_AFFINITY 4
+#define XS_IDENTITY 5
+#define XS_SUBSCRIBE 6
+#define XS_UNSUBSCRIBE 7
+#define XS_RATE 8
+#define XS_RECOVERY_IVL 9
+#define XS_SNDBUF 11
+#define XS_RCVBUF 12
+#define XS_RCVMORE 13
+#define XS_FD 14
+#define XS_EVENTS 15
+#define XS_TYPE 16
+#define XS_LINGER 17
+#define XS_RECONNECT_IVL 18
+#define XS_BACKLOG 19
+#define XS_RECONNECT_IVL_MAX 21
+#define XS_MAXMSGSIZE 22
+#define XS_SNDHWM 23
+#define XS_RCVHWM 24
+#define XS_MULTICAST_HOPS 25
+#define XS_RCVTIMEO 27
+#define XS_SNDTIMEO 28
+#define XS_IPV4ONLY 31
+
+/* Message options */
+#define XS_MORE 1
+
+/* Send/recv options. */
+#define XS_DONTWAIT 1
+#define XS_SNDMORE 2
+
+XS_EXPORT void *xs_socket (void *context, int type);
+XS_EXPORT int xs_close (void *s);
+XS_EXPORT int xs_setsockopt (void *s, int option, const void *optval,
+ size_t optvallen);
+XS_EXPORT int xs_getsockopt (void *s, int option, void *optval,
+ size_t *optvallen);
+XS_EXPORT int xs_bind (void *s, const char *addr);
+XS_EXPORT int xs_connect (void *s, const char *addr);
+XS_EXPORT int xs_send (void *s, const void *buf, size_t len, int flags);
+XS_EXPORT int xs_recv (void *s, void *buf, size_t len, int flags);
+XS_EXPORT int xs_sendmsg (void *s, xs_msg_t *msg, int flags);
+XS_EXPORT int xs_recvmsg (void *s, xs_msg_t *msg, int flags);
+
+/******************************************************************************/
+/* I/O multiplexing. */
+/******************************************************************************/
+
+#define XS_POLLIN 1
+#define XS_POLLOUT 2
+#define XS_POLLERR 4
+
+typedef struct
+{
+ void *socket;
+#if defined _WIN32
+ SOCKET fd;
+#else
+ int fd;
+#endif
+ short events;
+ short revents;
+} xs_pollitem_t;
+
+XS_EXPORT int xs_poll (xs_pollitem_t *items, int nitems, long timeout);
+
+#undef XS_EXPORT
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/zmq_utils.h b/include/xs_utils.h
index 341d639..c1171fe 100644
--- a/include/zmq_utils.h
+++ b/include/xs_utils.h
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,8 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_UTILS_H_INCLUDED__
-#define __ZMQ_UTILS_H_INCLUDED__
+#ifndef __XS_UTILS_H_INCLUDED__
+#define __XS_UTILS_H_INCLUDED__
#ifdef __cplusplus
extern "C" {
@@ -28,17 +28,17 @@ extern "C" {
/* Handle DSO symbol visibility */
#if defined _WIN32
# if defined DLL_EXPORT
-# define ZMQ_EXPORT __declspec(dllexport)
+# define XS_EXPORT __declspec(dllexport)
# else
-# define ZMQ_EXPORT __declspec(dllimport)
+# define XS_EXPORT __declspec(dllimport)
# endif
#else
# if defined __SUNPRO_C || defined __SUNPRO_CC
-# define ZMQ_EXPORT __global
+# define XS_EXPORT __global
# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
-# define ZMQ_EXPORT __attribute__ ((visibility("default")))
+# define XS_EXPORT __attribute__ ((visibility("default")))
# else
-# define ZMQ_EXPORT
+# define XS_EXPORT
# endif
#endif
@@ -46,16 +46,16 @@ extern "C" {
/* about minutiae of time-related functions on different OS platforms. */
/* Starts the stopwatch. Returns the handle to the watch. */
-ZMQ_EXPORT void *zmq_stopwatch_start (void);
+XS_EXPORT void *xs_stopwatch_start (void);
/* Stops the stopwatch. Returns the number of microseconds elapsed since */
/* the stopwatch was started. */
-ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_);
+XS_EXPORT unsigned long xs_stopwatch_stop (void *watch_);
/* Sleeps for specified number of seconds. */
-ZMQ_EXPORT void zmq_sleep (int seconds_);
+XS_EXPORT void xs_sleep (int seconds_);
-#undef ZMQ_EXPORT
+#undef XS_EXPORT
#ifdef __cplusplus
}
diff --git a/include/zmq.h b/include/zmq.h
deleted file mode 100644
index 5dc1146..0000000
--- a/include/zmq.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- Copyright (c) 2009-2011 250bpm s.r.o.
- Copyright (c) 2007-2010 iMatix Corporation
- Copyright (c) 2011 VMware, Inc.
- Copyright (c) 2007-2011 Other 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_H_INCLUDED__
-#define __ZMQ_H_INCLUDED__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <errno.h>
-#include <stddef.h>
-#if defined _WIN32
-#include <winsock2.h>
-#endif
-
-/* Handle DSO symbol visibility */
-#if defined _WIN32
-# if defined DLL_EXPORT
-# define ZMQ_EXPORT __declspec(dllexport)
-# else
-# define ZMQ_EXPORT __declspec(dllimport)
-# endif
-#else
-# if defined __SUNPRO_C || defined __SUNPRO_CC
-# define ZMQ_EXPORT __global
-# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
-# define ZMQ_EXPORT __attribute__ ((visibility("default")))
-# else
-# define ZMQ_EXPORT
-# endif
-#endif
-
-/******************************************************************************/
-/* 0MQ versioning support. */
-/******************************************************************************/
-
-/* Version macros for compile-time API version detection */
-#define ZMQ_VERSION_MAJOR 3
-#define ZMQ_VERSION_MINOR 1
-#define ZMQ_VERSION_PATCH 1
-
-#define ZMQ_MAKE_VERSION(major, minor, patch) \
- ((major) * 10000 + (minor) * 100 + (patch))
-#define ZMQ_VERSION \
- ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH)
-
-/* Run-time API version detection */
-ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch);
-
-/******************************************************************************/
-/* 0MQ errors. */
-/******************************************************************************/
-
-/* A number random enough not to collide with different errno ranges on */
-/* different OSes. The assumption is that error_t is at least 32-bit type. */
-#define ZMQ_HAUSNUMERO 156384712
-
-/* On Windows platform some of the standard POSIX errnos are not defined. */
-#ifndef ENOTSUP
-#define ENOTSUP (ZMQ_HAUSNUMERO + 1)
-#endif
-#ifndef EPROTONOSUPPORT
-#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2)
-#endif
-#ifndef ENOBUFS
-#define ENOBUFS (ZMQ_HAUSNUMERO + 3)
-#endif
-#ifndef ENETDOWN
-#define ENETDOWN (ZMQ_HAUSNUMERO + 4)
-#endif
-#ifndef EADDRINUSE
-#define EADDRINUSE (ZMQ_HAUSNUMERO + 5)
-#endif
-#ifndef EADDRNOTAVAIL
-#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6)
-#endif
-#ifndef ECONNREFUSED
-#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7)
-#endif
-#ifndef EINPROGRESS
-#define EINPROGRESS (ZMQ_HAUSNUMERO + 8)
-#endif
-#ifndef ENOTSOCK
-#define ENOTSOCK (ZMQ_HAUSNUMERO + 9)
-#endif
-#ifndef EAFNOSUPPORT
-#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 10)
-#endif
-
-/* Native 0MQ error codes. */
-#define EFSM (ZMQ_HAUSNUMERO + 51)
-#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52)
-#define ETERM (ZMQ_HAUSNUMERO + 53)
-#define EMTHREAD (ZMQ_HAUSNUMERO + 54)
-
-/* This function retrieves the errno as it is known to 0MQ library. The goal */
-/* of this function is to make the code 100% portable, including where 0MQ */
-/* compiled with certain CRT library (on Windows) is linked to an */
-/* application that uses different CRT library. */
-ZMQ_EXPORT int zmq_errno (void);
-
-/* Resolves system errors and 0MQ errors to human-readable string. */
-ZMQ_EXPORT const char *zmq_strerror (int errnum);
-
-/******************************************************************************/
-/* 0MQ message definition. */
-/******************************************************************************/
-
-typedef struct {unsigned char _ [32];} zmq_msg_t;
-
-typedef void (zmq_free_fn) (void *data, void *hint);
-
-ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg);
-ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size);
-ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data,
- size_t size, zmq_free_fn *ffn, void *hint);
-ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg);
-ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src);
-ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src);
-ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg);
-ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg);
-ZMQ_EXPORT int zmq_getmsgopt (zmq_msg_t *msg, int option, void *optval,
- size_t *optvallen);
-
-/******************************************************************************/
-/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */
-/******************************************************************************/
-
-ZMQ_EXPORT void *zmq_init (int io_threads);
-ZMQ_EXPORT int zmq_term (void *context);
-
-/******************************************************************************/
-/* 0MQ socket definition. */
-/******************************************************************************/
-
-/* Socket types. */
-#define ZMQ_PAIR 0
-#define ZMQ_PUB 1
-#define ZMQ_SUB 2
-#define ZMQ_REQ 3
-#define ZMQ_REP 4
-#define ZMQ_XREQ 5
-#define ZMQ_XREP 6
-#define ZMQ_PULL 7
-#define ZMQ_PUSH 8
-#define ZMQ_XPUB 9
-#define ZMQ_XSUB 10
-
-#define ZMQ_ROUTER ZMQ_XREP
-#define ZMQ_DEALER ZMQ_XREQ
-
-/* Socket options. */
-#define ZMQ_AFFINITY 4
-#define ZMQ_IDENTITY 5
-#define ZMQ_SUBSCRIBE 6
-#define ZMQ_UNSUBSCRIBE 7
-#define ZMQ_RATE 8
-#define ZMQ_RECOVERY_IVL 9
-#define ZMQ_SNDBUF 11
-#define ZMQ_RCVBUF 12
-#define ZMQ_RCVMORE 13
-#define ZMQ_FD 14
-#define ZMQ_EVENTS 15
-#define ZMQ_TYPE 16
-#define ZMQ_LINGER 17
-#define ZMQ_RECONNECT_IVL 18
-#define ZMQ_BACKLOG 19
-#define ZMQ_RECONNECT_IVL_MAX 21
-#define ZMQ_MAXMSGSIZE 22
-#define ZMQ_SNDHWM 23
-#define ZMQ_RCVHWM 24
-#define ZMQ_MULTICAST_HOPS 25
-#define ZMQ_RCVTIMEO 27
-#define ZMQ_SNDTIMEO 28
-#define ZMQ_IPV4ONLY 31
-
-/* Message options */
-#define ZMQ_MORE 1
-
-/* Send/recv options. */
-#define ZMQ_DONTWAIT 1
-#define ZMQ_SNDMORE 2
-
-ZMQ_EXPORT void *zmq_socket (void *context, int type);
-ZMQ_EXPORT int zmq_close (void *s);
-ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval,
- size_t optvallen);
-ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval,
- size_t *optvallen);
-ZMQ_EXPORT int zmq_bind (void *s, const char *addr);
-ZMQ_EXPORT int zmq_connect (void *s, const char *addr);
-ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags);
-ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags);
-ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags);
-ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags);
-
-/******************************************************************************/
-/* I/O multiplexing. */
-/******************************************************************************/
-
-#define ZMQ_POLLIN 1
-#define ZMQ_POLLOUT 2
-#define ZMQ_POLLERR 4
-
-typedef struct
-{
- void *socket;
-#if defined _WIN32
- SOCKET fd;
-#else
- int fd;
-#endif
- short events;
- short revents;
-} zmq_pollitem_t;
-
-ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout);
-
-#undef ZMQ_EXPORT
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/perf/Makefile.am b/perf/Makefile.am
index 4053ba5..3a4f629 100644
--- a/perf/Makefile.am
+++ b/perf/Makefile.am
@@ -3,20 +3,20 @@ INCLUDES = -I$(top_builddir)/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_LDADD = $(top_builddir)/src/libxs.la
local_lat_SOURCES = local_lat.cpp
-remote_lat_LDADD = $(top_builddir)/src/libzmq.la
+remote_lat_LDADD = $(top_builddir)/src/libxs.la
remote_lat_SOURCES = remote_lat.cpp
-local_thr_LDADD = $(top_builddir)/src/libzmq.la
+local_thr_LDADD = $(top_builddir)/src/libxs.la
local_thr_SOURCES = local_thr.cpp
-remote_thr_LDADD = $(top_builddir)/src/libzmq.la
+remote_thr_LDADD = $(top_builddir)/src/libxs.la
remote_thr_SOURCES = remote_thr.cpp
-inproc_lat_LDADD = $(top_builddir)/src/libzmq.la
+inproc_lat_LDADD = $(top_builddir)/src/libxs.la
inproc_lat_SOURCES = inproc_lat.cpp
-inproc_thr_LDADD = $(top_builddir)/src/libzmq.la
+inproc_thr_LDADD = $(top_builddir)/src/libxs.la
inproc_thr_SOURCES = inproc_thr.cpp
diff --git a/perf/inproc_lat.cpp b/perf/inproc_lat.cpp
index 5b6a830..d511706 100644
--- a/perf/inproc_lat.cpp
+++ b/perf/inproc_lat.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
-#include "../include/zmq_utils.h"
+#include "../include/xs.h"
+#include "../include/xs_utils.h"
#include <stdio.h>
#include <stdlib.h>
@@ -28,7 +28,7 @@
#include "../src/platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include <windows.h>
#include <process.h>
#else
@@ -38,7 +38,7 @@
static size_t message_size;
static int roundtrip_count;
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
static unsigned int __stdcall worker (void *ctx_)
#else
static void *worker (void *ctx_)
@@ -47,52 +47,52 @@ static void *worker (void *ctx_)
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ xs_msg_t msg;
- s = zmq_socket (ctx_, ZMQ_REP);
+ s = xs_socket (ctx_, XS_REP);
if (!s) {
- printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
+ printf ("error in xs_socket: %s\n", xs_strerror (errno));
exit (1);
}
- rc = zmq_connect (s, "inproc://lat_test");
+ rc = xs_connect (s, "inproc://lat_test");
if (rc != 0) {
- printf ("error in zmq_connect: %s\n", zmq_strerror (errno));
+ printf ("error in xs_connect: %s\n", xs_strerror (errno));
exit (1);
}
- rc = zmq_msg_init (&msg);
+ rc = xs_msg_init (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_init: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_init: %s\n", xs_strerror (errno));
exit (1);
}
for (i = 0; i != roundtrip_count; i++) {
- rc = zmq_recvmsg (s, &msg, 0);
+ rc = xs_recvmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_recvmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_recvmsg: %s\n", xs_strerror (errno));
exit (1);
}
- rc = zmq_sendmsg (s, &msg, 0);
+ rc = xs_sendmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_sendmsg: %s\n", xs_strerror (errno));
exit (1);
}
}
- rc = zmq_msg_close (&msg);
+ rc = xs_msg_close (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_close: %s\n", xs_strerror (errno));
exit (1);
}
- rc = zmq_close (s);
+ rc = xs_close (s);
if (rc != 0) {
- printf ("error in zmq_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_close: %s\n", xs_strerror (errno));
exit (1);
}
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
return 0;
#else
return NULL;
@@ -101,7 +101,7 @@ static void *worker (void *ctx_)
int main (int argc, char *argv [])
{
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
HANDLE local_thread;
#else
pthread_t local_thread;
@@ -110,7 +110,7 @@ int main (int argc, char *argv [])
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ xs_msg_t msg;
void *watch;
unsigned long elapsed;
double latency;
@@ -123,25 +123,25 @@ int main (int argc, char *argv [])
message_size = atoi (argv [1]);
roundtrip_count = atoi (argv [2]);
- ctx = zmq_init (1);
+ ctx = xs_init (1);
if (!ctx) {
- printf ("error in zmq_init: %s\n", zmq_strerror (errno));
+ printf ("error in xs_init: %s\n", xs_strerror (errno));
return -1;
}
- s = zmq_socket (ctx, ZMQ_REQ);
+ s = xs_socket (ctx, XS_REQ);
if (!s) {
- printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
+ printf ("error in xs_socket: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_bind (s, "inproc://lat_test");
+ rc = xs_bind (s, "inproc://lat_test");
if (rc != 0) {
- printf ("error in zmq_bind: %s\n", zmq_strerror (errno));
+ printf ("error in xs_bind: %s\n", xs_strerror (errno));
return -1;
}
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
local_thread = (HANDLE) _beginthreadex (NULL, 0,
worker, ctx, 0 , NULL);
if (local_thread == 0) {
@@ -151,51 +151,51 @@ int main (int argc, char *argv [])
#else
rc = pthread_create (&local_thread, NULL, worker, ctx);
if (rc != 0) {
- printf ("error in pthread_create: %s\n", zmq_strerror (rc));
+ printf ("error in pthread_create: %s\n", xs_strerror (rc));
return -1;
}
#endif
- rc = zmq_msg_init_size (&msg, message_size);
+ rc = xs_msg_init_size (&msg, message_size);
if (rc != 0) {
- printf ("error in zmq_msg_init_size: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_init_size: %s\n", xs_strerror (errno));
return -1;
}
- memset (zmq_msg_data (&msg), 0, message_size);
+ memset (xs_msg_data (&msg), 0, message_size);
printf ("message size: %d [B]\n", (int) message_size);
printf ("roundtrip count: %d\n", (int) roundtrip_count);
- watch = zmq_stopwatch_start ();
+ watch = xs_stopwatch_start ();
for (i = 0; i != roundtrip_count; i++) {
- rc = zmq_sendmsg (s, &msg, 0);
+ rc = xs_sendmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_sendmsg: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_recvmsg (s, &msg, 0);
+ rc = xs_recvmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_recvmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_recvmsg: %s\n", xs_strerror (errno));
return -1;
}
- if (zmq_msg_size (&msg) != message_size) {
+ if (xs_msg_size (&msg) != message_size) {
printf ("message of incorrect size received\n");
return -1;
}
}
- elapsed = zmq_stopwatch_stop (watch);
+ elapsed = xs_stopwatch_stop (watch);
- rc = zmq_msg_close (&msg);
+ rc = xs_msg_close (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_close: %s\n", xs_strerror (errno));
return -1;
}
latency = (double) elapsed / (roundtrip_count * 2);
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
DWORD rc2 = WaitForSingleObject (local_thread, INFINITE);
if (rc2 == WAIT_FAILED) {
printf ("error in WaitForSingleObject\n");
@@ -209,22 +209,22 @@ int main (int argc, char *argv [])
#else
rc = pthread_join (local_thread, NULL);
if (rc != 0) {
- printf ("error in pthread_join: %s\n", zmq_strerror (rc));
+ printf ("error in pthread_join: %s\n", xs_strerror (rc));
return -1;
}
#endif
printf ("average latency: %.3f [us]\n", (double) latency);
- rc = zmq_close (s);
+ rc = xs_close (s);
if (rc != 0) {
- printf ("error in zmq_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_close: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
if (rc != 0) {
- printf ("error in zmq_term: %s\n", zmq_strerror (errno));
+ printf ("error in xs_term: %s\n", xs_strerror (errno));
return -1;
}
diff --git a/perf/inproc_thr.cpp b/perf/inproc_thr.cpp
index b4cadfc..a103833 100644
--- a/perf/inproc_thr.cpp
+++ b/perf/inproc_thr.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
-#include "../include/zmq_utils.h"
+#include "../include/xs.h"
+#include "../include/xs_utils.h"
#include <stdio.h>
#include <stdlib.h>
@@ -28,7 +28,7 @@
#include "../src/platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include <windows.h>
#include <process.h>
#else
@@ -38,7 +38,7 @@
static int message_count;
static size_t message_size;
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
static unsigned int __stdcall worker (void *ctx_)
#else
static void *worker (void *ctx_)
@@ -47,50 +47,50 @@ static void *worker (void *ctx_)
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ xs_msg_t msg;
- s = zmq_socket (ctx_, ZMQ_PUSH);
+ s = xs_socket (ctx_, XS_PUSH);
if (!s) {
- printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
+ printf ("error in xs_socket: %s\n", xs_strerror (errno));
exit (1);
}
- rc = zmq_connect (s, "inproc://thr_test");
+ rc = xs_connect (s, "inproc://thr_test");
if (rc != 0) {
- printf ("error in zmq_connect: %s\n", zmq_strerror (errno));
+ printf ("error in xs_connect: %s\n", xs_strerror (errno));
exit (1);
}
for (i = 0; i != message_count; i++) {
- rc = zmq_msg_init_size (&msg, message_size);
+ rc = xs_msg_init_size (&msg, message_size);
if (rc != 0) {
- printf ("error in zmq_msg_init_size: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_init_size: %s\n", xs_strerror (errno));
exit (1);
}
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
- memset (zmq_msg_data (&msg), 0, message_size);
+#if defined XS_MAKE_VALGRIND_HAPPY
+ memset (xs_msg_data (&msg), 0, message_size);
#endif
- rc = zmq_sendmsg (s, &msg, 0);
+ rc = xs_sendmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_sendmsg: %s\n", xs_strerror (errno));
exit (1);
}
- rc = zmq_msg_close (&msg);
+ rc = xs_msg_close (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_close: %s\n", xs_strerror (errno));
exit (1);
}
}
- rc = zmq_close (s);
+ rc = xs_close (s);
if (rc != 0) {
- printf ("error in zmq_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_close: %s\n", xs_strerror (errno));
exit (1);
}
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
return 0;
#else
return NULL;
@@ -99,7 +99,7 @@ static void *worker (void *ctx_)
int main (int argc, char *argv [])
{
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
HANDLE local_thread;
#else
pthread_t local_thread;
@@ -108,7 +108,7 @@ int main (int argc, char *argv [])
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ xs_msg_t msg;
void *watch;
unsigned long elapsed;
unsigned long throughput;
@@ -122,25 +122,25 @@ int main (int argc, char *argv [])
message_size = atoi (argv [1]);
message_count = atoi (argv [2]);
- ctx = zmq_init (1);
+ ctx = xs_init (1);
if (!ctx) {
- printf ("error in zmq_init: %s\n", zmq_strerror (errno));
+ printf ("error in xs_init: %s\n", xs_strerror (errno));
return -1;
}
- s = zmq_socket (ctx, ZMQ_PULL);
+ s = xs_socket (ctx, XS_PULL);
if (!s) {
- printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
+ printf ("error in xs_socket: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_bind (s, "inproc://thr_test");
+ rc = xs_bind (s, "inproc://thr_test");
if (rc != 0) {
- printf ("error in zmq_bind: %s\n", zmq_strerror (errno));
+ printf ("error in xs_bind: %s\n", xs_strerror (errno));
return -1;
}
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
local_thread = (HANDLE) _beginthreadex (NULL, 0,
worker, ctx, 0 , NULL);
if (local_thread == 0) {
@@ -150,55 +150,55 @@ int main (int argc, char *argv [])
#else
rc = pthread_create (&local_thread, NULL, worker, ctx);
if (rc != 0) {
- printf ("error in pthread_create: %s\n", zmq_strerror (rc));
+ printf ("error in pthread_create: %s\n", xs_strerror (rc));
return -1;
}
#endif
- rc = zmq_msg_init (&msg);
+ rc = xs_msg_init (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_init: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_init: %s\n", xs_strerror (errno));
return -1;
}
printf ("message size: %d [B]\n", (int) message_size);
printf ("message count: %d\n", (int) message_count);
- rc = zmq_recvmsg (s, &msg, 0);
+ rc = xs_recvmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_recvmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_recvmsg: %s\n", xs_strerror (errno));
return -1;
}
- if (zmq_msg_size (&msg) != message_size) {
+ if (xs_msg_size (&msg) != message_size) {
printf ("message of incorrect size received\n");
return -1;
}
- watch = zmq_stopwatch_start ();
+ watch = xs_stopwatch_start ();
for (i = 0; i != message_count - 1; i++) {
- rc = zmq_recvmsg (s, &msg, 0);
+ rc = xs_recvmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_recvmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_recvmsg: %s\n", xs_strerror (errno));
return -1;
}
- if (zmq_msg_size (&msg) != message_size) {
+ if (xs_msg_size (&msg) != message_size) {
printf ("message of incorrect size received\n");
return -1;
}
}
- elapsed = zmq_stopwatch_stop (watch);
+ elapsed = xs_stopwatch_stop (watch);
if (elapsed == 0)
elapsed = 1;
- rc = zmq_msg_close (&msg);
+ rc = xs_msg_close (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_close: %s\n", xs_strerror (errno));
return -1;
}
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
DWORD rc2 = WaitForSingleObject (local_thread, INFINITE);
if (rc2 == WAIT_FAILED) {
printf ("error in WaitForSingleObject\n");
@@ -212,20 +212,20 @@ int main (int argc, char *argv [])
#else
rc = pthread_join (local_thread, NULL);
if (rc != 0) {
- printf ("error in pthread_join: %s\n", zmq_strerror (rc));
+ printf ("error in pthread_join: %s\n", xs_strerror (rc));
return -1;
}
#endif
- rc = zmq_close (s);
+ rc = xs_close (s);
if (rc != 0) {
- printf ("error in zmq_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_close: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
if (rc != 0) {
- printf ("error in zmq_term: %s\n", zmq_strerror (errno));
+ printf ("error in xs_term: %s\n", xs_strerror (errno));
return -1;
}
diff --git a/perf/local_lat.cpp b/perf/local_lat.cpp
index 714b8c0..7287453 100644
--- a/perf/local_lat.cpp
+++ b/perf/local_lat.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
-#include "../include/zmq_utils.h"
+#include "../include/xs.h"
+#include "../include/xs_utils.h"
#include <stdio.h>
#include <stdlib.h>
@@ -33,7 +33,7 @@ int main (int argc, char *argv [])
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ xs_msg_t msg;
if (argc != 4) {
printf ("usage: local_lat <bind-to> <message-size> "
@@ -44,64 +44,64 @@ int main (int argc, char *argv [])
message_size = atoi (argv [2]);
roundtrip_count = atoi (argv [3]);
- ctx = zmq_init (1);
+ ctx = xs_init (1);
if (!ctx) {
- printf ("error in zmq_init: %s\n", zmq_strerror (errno));
+ printf ("error in xs_init: %s\n", xs_strerror (errno));
return -1;
}
- s = zmq_socket (ctx, ZMQ_REP);
+ s = xs_socket (ctx, XS_REP);
if (!s) {
- printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
+ printf ("error in xs_socket: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_bind (s, bind_to);
+ rc = xs_bind (s, bind_to);
if (rc != 0) {
- printf ("error in zmq_bind: %s\n", zmq_strerror (errno));
+ printf ("error in xs_bind: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_msg_init (&msg);
+ rc = xs_msg_init (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_init: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_init: %s\n", xs_strerror (errno));
return -1;
}
for (i = 0; i != roundtrip_count; i++) {
- rc = zmq_recvmsg (s, &msg, 0);
+ rc = xs_recvmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_recvmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_recvmsg: %s\n", xs_strerror (errno));
return -1;
}
- if (zmq_msg_size (&msg) != message_size) {
+ if (xs_msg_size (&msg) != message_size) {
printf ("message of incorrect size received\n");
return -1;
}
- rc = zmq_sendmsg (s, &msg, 0);
+ rc = xs_sendmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_sendmsg: %s\n", xs_strerror (errno));
return -1;
}
}
- rc = zmq_msg_close (&msg);
+ rc = xs_msg_close (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_close: %s\n", xs_strerror (errno));
return -1;
}
- zmq_sleep (1);
+ xs_sleep (1);
- rc = zmq_close (s);
+ rc = xs_close (s);
if (rc != 0) {
- printf ("error in zmq_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_close: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
if (rc != 0) {
- printf ("error in zmq_term: %s\n", zmq_strerror (errno));
+ printf ("error in xs_term: %s\n", xs_strerror (errno));
return -1;
}
diff --git a/perf/local_thr.cpp b/perf/local_thr.cpp
index 5c495d8..6dcc810 100644
--- a/perf/local_thr.cpp
+++ b/perf/local_thr.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
-#include "../include/zmq_utils.h"
+#include "../include/xs.h"
+#include "../include/xs_utils.h"
#include <stdio.h>
#include <stdlib.h>
@@ -33,7 +33,7 @@ int main (int argc, char *argv [])
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ xs_msg_t msg;
void *watch;
unsigned long elapsed;
unsigned long throughput;
@@ -47,64 +47,64 @@ int main (int argc, char *argv [])
message_size = atoi (argv [2]);
message_count = atoi (argv [3]);
- ctx = zmq_init (1);
+ ctx = xs_init (1);
if (!ctx) {
- printf ("error in zmq_init: %s\n", zmq_strerror (errno));
+ printf ("error in xs_init: %s\n", xs_strerror (errno));
return -1;
}
- s = zmq_socket (ctx, ZMQ_PULL);
+ s = xs_socket (ctx, XS_PULL);
if (!s) {
- printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
+ printf ("error in xs_socket: %s\n", xs_strerror (errno));
return -1;
}
// Add your socket options here.
- // For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
+ // For example XS_RATE, XS_RECOVERY_IVL and XS_MCAST_LOOP for PGM.
- rc = zmq_bind (s, bind_to);
+ rc = xs_bind (s, bind_to);
if (rc != 0) {
- printf ("error in zmq_bind: %s\n", zmq_strerror (errno));
+ printf ("error in xs_bind: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_msg_init (&msg);
+ rc = xs_msg_init (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_init: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_init: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_recvmsg (s, &msg, 0);
+ rc = xs_recvmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_recvmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_recvmsg: %s\n", xs_strerror (errno));
return -1;
}
- if (zmq_msg_size (&msg) != message_size) {
+ if (xs_msg_size (&msg) != message_size) {
printf ("message of incorrect size received\n");
return -1;
}
- watch = zmq_stopwatch_start ();
+ watch = xs_stopwatch_start ();
for (i = 0; i != message_count - 1; i++) {
- rc = zmq_recvmsg (s, &msg, 0);
+ rc = xs_recvmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_recvmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_recvmsg: %s\n", xs_strerror (errno));
return -1;
}
- if (zmq_msg_size (&msg) != message_size) {
+ if (xs_msg_size (&msg) != message_size) {
printf ("message of incorrect size received\n");
return -1;
}
}
- elapsed = zmq_stopwatch_stop (watch);
+ elapsed = xs_stopwatch_stop (watch);
if (elapsed == 0)
elapsed = 1;
- rc = zmq_msg_close (&msg);
+ rc = xs_msg_close (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_close: %s\n", xs_strerror (errno));
return -1;
}
@@ -117,15 +117,15 @@ int main (int argc, char *argv [])
printf ("mean throughput: %d [msg/s]\n", (int) throughput);
printf ("mean throughput: %.3f [Mb/s]\n", (double) megabits);
- rc = zmq_close (s);
+ rc = xs_close (s);
if (rc != 0) {
- printf ("error in zmq_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_close: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
if (rc != 0) {
- printf ("error in zmq_term: %s\n", zmq_strerror (errno));
+ printf ("error in xs_term: %s\n", xs_strerror (errno));
return -1;
}
diff --git a/perf/remote_lat.cpp b/perf/remote_lat.cpp
index 9eb76b0..0ddddd5 100644
--- a/perf/remote_lat.cpp
+++ b/perf/remote_lat.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
-#include "../include/zmq_utils.h"
+#include "../include/xs.h"
+#include "../include/xs_utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -34,7 +34,7 @@ int main (int argc, char *argv [])
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ xs_msg_t msg;
void *watch;
unsigned long elapsed;
double latency;
@@ -48,55 +48,55 @@ int main (int argc, char *argv [])
message_size = atoi (argv [2]);
roundtrip_count = atoi (argv [3]);
- ctx = zmq_init (1);
+ ctx = xs_init (1);
if (!ctx) {
- printf ("error in zmq_init: %s\n", zmq_strerror (errno));
+ printf ("error in xs_init: %s\n", xs_strerror (errno));
return -1;
}
- s = zmq_socket (ctx, ZMQ_REQ);
+ s = xs_socket (ctx, XS_REQ);
if (!s) {
- printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
+ printf ("error in xs_socket: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_connect (s, connect_to);
+ rc = xs_connect (s, connect_to);
if (rc != 0) {
- printf ("error in zmq_connect: %s\n", zmq_strerror (errno));
+ printf ("error in xs_connect: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_msg_init_size (&msg, message_size);
+ rc = xs_msg_init_size (&msg, message_size);
if (rc != 0) {
- printf ("error in zmq_msg_init_size: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_init_size: %s\n", xs_strerror (errno));
return -1;
}
- memset (zmq_msg_data (&msg), 0, message_size);
+ memset (xs_msg_data (&msg), 0, message_size);
- watch = zmq_stopwatch_start ();
+ watch = xs_stopwatch_start ();
for (i = 0; i != roundtrip_count; i++) {
- rc = zmq_sendmsg (s, &msg, 0);
+ rc = xs_sendmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_sendmsg: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_recvmsg (s, &msg, 0);
+ rc = xs_recvmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_recvmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_recvmsg: %s\n", xs_strerror (errno));
return -1;
}
- if (zmq_msg_size (&msg) != message_size) {
+ if (xs_msg_size (&msg) != message_size) {
printf ("message of incorrect size received\n");
return -1;
}
}
- elapsed = zmq_stopwatch_stop (watch);
+ elapsed = xs_stopwatch_stop (watch);
- rc = zmq_msg_close (&msg);
+ rc = xs_msg_close (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_close: %s\n", xs_strerror (errno));
return -1;
}
@@ -106,15 +106,15 @@ int main (int argc, char *argv [])
printf ("roundtrip count: %d\n", (int) roundtrip_count);
printf ("average latency: %.3f [us]\n", (double) latency);
- rc = zmq_close (s);
+ rc = xs_close (s);
if (rc != 0) {
- printf ("error in zmq_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_close: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
if (rc != 0) {
- printf ("error in zmq_term: %s\n", zmq_strerror (errno));
+ printf ("error in xs_term: %s\n", xs_strerror (errno));
return -1;
}
diff --git a/perf/remote_thr.cpp b/perf/remote_thr.cpp
index 328bdce..5e825e9 100644
--- a/perf/remote_thr.cpp
+++ b/perf/remote_thr.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
-#include "../include/zmq_utils.h"
+#include "../include/xs.h"
+#include "../include/xs_utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -34,7 +34,7 @@ int main (int argc, char *argv [])
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ xs_msg_t msg;
if (argc != 4) {
printf ("usage: remote_thr <connect-to> <message-size> "
@@ -45,59 +45,59 @@ int main (int argc, char *argv [])
message_size = atoi (argv [2]);
message_count = atoi (argv [3]);
- ctx = zmq_init (1);
+ ctx = xs_init (1);
if (!ctx) {
- printf ("error in zmq_init: %s\n", zmq_strerror (errno));
+ printf ("error in xs_init: %s\n", xs_strerror (errno));
return -1;
}
- s = zmq_socket (ctx, ZMQ_PUSH);
+ s = xs_socket (ctx, XS_PUSH);
if (!s) {
- printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
+ printf ("error in xs_socket: %s\n", xs_strerror (errno));
return -1;
}
// Add your socket options here.
- // For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
+ // For example XS_RATE, XS_RECOVERY_IVL and XS_MCAST_LOOP for PGM.
- rc = zmq_connect (s, connect_to);
+ rc = xs_connect (s, connect_to);
if (rc != 0) {
- printf ("error in zmq_connect: %s\n", zmq_strerror (errno));
+ printf ("error in xs_connect: %s\n", xs_strerror (errno));
return -1;
}
for (i = 0; i != message_count; i++) {
- rc = zmq_msg_init_size (&msg, message_size);
+ rc = xs_msg_init_size (&msg, message_size);
if (rc != 0) {
- printf ("error in zmq_msg_init_size: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_init_size: %s\n", xs_strerror (errno));
return -1;
}
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
- memset (zmq_msg_data (&msg), 0, message_size);
+#if defined XS_MAKE_VALGRIND_HAPPY
+ memset (xs_msg_data (&msg), 0, message_size);
#endif
- rc = zmq_sendmsg (s, &msg, 0);
+ rc = xs_sendmsg (s, &msg, 0);
if (rc < 0) {
- printf ("error in zmq_sendmsg: %s\n", zmq_strerror (errno));
+ printf ("error in xs_sendmsg: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_msg_close (&msg);
+ rc = xs_msg_close (&msg);
if (rc != 0) {
- printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_msg_close: %s\n", xs_strerror (errno));
return -1;
}
}
- rc = zmq_close (s);
+ rc = xs_close (s);
if (rc != 0) {
- printf ("error in zmq_close: %s\n", zmq_strerror (errno));
+ printf ("error in xs_close: %s\n", xs_strerror (errno));
return -1;
}
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
if (rc != 0) {
- printf ("error in zmq_term: %s\n", zmq_strerror (errno));
+ printf ("error in xs_term: %s\n", xs_strerror (errno));
return -1;
}
diff --git a/src/Makefile.am b/src/Makefile.am
index f38dd0a..0db7957 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,11 +1,11 @@
-lib_LTLIBRARIES = libzmq.la
+lib_LTLIBRARIES = libxs.la
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libzmq.pc
+pkgconfig_DATA = libxs.pc
-include_HEADERS = ../include/zmq.h ../include/zmq_utils.h
+include_HEADERS = ../include/xs.h ../include/xs_utils.h
-libzmq_la_SOURCES = \
+libxs_la_SOURCES = \
array.hpp \
atomic_counter.hpp \
atomic_ptr.hpp \
@@ -130,20 +130,20 @@ libzmq_la_SOURCES = \
xrep.cpp \
xreq.cpp \
xsub.cpp \
- zmq.cpp \
- zmq_utils.cpp
+ xs.cpp \
+ xs_utils.cpp
if ON_MINGW
-libzmq_la_LDFLAGS = -no-undefined -avoid-version -version-info @LTVER@ @LIBZMQ_EXTRA_LDFLAGS@
+libxs_la_LDFLAGS = -no-undefined -avoid-version -version-info @LTVER@ @LIBXS_EXTRA_LDFLAGS@
else
-libzmq_la_LDFLAGS = -version-info @LTVER@ @LIBZMQ_EXTRA_LDFLAGS@
+libxs_la_LDFLAGS = -version-info @LTVER@ @LIBXS_EXTRA_LDFLAGS@
endif
-libzmq_la_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@
+libxs_la_CXXFLAGS = @LIBXS_EXTRA_CXXFLAGS@
if BUILD_PGM
-libzmq_la_CPPFLAGS = -I$(top_srcdir)/@pgm_srcdir@/include/
-libzmq_la_LIBADD = $(top_srcdir)/@pgm_srcdir@/libpgm_noinst.la
+libxs_la_CPPFLAGS = -I$(top_srcdir)/@pgm_srcdir@/include/
+libxs_la_LIBADD = $(top_srcdir)/@pgm_srcdir@/libpgm_noinst.la
endif
dist-hook:
diff --git a/src/array.hpp b/src/array.hpp
index 7e4ddd4..260558d 100644
--- a/src/array.hpp
+++ b/src/array.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,13 +19,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_ARRAY_INCLUDED__
-#define __ZMQ_ARRAY_INCLUDED__
+#ifndef __XS_ARRAY_INCLUDED__
+#define __XS_ARRAY_INCLUDED__
#include <vector>
#include <algorithm>
-namespace zmq
+namespace xs
{
// Base class for objects stored in the array. If you want to store
diff --git a/src/atomic_counter.hpp b/src/atomic_counter.hpp
index a0a67bf..81779a5 100644
--- a/src/atomic_counter.hpp
+++ b/src/atomic_counter.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,33 +19,33 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_ATOMIC_COUNTER_HPP_INCLUDED__
-#define __ZMQ_ATOMIC_COUNTER_HPP_INCLUDED__
+#ifndef __XS_ATOMIC_COUNTER_HPP_INCLUDED__
+#define __XS_ATOMIC_COUNTER_HPP_INCLUDED__
#include "stdint.hpp"
#include "platform.hpp"
-#if defined ZMQ_FORCE_MUTEXES
-#define ZMQ_ATOMIC_COUNTER_MUTEX
+#if defined XS_FORCE_MUTEXES
+#define XS_ATOMIC_COUNTER_MUTEX
#elif (defined __i386__ || defined __x86_64__) && defined __GNUC__
-#define ZMQ_ATOMIC_COUNTER_X86
-#elif defined ZMQ_HAVE_WINDOWS
-#define ZMQ_ATOMIC_COUNTER_WINDOWS
-#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD)
-#define ZMQ_ATOMIC_COUNTER_ATOMIC_H
+#define XS_ATOMIC_COUNTER_X86
+#elif defined XS_HAVE_WINDOWS
+#define XS_ATOMIC_COUNTER_WINDOWS
+#elif (defined XS_HAVE_SOLARIS || defined XS_HAVE_NETBSD)
+#define XS_ATOMIC_COUNTER_ATOMIC_H
#else
-#define ZMQ_ATOMIC_COUNTER_MUTEX
+#define XS_ATOMIC_COUNTER_MUTEX
#endif
-#if defined ZMQ_ATOMIC_COUNTER_MUTEX
+#if defined XS_ATOMIC_COUNTER_MUTEX
#include "mutex.hpp"
-#elif defined ZMQ_ATOMIC_COUNTER_WINDOWS
+#elif defined XS_ATOMIC_COUNTER_WINDOWS
#include "windows.hpp"
-#elif defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
+#elif defined XS_ATOMIC_COUNTER_ATOMIC_H
#include <atomic.h>
#endif
-namespace zmq
+namespace xs
{
// This class represents an integer that can be incremented/decremented
@@ -77,18 +77,18 @@ namespace zmq
{
integer_t old_value;
-#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
+#if defined XS_ATOMIC_COUNTER_WINDOWS
old_value = InterlockedExchangeAdd ((LONG*) &value, increment_);
-#elif defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
+#elif defined XS_ATOMIC_COUNTER_ATOMIC_H
integer_t new_value = atomic_add_32_nv (&value, increment_);
old_value = new_value - increment_;
-#elif defined ZMQ_ATOMIC_COUNTER_X86
+#elif defined XS_ATOMIC_COUNTER_X86
__asm__ volatile (
"lock; xadd %0, %1 \n\t"
: "=r" (old_value), "=m" (value)
: "0" (increment_), "m" (value)
: "cc", "memory");
-#elif defined ZMQ_ATOMIC_COUNTER_MUTEX
+#elif defined XS_ATOMIC_COUNTER_MUTEX
sync.lock ();
old_value = value;
value += increment_;
@@ -102,15 +102,15 @@ namespace zmq
// Atomic subtraction. Returns false if the counter drops to zero.
inline bool sub (integer_t decrement)
{
-#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
+#if defined XS_ATOMIC_COUNTER_WINDOWS
LONG delta = - ((LONG) decrement);
integer_t old = InterlockedExchangeAdd ((LONG*) &value, delta);
return old - decrement != 0;
-#elif defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
+#elif defined XS_ATOMIC_COUNTER_ATOMIC_H
int32_t delta = - ((int32_t) decrement);
integer_t nv = atomic_add_32_nv (&value, delta);
return nv != 0;
-#elif defined ZMQ_ATOMIC_COUNTER_X86
+#elif defined XS_ATOMIC_COUNTER_X86
integer_t oldval = -decrement;
volatile integer_t *val = &value;
__asm__ volatile ("lock; xaddl %0,%1"
@@ -118,7 +118,7 @@ namespace zmq
: "0" (oldval), "m" (*val)
: "cc", "memory");
return oldval != decrement;
-#elif defined ZMQ_ATOMIC_COUNTER_MUTEX
+#elif defined XS_ATOMIC_COUNTER_MUTEX
sync.lock ();
value -= decrement;
bool result = value ? true : false;
@@ -137,7 +137,7 @@ namespace zmq
private:
volatile integer_t value;
-#if defined ZMQ_ATOMIC_COUNTER_MUTEX
+#if defined XS_ATOMIC_COUNTER_MUTEX
mutex_t sync;
#endif
@@ -148,17 +148,17 @@ namespace zmq
}
// Remove macros local to this file.
-#if defined ZMQ_ATOMIC_COUNTER_WINDOWS
-#undef ZMQ_ATOMIC_COUNTER_WINDOWS
+#if defined XS_ATOMIC_COUNTER_WINDOWS
+#undef XS_ATOMIC_COUNTER_WINDOWS
#endif
-#if defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
-#undef ZMQ_ATOMIC_COUNTER_ATOMIC_H
+#if defined XS_ATOMIC_COUNTER_ATOMIC_H
+#undef XS_ATOMIC_COUNTER_ATOMIC_H
#endif
-#if defined ZMQ_ATOMIC_COUNTER_X86
-#undef ZMQ_ATOMIC_COUNTER_X86
+#if defined XS_ATOMIC_COUNTER_X86
+#undef XS_ATOMIC_COUNTER_X86
#endif
-#if defined ZMQ_ATOMIC_COUNTER_MUTEX
-#undef ZMQ_ATOMIC_COUNTER_MUTEX
+#if defined XS_ATOMIC_COUNTER_MUTEX
+#undef XS_ATOMIC_COUNTER_MUTEX
#endif
#endif
diff --git a/src/atomic_ptr.hpp b/src/atomic_ptr.hpp
index c59ab81..c7062ac 100644
--- a/src/atomic_ptr.hpp
+++ b/src/atomic_ptr.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,32 +19,32 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_ATOMIC_PTR_HPP_INCLUDED__
-#define __ZMQ_ATOMIC_PTR_HPP_INCLUDED__
+#ifndef __XS_ATOMIC_PTR_HPP_INCLUDED__
+#define __XS_ATOMIC_PTR_HPP_INCLUDED__
#include "platform.hpp"
-#if defined ZMQ_FORCE_MUTEXES
-#define ZMQ_ATOMIC_PTR_MUTEX
+#if defined XS_FORCE_MUTEXES
+#define XS_ATOMIC_PTR_MUTEX
#elif (defined __i386__ || defined __x86_64__) && defined __GNUC__
-#define ZMQ_ATOMIC_PTR_X86
-#elif defined ZMQ_HAVE_WINDOWS
-#define ZMQ_ATOMIC_PTR_WINDOWS
-#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD)
-#define ZMQ_ATOMIC_PTR_ATOMIC_H
+#define XS_ATOMIC_PTR_X86
+#elif defined XS_HAVE_WINDOWS
+#define XS_ATOMIC_PTR_WINDOWS
+#elif (defined XS_HAVE_SOLARIS || defined XS_HAVE_NETBSD)
+#define XS_ATOMIC_PTR_ATOMIC_H
#else
-#define ZMQ_ATOMIC_PTR_MUTEX
+#define XS_ATOMIC_PTR_MUTEX
#endif
-#if defined ZMQ_ATOMIC_PTR_MUTEX
+#if defined XS_ATOMIC_PTR_MUTEX
#include "mutex.hpp"
-#elif defined ZMQ_ATOMIC_PTR_WINDOWS
+#elif defined XS_ATOMIC_PTR_WINDOWS
#include "windows.hpp"
-#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
+#elif defined XS_ATOMIC_PTR_ATOMIC_H
#include <atomic.h>
#endif
-namespace zmq
+namespace xs
{
// This class encapsulates several atomic operations on pointers.
@@ -76,18 +76,18 @@ namespace zmq
// to the 'val' value. Old value is returned.
inline T *xchg (T *val_)
{
-#if defined ZMQ_ATOMIC_PTR_WINDOWS
+#if defined XS_ATOMIC_PTR_WINDOWS
return (T*) InterlockedExchangePointer ((PVOID*) &ptr, val_);
-#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
+#elif defined XS_ATOMIC_PTR_ATOMIC_H
return (T*) atomic_swap_ptr (&ptr, val_);
-#elif defined ZMQ_ATOMIC_PTR_X86
+#elif defined XS_ATOMIC_PTR_X86
T *old;
__asm__ volatile (
"lock; xchg %0, %2"
: "=r" (old), "=m" (ptr)
: "m" (ptr), "0" (val_));
return old;
-#elif defined ZMQ_ATOMIC_PTR_MUTEX
+#elif defined XS_ATOMIC_PTR_MUTEX
sync.lock ();
T *old = (T*) ptr;
ptr = val_;
@@ -104,12 +104,12 @@ namespace zmq
// is returned.
inline T *cas (T *cmp_, T *val_)
{
-#if defined ZMQ_ATOMIC_PTR_WINDOWS
+#if defined XS_ATOMIC_PTR_WINDOWS
return (T*) InterlockedCompareExchangePointer (
(volatile PVOID*) &ptr, val_, cmp_);
-#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
+#elif defined XS_ATOMIC_PTR_ATOMIC_H
return (T*) atomic_cas_ptr (&ptr, cmp_, val_);
-#elif defined ZMQ_ATOMIC_PTR_X86
+#elif defined XS_ATOMIC_PTR_X86
T *old;
__asm__ volatile (
"lock; cmpxchg %2, %3"
@@ -117,7 +117,7 @@ namespace zmq
: "r" (val_), "m" (ptr), "0" (cmp_)
: "cc");
return old;
-#elif defined ZMQ_ATOMIC_PTR_MUTEX
+#elif defined XS_ATOMIC_PTR_MUTEX
sync.lock ();
T *old = (T*) ptr;
if (ptr == cmp_)
@@ -132,7 +132,7 @@ namespace zmq
private:
volatile T *ptr;
-#if defined ZMQ_ATOMIC_PTR_MUTEX
+#if defined XS_ATOMIC_PTR_MUTEX
mutex_t sync;
#endif
@@ -143,17 +143,17 @@ namespace zmq
}
// Remove macros local to this file.
-#if defined ZMQ_ATOMIC_PTR_WINDOWS
-#undef ZMQ_ATOMIC_PTR_WINDOWS
+#if defined XS_ATOMIC_PTR_WINDOWS
+#undef XS_ATOMIC_PTR_WINDOWS
#endif
-#if defined ZMQ_ATOMIC_PTR_ATOMIC_H
-#undef ZMQ_ATOMIC_PTR_ATOMIC_H
+#if defined XS_ATOMIC_PTR_ATOMIC_H
+#undef XS_ATOMIC_PTR_ATOMIC_H
#endif
-#if defined ZMQ_ATOMIC_PTR_X86
-#undef ZMQ_ATOMIC_PTR_X86
+#if defined XS_ATOMIC_PTR_X86
+#undef XS_ATOMIC_PTR_X86
#endif
-#if defined ZMQ_ATOMIC_PTR_MUTEX
-#undef ZMQ_ATOMIC_PTR_MUTEX
+#if defined XS_ATOMIC_PTR_MUTEX
+#undef XS_ATOMIC_PTR_MUTEX
#endif
#endif
diff --git a/src/blob.hpp b/src/blob.hpp
index b8039c4..aabcf1d 100644
--- a/src/blob.hpp
+++ b/src/blob.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,12 +18,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_BLOB_HPP_INCLUDED__
-#define __ZMQ_BLOB_HPP_INCLUDED__
+#ifndef __XS_BLOB_HPP_INCLUDED__
+#define __XS_BLOB_HPP_INCLUDED__
#include <string>
-namespace zmq
+namespace xs
{
// Object to hold dynamically allocated opaque binary data.
diff --git a/src/clock.cpp b/src/clock.cpp
index 4868a5f..0406c0a 100644
--- a/src/clock.cpp
+++ b/src/clock.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -30,7 +30,7 @@
#include <intrin.h>
#endif
-#if !defined ZMQ_HAVE_WINDOWS
+#if !defined XS_HAVE_WINDOWS
#include <sys/time.h>
#endif
@@ -38,19 +38,19 @@
#include <time.h>
#endif
-zmq::clock_t::clock_t () :
+xs::clock_t::clock_t () :
last_tsc (rdtsc ()),
last_time (now_us () / 1000)
{
}
-zmq::clock_t::~clock_t ()
+xs::clock_t::~clock_t ()
{
}
-uint64_t zmq::clock_t::now_us ()
+uint64_t xs::clock_t::now_us ()
{
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
// Get the high resolution counter's accuracy.
LARGE_INTEGER ticksPerSecond;
@@ -84,7 +84,7 @@ uint64_t zmq::clock_t::now_us ()
#endif
}
-uint64_t zmq::clock_t::now_ms ()
+uint64_t xs::clock_t::now_ms ()
{
uint64_t tsc = rdtsc ();
@@ -103,7 +103,7 @@ uint64_t zmq::clock_t::now_ms ()
return last_time;
}
-uint64_t zmq::clock_t::rdtsc ()
+uint64_t xs::clock_t::rdtsc ()
{
#if (defined _MSC_VER && (defined _M_IX86 || defined _M_X64))
return __rdtsc ();
diff --git a/src/clock.hpp b/src/clock.hpp
index b3b19b2..d19b00f 100644
--- a/src/clock.hpp
+++ b/src/clock.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,12 +18,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_CLOCK_HPP_INCLUDED__
-#define __ZMQ_CLOCK_HPP_INCLUDED__
+#ifndef __XS_CLOCK_HPP_INCLUDED__
+#define __XS_CLOCK_HPP_INCLUDED__
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
class clock_t
diff --git a/src/command.hpp b/src/command.hpp
index 8378369..5d0221e 100644
--- a/src/command.hpp
+++ b/src/command.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,12 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_COMMAND_HPP_INCLUDED__
-#define __ZMQ_COMMAND_HPP_INCLUDED__
+#ifndef __XS_COMMAND_HPP_INCLUDED__
+#define __XS_COMMAND_HPP_INCLUDED__
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
class object_t;
@@ -38,7 +38,7 @@ namespace zmq
struct command_t
{
// Object to process the command.
- zmq::object_t *destination;
+ xs::object_t *destination;
enum type_t
{
@@ -73,7 +73,7 @@ namespace zmq
// Sent to socket to let it know about the newly created object.
struct {
- zmq::own_t *object;
+ xs::own_t *object;
} own;
// Attach the engine to the session. If engine is NULL, it informs
@@ -85,7 +85,7 @@ namespace zmq
// Sent from session to socket to establish pipe(s) between them.
// Caller have used inc_seqnum beforehand sending the command.
struct {
- zmq::pipe_t *pipe;
+ xs::pipe_t *pipe;
} bind;
// Sent by pipe writer to inform dormant pipe reader that there
@@ -118,7 +118,7 @@ namespace zmq
// Sent by I/O object ot the socket to request the shutdown of
// the I/O object.
struct {
- zmq::own_t *object;
+ xs::own_t *object;
} term_req;
// Sent by socket to I/O object to start its shutdown.
@@ -134,7 +134,7 @@ namespace zmq
// Transfers the ownership of the closed socket
// to the reaper thread.
struct {
- zmq::socket_base_t *socket;
+ xs::socket_base_t *socket;
} reap;
// Closed socket notifies the reaper that it's already deallocated.
diff --git a/src/config.hpp b/src/config.hpp
index f7b4c50..e4d948e 100644
--- a/src/config.hpp
+++ b/src/config.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,10 +19,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_CONFIG_HPP_INCLUDED__
-#define __ZMQ_CONFIG_HPP_INCLUDED__
+#ifndef __XS_CONFIG_HPP_INCLUDED__
+#define __XS_CONFIG_HPP_INCLUDED__
-namespace zmq
+namespace xs
{
// Compile-time settings.
diff --git a/src/ctx.cpp b/src/ctx.cpp
index d771f6f..2beda82 100644
--- a/src/ctx.cpp
+++ b/src/ctx.cpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2011 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,7 +20,7 @@
*/
#include "platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <unistd.h>
@@ -38,17 +38,17 @@
#include "err.hpp"
#include "msg.hpp"
-zmq::ctx_t::ctx_t (uint32_t io_threads_) :
+xs::ctx_t::ctx_t (uint32_t io_threads_) :
tag (0xbadcafe0),
terminating (false)
{
// Initialise the array of mailboxes. Additional three slots are for
- // zmq_term thread and reaper thread.
+ // xs_term thread and reaper thread.
slot_count = max_sockets + io_threads_ + 3;
slots = (mailbox_t**) malloc (sizeof (mailbox_t*) * slot_count);
alloc_assert (slots);
- // Initialise the infrastructure for zmq_term thread.
+ // Initialise the infrastructure for xs_term thread.
slots [term_tid] = &term_mailbox;
// Create the reaper thread.
@@ -74,34 +74,34 @@ zmq::ctx_t::ctx_t (uint32_t io_threads_) :
}
// Create the socket to send logs to.
- log_socket = create_socket (ZMQ_PUB);
- zmq_assert (log_socket);
+ log_socket = create_socket (XS_PUB);
+ xs_assert (log_socket);
int linger = 0;
- int rc = log_socket->setsockopt (ZMQ_LINGER, &linger, sizeof (linger));
+ int rc = log_socket->setsockopt (XS_LINGER, &linger, sizeof (linger));
errno_assert (rc == 0);
int hwm = 1;
- rc = log_socket->setsockopt (ZMQ_SNDHWM, &hwm, sizeof (hwm));
+ rc = log_socket->setsockopt (XS_SNDHWM, &hwm, sizeof (hwm));
errno_assert (rc == 0);
- rc = log_socket->connect ("ipc:///tmp/zmqlogs.ipc");
+ rc = log_socket->connect ("ipc:///tmp/xslogs.ipc");
errno_assert (rc == 0);
// Create the monitor object.
io_thread_t *io_thread = choose_io_thread (0);
- zmq_assert (io_thread);
+ xs_assert (io_thread);
monitor = new (std::nothrow) monitor_t (io_thread);
alloc_assert (monitor);
monitor->start ();
}
-bool zmq::ctx_t::check_tag ()
+bool xs::ctx_t::check_tag ()
{
return tag == 0xbadcafe0;
}
-zmq::ctx_t::~ctx_t ()
+xs::ctx_t::~ctx_t ()
{
// Check that there are no remaining sockets.
- zmq_assert (sockets.empty ());
+ xs_assert (sockets.empty ());
// Ask I/O threads to terminate. If stop signal wasn't sent to I/O
// thread subsequent invocation of destructor would hang-up.
@@ -124,7 +124,7 @@ zmq::ctx_t::~ctx_t ()
tag = 0xdeadbeef;
}
-int zmq::ctx_t::terminate ()
+int xs::ctx_t::terminate ()
{
// Check whether termination was already underway, but interrupted and now
// restarted.
@@ -139,13 +139,13 @@ int zmq::ctx_t::terminate ()
monitor->stop ();
command_t cmd;
int rc = term_mailbox.recv (&cmd, -1);
- zmq_assert (rc == 0);
- zmq_assert (cmd.type == command_t::done);
+ xs_assert (rc == 0);
+ xs_assert (cmd.type == command_t::done);
// Close the logging socket.
log_sync.lock ();
rc = log_socket->close ();
- zmq_assert (rc == 0);
+ xs_assert (rc == 0);
log_socket = NULL;
log_sync.unlock ();
@@ -166,10 +166,10 @@ int zmq::ctx_t::terminate ()
int rc = term_mailbox.recv (&cmd, -1);
if (rc == -1 && errno == EINTR)
return -1;
- zmq_assert (rc == 0);
- zmq_assert (cmd.type == command_t::done);
+ xs_assert (rc == 0);
+ xs_assert (cmd.type == command_t::done);
slot_sync.lock ();
- zmq_assert (sockets.empty ());
+ xs_assert (sockets.empty ());
slot_sync.unlock ();
// Deallocate the resources.
@@ -178,11 +178,11 @@ int zmq::ctx_t::terminate ()
return 0;
}
-zmq::socket_base_t *zmq::ctx_t::create_socket (int type_)
+xs::socket_base_t *xs::ctx_t::create_socket (int type_)
{
slot_sync.lock ();
- // Once zmq_term() was called, we can't create new sockets.
+ // Once xs_term() was called, we can't create new sockets.
if (terminating) {
slot_sync.unlock ();
errno = ETERM;
@@ -218,7 +218,7 @@ zmq::socket_base_t *zmq::ctx_t::create_socket (int type_)
return s;
}
-void zmq::ctx_t::destroy_socket (class socket_base_t *socket_)
+void xs::ctx_t::destroy_socket (class socket_base_t *socket_)
{
slot_sync.lock ();
@@ -230,7 +230,7 @@ void zmq::ctx_t::destroy_socket (class socket_base_t *socket_)
// Remove the socket from the list of sockets.
sockets.erase (socket_);
- // If zmq_term() was already called and there are no more socket
+ // If xs_term() was already called and there are no more socket
// we can ask reaper thread to terminate.
if (terminating && sockets.empty ())
reaper->stop ();
@@ -238,17 +238,17 @@ void zmq::ctx_t::destroy_socket (class socket_base_t *socket_)
slot_sync.unlock ();
}
-zmq::object_t *zmq::ctx_t::get_reaper ()
+xs::object_t *xs::ctx_t::get_reaper ()
{
return reaper;
}
-void zmq::ctx_t::send_command (uint32_t tid_, const command_t &command_)
+void xs::ctx_t::send_command (uint32_t tid_, const command_t &command_)
{
slots [tid_]->send (command_);
}
-zmq::io_thread_t *zmq::ctx_t::choose_io_thread (uint64_t affinity_)
+xs::io_thread_t *xs::ctx_t::choose_io_thread (uint64_t affinity_)
{
if (io_threads.empty ())
return NULL;
@@ -265,11 +265,11 @@ zmq::io_thread_t *zmq::ctx_t::choose_io_thread (uint64_t affinity_)
}
}
}
- zmq_assert (min_load != -1);
+ xs_assert (min_load != -1);
return io_threads [result];
}
-int zmq::ctx_t::register_endpoint (const char *addr_, endpoint_t &endpoint_)
+int xs::ctx_t::register_endpoint (const char *addr_, endpoint_t &endpoint_)
{
endpoints_sync.lock ();
@@ -285,7 +285,7 @@ int zmq::ctx_t::register_endpoint (const char *addr_, endpoint_t &endpoint_)
return 0;
}
-void zmq::ctx_t::unregister_endpoints (socket_base_t *socket_)
+void xs::ctx_t::unregister_endpoints (socket_base_t *socket_)
{
endpoints_sync.lock ();
@@ -303,7 +303,7 @@ void zmq::ctx_t::unregister_endpoints (socket_base_t *socket_)
endpoints_sync.unlock ();
}
-zmq::endpoint_t zmq::ctx_t::find_endpoint (const char *addr_)
+xs::endpoint_t xs::ctx_t::find_endpoint (const char *addr_)
{
endpoints_sync.lock ();
@@ -326,18 +326,18 @@ zmq::endpoint_t zmq::ctx_t::find_endpoint (const char *addr_)
return *endpoint;
}
-void zmq::ctx_t::log (int sid_, const char *text_)
+void xs::ctx_t::log (int sid_, const char *text_)
{
monitor->log (sid_, text_);
}
-void zmq::ctx_t::publish_logs (const char *text_)
+void xs::ctx_t::publish_logs (const char *text_)
{
log_sync.lock ();
msg_t msg;
msg.init_size (strlen (text_) + 1);
memcpy (msg.data (), text_, strlen (text_) + 1);
- int rc = log_socket->send (&msg, ZMQ_DONTWAIT);
+ int rc = log_socket->send (&msg, XS_DONTWAIT);
errno_assert (rc == 0);
msg.close ();
log_sync.unlock ();
@@ -346,5 +346,5 @@ void zmq::ctx_t::publish_logs (const char *text_)
// The last used socket ID, or 0 if no socket was used so far. Note that this
// is a global variable. Thus, even sockets created in different contexts have
// unique IDs.
-zmq::atomic_counter_t zmq::ctx_t::max_socket_id;
+xs::atomic_counter_t xs::ctx_t::max_socket_id;
diff --git a/src/ctx.hpp b/src/ctx.hpp
index 2859282..a813e60 100644
--- a/src/ctx.hpp
+++ b/src/ctx.hpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_CTX_HPP_INCLUDED__
-#define __ZMQ_CTX_HPP_INCLUDED__
+#ifndef __XS_CTX_HPP_INCLUDED__
+#define __XS_CTX_HPP_INCLUDED__
#include <map>
#include <vector>
@@ -35,7 +35,7 @@
#include "options.hpp"
#include "atomic_counter.hpp"
-namespace zmq
+namespace xs
{
class object_t;
@@ -67,15 +67,15 @@ namespace zmq
// Returns false if object is not a context.
bool check_tag ();
- // This function is called when user invokes zmq_term. If there are
+ // This function is called when user invokes xs_term. If there are
// no more sockets open it'll cause all the infrastructure to be shut
// down. If there are open sockets still, the deallocation happens
// after the last one is closed.
int terminate ();
// Create and destroy a socket.
- zmq::socket_base_t *create_socket (int type_);
- void destroy_socket (zmq::socket_base_t *socket_);
+ xs::socket_base_t *create_socket (int type_);
+ void destroy_socket (xs::socket_base_t *socket_);
// Send command to the destination thread.
void send_command (uint32_t tid_, const command_t &command_);
@@ -83,14 +83,14 @@ namespace zmq
// Returns the I/O thread that is the least busy at the moment.
// Affinity specifies which I/O threads are eligible (0 = all).
// Returns NULL is no I/O thread is available.
- zmq::io_thread_t *choose_io_thread (uint64_t affinity_);
+ xs::io_thread_t *choose_io_thread (uint64_t affinity_);
// Returns reaper thread object.
- zmq::object_t *get_reaper ();
+ xs::object_t *get_reaper ();
// Management of inproc endpoints.
int register_endpoint (const char *addr_, endpoint_t &endpoint_);
- void unregister_endpoints (zmq::socket_base_t *socket_);
+ void unregister_endpoints (xs::socket_base_t *socket_);
endpoint_t find_endpoint (const char *addr_);
// Logging related functions.
@@ -110,7 +110,7 @@ namespace zmq
uint32_t tag;
// Sockets belonging to this context. We need the list so that
- // we can notify the sockets when zmq_term() is called. The sockets
+ // we can notify the sockets when xs_term() is called. The sockets
// will return ETERM then.
typedef array_t <socket_base_t> sockets_t;
sockets_t sockets;
@@ -119,7 +119,7 @@ namespace zmq
typedef std::vector <uint32_t> emtpy_slots_t;
emtpy_slots_t empty_slots;
- // If true, zmq_term was already called.
+ // If true, xs_term was already called.
bool terminating;
// Synchronisation of accesses to global slot-related data:
@@ -129,17 +129,17 @@ namespace zmq
mutex_t slot_sync;
// The reaper thread.
- zmq::reaper_t *reaper;
+ xs::reaper_t *reaper;
// I/O threads.
- typedef std::vector <zmq::io_thread_t*> io_threads_t;
+ typedef std::vector <xs::io_thread_t*> io_threads_t;
io_threads_t io_threads;
// Array of pointers to mailboxes for both application and I/O threads.
uint32_t slot_count;
mailbox_t **slots;
- // Mailbox for zmq_term thread.
+ // Mailbox for xs_term thread.
mailbox_t term_mailbox;
// List of inproc endpoints within this context.
@@ -150,14 +150,14 @@ namespace zmq
mutex_t endpoints_sync;
// Monitor object attached to the context.
- zmq::monitor_t *monitor;
+ xs::monitor_t *monitor;
// Maximum socket ID.
static atomic_counter_t max_socket_id;
// PUB socket for logging. The socket is shared among all the threads,
// thus it is synchronised by a mutex.
- zmq::socket_base_t *log_socket;
+ xs::socket_base_t *log_socket;
mutex_t log_sync;
ctx_t (const ctx_t&);
diff --git a/src/decoder.cpp b/src/decoder.cpp
index 48f457f..910d7aa 100644
--- a/src/decoder.cpp
+++ b/src/decoder.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -28,7 +28,7 @@
#include "wire.hpp"
#include "err.hpp"
-zmq::decoder_t::decoder_t (size_t bufsize_, int64_t maxmsgsize_) :
+xs::decoder_t::decoder_t (size_t bufsize_, int64_t maxmsgsize_) :
decoder_base_t <decoder_t> (bufsize_),
session (NULL),
maxmsgsize (maxmsgsize_)
@@ -40,18 +40,18 @@ zmq::decoder_t::decoder_t (size_t bufsize_, int64_t maxmsgsize_) :
next_step (tmpbuf, 1, &decoder_t::one_byte_size_ready);
}
-zmq::decoder_t::~decoder_t ()
+xs::decoder_t::~decoder_t ()
{
int rc = in_progress.close ();
errno_assert (rc == 0);
}
-void zmq::decoder_t::set_session (session_base_t *session_)
+void xs::decoder_t::set_session (session_base_t *session_)
{
session = session_;
}
-bool zmq::decoder_t::one_byte_size_ready ()
+bool xs::decoder_t::one_byte_size_ready ()
{
// First byte of size is read. If it is 0xff read 8-byte size.
// Otherwise allocate the buffer for message data and read the
@@ -67,7 +67,7 @@ bool zmq::decoder_t::one_byte_size_ready ()
}
// in_progress is initialised at this point so in theory we should
- // close it before calling zmq_msg_init_size, however, it's a 0-byte
+ // close it before calling xs_msg_init_size, however, it's a 0-byte
// message and thus we can treat it as uninitialised...
int rc;
if (maxmsgsize >= 0 && (int64_t) (*tmpbuf - 1) > maxmsgsize) {
@@ -89,7 +89,7 @@ bool zmq::decoder_t::one_byte_size_ready ()
return true;
}
-bool zmq::decoder_t::eight_byte_size_ready ()
+bool xs::decoder_t::eight_byte_size_ready ()
{
// 8-byte size is read. Allocate the buffer for message body and
// read the message data into it.
@@ -102,7 +102,7 @@ bool zmq::decoder_t::eight_byte_size_ready ()
}
// in_progress is initialised at this point so in theory we should
- // close it before calling zmq_msg_init_size, however, it's a 0-byte
+ // close it before calling xs_msg_init_size, however, it's a 0-byte
// message and thus we can treat it as uninitialised...
int rc;
if (maxmsgsize >= 0 && (int64_t) (size - 1) > maxmsgsize) {
@@ -123,7 +123,7 @@ bool zmq::decoder_t::eight_byte_size_ready ()
return true;
}
-bool zmq::decoder_t::flags_ready ()
+bool xs::decoder_t::flags_ready ()
{
// Store the flags from the wire into the message structure.
in_progress.set_flags (tmpbuf [0]);
@@ -134,7 +134,7 @@ bool zmq::decoder_t::flags_ready ()
return true;
}
-bool zmq::decoder_t::message_ready ()
+bool xs::decoder_t::message_ready ()
{
// Message is completely read. Push it further and start reading
// new message. (in_progress is a 0-byte message after this point.)
diff --git a/src/decoder.hpp b/src/decoder.hpp
index 4afd018..bed1fc4 100644
--- a/src/decoder.hpp
+++ b/src/decoder.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_DECODER_HPP_INCLUDED__
-#define __ZMQ_DECODER_HPP_INCLUDED__
+#ifndef __XS_DECODER_HPP_INCLUDED__
+#define __XS_DECODER_HPP_INCLUDED__
#include <stddef.h>
#include <string.h>
@@ -31,14 +31,14 @@
#include "msg.hpp"
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
class session_base_t;
// Helper base class for decoders that know the amount of data to read
// in advance at any moment. Knowing the amount in advance is a property
- // of the protocol used. 0MQ framing protocol is based size-prefixed
+ // of the protocol used. Crossroads framing protocol is based size-prefixed
// paradigm, whixh qualifies it to be parsed by this class.
// On the other hand, XML-based transports (like XMPP or SOAP) don't allow
// for knowing the size of data to read in advance and should use different
@@ -186,7 +186,8 @@ namespace zmq
const decoder_base_t &operator = (const decoder_base_t&);
};
- // Decoder for 0MQ framing protocol. Converts data batches into messages.
+ // Decoder for Crossroads framing protocol.
+ // Converts data batches into messages.
class decoder_t : public decoder_base_t <decoder_t>
{
@@ -195,7 +196,7 @@ namespace zmq
decoder_t (size_t bufsize_, int64_t maxmsgsize_);
~decoder_t ();
- void set_session (zmq::session_base_t *session_);
+ void set_session (xs::session_base_t *session_);
private:
@@ -204,7 +205,7 @@ namespace zmq
bool flags_ready ();
bool message_ready ();
- zmq::session_base_t *session;
+ xs::session_base_t *session;
unsigned char tmpbuf [8];
msg_t in_progress;
diff --git a/src/devpoll.cpp b/src/devpoll.cpp
index 0c46d14..12b22ce 100644
--- a/src/devpoll.cpp
+++ b/src/devpoll.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,7 +20,7 @@
*/
#include "devpoll.hpp"
-#if defined ZMQ_USE_DEVPOLL
+#if defined XS_USE_DEVPOLL
#include <sys/devpoll.h>
#include <sys/time.h>
@@ -37,27 +37,27 @@
#include "config.hpp"
#include "i_poll_events.hpp"
-zmq::devpoll_t::devpoll_t () :
+xs::devpoll_t::devpoll_t () :
stopping (false)
{
devpoll_fd = open ("/dev/poll", O_RDWR);
errno_assert (devpoll_fd != -1);
}
-zmq::devpoll_t::~devpoll_t ()
+xs::devpoll_t::~devpoll_t ()
{
worker.stop ();
close (devpoll_fd);
}
-void zmq::devpoll_t::devpoll_ctl (fd_t fd_, short events_)
+void xs::devpoll_t::devpoll_ctl (fd_t fd_, short events_)
{
struct pollfd pfd = {fd_, events_, 0};
ssize_t rc = write (devpoll_fd, &pfd, sizeof pfd);
- zmq_assert (rc == sizeof pfd);
+ xs_assert (rc == sizeof pfd);
}
-zmq::devpoll_t::handle_t zmq::devpoll_t::add_fd (fd_t fd_,
+xs::devpoll_t::handle_t xs::devpoll_t::add_fd (fd_t fd_,
i_poll_events *reactor_)
{
// If the file descriptor table is too small expand it.
@@ -86,7 +86,7 @@ zmq::devpoll_t::handle_t zmq::devpoll_t::add_fd (fd_t fd_,
return fd_;
}
-void zmq::devpoll_t::rm_fd (handle_t handle_)
+void xs::devpoll_t::rm_fd (handle_t handle_)
{
assert (fd_table [handle_].valid);
@@ -97,45 +97,45 @@ void zmq::devpoll_t::rm_fd (handle_t handle_)
adjust_load (-1);
}
-void zmq::devpoll_t::set_pollin (handle_t handle_)
+void xs::devpoll_t::set_pollin (handle_t handle_)
{
devpoll_ctl (handle_, POLLREMOVE);
fd_table [handle_].events |= POLLIN;
devpoll_ctl (handle_, fd_table [handle_].events);
}
-void zmq::devpoll_t::reset_pollin (handle_t handle_)
+void xs::devpoll_t::reset_pollin (handle_t handle_)
{
devpoll_ctl (handle_, POLLREMOVE);
fd_table [handle_].events &= ~((short) POLLIN);
devpoll_ctl (handle_, fd_table [handle_].events);
}
-void zmq::devpoll_t::set_pollout (handle_t handle_)
+void xs::devpoll_t::set_pollout (handle_t handle_)
{
devpoll_ctl (handle_, POLLREMOVE);
fd_table [handle_].events |= POLLOUT;
devpoll_ctl (handle_, fd_table [handle_].events);
}
-void zmq::devpoll_t::reset_pollout (handle_t handle_)
+void xs::devpoll_t::reset_pollout (handle_t handle_)
{
devpoll_ctl (handle_, POLLREMOVE);
fd_table [handle_].events &= ~((short) POLLOUT);
devpoll_ctl (handle_, fd_table [handle_].events);
}
-void zmq::devpoll_t::start ()
+void xs::devpoll_t::start ()
{
worker.start (worker_routine, this);
}
-void zmq::devpoll_t::stop ()
+void xs::devpoll_t::stop ()
{
stopping = true;
}
-void zmq::devpoll_t::loop ()
+void xs::devpoll_t::loop ()
{
while (!stopping) {
@@ -152,7 +152,7 @@ void zmq::devpoll_t::loop ()
// Wait for events.
// On Solaris, we can retrieve no more then (OPEN_MAX - 1) events.
poll_req.dp_fds = &ev_buf [0];
-#if defined ZMQ_HAVE_SOLARIS
+#if defined XS_HAVE_SOLARIS
poll_req.dp_nfds = std::min ((int) max_io_events, OPEN_MAX - 1);
#else
poll_req.dp_nfds = max_io_events;
@@ -182,7 +182,7 @@ void zmq::devpoll_t::loop ()
}
}
-void zmq::devpoll_t::worker_routine (void *arg_)
+void xs::devpoll_t::worker_routine (void *arg_)
{
((devpoll_t*) arg_)->loop ();
}
diff --git a/src/devpoll.hpp b/src/devpoll.hpp
index 382be0f..4f210c4 100644
--- a/src/devpoll.hpp
+++ b/src/devpoll.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,12 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_DEVPOLL_HPP_INCLUDED__
-#define __ZMQ_DEVPOLL_HPP_INCLUDED__
+#ifndef __XS_DEVPOLL_HPP_INCLUDED__
+#define __XS_DEVPOLL_HPP_INCLUDED__
// poller.hpp decides which polling mechanism to use.
#include "poller.hpp"
-#if defined ZMQ_USE_DEVPOLL
+#if defined XS_USE_DEVPOLL
#include <vector>
@@ -32,7 +32,7 @@
#include "thread.hpp"
#include "poller_base.hpp"
-namespace zmq
+namespace xs
{
struct i_poll_events;
@@ -49,7 +49,7 @@ namespace zmq
~devpoll_t ();
// "poller" concept.
- handle_t add_fd (fd_t fd_, zmq::i_poll_events *events_);
+ handle_t add_fd (fd_t fd_, xs::i_poll_events *events_);
void rm_fd (handle_t handle_);
void set_pollin (handle_t handle_);
void reset_pollin (handle_t handle_);
@@ -72,7 +72,7 @@ namespace zmq
struct fd_entry_t
{
short events;
- zmq::i_poll_events *reactor;
+ xs::i_poll_events *reactor;
bool valid;
bool accepted;
};
diff --git a/src/dist.cpp b/src/dist.cpp
index d220c43..24f1132 100644
--- a/src/dist.cpp
+++ b/src/dist.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -25,7 +25,7 @@
#include "msg.hpp"
#include "likely.hpp"
-zmq::dist_t::dist_t () :
+xs::dist_t::dist_t () :
matching (0),
active (0),
eligible (0),
@@ -33,12 +33,12 @@ zmq::dist_t::dist_t () :
{
}
-zmq::dist_t::~dist_t ()
+xs::dist_t::~dist_t ()
{
- zmq_assert (pipes.empty ());
+ xs_assert (pipes.empty ());
}
-void zmq::dist_t::attach (pipe_t *pipe_)
+void xs::dist_t::attach (pipe_t *pipe_)
{
// If we are in the middle of sending a message, we'll add new pipe
// into the list of eligible pipes. Otherwise we add it to the list
@@ -56,7 +56,7 @@ void zmq::dist_t::attach (pipe_t *pipe_)
}
}
-void zmq::dist_t::match (pipe_t *pipe_)
+void xs::dist_t::match (pipe_t *pipe_)
{
// If pipe is already matching do nothing.
if (pipes.index (pipe_) < matching)
@@ -71,12 +71,12 @@ void zmq::dist_t::match (pipe_t *pipe_)
matching++;
}
-void zmq::dist_t::unmatch ()
+void xs::dist_t::unmatch ()
{
matching = 0;
}
-void zmq::dist_t::terminated (pipe_t *pipe_)
+void xs::dist_t::terminated (pipe_t *pipe_)
{
// Remove the pipe from the list; adjust number of matching, active and/or
// eligible pipes accordingly.
@@ -89,7 +89,7 @@ void zmq::dist_t::terminated (pipe_t *pipe_)
pipes.erase (pipe_);
}
-void zmq::dist_t::activated (pipe_t *pipe_)
+void xs::dist_t::activated (pipe_t *pipe_)
{
// Move the pipe from passive to eligible state.
pipes.swap (pipes.index (pipe_), eligible);
@@ -103,13 +103,13 @@ void zmq::dist_t::activated (pipe_t *pipe_)
}
}
-int zmq::dist_t::send_to_all (msg_t *msg_, int flags_)
+int xs::dist_t::send_to_all (msg_t *msg_, int flags_)
{
matching = active;
return send_to_matching (msg_, flags_);
}
-int zmq::dist_t::send_to_matching (msg_t *msg_, int flags_)
+int xs::dist_t::send_to_matching (msg_t *msg_, int flags_)
{
// Is this end of a multipart message?
bool msg_more = msg_->flags () & msg_t::more ? true : false;
@@ -126,14 +126,14 @@ int zmq::dist_t::send_to_matching (msg_t *msg_, int flags_)
return 0;
}
-void zmq::dist_t::distribute (msg_t *msg_, int flags_)
+void xs::dist_t::distribute (msg_t *msg_, int flags_)
{
// If there are no matching pipes available, simply drop the message.
if (matching == 0) {
int rc = msg_->close ();
errno_assert (rc == 0);
rc = msg_->init ();
- zmq_assert (rc == 0);
+ xs_assert (rc == 0);
return;
}
@@ -165,12 +165,12 @@ void zmq::dist_t::distribute (msg_t *msg_, int flags_)
errno_assert (rc == 0);
}
-bool zmq::dist_t::has_out ()
+bool xs::dist_t::has_out ()
{
return true;
}
-bool zmq::dist_t::write (pipe_t *pipe_, msg_t *msg_)
+bool xs::dist_t::write (pipe_t *pipe_, msg_t *msg_)
{
if (!pipe_->write (msg_)) {
pipes.swap (pipes.index (pipe_), matching - 1);
diff --git a/src/dist.hpp b/src/dist.hpp
index be86ab2..a16ca7b 100644
--- a/src/dist.hpp
+++ b/src/dist.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,15 +18,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_DIST_HPP_INCLUDED__
-#define __ZMQ_DIST_HPP_INCLUDED__
+#ifndef __XS_DIST_HPP_INCLUDED__
+#define __XS_DIST_HPP_INCLUDED__
#include <vector>
#include "array.hpp"
#include "pipe.hpp"
-namespace zmq
+namespace xs
{
class pipe_t;
@@ -42,26 +42,26 @@ namespace zmq
~dist_t ();
// Adds the pipe to the distributor object.
- void attach (zmq::pipe_t *pipe_);
+ void attach (xs::pipe_t *pipe_);
// Activates pipe that have previously reached high watermark.
- void activated (zmq::pipe_t *pipe_);
+ void activated (xs::pipe_t *pipe_);
// Mark the pipe as matching. Subsequent call to send_to_matching
// will send message also to this pipe.
- void match (zmq::pipe_t *pipe_);
+ void match (xs::pipe_t *pipe_);
// Mark all pipes as non-matching.
void unmatch ();
// Removes the pipe from the distributor object.
- void terminated (zmq::pipe_t *pipe_);
+ void terminated (xs::pipe_t *pipe_);
// Send the message to the matching outbound pipes.
- int send_to_matching (zmq::msg_t *msg_, int flags_);
+ int send_to_matching (xs::msg_t *msg_, int flags_);
// Send the message to all the outbound pipes.
- int send_to_all (zmq::msg_t *msg_, int flags_);
+ int send_to_all (xs::msg_t *msg_, int flags_);
bool has_out ();
@@ -69,13 +69,13 @@ namespace zmq
// Write the message to the pipe. Make the pipe inactive if writing
// fails. In such a case false is returned.
- bool write (zmq::pipe_t *pipe_, zmq::msg_t *msg_);
+ bool write (xs::pipe_t *pipe_, xs::msg_t *msg_);
// Put the message to all active pipes.
- void distribute (zmq::msg_t *msg_, int flags_);
+ void distribute (xs::msg_t *msg_, int flags_);
// List of outbound pipes.
- typedef array_t <zmq::pipe_t, 2> pipes_t;
+ typedef array_t <xs::pipe_t, 2> pipes_t;
pipes_t pipes;
// Number of all the pipes to send the next message to.
diff --git a/src/encoder.cpp b/src/encoder.cpp
index 030b3ef..c1397fe 100644
--- a/src/encoder.cpp
+++ b/src/encoder.cpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -25,7 +25,7 @@
#include "likely.hpp"
#include "wire.hpp"
-zmq::encoder_t::encoder_t (size_t bufsize_) :
+xs::encoder_t::encoder_t (size_t bufsize_) :
encoder_base_t <encoder_t> (bufsize_),
session (NULL)
{
@@ -36,18 +36,18 @@ zmq::encoder_t::encoder_t (size_t bufsize_) :
next_step (NULL, 0, &encoder_t::message_ready, true);
}
-zmq::encoder_t::~encoder_t ()
+xs::encoder_t::~encoder_t ()
{
int rc = in_progress.close ();
errno_assert (rc == 0);
}
-void zmq::encoder_t::set_session (session_base_t *session_)
+void xs::encoder_t::set_session (session_base_t *session_)
{
session = session_;
}
-bool zmq::encoder_t::size_ready ()
+bool xs::encoder_t::size_ready ()
{
// Write message body into the buffer.
next_step (in_progress.data (), in_progress.size (),
@@ -55,7 +55,7 @@ bool zmq::encoder_t::size_ready ()
return true;
}
-bool zmq::encoder_t::message_ready ()
+bool xs::encoder_t::message_ready ()
{
// Destroy content of the old message.
int rc = in_progress.close ();
diff --git a/src/encoder.hpp b/src/encoder.hpp
index f521b6b..93efbb8 100644
--- a/src/encoder.hpp
+++ b/src/encoder.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_ENCODER_HPP_INCLUDED__
-#define __ZMQ_ENCODER_HPP_INCLUDED__
+#ifndef __XS_ENCODER_HPP_INCLUDED__
+#define __XS_ENCODER_HPP_INCLUDED__
#include <stddef.h>
#include <string.h>
@@ -30,7 +30,7 @@
#include "err.hpp"
#include "msg.hpp"
-namespace zmq
+namespace xs
{
class session_base_t;
@@ -166,7 +166,8 @@ namespace zmq
void operator = (const encoder_base_t&);
};
- // Encoder for 0MQ framing protocol. Converts messages into data batches.
+ // Encoder for Crossroads framing protocol.
+ // Converts messages into data batches.
class encoder_t : public encoder_base_t <encoder_t>
{
@@ -175,14 +176,14 @@ namespace zmq
encoder_t (size_t bufsize_);
~encoder_t ();
- void set_session (zmq::session_base_t *session_);
+ void set_session (xs::session_base_t *session_);
private:
bool size_ready ();
bool message_ready ();
- zmq::session_base_t *session;
+ xs::session_base_t *session;
msg_t in_progress;
unsigned char tmpbuf [10];
diff --git a/src/epoll.cpp b/src/epoll.cpp
index a62345d..3902282 100644
--- a/src/epoll.cpp
+++ b/src/epoll.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,7 +20,7 @@
*/
#include "epoll.hpp"
-#if defined ZMQ_USE_EPOLL
+#if defined XS_USE_EPOLL
#include <sys/epoll.h>
#include <stdlib.h>
@@ -34,14 +34,14 @@
#include "config.hpp"
#include "i_poll_events.hpp"
-zmq::epoll_t::epoll_t () :
+xs::epoll_t::epoll_t () :
stopping (false)
{
epoll_fd = epoll_create (1);
errno_assert (epoll_fd != -1);
}
-zmq::epoll_t::~epoll_t ()
+xs::epoll_t::~epoll_t ()
{
// Wait till the worker thread exits.
worker.stop ();
@@ -51,7 +51,7 @@ zmq::epoll_t::~epoll_t ()
delete *it;
}
-zmq::epoll_t::handle_t zmq::epoll_t::add_fd (fd_t fd_, i_poll_events *events_)
+xs::epoll_t::handle_t xs::epoll_t::add_fd (fd_t fd_, i_poll_events *events_)
{
poll_entry_t *pe = new (std::nothrow) poll_entry_t;
alloc_assert (pe);
@@ -74,7 +74,7 @@ zmq::epoll_t::handle_t zmq::epoll_t::add_fd (fd_t fd_, i_poll_events *events_)
return pe;
}
-void zmq::epoll_t::rm_fd (handle_t handle_)
+void xs::epoll_t::rm_fd (handle_t handle_)
{
poll_entry_t *pe = (poll_entry_t*) handle_;
int rc = epoll_ctl (epoll_fd, EPOLL_CTL_DEL, pe->fd, &pe->ev);
@@ -86,7 +86,7 @@ void zmq::epoll_t::rm_fd (handle_t handle_)
adjust_load (-1);
}
-void zmq::epoll_t::set_pollin (handle_t handle_)
+void xs::epoll_t::set_pollin (handle_t handle_)
{
poll_entry_t *pe = (poll_entry_t*) handle_;
pe->ev.events |= EPOLLIN;
@@ -94,7 +94,7 @@ void zmq::epoll_t::set_pollin (handle_t handle_)
errno_assert (rc != -1);
}
-void zmq::epoll_t::reset_pollin (handle_t handle_)
+void xs::epoll_t::reset_pollin (handle_t handle_)
{
poll_entry_t *pe = (poll_entry_t*) handle_;
pe->ev.events &= ~((short) EPOLLIN);
@@ -102,7 +102,7 @@ void zmq::epoll_t::reset_pollin (handle_t handle_)
errno_assert (rc != -1);
}
-void zmq::epoll_t::set_pollout (handle_t handle_)
+void xs::epoll_t::set_pollout (handle_t handle_)
{
poll_entry_t *pe = (poll_entry_t*) handle_;
pe->ev.events |= EPOLLOUT;
@@ -110,7 +110,7 @@ void zmq::epoll_t::set_pollout (handle_t handle_)
errno_assert (rc != -1);
}
-void zmq::epoll_t::reset_pollout (handle_t handle_)
+void xs::epoll_t::reset_pollout (handle_t handle_)
{
poll_entry_t *pe = (poll_entry_t*) handle_;
pe->ev.events &= ~((short) EPOLLOUT);
@@ -118,17 +118,17 @@ void zmq::epoll_t::reset_pollout (handle_t handle_)
errno_assert (rc != -1);
}
-void zmq::epoll_t::start ()
+void xs::epoll_t::start ()
{
worker.start (worker_routine, this);
}
-void zmq::epoll_t::stop ()
+void xs::epoll_t::stop ()
{
stopping = true;
}
-void zmq::epoll_t::loop ()
+void xs::epoll_t::loop ()
{
epoll_event ev_buf [max_io_events];
@@ -169,7 +169,7 @@ void zmq::epoll_t::loop ()
}
}
-void zmq::epoll_t::worker_routine (void *arg_)
+void xs::epoll_t::worker_routine (void *arg_)
{
((epoll_t*) arg_)->loop ();
}
diff --git a/src/epoll.hpp b/src/epoll.hpp
index 3fd4262..7121c25 100644
--- a/src/epoll.hpp
+++ b/src/epoll.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,12 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_EPOLL_HPP_INCLUDED__
-#define __ZMQ_EPOLL_HPP_INCLUDED__
+#ifndef __XS_EPOLL_HPP_INCLUDED__
+#define __XS_EPOLL_HPP_INCLUDED__
// poller.hpp decides which polling mechanism to use.
#include "poller.hpp"
-#if defined ZMQ_USE_EPOLL
+#if defined XS_USE_EPOLL
#include <vector>
#include <sys/epoll.h>
@@ -33,7 +33,7 @@
#include "thread.hpp"
#include "poller_base.hpp"
-namespace zmq
+namespace xs
{
struct i_poll_events;
@@ -51,7 +51,7 @@ namespace zmq
~epoll_t ();
// "poller" concept.
- handle_t add_fd (fd_t fd_, zmq::i_poll_events *events_);
+ handle_t add_fd (fd_t fd_, xs::i_poll_events *events_);
void rm_fd (handle_t handle_);
void set_pollin (handle_t handle_);
void reset_pollin (handle_t handle_);
@@ -75,7 +75,7 @@ namespace zmq
{
fd_t fd;
epoll_event ev;
- zmq::i_poll_events *events;
+ xs::i_poll_events *events;
};
// List of retired event sources.
diff --git a/src/err.cpp b/src/err.cpp
index 028d752..9c69138 100644
--- a/src/err.cpp
+++ b/src/err.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,10 +22,10 @@
#include "err.hpp"
#include "platform.hpp"
-const char *zmq::errno_to_string (int errno_)
+const char *xs::errno_to_string (int errno_)
{
switch (errno_) {
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
case ENOTSUP:
return "Not supported";
case EPROTONOSUPPORT:
@@ -63,9 +63,9 @@ const char *zmq::errno_to_string (int errno_)
}
}
-void zmq::zmq_abort(const char *errmsg_)
+void xs::xs_abort(const char *errmsg_)
{
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
// Raise STATUS_FATAL_APP_EXIT.
ULONG_PTR extra_info [1];
@@ -76,9 +76,9 @@ void zmq::zmq_abort(const char *errmsg_)
#endif
}
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
-const char *zmq::wsa_error()
+const char *xs::wsa_error()
{
int no = WSAGetLastError ();
// TODO: This is not a generic way to handle this...
@@ -88,7 +88,7 @@ const char *zmq::wsa_error()
return wsa_error_no (no);
}
-const char *zmq::wsa_error_no (int no_)
+const char *xs::wsa_error_no (int no_)
{
// TODO: It seems that list of Windows socket errors is longer than this.
// Investigate whether there's a way to convert it into the string
@@ -199,16 +199,16 @@ const char *zmq::wsa_error_no (int no_)
"error not defined";
}
-void zmq::win_error (char *buffer_, size_t buffer_size_)
+void xs::win_error (char *buffer_, size_t buffer_size_)
{
DWORD errcode = GetLastError ();
DWORD rc = FormatMessageA (FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errcode, MAKELANGID(LANG_NEUTRAL,
SUBLANG_DEFAULT), buffer_, (DWORD) buffer_size_, NULL );
- zmq_assert (rc);
+ xs_assert (rc);
}
-void zmq::wsa_error_to_errno ()
+void xs::wsa_error_to_errno ()
{
int errcode = WSAGetLastError ();
switch (errcode) {
diff --git a/src/err.hpp b/src/err.hpp
index 53a6569..a62d0fd 100644
--- a/src/err.hpp
+++ b/src/err.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,11 +19,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_ERR_HPP_INCLUDED__
-#define __ZMQ_ERR_HPP_INCLUDED__
+#ifndef __XS_ERR_HPP_INCLUDED__
+#define __XS_ERR_HPP_INCLUDED__
-// 0MQ-specific error codes are defined in zmq.h
-#include "../include/zmq.h"
+// Crossroads-specific error codes are defined in xs.h
+#include "../include/xs.h"
#include <assert.h>
#include <errno.h>
@@ -34,21 +34,21 @@
#include "platform.hpp"
#include "likely.hpp"
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <netdb.h>
#endif
-namespace zmq
+namespace xs
{
const char *errno_to_string (int errno_);
- void zmq_abort (const char *errmsg_);
+ void xs_abort (const char *errmsg_);
}
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
-namespace zmq
+namespace xs
{
const char *wsa_error ();
const char *wsa_error_no (int no_);
@@ -60,11 +60,11 @@ namespace zmq
#define wsa_assert(x) \
do {\
if (unlikely (!(x))) {\
- const char *errstr = zmq::wsa_error ();\
+ const char *errstr = xs::wsa_error ();\
if (errstr != NULL) {\
fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \
__FILE__, __LINE__);\
- zmq::zmq_abort (errstr);\
+ xs::xs_abort (errstr);\
}\
}\
} while (false)
@@ -72,11 +72,11 @@ namespace zmq
// Provides convenient way to assert on WSA-style errors on Windows.
#define wsa_assert_no(no) \
do {\
- const char *errstr = zmq::wsa_error_no (no);\
+ const char *errstr = xs::wsa_error_no (no);\
if (errstr != NULL) {\
fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \
__FILE__, __LINE__);\
- zmq::zmq_abort (errstr);\
+ xs::xs_abort (errstr);\
}\
} while (false)
@@ -85,10 +85,10 @@ namespace zmq
do {\
if (unlikely (!(x))) {\
char errstr [256];\
- zmq::win_error (errstr, 256);\
+ xs::win_error (errstr, 256);\
fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \
__FILE__, __LINE__);\
- zmq::zmq_abort (errstr);\
+ xs::xs_abort (errstr);\
}\
} while (false)
@@ -97,12 +97,12 @@ namespace zmq
// This macro works in exactly the same way as the normal assert. It is used
// in its stead because standard assert on Win32 in broken - it prints nothing
// when used within the scope of JNI library.
-#define zmq_assert(x) \
+#define xs_assert(x) \
do {\
if (unlikely (!(x))) {\
fprintf (stderr, "Assertion failed: %s (%s:%d)\n", #x, \
__FILE__, __LINE__);\
- zmq::zmq_abort (#x);\
+ xs::xs_abort (#x);\
}\
} while (false)
@@ -112,7 +112,7 @@ namespace zmq
if (unlikely (!(x))) {\
const char *errstr = strerror (errno);\
fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\
- zmq::zmq_abort (errstr);\
+ xs::xs_abort (errstr);\
}\
} while (false)
@@ -122,7 +122,7 @@ namespace zmq
if (unlikely (x)) {\
const char *errstr = strerror (x);\
fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\
- zmq::zmq_abort (errstr);\
+ xs::xs_abort (errstr);\
}\
} while (false)
@@ -132,7 +132,7 @@ namespace zmq
if (unlikely (x)) {\
const char *errstr = gai_strerror (x);\
fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\
- zmq::zmq_abort (errstr);\
+ xs::xs_abort (errstr);\
}\
} while (false)
@@ -142,7 +142,7 @@ namespace zmq
if (unlikely (!x)) {\
fprintf (stderr, "FATAL ERROR: OUT OF MEMORY (%s:%d)\n",\
__FILE__, __LINE__);\
- zmq::zmq_abort ("FATAL ERROR: OUT OF MEMORY");\
+ xs::xs_abort ("FATAL ERROR: OUT OF MEMORY");\
}\
} while (false)
diff --git a/src/fd.hpp b/src/fd.hpp
index 773e380..06689fa 100644
--- a/src/fd.hpp
+++ b/src/fd.hpp
@@ -1,15 +1,16 @@
/*
+ Copyright (c) 2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,18 +19,18 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_FD_HPP_INCLUDED__
-#define __ZMQ_FD_HPP_INCLUDED__
+#ifndef __XS_FD_HPP_INCLUDED__
+#define __XS_FD_HPP_INCLUDED__
#include "platform.hpp"
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#endif
-namespace zmq
+namespace xs
{
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#if defined _MSC_VER &&_MSC_VER <= 1400
typedef UINT_PTR fd_t;
enum {retired_fd = (fd_t)(~0)};
diff --git a/src/fq.cpp b/src/fq.cpp
index 429c038..fc420fe 100644
--- a/src/fq.cpp
+++ b/src/fq.cpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -25,26 +25,26 @@
#include "err.hpp"
#include "msg.hpp"
-zmq::fq_t::fq_t () :
+xs::fq_t::fq_t () :
active (0),
current (0),
more (false)
{
}
-zmq::fq_t::~fq_t ()
+xs::fq_t::~fq_t ()
{
- zmq_assert (pipes.empty ());
+ xs_assert (pipes.empty ());
}
-void zmq::fq_t::attach (pipe_t *pipe_)
+void xs::fq_t::attach (pipe_t *pipe_)
{
pipes.push_back (pipe_);
pipes.swap (active, pipes.size () - 1);
active++;
}
-void zmq::fq_t::terminated (pipe_t *pipe_)
+void xs::fq_t::terminated (pipe_t *pipe_)
{
// Remove the pipe from the list; adjust number of active pipes
// accordingly.
@@ -56,19 +56,19 @@ void zmq::fq_t::terminated (pipe_t *pipe_)
pipes.erase (pipe_);
}
-void zmq::fq_t::activated (pipe_t *pipe_)
+void xs::fq_t::activated (pipe_t *pipe_)
{
// Move the pipe to the list of active pipes.
pipes.swap (pipes.index (pipe_), active);
active++;
}
-int zmq::fq_t::recv (msg_t *msg_, int flags_)
+int xs::fq_t::recv (msg_t *msg_, int flags_)
{
return recvpipe (msg_, flags_, NULL);
}
-int zmq::fq_t::recvpipe (msg_t *msg_, int flags_, pipe_t **pipe_)
+int xs::fq_t::recvpipe (msg_t *msg_, int flags_, pipe_t **pipe_)
{
// Deallocate old content of the message.
int rc = msg_->close ();
@@ -84,7 +84,7 @@ int zmq::fq_t::recvpipe (msg_t *msg_, int flags_, pipe_t **pipe_)
// Check the atomicity of the message. If we've already received the
// first part of the message we should get the remaining parts
// without blocking.
- zmq_assert (!(more && !fetched));
+ xs_assert (!(more && !fetched));
// Note that when message is not fetched, current pipe is deactivated
// and replaced by another active pipe. Thus we don't have to increase
@@ -117,7 +117,7 @@ int zmq::fq_t::recvpipe (msg_t *msg_, int flags_, pipe_t **pipe_)
return -1;
}
-bool zmq::fq_t::has_in ()
+bool xs::fq_t::has_in ()
{
// There are subsequent parts of the partly-read message available.
if (more)
diff --git a/src/fq.hpp b/src/fq.hpp
index 24d7b85..c2e828e 100644
--- a/src/fq.hpp
+++ b/src/fq.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,14 +19,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_FQ_HPP_INCLUDED__
-#define __ZMQ_FQ_HPP_INCLUDED__
+#ifndef __XS_FQ_HPP_INCLUDED__
+#define __XS_FQ_HPP_INCLUDED__
#include "array.hpp"
#include "pipe.hpp"
#include "msg.hpp"
-namespace zmq
+namespace xs
{
// Class manages a set of inbound pipes. On receive it performs fair
diff --git a/src/i_engine.hpp b/src/i_engine.hpp
index 93cd8b1..fc03f0e 100644
--- a/src/i_engine.hpp
+++ b/src/i_engine.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,10 +19,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_I_ENGINE_HPP_INCLUDED__
-#define __ZMQ_I_ENGINE_HPP_INCLUDED__
+#ifndef __XS_I_ENGINE_HPP_INCLUDED__
+#define __XS_I_ENGINE_HPP_INCLUDED__
-namespace zmq
+namespace xs
{
class io_thread_t;
@@ -34,7 +34,7 @@ namespace zmq
virtual ~i_engine () {}
// Plug the engine to the session.
- virtual void plug (zmq::io_thread_t *io_thread_,
+ virtual void plug (xs::io_thread_t *io_thread_,
class session_base_t *session_) = 0;
// Unplug the engine from the session.
diff --git a/src/i_poll_events.hpp b/src/i_poll_events.hpp
index 9cf47fd..ca1625d 100644
--- a/src/i_poll_events.hpp
+++ b/src/i_poll_events.hpp
@@ -1,28 +1,28 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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
+ 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/>.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_I_POLL_EVENTS_HPP_INCLUDED__
-#define __ZMQ_I_POLL_EVENTS_HPP_INCLUDED__
+#ifndef __XS_I_POLL_EVENTS_HPP_INCLUDED__
+#define __XS_I_POLL_EVENTS_HPP_INCLUDED__
-namespace zmq
+namespace xs
{
// Virtual interface to be exposed by object that want to be notified
diff --git a/src/io_object.cpp b/src/io_object.cpp
index 81b9ce5..1b0231d 100644
--- a/src/io_object.cpp
+++ b/src/io_object.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -23,86 +23,86 @@
#include "io_thread.hpp"
#include "err.hpp"
-zmq::io_object_t::io_object_t (io_thread_t *io_thread_) :
+xs::io_object_t::io_object_t (io_thread_t *io_thread_) :
poller (NULL)
{
if (io_thread_)
plug (io_thread_);
}
-zmq::io_object_t::~io_object_t ()
+xs::io_object_t::~io_object_t ()
{
}
-void zmq::io_object_t::plug (io_thread_t *io_thread_)
+void xs::io_object_t::plug (io_thread_t *io_thread_)
{
- zmq_assert (io_thread_);
- zmq_assert (!poller);
+ xs_assert (io_thread_);
+ xs_assert (!poller);
// Retrieve the poller from the thread we are running in.
poller = io_thread_->get_poller ();
}
-void zmq::io_object_t::unplug ()
+void xs::io_object_t::unplug ()
{
- zmq_assert (poller);
+ xs_assert (poller);
// Forget about old poller in preparation to be migrated
// to a different I/O thread.
poller = NULL;
}
-zmq::io_object_t::handle_t zmq::io_object_t::add_fd (fd_t fd_)
+xs::io_object_t::handle_t xs::io_object_t::add_fd (fd_t fd_)
{
return poller->add_fd (fd_, this);
}
-void zmq::io_object_t::rm_fd (handle_t handle_)
+void xs::io_object_t::rm_fd (handle_t handle_)
{
poller->rm_fd (handle_);
}
-void zmq::io_object_t::set_pollin (handle_t handle_)
+void xs::io_object_t::set_pollin (handle_t handle_)
{
poller->set_pollin (handle_);
}
-void zmq::io_object_t::reset_pollin (handle_t handle_)
+void xs::io_object_t::reset_pollin (handle_t handle_)
{
poller->reset_pollin (handle_);
}
-void zmq::io_object_t::set_pollout (handle_t handle_)
+void xs::io_object_t::set_pollout (handle_t handle_)
{
poller->set_pollout (handle_);
}
-void zmq::io_object_t::reset_pollout (handle_t handle_)
+void xs::io_object_t::reset_pollout (handle_t handle_)
{
poller->reset_pollout (handle_);
}
-void zmq::io_object_t::add_timer (int timeout_, int id_)
+void xs::io_object_t::add_timer (int timeout_, int id_)
{
poller->add_timer (timeout_, this, id_);
}
-void zmq::io_object_t::cancel_timer (int id_)
+void xs::io_object_t::cancel_timer (int id_)
{
poller->cancel_timer (this, id_);
}
-void zmq::io_object_t::in_event ()
+void xs::io_object_t::in_event ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::io_object_t::out_event ()
+void xs::io_object_t::out_event ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::io_object_t::timer_event (int id_)
+void xs::io_object_t::timer_event (int id_)
{
- zmq_assert (false);
+ xs_assert (false);
}
diff --git a/src/io_object.hpp b/src/io_object.hpp
index 689b221..b3496b6 100644
--- a/src/io_object.hpp
+++ b/src/io_object.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_IO_OBJECT_HPP_INCLUDED__
-#define __ZMQ_IO_OBJECT_HPP_INCLUDED__
+#ifndef __XS_IO_OBJECT_HPP_INCLUDED__
+#define __XS_IO_OBJECT_HPP_INCLUDED__
#include <stddef.h>
@@ -28,7 +28,7 @@
#include "poller.hpp"
#include "i_poll_events.hpp"
-namespace zmq
+namespace xs
{
class io_thread_t;
@@ -41,12 +41,12 @@ namespace zmq
{
public:
- io_object_t (zmq::io_thread_t *io_thread_ = NULL);
+ io_object_t (xs::io_thread_t *io_thread_ = NULL);
~io_object_t ();
// When migrating an object from one I/O thread to another, first
// unplug it, then migrate it, then plug it to the new thread.
- void plug (zmq::io_thread_t *io_thread_);
+ void plug (xs::io_thread_t *io_thread_);
void unplug ();
protected:
diff --git a/src/io_thread.cpp b/src/io_thread.cpp
index 40bbef9..e5abbe0 100644
--- a/src/io_thread.cpp
+++ b/src/io_thread.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -26,7 +26,7 @@
#include "err.hpp"
#include "ctx.hpp"
-zmq::io_thread_t::io_thread_t (ctx_t *ctx_, uint32_t tid_) :
+xs::io_thread_t::io_thread_t (ctx_t *ctx_, uint32_t tid_) :
object_t (ctx_, tid_)
{
poller = new (std::nothrow) poller_t;
@@ -36,33 +36,33 @@ zmq::io_thread_t::io_thread_t (ctx_t *ctx_, uint32_t tid_) :
poller->set_pollin (mailbox_handle);
}
-zmq::io_thread_t::~io_thread_t ()
+xs::io_thread_t::~io_thread_t ()
{
delete poller;
}
-void zmq::io_thread_t::start ()
+void xs::io_thread_t::start ()
{
// Start the underlying I/O thread.
poller->start ();
}
-void zmq::io_thread_t::stop ()
+void xs::io_thread_t::stop ()
{
send_stop ();
}
-zmq::mailbox_t *zmq::io_thread_t::get_mailbox ()
+xs::mailbox_t *xs::io_thread_t::get_mailbox ()
{
return &mailbox;
}
-int zmq::io_thread_t::get_load ()
+int xs::io_thread_t::get_load ()
{
return poller->get_load ();
}
-void zmq::io_thread_t::in_event ()
+void xs::io_thread_t::in_event ()
{
// TODO: Do we want to limit number of commands I/O thread can
// process in a single go?
@@ -83,25 +83,25 @@ void zmq::io_thread_t::in_event ()
}
}
-void zmq::io_thread_t::out_event ()
+void xs::io_thread_t::out_event ()
{
// We are never polling for POLLOUT here. This function is never called.
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::io_thread_t::timer_event (int id_)
+void xs::io_thread_t::timer_event (int id_)
{
// No timers here. This function is never called.
- zmq_assert (false);
+ xs_assert (false);
}
-zmq::poller_t *zmq::io_thread_t::get_poller ()
+xs::poller_t *xs::io_thread_t::get_poller ()
{
- zmq_assert (poller);
+ xs_assert (poller);
return poller;
}
-void zmq::io_thread_t::process_stop ()
+void xs::io_thread_t::process_stop ()
{
poller->rm_fd (mailbox_handle);
poller->stop ();
diff --git a/src/io_thread.hpp b/src/io_thread.hpp
index 00bd9a6..4884c5b 100644
--- a/src/io_thread.hpp
+++ b/src/io_thread.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_IO_THREAD_HPP_INCLUDED__
-#define __ZMQ_IO_THREAD_HPP_INCLUDED__
+#ifndef __XS_IO_THREAD_HPP_INCLUDED__
+#define __XS_IO_THREAD_HPP_INCLUDED__
#include <vector>
@@ -30,7 +30,7 @@
#include "i_poll_events.hpp"
#include "mailbox.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -42,7 +42,7 @@ namespace zmq
{
public:
- io_thread_t (zmq::ctx_t *ctx_, uint32_t tid_);
+ io_thread_t (xs::ctx_t *ctx_, uint32_t tid_);
// Clean-up. If the thread was started, it's neccessary to call 'stop'
// before invoking destructor. Otherwise the destructor would hang up.
diff --git a/src/ip.cpp b/src/ip.cpp
index 0b4596a..2e7f2db 100644
--- a/src/ip.cpp
+++ b/src/ip.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -23,7 +23,7 @@
#include "err.hpp"
#include "platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <fcntl.h>
@@ -33,15 +33,15 @@
#include <netinet/tcp.h>
#endif
-#if defined ZMQ_HAVE_OPENVMS
+#if defined XS_HAVE_OPENVMS
#include <ioctl.h>
#endif
-zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
+xs::fd_t xs::open_socket (int domain_, int type_, int protocol_)
{
// Setting this option result in sane behaviour when exec() functions
// are used. Old sockets are closed and don't block TCP ports etc.
-#if defined ZMQ_HAVE_SOCK_CLOEXEC
+#if defined XS_HAVE_SOCK_CLOEXEC
type_ |= SOCK_CLOEXEC;
#endif
@@ -52,7 +52,7 @@ zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
// If there's no SOCK_CLOEXEC, let's try the second best option. Note that
// race condition can cause socket not to be closed (if fork happens
// between socket creation and this point).
-#if !defined ZMQ_HAVE_SOCK_CLOEXEC && defined FD_CLOEXEC
+#if !defined XS_HAVE_SOCK_CLOEXEC && defined FD_CLOEXEC
int rc = fcntl (s, F_SETFD, FD_CLOEXEC);
errno_assert (rc != -1);
#endif
@@ -60,21 +60,21 @@ zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
return s;
}
-void zmq::tune_tcp_socket (fd_t s_)
+void xs::tune_tcp_socket (fd_t s_)
{
- // Disable Nagle's algorithm. We are doing data batching on 0MQ level,
- // so using Nagle wouldn't improve throughput in anyway, but it would
- // hurt latency.
+ // Disable Nagle's algorithm. We are doing data batching on Crossroads
+ // level, so using Nagle wouldn't improve throughput in anyway, but it
+ // would hurt latency.
int nodelay = 1;
int rc = setsockopt (s_, IPPROTO_TCP, TCP_NODELAY, (char*) &nodelay,
sizeof (int));
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
wsa_assert (rc != SOCKET_ERROR);
#else
errno_assert (rc == 0);
#endif
-#ifdef ZMQ_HAVE_OPENVMS
+#ifdef XS_HAVE_OPENVMS
// Disable delayed acknowledgements as they hurt latency is serious manner.
int nodelack = 1;
rc = setsockopt (s_, IPPROTO_TCP, TCP_NODELACK, (char*) &nodelack,
@@ -83,13 +83,13 @@ void zmq::tune_tcp_socket (fd_t s_)
#endif
}
-void zmq::unblock_socket (fd_t s_)
+void xs::unblock_socket (fd_t s_)
{
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
u_long nonblock = 1;
int rc = ioctlsocket (s_, FIONBIO, &nonblock);
wsa_assert (rc != SOCKET_ERROR);
-#elif ZMQ_HAVE_OPENVMS
+#elif XS_HAVE_OPENVMS
int nonblock = 1;
int rc = ioctl (s_, FIONBIO, &nonblock);
errno_assert (rc != -1);
@@ -102,17 +102,17 @@ void zmq::unblock_socket (fd_t s_)
#endif
}
-void zmq::enable_ipv4_mapping (fd_t s_)
+void xs::enable_ipv4_mapping (fd_t s_)
{
#ifdef IPV6_V6ONLY
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
DWORD flag = 0;
#else
int flag = 0;
#endif
int rc = setsockopt (s_, IPPROTO_IPV6, IPV6_V6ONLY, (const char*) &flag,
sizeof (flag));
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
wsa_assert (rc != SOCKET_ERROR);
#else
errno_assert (rc == 0);
diff --git a/src/ip.hpp b/src/ip.hpp
index c5f31db..d2fcc72 100644
--- a/src/ip.hpp
+++ b/src/ip.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,12 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_IP_HPP_INCLUDED__
-#define __ZMQ_IP_HPP_INCLUDED__
+#ifndef __XS_IP_HPP_INCLUDED__
+#define __XS_IP_HPP_INCLUDED__
#include "fd.hpp"
-namespace zmq
+namespace xs
{
// Same as socket(2), but allows for transparent tweaking the options.
diff --git a/src/ipc_address.cpp b/src/ipc_address.cpp
index d601c56..1309474 100644
--- a/src/ipc_address.cpp
+++ b/src/ipc_address.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,22 +20,22 @@
#include "ipc_address.hpp"
-#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+#if !defined XS_HAVE_WINDOWS && !defined XS_HAVE_OPENVMS
#include "err.hpp"
#include <string.h>
-zmq::ipc_address_t::ipc_address_t ()
+xs::ipc_address_t::ipc_address_t ()
{
memset (&address, 0, sizeof (address));
}
-zmq::ipc_address_t::~ipc_address_t ()
+xs::ipc_address_t::~ipc_address_t ()
{
}
-int zmq::ipc_address_t::resolve (const char *path_)
+int xs::ipc_address_t::resolve (const char *path_)
{
if (strlen (path_) >= sizeof (address.sun_path)) {
errno = ENAMETOOLONG;
@@ -47,12 +47,12 @@ int zmq::ipc_address_t::resolve (const char *path_)
return 0;
}
-sockaddr *zmq::ipc_address_t::addr ()
+sockaddr *xs::ipc_address_t::addr ()
{
return (sockaddr*) &address;
}
-socklen_t zmq::ipc_address_t::addrlen ()
+socklen_t xs::ipc_address_t::addrlen ()
{
return (socklen_t) sizeof (address);
}
diff --git a/src/ipc_address.hpp b/src/ipc_address.hpp
index 4a7f230..6907944 100644
--- a/src/ipc_address.hpp
+++ b/src/ipc_address.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,17 +18,17 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_IPC_ADDRESS_HPP_INCLUDED__
-#define __ZMQ_IPC_ADDRESS_HPP_INCLUDED__
+#ifndef __XS_IPC_ADDRESS_HPP_INCLUDED__
+#define __XS_IPC_ADDRESS_HPP_INCLUDED__
#include "platform.hpp"
-#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+#if !defined XS_HAVE_WINDOWS && !defined XS_HAVE_OPENVMS
#include <sys/socket.h>
#include <sys/un.h>
-namespace zmq
+namespace xs
{
class ipc_address_t
diff --git a/src/ipc_connecter.cpp b/src/ipc_connecter.cpp
index 58dccf4..1d7c386 100644
--- a/src/ipc_connecter.cpp
+++ b/src/ipc_connecter.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,7 +20,7 @@
#include "ipc_connecter.hpp"
-#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+#if !defined XS_HAVE_WINDOWS && !defined XS_HAVE_OPENVMS
#include <new>
#include <string>
@@ -37,7 +37,7 @@
#include <sys/socket.h>
#include <sys/un.h>
-zmq::ipc_connecter_t::ipc_connecter_t (class io_thread_t *io_thread_,
+xs::ipc_connecter_t::ipc_connecter_t (class io_thread_t *io_thread_,
class session_base_t *session_, const options_t &options_,
const char *address_, bool wait_) :
own_t (io_thread_, options_),
@@ -51,10 +51,10 @@ zmq::ipc_connecter_t::ipc_connecter_t (class io_thread_t *io_thread_,
// TODO: set_addess should be called separately, so that the error
// can be propagated.
int rc = set_address (address_);
- zmq_assert (rc == 0);
+ xs_assert (rc == 0);
}
-zmq::ipc_connecter_t::~ipc_connecter_t ()
+xs::ipc_connecter_t::~ipc_connecter_t ()
{
if (wait)
cancel_timer (reconnect_timer_id);
@@ -65,7 +65,7 @@ zmq::ipc_connecter_t::~ipc_connecter_t ()
close ();
}
-void zmq::ipc_connecter_t::process_plug ()
+void xs::ipc_connecter_t::process_plug ()
{
if (wait)
add_reconnect_timer();
@@ -73,7 +73,7 @@ void zmq::ipc_connecter_t::process_plug ()
start_connecting ();
}
-void zmq::ipc_connecter_t::in_event ()
+void xs::ipc_connecter_t::in_event ()
{
// We are not polling for incomming data, so we are actually called
// because of error here. However, we can get error on out event as well
@@ -81,7 +81,7 @@ void zmq::ipc_connecter_t::in_event ()
out_event ();
}
-void zmq::ipc_connecter_t::out_event ()
+void xs::ipc_connecter_t::out_event ()
{
fd_t fd = connect ();
rm_fd (handle);
@@ -106,14 +106,14 @@ void zmq::ipc_connecter_t::out_event ()
terminate ();
}
-void zmq::ipc_connecter_t::timer_event (int id_)
+void xs::ipc_connecter_t::timer_event (int id_)
{
- zmq_assert (id_ == reconnect_timer_id);
+ xs_assert (id_ == reconnect_timer_id);
wait = false;
start_connecting ();
}
-void zmq::ipc_connecter_t::start_connecting ()
+void xs::ipc_connecter_t::start_connecting ()
{
// Open the connecting socket.
int rc = open ();
@@ -140,12 +140,12 @@ void zmq::ipc_connecter_t::start_connecting ()
add_reconnect_timer();
}
-void zmq::ipc_connecter_t::add_reconnect_timer()
+void xs::ipc_connecter_t::add_reconnect_timer()
{
add_timer (get_new_reconnect_ivl(), reconnect_timer_id);
}
-int zmq::ipc_connecter_t::get_new_reconnect_ivl ()
+int xs::ipc_connecter_t::get_new_reconnect_ivl ()
{
// The new interval is the current interval + random value.
int this_interval = current_reconnect_ivl +
@@ -165,14 +165,14 @@ int zmq::ipc_connecter_t::get_new_reconnect_ivl ()
return this_interval;
}
-int zmq::ipc_connecter_t::set_address (const char *addr_)
+int xs::ipc_connecter_t::set_address (const char *addr_)
{
return address.resolve (addr_);
}
-int zmq::ipc_connecter_t::open ()
+int xs::ipc_connecter_t::open ()
{
- zmq_assert (s == retired_fd);
+ xs_assert (s == retired_fd);
// Create the socket.
s = open_socket (AF_UNIX, SOCK_STREAM, 0);
@@ -193,9 +193,9 @@ int zmq::ipc_connecter_t::open ()
return -1;
}
-int zmq::ipc_connecter_t::close ()
+int xs::ipc_connecter_t::close ()
{
- zmq_assert (s != retired_fd);
+ xs_assert (s != retired_fd);
int rc = ::close (s);
if (rc != 0)
return -1;
@@ -203,12 +203,12 @@ int zmq::ipc_connecter_t::close ()
return 0;
}
-zmq::fd_t zmq::ipc_connecter_t::connect ()
+xs::fd_t xs::ipc_connecter_t::connect ()
{
// Following code should handle both Berkeley-derived socket
// implementations and Solaris.
int err = 0;
-#if defined ZMQ_HAVE_HPUX
+#if defined XS_HAVE_HPUX
int len = sizeof (err);
#else
socklen_t len = sizeof (err);
@@ -218,7 +218,7 @@ zmq::fd_t zmq::ipc_connecter_t::connect ()
err = errno;
if (err != 0) {
- // Assert if the error was caused by 0MQ bug.
+ // Assert if the error was caused by Crossroads bug.
// Networking problems are OK. No need to assert.
errno = err;
errno_assert (errno == ECONNREFUSED || errno == ECONNRESET ||
diff --git a/src/ipc_connecter.hpp b/src/ipc_connecter.hpp
index d2d1752..d22faab 100644
--- a/src/ipc_connecter.hpp
+++ b/src/ipc_connecter.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -23,7 +23,7 @@
#include "platform.hpp"
-#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+#if !defined XS_HAVE_WINDOWS && !defined XS_HAVE_OPENVMS
#include "fd.hpp"
#include "own.hpp"
@@ -31,7 +31,7 @@
#include "io_object.hpp"
#include "ipc_address.hpp"
-namespace zmq
+namespace xs
{
class io_thread_t;
@@ -43,8 +43,8 @@ namespace zmq
// If 'delay' is true connecter first waits for a while, then starts
// connection process.
- ipc_connecter_t (zmq::io_thread_t *io_thread_,
- zmq::session_base_t *session_, const options_t &options_,
+ ipc_connecter_t (xs::io_thread_t *io_thread_,
+ xs::session_base_t *session_, const options_t &options_,
const char *address_, bool delay_);
~ipc_connecter_t ();
@@ -104,7 +104,7 @@ namespace zmq
bool wait;
// Reference to the session we belong to.
- zmq::session_base_t *session;
+ xs::session_base_t *session;
// Current reconnect ivl, updated for backoff strategy
int current_reconnect_ivl;
diff --git a/src/ipc_listener.cpp b/src/ipc_listener.cpp
index 07a7dff..accd09c 100644
--- a/src/ipc_listener.cpp
+++ b/src/ipc_listener.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,7 +20,7 @@
#include "ipc_listener.hpp"
-#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+#if !defined XS_HAVE_WINDOWS && !defined XS_HAVE_OPENVMS
#include <new>
@@ -39,7 +39,7 @@
#include <fcntl.h>
#include <sys/un.h>
-zmq::ipc_listener_t::ipc_listener_t (io_thread_t *io_thread_,
+xs::ipc_listener_t::ipc_listener_t (io_thread_t *io_thread_,
socket_base_t *socket_, const options_t &options_) :
own_t (io_thread_, options_),
io_object_t (io_thread_),
@@ -49,26 +49,26 @@ zmq::ipc_listener_t::ipc_listener_t (io_thread_t *io_thread_,
{
}
-zmq::ipc_listener_t::~ipc_listener_t ()
+xs::ipc_listener_t::~ipc_listener_t ()
{
if (s != retired_fd)
close ();
}
-void zmq::ipc_listener_t::process_plug ()
+void xs::ipc_listener_t::process_plug ()
{
// Start polling for incoming connections.
handle = add_fd (s);
set_pollin (handle);
}
-void zmq::ipc_listener_t::process_term (int linger_)
+void xs::ipc_listener_t::process_term (int linger_)
{
rm_fd (handle);
own_t::process_term (linger_);
}
-void zmq::ipc_listener_t::in_event ()
+void xs::ipc_listener_t::in_event ()
{
fd_t fd = accept ();
@@ -84,7 +84,7 @@ void zmq::ipc_listener_t::in_event ()
// Choose I/O thread to run connecter in. Given that we are already
// running in an I/O thread, there must be at least one available.
io_thread_t *io_thread = choose_io_thread (options.affinity);
- zmq_assert (io_thread);
+ xs_assert (io_thread);
// Create and launch a session object.
session_base_t *session = session_base_t::create (io_thread, false, socket,
@@ -95,7 +95,7 @@ void zmq::ipc_listener_t::in_event ()
send_attach (session, engine, false);
}
-int zmq::ipc_listener_t::set_address (const char *addr_)
+int xs::ipc_listener_t::set_address (const char *addr_)
{
// Get rid of the file associated with the UNIX domain socket that
// may have been left behind by the previous run of the application.
@@ -128,9 +128,9 @@ int zmq::ipc_listener_t::set_address (const char *addr_)
return 0;
}
-int zmq::ipc_listener_t::close ()
+int xs::ipc_listener_t::close ()
{
- zmq_assert (s != retired_fd);
+ xs_assert (s != retired_fd);
int rc = ::close (s);
if (rc != 0)
return -1;
@@ -147,10 +147,10 @@ int zmq::ipc_listener_t::close ()
return 0;
}
-zmq::fd_t zmq::ipc_listener_t::accept ()
+xs::fd_t xs::ipc_listener_t::accept ()
{
// Accept one connection and deal with different failure modes.
- zmq_assert (s != retired_fd);
+ xs_assert (s != retired_fd);
fd_t sock = ::accept (s, NULL, NULL);
if (sock == -1) {
errno_assert (errno == EAGAIN || errno == EWOULDBLOCK ||
diff --git a/src/ipc_listener.hpp b/src/ipc_listener.hpp
index e1f4817..d2e19df 100644
--- a/src/ipc_listener.hpp
+++ b/src/ipc_listener.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,12 +18,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_IPC_LISTENER_HPP_INCLUDED__
-#define __ZMQ_IPC_LISTENER_HPP_INCLUDED__
+#ifndef __XS_IPC_LISTENER_HPP_INCLUDED__
+#define __XS_IPC_LISTENER_HPP_INCLUDED__
#include "platform.hpp"
-#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+#if !defined XS_HAVE_WINDOWS && !defined XS_HAVE_OPENVMS
#include <string>
@@ -32,7 +32,7 @@
#include "stdint.hpp"
#include "io_object.hpp"
-namespace zmq
+namespace xs
{
class io_thread_t;
@@ -42,8 +42,8 @@ namespace zmq
{
public:
- ipc_listener_t (zmq::io_thread_t *io_thread_,
- zmq::socket_base_t *socket_, const options_t &options_);
+ ipc_listener_t (xs::io_thread_t *io_thread_,
+ xs::socket_base_t *socket_, const options_t &options_);
~ipc_listener_t ();
// Set address to listen on.
@@ -79,7 +79,7 @@ namespace zmq
handle_t handle;
// Socket the listerner belongs to.
- zmq::socket_base_t *socket;
+ xs::socket_base_t *socket;
ipc_listener_t (const ipc_listener_t&);
const ipc_listener_t &operator = (const ipc_listener_t&);
diff --git a/src/kqueue.cpp b/src/kqueue.cpp
index 0b07fab..046cbc7 100644
--- a/src/kqueue.cpp
+++ b/src/kqueue.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,7 +20,7 @@
*/
#include "kqueue.hpp"
-#if defined ZMQ_USE_KQUEUE
+#if defined XS_USE_KQUEUE
#include <sys/time.h>
#include <sys/types.h>
@@ -38,13 +38,13 @@
// NetBSD defines (struct kevent).udata as intptr_t, everyone else
// as void *.
-#if defined ZMQ_HAVE_NETBSD
+#if defined XS_HAVE_NETBSD
#define kevent_udata_t intptr_t
#else
#define kevent_udata_t void *
#endif
-zmq::kqueue_t::kqueue_t () :
+xs::kqueue_t::kqueue_t () :
stopping (false)
{
// Create event queue
@@ -52,13 +52,13 @@ zmq::kqueue_t::kqueue_t () :
errno_assert (kqueue_fd != -1);
}
-zmq::kqueue_t::~kqueue_t ()
+xs::kqueue_t::~kqueue_t ()
{
worker.stop ();
close (kqueue_fd);
}
-void zmq::kqueue_t::kevent_add (fd_t fd_, short filter_, void *udata_)
+void xs::kqueue_t::kevent_add (fd_t fd_, short filter_, void *udata_)
{
struct kevent ev;
@@ -67,7 +67,7 @@ void zmq::kqueue_t::kevent_add (fd_t fd_, short filter_, void *udata_)
errno_assert (rc != -1);
}
-void zmq::kqueue_t::kevent_delete (fd_t fd_, short filter_)
+void xs::kqueue_t::kevent_delete (fd_t fd_, short filter_)
{
struct kevent ev;
@@ -76,7 +76,7 @@ void zmq::kqueue_t::kevent_delete (fd_t fd_, short filter_)
errno_assert (rc != -1);
}
-zmq::kqueue_t::handle_t zmq::kqueue_t::add_fd (fd_t fd_,
+xs::kqueue_t::handle_t xs::kqueue_t::add_fd (fd_t fd_,
i_poll_events *reactor_)
{
poll_entry_t *pe = new (std::nothrow) poll_entry_t;
@@ -92,7 +92,7 @@ zmq::kqueue_t::handle_t zmq::kqueue_t::add_fd (fd_t fd_,
return pe;
}
-void zmq::kqueue_t::rm_fd (handle_t handle_)
+void xs::kqueue_t::rm_fd (handle_t handle_)
{
poll_entry_t *pe = (poll_entry_t*) handle_;
if (pe->flag_pollin)
@@ -105,7 +105,7 @@ void zmq::kqueue_t::rm_fd (handle_t handle_)
adjust_load (-1);
}
-void zmq::kqueue_t::set_pollin (handle_t handle_)
+void xs::kqueue_t::set_pollin (handle_t handle_)
{
poll_entry_t *pe = (poll_entry_t*) handle_;
if (likely (!pe->flag_pollin)) {
@@ -114,7 +114,7 @@ void zmq::kqueue_t::set_pollin (handle_t handle_)
}
}
-void zmq::kqueue_t::reset_pollin (handle_t handle_)
+void xs::kqueue_t::reset_pollin (handle_t handle_)
{
poll_entry_t *pe = (poll_entry_t*) handle_;
if (likely (pe->flag_pollin)) {
@@ -123,7 +123,7 @@ void zmq::kqueue_t::reset_pollin (handle_t handle_)
}
}
-void zmq::kqueue_t::set_pollout (handle_t handle_)
+void xs::kqueue_t::set_pollout (handle_t handle_)
{
poll_entry_t *pe = (poll_entry_t*) handle_;
if (likely (!pe->flag_pollout)) {
@@ -132,7 +132,7 @@ void zmq::kqueue_t::set_pollout (handle_t handle_)
}
}
-void zmq::kqueue_t::reset_pollout (handle_t handle_)
+void xs::kqueue_t::reset_pollout (handle_t handle_)
{
poll_entry_t *pe = (poll_entry_t*) handle_;
if (likely (pe->flag_pollout)) {
@@ -141,17 +141,17 @@ void zmq::kqueue_t::reset_pollout (handle_t handle_)
}
}
-void zmq::kqueue_t::start ()
+void xs::kqueue_t::start ()
{
worker.start (worker_routine, this);
}
-void zmq::kqueue_t::stop ()
+void xs::kqueue_t::stop ()
{
stopping = true;
}
-void zmq::kqueue_t::loop ()
+void xs::kqueue_t::loop ()
{
while (!stopping) {
@@ -192,7 +192,7 @@ void zmq::kqueue_t::loop ()
}
}
-void zmq::kqueue_t::worker_routine (void *arg_)
+void xs::kqueue_t::worker_routine (void *arg_)
{
((kqueue_t*) arg_)->loop ();
}
diff --git a/src/kqueue.hpp b/src/kqueue.hpp
index b1352df..4ec909d 100644
--- a/src/kqueue.hpp
+++ b/src/kqueue.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,12 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_KQUEUE_HPP_INCLUDED__
-#define __ZMQ_KQUEUE_HPP_INCLUDED__
+#ifndef __XS_KQUEUE_HPP_INCLUDED__
+#define __XS_KQUEUE_HPP_INCLUDED__
// poller.hpp decides which polling mechanism to use.
#include "poller.hpp"
-#if defined ZMQ_USE_KQUEUE
+#if defined XS_USE_KQUEUE
#include <vector>
@@ -32,7 +32,7 @@
#include "thread.hpp"
#include "poller_base.hpp"
-namespace zmq
+namespace xs
{
struct i_poll_events;
@@ -50,7 +50,7 @@ namespace zmq
~kqueue_t ();
// "poller" concept.
- handle_t add_fd (fd_t fd_, zmq::i_poll_events *events_);
+ handle_t add_fd (fd_t fd_, xs::i_poll_events *events_);
void rm_fd (handle_t handle_);
void set_pollin (handle_t handle_);
void reset_pollin (handle_t handle_);
@@ -81,7 +81,7 @@ namespace zmq
fd_t fd;
bool flag_pollin;
bool flag_pollout;
- zmq::i_poll_events *reactor;
+ xs::i_poll_events *reactor;
};
// List of retired event sources.
diff --git a/src/lb.cpp b/src/lb.cpp
index 2a0f769..db4ad63 100644
--- a/src/lb.cpp
+++ b/src/lb.cpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -25,7 +25,7 @@
#include "err.hpp"
#include "msg.hpp"
-zmq::lb_t::lb_t () :
+xs::lb_t::lb_t () :
active (0),
current (0),
more (false),
@@ -33,19 +33,19 @@ zmq::lb_t::lb_t () :
{
}
-zmq::lb_t::~lb_t ()
+xs::lb_t::~lb_t ()
{
- zmq_assert (pipes.empty ());
+ xs_assert (pipes.empty ());
}
-void zmq::lb_t::attach (pipe_t *pipe_)
+void xs::lb_t::attach (pipe_t *pipe_)
{
pipes.push_back (pipe_);
pipes.swap (active, pipes.size () - 1);
active++;
}
-void zmq::lb_t::terminated (pipe_t *pipe_)
+void xs::lb_t::terminated (pipe_t *pipe_)
{
pipes_t::size_type index = pipes.index (pipe_);
@@ -64,14 +64,14 @@ void zmq::lb_t::terminated (pipe_t *pipe_)
pipes.erase (pipe_);
}
-void zmq::lb_t::activated (pipe_t *pipe_)
+void xs::lb_t::activated (pipe_t *pipe_)
{
// Move the pipe to the list of active pipes.
pipes.swap (pipes.index (pipe_), active);
active++;
}
-int zmq::lb_t::send (msg_t *msg_, int flags_)
+int xs::lb_t::send (msg_t *msg_, int flags_)
{
// Drop the message if required. If we are at the end of the message
// switch back to non-dropping mode.
@@ -84,7 +84,7 @@ int zmq::lb_t::send (msg_t *msg_, int flags_)
int rc = msg_->close ();
errno_assert (rc == 0);
rc = msg_->init ();
- zmq_assert (rc == 0);
+ xs_assert (rc == 0);
return 0;
}
@@ -94,7 +94,7 @@ int zmq::lb_t::send (msg_t *msg_, int flags_)
break;
}
- zmq_assert (!more);
+ xs_assert (!more);
active--;
if (current < active)
pipes.swap (current, active);
@@ -122,7 +122,7 @@ int zmq::lb_t::send (msg_t *msg_, int flags_)
return 0;
}
-bool zmq::lb_t::has_out ()
+bool xs::lb_t::has_out ()
{
// If one part of the message was already written we can definitely
// write the rest of the message.
diff --git a/src/lb.hpp b/src/lb.hpp
index 91189f5..981c3dc 100644
--- a/src/lb.hpp
+++ b/src/lb.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,13 +19,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_LB_HPP_INCLUDED__
-#define __ZMQ_LB_HPP_INCLUDED__
+#ifndef __XS_LB_HPP_INCLUDED__
+#define __XS_LB_HPP_INCLUDED__
#include "array.hpp"
#include "pipe.hpp"
-namespace zmq
+namespace xs
{
// This class manages a set of outbound pipes. On send it load balances
diff --git a/src/libzmq.pc.in b/src/libxs.pc.in
index ba155a3..c0f09f7 100644
--- a/src/libzmq.pc.in
+++ b/src/libxs.pc.in
@@ -3,8 +3,8 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
-Name: libzmq
-Description: 0MQ c++ library
+Name: libxs
+Description: Crossroads library
Version: @VERSION@
-Libs: -L${libdir} -lzmq
+Libs: -L${libdir} -lxs
Cflags: -I${includedir}
diff --git a/src/likely.hpp b/src/likely.hpp
index e604464..80b2a5d 100644
--- a/src/likely.hpp
+++ b/src/likely.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2009-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,8 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_LIKELY_HPP_INCLUDED__
-#define __ZMQ_LIKELY_HPP_INCLUDED__
+#ifndef __XS_LIKELY_HPP_INCLUDED__
+#define __XS_LIKELY_HPP_INCLUDED__
#if defined __GNUC__
#define likely(x) __builtin_expect ((x), 1)
diff --git a/src/mailbox.cpp b/src/mailbox.cpp
index ff16afe..d3c6697 100644
--- a/src/mailbox.cpp
+++ b/src/mailbox.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,27 +22,27 @@
#include "mailbox.hpp"
#include "err.hpp"
-zmq::mailbox_t::mailbox_t ()
+xs::mailbox_t::mailbox_t ()
{
// Get the pipe into passive state. That way, if the users starts by
// polling on the associated file descriptor it will get woken up when
// new command is posted.
bool ok = cpipe.read (NULL);
- zmq_assert (!ok);
+ xs_assert (!ok);
active = false;
}
-zmq::mailbox_t::~mailbox_t ()
+xs::mailbox_t::~mailbox_t ()
{
// TODO: Retrieve and deallocate commands inside the cpipe.
}
-zmq::fd_t zmq::mailbox_t::get_fd ()
+xs::fd_t xs::mailbox_t::get_fd ()
{
return signaler.get_fd ();
}
-void zmq::mailbox_t::send (const command_t &cmd_)
+void xs::mailbox_t::send (const command_t &cmd_)
{
sync.lock ();
cpipe.write (cmd_, false);
@@ -52,7 +52,7 @@ void zmq::mailbox_t::send (const command_t &cmd_)
signaler.send ();
}
-int zmq::mailbox_t::recv (command_t *cmd_, int timeout_)
+int xs::mailbox_t::recv (command_t *cmd_, int timeout_)
{
// Try to get the command straight away.
if (active) {
@@ -76,7 +76,7 @@ int zmq::mailbox_t::recv (command_t *cmd_, int timeout_)
// Get a command.
errno_assert (rc == 0);
bool ok = cpipe.read (cmd_);
- zmq_assert (ok);
+ xs_assert (ok);
return 0;
}
diff --git a/src/mailbox.hpp b/src/mailbox.hpp
index c059c2a..8771c09 100644
--- a/src/mailbox.hpp
+++ b/src/mailbox.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_MAILBOX_HPP_INCLUDED__
-#define __ZMQ_MAILBOX_HPP_INCLUDED__
+#ifndef __XS_MAILBOX_HPP_INCLUDED__
+#define __XS_MAILBOX_HPP_INCLUDED__
#include <stddef.h>
@@ -32,7 +32,7 @@
#include "ypipe.hpp"
#include "mutex.hpp"
-namespace zmq
+namespace xs
{
class mailbox_t
diff --git a/src/monitor.cpp b/src/monitor.cpp
index 1cccfd0..1937039 100644
--- a/src/monitor.cpp
+++ b/src/monitor.cpp
@@ -2,14 +2,14 @@
Copyright (c) 2012 250bpm s.r.o.
Copyright (c) 2012 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -24,49 +24,49 @@
#include "random.hpp"
#include "err.hpp"
-zmq::monitor_t::monitor_t (zmq::io_thread_t *io_thread_) :
+xs::monitor_t::monitor_t (xs::io_thread_t *io_thread_) :
own_t (io_thread_, options_t ()),
io_object_t (io_thread_)
{
}
-zmq::monitor_t::~monitor_t ()
+xs::monitor_t::~monitor_t ()
{
}
-void zmq::monitor_t::start ()
+void xs::monitor_t::start ()
{
send_plug (this);
}
-void zmq::monitor_t::stop ()
+void xs::monitor_t::stop ()
{
send_stop ();
}
-void zmq::monitor_t::log (int sid_, const char *text_)
+void xs::monitor_t::log (int sid_, const char *text_)
{
sync.lock ();
text = text_;
sync.unlock ();
}
-void zmq::monitor_t::process_plug ()
+void xs::monitor_t::process_plug ()
{
// Schedule sending of the first snapshot.
add_timer (500 + (generate_random () % 1000), timer_id);
}
-void zmq::monitor_t::process_stop ()
+void xs::monitor_t::process_stop ()
{
cancel_timer (timer_id);
send_done ();
delete this;
}
-void zmq::monitor_t::timer_event (int id_)
+void xs::monitor_t::timer_event (int id_)
{
- zmq_assert (id_ == timer_id);
+ xs_assert (id_ == timer_id);
// Send the snapshot here!
sync.lock ();
diff --git a/src/monitor.hpp b/src/monitor.hpp
index c8fa823..8aa58ba 100644
--- a/src/monitor.hpp
+++ b/src/monitor.hpp
@@ -2,14 +2,14 @@
Copyright (c) 2012 250bpm s.r.o.
Copyright (c) 2012 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,8 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_MONITOR_HPP_INCLUDED__
-#define __ZMQ_MONITOR_HPP_INCLUDED__
+#ifndef __XS_MONITOR_HPP_INCLUDED__
+#define __XS_MONITOR_HPP_INCLUDED__
#include <string>
@@ -27,7 +27,7 @@
#include "mutex.hpp"
#include "io_object.hpp"
-namespace zmq
+namespace xs
{
class io_thread_t;
@@ -37,7 +37,7 @@ namespace zmq
{
public:
- monitor_t (zmq::io_thread_t *io_thread_);
+ monitor_t (xs::io_thread_t *io_thread_);
~monitor_t ();
void start ();
diff --git a/src/msg.cpp b/src/msg.cpp
index 60d5bf3..3bda35f 100644
--- a/src/msg.cpp
+++ b/src/msg.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,7 +20,7 @@
*/
#include "msg.hpp"
-#include "../include/zmq.h"
+#include "../include/xs.h"
#include <string.h>
#include <errno.h>
@@ -31,17 +31,17 @@
#include "likely.hpp"
#include "err.hpp"
-// Check whether the sizes of public representation of the message (zmq_msg_t)
-// and private represenation of the message (zmq::msg_t) match.
-typedef char zmq_msg_size_check
- [2 * ((sizeof (zmq::msg_t) == sizeof (zmq_msg_t)) != 0) - 1];
+// Check whether the sizes of public representation of the message (xs_msg_t)
+// and private represenation of the message (xs::msg_t) match.
+typedef char xs_msg_size_check
+ [2 * ((sizeof (xs::msg_t) == sizeof (xs_msg_t)) != 0) - 1];
-bool zmq::msg_t::check ()
+bool xs::msg_t::check ()
{
return u.base.type >= type_min && u.base.type <= type_max;
}
-int zmq::msg_t::init ()
+int xs::msg_t::init ()
{
u.vsm.type = type_vsm;
u.vsm.flags = 0;
@@ -49,7 +49,7 @@ int zmq::msg_t::init ()
return 0;
}
-int zmq::msg_t::init_size (size_t size_)
+int xs::msg_t::init_size (size_t size_)
{
if (size_ <= max_vsm_size) {
u.vsm.type = type_vsm;
@@ -70,12 +70,12 @@ int zmq::msg_t::init_size (size_t size_)
u.lmsg.content->size = size_;
u.lmsg.content->ffn = NULL;
u.lmsg.content->hint = NULL;
- new (&u.lmsg.content->refcnt) zmq::atomic_counter_t ();
+ new (&u.lmsg.content->refcnt) xs::atomic_counter_t ();
}
return 0;
}
-int zmq::msg_t::init_data (void *data_, size_t size_, msg_free_fn *ffn_,
+int xs::msg_t::init_data (void *data_, size_t size_, msg_free_fn *ffn_,
void *hint_)
{
u.lmsg.type = type_lmsg;
@@ -90,19 +90,19 @@ int zmq::msg_t::init_data (void *data_, size_t size_, msg_free_fn *ffn_,
u.lmsg.content->size = size_;
u.lmsg.content->ffn = ffn_;
u.lmsg.content->hint = hint_;
- new (&u.lmsg.content->refcnt) zmq::atomic_counter_t ();
+ new (&u.lmsg.content->refcnt) xs::atomic_counter_t ();
return 0;
}
-int zmq::msg_t::init_delimiter ()
+int xs::msg_t::init_delimiter ()
{
u.delimiter.type = type_delimiter;
u.delimiter.flags = 0;
return 0;
}
-int zmq::msg_t::close ()
+int xs::msg_t::close ()
{
// Check the validity of the message.
if (unlikely (!check ())) {
@@ -135,7 +135,7 @@ int zmq::msg_t::close ()
}
-int zmq::msg_t::move (msg_t &src_)
+int xs::msg_t::move (msg_t &src_)
{
// Check the validity of the source.
if (unlikely (!src_.check ())) {
@@ -156,7 +156,7 @@ int zmq::msg_t::move (msg_t &src_)
return 0;
}
-int zmq::msg_t::copy (msg_t &src_)
+int xs::msg_t::copy (msg_t &src_)
{
// Check the validity of the source.
if (unlikely (!src_.check ())) {
@@ -186,10 +186,10 @@ int zmq::msg_t::copy (msg_t &src_)
}
-void *zmq::msg_t::data ()
+void *xs::msg_t::data ()
{
// Check the validity of the message.
- zmq_assert (check ());
+ xs_assert (check ());
switch (u.base.type) {
case type_vsm:
@@ -197,15 +197,15 @@ void *zmq::msg_t::data ()
case type_lmsg:
return u.lmsg.content->data;
default:
- zmq_assert (false);
+ xs_assert (false);
return NULL;
}
}
-size_t zmq::msg_t::size ()
+size_t xs::msg_t::size ()
{
// Check the validity of the message.
- zmq_assert (check ());
+ xs_assert (check ());
switch (u.base.type) {
case type_vsm:
@@ -213,39 +213,39 @@ size_t zmq::msg_t::size ()
case type_lmsg:
return u.lmsg.content->size;
default:
- zmq_assert (false);
+ xs_assert (false);
return 0;
}
}
-unsigned char zmq::msg_t::flags ()
+unsigned char xs::msg_t::flags ()
{
return u.base.flags;
}
-void zmq::msg_t::set_flags (unsigned char flags_)
+void xs::msg_t::set_flags (unsigned char flags_)
{
u.base.flags |= flags_;
}
-void zmq::msg_t::reset_flags (unsigned char flags_)
+void xs::msg_t::reset_flags (unsigned char flags_)
{
u.base.flags &= ~flags_;
}
-bool zmq::msg_t::is_delimiter ()
+bool xs::msg_t::is_delimiter ()
{
return u.base.type == type_delimiter;
}
-bool zmq::msg_t::is_vsm ()
+bool xs::msg_t::is_vsm ()
{
return u.base.type == type_vsm;
}
-void zmq::msg_t::add_refs (int refs_)
+void xs::msg_t::add_refs (int refs_)
{
- zmq_assert (refs_ >= 0);
+ xs_assert (refs_ >= 0);
// No copies required.
if (!refs_)
@@ -263,9 +263,9 @@ void zmq::msg_t::add_refs (int refs_)
}
}
-bool zmq::msg_t::rm_refs (int refs_)
+bool xs::msg_t::rm_refs (int refs_)
{
- zmq_assert (refs_ >= 0);
+ xs_assert (refs_ >= 0);
// No copies required.
if (!refs_)
diff --git a/src/msg.hpp b/src/msg.hpp
index 8c84670..671133b 100644
--- a/src/msg.hpp
+++ b/src/msg.hpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,8 +20,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_MSG_HPP_INCLUDE__
-#define __ZMQ_MSG_HPP_INCLUDE__
+#ifndef __XS_MSG_HPP_INCLUDE__
+#define __XS_MSG_HPP_INCLUDE__
#include <stddef.h>
@@ -30,13 +30,13 @@
// Signature for free function to deallocate the message content.
// Note that it has to be declared as "C" so that it is the same as
-// zmq_free_fn defined in zmq.h.
+// xs_free_fn defined in xs.h.
extern "C"
{
typedef void (msg_free_fn) (void *data, void *hint);
}
-namespace zmq
+namespace xs
{
// Note that this structure needs to be explicitly constructed
@@ -98,7 +98,7 @@ namespace zmq
size_t size;
msg_free_fn *ffn;
void *hint;
- zmq::atomic_counter_t refcnt;
+ xs::atomic_counter_t refcnt;
};
// Different message types.
diff --git a/src/mtrie.cpp b/src/mtrie.cpp
index 65b4fe8..3a0a339 100644
--- a/src/mtrie.cpp
+++ b/src/mtrie.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -24,7 +24,7 @@
#include <algorithm>
#include "platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#endif
@@ -32,13 +32,13 @@
#include "pipe.hpp"
#include "mtrie.hpp"
-zmq::mtrie_t::mtrie_t () :
+xs::mtrie_t::mtrie_t () :
min (0),
count (0)
{
}
-zmq::mtrie_t::~mtrie_t ()
+xs::mtrie_t::~mtrie_t ()
{
if (count == 1)
delete next.node;
@@ -50,12 +50,12 @@ zmq::mtrie_t::~mtrie_t ()
}
}
-bool zmq::mtrie_t::add (unsigned char *prefix_, size_t size_, pipe_t *pipe_)
+bool xs::mtrie_t::add (unsigned char *prefix_, size_t size_, pipe_t *pipe_)
{
return add_helper (prefix_, size_, pipe_);
}
-bool zmq::mtrie_t::add_helper (unsigned char *prefix_, size_t size_,
+bool xs::mtrie_t::add_helper (unsigned char *prefix_, size_t size_,
pipe_t *pipe_)
{
// We are at the node corresponding to the prefix. We are done.
@@ -81,7 +81,7 @@ bool zmq::mtrie_t::add_helper (unsigned char *prefix_, size_t size_,
count = (min < c ? c - min : min - c) + 1;
next.table = (mtrie_t**)
malloc (sizeof (mtrie_t*) * count);
- zmq_assert (next.table);
+ xs_assert (next.table);
for (unsigned short i = 0; i != count; ++i)
next.table [i] = 0;
min = std::min (min, c);
@@ -94,7 +94,7 @@ bool zmq::mtrie_t::add_helper (unsigned char *prefix_, size_t size_,
count = c - min + 1;
next.table = (mtrie_t**) realloc ((void*) next.table,
sizeof (mtrie_t*) * count);
- zmq_assert (next.table);
+ xs_assert (next.table);
for (unsigned short i = old_count; i != count; i++)
next.table [i] = NULL;
}
@@ -105,7 +105,7 @@ bool zmq::mtrie_t::add_helper (unsigned char *prefix_, size_t size_,
count = (min + old_count) - c;
next.table = (mtrie_t**) realloc ((void*) next.table,
sizeof (mtrie_t*) * count);
- zmq_assert (next.table);
+ xs_assert (next.table);
memmove (next.table + min - c, next.table,
old_count * sizeof (mtrie_t*));
for (unsigned short i = 0; i != min - c; i++)
@@ -118,21 +118,21 @@ bool zmq::mtrie_t::add_helper (unsigned char *prefix_, size_t size_,
if (count == 1) {
if (!next.node) {
next.node = new (std::nothrow) mtrie_t;
- zmq_assert (next.node);
+ xs_assert (next.node);
}
return next.node->add_helper (prefix_ + 1, size_ - 1, pipe_);
}
else {
if (!next.table [c - min]) {
next.table [c - min] = new (std::nothrow) mtrie_t;
- zmq_assert (next.table [c - min]);
+ xs_assert (next.table [c - min]);
}
return next.table [c - min]->add_helper (prefix_ + 1, size_ - 1, pipe_);
}
}
-void zmq::mtrie_t::rm (pipe_t *pipe_,
+void xs::mtrie_t::rm (pipe_t *pipe_,
void (*func_) (unsigned char *data_, size_t size_, void *arg_),
void *arg_)
{
@@ -141,7 +141,7 @@ void zmq::mtrie_t::rm (pipe_t *pipe_,
free (buff);
}
-void zmq::mtrie_t::rm_helper (pipe_t *pipe_, unsigned char **buff_,
+void xs::mtrie_t::rm_helper (pipe_t *pipe_, unsigned char **buff_,
size_t buffsize_, size_t maxbuffsize_,
void (*func_) (unsigned char *data_, size_t size_, void *arg_),
void *arg_)
@@ -179,17 +179,17 @@ void zmq::mtrie_t::rm_helper (pipe_t *pipe_, unsigned char **buff_,
}
}
-bool zmq::mtrie_t::rm (unsigned char *prefix_, size_t size_, pipe_t *pipe_)
+bool xs::mtrie_t::rm (unsigned char *prefix_, size_t size_, pipe_t *pipe_)
{
return rm_helper (prefix_, size_, pipe_);
}
-bool zmq::mtrie_t::rm_helper (unsigned char *prefix_, size_t size_,
+bool xs::mtrie_t::rm_helper (unsigned char *prefix_, size_t size_,
pipe_t *pipe_)
{
if (!size_) {
pipes_t::size_type erased = pipes.erase (pipe_);
- zmq_assert (erased == 1);
+ xs_assert (erased == 1);
return pipes.empty ();
}
@@ -206,7 +206,7 @@ bool zmq::mtrie_t::rm_helper (unsigned char *prefix_, size_t size_,
return next_node->rm_helper (prefix_ + 1, size_ - 1, pipe_);
}
-void zmq::mtrie_t::match (unsigned char *data_, size_t size_,
+void xs::mtrie_t::match (unsigned char *data_, size_t size_,
void (*func_) (pipe_t *pipe_, void *arg_), void *arg_)
{
mtrie_t *current = this;
diff --git a/src/mtrie.hpp b/src/mtrie.hpp
index 11ef940..9018d8f 100644
--- a/src/mtrie.hpp
+++ b/src/mtrie.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,15 +18,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_MTRIE_HPP_INCLUDED__
-#define __ZMQ_MTRIE_HPP_INCLUDED__
+#ifndef __XS_MTRIE_HPP_INCLUDED__
+#define __XS_MTRIE_HPP_INCLUDED__
#include <stddef.h>
#include <set>
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
class pipe_t;
@@ -42,35 +42,35 @@ namespace zmq
// Add key to the trie. Returns true if it's a new subscription
// rather than a duplicate.
- bool add (unsigned char *prefix_, size_t size_, zmq::pipe_t *pipe_);
+ bool add (unsigned char *prefix_, size_t size_, xs::pipe_t *pipe_);
// Remove all subscriptions for a specific peer from the trie.
// If there are no subscriptions left on some topics, invoke the
// supplied callback function.
- void rm (zmq::pipe_t *pipe_,
+ void rm (xs::pipe_t *pipe_,
void (*func_) (unsigned char *data_, size_t size_, void *arg_),
void *arg_);
// Remove specific subscription from the trie. Return true is it was
// actually removed rather than de-duplicated.
- bool rm (unsigned char *prefix_, size_t size_, zmq::pipe_t *pipe_);
+ bool rm (unsigned char *prefix_, size_t size_, xs::pipe_t *pipe_);
// Signal all the matching pipes.
void match (unsigned char *data_, size_t size_,
- void (*func_) (zmq::pipe_t *pipe_, void *arg_), void *arg_);
+ void (*func_) (xs::pipe_t *pipe_, void *arg_), void *arg_);
private:
bool add_helper (unsigned char *prefix_, size_t size_,
- zmq::pipe_t *pipe_);
- void rm_helper (zmq::pipe_t *pipe_, unsigned char **buff_,
+ xs::pipe_t *pipe_);
+ void rm_helper (xs::pipe_t *pipe_, unsigned char **buff_,
size_t buffsize_, size_t maxbuffsize_,
void (*func_) (unsigned char *data_, size_t size_, void *arg_),
void *arg_);
bool rm_helper (unsigned char *prefix_, size_t size_,
- zmq::pipe_t *pipe_);
+ xs::pipe_t *pipe_);
- typedef std::set <zmq::pipe_t*> pipes_t;
+ typedef std::set <xs::pipe_t*> pipes_t;
pipes_t pipes;
unsigned char min;
diff --git a/src/mutex.hpp b/src/mutex.hpp
index 8d7068a..118b5ef 100644
--- a/src/mutex.hpp
+++ b/src/mutex.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,19 +19,19 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_MUTEX_HPP_INCLUDED__
-#define __ZMQ_MUTEX_HPP_INCLUDED__
+#ifndef __XS_MUTEX_HPP_INCLUDED__
+#define __XS_MUTEX_HPP_INCLUDED__
#include "platform.hpp"
#include "err.hpp"
// Mutex class encapsulates OS mutex in a platform-independent way.
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
-namespace zmq
+namespace xs
{
class mutex_t
@@ -72,7 +72,7 @@ namespace zmq
#include <pthread.h>
-namespace zmq
+namespace xs
{
class mutex_t
diff --git a/src/object.cpp b/src/object.cpp
index e4e94d9..2d1f5aa 100644
--- a/src/object.cpp
+++ b/src/object.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -30,33 +30,33 @@
#include "session_base.hpp"
#include "socket_base.hpp"
-zmq::object_t::object_t (ctx_t *ctx_, uint32_t tid_) :
+xs::object_t::object_t (ctx_t *ctx_, uint32_t tid_) :
ctx (ctx_),
tid (tid_)
{
}
-zmq::object_t::object_t (object_t *parent_) :
+xs::object_t::object_t (object_t *parent_) :
ctx (parent_->ctx),
tid (parent_->tid)
{
}
-zmq::object_t::~object_t ()
+xs::object_t::~object_t ()
{
}
-uint32_t zmq::object_t::get_tid ()
+uint32_t xs::object_t::get_tid ()
{
return tid;
}
-zmq::ctx_t *zmq::object_t::get_ctx ()
+xs::ctx_t *xs::object_t::get_ctx ()
{
return ctx;
}
-void zmq::object_t::process_command (command_t &cmd_)
+void xs::object_t::process_command (command_t &cmd_)
{
switch (cmd_.type) {
@@ -125,51 +125,51 @@ void zmq::object_t::process_command (command_t &cmd_)
break;
default:
- zmq_assert (false);
+ xs_assert (false);
}
}
-int zmq::object_t::register_endpoint (const char *addr_, endpoint_t &endpoint_)
+int xs::object_t::register_endpoint (const char *addr_, endpoint_t &endpoint_)
{
return ctx->register_endpoint (addr_, endpoint_);
}
-void zmq::object_t::unregister_endpoints (socket_base_t *socket_)
+void xs::object_t::unregister_endpoints (socket_base_t *socket_)
{
return ctx->unregister_endpoints (socket_);
}
-zmq::endpoint_t zmq::object_t::find_endpoint (const char *addr_)
+xs::endpoint_t xs::object_t::find_endpoint (const char *addr_)
{
return ctx->find_endpoint (addr_);
}
-void zmq::object_t::destroy_socket (socket_base_t *socket_)
+void xs::object_t::destroy_socket (socket_base_t *socket_)
{
ctx->destroy_socket (socket_);
}
-zmq::io_thread_t *zmq::object_t::choose_io_thread (uint64_t affinity_)
+xs::io_thread_t *xs::object_t::choose_io_thread (uint64_t affinity_)
{
return ctx->choose_io_thread (affinity_);
}
-void zmq::object_t::log (int sid_, const char *text_)
+void xs::object_t::log (int sid_, const char *text_)
{
ctx->log (sid_, text_);
}
-void zmq::object_t::publish_logs (const char *text_)
+void xs::object_t::publish_logs (const char *text_)
{
ctx->publish_logs (text_);
}
-void zmq::object_t::send_stop ()
+void xs::object_t::send_stop ()
{
// 'stop' command goes always from administrative thread to
// the current object.
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = this;
@@ -177,13 +177,13 @@ void zmq::object_t::send_stop ()
ctx->send_command (tid, cmd);
}
-void zmq::object_t::send_plug (own_t *destination_, bool inc_seqnum_)
+void xs::object_t::send_plug (own_t *destination_, bool inc_seqnum_)
{
if (inc_seqnum_)
destination_->inc_seqnum ();
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -191,11 +191,11 @@ void zmq::object_t::send_plug (own_t *destination_, bool inc_seqnum_)
send_command (cmd);
}
-void zmq::object_t::send_own (own_t *destination_, own_t *object_)
+void xs::object_t::send_own (own_t *destination_, own_t *object_)
{
destination_->inc_seqnum ();
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -204,14 +204,14 @@ void zmq::object_t::send_own (own_t *destination_, own_t *object_)
send_command (cmd);
}
-void zmq::object_t::send_attach (session_base_t *destination_,
+void xs::object_t::send_attach (session_base_t *destination_,
i_engine *engine_, bool inc_seqnum_)
{
if (inc_seqnum_)
destination_->inc_seqnum ();
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -220,14 +220,14 @@ void zmq::object_t::send_attach (session_base_t *destination_,
send_command (cmd);
}
-void zmq::object_t::send_bind (own_t *destination_, pipe_t *pipe_,
+void xs::object_t::send_bind (own_t *destination_, pipe_t *pipe_,
bool inc_seqnum_)
{
if (inc_seqnum_)
destination_->inc_seqnum ();
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -236,10 +236,10 @@ void zmq::object_t::send_bind (own_t *destination_, pipe_t *pipe_,
send_command (cmd);
}
-void zmq::object_t::send_activate_read (pipe_t *destination_)
+void xs::object_t::send_activate_read (pipe_t *destination_)
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -247,11 +247,11 @@ void zmq::object_t::send_activate_read (pipe_t *destination_)
send_command (cmd);
}
-void zmq::object_t::send_activate_write (pipe_t *destination_,
+void xs::object_t::send_activate_write (pipe_t *destination_,
uint64_t msgs_read_)
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -260,10 +260,10 @@ void zmq::object_t::send_activate_write (pipe_t *destination_,
send_command (cmd);
}
-void zmq::object_t::send_hiccup (pipe_t *destination_, void *pipe_)
+void xs::object_t::send_hiccup (pipe_t *destination_, void *pipe_)
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -272,10 +272,10 @@ void zmq::object_t::send_hiccup (pipe_t *destination_, void *pipe_)
send_command (cmd);
}
-void zmq::object_t::send_pipe_term (pipe_t *destination_)
+void xs::object_t::send_pipe_term (pipe_t *destination_)
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -283,10 +283,10 @@ void zmq::object_t::send_pipe_term (pipe_t *destination_)
send_command (cmd);
}
-void zmq::object_t::send_pipe_term_ack (pipe_t *destination_)
+void xs::object_t::send_pipe_term_ack (pipe_t *destination_)
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -294,11 +294,11 @@ void zmq::object_t::send_pipe_term_ack (pipe_t *destination_)
send_command (cmd);
}
-void zmq::object_t::send_term_req (own_t *destination_,
+void xs::object_t::send_term_req (own_t *destination_,
own_t *object_)
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -307,10 +307,10 @@ void zmq::object_t::send_term_req (own_t *destination_,
send_command (cmd);
}
-void zmq::object_t::send_term (own_t *destination_, int linger_)
+void xs::object_t::send_term (own_t *destination_, int linger_)
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -319,10 +319,10 @@ void zmq::object_t::send_term (own_t *destination_, int linger_)
send_command (cmd);
}
-void zmq::object_t::send_term_ack (own_t *destination_)
+void xs::object_t::send_term_ack (own_t *destination_)
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = destination_;
@@ -330,10 +330,10 @@ void zmq::object_t::send_term_ack (own_t *destination_)
send_command (cmd);
}
-void zmq::object_t::send_reap (class socket_base_t *socket_)
+void xs::object_t::send_reap (class socket_base_t *socket_)
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = ctx->get_reaper ();
@@ -342,10 +342,10 @@ void zmq::object_t::send_reap (class socket_base_t *socket_)
send_command (cmd);
}
-void zmq::object_t::send_reaped ()
+void xs::object_t::send_reaped ()
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = ctx->get_reaper ();
@@ -353,10 +353,10 @@ void zmq::object_t::send_reaped ()
send_command (cmd);
}
-void zmq::object_t::send_done ()
+void xs::object_t::send_done ()
{
command_t cmd;
-#if defined ZMQ_MAKE_VALGRIND_HAPPY
+#if defined XS_MAKE_VALGRIND_HAPPY
memset (&cmd, 0, sizeof (cmd));
#endif
cmd.destination = NULL;
@@ -364,87 +364,87 @@ void zmq::object_t::send_done ()
ctx->send_command (ctx_t::term_tid, cmd);
}
-void zmq::object_t::process_stop ()
+void xs::object_t::process_stop ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_plug ()
+void xs::object_t::process_plug ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_own (own_t *object_)
+void xs::object_t::process_own (own_t *object_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_attach (i_engine *engine_)
+void xs::object_t::process_attach (i_engine *engine_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_bind (pipe_t *pipe_)
+void xs::object_t::process_bind (pipe_t *pipe_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_activate_read ()
+void xs::object_t::process_activate_read ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_activate_write (uint64_t msgs_read_)
+void xs::object_t::process_activate_write (uint64_t msgs_read_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_hiccup (void *pipe_)
+void xs::object_t::process_hiccup (void *pipe_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_pipe_term ()
+void xs::object_t::process_pipe_term ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_pipe_term_ack ()
+void xs::object_t::process_pipe_term_ack ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_term_req (own_t *object_)
+void xs::object_t::process_term_req (own_t *object_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_term (int linger_)
+void xs::object_t::process_term (int linger_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_term_ack ()
+void xs::object_t::process_term_ack ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_reap (class socket_base_t *socket_)
+void xs::object_t::process_reap (class socket_base_t *socket_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_reaped ()
+void xs::object_t::process_reaped ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::process_seqnum ()
+void xs::object_t::process_seqnum ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::object_t::send_command (command_t &cmd_)
+void xs::object_t::send_command (command_t &cmd_)
{
ctx->send_command (cmd_.destination->get_tid (), cmd_);
}
diff --git a/src/object.hpp b/src/object.hpp
index 6ea3bb2..b1bc0c3 100644
--- a/src/object.hpp
+++ b/src/object.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,12 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_OBJECT_HPP_INCLUDED__
-#define __ZMQ_OBJECT_HPP_INCLUDED__
+#ifndef __XS_OBJECT_HPP_INCLUDED__
+#define __XS_OBJECT_HPP_INCLUDED__
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
struct i_engine;
@@ -44,25 +44,25 @@ namespace zmq
{
public:
- object_t (zmq::ctx_t *ctx_, uint32_t tid_);
+ object_t (xs::ctx_t *ctx_, uint32_t tid_);
object_t (object_t *parent_);
virtual ~object_t ();
uint32_t get_tid ();
ctx_t *get_ctx ();
- void process_command (zmq::command_t &cmd_);
+ void process_command (xs::command_t &cmd_);
protected:
// Using following function, socket is able to access global
// repository of inproc endpoints.
- int register_endpoint (const char *addr_, zmq::endpoint_t &endpoint_);
- void unregister_endpoints (zmq::socket_base_t *socket_);
- zmq::endpoint_t find_endpoint (const char *addr_);
- void destroy_socket (zmq::socket_base_t *socket_);
+ int register_endpoint (const char *addr_, xs::endpoint_t &endpoint_);
+ void unregister_endpoints (xs::socket_base_t *socket_);
+ xs::endpoint_t find_endpoint (const char *addr_);
+ void destroy_socket (xs::socket_base_t *socket_);
// Chooses least loaded I/O thread.
- zmq::io_thread_t *choose_io_thread (uint64_t affinity_);
+ xs::io_thread_t *choose_io_thread (uint64_t affinity_);
// Logging related functions.
void log (int sid_, const char *text_);
@@ -71,25 +71,25 @@ namespace zmq
// Derived object can use these functions to send commands
// to other objects.
void send_stop ();
- void send_plug (zmq::own_t *destination_,
+ void send_plug (xs::own_t *destination_,
bool inc_seqnum_ = true);
- void send_own (zmq::own_t *destination_,
- zmq::own_t *object_);
- void send_attach (zmq::session_base_t *destination_,
- zmq::i_engine *engine_, bool inc_seqnum_ = true);
- void send_bind (zmq::own_t *destination_, zmq::pipe_t *pipe_,
+ void send_own (xs::own_t *destination_,
+ xs::own_t *object_);
+ void send_attach (xs::session_base_t *destination_,
+ xs::i_engine *engine_, bool inc_seqnum_ = true);
+ void send_bind (xs::own_t *destination_, xs::pipe_t *pipe_,
bool inc_seqnum_ = true);
- void send_activate_read (zmq::pipe_t *destination_);
- void send_activate_write (zmq::pipe_t *destination_,
+ void send_activate_read (xs::pipe_t *destination_);
+ void send_activate_write (xs::pipe_t *destination_,
uint64_t msgs_read_);
- void send_hiccup (zmq::pipe_t *destination_, void *pipe_);
- void send_pipe_term (zmq::pipe_t *destination_);
- void send_pipe_term_ack (zmq::pipe_t *destination_);
- void send_term_req (zmq::own_t *destination_,
- zmq::own_t *object_);
- void send_term (zmq::own_t *destination_, int linger_);
- void send_term_ack (zmq::own_t *destination_);
- void send_reap (zmq::socket_base_t *socket_);
+ void send_hiccup (xs::pipe_t *destination_, void *pipe_);
+ void send_pipe_term (xs::pipe_t *destination_);
+ void send_pipe_term_ack (xs::pipe_t *destination_);
+ void send_term_req (xs::own_t *destination_,
+ xs::own_t *object_);
+ void send_term (xs::own_t *destination_, int linger_);
+ void send_term_ack (xs::own_t *destination_);
+ void send_reap (xs::socket_base_t *socket_);
void send_reaped ();
void send_done ();
@@ -97,18 +97,18 @@ namespace zmq
// called when command arrives from another thread.
virtual void process_stop ();
virtual void process_plug ();
- virtual void process_own (zmq::own_t *object_);
- virtual void process_attach (zmq::i_engine *engine_);
- virtual void process_bind (zmq::pipe_t *pipe_);
+ virtual void process_own (xs::own_t *object_);
+ virtual void process_attach (xs::i_engine *engine_);
+ virtual void process_bind (xs::pipe_t *pipe_);
virtual void process_activate_read ();
virtual void process_activate_write (uint64_t msgs_read_);
virtual void process_hiccup (void *pipe_);
virtual void process_pipe_term ();
virtual void process_pipe_term_ack ();
- virtual void process_term_req (zmq::own_t *object_);
+ virtual void process_term_req (xs::own_t *object_);
virtual void process_term (int linger_);
virtual void process_term_ack ();
- virtual void process_reap (zmq::socket_base_t *socket_);
+ virtual void process_reap (xs::socket_base_t *socket_);
virtual void process_reaped ();
// Special handler called after a command that requires a seqnum
@@ -119,7 +119,7 @@ namespace zmq
private:
// Context provides access to the global state.
- zmq::ctx_t *ctx;
+ xs::ctx_t *ctx;
// Thread ID of the thread the object belongs to.
uint32_t tid;
diff --git a/src/options.cpp b/src/options.cpp
index 61daf87..b8f7709 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -4,14 +4,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -25,7 +25,7 @@
#include "options.hpp"
#include "err.hpp"
-zmq::options_t::options_t () :
+xs::options_t::options_t () :
sndhwm (1000),
rcvhwm (1000),
affinity (0),
@@ -53,12 +53,12 @@ zmq::options_t::options_t () :
{
}
-int zmq::options_t::setsockopt (int option_, const void *optval_,
+int xs::options_t::setsockopt (int option_, const void *optval_,
size_t optvallen_)
{
switch (option_) {
- case ZMQ_SNDHWM:
+ case XS_SNDHWM:
if (optvallen_ != sizeof (int) || *((int*) optval_) < 0) {
errno = EINVAL;
return -1;
@@ -66,7 +66,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
sndhwm = *((int*) optval_);
return 0;
- case ZMQ_RCVHWM:
+ case XS_RCVHWM:
if (optvallen_ != sizeof (int) || *((int*) optval_) < 0) {
errno = EINVAL;
return -1;
@@ -74,7 +74,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
rcvhwm = *((int*) optval_);
return 0;
- case ZMQ_AFFINITY:
+ case XS_AFFINITY:
if (optvallen_ != sizeof (uint64_t)) {
errno = EINVAL;
return -1;
@@ -82,7 +82,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
affinity = *((uint64_t*) optval_);
return 0;
- case ZMQ_IDENTITY:
+ case XS_IDENTITY:
// Empty identity is invalid as well as identity longer than
// 255 bytes. Identity starting with binary zero is invalid
@@ -96,7 +96,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
memcpy (identity, optval_, identity_size);
return 0;
- case ZMQ_RATE:
+ case XS_RATE:
if (optvallen_ != sizeof (int) || *((int*) optval_) <= 0) {
errno = EINVAL;
return -1;
@@ -104,7 +104,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
rate = *((int*) optval_);
return 0;
- case ZMQ_RECOVERY_IVL:
+ case XS_RECOVERY_IVL:
if (optvallen_ != sizeof (int) || *((int*) optval_) < 0) {
errno = EINVAL;
return -1;
@@ -112,7 +112,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
recovery_ivl = *((int*) optval_);
return 0;
- case ZMQ_SNDBUF:
+ case XS_SNDBUF:
if (optvallen_ != sizeof (int) || *((int*) optval_) < 0) {
errno = EINVAL;
return -1;
@@ -120,7 +120,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
sndbuf = *((int*) optval_);
return 0;
- case ZMQ_RCVBUF:
+ case XS_RCVBUF:
if (optvallen_ != sizeof (int) || *((int*) optval_) < 0) {
errno = EINVAL;
return -1;
@@ -128,7 +128,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
rcvbuf = *((int*) optval_);
return 0;
- case ZMQ_LINGER:
+ case XS_LINGER:
if (optvallen_ != sizeof (int)) {
errno = EINVAL;
return -1;
@@ -136,7 +136,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
linger = *((int*) optval_);
return 0;
- case ZMQ_RECONNECT_IVL:
+ case XS_RECONNECT_IVL:
if (optvallen_ != sizeof (int)) {
errno = EINVAL;
return -1;
@@ -148,7 +148,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
reconnect_ivl = *((int*) optval_);
return 0;
- case ZMQ_RECONNECT_IVL_MAX:
+ case XS_RECONNECT_IVL_MAX:
if (optvallen_ != sizeof (int)) {
errno = EINVAL;
return -1;
@@ -160,7 +160,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
reconnect_ivl_max = *((int*) optval_);
return 0;
- case ZMQ_BACKLOG:
+ case XS_BACKLOG:
if (optvallen_ != sizeof (int)) {
errno = EINVAL;
return -1;
@@ -168,7 +168,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
backlog = *((int*) optval_);
return 0;
- case ZMQ_MAXMSGSIZE:
+ case XS_MAXMSGSIZE:
if (optvallen_ != sizeof (int64_t)) {
errno = EINVAL;
return -1;
@@ -176,7 +176,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
maxmsgsize = *((int64_t*) optval_);
return 0;
- case ZMQ_MULTICAST_HOPS:
+ case XS_MULTICAST_HOPS:
if (optvallen_ != sizeof (int) || *((int*) optval_) <= 0) {
errno = EINVAL;
return -1;
@@ -184,7 +184,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
multicast_hops = *((int*) optval_);
return 0;
- case ZMQ_RCVTIMEO:
+ case XS_RCVTIMEO:
if (optvallen_ != sizeof (int)) {
errno = EINVAL;
return -1;
@@ -192,7 +192,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
rcvtimeo = *((int*) optval_);
return 0;
- case ZMQ_SNDTIMEO:
+ case XS_SNDTIMEO:
if (optvallen_ != sizeof (int)) {
errno = EINVAL;
return -1;
@@ -200,7 +200,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
sndtimeo = *((int*) optval_);
return 0;
- case ZMQ_IPV4ONLY:
+ case XS_IPV4ONLY:
{
if (optvallen_ != sizeof (int)) {
errno = EINVAL;
@@ -221,11 +221,11 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return -1;
}
-int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
+int xs::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
{
switch (option_) {
- case ZMQ_SNDHWM:
+ case XS_SNDHWM:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -234,7 +234,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_RCVHWM:
+ case XS_RCVHWM:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -243,7 +243,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_AFFINITY:
+ case XS_AFFINITY:
if (*optvallen_ < sizeof (uint64_t)) {
errno = EINVAL;
return -1;
@@ -252,7 +252,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (uint64_t);
return 0;
- case ZMQ_IDENTITY:
+ case XS_IDENTITY:
if (*optvallen_ < identity_size) {
errno = EINVAL;
return -1;
@@ -261,7 +261,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = identity_size;
return 0;
- case ZMQ_RATE:
+ case XS_RATE:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -270,7 +270,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_RECOVERY_IVL:
+ case XS_RECOVERY_IVL:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -279,7 +279,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_SNDBUF:
+ case XS_SNDBUF:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -288,7 +288,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_RCVBUF:
+ case XS_RCVBUF:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -297,7 +297,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_TYPE:
+ case XS_TYPE:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -306,7 +306,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_LINGER:
+ case XS_LINGER:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -315,7 +315,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_RECONNECT_IVL:
+ case XS_RECONNECT_IVL:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -324,7 +324,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_RECONNECT_IVL_MAX:
+ case XS_RECONNECT_IVL_MAX:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -333,7 +333,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_BACKLOG:
+ case XS_BACKLOG:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -342,7 +342,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_MAXMSGSIZE:
+ case XS_MAXMSGSIZE:
if (*optvallen_ < sizeof (int64_t)) {
errno = EINVAL;
return -1;
@@ -351,7 +351,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int64_t);
return 0;
- case ZMQ_MULTICAST_HOPS:
+ case XS_MULTICAST_HOPS:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -360,7 +360,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_RCVTIMEO:
+ case XS_RCVTIMEO:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -369,7 +369,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_SNDTIMEO:
+ case XS_SNDTIMEO:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -378,7 +378,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int);
return 0;
- case ZMQ_IPV4ONLY:
+ case XS_IPV4ONLY:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
diff --git a/src/options.hpp b/src/options.hpp
index 9a93af4..e6d0edc 100644
--- a/src/options.hpp
+++ b/src/options.hpp
@@ -4,14 +4,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,13 +20,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_OPTIONS_HPP_INCLUDED__
-#define __ZMQ_OPTIONS_HPP_INCLUDED__
+#ifndef __XS_OPTIONS_HPP_INCLUDED__
+#define __XS_OPTIONS_HPP_INCLUDED__
#include "stddef.h"
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
struct options_t
diff --git a/src/own.cpp b/src/own.cpp
index d6dd309..0eae831 100644
--- a/src/own.cpp
+++ b/src/own.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,7 +22,7 @@
#include "err.hpp"
#include "io_thread.hpp"
-zmq::own_t::own_t (class ctx_t *parent_, uint32_t tid_) :
+xs::own_t::own_t (class ctx_t *parent_, uint32_t tid_) :
object_t (parent_, tid_),
terminating (false),
sent_seqnum (0),
@@ -32,7 +32,7 @@ zmq::own_t::own_t (class ctx_t *parent_, uint32_t tid_) :
{
}
-zmq::own_t::own_t (io_thread_t *io_thread_, const options_t &options_) :
+xs::own_t::own_t (io_thread_t *io_thread_, const options_t &options_) :
object_t (io_thread_),
options (options_),
terminating (false),
@@ -43,23 +43,23 @@ zmq::own_t::own_t (io_thread_t *io_thread_, const options_t &options_) :
{
}
-zmq::own_t::~own_t ()
+xs::own_t::~own_t ()
{
}
-void zmq::own_t::set_owner (own_t *owner_)
+void xs::own_t::set_owner (own_t *owner_)
{
- zmq_assert (!owner);
+ xs_assert (!owner);
owner = owner_;
}
-void zmq::own_t::inc_seqnum ()
+void xs::own_t::inc_seqnum ()
{
// This function may be called from a different thread!
sent_seqnum.add (1);
}
-void zmq::own_t::process_seqnum ()
+void xs::own_t::process_seqnum ()
{
// Catch up with counter of processed commands.
processed_seqnum++;
@@ -68,7 +68,7 @@ void zmq::own_t::process_seqnum ()
check_term_acks ();
}
-void zmq::own_t::launch_child (own_t *object_)
+void xs::own_t::launch_child (own_t *object_)
{
// Specify the owner of the object.
object_->set_owner (this);
@@ -80,7 +80,7 @@ void zmq::own_t::launch_child (own_t *object_)
send_own (this, object_);
}
-void zmq::own_t::launch_sibling (own_t *object_)
+void xs::own_t::launch_sibling (own_t *object_)
{
// At this point it is important that object is plugged in before its
// owner has a chance to terminate it. Thus, 'plug' command is sent before
@@ -98,7 +98,7 @@ void zmq::own_t::launch_sibling (own_t *object_)
send_own (owner, object_);
}
-void zmq::own_t::process_term_req (own_t *object_)
+void xs::own_t::process_term_req (own_t *object_)
{
// When shutting down we can ignore termination requests from owned
// objects. The termination request was already sent to the object.
@@ -121,7 +121,7 @@ void zmq::own_t::process_term_req (own_t *object_)
send_term (object_, options.linger);
}
-void zmq::own_t::process_own (own_t *object_)
+void xs::own_t::process_own (own_t *object_)
{
// If the object is already being shut down, new owned objects are
// immediately asked to terminate. Note that linger is set to zero.
@@ -135,7 +135,7 @@ void zmq::own_t::process_own (own_t *object_)
owned.insert (object_);
}
-void zmq::own_t::terminate ()
+void xs::own_t::terminate ()
{
// If termination is already underway, there's no point
// in starting it anew.
@@ -153,15 +153,15 @@ void zmq::own_t::terminate ()
send_term_req (owner, this);
}
-bool zmq::own_t::is_terminating ()
+bool xs::own_t::is_terminating ()
{
return terminating;
}
-void zmq::own_t::process_term (int linger_)
+void xs::own_t::process_term (int linger_)
{
// Double termination should never happen.
- zmq_assert (!terminating);
+ xs_assert (!terminating);
// Send termination request to all owned objects.
for (owned_t::iterator it = owned.begin (); it != owned.end (); ++it)
@@ -175,32 +175,32 @@ void zmq::own_t::process_term (int linger_)
check_term_acks ();
}
-void zmq::own_t::register_term_acks (int count_)
+void xs::own_t::register_term_acks (int count_)
{
term_acks += count_;
}
-void zmq::own_t::unregister_term_ack ()
+void xs::own_t::unregister_term_ack ()
{
- zmq_assert (term_acks > 0);
+ xs_assert (term_acks > 0);
term_acks--;
// This may be a last ack we are waiting for before termination...
check_term_acks ();
}
-void zmq::own_t::process_term_ack ()
+void xs::own_t::process_term_ack ()
{
unregister_term_ack ();
}
-void zmq::own_t::check_term_acks ()
+void xs::own_t::check_term_acks ()
{
if (terminating && processed_seqnum == sent_seqnum.get () &&
term_acks == 0) {
// Sanity check. There should be no active children at this point.
- zmq_assert (owned.empty ());
+ xs_assert (owned.empty ());
// The root object has nobody to confirm the termination to.
// Other nodes will confirm the termination to the owner.
@@ -212,7 +212,7 @@ void zmq::own_t::check_term_acks ()
}
}
-void zmq::own_t::process_destroy ()
+void xs::own_t::process_destroy ()
{
delete this;
}
diff --git a/src/own.hpp b/src/own.hpp
index 2969ffd..9f26bd3 100644
--- a/src/own.hpp
+++ b/src/own.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,8 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_OWN_HPP_INCLUDED__
-#define __ZMQ_OWN_HPP_INCLUDED__
+#ifndef __XS_OWN_HPP_INCLUDED__
+#define __XS_OWN_HPP_INCLUDED__
#include <set>
#include <algorithm>
@@ -29,7 +29,7 @@
#include "atomic_counter.hpp"
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -46,11 +46,11 @@ namespace zmq
// It'll be supplied later on when the object is plugged in.
// The object is not living within an I/O thread. It has it's own
- // thread outside of 0MQ infrastructure.
- own_t (zmq::ctx_t *parent_, uint32_t tid_);
+ // thread outside of Crossroads infrastructure.
+ own_t (xs::ctx_t *parent_, uint32_t tid_);
// The object is living within I/O thread.
- own_t (zmq::io_thread_t *io_thread_, const options_t &options_);
+ own_t (xs::io_thread_t *io_thread_, const options_t &options_);
// When another owned object wants to send command to this object
// it calls this function to let it know it should not shut down
diff --git a/src/pair.cpp b/src/pair.cpp
index 1bc9db3..aa64ce9 100644
--- a/src/pair.cpp
+++ b/src/pair.cpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -24,50 +24,50 @@
#include "pipe.hpp"
#include "msg.hpp"
-zmq::pair_t::pair_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::pair_t::pair_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_),
pipe (NULL)
{
- options.type = ZMQ_PAIR;
+ options.type = XS_PAIR;
}
-zmq::pair_t::~pair_t ()
+xs::pair_t::~pair_t ()
{
- zmq_assert (!pipe);
+ xs_assert (!pipe);
}
-void zmq::pair_t::xattach_pipe (pipe_t *pipe_)
+void xs::pair_t::xattach_pipe (pipe_t *pipe_)
{
- zmq_assert (!pipe);
+ xs_assert (!pipe);
pipe = pipe_;
}
-void zmq::pair_t::xterminated (pipe_t *pipe_)
+void xs::pair_t::xterminated (pipe_t *pipe_)
{
- zmq_assert (pipe_ == pipe);
+ xs_assert (pipe_ == pipe);
pipe = NULL;
}
-void zmq::pair_t::xread_activated (pipe_t *pipe_)
+void xs::pair_t::xread_activated (pipe_t *pipe_)
{
// There's just one pipe. No lists of active and inactive pipes.
// There's nothing to do here.
}
-void zmq::pair_t::xwrite_activated (pipe_t *pipe_)
+void xs::pair_t::xwrite_activated (pipe_t *pipe_)
{
// There's just one pipe. No lists of active and inactive pipes.
// There's nothing to do here.
}
-int zmq::pair_t::xsend (msg_t *msg_, int flags_)
+int xs::pair_t::xsend (msg_t *msg_, int flags_)
{
if (!pipe || !pipe->write (msg_)) {
errno = EAGAIN;
return -1;
}
- if (!(flags_ & ZMQ_SNDMORE))
+ if (!(flags_ & XS_SNDMORE))
pipe->flush ();
// Detach the original message from the data buffer.
@@ -77,7 +77,7 @@ int zmq::pair_t::xsend (msg_t *msg_, int flags_)
return 0;
}
-int zmq::pair_t::xrecv (msg_t *msg_, int flags_)
+int xs::pair_t::xrecv (msg_t *msg_, int flags_)
{
// Deallocate old content of the message.
int rc = msg_->close ();
@@ -95,7 +95,7 @@ int zmq::pair_t::xrecv (msg_t *msg_, int flags_)
return 0;
}
-bool zmq::pair_t::xhas_in ()
+bool xs::pair_t::xhas_in ()
{
if (!pipe)
return false;
@@ -103,7 +103,7 @@ bool zmq::pair_t::xhas_in ()
return pipe->check_read ();
}
-bool zmq::pair_t::xhas_out ()
+bool xs::pair_t::xhas_out ()
{
if (!pipe)
return false;
@@ -117,7 +117,7 @@ bool zmq::pair_t::xhas_out ()
return result;
}
-zmq::pair_session_t::pair_session_t (io_thread_t *io_thread_, bool connect_,
+xs::pair_session_t::pair_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
session_base_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -125,7 +125,7 @@ zmq::pair_session_t::pair_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::pair_session_t::~pair_session_t ()
+xs::pair_session_t::~pair_session_t ()
{
}
diff --git a/src/pair.hpp b/src/pair.hpp
index 9514b1b..c03ee1e 100644
--- a/src/pair.hpp
+++ b/src/pair.hpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,13 +19,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_PAIR_HPP_INCLUDED__
-#define __ZMQ_PAIR_HPP_INCLUDED__
+#ifndef __XS_PAIR_HPP_INCLUDED__
+#define __XS_PAIR_HPP_INCLUDED__
#include "socket_base.hpp"
#include "session_base.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -38,22 +38,22 @@ namespace zmq
{
public:
- pair_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ pair_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~pair_t ();
// Overloads of functions from socket_base_t.
- void xattach_pipe (zmq::pipe_t *pipe_);
- int xsend (zmq::msg_t *msg_, int flags_);
- int xrecv (zmq::msg_t *msg_, int flags_);
+ void xattach_pipe (xs::pipe_t *pipe_);
+ int xsend (xs::msg_t *msg_, int flags_);
+ int xrecv (xs::msg_t *msg_, int flags_);
bool xhas_in ();
bool xhas_out ();
- void xread_activated (zmq::pipe_t *pipe_);
- void xwrite_activated (zmq::pipe_t *pipe_);
- void xterminated (zmq::pipe_t *pipe_);
+ void xread_activated (xs::pipe_t *pipe_);
+ void xwrite_activated (xs::pipe_t *pipe_);
+ void xterminated (xs::pipe_t *pipe_);
private:
- zmq::pipe_t *pipe;
+ xs::pipe_t *pipe;
pair_t (const pair_t&);
const pair_t &operator = (const pair_t&);
@@ -63,7 +63,7 @@ namespace zmq
{
public:
- pair_session_t (zmq::io_thread_t *io_thread_, bool connect_,
+ pair_session_t (xs::io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~pair_session_t ();
diff --git a/src/pgm_receiver.cpp b/src/pgm_receiver.cpp
index 122d110..e87286d 100644
--- a/src/pgm_receiver.cpp
+++ b/src/pgm_receiver.cpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2010-2011 Miru Limited
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,11 +22,11 @@
#include "platform.hpp"
-#if defined ZMQ_HAVE_OPENPGM
+#if defined XS_HAVE_OPENPGM
#include <new>
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#endif
@@ -36,7 +36,7 @@
#include "wire.hpp"
#include "err.hpp"
-zmq::pgm_receiver_t::pgm_receiver_t (class io_thread_t *parent_,
+xs::pgm_receiver_t::pgm_receiver_t (class io_thread_t *parent_,
const options_t &options_) :
io_object_t (parent_),
has_rx_timer (false),
@@ -48,18 +48,18 @@ zmq::pgm_receiver_t::pgm_receiver_t (class io_thread_t *parent_,
{
}
-zmq::pgm_receiver_t::~pgm_receiver_t ()
+xs::pgm_receiver_t::~pgm_receiver_t ()
{
// Destructor should not be called before unplug.
- zmq_assert (peers.empty ());
+ xs_assert (peers.empty ());
}
-int zmq::pgm_receiver_t::init (bool udp_encapsulation_, const char *network_)
+int xs::pgm_receiver_t::init (bool udp_encapsulation_, const char *network_)
{
return pgm_socket.init (udp_encapsulation_, network_);
}
-void zmq::pgm_receiver_t::plug (io_thread_t *io_thread_,
+void xs::pgm_receiver_t::plug (io_thread_t *io_thread_,
session_base_t *session_)
{
// Retrieve PGM fds and start polling.
@@ -77,7 +77,7 @@ void zmq::pgm_receiver_t::plug (io_thread_t *io_thread_,
drop_subscriptions ();
}
-void zmq::pgm_receiver_t::unplug ()
+void xs::pgm_receiver_t::unplug ()
{
// Delete decoders.
for (peers_t::iterator it = peers.begin (); it != peers.end (); ++it) {
@@ -100,18 +100,18 @@ void zmq::pgm_receiver_t::unplug ()
session = NULL;
}
-void zmq::pgm_receiver_t::terminate ()
+void xs::pgm_receiver_t::terminate ()
{
unplug ();
delete this;
}
-void zmq::pgm_receiver_t::activate_out ()
+void xs::pgm_receiver_t::activate_out ()
{
drop_subscriptions ();
}
-void zmq::pgm_receiver_t::activate_in ()
+void xs::pgm_receiver_t::activate_in ()
{
// It is possible that the most recently used decoder
// processed the whole buffer but failed to write
@@ -122,8 +122,8 @@ void zmq::pgm_receiver_t::activate_in ()
return;
}
- zmq_assert (mru_decoder != NULL);
- zmq_assert (pending_ptr != NULL);
+ xs_assert (mru_decoder != NULL);
+ xs_assert (pending_ptr != NULL);
// Ask the decoder to process remaining data.
size_t n = mru_decoder->process_buffer (pending_ptr, pending_bytes);
@@ -139,13 +139,13 @@ void zmq::pgm_receiver_t::activate_in ()
in_event ();
}
-void zmq::pgm_receiver_t::in_event ()
+void xs::pgm_receiver_t::in_event ()
{
// Read data from the underlying pgm_socket.
unsigned char *data = NULL;
const pgm_tsi_t *tsi = NULL;
- zmq_assert (pending_bytes == 0);
+ xs_assert (pending_bytes == 0);
if (has_rx_timer) {
cancel_timer (rx_timer_id);
@@ -197,7 +197,7 @@ void zmq::pgm_receiver_t::in_event ()
}
// Read the offset of the fist message in the current packet.
- zmq_assert ((size_t) received >= sizeof (uint16_t));
+ xs_assert ((size_t) received >= sizeof (uint16_t));
uint16_t offset = get_uint16 (data);
data += sizeof (uint16_t);
received -= sizeof (uint16_t);
@@ -210,8 +210,8 @@ void zmq::pgm_receiver_t::in_event ()
if (offset == 0xffff)
continue;
- zmq_assert (offset <= received);
- zmq_assert (it->second.decoder == NULL);
+ xs_assert (offset <= received);
+ xs_assert (it->second.decoder == NULL);
// We have to move data to the begining of the first message.
data += offset;
@@ -253,16 +253,16 @@ void zmq::pgm_receiver_t::in_event ()
session->flush ();
}
-void zmq::pgm_receiver_t::timer_event (int token)
+void xs::pgm_receiver_t::timer_event (int token)
{
- zmq_assert (token == rx_timer_id);
+ xs_assert (token == rx_timer_id);
// Timer cancels on return by poller_base.
has_rx_timer = false;
in_event ();
}
-void zmq::pgm_receiver_t::drop_subscriptions ()
+void xs::pgm_receiver_t::drop_subscriptions ()
{
msg_t msg;
while (session->read (&msg))
diff --git a/src/pgm_receiver.hpp b/src/pgm_receiver.hpp
index 7c97d5a..939f540 100644
--- a/src/pgm_receiver.hpp
+++ b/src/pgm_receiver.hpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2010-2011 Miru Limited
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,14 +20,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_PGM_RECEIVER_HPP_INCLUDED__
-#define __ZMQ_PGM_RECEIVER_HPP_INCLUDED__
+#ifndef __XS_PGM_RECEIVER_HPP_INCLUDED__
+#define __XS_PGM_RECEIVER_HPP_INCLUDED__
#include "platform.hpp"
-#if defined ZMQ_HAVE_OPENPGM
+#if defined XS_HAVE_OPENPGM
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#endif
@@ -40,7 +40,7 @@
#include "decoder.hpp"
#include "pgm_socket.hpp"
-namespace zmq
+namespace xs
{
class io_thread_t;
@@ -51,14 +51,14 @@ namespace zmq
public:
- pgm_receiver_t (zmq::io_thread_t *parent_, const options_t &options_);
+ pgm_receiver_t (xs::io_thread_t *parent_, const options_t &options_);
~pgm_receiver_t ();
int init (bool udp_encapsulation_, const char *network_);
// i_engine interface implementation.
- void plug (zmq::io_thread_t *io_thread_,
- zmq::session_base_t *session_);
+ void plug (xs::io_thread_t *io_thread_,
+ xs::session_base_t *session_);
void unplug ();
void terminate ();
void activate_in ();
@@ -111,7 +111,7 @@ namespace zmq
options_t options;
// Associated session.
- zmq::session_base_t *session;
+ xs::session_base_t *session;
// Most recently used decoder.
decoder_t *mru_decoder;
diff --git a/src/pgm_sender.cpp b/src/pgm_sender.cpp
index 759802f..707ced0 100644
--- a/src/pgm_sender.cpp
+++ b/src/pgm_sender.cpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2010-2011 Miru Limited
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,9 +22,9 @@
#include "platform.hpp"
-#if defined ZMQ_HAVE_OPENPGM
+#if defined XS_HAVE_OPENPGM
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#endif
@@ -37,7 +37,7 @@
#include "wire.hpp"
#include "stdint.hpp"
-zmq::pgm_sender_t::pgm_sender_t (io_thread_t *parent_,
+xs::pgm_sender_t::pgm_sender_t (io_thread_t *parent_,
const options_t &options_) :
io_object_t (parent_),
has_tx_timer (false),
@@ -51,7 +51,7 @@ zmq::pgm_sender_t::pgm_sender_t (io_thread_t *parent_,
{
}
-int zmq::pgm_sender_t::init (bool udp_encapsulation_, const char *network_)
+int xs::pgm_sender_t::init (bool udp_encapsulation_, const char *network_)
{
int rc = pgm_socket.init (udp_encapsulation_, network_);
if (rc != 0)
@@ -64,7 +64,7 @@ int zmq::pgm_sender_t::init (bool udp_encapsulation_, const char *network_)
return rc;
}
-void zmq::pgm_sender_t::plug (io_thread_t *io_thread_, session_base_t *session_)
+void xs::pgm_sender_t::plug (io_thread_t *io_thread_, session_base_t *session_)
{
// Alocate 2 fds for PGM socket.
fd_t downlink_socket_fd = retired_fd;
@@ -99,11 +99,11 @@ void zmq::pgm_sender_t::plug (io_thread_t *io_thread_, session_base_t *session_)
msg.init_size (1);
*(unsigned char*) msg.data () = 1;
bool ok = session_->write (&msg);
- zmq_assert (ok);
+ xs_assert (ok);
session_->flush ();
}
-void zmq::pgm_sender_t::unplug ()
+void xs::pgm_sender_t::unplug ()
{
if (has_rx_timer) {
cancel_timer (rx_timer_id);
@@ -122,24 +122,24 @@ void zmq::pgm_sender_t::unplug ()
encoder.set_session (NULL);
}
-void zmq::pgm_sender_t::terminate ()
+void xs::pgm_sender_t::terminate ()
{
unplug ();
delete this;
}
-void zmq::pgm_sender_t::activate_out ()
+void xs::pgm_sender_t::activate_out ()
{
set_pollout (handle);
out_event ();
}
-void zmq::pgm_sender_t::activate_in ()
+void xs::pgm_sender_t::activate_in ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-zmq::pgm_sender_t::~pgm_sender_t ()
+xs::pgm_sender_t::~pgm_sender_t ()
{
if (out_buffer) {
free (out_buffer);
@@ -147,7 +147,7 @@ zmq::pgm_sender_t::~pgm_sender_t ()
}
}
-void zmq::pgm_sender_t::in_event ()
+void xs::pgm_sender_t::in_event ()
{
if (has_rx_timer) {
cancel_timer (rx_timer_id);
@@ -163,7 +163,7 @@ void zmq::pgm_sender_t::in_event ()
}
}
-void zmq::pgm_sender_t::out_event ()
+void xs::pgm_sender_t::out_event ()
{
// POLLOUT event from send socket. If write buffer is empty,
// try to read new data from the encoder.
@@ -200,18 +200,18 @@ void zmq::pgm_sender_t::out_event ()
if (nbytes == write_size) {
write_size = 0;
} else {
- zmq_assert (nbytes == 0);
+ xs_assert (nbytes == 0);
if (errno == ENOMEM) {
const long timeout = pgm_socket.get_tx_timeout ();
add_timer (timeout, tx_timer_id);
has_tx_timer = true;
} else
- zmq_assert (errno == EBUSY);
+ xs_assert (errno == EBUSY);
}
}
-void zmq::pgm_sender_t::timer_event (int token)
+void xs::pgm_sender_t::timer_event (int token)
{
// Timer cancels on return by poller_base.
if (token == rx_timer_id) {
@@ -221,7 +221,7 @@ void zmq::pgm_sender_t::timer_event (int token)
has_tx_timer = false;
out_event ();
} else
- zmq_assert (false);
+ xs_assert (false);
}
#endif
diff --git a/src/pgm_sender.hpp b/src/pgm_sender.hpp
index 99405f0..277fb53 100644
--- a/src/pgm_sender.hpp
+++ b/src/pgm_sender.hpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2010-2011 Miru Limited
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,14 +20,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_PGM_SENDER_HPP_INCLUDED__
-#define __ZMQ_PGM_SENDER_HPP_INCLUDED__
+#ifndef __XS_PGM_SENDER_HPP_INCLUDED__
+#define __XS_PGM_SENDER_HPP_INCLUDED__
#include "platform.hpp"
-#if defined ZMQ_HAVE_OPENPGM
+#if defined XS_HAVE_OPENPGM
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#endif
@@ -38,7 +38,7 @@
#include "pgm_socket.hpp"
#include "encoder.hpp"
-namespace zmq
+namespace xs
{
class io_thread_t;
@@ -49,14 +49,14 @@ namespace zmq
public:
- pgm_sender_t (zmq::io_thread_t *parent_, const options_t &options_);
+ pgm_sender_t (xs::io_thread_t *parent_, const options_t &options_);
~pgm_sender_t ();
int init (bool udp_encapsulation_, const char *network_);
// i_engine interface implementation.
- void plug (zmq::io_thread_t *io_thread_,
- zmq::session_base_t *session_);
+ void plug (xs::io_thread_t *io_thread_,
+ xs::session_base_t *session_);
void unplug ();
void terminate ();
void activate_in ();
diff --git a/src/pgm_socket.cpp b/src/pgm_socket.cpp
index 0274ee4..eeaafa0 100644
--- a/src/pgm_socket.cpp
+++ b/src/pgm_socket.cpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2010-2011 Miru Limited
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,13 +22,13 @@
#include "platform.hpp"
-#ifdef ZMQ_HAVE_OPENPGM
+#ifdef XS_HAVE_OPENPGM
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#endif
-#ifdef ZMQ_HAVE_LINUX
+#ifdef XS_HAVE_LINUX
#include <poll.h>
#endif
@@ -47,7 +47,7 @@
#define MSG_ERRQUEUE 0x2000
#endif
-zmq::pgm_socket_t::pgm_socket_t (bool receiver_, const options_t &options_) :
+xs::pgm_socket_t::pgm_socket_t (bool receiver_, const options_t &options_) :
sock (NULL),
options (options_),
receiver (receiver_),
@@ -64,10 +64,10 @@ zmq::pgm_socket_t::pgm_socket_t (bool receiver_, const options_t &options_) :
// e.g. eth0;239.192.0.1:7500
// link-local;224.250.0.1,224.250.0.2;224.250.0.3:8000
// ;[fe80::1%en0]:7500
-int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
+int xs::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
{
// Can not open transport before destroying old one.
- zmq_assert (sock == NULL);
+ xs_assert (sock == NULL);
// Parse port number, start from end for IPv6
const char *port_delim = strrchr (network_, ':');
@@ -86,7 +86,7 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
memset (network, '\0', sizeof (network));
memcpy (network, network_, port_delim - network_);
- zmq_assert (options.rate > 0);
+ xs_assert (options.rate > 0);
// Zero counter used in msgrecv.
nbytes_rec = 0;
@@ -102,7 +102,7 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
if (!pgm_getaddrinfo (network, NULL, &res, &pgm_error)) {
// Invalid parameters don't set pgm_error_t.
- zmq_assert (pgm_error != NULL);
+ xs_assert (pgm_error != NULL);
if (pgm_error->domain == PGM_ERROR_DOMAIN_IF && (
// NB: cannot catch EAI_BADFLAGS.
@@ -113,10 +113,10 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
goto err_abort;
// Fatal OpenPGM internal error.
- zmq_assert (false);
+ xs_assert (false);
}
- zmq_assert (res != NULL);
+ xs_assert (res != NULL);
// Pick up detected IP family.
sa_family = res->ai_send_addrs[0].gsr_group.ss_family;
@@ -127,7 +127,7 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
&pgm_error)) {
// Invalid parameters don't set pgm_error_t.
- zmq_assert (pgm_error != NULL);
+ xs_assert (pgm_error != NULL);
if (pgm_error->domain == PGM_ERROR_DOMAIN_SOCKET && (
pgm_error->code != PGM_ERROR_BADF &&
pgm_error->code != PGM_ERROR_FAULT &&
@@ -138,7 +138,7 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
goto err_abort;
// Fatal OpenPGM internal error.
- zmq_assert (false);
+ xs_assert (false);
}
// All options are of data type int
@@ -155,7 +155,7 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
&pgm_error)) {
// Invalid parameters don't set pgm_error_t.
- zmq_assert (pgm_error != NULL);
+ xs_assert (pgm_error != NULL);
if (pgm_error->domain == PGM_ERROR_DOMAIN_SOCKET && (
pgm_error->code != PGM_ERROR_BADF &&
pgm_error->code != PGM_ERROR_FAULT &&
@@ -166,7 +166,7 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
goto err_abort;
// Fatal OpenPGM internal error.
- zmq_assert (false);
+ xs_assert (false);
}
}
@@ -280,7 +280,7 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
&if_req, sizeof (if_req), &pgm_error)) {
// Invalid parameters don't set pgm_error_t.
- zmq_assert (pgm_error != NULL);
+ xs_assert (pgm_error != NULL);
if ((pgm_error->domain == PGM_ERROR_DOMAIN_SOCKET ||
pgm_error->domain == PGM_ERROR_DOMAIN_IF) && (
pgm_error->code != PGM_ERROR_INVAL &&
@@ -291,7 +291,7 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
goto err_abort;
// Fatal OpenPGM internal error.
- zmq_assert (false);
+ xs_assert (false);
}
// Join IP multicast groups.
@@ -335,18 +335,18 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
if (!pgm_connect (sock, &pgm_error)) {
// Invalid parameters don't set pgm_error_t.
- zmq_assert (pgm_error != NULL);
+ xs_assert (pgm_error != NULL);
goto err_abort;
}
// For receiver transport preallocate pgm_msgv array.
if (receiver) {
- zmq_assert (in_batch_size > 0);
+ xs_assert (in_batch_size > 0);
size_t max_tsdu_size = get_max_tsdu_size ();
pgm_msgv_len = (int) in_batch_size / max_tsdu_size;
if ((int) in_batch_size % max_tsdu_size)
pgm_msgv_len++;
- zmq_assert (pgm_msgv_len);
+ xs_assert (pgm_msgv_len);
pgm_msgv = (pgm_msgv_t*) malloc (sizeof (pgm_msgv_t) * pgm_msgv_len);
alloc_assert (pgm_msgv);
@@ -371,7 +371,7 @@ err_abort:
return -1;
}
-zmq::pgm_socket_t::~pgm_socket_t ()
+xs::pgm_socket_t::~pgm_socket_t ()
{
if (pgm_msgv)
free (pgm_msgv);
@@ -381,26 +381,26 @@ zmq::pgm_socket_t::~pgm_socket_t ()
// Get receiver fds. receive_fd_ is signaled for incoming packets,
// waiting_pipe_fd_ is signaled for state driven events and data.
-void zmq::pgm_socket_t::get_receiver_fds (fd_t *receive_fd_,
+void xs::pgm_socket_t::get_receiver_fds (fd_t *receive_fd_,
fd_t *waiting_pipe_fd_)
{
socklen_t socklen;
bool rc;
- zmq_assert (receive_fd_);
- zmq_assert (waiting_pipe_fd_);
+ xs_assert (receive_fd_);
+ xs_assert (waiting_pipe_fd_);
socklen = sizeof (*receive_fd_);
rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_RECV_SOCK, receive_fd_,
&socklen);
- zmq_assert (rc);
- zmq_assert (socklen == sizeof (*receive_fd_));
+ xs_assert (rc);
+ xs_assert (socklen == sizeof (*receive_fd_));
socklen = sizeof (*waiting_pipe_fd_);
rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_PENDING_SOCK, waiting_pipe_fd_,
&socklen);
- zmq_assert (rc);
- zmq_assert (socklen == sizeof (*waiting_pipe_fd_));
+ xs_assert (rc);
+ xs_assert (socklen == sizeof (*waiting_pipe_fd_));
}
// Get fds and store them into user allocated memory.
@@ -408,44 +408,44 @@ void zmq::pgm_socket_t::get_receiver_fds (fd_t *receive_fd_,
// receive_fd_ is for incoming back-channel protocol packets.
// rdata_notify_fd_ is raised for waiting repair transmissions.
// pending_notify_fd_ is for state driven events.
-void zmq::pgm_socket_t::get_sender_fds (fd_t *send_fd_, fd_t *receive_fd_,
+void xs::pgm_socket_t::get_sender_fds (fd_t *send_fd_, fd_t *receive_fd_,
fd_t *rdata_notify_fd_, fd_t *pending_notify_fd_)
{
socklen_t socklen;
bool rc;
- zmq_assert (send_fd_);
- zmq_assert (receive_fd_);
- zmq_assert (rdata_notify_fd_);
- zmq_assert (pending_notify_fd_);
+ xs_assert (send_fd_);
+ xs_assert (receive_fd_);
+ xs_assert (rdata_notify_fd_);
+ xs_assert (pending_notify_fd_);
socklen = sizeof (*send_fd_);
rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_SEND_SOCK, send_fd_, &socklen);
- zmq_assert (rc);
- zmq_assert (socklen == sizeof (*receive_fd_));
+ xs_assert (rc);
+ xs_assert (socklen == sizeof (*receive_fd_));
socklen = sizeof (*receive_fd_);
rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_RECV_SOCK, receive_fd_,
&socklen);
- zmq_assert (rc);
- zmq_assert (socklen == sizeof (*receive_fd_));
+ xs_assert (rc);
+ xs_assert (socklen == sizeof (*receive_fd_));
socklen = sizeof (*rdata_notify_fd_);
rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_REPAIR_SOCK, rdata_notify_fd_,
&socklen);
- zmq_assert (rc);
- zmq_assert (socklen == sizeof (*rdata_notify_fd_));
+ xs_assert (rc);
+ xs_assert (socklen == sizeof (*rdata_notify_fd_));
socklen = sizeof (*pending_notify_fd_);
rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_PENDING_SOCK,
pending_notify_fd_, &socklen);
- zmq_assert (rc);
- zmq_assert (socklen == sizeof (*pending_notify_fd_));
+ xs_assert (rc);
+ xs_assert (socklen == sizeof (*pending_notify_fd_));
}
// Send one APDU, transmit window owned memory.
// data_len_ must be less than one TPDU.
-size_t zmq::pgm_socket_t::send (unsigned char *data_, size_t data_len_)
+size_t xs::pgm_socket_t::send (unsigned char *data_, size_t data_len_)
{
size_t nbytes = 0;
@@ -453,10 +453,10 @@ size_t zmq::pgm_socket_t::send (unsigned char *data_, size_t data_len_)
// We have to write all data as one packet.
if (nbytes > 0) {
- zmq_assert (status == PGM_IO_STATUS_NORMAL);
- zmq_assert ((ssize_t) nbytes == (ssize_t) data_len_);
+ xs_assert (status == PGM_IO_STATUS_NORMAL);
+ xs_assert ((ssize_t) nbytes == (ssize_t) data_len_);
} else {
- zmq_assert (status == PGM_IO_STATUS_RATE_LIMITED ||
+ xs_assert (status == PGM_IO_STATUS_RATE_LIMITED ||
status == PGM_IO_STATUS_WOULD_BLOCK);
if (status == PGM_IO_STATUS_RATE_LIMITED)
@@ -471,7 +471,7 @@ size_t zmq::pgm_socket_t::send (unsigned char *data_, size_t data_len_)
return nbytes;
}
-long zmq::pgm_socket_t::get_rx_timeout ()
+long xs::pgm_socket_t::get_rx_timeout ()
{
if (last_rx_status != PGM_IO_STATUS_RATE_LIMITED &&
last_rx_status != PGM_IO_STATUS_TIMER_PENDING)
@@ -482,14 +482,14 @@ long zmq::pgm_socket_t::get_rx_timeout ()
const bool rc = pgm_getsockopt (sock, IPPROTO_PGM,
last_rx_status == PGM_IO_STATUS_RATE_LIMITED ? PGM_RATE_REMAIN :
PGM_TIME_REMAIN, &tv, &optlen);
- zmq_assert (rc);
+ xs_assert (rc);
const long timeout = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
return timeout;
}
-long zmq::pgm_socket_t::get_tx_timeout ()
+long xs::pgm_socket_t::get_tx_timeout ()
{
if (last_tx_status != PGM_IO_STATUS_RATE_LIMITED)
return -1;
@@ -498,7 +498,7 @@ long zmq::pgm_socket_t::get_tx_timeout ()
socklen_t optlen = sizeof (tv);
const bool rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv,
&optlen);
- zmq_assert (rc);
+ xs_assert (rc);
const long timeout = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
@@ -506,20 +506,20 @@ long zmq::pgm_socket_t::get_tx_timeout ()
}
// Return max TSDU size without fragmentation from current PGM transport.
-size_t zmq::pgm_socket_t::get_max_tsdu_size ()
+size_t xs::pgm_socket_t::get_max_tsdu_size ()
{
int max_tsdu = 0;
socklen_t optlen = sizeof (max_tsdu);
bool rc = pgm_getsockopt (sock, IPPROTO_PGM, PGM_MSS, &max_tsdu, &optlen);
- zmq_assert (rc);
- zmq_assert (optlen == sizeof (max_tsdu));
+ xs_assert (rc);
+ xs_assert (optlen == sizeof (max_tsdu));
return (size_t) max_tsdu;
}
// pgm_recvmsgv is called to fill the pgm_msgv array up to pgm_msgv_len.
// In subsequent calls data from pgm_msgv structure are returned.
-ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
+ssize_t xs::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
{
size_t raw_data_len = 0;
@@ -540,9 +540,9 @@ ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
if (nbytes_rec == nbytes_processed) {
// Check program flow.
- zmq_assert (pgm_msgv_processed == 0);
- zmq_assert (nbytes_processed == 0);
- zmq_assert (nbytes_rec == 0);
+ xs_assert (pgm_msgv_processed == 0);
+ xs_assert (nbytes_processed == 0);
+ xs_assert (nbytes_rec == 0);
// Receive a vector of Application Protocol Domain Unit's (APDUs)
// from the transport.
@@ -552,7 +552,7 @@ ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
pgm_msgv_len, MSG_ERRQUEUE, &nbytes_rec, &pgm_error);
// Invalid parameters.
- zmq_assert (status != PGM_IO_STATUS_ERROR);
+ xs_assert (status != PGM_IO_STATUS_ERROR);
last_rx_status = status;
@@ -560,7 +560,7 @@ ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
// pgm_recvmsg returns PGM_IO_STATUS_TIMER_PENDING.
if (status == PGM_IO_STATUS_TIMER_PENDING) {
- zmq_assert (nbytes_rec == 0);
+ xs_assert (nbytes_rec == 0);
// In case if no RDATA/ODATA caused POLLIN 0 is
// returned.
@@ -572,7 +572,7 @@ ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
// Send SPMR, NAK, ACK is rate limited.
if (status == PGM_IO_STATUS_RATE_LIMITED) {
- zmq_assert (nbytes_rec == 0);
+ xs_assert (nbytes_rec == 0);
// In case if no RDATA/ODATA caused POLLIN 0 is returned.
nbytes_rec = 0;
@@ -583,7 +583,7 @@ ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
// No peers and hence no incoming packets.
if (status == PGM_IO_STATUS_WOULD_BLOCK) {
- zmq_assert (nbytes_rec == 0);
+ xs_assert (nbytes_rec == 0);
// In case if no RDATA/ODATA caused POLLIN 0 is returned.
nbytes_rec = 0;
@@ -606,18 +606,18 @@ ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
return -1;
}
- zmq_assert (status == PGM_IO_STATUS_NORMAL);
+ xs_assert (status == PGM_IO_STATUS_NORMAL);
}
else
{
- zmq_assert (pgm_msgv_processed <= pgm_msgv_len);
+ xs_assert (pgm_msgv_processed <= pgm_msgv_len);
}
- // Zero byte payloads are valid in PGM, but not 0MQ protocol.
- zmq_assert (nbytes_rec > 0);
+ // Zero byte payloads are valid in PGM, but not Crossroads protocol.
+ xs_assert (nbytes_rec > 0);
// Only one APDU per pgm_msgv_t structure is allowed.
- zmq_assert (pgm_msgv [pgm_msgv_processed].msgv_len == 1);
+ xs_assert (pgm_msgv [pgm_msgv_processed].msgv_len == 1);
struct pgm_sk_buff_t* skb =
pgm_msgv [pgm_msgv_processed].msgv_skb [0];
@@ -631,13 +631,13 @@ ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
// Move the the next pgm_msgv_t structure.
pgm_msgv_processed++;
- zmq_assert (pgm_msgv_processed <= pgm_msgv_len);
+ xs_assert (pgm_msgv_processed <= pgm_msgv_len);
nbytes_processed +=raw_data_len;
return raw_data_len;
}
-void zmq::pgm_socket_t::process_upstream ()
+void xs::pgm_socket_t::process_upstream ()
{
pgm_msgv_t dummy_msg;
@@ -648,10 +648,10 @@ void zmq::pgm_socket_t::process_upstream ()
1, MSG_ERRQUEUE, &dummy_bytes, &pgm_error);
// Invalid parameters.
- zmq_assert (status != PGM_IO_STATUS_ERROR);
+ xs_assert (status != PGM_IO_STATUS_ERROR);
// No data should be returned.
- zmq_assert (dummy_bytes == 0 && (status == PGM_IO_STATUS_TIMER_PENDING ||
+ xs_assert (dummy_bytes == 0 && (status == PGM_IO_STATUS_TIMER_PENDING ||
status == PGM_IO_STATUS_RATE_LIMITED ||
status == PGM_IO_STATUS_WOULD_BLOCK));
@@ -665,7 +665,7 @@ void zmq::pgm_socket_t::process_upstream ()
errno = EAGAIN;
}
-int zmq::pgm_socket_t::compute_sqns (int tpdu_)
+int xs::pgm_socket_t::compute_sqns (int tpdu_)
{
// Convert rate into B/ms.
uint64_t rate = uint64_t (options.rate) / 8;
diff --git a/src/pgm_socket.hpp b/src/pgm_socket.hpp
index 5a5ef99..4e45caa 100644
--- a/src/pgm_socket.hpp
+++ b/src/pgm_socket.hpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2010-2011 Miru Limited
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -25,23 +25,23 @@
#include "platform.hpp"
-#if defined ZMQ_HAVE_OPENPGM
+#if defined XS_HAVE_OPENPGM
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#define __PGM_WININT_H__
#endif
#include <pgm/pgm.h>
-#ifdef ZMQ_HAVE_OSX
+#ifdef XS_HAVE_OSX
#include <pgm/in.h>
#endif
#include "fd.hpp"
#include "options.hpp"
-namespace zmq
+namespace xs
{
// Encapsulates PGM socket.
class pgm_socket_t
diff --git a/src/pipe.cpp b/src/pipe.cpp
index 25dd51c..4911dd0 100644
--- a/src/pipe.cpp
+++ b/src/pipe.cpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -26,7 +26,7 @@
#include "pipe.hpp"
#include "err.hpp"
-int zmq::pipepair (class object_t *parents_ [2], class pipe_t* pipes_ [2],
+int xs::pipepair (class object_t *parents_ [2], class pipe_t* pipes_ [2],
int hwms_ [2], bool delays_ [2])
{
// Creates two pipe objects. These objects are connected by two ypipes,
@@ -50,7 +50,7 @@ int zmq::pipepair (class object_t *parents_ [2], class pipe_t* pipes_ [2],
return 0;
}
-zmq::pipe_t::pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_,
+xs::pipe_t::pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_,
int inhwm_, int outhwm_, bool delay_) :
object_t (parent_),
inpipe (inpipe_),
@@ -69,35 +69,35 @@ zmq::pipe_t::pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_,
{
}
-zmq::pipe_t::~pipe_t ()
+xs::pipe_t::~pipe_t ()
{
}
-void zmq::pipe_t::set_peer (pipe_t *peer_)
+void xs::pipe_t::set_peer (pipe_t *peer_)
{
// Peer can be set once only.
- zmq_assert (!peer);
+ xs_assert (!peer);
peer = peer_;
}
-void zmq::pipe_t::set_event_sink (i_pipe_events *sink_)
+void xs::pipe_t::set_event_sink (i_pipe_events *sink_)
{
// Sink can be set once only.
- zmq_assert (!sink);
+ xs_assert (!sink);
sink = sink_;
}
-void zmq::pipe_t::set_identity (const blob_t &identity_)
+void xs::pipe_t::set_identity (const blob_t &identity_)
{
identity = identity_;
}
-zmq::blob_t zmq::pipe_t::get_identity ()
+xs::blob_t xs::pipe_t::get_identity ()
{
return identity;
}
-bool zmq::pipe_t::check_read ()
+bool xs::pipe_t::check_read ()
{
if (unlikely (!in_active || (state != active && state != pending)))
return false;
@@ -113,7 +113,7 @@ bool zmq::pipe_t::check_read ()
if (inpipe->probe (is_delimiter)) {
msg_t msg;
bool ok = inpipe->read (&msg);
- zmq_assert (ok);
+ xs_assert (ok);
delimit ();
return false;
}
@@ -121,7 +121,7 @@ bool zmq::pipe_t::check_read ()
return true;
}
-bool zmq::pipe_t::read (msg_t *msg_)
+bool xs::pipe_t::read (msg_t *msg_)
{
if (unlikely (!in_active || (state != active && state != pending)))
return false;
@@ -146,7 +146,7 @@ bool zmq::pipe_t::read (msg_t *msg_)
return true;
}
-bool zmq::pipe_t::check_write (msg_t *msg_)
+bool xs::pipe_t::check_write (msg_t *msg_)
{
if (unlikely (!out_active || state != active))
return false;
@@ -161,7 +161,7 @@ bool zmq::pipe_t::check_write (msg_t *msg_)
return true;
}
-bool zmq::pipe_t::write (msg_t *msg_)
+bool xs::pipe_t::write (msg_t *msg_)
{
if (unlikely (!check_write (msg_)))
return false;
@@ -174,20 +174,20 @@ bool zmq::pipe_t::write (msg_t *msg_)
return true;
}
-void zmq::pipe_t::rollback ()
+void xs::pipe_t::rollback ()
{
// Remove incomplete message from the outbound pipe.
msg_t msg;
if (outpipe) {
while (outpipe->unwrite (&msg)) {
- zmq_assert (msg.flags () & msg_t::more);
+ xs_assert (msg.flags () & msg_t::more);
int rc = msg.close ();
errno_assert (rc == 0);
}
}
}
-void zmq::pipe_t::flush ()
+void xs::pipe_t::flush ()
{
// If terminate() was already called do nothing.
if (state == terminated && state == double_terminated)
@@ -201,7 +201,7 @@ void zmq::pipe_t::flush ()
send_activate_read (peer);
}
-void zmq::pipe_t::process_activate_read ()
+void xs::pipe_t::process_activate_read ()
{
if (!in_active && (state == active || state == pending)) {
in_active = true;
@@ -209,7 +209,7 @@ void zmq::pipe_t::process_activate_read ()
}
}
-void zmq::pipe_t::process_activate_write (uint64_t msgs_read_)
+void xs::pipe_t::process_activate_write (uint64_t msgs_read_)
{
// Remember the peers's message sequence number.
peers_msgs_read = msgs_read_;
@@ -220,11 +220,11 @@ void zmq::pipe_t::process_activate_write (uint64_t msgs_read_)
}
}
-void zmq::pipe_t::process_hiccup (void *pipe_)
+void xs::pipe_t::process_hiccup (void *pipe_)
{
// Destroy old outpipe. Note that the read end of the pipe was already
// migrated to this thread.
- zmq_assert (outpipe);
+ xs_assert (outpipe);
outpipe->flush ();
msg_t msg;
while (outpipe->read (&msg)) {
@@ -234,7 +234,7 @@ void zmq::pipe_t::process_hiccup (void *pipe_)
delete outpipe;
// Plug in the new outpipe.
- zmq_assert (pipe_);
+ xs_assert (pipe_);
outpipe = (upipe_t*) pipe_;
out_active = true;
@@ -243,7 +243,7 @@ void zmq::pipe_t::process_hiccup (void *pipe_)
sink->hiccuped (this);
}
-void zmq::pipe_t::process_pipe_term ()
+void xs::pipe_t::process_pipe_term ()
{
// This is the simple case of peer-induced termination. If there are no
// more pending messages to read, or if the pipe was configured to drop
@@ -283,13 +283,13 @@ void zmq::pipe_t::process_pipe_term ()
}
// pipe_term is invalid in other states.
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::pipe_t::process_pipe_term_ack ()
+void xs::pipe_t::process_pipe_term_ack ()
{
// Notify the user that all the references to the pipe should be dropped.
- zmq_assert (sink);
+ xs_assert (sink);
sink->terminated (this);
// In terminating and double_terminated states there's nothing to do.
@@ -303,7 +303,7 @@ void zmq::pipe_t::process_pipe_term_ack ()
send_pipe_term_ack (peer);
}
else
- zmq_assert (false);
+ xs_assert (false);
// We'll deallocate the inbound pipe, the peer will deallocate the outbound
// pipe (which is an inbound pipe from its point of view).
@@ -321,7 +321,7 @@ void zmq::pipe_t::process_pipe_term_ack ()
delete this;
}
-void zmq::pipe_t::terminate (bool delay_)
+void xs::pipe_t::terminate (bool delay_)
{
// Overload the value specified at pipe creation.
delay = delay_;
@@ -364,7 +364,7 @@ void zmq::pipe_t::terminate (bool delay_)
// There are no other states.
else
- zmq_assert (false);
+ xs_assert (false);
// Stop outbound flow of messages.
out_active = false;
@@ -383,12 +383,12 @@ void zmq::pipe_t::terminate (bool delay_)
}
}
-bool zmq::pipe_t::is_delimiter (msg_t &msg_)
+bool xs::pipe_t::is_delimiter (msg_t &msg_)
{
return msg_.is_delimiter ();
}
-int zmq::pipe_t::compute_lwm (int hwm_)
+int xs::pipe_t::compute_lwm (int hwm_)
{
// Compute the low water mark. Following point should be taken
// into consideration:
@@ -416,7 +416,7 @@ int zmq::pipe_t::compute_lwm (int hwm_)
return result;
}
-void zmq::pipe_t::delimit ()
+void xs::pipe_t::delimit ()
{
if (state == active) {
state = delimited;
@@ -431,10 +431,10 @@ void zmq::pipe_t::delimit ()
}
// Delimiter in any other state is invalid.
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::pipe_t::hiccup ()
+void xs::pipe_t::hiccup ()
{
// If termination is already under way do nothing.
if (state != active)
diff --git a/src/pipe.hpp b/src/pipe.hpp
index f438257..15775de 100644
--- a/src/pipe.hpp
+++ b/src/pipe.hpp
@@ -1,17 +1,17 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,8 +20,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_PIPE_HPP_INCLUDED__
-#define __ZMQ_PIPE_HPP_INCLUDED__
+#ifndef __XS_PIPE_HPP_INCLUDED__
+#define __XS_PIPE_HPP_INCLUDED__
#include "msg.hpp"
#include "ypipe.hpp"
@@ -31,7 +31,7 @@
#include "array.hpp"
#include "blob.hpp"
-namespace zmq
+namespace xs
{
class object_t;
@@ -43,17 +43,17 @@ namespace zmq
// Delay specifies how the pipe behaves when the peer terminates. If true
// pipe receives all the pending messages before terminating, otherwise it
// terminates straight away.
- int pipepair (zmq::object_t *parents_ [2], zmq::pipe_t* pipes_ [2],
+ int pipepair (xs::object_t *parents_ [2], xs::pipe_t* pipes_ [2],
int hwms_ [2], bool delays_ [2]);
struct i_pipe_events
{
virtual ~i_pipe_events () {}
- virtual void read_activated (zmq::pipe_t *pipe_) = 0;
- virtual void write_activated (zmq::pipe_t *pipe_) = 0;
- virtual void hiccuped (zmq::pipe_t *pipe_) = 0;
- virtual void terminated (zmq::pipe_t *pipe_) = 0;
+ virtual void read_activated (xs::pipe_t *pipe_) = 0;
+ virtual void write_activated (xs::pipe_t *pipe_) = 0;
+ virtual void hiccuped (xs::pipe_t *pipe_) = 0;
+ virtual void terminated (xs::pipe_t *pipe_) = 0;
};
// Note that pipe can be stored in three different arrays.
@@ -67,8 +67,8 @@ namespace zmq
public array_item_t <3>
{
// This allows pipepair to create pipe objects.
- friend int pipepair (zmq::object_t *parents_ [2],
- zmq::pipe_t* pipes_ [2], int hwms_ [2], bool delays_ [2]);
+ friend int pipepair (xs::object_t *parents_ [2],
+ xs::pipe_t* pipes_ [2], int hwms_ [2], bool delays_ [2]);
public:
diff --git a/src/poll.cpp b/src/poll.cpp
index 1d1c423..86fdd5b 100644
--- a/src/poll.cpp
+++ b/src/poll.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,7 +20,7 @@
*/
#include "poll.hpp"
-#if defined ZMQ_USE_POLL
+#if defined XS_USE_POLL
#include <sys/types.h>
#include <sys/time.h>
@@ -32,18 +32,18 @@
#include "config.hpp"
#include "i_poll_events.hpp"
-zmq::poll_t::poll_t () :
+xs::poll_t::poll_t () :
retired (false),
stopping (false)
{
}
-zmq::poll_t::~poll_t ()
+xs::poll_t::~poll_t ()
{
worker.stop ();
}
-zmq::poll_t::handle_t zmq::poll_t::add_fd (fd_t fd_, i_poll_events *events_)
+xs::poll_t::handle_t xs::poll_t::add_fd (fd_t fd_, i_poll_events *events_)
{
// If the file descriptor table is too small expand it.
fd_table_t::size_type sz = fd_table.size ();
@@ -68,7 +68,7 @@ zmq::poll_t::handle_t zmq::poll_t::add_fd (fd_t fd_, i_poll_events *events_)
return fd_;
}
-void zmq::poll_t::rm_fd (handle_t handle_)
+void xs::poll_t::rm_fd (handle_t handle_)
{
fd_t index = fd_table [handle_].index;
assert (index != retired_fd);
@@ -82,41 +82,41 @@ void zmq::poll_t::rm_fd (handle_t handle_)
adjust_load (-1);
}
-void zmq::poll_t::set_pollin (handle_t handle_)
+void xs::poll_t::set_pollin (handle_t handle_)
{
int index = fd_table [handle_].index;
pollset [index].events |= POLLIN;
}
-void zmq::poll_t::reset_pollin (handle_t handle_)
+void xs::poll_t::reset_pollin (handle_t handle_)
{
int index = fd_table [handle_].index;
pollset [index].events &= ~((short) POLLIN);
}
-void zmq::poll_t::set_pollout (handle_t handle_)
+void xs::poll_t::set_pollout (handle_t handle_)
{
int index = fd_table [handle_].index;
pollset [index].events |= POLLOUT;
}
-void zmq::poll_t::reset_pollout (handle_t handle_)
+void xs::poll_t::reset_pollout (handle_t handle_)
{
int index = fd_table [handle_].index;
pollset [index].events &= ~((short) POLLOUT);
}
-void zmq::poll_t::start ()
+void xs::poll_t::start ()
{
worker.start (worker_routine, this);
}
-void zmq::poll_t::stop ()
+void xs::poll_t::stop ()
{
stopping = true;
}
-void zmq::poll_t::loop ()
+void xs::poll_t::loop ()
{
while (!stopping) {
@@ -137,7 +137,7 @@ void zmq::poll_t::loop ()
for (pollset_t::size_type i = 0; i != pollset.size (); i++) {
- zmq_assert (!(pollset [i].revents & POLLNVAL));
+ xs_assert (!(pollset [i].revents & POLLNVAL));
if (pollset [i].fd == retired_fd)
continue;
if (pollset [i].revents & (POLLERR | POLLHUP))
@@ -168,7 +168,7 @@ void zmq::poll_t::loop ()
}
}
-void zmq::poll_t::worker_routine (void *arg_)
+void xs::poll_t::worker_routine (void *arg_)
{
((poll_t*) arg_)->loop ();
}
diff --git a/src/poll.hpp b/src/poll.hpp
index 9a7fbc3..3ce959f 100644
--- a/src/poll.hpp
+++ b/src/poll.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,12 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_POLL_HPP_INCLUDED__
-#define __ZMQ_POLL_HPP_INCLUDED__
+#ifndef __XS_POLL_HPP_INCLUDED__
+#define __XS_POLL_HPP_INCLUDED__
// poller.hpp decides which polling mechanism to use.
#include "poller.hpp"
-#if defined ZMQ_USE_POLL
+#if defined XS_USE_POLL
#include <poll.h>
#include <stddef.h>
@@ -34,7 +34,7 @@
#include "thread.hpp"
#include "poller_base.hpp"
-namespace zmq
+namespace xs
{
struct i_poll_events;
@@ -52,7 +52,7 @@ namespace zmq
~poll_t ();
// "poller" concept.
- handle_t add_fd (fd_t fd_, zmq::i_poll_events *events_);
+ handle_t add_fd (fd_t fd_, xs::i_poll_events *events_);
void rm_fd (handle_t handle_);
void set_pollin (handle_t handle_);
void reset_pollin (handle_t handle_);
@@ -72,7 +72,7 @@ namespace zmq
struct fd_entry_t
{
fd_t index;
- zmq::i_poll_events *events;
+ xs::i_poll_events *events;
};
// This table stores data for registered descriptors.
diff --git a/src/poller.hpp b/src/poller.hpp
index a989328..bf3c38f 100644
--- a/src/poller.hpp
+++ b/src/poller.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,61 +19,61 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_POLLER_HPP_INCLUDED__
-#define __ZMQ_POLLER_HPP_INCLUDED__
+#ifndef __XS_POLLER_HPP_INCLUDED__
+#define __XS_POLLER_HPP_INCLUDED__
#include "platform.hpp"
-#if defined ZMQ_FORCE_SELECT
-#define ZMQ_USE_SELECT
+#if defined XS_FORCE_SELECT
+#define XS_USE_SELECT
#include "select.hpp"
-#elif defined ZMQ_FORCE_POLL
-#define ZMQ_USE_POLL
+#elif defined XS_FORCE_POLL
+#define XS_USE_POLL
#include "poll.hpp"
-#elif defined ZMQ_FORCE_EPOLL
-#define ZMQ_USE_EPOLL
+#elif defined XS_FORCE_EPOLL
+#define XS_USE_EPOLL
#include "epoll.hpp"
-#elif defined ZMQ_FORCE_DEVPOLL
-#define ZMQ_USE_DEVPOLL
+#elif defined XS_FORCE_DEVPOLL
+#define XS_USE_DEVPOLL
#include "devpoll.hpp"
-#elif defined ZMQ_FORCE_KQUEUE
-#define ZMQ_USE_KQUEUE
+#elif defined XS_FORCE_KQUEUE
+#define XS_USE_KQUEUE
#include "kqueue.hpp"
-#elif defined ZMQ_HAVE_LINUX
-#define ZMQ_USE_EPOLL
+#elif defined XS_HAVE_LINUX
+#define XS_USE_EPOLL
#include "epoll.hpp"
-#elif defined ZMQ_HAVE_WINDOWS
-#define ZMQ_USE_SELECT
+#elif defined XS_HAVE_WINDOWS
+#define XS_USE_SELECT
#include "select.hpp"
-#elif defined ZMQ_HAVE_FREEBSD
-#define ZMQ_USE_KQUEUE
+#elif defined XS_HAVE_FREEBSD
+#define XS_USE_KQUEUE
#include "kqueue.hpp"
-#elif defined ZMQ_HAVE_OPENBSD
-#define ZMQ_USE_KQUEUE
+#elif defined XS_HAVE_OPENBSD
+#define XS_USE_KQUEUE
#include "kqueue.hpp"
-#elif defined ZMQ_HAVE_NETBSD
-#define ZMQ_USE_KQUEUE
+#elif defined XS_HAVE_NETBSD
+#define XS_USE_KQUEUE
#include "kqueue.hpp"
-#elif defined ZMQ_HAVE_SOLARIS
-#define ZMQ_USE_DEVPOLL
+#elif defined XS_HAVE_SOLARIS
+#define XS_USE_DEVPOLL
#include "devpoll.hpp"
-#elif defined ZMQ_HAVE_OSX
-#define ZMQ_USE_KQUEUE
+#elif defined XS_HAVE_OSX
+#define XS_USE_KQUEUE
#include "kqueue.hpp"
-#elif defined ZMQ_HAVE_QNXNTO
-#define ZMQ_USE_POLL
+#elif defined XS_HAVE_QNXNTO
+#define XS_USE_POLL
#include "poll.hpp"
-#elif defined ZMQ_HAVE_AIX
-#define ZMQ_USE_POLL
+#elif defined XS_HAVE_AIX
+#define XS_USE_POLL
#include "poll.hpp"
-#elif defined ZMQ_HAVE_HPUX
-#define ZMQ_USE_DEVPOLL
+#elif defined XS_HAVE_HPUX
+#define XS_USE_DEVPOLL
#include "devpoll.hpp"
-#elif defined ZMQ_HAVE_OPENVMS
-#define ZMQ_USE_SELECT
+#elif defined XS_HAVE_OPENVMS
+#define XS_USE_SELECT
#include "select.hpp"
-#elif defined ZMQ_HAVE_CYGWIN
-#define ZMQ_USE_SELECT
+#elif defined XS_HAVE_CYGWIN
+#define XS_USE_SELECT
#include "select.hpp"
#else
#error Unsupported platform
diff --git a/src/poller_base.cpp b/src/poller_base.cpp
index 6e532ae..7c8ddfd 100644
--- a/src/poller_base.cpp
+++ b/src/poller_base.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,22 +22,22 @@
#include "i_poll_events.hpp"
#include "err.hpp"
-zmq::poller_base_t::poller_base_t ()
+xs::poller_base_t::poller_base_t ()
{
}
-zmq::poller_base_t::~poller_base_t ()
+xs::poller_base_t::~poller_base_t ()
{
// Make sure there is no more load on the shutdown.
- zmq_assert (get_load () == 0);
+ xs_assert (get_load () == 0);
}
-int zmq::poller_base_t::get_load ()
+int xs::poller_base_t::get_load ()
{
return load.get ();
}
-void zmq::poller_base_t::adjust_load (int amount_)
+void xs::poller_base_t::adjust_load (int amount_)
{
if (amount_ > 0)
load.add (amount_);
@@ -45,14 +45,14 @@ void zmq::poller_base_t::adjust_load (int amount_)
load.sub (-amount_);
}
-void zmq::poller_base_t::add_timer (int timeout_, i_poll_events *sink_, int id_)
+void xs::poller_base_t::add_timer (int timeout_, i_poll_events *sink_, int id_)
{
uint64_t expiration = clock.now_ms () + timeout_;
timer_info_t info = {sink_, id_};
timers.insert (timers_t::value_type (expiration, info));
}
-void zmq::poller_base_t::cancel_timer (i_poll_events *sink_, int id_)
+void xs::poller_base_t::cancel_timer (i_poll_events *sink_, int id_)
{
// Complexity of this operation is O(n). We assume it is rarely used.
for (timers_t::iterator it = timers.begin (); it != timers.end (); ++it)
@@ -62,10 +62,10 @@ void zmq::poller_base_t::cancel_timer (i_poll_events *sink_, int id_)
}
// Timer not found.
- zmq_assert (false);
+ xs_assert (false);
}
-uint64_t zmq::poller_base_t::execute_timers ()
+uint64_t xs::poller_base_t::execute_timers ()
{
// Fast track.
if (timers.empty ())
diff --git a/src/poller_base.hpp b/src/poller_base.hpp
index c184358..b1a6bf9 100644
--- a/src/poller_base.hpp
+++ b/src/poller_base.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,15 +18,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_POLLER_BASE_HPP_INCLUDED__
-#define __ZMQ_POLLER_BASE_HPP_INCLUDED__
+#ifndef __XS_POLLER_BASE_HPP_INCLUDED__
+#define __XS_POLLER_BASE_HPP_INCLUDED__
#include <map>
#include "clock.hpp"
#include "atomic_counter.hpp"
-namespace zmq
+namespace xs
{
struct i_poll_events;
@@ -45,10 +45,10 @@ namespace zmq
// Add a timeout to expire in timeout_ milliseconds. After the
// expiration timer_event on sink_ object will be called with
// argument set to id_.
- void add_timer (int timeout_, zmq::i_poll_events *sink_, int id_);
+ void add_timer (int timeout_, xs::i_poll_events *sink_, int id_);
// Cancel the timer created by sink_ object with ID equal to id_.
- void cancel_timer (zmq::i_poll_events *sink_, int id_);
+ void cancel_timer (xs::i_poll_events *sink_, int id_);
protected:
@@ -67,7 +67,7 @@ namespace zmq
// List of active timers.
struct timer_info_t
{
- zmq::i_poll_events *sink;
+ xs::i_poll_events *sink;
int id;
};
typedef std::multimap <uint64_t, timer_info_t> timers_t;
diff --git a/src/precompiled.cpp b/src/precompiled.cpp
index 3b2e52d..434f6d2 100644
--- a/src/precompiled.cpp
+++ b/src/precompiled.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
diff --git a/src/precompiled.hpp b/src/precompiled.hpp
index aeea3cd..93f5ee6 100644
--- a/src/precompiled.hpp
+++ b/src/precompiled.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,8 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_PRECOMPILED_HPP_INCLUDED__
-#define __ZMQ_PRECOMPILED_HPP_INCLUDED__
+#ifndef __XS_PRECOMPILED_HPP_INCLUDED__
+#define __XS_PRECOMPILED_HPP_INCLUDED__
#ifdef _MSC_VER
@@ -39,8 +39,8 @@
#include <string>
#include <vector>
-// 0MQ definitions and exported functions
-#include "../include/zmq.h"
+// Crossroads definitions and exported functions
+#include "../include/xs.h"
#endif // _MSC_VER
diff --git a/src/pub.cpp b/src/pub.cpp
index d29a3f9..aa0ed8e 100644
--- a/src/pub.cpp
+++ b/src/pub.cpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,29 +22,29 @@
#include "pub.hpp"
#include "msg.hpp"
-zmq::pub_t::pub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::pub_t::pub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
xpub_t (parent_, tid_, sid_)
{
- options.type = ZMQ_PUB;
+ options.type = XS_PUB;
}
-zmq::pub_t::~pub_t ()
+xs::pub_t::~pub_t ()
{
}
-int zmq::pub_t::xrecv (class msg_t *msg_, int flags_)
+int xs::pub_t::xrecv (class msg_t *msg_, int flags_)
{
// Messages cannot be received from PUB socket.
errno = ENOTSUP;
return -1;
}
-bool zmq::pub_t::xhas_in ()
+bool xs::pub_t::xhas_in ()
{
return false;
}
-zmq::pub_session_t::pub_session_t (io_thread_t *io_thread_, bool connect_,
+xs::pub_session_t::pub_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
xpub_session_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -52,7 +52,7 @@ zmq::pub_session_t::pub_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::pub_session_t::~pub_session_t ()
+xs::pub_session_t::~pub_session_t ()
{
}
diff --git a/src/pub.hpp b/src/pub.hpp
index fc12cad..49aecc0 100644
--- a/src/pub.hpp
+++ b/src/pub.hpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,12 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_PUB_HPP_INCLUDED__
-#define __ZMQ_PUB_HPP_INCLUDED__
+#ifndef __XS_PUB_HPP_INCLUDED__
+#define __XS_PUB_HPP_INCLUDED__
#include "xpub.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -36,11 +36,11 @@ namespace zmq
{
public:
- pub_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ pub_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~pub_t ();
// Implementations of virtual functions from socket_base_t.
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xrecv (xs::msg_t *msg_, int flags_);
bool xhas_in ();
private:
@@ -53,8 +53,8 @@ namespace zmq
{
public:
- pub_session_t (zmq::io_thread_t *io_thread_, bool connect_,
- zmq::socket_base_t *socket_, const options_t &options_,
+ pub_session_t (xs::io_thread_t *io_thread_, bool connect_,
+ xs::socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~pub_session_t ();
diff --git a/src/pull.cpp b/src/pull.cpp
index 6ff5915..9495e12 100644
--- a/src/pull.cpp
+++ b/src/pull.cpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2010 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -24,43 +24,43 @@
#include "msg.hpp"
#include "pipe.hpp"
-zmq::pull_t::pull_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::pull_t::pull_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_)
{
- options.type = ZMQ_PULL;
+ options.type = XS_PULL;
}
-zmq::pull_t::~pull_t ()
+xs::pull_t::~pull_t ()
{
}
-void zmq::pull_t::xattach_pipe (pipe_t *pipe_)
+void xs::pull_t::xattach_pipe (pipe_t *pipe_)
{
- zmq_assert (pipe_);
+ xs_assert (pipe_);
fq.attach (pipe_);
}
-void zmq::pull_t::xread_activated (pipe_t *pipe_)
+void xs::pull_t::xread_activated (pipe_t *pipe_)
{
fq.activated (pipe_);
}
-void zmq::pull_t::xterminated (pipe_t *pipe_)
+void xs::pull_t::xterminated (pipe_t *pipe_)
{
fq.terminated (pipe_);
}
-int zmq::pull_t::xrecv (msg_t *msg_, int flags_)
+int xs::pull_t::xrecv (msg_t *msg_, int flags_)
{
return fq.recv (msg_, flags_);
}
-bool zmq::pull_t::xhas_in ()
+bool xs::pull_t::xhas_in ()
{
return fq.has_in ();
}
-zmq::pull_session_t::pull_session_t (io_thread_t *io_thread_, bool connect_,
+xs::pull_session_t::pull_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
session_base_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -68,7 +68,7 @@ zmq::pull_session_t::pull_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::pull_session_t::~pull_session_t ()
+xs::pull_session_t::~pull_session_t ()
{
}
diff --git a/src/pull.hpp b/src/pull.hpp
index 6ab7579..446956c 100644
--- a/src/pull.hpp
+++ b/src/pull.hpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2010 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,14 +19,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_PULL_HPP_INCLUDED__
-#define __ZMQ_PULL_HPP_INCLUDED__
+#ifndef __XS_PULL_HPP_INCLUDED__
+#define __XS_PULL_HPP_INCLUDED__
#include "socket_base.hpp"
#include "session_base.hpp"
#include "fq.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -39,17 +39,17 @@ namespace zmq
{
public:
- pull_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ pull_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~pull_t ();
protected:
// Overloads of functions from socket_base_t.
- void xattach_pipe (zmq::pipe_t *pipe_);
- int xrecv (zmq::msg_t *msg_, int flags_);
+ void xattach_pipe (xs::pipe_t *pipe_);
+ int xrecv (xs::msg_t *msg_, int flags_);
bool xhas_in ();
- void xread_activated (zmq::pipe_t *pipe_);
- void xterminated (zmq::pipe_t *pipe_);
+ void xread_activated (xs::pipe_t *pipe_);
+ void xterminated (xs::pipe_t *pipe_);
private:
@@ -65,7 +65,7 @@ namespace zmq
{
public:
- pull_session_t (zmq::io_thread_t *io_thread_, bool connect_,
+ pull_session_t (xs::io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~pull_session_t ();
diff --git a/src/push.cpp b/src/push.cpp
index 2136e2b..b0002e9 100644
--- a/src/push.cpp
+++ b/src/push.cpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2010 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -24,43 +24,43 @@
#include "err.hpp"
#include "msg.hpp"
-zmq::push_t::push_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::push_t::push_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_)
{
- options.type = ZMQ_PUSH;
+ options.type = XS_PUSH;
}
-zmq::push_t::~push_t ()
+xs::push_t::~push_t ()
{
}
-void zmq::push_t::xattach_pipe (pipe_t *pipe_)
+void xs::push_t::xattach_pipe (pipe_t *pipe_)
{
- zmq_assert (pipe_);
+ xs_assert (pipe_);
lb.attach (pipe_);
}
-void zmq::push_t::xwrite_activated (pipe_t *pipe_)
+void xs::push_t::xwrite_activated (pipe_t *pipe_)
{
lb.activated (pipe_);
}
-void zmq::push_t::xterminated (pipe_t *pipe_)
+void xs::push_t::xterminated (pipe_t *pipe_)
{
lb.terminated (pipe_);
}
-int zmq::push_t::xsend (msg_t *msg_, int flags_)
+int xs::push_t::xsend (msg_t *msg_, int flags_)
{
return lb.send (msg_, flags_);
}
-bool zmq::push_t::xhas_out ()
+bool xs::push_t::xhas_out ()
{
return lb.has_out ();
}
-zmq::push_session_t::push_session_t (io_thread_t *io_thread_, bool connect_,
+xs::push_session_t::push_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
session_base_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -68,7 +68,7 @@ zmq::push_session_t::push_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::push_session_t::~push_session_t ()
+xs::push_session_t::~push_session_t ()
{
}
diff --git a/src/push.hpp b/src/push.hpp
index 07900eb..f90479c 100644
--- a/src/push.hpp
+++ b/src/push.hpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2010 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,14 +19,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_PUSH_HPP_INCLUDED__
-#define __ZMQ_PUSH_HPP_INCLUDED__
+#ifndef __XS_PUSH_HPP_INCLUDED__
+#define __XS_PUSH_HPP_INCLUDED__
#include "socket_base.hpp"
#include "session_base.hpp"
#include "lb.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -39,17 +39,17 @@ namespace zmq
{
public:
- push_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ push_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~push_t ();
protected:
// Overloads of functions from socket_base_t.
- void xattach_pipe (zmq::pipe_t *pipe_);
- int xsend (zmq::msg_t *msg_, int flags_);
+ void xattach_pipe (xs::pipe_t *pipe_);
+ int xsend (xs::msg_t *msg_, int flags_);
bool xhas_out ();
- void xwrite_activated (zmq::pipe_t *pipe_);
- void xterminated (zmq::pipe_t *pipe_);
+ void xwrite_activated (xs::pipe_t *pipe_);
+ void xterminated (xs::pipe_t *pipe_);
private:
@@ -64,7 +64,7 @@ namespace zmq
{
public:
- push_session_t (zmq::io_thread_t *io_thread_, bool connect_,
+ push_session_t (xs::io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~push_session_t ();
diff --git a/src/random.cpp b/src/random.cpp
index 326a3d9..2a00ac3 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include "platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <unistd.h>
@@ -31,9 +31,9 @@
#include "stdint.hpp"
#include "clock.hpp"
-void zmq::seed_random ()
+void xs::seed_random ()
{
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
int pid = (int) GetCurrentProcessId ();
#else
int pid = (int) getpid ();
@@ -41,7 +41,7 @@ void zmq::seed_random ()
srand ((unsigned int) (clock_t::now_us () + pid));
}
-uint32_t zmq::generate_random ()
+uint32_t xs::generate_random ()
{
// Compensate for the fact that rand() returns signed integer.
uint32_t low = (uint32_t) rand ();
diff --git a/src/random.hpp b/src/random.hpp
index ca3d39a..0e482ef 100644
--- a/src/random.hpp
+++ b/src/random.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,12 +18,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_RANDOM_HPP_INCLUDED__
-#define __ZMQ_RANDOM_HPP_INCLUDED__
+#ifndef __XS_RANDOM_HPP_INCLUDED__
+#define __XS_RANDOM_HPP_INCLUDED__
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
// Seeds the random number generator.
diff --git a/src/reaper.cpp b/src/reaper.cpp
index 716f638..1eb2b7c 100644
--- a/src/reaper.cpp
+++ b/src/reaper.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,7 +22,7 @@
#include "socket_base.hpp"
#include "err.hpp"
-zmq::reaper_t::reaper_t (class ctx_t *ctx_, uint32_t tid_) :
+xs::reaper_t::reaper_t (class ctx_t *ctx_, uint32_t tid_) :
object_t (ctx_, tid_),
sockets (0),
terminating (false)
@@ -34,28 +34,28 @@ zmq::reaper_t::reaper_t (class ctx_t *ctx_, uint32_t tid_) :
poller->set_pollin (mailbox_handle);
}
-zmq::reaper_t::~reaper_t ()
+xs::reaper_t::~reaper_t ()
{
delete poller;
}
-zmq::mailbox_t *zmq::reaper_t::get_mailbox ()
+xs::mailbox_t *xs::reaper_t::get_mailbox ()
{
return &mailbox;
}
-void zmq::reaper_t::start ()
+void xs::reaper_t::start ()
{
// Start the thread.
poller->start ();
}
-void zmq::reaper_t::stop ()
+void xs::reaper_t::stop ()
{
send_stop ();
}
-void zmq::reaper_t::in_event ()
+void xs::reaper_t::in_event ()
{
while (true) {
@@ -73,17 +73,17 @@ void zmq::reaper_t::in_event ()
}
}
-void zmq::reaper_t::out_event ()
+void xs::reaper_t::out_event ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::reaper_t::timer_event (int id_)
+void xs::reaper_t::timer_event (int id_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::reaper_t::process_stop ()
+void xs::reaper_t::process_stop ()
{
terminating = true;
@@ -95,7 +95,7 @@ void zmq::reaper_t::process_stop ()
}
}
-void zmq::reaper_t::process_reap (socket_base_t *socket_)
+void xs::reaper_t::process_reap (socket_base_t *socket_)
{
// Add the socket to the poller.
socket_->start_reaping (poller);
@@ -103,7 +103,7 @@ void zmq::reaper_t::process_reap (socket_base_t *socket_)
++sockets;
}
-void zmq::reaper_t::process_reaped ()
+void xs::reaper_t::process_reaped ()
{
--sockets;
diff --git a/src/reaper.hpp b/src/reaper.hpp
index 66a3db9..b3fc818 100644
--- a/src/reaper.hpp
+++ b/src/reaper.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2011 250bpm s.r.o.
+ Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,15 +18,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_REAPER_HPP_INCLUDED__
-#define __ZMQ_REAPER_HPP_INCLUDED__
+#ifndef __XS_REAPER_HPP_INCLUDED__
+#define __XS_REAPER_HPP_INCLUDED__
#include "object.hpp"
#include "mailbox.hpp"
#include "poller.hpp"
#include "i_poll_events.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -36,7 +36,7 @@ namespace zmq
{
public:
- reaper_t (zmq::ctx_t *ctx_, uint32_t tid_);
+ reaper_t (xs::ctx_t *ctx_, uint32_t tid_);
~reaper_t ();
mailbox_t *get_mailbox ();
@@ -53,7 +53,7 @@ namespace zmq
// Command handlers.
void process_stop ();
- void process_reap (zmq::socket_base_t *socket_);
+ void process_reap (xs::socket_base_t *socket_);
void process_reaped ();
// Reaper thread accesses incoming commands via this mailbox.
diff --git a/src/rep.cpp b/src/rep.cpp
index 5ded266..6454b57 100644
--- a/src/rep.cpp
+++ b/src/rep.cpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2011 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -23,19 +23,19 @@
#include "err.hpp"
#include "msg.hpp"
-zmq::rep_t::rep_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::rep_t::rep_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
xrep_t (parent_, tid_, sid_),
sending_reply (false),
request_begins (true)
{
- options.type = ZMQ_REP;
+ options.type = XS_REP;
}
-zmq::rep_t::~rep_t ()
+xs::rep_t::~rep_t ()
{
}
-int zmq::rep_t::xsend (msg_t *msg_, int flags_)
+int xs::rep_t::xsend (msg_t *msg_, int flags_)
{
// If we are in the middle of receiving a request, we cannot send reply.
if (!sending_reply) {
@@ -57,7 +57,7 @@ int zmq::rep_t::xsend (msg_t *msg_, int flags_)
return 0;
}
-int zmq::rep_t::xrecv (msg_t *msg_, int flags_)
+int xs::rep_t::xrecv (msg_t *msg_, int flags_)
{
// If we are in middle of sending a reply, we cannot receive next request.
if (sending_reply) {
@@ -72,7 +72,7 @@ int zmq::rep_t::xrecv (msg_t *msg_, int flags_)
int rc = xrep_t::xrecv (msg_, flags_);
if (rc != 0)
return rc;
- zmq_assert (msg_->flags () & msg_t::more);
+ xs_assert (msg_->flags () & msg_t::more);
bool bottom = (msg_->size () == 0);
rc = xrep_t::xsend (msg_, flags_);
errno_assert (rc == 0);
@@ -96,7 +96,7 @@ int zmq::rep_t::xrecv (msg_t *msg_, int flags_)
return 0;
}
-bool zmq::rep_t::xhas_in ()
+bool xs::rep_t::xhas_in ()
{
if (sending_reply)
return false;
@@ -104,7 +104,7 @@ bool zmq::rep_t::xhas_in ()
return xrep_t::xhas_in ();
}
-bool zmq::rep_t::xhas_out ()
+bool xs::rep_t::xhas_out ()
{
if (!sending_reply)
return false;
@@ -112,7 +112,7 @@ bool zmq::rep_t::xhas_out ()
return xrep_t::xhas_out ();
}
-zmq::rep_session_t::rep_session_t (io_thread_t *io_thread_, bool connect_,
+xs::rep_session_t::rep_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
xrep_session_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -120,7 +120,7 @@ zmq::rep_session_t::rep_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::rep_session_t::~rep_session_t ()
+xs::rep_session_t::~rep_session_t ()
{
}
diff --git a/src/rep.hpp b/src/rep.hpp
index 87d9e2a..0b608ee 100644
--- a/src/rep.hpp
+++ b/src/rep.hpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2011 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,12 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_REP_HPP_INCLUDED__
-#define __ZMQ_REP_HPP_INCLUDED__
+#ifndef __XS_REP_HPP_INCLUDED__
+#define __XS_REP_HPP_INCLUDED__
#include "xrep.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -36,12 +36,12 @@ namespace zmq
{
public:
- rep_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ rep_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~rep_t ();
// Overloads of functions from socket_base_t.
- int xsend (zmq::msg_t *msg_, int flags_);
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xsend (xs::msg_t *msg_, int flags_);
+ int xrecv (xs::msg_t *msg_, int flags_);
bool xhas_in ();
bool xhas_out ();
@@ -64,8 +64,8 @@ namespace zmq
{
public:
- rep_session_t (zmq::io_thread_t *io_thread_, bool connect_,
- zmq::socket_base_t *socket_, const options_t &options_,
+ rep_session_t (xs::io_thread_t *io_thread_, bool connect_,
+ xs::socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~rep_session_t ();
diff --git a/src/req.cpp b/src/req.cpp
index 1f09e8e..af6c8cd 100644
--- a/src/req.cpp
+++ b/src/req.cpp
@@ -4,14 +4,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -27,19 +27,19 @@
#include "random.hpp"
#include "likely.hpp"
-zmq::req_t::req_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::req_t::req_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
xreq_t (parent_, tid_, sid_),
receiving_reply (false),
message_begins (true)
{
- options.type = ZMQ_REQ;
+ options.type = XS_REQ;
}
-zmq::req_t::~req_t ()
+xs::req_t::~req_t ()
{
}
-int zmq::req_t::xsend (msg_t *msg_, int flags_)
+int xs::req_t::xsend (msg_t *msg_, int flags_)
{
// If we've sent a request and we still haven't got the reply,
// we can't send another request.
@@ -75,7 +75,7 @@ int zmq::req_t::xsend (msg_t *msg_, int flags_)
return 0;
}
-int zmq::req_t::xrecv (msg_t *msg_, int flags_)
+int xs::req_t::xrecv (msg_t *msg_, int flags_)
{
// If request wasn't send, we can't wait for reply.
if (!receiving_reply) {
@@ -119,7 +119,7 @@ int zmq::req_t::xrecv (msg_t *msg_, int flags_)
return 0;
}
-bool zmq::req_t::xhas_in ()
+bool xs::req_t::xhas_in ()
{
// TODO: Duplicates should be removed here.
@@ -129,7 +129,7 @@ bool zmq::req_t::xhas_in ()
return xreq_t::xhas_in ();
}
-bool zmq::req_t::xhas_out ()
+bool xs::req_t::xhas_out ()
{
if (receiving_reply)
return false;
@@ -137,7 +137,7 @@ bool zmq::req_t::xhas_out ()
return xreq_t::xhas_out ();
}
-zmq::req_session_t::req_session_t (io_thread_t *io_thread_, bool connect_,
+xs::req_session_t::req_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
xreq_session_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -146,12 +146,12 @@ zmq::req_session_t::req_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::req_session_t::~req_session_t ()
+xs::req_session_t::~req_session_t ()
{
state = options.recv_identity ? identity : bottom;
}
-int zmq::req_session_t::write (msg_t *msg_)
+int xs::req_session_t::write (msg_t *msg_)
{
switch (state) {
case bottom:
diff --git a/src/req.hpp b/src/req.hpp
index 69b7bd4..46015e8 100644
--- a/src/req.hpp
+++ b/src/req.hpp
@@ -4,14 +4,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,13 +20,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_REQ_HPP_INCLUDED__
-#define __ZMQ_REQ_HPP_INCLUDED__
+#ifndef __XS_REQ_HPP_INCLUDED__
+#define __XS_REQ_HPP_INCLUDED__
#include "xreq.hpp"
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -38,12 +38,12 @@ namespace zmq
{
public:
- req_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ req_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~req_t ();
// Overloads of functions from socket_base_t.
- int xsend (zmq::msg_t *msg_, int flags_);
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xsend (xs::msg_t *msg_, int flags_);
+ int xrecv (xs::msg_t *msg_, int flags_);
bool xhas_in ();
bool xhas_out ();
@@ -65,8 +65,8 @@ namespace zmq
{
public:
- req_session_t (zmq::io_thread_t *io_thread_, bool connect_,
- zmq::socket_base_t *socket_, const options_t &options_,
+ req_session_t (xs::io_thread_t *io_thread_, bool connect_,
+ xs::socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~req_session_t ();
diff --git a/src/select.cpp b/src/select.cpp
index 56b87ae..b2ade09 100644
--- a/src/select.cpp
+++ b/src/select.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,16 +20,16 @@
*/
#include "select.hpp"
-#if defined ZMQ_USE_SELECT
+#if defined XS_USE_SELECT
#include "platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
-#elif defined ZMQ_HAVE_HPUX
+#elif defined XS_HAVE_HPUX
#include <sys/param.h>
#include <sys/types.h>
#include <sys/time.h>
-#elif defined ZMQ_HAVE_OPENVMS
+#elif defined XS_HAVE_OPENVMS
#include <sys/types.h>
#include <sys/time.h>
#else
@@ -43,7 +43,7 @@
#include "config.hpp"
#include "i_poll_events.hpp"
-zmq::select_t::select_t () :
+xs::select_t::select_t () :
maxfd (retired_fd),
retired (false),
stopping (false)
@@ -54,12 +54,12 @@ zmq::select_t::select_t () :
FD_ZERO (&source_set_err);
}
-zmq::select_t::~select_t ()
+xs::select_t::~select_t ()
{
worker.stop ();
}
-zmq::select_t::handle_t zmq::select_t::add_fd (fd_t fd_, i_poll_events *events_)
+xs::select_t::handle_t xs::select_t::add_fd (fd_t fd_, i_poll_events *events_)
{
// Store the file descriptor.
fd_entry_t entry = {fd_, events_};
@@ -67,7 +67,7 @@ zmq::select_t::handle_t zmq::select_t::add_fd (fd_t fd_, i_poll_events *events_)
// Ensure we do not attempt to select () on more than FD_SETSIZE
// file descriptors.
- zmq_assert (fds.size () <= FD_SETSIZE);
+ xs_assert (fds.size () <= FD_SETSIZE);
// Start polling on errors.
FD_SET (fd_, &source_set_err);
@@ -82,14 +82,14 @@ zmq::select_t::handle_t zmq::select_t::add_fd (fd_t fd_, i_poll_events *events_)
return fd_;
}
-void zmq::select_t::rm_fd (handle_t handle_)
+void xs::select_t::rm_fd (handle_t handle_)
{
// Mark the descriptor as retired.
fd_set_t::iterator it;
for (it = fds.begin (); it != fds.end (); ++it)
if (it->fd == handle_)
break;
- zmq_assert (it != fds.end ());
+ xs_assert (it != fds.end ());
it->fd = retired_fd;
retired = true;
@@ -116,37 +116,37 @@ void zmq::select_t::rm_fd (handle_t handle_)
adjust_load (-1);
}
-void zmq::select_t::set_pollin (handle_t handle_)
+void xs::select_t::set_pollin (handle_t handle_)
{
FD_SET (handle_, &source_set_in);
}
-void zmq::select_t::reset_pollin (handle_t handle_)
+void xs::select_t::reset_pollin (handle_t handle_)
{
FD_CLR (handle_, &source_set_in);
}
-void zmq::select_t::set_pollout (handle_t handle_)
+void xs::select_t::set_pollout (handle_t handle_)
{
FD_SET (handle_, &source_set_out);
}
-void zmq::select_t::reset_pollout (handle_t handle_)
+void xs::select_t::reset_pollout (handle_t handle_)
{
FD_CLR (handle_, &source_set_out);
}
-void zmq::select_t::start ()
+void xs::select_t::start ()
{
worker.start (worker_routine, this);
}
-void zmq::select_t::stop ()
+void xs::select_t::stop ()
{
stopping = true;
}
-void zmq::select_t::loop ()
+void xs::select_t::loop ()
{
while (!stopping) {
@@ -161,7 +161,7 @@ void zmq::select_t::loop ()
// Wait for events.
struct timeval tv = {(long) (timeout / 1000),
(long) (timeout % 1000 * 1000)};
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
int rc = select (0, &readfds, &writefds, &exceptfds,
timeout ? &tv : NULL);
wsa_assert (rc != SOCKET_ERROR);
@@ -196,18 +196,18 @@ void zmq::select_t::loop ()
// Destroy retired event sources.
if (retired) {
fds.erase (std::remove_if (fds.begin (), fds.end (),
- zmq::select_t::is_retired_fd), fds.end ());
+ xs::select_t::is_retired_fd), fds.end ());
retired = false;
}
}
}
-void zmq::select_t::worker_routine (void *arg_)
+void xs::select_t::worker_routine (void *arg_)
{
((select_t*) arg_)->loop ();
}
-bool zmq::select_t::is_retired_fd (const fd_entry_t &entry)
+bool xs::select_t::is_retired_fd (const fd_entry_t &entry)
{
return (entry.fd == retired_fd);
}
diff --git a/src/select.hpp b/src/select.hpp
index 9f19a0f..b60c37d 100644
--- a/src/select.hpp
+++ b/src/select.hpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,21 +19,21 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_SELECT_HPP_INCLUDED__
-#define __ZMQ_SELECT_HPP_INCLUDED__
+#ifndef __XS_SELECT_HPP_INCLUDED__
+#define __XS_SELECT_HPP_INCLUDED__
// poller.hpp decides which polling mechanism to use.
#include "poller.hpp"
-#if defined ZMQ_USE_SELECT
+#if defined XS_USE_SELECT
#include "platform.hpp"
#include <stddef.h>
#include <vector>
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "winsock2.h"
-#elif defined ZMQ_HAVE_OPENVMS
+#elif defined XS_HAVE_OPENVMS
#include <sys/types.h>
#include <sys/time.h>
#else
@@ -44,7 +44,7 @@
#include "thread.hpp"
#include "poller_base.hpp"
-namespace zmq
+namespace xs
{
struct i_poll_events;
@@ -62,7 +62,7 @@ namespace zmq
~select_t ();
// "poller" concept.
- handle_t add_fd (fd_t fd_, zmq::i_poll_events *events_);
+ handle_t add_fd (fd_t fd_, xs::i_poll_events *events_);
void rm_fd (handle_t handle_);
void set_pollin (handle_t handle_);
void reset_pollin (handle_t handle_);
@@ -82,7 +82,7 @@ namespace zmq
struct fd_entry_t
{
fd_t fd;
- zmq::i_poll_events *events;
+ xs::i_poll_events *events;
};
// Checks if an fd_entry_t is retired.
diff --git a/src/session_base.cpp b/src/session_base.cpp
index f2ee713..6c23bb5 100644
--- a/src/session_base.cpp
+++ b/src/session_base.cpp
@@ -4,14 +4,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -43,52 +43,52 @@
#include "pull.hpp"
#include "pair.hpp"
-zmq::session_base_t *zmq::session_base_t::create (class io_thread_t *io_thread_,
+xs::session_base_t *xs::session_base_t::create (class io_thread_t *io_thread_,
bool connect_, class socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_)
{
session_base_t *s = NULL;
switch (options_.type) {
- case ZMQ_REQ:
+ case XS_REQ:
s = new (std::nothrow) req_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
- case ZMQ_XREQ:
+ case XS_XREQ:
s = new (std::nothrow) xreq_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
- case ZMQ_REP:
+ case XS_REP:
s = new (std::nothrow) rep_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
- case ZMQ_XREP:
+ case XS_XREP:
s = new (std::nothrow) xrep_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
- case ZMQ_PUB:
+ case XS_PUB:
s = new (std::nothrow) pub_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
- case ZMQ_XPUB:
+ case XS_XPUB:
s = new (std::nothrow) xpub_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
- case ZMQ_SUB:
+ case XS_SUB:
s = new (std::nothrow) sub_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
- case ZMQ_XSUB:
+ case XS_XSUB:
s = new (std::nothrow) xsub_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
- case ZMQ_PUSH:
+ case XS_PUSH:
s = new (std::nothrow) push_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
- case ZMQ_PULL:
+ case XS_PULL:
s = new (std::nothrow) pull_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
- case ZMQ_PAIR:
+ case XS_PAIR:
s = new (std::nothrow) pair_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
@@ -100,7 +100,7 @@ zmq::session_base_t *zmq::session_base_t::create (class io_thread_t *io_thread_,
return s;
}
-zmq::session_base_t::session_base_t (class io_thread_t *io_thread_,
+xs::session_base_t::session_base_t (class io_thread_t *io_thread_,
bool connect_, class socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
own_t (io_thread_, options_),
@@ -122,9 +122,9 @@ zmq::session_base_t::session_base_t (class io_thread_t *io_thread_,
address = address_;
}
-zmq::session_base_t::~session_base_t ()
+xs::session_base_t::~session_base_t ()
{
- zmq_assert (!pipe);
+ xs_assert (!pipe);
// If there's still a pending linger timer, remove it.
if (has_linger_timer) {
@@ -137,20 +137,20 @@ zmq::session_base_t::~session_base_t ()
engine->terminate ();
}
-void zmq::session_base_t::attach_pipe (pipe_t *pipe_)
+void xs::session_base_t::attach_pipe (pipe_t *pipe_)
{
- zmq_assert (!is_terminating ());
- zmq_assert (!pipe);
- zmq_assert (pipe_);
+ xs_assert (!is_terminating ());
+ xs_assert (!pipe);
+ xs_assert (pipe_);
pipe = pipe_;
pipe->set_event_sink (this);
}
-int zmq::session_base_t::read (msg_t *msg_)
+int xs::session_base_t::read (msg_t *msg_)
{
// First message to send is identity (if required).
if (send_identity) {
- zmq_assert (!(msg_->flags () & msg_t::more));
+ xs_assert (!(msg_->flags () & msg_t::more));
msg_->init_size (options.identity_size);
memcpy (msg_->data (), options.identity, options.identity_size);
send_identity = false;
@@ -167,7 +167,7 @@ int zmq::session_base_t::read (msg_t *msg_)
return 0;
}
-int zmq::session_base_t::write (msg_t *msg_)
+int xs::session_base_t::write (msg_t *msg_)
{
// First message to receive is identity (if required).
if (recv_identity) {
@@ -185,13 +185,13 @@ int zmq::session_base_t::write (msg_t *msg_)
return -1;
}
-void zmq::session_base_t::flush ()
+void xs::session_base_t::flush ()
{
if (pipe)
pipe->flush ();
}
-void zmq::session_base_t::clean_pipes ()
+void xs::session_base_t::clean_pipes ()
{
if (pipe) {
@@ -206,7 +206,7 @@ void zmq::session_base_t::clean_pipes ()
int rc = msg.init ();
errno_assert (rc == 0);
if (!read (&msg)) {
- zmq_assert (!incomplete_in);
+ xs_assert (!incomplete_in);
break;
}
rc = msg.close ();
@@ -215,10 +215,10 @@ void zmq::session_base_t::clean_pipes ()
}
}
-void zmq::session_base_t::terminated (pipe_t *pipe_)
+void xs::session_base_t::terminated (pipe_t *pipe_)
{
// Drop the reference to the deallocated pipe.
- zmq_assert (pipe == pipe_);
+ xs_assert (pipe == pipe_);
pipe = NULL;
// If we are waiting for pending messages to be sent, at this point
@@ -228,9 +228,9 @@ void zmq::session_base_t::terminated (pipe_t *pipe_)
proceed_with_term ();
}
-void zmq::session_base_t::read_activated (pipe_t *pipe_)
+void xs::session_base_t::read_activated (pipe_t *pipe_)
{
- zmq_assert (pipe == pipe_);
+ xs_assert (pipe == pipe_);
if (likely (engine != NULL))
engine->activate_out ();
@@ -238,33 +238,33 @@ void zmq::session_base_t::read_activated (pipe_t *pipe_)
pipe->check_read ();
}
-void zmq::session_base_t::write_activated (pipe_t *pipe_)
+void xs::session_base_t::write_activated (pipe_t *pipe_)
{
- zmq_assert (pipe == pipe_);
+ xs_assert (pipe == pipe_);
if (engine)
engine->activate_in ();
}
-void zmq::session_base_t::hiccuped (pipe_t *pipe_)
+void xs::session_base_t::hiccuped (pipe_t *pipe_)
{
// Hiccups are always sent from session to socket, not the other
// way round.
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::session_base_t::process_plug ()
+void xs::session_base_t::process_plug ()
{
if (connect)
start_connecting (false);
}
-void zmq::session_base_t::process_attach (i_engine *engine_)
+void xs::session_base_t::process_attach (i_engine *engine_)
{
// If some other object (e.g. init) notifies us that the connection failed
// without creating an engine we need to start the reconnection process.
if (!engine_) {
- zmq_assert (!engine);
+ xs_assert (!engine);
detached ();
return;
}
@@ -282,7 +282,7 @@ void zmq::session_base_t::process_attach (i_engine *engine_)
pipes [0]->set_event_sink (this);
// Remember the local end of the pipe.
- zmq_assert (!pipe);
+ xs_assert (!pipe);
pipe = pipes [0];
// Ask socket to plug into the remote end of the pipe.
@@ -290,12 +290,12 @@ void zmq::session_base_t::process_attach (i_engine *engine_)
}
// Plug in the engine.
- zmq_assert (!engine);
+ xs_assert (!engine);
engine = engine_;
engine->plug (io_thread, this);
}
-void zmq::session_base_t::detach ()
+void xs::session_base_t::detach ()
{
// Engine is dead. Let's forget about it.
engine = NULL;
@@ -311,9 +311,9 @@ void zmq::session_base_t::detach ()
pipe->check_read ();
}
-void zmq::session_base_t::process_term (int linger_)
+void xs::session_base_t::process_term (int linger_)
{
- zmq_assert (!pending);
+ xs_assert (!pending);
// If the termination of the pipe happens before the term command is
// delivered there's nothing much to do. We can proceed with the
@@ -329,7 +329,7 @@ void zmq::session_base_t::process_term (int linger_)
// If linger is infinite (negative) we don't even have to set
// the timer.
if (linger_ > 0) {
- zmq_assert (!has_linger_timer);
+ xs_assert (!has_linger_timer);
add_timer (linger_, linger_timer_id);
has_linger_timer = true;
}
@@ -344,7 +344,7 @@ void zmq::session_base_t::process_term (int linger_)
pipe->check_read ();
}
-void zmq::session_base_t::proceed_with_term ()
+void xs::session_base_t::proceed_with_term ()
{
// The pending phase have just ended.
pending = false;
@@ -353,19 +353,19 @@ void zmq::session_base_t::proceed_with_term ()
own_t::process_term (0);
}
-void zmq::session_base_t::timer_event (int id_)
+void xs::session_base_t::timer_event (int id_)
{
// Linger period expired. We can proceed with termination even though
// there are still pending messages to be sent.
- zmq_assert (id_ == linger_timer_id);
+ xs_assert (id_ == linger_timer_id);
has_linger_timer = false;
// Ask pipe to terminate even though there may be pending messages in it.
- zmq_assert (pipe);
+ xs_assert (pipe);
pipe->terminate (false);
}
-void zmq::session_base_t::detached ()
+void xs::session_base_t::detached ()
{
// Transient session self-destructs after peer disconnects.
if (!connect) {
@@ -378,18 +378,18 @@ void zmq::session_base_t::detached ()
// For subscriber sockets we hiccup the inbound pipe, which will cause
// the socket object to resend all the subscriptions.
- if (pipe && (options.type == ZMQ_SUB || options.type == ZMQ_XSUB))
+ if (pipe && (options.type == XS_SUB || options.type == XS_XSUB))
pipe->hiccup ();
}
-void zmq::session_base_t::start_connecting (bool wait_)
+void xs::session_base_t::start_connecting (bool wait_)
{
- zmq_assert (connect);
+ xs_assert (connect);
// Choose I/O thread to run connecter in. Given that we are already
// running in an I/O thread, there must be at least one available.
io_thread_t *io_thread = choose_io_thread (options.affinity);
- zmq_assert (io_thread);
+ xs_assert (io_thread);
// Create the connecter object.
@@ -401,7 +401,7 @@ void zmq::session_base_t::start_connecting (bool wait_)
return;
}
-#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+#if !defined XS_HAVE_WINDOWS && !defined XS_HAVE_OPENVMS
if (protocol == "ipc") {
ipc_connecter_t *connecter = new (std::nothrow) ipc_connecter_t (
io_thread, this, options, address.c_str (), wait_);
@@ -411,7 +411,7 @@ void zmq::session_base_t::start_connecting (bool wait_)
}
#endif
-#if defined ZMQ_HAVE_OPENPGM
+#if defined XS_HAVE_OPENPGM
// Both PGM and EPGM transports are using the same infrastructure.
if (protocol == "pgm" || protocol == "epgm") {
@@ -422,7 +422,7 @@ void zmq::session_base_t::start_connecting (bool wait_)
// At this point we'll create message pipes to the session straight
// away. There's no point in delaying it as no concept of 'connect'
// exists with PGM anyway.
- if (options.type == ZMQ_PUB || options.type == ZMQ_XPUB) {
+ if (options.type == XS_PUB || options.type == XS_XPUB) {
// PGM sender.
pgm_sender_t *pgm_sender = new (std::nothrow) pgm_sender_t (
@@ -430,11 +430,11 @@ void zmq::session_base_t::start_connecting (bool wait_)
alloc_assert (pgm_sender);
int rc = pgm_sender->init (udp_encapsulation, address.c_str ());
- zmq_assert (rc == 0);
+ xs_assert (rc == 0);
send_attach (this, pgm_sender);
}
- else if (options.type == ZMQ_SUB || options.type == ZMQ_XSUB) {
+ else if (options.type == XS_SUB || options.type == XS_XSUB) {
// PGM receiver.
pgm_receiver_t *pgm_receiver = new (std::nothrow) pgm_receiver_t (
@@ -442,17 +442,17 @@ void zmq::session_base_t::start_connecting (bool wait_)
alloc_assert (pgm_receiver);
int rc = pgm_receiver->init (udp_encapsulation, address.c_str ());
- zmq_assert (rc == 0);
+ xs_assert (rc == 0);
send_attach (this, pgm_receiver);
}
else
- zmq_assert (false);
+ xs_assert (false);
return;
}
#endif
- zmq_assert (false);
+ xs_assert (false);
}
diff --git a/src/session_base.hpp b/src/session_base.hpp
index 6be110b..2360b6b 100644
--- a/src/session_base.hpp
+++ b/src/session_base.hpp
@@ -4,14 +4,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,8 +20,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_SESSION_BASE_HPP_INCLUDED__
-#define __ZMQ_SESSION_BASE_HPP_INCLUDED__
+#ifndef __XS_SESSION_BASE_HPP_INCLUDED__
+#define __XS_SESSION_BASE_HPP_INCLUDED__
#include <string>
@@ -29,7 +29,7 @@
#include "io_object.hpp"
#include "pipe.hpp"
-namespace zmq
+namespace xs
{
class pipe_t;
@@ -45,13 +45,13 @@ namespace zmq
public:
// Create a session of the particular type.
- static session_base_t *create (zmq::io_thread_t *io_thread_,
- bool connect_, zmq::socket_base_t *socket_,
+ static session_base_t *create (xs::io_thread_t *io_thread_,
+ bool connect_, xs::socket_base_t *socket_,
const options_t &options_, const char *protocol_,
const char *address_);
// To be used once only, when creating the session.
- void attach_pipe (zmq::pipe_t *pipe_);
+ void attach_pipe (xs::pipe_t *pipe_);
// Following functions are the interface exposed towards the engine.
virtual int read (msg_t *msg_);
@@ -60,15 +60,15 @@ namespace zmq
void detach ();
// i_pipe_events interface implementation.
- void read_activated (zmq::pipe_t *pipe_);
- void write_activated (zmq::pipe_t *pipe_);
- void hiccuped (zmq::pipe_t *pipe_);
- void terminated (zmq::pipe_t *pipe_);
+ void read_activated (xs::pipe_t *pipe_);
+ void write_activated (xs::pipe_t *pipe_);
+ void hiccuped (xs::pipe_t *pipe_);
+ void terminated (xs::pipe_t *pipe_);
protected:
- session_base_t (zmq::io_thread_t *io_thread_, bool connect_,
- zmq::socket_base_t *socket_, const options_t &options_,
+ session_base_t (xs::io_thread_t *io_thread_, bool connect_,
+ xs::socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~session_base_t ();
@@ -80,7 +80,7 @@ namespace zmq
// Handlers for incoming commands.
void process_plug ();
- void process_attach (zmq::i_engine *engine_);
+ void process_attach (xs::i_engine *engine_);
void process_term (int linger_);
// i_poll_events handlers.
@@ -98,7 +98,7 @@ namespace zmq
bool connect;
// Pipe connecting the session to its socket.
- zmq::pipe_t *pipe;
+ xs::pipe_t *pipe;
// This flag is true if the remainder of the message being processed
// is still in the in pipe.
@@ -109,14 +109,14 @@ namespace zmq
bool pending;
// The protocol I/O engine connected to the session.
- zmq::i_engine *engine;
+ xs::i_engine *engine;
// The socket the session belongs to.
- zmq::socket_base_t *socket;
+ xs::socket_base_t *socket;
// I/O thread the session is living in. It will be used to plug in
// the engines into the same thread.
- zmq::io_thread_t *io_thread;
+ xs::io_thread_t *io_thread;
// ID of the linger timer
enum {linger_timer_id = 0x20};
diff --git a/src/signaler.cpp b/src/signaler.cpp
index 29895c2..c2579c2 100644
--- a/src/signaler.cpp
+++ b/src/signaler.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,35 +20,35 @@
#include "platform.hpp"
-#if defined ZMQ_FORCE_SELECT
-#define ZMQ_SIGNALER_WAIT_BASED_ON_SELECT
-#elif defined ZMQ_FORCE_POLL
-#define ZMQ_SIGNALER_WAIT_BASED_ON_POLL
-#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
- defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
- defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
- defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
- defined ZMQ_HAVE_NETBSD
-#define ZMQ_SIGNALER_WAIT_BASED_ON_POLL
-#elif defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS ||\
- defined ZMQ_HAVE_CYGWIN
-#define ZMQ_SIGNALER_WAIT_BASED_ON_SELECT
+#if defined XS_FORCE_SELECT
+#define XS_SIGNALER_WAIT_BASED_ON_SELECT
+#elif defined XS_FORCE_POLL
+#define XS_SIGNALER_WAIT_BASED_ON_POLL
+#elif defined XS_HAVE_LINUX || defined XS_HAVE_FREEBSD ||\
+ defined XS_HAVE_OPENBSD || defined XS_HAVE_SOLARIS ||\
+ defined XS_HAVE_OSX || defined XS_HAVE_QNXNTO ||\
+ defined XS_HAVE_HPUX || defined XS_HAVE_AIX ||\
+ defined XS_HAVE_NETBSD
+#define XS_SIGNALER_WAIT_BASED_ON_POLL
+#elif defined XS_HAVE_WINDOWS || defined XS_HAVE_OPENVMS ||\
+ defined XS_HAVE_CYGWIN
+#define XS_SIGNALER_WAIT_BASED_ON_SELECT
#endif
-// On AIX, poll.h has to be included before zmq.h to get consistent
+// On AIX, poll.h has to be included before xs.h to get consistent
// definition of pollfd structure (AIX uses 'reqevents' and 'retnevents'
// instead of 'events' and 'revents' and defines macros to map from POSIX-y
// names to AIX-specific names).
-#if defined ZMQ_SIGNALER_WAIT_BASED_ON_POLL
+#if defined XS_SIGNALER_WAIT_BASED_ON_POLL
#include <poll.h>
-#elif defined ZMQ_SIGNALER_WAIT_BASED_ON_SELECT
-#if defined ZMQ_HAVE_WINDOWS
+#elif defined XS_SIGNALER_WAIT_BASED_ON_SELECT
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
-#elif defined ZMQ_HAVE_HPUX
+#elif defined XS_HAVE_HPUX
#include <sys/param.h>
#include <sys/types.h>
#include <sys/time.h>
-#elif defined ZMQ_HAVE_OPENVMS
+#elif defined XS_HAVE_OPENVMS
#include <sys/types.h>
#include <sys/time.h>
#else
@@ -64,11 +64,11 @@
#include "fd.hpp"
#include "ip.hpp"
-#if defined ZMQ_HAVE_EVENTFD
+#if defined XS_HAVE_EVENTFD
#include <sys/eventfd.h>
#endif
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <unistd.h>
@@ -78,7 +78,7 @@
#include <sys/socket.h>
#endif
-zmq::signaler_t::signaler_t ()
+xs::signaler_t::signaler_t ()
{
// Create the socketpair for signaling.
int rc = make_fdpair (&r, &w);
@@ -89,12 +89,12 @@ zmq::signaler_t::signaler_t ()
unblock_socket (r);
}
-zmq::signaler_t::~signaler_t ()
+xs::signaler_t::~signaler_t ()
{
-#if defined ZMQ_HAVE_EVENTFD
+#if defined XS_HAVE_EVENTFD
int rc = close (r);
errno_assert (rc == 0);
-#elif defined ZMQ_HAVE_WINDOWS
+#elif defined XS_HAVE_WINDOWS
int rc = closesocket (w);
wsa_assert (rc != SOCKET_ERROR);
rc = closesocket (r);
@@ -107,55 +107,55 @@ zmq::signaler_t::~signaler_t ()
#endif
}
-zmq::fd_t zmq::signaler_t::get_fd ()
+xs::fd_t xs::signaler_t::get_fd ()
{
return r;
}
-void zmq::signaler_t::send ()
+void xs::signaler_t::send ()
{
-#if defined ZMQ_HAVE_EVENTFD
+#if defined XS_HAVE_EVENTFD
const uint64_t inc = 1;
ssize_t sz = write (w, &inc, sizeof (inc));
errno_assert (sz == sizeof (inc));
-#elif defined ZMQ_HAVE_WINDOWS
+#elif defined XS_HAVE_WINDOWS
unsigned char dummy = 0;
int nbytes = ::send (w, (char*) &dummy, sizeof (dummy), 0);
wsa_assert (nbytes != SOCKET_ERROR);
- zmq_assert (nbytes == sizeof (dummy));
+ xs_assert (nbytes == sizeof (dummy));
#else
unsigned char dummy = 0;
while (true) {
ssize_t nbytes = ::send (w, &dummy, sizeof (dummy), 0);
if (unlikely (nbytes == -1 && errno == EINTR))
continue;
- zmq_assert (nbytes == sizeof (dummy));
+ xs_assert (nbytes == sizeof (dummy));
break;
}
#endif
}
-int zmq::signaler_t::wait (int timeout_)
+int xs::signaler_t::wait (int timeout_)
{
-#ifdef ZMQ_SIGNALER_WAIT_BASED_ON_POLL
+#ifdef XS_SIGNALER_WAIT_BASED_ON_POLL
struct pollfd pfd;
pfd.fd = r;
pfd.events = POLLIN;
int rc = poll (&pfd, 1, timeout_);
if (unlikely (rc < 0)) {
- zmq_assert (errno == EINTR);
+ xs_assert (errno == EINTR);
return -1;
}
else if (unlikely (rc == 0)) {
errno = EAGAIN;
return -1;
}
- zmq_assert (rc == 1);
- zmq_assert (pfd.revents & POLLIN);
+ xs_assert (rc == 1);
+ xs_assert (pfd.revents & POLLIN);
return 0;
-#elif defined ZMQ_SIGNALER_WAIT_BASED_ON_SELECT
+#elif defined XS_SIGNALER_WAIT_BASED_ON_SELECT
fd_set fds;
FD_ZERO (&fds);
@@ -165,7 +165,7 @@ int zmq::signaler_t::wait (int timeout_)
timeout.tv_sec = timeout_ / 1000;
timeout.tv_usec = timeout_ % 1000 * 1000;
}
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
int rc = select (0, &fds, NULL, NULL,
timeout_ >= 0 ? &timeout : NULL);
wsa_assert (rc != SOCKET_ERROR);
@@ -173,7 +173,7 @@ int zmq::signaler_t::wait (int timeout_)
int rc = select (r + 1, &fds, NULL, NULL,
timeout_ >= 0 ? &timeout : NULL);
if (unlikely (rc < 0)) {
- zmq_assert (errno == EINTR);
+ xs_assert (errno == EINTR);
return -1;
}
#endif
@@ -181,7 +181,7 @@ int zmq::signaler_t::wait (int timeout_)
errno = EAGAIN;
return -1;
}
- zmq_assert (rc == 1);
+ xs_assert (rc == 1);
return 0;
#else
@@ -189,10 +189,10 @@ int zmq::signaler_t::wait (int timeout_)
#endif
}
-void zmq::signaler_t::recv ()
+void xs::signaler_t::recv ()
{
// Attempt to read a signal.
-#if defined ZMQ_HAVE_EVENTFD
+#if defined XS_HAVE_EVENTFD
uint64_t dummy;
ssize_t sz = read (r, &dummy, sizeof (dummy));
errno_assert (sz == sizeof (dummy));
@@ -206,24 +206,24 @@ void zmq::signaler_t::recv ()
return;
}
- zmq_assert (dummy == 1);
+ xs_assert (dummy == 1);
#else
unsigned char dummy;
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
int nbytes = ::recv (r, (char*) &dummy, sizeof (dummy), 0);
wsa_assert (nbytes != SOCKET_ERROR);
#else
ssize_t nbytes = ::recv (r, &dummy, sizeof (dummy), 0);
errno_assert (nbytes >= 0);
#endif
- zmq_assert (nbytes == sizeof (dummy));
- zmq_assert (dummy == 0);
+ xs_assert (nbytes == sizeof (dummy));
+ xs_assert (dummy == 0);
#endif
}
-int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
+int xs::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
{
-#if defined ZMQ_HAVE_EVENTFD
+#if defined XS_HAVE_EVENTFD
// Create eventfd object.
fd_t fd = eventfd (0, 0);
@@ -232,18 +232,18 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
*r_ = fd;
return 0;
-#elif defined ZMQ_HAVE_WINDOWS
+#elif defined XS_HAVE_WINDOWS
// This function has to be in a system-wide critical section so that
// two instances of the library don't accidentally create signaler
// crossing the process boundary.
// We'll use named event object to implement the critical section.
- HANDLE sync = CreateEvent (NULL, FALSE, TRUE, "zmq-signaler-port-sync");
+ HANDLE sync = CreateEvent (NULL, FALSE, TRUE, "xs-signaler-port-sync");
win_assert (sync != NULL);
// Enter the critical section.
DWORD dwrc = WaitForSingleObject (sync, INFINITE);
- zmq_assert (dwrc == WAIT_OBJECT_0);
+ xs_assert (dwrc == WAIT_OBJECT_0);
// Windows has no 'socketpair' function. CreatePipe is no good as pipe
// handles cannot be polled on. Here we create the socketpair by hand.
@@ -305,7 +305,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
return 0;
-#elif defined ZMQ_HAVE_OPENVMS
+#elif defined XS_HAVE_OPENVMS
// Whilst OpenVMS supports socketpair - it maps to AF_INET only. Further,
// it does not set the socket options TCP_NODELAY and TCP_NODELACK which
@@ -371,10 +371,10 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
#endif
}
-#if defined ZMQ_SIGNALER_WAIT_BASED_ON_SELECT
-#undef ZMQ_SIGNALER_WAIT_BASED_ON_SELECT
+#if defined XS_SIGNALER_WAIT_BASED_ON_SELECT
+#undef XS_SIGNALER_WAIT_BASED_ON_SELECT
#endif
-#if defined ZMQ_SIGNALER_WAIT_BASED_ON_POLL
-#undef ZMQ_SIGNALER_WAIT_BASED_ON_POLL
+#if defined XS_SIGNALER_WAIT_BASED_ON_POLL
+#undef XS_SIGNALER_WAIT_BASED_ON_POLL
#endif
diff --git a/src/signaler.hpp b/src/signaler.hpp
index 4466c98..5cee6fd 100644
--- a/src/signaler.hpp
+++ b/src/signaler.hpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,12 +18,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_SIGNALER_HPP_INCLUDED__
-#define __ZMQ_SIGNALER_HPP_INCLUDED__
+#ifndef __XS_SIGNALER_HPP_INCLUDED__
+#define __XS_SIGNALER_HPP_INCLUDED__
#include "fd.hpp"
-namespace zmq
+namespace xs
{
// This is a cross-platform equivalent to signal_fd. However, as opposed
diff --git a/src/socket_base.cpp b/src/socket_base.cpp
index 49c6e0a..e932990 100644
--- a/src/socket_base.cpp
+++ b/src/socket_base.cpp
@@ -4,14 +4,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -26,7 +26,7 @@
#include "platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#if defined _MSC_VER
#include <intrin.h>
@@ -62,48 +62,48 @@
#include "xpub.hpp"
#include "xsub.hpp"
-bool zmq::socket_base_t::check_tag ()
+bool xs::socket_base_t::check_tag ()
{
return tag == 0xbaddecaf;
}
-zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_,
+xs::socket_base_t *xs::socket_base_t::create (int type_, class ctx_t *parent_,
uint32_t tid_, int sid_)
{
socket_base_t *s = NULL;
switch (type_) {
- case ZMQ_PAIR:
+ case XS_PAIR:
s = new (std::nothrow) pair_t (parent_, tid_, sid_);
break;
- case ZMQ_PUB:
+ case XS_PUB:
s = new (std::nothrow) pub_t (parent_, tid_, sid_);
break;
- case ZMQ_SUB:
+ case XS_SUB:
s = new (std::nothrow) sub_t (parent_, tid_, sid_);
break;
- case ZMQ_REQ:
+ case XS_REQ:
s = new (std::nothrow) req_t (parent_, tid_, sid_);
break;
- case ZMQ_REP:
+ case XS_REP:
s = new (std::nothrow) rep_t (parent_, tid_, sid_);
break;
- case ZMQ_XREQ:
+ case XS_XREQ:
s = new (std::nothrow) xreq_t (parent_, tid_, sid_);
break;
- case ZMQ_XREP:
+ case XS_XREP:
s = new (std::nothrow) xrep_t (parent_, tid_, sid_);
break;
- case ZMQ_PULL:
+ case XS_PULL:
s = new (std::nothrow) pull_t (parent_, tid_, sid_);
break;
- case ZMQ_PUSH:
+ case XS_PUSH:
s = new (std::nothrow) push_t (parent_, tid_, sid_);
break;
- case ZMQ_XPUB:
+ case XS_XPUB:
s = new (std::nothrow) xpub_t (parent_, tid_, sid_);
break;
- case ZMQ_XSUB:
+ case XS_XSUB:
s = new (std::nothrow) xsub_t (parent_, tid_, sid_);
break;
default:
@@ -114,7 +114,7 @@ zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_,
return s;
}
-zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_) :
own_t (parent_, tid_),
tag (0xbaddecaf),
ctx_terminated (false),
@@ -126,32 +126,32 @@ zmq::socket_base_t::socket_base_t (ctx_t *parent_, uint32_t tid_, int sid_) :
options.socket_id = sid_;
}
-zmq::socket_base_t::~socket_base_t ()
+xs::socket_base_t::~socket_base_t ()
{
- zmq_assert (destroyed);
+ xs_assert (destroyed);
// Mark the socket as dead.
tag = 0xdeadbeef;
}
-zmq::mailbox_t *zmq::socket_base_t::get_mailbox ()
+xs::mailbox_t *xs::socket_base_t::get_mailbox ()
{
return &mailbox;
}
-void zmq::socket_base_t::stop ()
+void xs::socket_base_t::stop ()
{
- // Called by ctx when it is terminated (zmq_term).
- // 'stop' command is sent from the threads that called zmq_term to
+ // Called by ctx when it is terminated (xs_term).
+ // 'stop' command is sent from the threads that called xs_term to
// the thread owning the socket. This way, blocking call in the
// owner thread can be interrupted.
send_stop ();
}
-int zmq::socket_base_t::parse_uri (const char *uri_,
+int xs::socket_base_t::parse_uri (const char *uri_,
std::string &protocol_, std::string &address_)
{
- zmq_assert (uri_ != NULL);
+ xs_assert (uri_ != NULL);
std::string uri (uri_);
std::string::size_type pos = uri.find ("://");
@@ -168,7 +168,7 @@ int zmq::socket_base_t::parse_uri (const char *uri_,
return 0;
}
-int zmq::socket_base_t::check_protocol (const std::string &protocol_)
+int xs::socket_base_t::check_protocol (const std::string &protocol_)
{
// First check out whether the protcol is something we are aware of.
if (protocol_ != "inproc" && protocol_ != "ipc" && protocol_ != "tcp" &&
@@ -177,9 +177,9 @@ int zmq::socket_base_t::check_protocol (const std::string &protocol_)
return -1;
}
- // If 0MQ is not compiled with OpenPGM, pgm and epgm transports
+ // If Crossroads is not compiled with OpenPGM, pgm and epgm transports
// are not avaialble.
-#if !defined ZMQ_HAVE_OPENPGM
+#if !defined XS_HAVE_OPENPGM
if (protocol_ == "pgm" || protocol_ == "epgm") {
errno = EPROTONOSUPPORT;
return -1;
@@ -187,7 +187,7 @@ int zmq::socket_base_t::check_protocol (const std::string &protocol_)
#endif
// IPC transport is not available on Windows and OpenVMS.
-#if defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS
+#if defined XS_HAVE_WINDOWS || defined XS_HAVE_OPENVMS
if (protocol_ == "ipc") {
// Unknown protocol.
errno = EPROTONOSUPPORT;
@@ -199,8 +199,8 @@ int zmq::socket_base_t::check_protocol (const std::string &protocol_)
// Specifically, multicast protocols can't be combined with
// bi-directional messaging patterns (socket types).
if ((protocol_ == "pgm" || protocol_ == "epgm") &&
- options.type != ZMQ_PUB && options.type != ZMQ_SUB &&
- options.type != ZMQ_XPUB && options.type != ZMQ_XSUB) {
+ options.type != XS_PUB && options.type != XS_SUB &&
+ options.type != XS_XPUB && options.type != XS_XSUB) {
errno = ENOCOMPATPROTO;
return -1;
}
@@ -209,7 +209,7 @@ int zmq::socket_base_t::check_protocol (const std::string &protocol_)
return 0;
}
-void zmq::socket_base_t::attach_pipe (pipe_t *pipe_)
+void xs::socket_base_t::attach_pipe (pipe_t *pipe_)
{
// First, register the pipe so that we can terminate it later on.
pipe_->set_event_sink (this);
@@ -226,7 +226,7 @@ void zmq::socket_base_t::attach_pipe (pipe_t *pipe_)
}
}
-int zmq::socket_base_t::setsockopt (int option_, const void *optval_,
+int xs::socket_base_t::setsockopt (int option_, const void *optval_,
size_t optvallen_)
{
if (unlikely (ctx_terminated)) {
@@ -244,7 +244,7 @@ int zmq::socket_base_t::setsockopt (int option_, const void *optval_,
return options.setsockopt (option_, optval_, optvallen_);
}
-int zmq::socket_base_t::getsockopt (int option_, void *optval_,
+int xs::socket_base_t::getsockopt (int option_, void *optval_,
size_t *optvallen_)
{
if (unlikely (ctx_terminated)) {
@@ -252,7 +252,7 @@ int zmq::socket_base_t::getsockopt (int option_, void *optval_,
return -1;
}
- if (option_ == ZMQ_RCVMORE) {
+ if (option_ == XS_RCVMORE) {
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -262,7 +262,7 @@ int zmq::socket_base_t::getsockopt (int option_, void *optval_,
return 0;
}
- if (option_ == ZMQ_FD) {
+ if (option_ == XS_FD) {
if (*optvallen_ < sizeof (fd_t)) {
errno = EINVAL;
return -1;
@@ -272,7 +272,7 @@ int zmq::socket_base_t::getsockopt (int option_, void *optval_,
return 0;
}
- if (option_ == ZMQ_EVENTS) {
+ if (option_ == XS_EVENTS) {
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
@@ -283,9 +283,9 @@ int zmq::socket_base_t::getsockopt (int option_, void *optval_,
errno_assert (rc == 0);
*((int*) optval_) = 0;
if (has_out ())
- *((int*) optval_) |= ZMQ_POLLOUT;
+ *((int*) optval_) |= XS_POLLOUT;
if (has_in ())
- *((int*) optval_) |= ZMQ_POLLIN;
+ *((int*) optval_) |= XS_POLLIN;
*optvallen_ = sizeof (int);
return 0;
}
@@ -293,7 +293,7 @@ int zmq::socket_base_t::getsockopt (int option_, void *optval_,
return options.getsockopt (option_, optval_, optvallen_);
}
-int zmq::socket_base_t::bind (const char *addr_)
+int xs::socket_base_t::bind (const char *addr_)
{
if (unlikely (ctx_terminated)) {
errno = ETERM;
@@ -344,7 +344,7 @@ int zmq::socket_base_t::bind (const char *addr_)
return 0;
}
-#if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS
+#if !defined XS_HAVE_WINDOWS && !defined XS_HAVE_OPENVMS
if (protocol == "ipc") {
ipc_listener_t *listener = new (std::nothrow) ipc_listener_t (
io_thread, this, options);
@@ -359,11 +359,11 @@ int zmq::socket_base_t::bind (const char *addr_)
}
#endif
- zmq_assert (false);
+ xs_assert (false);
return -1;
}
-int zmq::socket_base_t::connect (const char *addr_)
+int xs::socket_base_t::connect (const char *addr_)
{
if (unlikely (ctx_terminated)) {
errno = ETERM;
@@ -420,11 +420,11 @@ int zmq::socket_base_t::connect (const char *addr_)
if (options.send_identity) {
msg_t id;
rc = id.init_size (options.identity_size);
- zmq_assert (rc == 0);
+ xs_assert (rc == 0);
memcpy (id.data (), options.identity, options.identity_size);
id.set_flags (msg_t::identity);
bool written = pipes [0]->write (&id);
- zmq_assert (written);
+ xs_assert (written);
}
// Attach remote end of the pipe to the peer socket. Note that peer's
@@ -467,7 +467,7 @@ int zmq::socket_base_t::connect (const char *addr_)
return 0;
}
-int zmq::socket_base_t::send (msg_t *msg_, int flags_)
+int xs::socket_base_t::send (msg_t *msg_, int flags_)
{
// Check whether the library haven't been shut down yet.
if (unlikely (ctx_terminated)) {
@@ -490,7 +490,7 @@ int zmq::socket_base_t::send (msg_t *msg_, int flags_)
msg_->reset_flags (msg_t::more);
// At this point we impose the flags on the message.
- if (flags_ & ZMQ_SNDMORE)
+ if (flags_ & XS_SNDMORE)
msg_->set_flags (msg_t::more);
// Try to send the message.
@@ -502,7 +502,7 @@ int zmq::socket_base_t::send (msg_t *msg_, int flags_)
// In case of non-blocking send we'll simply propagate
// the error - including EAGAIN - up the stack.
- if (flags_ & ZMQ_DONTWAIT || options.sndtimeo == 0)
+ if (flags_ & XS_DONTWAIT || options.sndtimeo == 0)
return -1;
// Compute the time when the timeout should occur.
@@ -533,7 +533,7 @@ int zmq::socket_base_t::send (msg_t *msg_, int flags_)
return 0;
}
-int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
+int xs::socket_base_t::recv (msg_t *msg_, int flags_)
{
// Check whether the library haven't been shut down yet.
if (unlikely (ctx_terminated)) {
@@ -576,7 +576,7 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
// For non-blocking recv, commands are processed in case there's an
// activate_reader command already waiting int a command pipe.
// If it's not, return EAGAIN.
- if (flags_ & ZMQ_DONTWAIT || options.rcvtimeo == 0) {
+ if (flags_ & XS_DONTWAIT || options.rcvtimeo == 0) {
if (unlikely (process_commands (0, false) != 0))
return -1;
ticks = 0;
@@ -621,7 +621,7 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
return 0;
}
-int zmq::socket_base_t::close ()
+int xs::socket_base_t::close ()
{
// Transfer the ownership of the socket from this application thread
// to the reaper thread which will take care of the rest of shutdown
@@ -631,17 +631,17 @@ int zmq::socket_base_t::close ()
return 0;
}
-bool zmq::socket_base_t::has_in ()
+bool xs::socket_base_t::has_in ()
{
return xhas_in ();
}
-bool zmq::socket_base_t::has_out ()
+bool xs::socket_base_t::has_out ()
{
return xhas_out ();
}
-void zmq::socket_base_t::start_reaping (poller_t *poller_)
+void xs::socket_base_t::start_reaping (poller_t *poller_)
{
// Plug the socket to the reaper thread.
poller = poller_;
@@ -654,7 +654,7 @@ void zmq::socket_base_t::start_reaping (poller_t *poller_)
check_destroy ();
}
-int zmq::socket_base_t::process_commands (int timeout_, bool throttle_)
+int xs::socket_base_t::process_commands (int timeout_, bool throttle_)
{
int rc;
command_t cmd;
@@ -669,7 +669,7 @@ int zmq::socket_base_t::process_commands (int timeout_, bool throttle_)
// commands recently, so that we can throttle the new commands.
// Get the CPU's tick counter. If 0, the counter is not available.
- uint64_t tsc = zmq::clock_t::rdtsc ();
+ uint64_t tsc = xs::clock_t::rdtsc ();
// Optimised version of command processing - it doesn't have to check
// for incoming commands each time. It does so only if certain time
@@ -710,25 +710,25 @@ int zmq::socket_base_t::process_commands (int timeout_, bool throttle_)
return 0;
}
-void zmq::socket_base_t::process_stop ()
+void xs::socket_base_t::process_stop ()
{
- // Here, someone have called zmq_term while the socket was still alive.
+ // Here, someone have called xs_term while the socket was still alive.
// We'll remember the fact so that any blocking call is interrupted and any
// further attempt to use the socket will return ETERM. The user is still
- // responsible for calling zmq_close on the socket though!
+ // responsible for calling xs_close on the socket though!
ctx_terminated = true;
}
-void zmq::socket_base_t::process_bind (pipe_t *pipe_)
+void xs::socket_base_t::process_bind (pipe_t *pipe_)
{
attach_pipe (pipe_);
}
-void zmq::socket_base_t::process_unplug ()
+void xs::socket_base_t::process_unplug ()
{
}
-void zmq::socket_base_t::process_term (int linger_)
+void xs::socket_base_t::process_term (int linger_)
{
// Unregister all inproc endpoints associated with this socket.
// Doing this we make sure that no new pipes from other sockets (inproc)
@@ -744,55 +744,55 @@ void zmq::socket_base_t::process_term (int linger_)
own_t::process_term (linger_);
}
-void zmq::socket_base_t::process_destroy ()
+void xs::socket_base_t::process_destroy ()
{
destroyed = true;
}
-int zmq::socket_base_t::xsetsockopt (int option_, const void *optval_,
+int xs::socket_base_t::xsetsockopt (int option_, const void *optval_,
size_t optvallen_)
{
errno = EINVAL;
return -1;
}
-bool zmq::socket_base_t::xhas_out ()
+bool xs::socket_base_t::xhas_out ()
{
return false;
}
-int zmq::socket_base_t::xsend (msg_t *msg_, int flags_)
+int xs::socket_base_t::xsend (msg_t *msg_, int flags_)
{
errno = ENOTSUP;
return -1;
}
-bool zmq::socket_base_t::xhas_in ()
+bool xs::socket_base_t::xhas_in ()
{
return false;
}
-int zmq::socket_base_t::xrecv (msg_t *msg_, int flags_)
+int xs::socket_base_t::xrecv (msg_t *msg_, int flags_)
{
errno = ENOTSUP;
return -1;
}
-void zmq::socket_base_t::xread_activated (pipe_t *pipe_)
+void xs::socket_base_t::xread_activated (pipe_t *pipe_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::socket_base_t::xwrite_activated (pipe_t *pipe_)
+void xs::socket_base_t::xwrite_activated (pipe_t *pipe_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::socket_base_t::xhiccuped (pipe_t *pipe_)
+void xs::socket_base_t::xhiccuped (pipe_t *pipe_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::socket_base_t::in_event ()
+void xs::socket_base_t::in_event ()
{
// This function is invoked only once the socket is running in the context
// of the reaper thread. Process any commands from other threads/sockets
@@ -802,17 +802,17 @@ void zmq::socket_base_t::in_event ()
check_destroy ();
}
-void zmq::socket_base_t::out_event ()
+void xs::socket_base_t::out_event ()
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::socket_base_t::timer_event (int id_)
+void xs::socket_base_t::timer_event (int id_)
{
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::socket_base_t::check_destroy ()
+void xs::socket_base_t::check_destroy ()
{
// If the object was already marked as destroyed, finish the deallocation.
if (destroyed) {
@@ -831,22 +831,22 @@ void zmq::socket_base_t::check_destroy ()
}
}
-void zmq::socket_base_t::read_activated (pipe_t *pipe_)
+void xs::socket_base_t::read_activated (pipe_t *pipe_)
{
xread_activated (pipe_);
}
-void zmq::socket_base_t::write_activated (pipe_t *pipe_)
+void xs::socket_base_t::write_activated (pipe_t *pipe_)
{
xwrite_activated (pipe_);
}
-void zmq::socket_base_t::hiccuped (pipe_t *pipe_)
+void xs::socket_base_t::hiccuped (pipe_t *pipe_)
{
xhiccuped (pipe_);
}
-void zmq::socket_base_t::terminated (pipe_t *pipe_)
+void xs::socket_base_t::terminated (pipe_t *pipe_)
{
// Notify the specific socket type about the pipe termination.
xterminated (pipe_);
@@ -858,11 +858,11 @@ void zmq::socket_base_t::terminated (pipe_t *pipe_)
unregister_term_ack ();
}
-void zmq::socket_base_t::extract_flags (msg_t *msg_)
+void xs::socket_base_t::extract_flags (msg_t *msg_)
{
// Test whether IDENTITY flag is valid for this socket type.
if (unlikely (msg_->flags () & msg_t::identity))
- zmq_assert (options.recv_identity);
+ xs_assert (options.recv_identity);
// Remove MORE flag.
rcvmore = msg_->flags () & msg_t::more ? true : false;
diff --git a/src/socket_base.hpp b/src/socket_base.hpp
index 144eb8d..bc405f6 100644
--- a/src/socket_base.hpp
+++ b/src/socket_base.hpp
@@ -4,14 +4,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,8 +20,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_SOCKET_BASE_HPP_INCLUDED__
-#define __ZMQ_SOCKET_BASE_HPP_INCLUDED__
+#ifndef __XS_SOCKET_BASE_HPP_INCLUDED__
+#define __XS_SOCKET_BASE_HPP_INCLUDED__
#include <string>
@@ -35,7 +35,7 @@
#include "stdint.hpp"
#include "pipe.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -56,7 +56,7 @@ namespace zmq
bool check_tag ();
// Create a socket of a specified type.
- static socket_base_t *create (int type_, zmq::ctx_t *parent_,
+ static socket_base_t *create (int type_, xs::ctx_t *parent_,
uint32_t tid_, int sid_);
// Returns the mailbox associated with this socket.
@@ -71,8 +71,8 @@ namespace zmq
int getsockopt (int option_, void *optval_, size_t *optvallen_);
int bind (const char *addr_);
int connect (const char *addr_);
- int send (zmq::msg_t *msg_, int flags_);
- int recv (zmq::msg_t *msg_, int flags_);
+ int send (xs::msg_t *msg_, int flags_);
+ int recv (xs::msg_t *msg_, int flags_);
int close ();
// These functions are used by the polling mechanism to determine
@@ -98,12 +98,12 @@ namespace zmq
protected:
- socket_base_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ socket_base_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
virtual ~socket_base_t ();
// Concrete algorithms for the x- methods are to be defined by
// individual socket types.
- virtual void xattach_pipe (zmq::pipe_t *pipe_) = 0;
+ virtual void xattach_pipe (xs::pipe_t *pipe_) = 0;
// The default implementation assumes there are no specific socket
// options for the particular socket type. If not so, overload this
@@ -113,11 +113,11 @@ namespace zmq
// The default implementation assumes that send is not supported.
virtual bool xhas_out ();
- virtual int xsend (zmq::msg_t *msg_, int flags_);
+ virtual int xsend (xs::msg_t *msg_, int flags_);
// The default implementation assumes that recv in not supported.
virtual bool xhas_in ();
- virtual int xrecv (zmq::msg_t *msg_, int flags_);
+ virtual int xrecv (xs::msg_t *msg_, int flags_);
// i_pipe_events will be forwarded to these functions.
virtual void xread_activated (pipe_t *pipe_);
@@ -158,7 +158,7 @@ namespace zmq
int check_protocol (const std::string &protocol_);
// Register the pipe with this socket.
- void attach_pipe (zmq::pipe_t *pipe_);
+ void attach_pipe (xs::pipe_t *pipe_);
// Processes commands sent to this socket (if any). If timeout is -1,
// returns only after at least one command was processed.
@@ -168,7 +168,7 @@ namespace zmq
// Handlers for incoming commands.
void process_stop ();
- void process_bind (zmq::pipe_t *pipe_);
+ void process_bind (xs::pipe_t *pipe_);
void process_unplug ();
void process_term (int linger_);
diff --git a/src/stdint.hpp b/src/stdint.hpp
index b78afcd..996098a 100644
--- a/src/stdint.hpp
+++ b/src/stdint.hpp
@@ -2,14 +2,14 @@
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,12 +18,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_STDINT_HPP_INCLUDED__
-#define __ZMQ_STDINT_HPP_INCLUDED__
+#ifndef __XS_STDINT_HPP_INCLUDED__
+#define __XS_STDINT_HPP_INCLUDED__
#include "platform.hpp"
-#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS
+#if defined XS_HAVE_SOLARIS || defined XS_HAVE_OPENVMS
#include <inttypes.h>
diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp
index ab6329a..0034737 100644
--- a/src/stream_engine.cpp
+++ b/src/stream_engine.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,7 +20,7 @@
*/
#include "platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <unistd.h>
@@ -42,7 +42,7 @@
#include "err.hpp"
#include "ip.hpp"
-zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_) :
+xs::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_) :
s (fd_),
inpos (NULL),
insize (0),
@@ -62,7 +62,7 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_) :
if (options.sndbuf) {
int rc = setsockopt (s, SOL_SOCKET, SO_SNDBUF,
(char*) &options.sndbuf, sizeof (int));
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
wsa_assert (rc != SOCKET_ERROR);
#else
errno_assert (rc == 0);
@@ -71,14 +71,14 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_) :
if (options.rcvbuf) {
int rc = setsockopt (s, SOL_SOCKET, SO_RCVBUF,
(char*) &options.rcvbuf, sizeof (int));
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
wsa_assert (rc != SOCKET_ERROR);
#else
errno_assert (rc == 0);
#endif
}
-#if defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_FREEBSD
+#if defined XS_HAVE_OSX || defined XS_HAVE_FREEBSD
// Make sure that SIGPIPE signal is not generated when writing to a
// connection that was already closed by the peer.
int set = 1;
@@ -87,12 +87,12 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_) :
#endif
}
-zmq::stream_engine_t::~stream_engine_t ()
+xs::stream_engine_t::~stream_engine_t ()
{
- zmq_assert (!plugged);
+ xs_assert (!plugged);
if (s != retired_fd) {
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
int rc = closesocket (s);
wsa_assert (rc != SOCKET_ERROR);
#else
@@ -103,16 +103,16 @@ zmq::stream_engine_t::~stream_engine_t ()
}
}
-void zmq::stream_engine_t::plug (io_thread_t *io_thread_,
+void xs::stream_engine_t::plug (io_thread_t *io_thread_,
session_base_t *session_)
{
- zmq_assert (!plugged);
+ xs_assert (!plugged);
plugged = true;
leftover_session = NULL;
// Connect to session object.
- zmq_assert (!session);
- zmq_assert (session_);
+ xs_assert (!session);
+ xs_assert (session_);
encoder.set_session (session_);
decoder.set_session (session_);
session = session_;
@@ -127,9 +127,9 @@ void zmq::stream_engine_t::plug (io_thread_t *io_thread_,
in_event ();
}
-void zmq::stream_engine_t::unplug ()
+void xs::stream_engine_t::unplug ()
{
- zmq_assert (plugged);
+ xs_assert (plugged);
plugged = false;
// Cancel all fd subscriptions.
@@ -145,13 +145,13 @@ void zmq::stream_engine_t::unplug ()
session = NULL;
}
-void zmq::stream_engine_t::terminate ()
+void xs::stream_engine_t::terminate ()
{
unplug ();
delete this;
}
-void zmq::stream_engine_t::in_event ()
+void xs::stream_engine_t::in_event ()
{
bool disconnection = false;
@@ -196,7 +196,7 @@ void zmq::stream_engine_t::in_event ()
// Flush all messages the decoder may have produced.
// If IO handler has unplugged engine, flush transient IO handler.
if (unlikely (!plugged)) {
- zmq_assert (leftover_session);
+ xs_assert (leftover_session);
leftover_session->flush ();
} else {
session->flush ();
@@ -206,7 +206,7 @@ void zmq::stream_engine_t::in_event ()
error ();
}
-void zmq::stream_engine_t::out_event ()
+void xs::stream_engine_t::out_event ()
{
// If write buffer is empty, try to read new data from the encoder.
if (!outsize) {
@@ -216,7 +216,7 @@ void zmq::stream_engine_t::out_event ()
// If IO handler has unplugged engine, flush transient IO handler.
if (unlikely (!plugged)) {
- zmq_assert (leftover_session);
+ xs_assert (leftover_session);
leftover_session->flush ();
return;
}
@@ -245,7 +245,7 @@ void zmq::stream_engine_t::out_event ()
outsize -= nbytes;
}
-void zmq::stream_engine_t::activate_out ()
+void xs::stream_engine_t::activate_out ()
{
set_pollout (handle);
@@ -256,7 +256,7 @@ void zmq::stream_engine_t::activate_out ()
out_event ();
}
-void zmq::stream_engine_t::activate_in ()
+void xs::stream_engine_t::activate_in ()
{
set_pollin (handle);
@@ -264,17 +264,17 @@ void zmq::stream_engine_t::activate_in ()
in_event ();
}
-void zmq::stream_engine_t::error ()
+void xs::stream_engine_t::error ()
{
- zmq_assert (session);
+ xs_assert (session);
session->detach ();
unplug ();
delete this;
}
-int zmq::stream_engine_t::write (const void *data_, size_t size_)
+int xs::stream_engine_t::write (const void *data_, size_t size_)
{
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
int nbytes = send (s, (char*) data_, (int) size_, 0);
@@ -317,9 +317,9 @@ int zmq::stream_engine_t::write (const void *data_, size_t size_)
#endif
}
-int zmq::stream_engine_t::read (void *data_, size_t size_)
+int xs::stream_engine_t::read (void *data_, size_t size_)
{
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
int nbytes = recv (s, (char*) data_, (int) size_, 0);
diff --git a/src/stream_engine.hpp b/src/stream_engine.hpp
index 30b190b..472c07a 100644
--- a/src/stream_engine.hpp
+++ b/src/stream_engine.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_STREAM_ENGINE_HPP_INCLUDED__
-#define __ZMQ_STREAM_ENGINE_HPP_INCLUDED__
+#ifndef __XS_STREAM_ENGINE_HPP_INCLUDED__
+#define __XS_STREAM_ENGINE_HPP_INCLUDED__
#include <stddef.h>
@@ -31,7 +31,7 @@
#include "decoder.hpp"
#include "options.hpp"
-namespace zmq
+namespace xs
{
class io_thread_t;
@@ -48,8 +48,8 @@ namespace zmq
~stream_engine_t ();
// i_engine interface implementation.
- void plug (zmq::io_thread_t *io_thread_,
- zmq::session_base_t *session_);
+ void plug (xs::io_thread_t *io_thread_,
+ xs::session_base_t *session_);
void unplug ();
void terminate ();
void activate_in ();
@@ -89,10 +89,10 @@ namespace zmq
encoder_t encoder;
// The session this engine is attached to.
- zmq::session_base_t *session;
+ xs::session_base_t *session;
// Detached transient session.
- zmq::session_base_t *leftover_session;
+ xs::session_base_t *leftover_session;
options_t options;
diff --git a/src/sub.cpp b/src/sub.cpp
index ddd1321..ad55ea3 100644
--- a/src/sub.cpp
+++ b/src/sub.cpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,24 +22,24 @@
#include "sub.hpp"
#include "msg.hpp"
-zmq::sub_t::sub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::sub_t::sub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
xsub_t (parent_, tid_, sid_)
{
- options.type = ZMQ_SUB;
+ options.type = XS_SUB;
// Switch filtering messages on (as opposed to XSUB which where the
// filtering is off).
options.filter = true;
}
-zmq::sub_t::~sub_t ()
+xs::sub_t::~sub_t ()
{
}
-int zmq::sub_t::xsetsockopt (int option_, const void *optval_,
+int xs::sub_t::xsetsockopt (int option_, const void *optval_,
size_t optvallen_)
{
- if (option_ != ZMQ_SUBSCRIBE && option_ != ZMQ_UNSUBSCRIBE) {
+ if (option_ != XS_SUBSCRIBE && option_ != XS_UNSUBSCRIBE) {
errno = EINVAL;
return -1;
}
@@ -49,9 +49,9 @@ int zmq::sub_t::xsetsockopt (int option_, const void *optval_,
int rc = msg.init_size (optvallen_ + 1);
errno_assert (rc == 0);
unsigned char *data = (unsigned char*) msg.data ();
- if (option_ == ZMQ_SUBSCRIBE)
+ if (option_ == XS_SUBSCRIBE)
*data = 1;
- else if (option_ == ZMQ_UNSUBSCRIBE)
+ else if (option_ == XS_UNSUBSCRIBE)
*data = 0;
memcpy (data + 1, optval_, optvallen_);
@@ -67,20 +67,20 @@ int zmq::sub_t::xsetsockopt (int option_, const void *optval_,
return rc;
}
-int zmq::sub_t::xsend (msg_t *msg_, int flags_)
+int xs::sub_t::xsend (msg_t *msg_, int flags_)
{
// Overload the XSUB's send.
errno = ENOTSUP;
return -1;
}
-bool zmq::sub_t::xhas_out ()
+bool xs::sub_t::xhas_out ()
{
// Overload the XSUB's send.
return false;
}
-zmq::sub_session_t::sub_session_t (io_thread_t *io_thread_, bool connect_,
+xs::sub_session_t::sub_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
xsub_session_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -88,7 +88,7 @@ zmq::sub_session_t::sub_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::sub_session_t::~sub_session_t ()
+xs::sub_session_t::~sub_session_t ()
{
}
diff --git a/src/sub.hpp b/src/sub.hpp
index 272922f..70ade88 100644
--- a/src/sub.hpp
+++ b/src/sub.hpp
@@ -3,14 +3,14 @@
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,12 +19,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_SUB_HPP_INCLUDED__
-#define __ZMQ_SUB_HPP_INCLUDED__
+#ifndef __XS_SUB_HPP_INCLUDED__
+#define __XS_SUB_HPP_INCLUDED__
#include "xsub.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -36,13 +36,13 @@ namespace zmq
{
public:
- sub_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ sub_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~sub_t ();
protected:
int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
- int xsend (zmq::msg_t *msg_, int flags_);
+ int xsend (xs::msg_t *msg_, int flags_);
bool xhas_out ();
private:
@@ -55,8 +55,8 @@ namespace zmq
{
public:
- sub_session_t (zmq::io_thread_t *io_thread_, bool connect_,
- zmq::socket_base_t *socket_, const options_t &options_,
+ sub_session_t (xs::io_thread_t *io_thread_, bool connect_,
+ xs::socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~sub_session_t ();
diff --git a/src/tcp_address.cpp b/src/tcp_address.cpp
index de6e0ad..3b6ed94 100644
--- a/src/tcp_address.cpp
+++ b/src/tcp_address.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -28,7 +28,7 @@
#include "err.hpp"
#include "ip.hpp"
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <sys/types.h>
@@ -44,7 +44,7 @@
#define AI_ADDRCONFIG 0
#endif
-#if defined ZMQ_HAVE_SOLARIS
+#if defined XS_HAVE_SOLARIS
#include <sys/sockio.h>
#include <net/if.h>
@@ -52,21 +52,21 @@
#include <stdlib.h>
// On Solaris platform, network interface name can be queried by ioctl.
-int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
+int xs::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
{
// TODO: Unused parameter, IPv6 support not implemented for Solaris.
(void) ipv4only_;
// Create a socket.
int fd = open_socket (AF_INET, SOCK_DGRAM, 0);
- zmq_assert (fd != -1);
+ xs_assert (fd != -1);
// Retrieve number of interfaces.
lifnum ifn;
ifn.lifn_family = AF_INET;
ifn.lifn_flags = 0;
int rc = ioctl (fd, SIOCGLIFNUM, (char*) &ifn);
- zmq_assert (rc != -1);
+ xs_assert (rc != -1);
// Allocate memory to get interface names.
size_t ifr_size = sizeof (struct lifreq) * ifn.lifn_count;
@@ -80,7 +80,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
ifc.lifc_len = ifr_size;
ifc.lifc_buf = ifr;
rc = ioctl (fd, SIOCGLIFCONF, (char*) &ifc);
- zmq_assert (rc != -1);
+ xs_assert (rc != -1);
// Find the interface with the specified name and AF_INET family.
bool found = false;
@@ -89,7 +89,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
n ++, ifrp ++) {
if (!strcmp (nic_, ifrp->lifr_name)) {
rc = ioctl (fd, SIOCGLIFADDR, (char*) ifrp);
- zmq_assert (rc != -1);
+ xs_assert (rc != -1);
if (ifrp->lifr_addr.ss_family == AF_INET) {
address.ipv4 = *(sockaddr_in*) &ifrp->lifr_addr;
found = true;
@@ -110,21 +110,21 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
return 0;
}
-#elif defined ZMQ_HAVE_AIX || defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_ANDROID
+#elif defined XS_HAVE_AIX || defined XS_HAVE_HPUX || defined XS_HAVE_ANDROID
#include <sys/types.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <net/if.h>
-int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
+int xs::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
{
// TODO: Unused parameter, IPv6 support not implemented for AIX or HP/UX.
(void) ipv4only_;
// Create a socket.
int sd = open_socket (AF_INET, SOCK_DGRAM, 0);
- zmq_assert (sd != -1);
+ xs_assert (sd != -1);
struct ifreq ifr;
@@ -148,22 +148,22 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
return 0;
}
-#elif ((defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
- defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD ||\
- defined ZMQ_HAVE_QNXNTO || defined ZMQ_HAVE_NETBSD)\
- && defined ZMQ_HAVE_IFADDRS)
+#elif ((defined XS_HAVE_LINUX || defined XS_HAVE_FREEBSD ||\
+ defined XS_HAVE_OSX || defined XS_HAVE_OPENBSD ||\
+ defined XS_HAVE_QNXNTO || defined XS_HAVE_NETBSD)\
+ && defined XS_HAVE_IFADDRS)
#include <ifaddrs.h>
// On these platforms, network interface name can be queried
// using getifaddrs function.
-int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
+int xs::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
{
// Get the addresses.
ifaddrs* ifa = NULL;
int rc = getifaddrs (&ifa);
- zmq_assert (rc == 0);
- zmq_assert (ifa != NULL);
+ xs_assert (rc == 0);
+ xs_assert (ifa != NULL);
// Find the corresponding network interface.
bool found = false;
@@ -201,7 +201,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
// On other platforms we assume there are no sane interface names.
// This is true especially of Windows.
-int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
+int xs::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
{
// All unused parameters.
(void) nic_;
@@ -213,7 +213,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
#endif
-int zmq::tcp_address_t::resolve_interface (char const *interface_,
+int xs::tcp_address_t::resolve_interface (char const *interface_,
bool ipv4only_)
{
// Initialize temporary output pointers with storage address.
@@ -241,7 +241,7 @@ int zmq::tcp_address_t::resolve_interface (char const *interface_,
// * resolves to INADDR_ANY or in6addr_any.
if (strcmp (interface_, "*") == 0) {
- zmq_assert (out_addrlen <= (socklen_t) sizeof (address));
+ xs_assert (out_addrlen <= (socklen_t) sizeof (address));
memcpy (&address, out_addr, out_addrlen);
return 0;
}
@@ -251,13 +251,13 @@ int zmq::tcp_address_t::resolve_interface (char const *interface_,
if (rc != 0 && errno != ENODEV)
return rc;
if (rc == 0) {
- zmq_assert (out_addrlen <= (socklen_t) sizeof (address));
+ xs_assert (out_addrlen <= (socklen_t) sizeof (address));
memcpy (&address, out_addr, out_addrlen);
return 0;
}
// There's no such interface name. Assume literal address.
-#if defined ZMQ_HAVE_OPENVMS && defined __ia64
+#if defined XS_HAVE_OPENVMS && defined __ia64
__addrinfo64 *res = NULL;
__addrinfo64 req;
#else
@@ -277,7 +277,7 @@ int zmq::tcp_address_t::resolve_interface (char const *interface_,
// service-name irregularity due to indeterminate socktype.
req.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
-#ifndef ZMQ_HAVE_WINDOWS
+#ifndef XS_HAVE_WINDOWS
// Windows by default maps IPv4 addresses into IPv6. In this API we only
// require IPv4-mapped addresses when no native IPv6 interfaces are
// available (~AI_ALL). This saves an additional DNS roundtrip for IPv4
@@ -295,7 +295,7 @@ int zmq::tcp_address_t::resolve_interface (char const *interface_,
}
// Use the first result.
- zmq_assert ((size_t) (res->ai_addrlen) <= sizeof (address));
+ xs_assert ((size_t) (res->ai_addrlen) <= sizeof (address));
memcpy (&address, res->ai_addr, res->ai_addrlen);
// Cleanup getaddrinfo after copying the possibly referenced result.
@@ -305,10 +305,10 @@ int zmq::tcp_address_t::resolve_interface (char const *interface_,
return 0;
}
-int zmq::tcp_address_t::resolve_hostname (const char *hostname_, bool ipv4only_)
+int xs::tcp_address_t::resolve_hostname (const char *hostname_, bool ipv4only_)
{
// Set up the query.
-#if defined ZMQ_HAVE_OPENVMS && defined __ia64 && __INITIAL_POINTER_SIZE == 64
+#if defined XS_HAVE_OPENVMS && defined __ia64 && __INITIAL_POINTER_SIZE == 64
__addrinfo64 req;
#else
addrinfo req;
@@ -323,7 +323,7 @@ int zmq::tcp_address_t::resolve_hostname (const char *hostname_, bool ipv4only_)
// doesn't really matter, since it's not included in the addr-output.
req.ai_socktype = SOCK_STREAM;
-#ifndef ZMQ_HAVE_WINDOWS
+#ifndef XS_HAVE_WINDOWS
// Windows by default maps IPv4 addresses into IPv6. In this API we only
// require IPv4-mapped addresses when no native IPv6 interfaces are
// available. This saves an additional DNS roundtrip for IPv4 addresses.
@@ -333,7 +333,7 @@ int zmq::tcp_address_t::resolve_hostname (const char *hostname_, bool ipv4only_)
// Resolve host name. Some of the error info is lost in case of error,
// however, there's no way to report EAI errors via errno.
-#if defined ZMQ_HAVE_OPENVMS && defined __ia64 && __INITIAL_POINTER_SIZE == 64
+#if defined XS_HAVE_OPENVMS && defined __ia64 && __INITIAL_POINTER_SIZE == 64
__addrinfo64 *res;
#else
addrinfo *res;
@@ -352,7 +352,7 @@ int zmq::tcp_address_t::resolve_hostname (const char *hostname_, bool ipv4only_)
}
// Copy first result to output addr with hostname and service.
- zmq_assert ((size_t) (res->ai_addrlen) <= sizeof (address));
+ xs_assert ((size_t) (res->ai_addrlen) <= sizeof (address));
memcpy (&address, res->ai_addr, res->ai_addrlen);
freeaddrinfo (res);
@@ -360,16 +360,16 @@ int zmq::tcp_address_t::resolve_hostname (const char *hostname_, bool ipv4only_)
return 0;
}
-zmq::tcp_address_t::tcp_address_t ()
+xs::tcp_address_t::tcp_address_t ()
{
memset (&address, 0, sizeof (address));
}
-zmq::tcp_address_t::~tcp_address_t ()
+xs::tcp_address_t::~tcp_address_t ()
{
}
-int zmq::tcp_address_t::resolve (const char *name_, bool local_, bool ipv4only_)
+int xs::tcp_address_t::resolve (const char *name_, bool local_, bool ipv4only_)
{
// Find the ':' at end that separates address from the port number.
const char *delimiter = strrchr (name_, ':');
@@ -412,12 +412,12 @@ int zmq::tcp_address_t::resolve (const char *name_, bool local_, bool ipv4only_)
return 0;
}
-sockaddr *zmq::tcp_address_t::addr ()
+sockaddr *xs::tcp_address_t::addr ()
{
return &address.generic;
}
-socklen_t zmq::tcp_address_t::addrlen ()
+socklen_t xs::tcp_address_t::addrlen ()
{
if (address.generic.sa_family == AF_INET6)
return (socklen_t) sizeof (address.ipv6);
@@ -425,10 +425,10 @@ socklen_t zmq::tcp_address_t::addrlen ()
return (socklen_t) sizeof (address.ipv4);
}
-#if defined ZMQ_HAVE_WINDOWS
-unsigned short zmq::tcp_address_t::family ()
+#if defined XS_HAVE_WINDOWS
+unsigned short xs::tcp_address_t::family ()
#else
-sa_family_t zmq::tcp_address_t::family ()
+sa_family_t xs::tcp_address_t::family ()
#endif
{
return address.generic.sa_family;
diff --git a/src/tcp_address.hpp b/src/tcp_address.hpp
index d4768c7..683f30f 100644
--- a/src/tcp_address.hpp
+++ b/src/tcp_address.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,19 +19,19 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_TCP_ADDRESS_HPP_INCLUDED__
-#define __ZMQ_TCP_ADDRESS_HPP_INCLUDED__
+#ifndef __XS_TCP_ADDRESS_HPP_INCLUDED__
+#define __XS_TCP_ADDRESS_HPP_INCLUDED__
#include "platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <sys/socket.h>
#include <netinet/in.h>
#endif
-namespace zmq
+namespace xs
{
class tcp_address_t
@@ -47,7 +47,7 @@ namespace zmq
// If 'ipv4only' is true, the name will never resolve to IPv6 address.
int resolve (const char* name_, bool local_, bool ipv4only_);
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
unsigned short family ();
#else
sa_family_t family ();
diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp
index 042e82a..b89d0be 100644
--- a/src/tcp_connecter.cpp
+++ b/src/tcp_connecter.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -30,7 +30,7 @@
#include "err.hpp"
#include "ip.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <unistd.h>
@@ -41,12 +41,12 @@
#include <netinet/in.h>
#include <netdb.h>
#include <fcntl.h>
-#ifdef ZMQ_HAVE_OPENVMS
+#ifdef XS_HAVE_OPENVMS
#include <ioctl.h>
#endif
#endif
-zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_,
+xs::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_,
class session_base_t *session_, const options_t &options_,
const char *address_, bool wait_) :
own_t (io_thread_, options_),
@@ -63,7 +63,7 @@ zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_,
errno_assert (rc == 0);
}
-zmq::tcp_connecter_t::~tcp_connecter_t ()
+xs::tcp_connecter_t::~tcp_connecter_t ()
{
if (wait)
cancel_timer (reconnect_timer_id);
@@ -74,7 +74,7 @@ zmq::tcp_connecter_t::~tcp_connecter_t ()
close ();
}
-void zmq::tcp_connecter_t::process_plug ()
+void xs::tcp_connecter_t::process_plug ()
{
if (wait)
add_reconnect_timer();
@@ -82,7 +82,7 @@ void zmq::tcp_connecter_t::process_plug ()
start_connecting ();
}
-void zmq::tcp_connecter_t::in_event ()
+void xs::tcp_connecter_t::in_event ()
{
// We are not polling for incomming data, so we are actually called
// because of error here. However, we can get error on out event as well
@@ -90,7 +90,7 @@ void zmq::tcp_connecter_t::in_event ()
out_event ();
}
-void zmq::tcp_connecter_t::out_event ()
+void xs::tcp_connecter_t::out_event ()
{
fd_t fd = connect ();
rm_fd (handle);
@@ -117,14 +117,14 @@ void zmq::tcp_connecter_t::out_event ()
terminate ();
}
-void zmq::tcp_connecter_t::timer_event (int id_)
+void xs::tcp_connecter_t::timer_event (int id_)
{
- zmq_assert (id_ == reconnect_timer_id);
+ xs_assert (id_ == reconnect_timer_id);
wait = false;
start_connecting ();
}
-void zmq::tcp_connecter_t::start_connecting ()
+void xs::tcp_connecter_t::start_connecting ()
{
// Open the connecting socket.
int rc = open ();
@@ -151,12 +151,12 @@ void zmq::tcp_connecter_t::start_connecting ()
add_reconnect_timer();
}
-void zmq::tcp_connecter_t::add_reconnect_timer()
+void xs::tcp_connecter_t::add_reconnect_timer()
{
add_timer (get_new_reconnect_ivl(), reconnect_timer_id);
}
-int zmq::tcp_connecter_t::get_new_reconnect_ivl ()
+int xs::tcp_connecter_t::get_new_reconnect_ivl ()
{
// The new interval is the current interval + random value.
int this_interval = current_reconnect_ivl +
@@ -176,18 +176,18 @@ int zmq::tcp_connecter_t::get_new_reconnect_ivl ()
return this_interval;
}
-int zmq::tcp_connecter_t::set_address (const char *addr_)
+int xs::tcp_connecter_t::set_address (const char *addr_)
{
return address.resolve (addr_, false, options.ipv4only ? true : false);
}
-int zmq::tcp_connecter_t::open ()
+int xs::tcp_connecter_t::open ()
{
- zmq_assert (s == retired_fd);
+ xs_assert (s == retired_fd);
// Create the socket.
s = open_socket (address.family (), SOCK_STREAM, IPPROTO_TCP);
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
if (s == INVALID_SOCKET) {
wsa_error_to_errno ();
return -1;
@@ -213,7 +213,7 @@ int zmq::tcp_connecter_t::open ()
return 0;
// Asynchronous connect was launched.
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
if (rc == SOCKET_ERROR && (WSAGetLastError () == WSAEINPROGRESS ||
WSAGetLastError () == WSAEWOULDBLOCK)) {
errno = EAGAIN;
@@ -229,11 +229,11 @@ int zmq::tcp_connecter_t::open ()
return -1;
}
-zmq::fd_t zmq::tcp_connecter_t::connect ()
+xs::fd_t xs::tcp_connecter_t::connect ()
{
// Async connect have finished. Check whether an error occured.
int err = 0;
-#if defined ZMQ_HAVE_HPUX
+#if defined XS_HAVE_HPUX
int len = sizeof (err);
#else
socklen_t len = sizeof (err);
@@ -241,10 +241,10 @@ zmq::fd_t zmq::tcp_connecter_t::connect ()
int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len);
- // Assert if the error was caused by 0MQ bug.
+ // Assert if the error was caused by Crossroads bug.
// Networking problems are OK. No need to assert.
-#ifdef ZMQ_HAVE_WINDOWS
- zmq_assert (rc == 0);
+#ifdef XS_HAVE_WINDOWS
+ xs_assert (rc == 0);
if (err != 0) {
if (err == WSAECONNREFUSED || err == WSAETIMEDOUT ||
err == WSAECONNABORTED || err == WSAEHOSTUNREACH ||
@@ -273,10 +273,10 @@ zmq::fd_t zmq::tcp_connecter_t::connect ()
return result;
}
-void zmq::tcp_connecter_t::close ()
+void xs::tcp_connecter_t::close ()
{
- zmq_assert (s != retired_fd);
-#ifdef ZMQ_HAVE_WINDOWS
+ xs_assert (s != retired_fd);
+#ifdef XS_HAVE_WINDOWS
int rc = closesocket (s);
wsa_assert (rc != SOCKET_ERROR);
#else
diff --git a/src/tcp_connecter.hpp b/src/tcp_connecter.hpp
index fc3b9f2..bccaf6b 100644
--- a/src/tcp_connecter.hpp
+++ b/src/tcp_connecter.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -28,7 +28,7 @@
#include "io_object.hpp"
#include "tcp_address.hpp"
-namespace zmq
+namespace xs
{
class io_thread_t;
@@ -40,8 +40,8 @@ namespace zmq
// If 'delay' is true connecter first waits for a while, then starts
// connection process.
- tcp_connecter_t (zmq::io_thread_t *io_thread_,
- zmq::session_base_t *session_, const options_t &options_,
+ tcp_connecter_t (xs::io_thread_t *io_thread_,
+ xs::session_base_t *session_, const options_t &options_,
const char *address_, bool delay_);
~tcp_connecter_t ();
@@ -101,7 +101,7 @@ namespace zmq
bool wait;
// Reference to the session we belong to.
- zmq::session_base_t *session;
+ xs::session_base_t *session;
// Current reconnect ivl, updated for backoff strategy
int current_reconnect_ivl;
diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp
index 0b7a90d..2a2819c 100644
--- a/src/tcp_listener.cpp
+++ b/src/tcp_listener.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2010 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -32,7 +32,7 @@
#include "err.hpp"
#include "ip.hpp"
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <unistd.h>
@@ -44,11 +44,11 @@
#include <fcntl.h>
#endif
-#ifdef ZMQ_HAVE_OPENVMS
+#ifdef XS_HAVE_OPENVMS
#include <ioctl.h>
#endif
-zmq::tcp_listener_t::tcp_listener_t (io_thread_t *io_thread_,
+xs::tcp_listener_t::tcp_listener_t (io_thread_t *io_thread_,
socket_base_t *socket_, const options_t &options_) :
own_t (io_thread_, options_),
io_object_t (io_thread_),
@@ -58,26 +58,26 @@ zmq::tcp_listener_t::tcp_listener_t (io_thread_t *io_thread_,
{
}
-zmq::tcp_listener_t::~tcp_listener_t ()
+xs::tcp_listener_t::~tcp_listener_t ()
{
if (s != retired_fd)
close ();
}
-void zmq::tcp_listener_t::process_plug ()
+void xs::tcp_listener_t::process_plug ()
{
// Start polling for incoming connections.
handle = add_fd (s);
set_pollin (handle);
}
-void zmq::tcp_listener_t::process_term (int linger_)
+void xs::tcp_listener_t::process_term (int linger_)
{
rm_fd (handle);
own_t::process_term (linger_);
}
-void zmq::tcp_listener_t::in_event ()
+void xs::tcp_listener_t::in_event ()
{
fd_t fd = accept ();
@@ -95,7 +95,7 @@ void zmq::tcp_listener_t::in_event ()
// Choose I/O thread to run connecter in. Given that we are already
// running in an I/O thread, there must be at least one available.
io_thread_t *io_thread = choose_io_thread (options.affinity);
- zmq_assert (io_thread);
+ xs_assert (io_thread);
// Create and launch a session object.
session_base_t *session = session_base_t::create (io_thread, false, socket,
@@ -106,10 +106,10 @@ void zmq::tcp_listener_t::in_event ()
send_attach (session, engine, false);
}
-void zmq::tcp_listener_t::close ()
+void xs::tcp_listener_t::close ()
{
- zmq_assert (s != retired_fd);
-#ifdef ZMQ_HAVE_WINDOWS
+ xs_assert (s != retired_fd);
+#ifdef XS_HAVE_WINDOWS
int rc = closesocket (s);
wsa_assert (rc != SOCKET_ERROR);
#else
@@ -119,7 +119,7 @@ void zmq::tcp_listener_t::close ()
s = retired_fd;
}
-int zmq::tcp_listener_t::set_address (const char *addr_)
+int xs::tcp_listener_t::set_address (const char *addr_)
{
// Convert the textual address into address structure.
int rc = address.resolve (addr_, true, options.ipv4only ? true : false);
@@ -128,7 +128,7 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
// Create a listening socket.
s = open_socket (address.family (), SOCK_STREAM, IPPROTO_TCP);
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
if (s == INVALID_SOCKET)
wsa_error_to_errno ();
#endif
@@ -142,7 +142,7 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
s = ::socket (address.family (), SOCK_STREAM, IPPROTO_TCP);
}
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
if (s == INVALID_SOCKET) {
wsa_error_to_errno ();
return -1;
@@ -159,7 +159,7 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
// Allow reusing of the address.
int flag = 1;
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
rc = setsockopt (s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE,
(const char*) &flag, sizeof (int));
wsa_assert (rc != SOCKET_ERROR);
@@ -170,7 +170,7 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
// Bind the socket to the network interface and port.
rc = bind (s, address.addr (), address.addrlen ());
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
if (rc == SOCKET_ERROR) {
wsa_error_to_errno ();
return -1;
@@ -182,7 +182,7 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
// Listen for incomming connections.
rc = listen (s, options.backlog);
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
if (rc == SOCKET_ERROR) {
wsa_error_to_errno ();
return -1;
@@ -195,12 +195,12 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
return 0;
}
-zmq::fd_t zmq::tcp_listener_t::accept ()
+xs::fd_t xs::tcp_listener_t::accept ()
{
// Accept one connection and deal with different failure modes.
- zmq_assert (s != retired_fd);
+ xs_assert (s != retired_fd);
fd_t sock = ::accept (s, NULL, NULL);
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
if (sock == INVALID_SOCKET) {
wsa_assert (WSAGetLastError () == WSAEWOULDBLOCK ||
WSAGetLastError () == WSAECONNRESET);
diff --git a/src/tcp_listener.hpp b/src/tcp_listener.hpp
index c2116b3..6c760e2 100644
--- a/src/tcp_listener.hpp
+++ b/src/tcp_listener.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2010 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_TCP_LISTENER_HPP_INCLUDED__
-#define __ZMQ_TCP_LISTENER_HPP_INCLUDED__
+#ifndef __XS_TCP_LISTENER_HPP_INCLUDED__
+#define __XS_TCP_LISTENER_HPP_INCLUDED__
#include "fd.hpp"
#include "own.hpp"
@@ -28,7 +28,7 @@
#include "io_object.hpp"
#include "tcp_address.hpp"
-namespace zmq
+namespace xs
{
class io_thread_t;
@@ -38,8 +38,8 @@ namespace zmq
{
public:
- tcp_listener_t (zmq::io_thread_t *io_thread_,
- zmq::socket_base_t *socket_, const options_t &options_);
+ tcp_listener_t (xs::io_thread_t *io_thread_,
+ xs::socket_base_t *socket_, const options_t &options_);
~tcp_listener_t ();
// Set address to listen on.
@@ -75,7 +75,7 @@ namespace zmq
handle_t handle;
// Socket the listerner belongs to.
- zmq::socket_base_t *socket;
+ xs::socket_base_t *socket;
tcp_listener_t (const tcp_listener_t&);
const tcp_listener_t &operator = (const tcp_listener_t&);
diff --git a/src/thread.cpp b/src/thread.cpp
index 00628e5..fc554d2 100644
--- a/src/thread.cpp
+++ b/src/thread.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2007-2011 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -23,19 +23,19 @@
#include "err.hpp"
#include "platform.hpp"
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
extern "C"
{
static unsigned int __stdcall thread_routine (void *arg_)
{
- zmq::thread_t *self = (zmq::thread_t*) arg_;
+ xs::thread_t *self = (xs::thread_t*) arg_;
self->tfn (self->arg);
return 0;
}
}
-void zmq::thread_t::start (thread_fn *tfn_, void *arg_)
+void xs::thread_t::start (thread_fn *tfn_, void *arg_)
{
tfn = tfn_;
arg =arg_;
@@ -44,7 +44,7 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_)
win_assert (descriptor != NULL);
}
-void zmq::thread_t::stop ()
+void xs::thread_t::stop ()
{
DWORD rc = WaitForSingleObject (descriptor, INFINITE);
win_assert (rc != WAIT_FAILED);
@@ -60,7 +60,7 @@ extern "C"
{
static void *thread_routine (void *arg_)
{
-#if !defined ZMQ_HAVE_OPENVMS && !defined ZMQ_HAVE_ANDROID
+#if !defined XS_HAVE_OPENVMS && !defined XS_HAVE_ANDROID
// Following code will guarantee more predictable latencies as it'll
// disallow any signal handling in the I/O thread.
sigset_t signal_set;
@@ -70,13 +70,13 @@ extern "C"
posix_assert (rc);
#endif
- zmq::thread_t *self = (zmq::thread_t*) arg_;
+ xs::thread_t *self = (xs::thread_t*) arg_;
self->tfn (self->arg);
return NULL;
}
}
-void zmq::thread_t::start (thread_fn *tfn_, void *arg_)
+void xs::thread_t::start (thread_fn *tfn_, void *arg_)
{
tfn = tfn_;
arg =arg_;
@@ -84,7 +84,7 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_)
posix_assert (rc);
}
-void zmq::thread_t::stop ()
+void xs::thread_t::stop ()
{
int rc = pthread_join (descriptor, NULL);
posix_assert (rc);
diff --git a/src/thread.hpp b/src/thread.hpp
index 52769b1..23f1712 100644
--- a/src/thread.hpp
+++ b/src/thread.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2007-2011 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,18 +19,18 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_THREAD_HPP_INCLUDED__
-#define __ZMQ_THREAD_HPP_INCLUDED__
+#ifndef __XS_THREAD_HPP_INCLUDED__
+#define __XS_THREAD_HPP_INCLUDED__
#include "platform.hpp"
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <pthread.h>
#endif
-namespace zmq
+namespace xs
{
typedef void (thread_fn) (void*);
@@ -64,7 +64,7 @@ namespace zmq
private:
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
HANDLE descriptor;
#else
pthread_t descriptor;
diff --git a/src/trie.cpp b/src/trie.cpp
index d53a135..5656efb 100644
--- a/src/trie.cpp
+++ b/src/trie.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -25,21 +25,21 @@
#include <algorithm>
#include "platform.hpp"
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#endif
#include "err.hpp"
#include "trie.hpp"
-zmq::trie_t::trie_t () :
+xs::trie_t::trie_t () :
refcnt (0),
min (0),
count (0)
{
}
-zmq::trie_t::~trie_t ()
+xs::trie_t::~trie_t ()
{
if (count == 1)
delete next.node;
@@ -51,7 +51,7 @@ zmq::trie_t::~trie_t ()
}
}
-bool zmq::trie_t::add (unsigned char *prefix_, size_t size_)
+bool xs::trie_t::add (unsigned char *prefix_, size_t size_)
{
// We are at the node corresponding to the prefix. We are done.
if (!size_) {
@@ -75,7 +75,7 @@ bool zmq::trie_t::add (unsigned char *prefix_, size_t size_)
count = (min < c ? c - min : min - c) + 1;
next.table = (trie_t**)
malloc (sizeof (trie_t*) * count);
- zmq_assert (next.table);
+ xs_assert (next.table);
for (unsigned short i = 0; i != count; ++i)
next.table [i] = 0;
min = std::min (min, c);
@@ -88,7 +88,7 @@ bool zmq::trie_t::add (unsigned char *prefix_, size_t size_)
count = c - min + 1;
next.table = (trie_t**) realloc ((void*) next.table,
sizeof (trie_t*) * count);
- zmq_assert (next.table);
+ xs_assert (next.table);
for (unsigned short i = old_count; i != count; i++)
next.table [i] = NULL;
}
@@ -99,7 +99,7 @@ bool zmq::trie_t::add (unsigned char *prefix_, size_t size_)
count = (min + old_count) - c;
next.table = (trie_t**) realloc ((void*) next.table,
sizeof (trie_t*) * count);
- zmq_assert (next.table);
+ xs_assert (next.table);
memmove (next.table + min - c, next.table,
old_count * sizeof (trie_t*));
for (unsigned short i = 0; i != min - c; i++)
@@ -112,20 +112,20 @@ bool zmq::trie_t::add (unsigned char *prefix_, size_t size_)
if (count == 1) {
if (!next.node) {
next.node = new (std::nothrow) trie_t;
- zmq_assert (next.node);
+ xs_assert (next.node);
}
return next.node->add (prefix_ + 1, size_ - 1);
}
else {
if (!next.table [c - min]) {
next.table [c - min] = new (std::nothrow) trie_t;
- zmq_assert (next.table [c - min]);
+ xs_assert (next.table [c - min]);
}
return next.table [c - min]->add (prefix_ + 1, size_ - 1);
}
}
-bool zmq::trie_t::rm (unsigned char *prefix_, size_t size_)
+bool xs::trie_t::rm (unsigned char *prefix_, size_t size_)
{
// TODO: Shouldn't an error be reported if the key does not exist?
@@ -149,7 +149,7 @@ bool zmq::trie_t::rm (unsigned char *prefix_, size_t size_)
return next_node->rm (prefix_ + 1, size_ - 1);
}
-bool zmq::trie_t::check (unsigned char *data_, size_t size_)
+bool xs::trie_t::check (unsigned char *data_, size_t size_)
{
// This function is on critical path. It deliberately doesn't use
// recursion to get a bit better performance.
@@ -183,7 +183,7 @@ bool zmq::trie_t::check (unsigned char *data_, size_t size_)
}
}
-void zmq::trie_t::apply (void (*func_) (unsigned char *data_, size_t size_,
+void xs::trie_t::apply (void (*func_) (unsigned char *data_, size_t size_,
void *arg_), void *arg_)
{
unsigned char *buff = NULL;
@@ -191,7 +191,7 @@ void zmq::trie_t::apply (void (*func_) (unsigned char *data_, size_t size_,
free (buff);
}
-void zmq::trie_t::apply_helper (
+void xs::trie_t::apply_helper (
unsigned char **buff_, size_t buffsize_, size_t maxbuffsize_,
void (*func_) (unsigned char *data_, size_t size_, void *arg_), void *arg_)
{
@@ -203,7 +203,7 @@ void zmq::trie_t::apply_helper (
if (buffsize_ >= maxbuffsize_) {
maxbuffsize_ = buffsize_ + 256;
*buff_ = (unsigned char*) realloc (*buff_, maxbuffsize_);
- zmq_assert (*buff_);
+ xs_assert (*buff_);
}
// If there are no subnodes in the trie, return.
diff --git a/src/trie.hpp b/src/trie.hpp
index 76e4fd9..19aaa26 100644
--- a/src/trie.hpp
+++ b/src/trie.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,14 +19,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_TRIE_HPP_INCLUDED__
-#define __ZMQ_TRIE_HPP_INCLUDED__
+#ifndef __XS_TRIE_HPP_INCLUDED__
+#define __XS_TRIE_HPP_INCLUDED__
#include <stddef.h>
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
class trie_t
diff --git a/src/windows.hpp b/src/windows.hpp
index f5f946c..228356a 100644
--- a/src/windows.hpp
+++ b/src/windows.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_WINDOWS_HPP_INCLUDED__
-#define __ZMQ_WINDOWS_HPP_INCLUDED__
+#ifndef __XS_WINDOWS_HPP_INCLUDED__
+#define __XS_WINDOWS_HPP_INCLUDED__
// The purpose of this header file is to turn on only the items actually
// needed on the windows platform.
diff --git a/src/wire.hpp b/src/wire.hpp
index b0f4e0e..3a33349 100644
--- a/src/wire.hpp
+++ b/src/wire.hpp
@@ -2,14 +2,14 @@
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,12 +18,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_WIRE_HPP_INCLUDED__
-#define __ZMQ_WIRE_HPP_INCLUDED__
+#ifndef __XS_WIRE_HPP_INCLUDED__
+#define __XS_WIRE_HPP_INCLUDED__
#include "stdint.hpp"
-namespace zmq
+namespace xs
{
// Helper functions to convert different integer types to/from network
diff --git a/src/xpub.cpp b/src/xpub.cpp
index af83af1..f5520f7 100644
--- a/src/xpub.cpp
+++ b/src/xpub.cpp
@@ -3,14 +3,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -26,20 +26,20 @@
#include "err.hpp"
#include "msg.hpp"
-zmq::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_),
more (false)
{
- options.type = ZMQ_XPUB;
+ options.type = XS_XPUB;
}
-zmq::xpub_t::~xpub_t ()
+xs::xpub_t::~xpub_t ()
{
}
-void zmq::xpub_t::xattach_pipe (pipe_t *pipe_)
+void xs::xpub_t::xattach_pipe (pipe_t *pipe_)
{
- zmq_assert (pipe_);
+ xs_assert (pipe_);
dist.attach (pipe_);
// The pipe is active when attached. Let's read the subscriptions from
@@ -47,7 +47,7 @@ void zmq::xpub_t::xattach_pipe (pipe_t *pipe_)
xread_activated (pipe_);
}
-void zmq::xpub_t::xread_activated (pipe_t *pipe_)
+void xs::xpub_t::xread_activated (pipe_t *pipe_)
{
// There are some subscriptions waiting. Let's process them.
msg_t sub;
@@ -63,7 +63,7 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
// Apply the subscription to the trie.
unsigned char *data = (unsigned char*) sub.data ();
size_t size = sub.size ();
- zmq_assert (size > 0 && (*data == 0 || *data == 1));
+ xs_assert (size > 0 && (*data == 0 || *data == 1));
bool unique;
if (*data == 0)
unique = subscriptions.rm (data + 1, size - 1, pipe_);
@@ -72,18 +72,18 @@ void zmq::xpub_t::xread_activated (pipe_t *pipe_)
// If the subscription is not a duplicate store it so that it can be
// passed to used on next recv call.
- if (unique && options.type != ZMQ_PUB)
+ if (unique && options.type != XS_PUB)
pending.push_back (blob_t ((unsigned char*) sub.data (),
sub.size ()));
}
}
-void zmq::xpub_t::xwrite_activated (pipe_t *pipe_)
+void xs::xpub_t::xwrite_activated (pipe_t *pipe_)
{
dist.activated (pipe_);
}
-void zmq::xpub_t::xterminated (pipe_t *pipe_)
+void xs::xpub_t::xterminated (pipe_t *pipe_)
{
// Remove the pipe from the trie. If there are topics that nobody
// is interested in anymore, send corresponding unsubscriptions
@@ -93,13 +93,13 @@ void zmq::xpub_t::xterminated (pipe_t *pipe_)
dist.terminated (pipe_);
}
-void zmq::xpub_t::mark_as_matching (pipe_t *pipe_, void *arg_)
+void xs::xpub_t::mark_as_matching (pipe_t *pipe_, void *arg_)
{
xpub_t *self = (xpub_t*) arg_;
self->dist.match (pipe_);
}
-int zmq::xpub_t::xsend (msg_t *msg_, int flags_)
+int xs::xpub_t::xsend (msg_t *msg_, int flags_)
{
bool msg_more = msg_->flags () & msg_t::more ? true : false;
@@ -124,12 +124,12 @@ int zmq::xpub_t::xsend (msg_t *msg_, int flags_)
return 0;
}
-bool zmq::xpub_t::xhas_out ()
+bool xs::xpub_t::xhas_out ()
{
return dist.has_out ();
}
-int zmq::xpub_t::xrecv (msg_t *msg_, int flags_)
+int xs::xpub_t::xrecv (msg_t *msg_, int flags_)
{
// If there is at least one
if (pending.empty ()) {
@@ -147,17 +147,17 @@ int zmq::xpub_t::xrecv (msg_t *msg_, int flags_)
return 0;
}
-bool zmq::xpub_t::xhas_in ()
+bool xs::xpub_t::xhas_in ()
{
return !pending.empty ();
}
-void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
+void xs::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
void *arg_)
{
xpub_t *self = (xpub_t*) arg_;
- if (self->options.type != ZMQ_PUB) {
+ if (self->options.type != XS_PUB) {
// Place the unsubscription to the queue of pending (un)sunscriptions
// to be retrived by the user later on.
@@ -169,7 +169,7 @@ void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_,
}
}
-zmq::xpub_session_t::xpub_session_t (io_thread_t *io_thread_, bool connect_,
+xs::xpub_session_t::xpub_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
session_base_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -177,7 +177,7 @@ zmq::xpub_session_t::xpub_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::xpub_session_t::~xpub_session_t ()
+xs::xpub_session_t::~xpub_session_t ()
{
}
diff --git a/src/xpub.hpp b/src/xpub.hpp
index 054d476..840eaba 100644
--- a/src/xpub.hpp
+++ b/src/xpub.hpp
@@ -2,14 +2,14 @@
Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,8 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_XPUB_HPP_INCLUDED__
-#define __ZMQ_XPUB_HPP_INCLUDED__
+#ifndef __XS_XPUB_HPP_INCLUDED__
+#define __XS_XPUB_HPP_INCLUDED__
#include <deque>
#include <string>
@@ -30,7 +30,7 @@
#include "array.hpp"
#include "dist.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -43,18 +43,18 @@ namespace zmq
{
public:
- xpub_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ xpub_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~xpub_t ();
// Implementations of virtual functions from socket_base_t.
- void xattach_pipe (zmq::pipe_t *pipe_);
- int xsend (zmq::msg_t *msg_, int flags_);
+ void xattach_pipe (xs::pipe_t *pipe_);
+ int xsend (xs::msg_t *msg_, int flags_);
bool xhas_out ();
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xrecv (xs::msg_t *msg_, int flags_);
bool xhas_in ();
- void xread_activated (zmq::pipe_t *pipe_);
- void xwrite_activated (zmq::pipe_t *pipe_);
- void xterminated (zmq::pipe_t *pipe_);
+ void xread_activated (xs::pipe_t *pipe_);
+ void xwrite_activated (xs::pipe_t *pipe_);
+ void xterminated (xs::pipe_t *pipe_);
private:
@@ -64,7 +64,7 @@ namespace zmq
void *arg_);
// Function to be applied to each matching pipes.
- static void mark_as_matching (zmq::pipe_t *pipe_, void *arg_);
+ static void mark_as_matching (xs::pipe_t *pipe_, void *arg_);
// List of all subscriptions mapped to corresponding pipes.
mtrie_t subscriptions;
@@ -89,7 +89,7 @@ namespace zmq
{
public:
- xpub_session_t (zmq::io_thread_t *io_thread_, bool connect_,
+ xpub_session_t (xs::io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~xpub_session_t ();
diff --git a/src/xrep.cpp b/src/xrep.cpp
index 2fc367a..8304f62 100644
--- a/src/xrep.cpp
+++ b/src/xrep.cpp
@@ -4,14 +4,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -27,7 +27,7 @@
#include "likely.hpp"
#include "err.hpp"
-zmq::xrep_t::xrep_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::xrep_t::xrep_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_),
prefetched (0),
more_in (false),
@@ -35,7 +35,7 @@ zmq::xrep_t::xrep_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
more_out (false),
next_peer_id (generate_random ())
{
- options.type = ZMQ_XREP;
+ options.type = XS_XREP;
// TODO: Uncomment the following line when XREP will become true XREP
// rather than generic router socket.
@@ -49,15 +49,15 @@ zmq::xrep_t::xrep_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
prefetched_msg.init ();
}
-zmq::xrep_t::~xrep_t ()
+xs::xrep_t::~xrep_t ()
{
- zmq_assert (outpipes.empty ());
+ xs_assert (outpipes.empty ());
prefetched_msg.close ();
}
-void zmq::xrep_t::xattach_pipe (pipe_t *pipe_)
+void xs::xrep_t::xattach_pipe (pipe_t *pipe_)
{
- zmq_assert (pipe_);
+ xs_assert (pipe_);
// Generate a new unique peer identity.
unsigned char buf [5];
@@ -70,14 +70,14 @@ void zmq::xrep_t::xattach_pipe (pipe_t *pipe_)
outpipe_t outpipe = {pipe_, true};
bool ok = outpipes.insert (outpipes_t::value_type (
identity, outpipe)).second;
- zmq_assert (ok);
+ xs_assert (ok);
// Add the pipe to the list of inbound pipes.
pipe_->set_identity (identity);
fq.attach (pipe_);
}
-void zmq::xrep_t::xterminated (pipe_t *pipe_)
+void xs::xrep_t::xterminated (pipe_t *pipe_)
{
fq.terminated (pipe_);
@@ -90,33 +90,33 @@ void zmq::xrep_t::xterminated (pipe_t *pipe_)
return;
}
}
- zmq_assert (false);
+ xs_assert (false);
}
-void zmq::xrep_t::xread_activated (pipe_t *pipe_)
+void xs::xrep_t::xread_activated (pipe_t *pipe_)
{
fq.activated (pipe_);
}
-void zmq::xrep_t::xwrite_activated (pipe_t *pipe_)
+void xs::xrep_t::xwrite_activated (pipe_t *pipe_)
{
for (outpipes_t::iterator it = outpipes.begin ();
it != outpipes.end (); ++it) {
if (it->second.pipe == pipe_) {
- zmq_assert (!it->second.active);
+ xs_assert (!it->second.active);
it->second.active = true;
return;
}
}
- zmq_assert (false);
+ xs_assert (false);
}
-int zmq::xrep_t::xsend (msg_t *msg_, int flags_)
+int xs::xrep_t::xsend (msg_t *msg_, int flags_)
{
// If this is the first part of the message it's the ID of the
// peer to send the message to.
if (!more_out) {
- zmq_assert (!current_out);
+ xs_assert (!current_out);
// If we have malformed message (prefix with no subsequent message)
// then just silently ignore it.
@@ -178,7 +178,7 @@ int zmq::xrep_t::xsend (msg_t *msg_, int flags_)
return 0;
}
-int zmq::xrep_t::xrecv (msg_t *msg_, int flags_)
+int xs::xrep_t::xrecv (msg_t *msg_, int flags_)
{
// if there is a prefetched identity, return it.
if (prefetched == 2)
@@ -212,7 +212,7 @@ int zmq::xrep_t::xrecv (msg_t *msg_, int flags_)
if (likely (!(msg_->flags () & msg_t::identity)))
break;
- zmq_assert (!more_in);
+ xs_assert (!more_in);
// Empty identity means we can preserve the auto-generated identity.
if (msg_->size () != 0) {
@@ -232,7 +232,7 @@ int zmq::xrep_t::xrecv (msg_t *msg_, int flags_)
}
++it;
}
- zmq_assert (it != outpipes.end ());
+ xs_assert (it != outpipes.end ());
}
}
@@ -258,7 +258,7 @@ int zmq::xrep_t::xrecv (msg_t *msg_, int flags_)
return 0;
}
-int zmq::xrep_t::rollback (void)
+int xs::xrep_t::rollback (void)
{
if (current_out) {
current_out->rollback ();
@@ -268,7 +268,7 @@ int zmq::xrep_t::rollback (void)
return 0;
}
-bool zmq::xrep_t::xhas_in ()
+bool xs::xrep_t::xhas_in ()
{
// If we are in the middle of reading the messages, there are
// definitely more parts available.
@@ -283,12 +283,12 @@ bool zmq::xrep_t::xhas_in ()
// it will be identity of the peer sending the message.
msg_t id;
id.init ();
- int rc = xrep_t::xrecv (&id, ZMQ_DONTWAIT);
+ int rc = xrep_t::xrecv (&id, XS_DONTWAIT);
if (rc != 0 && errno == EAGAIN) {
id.close ();
return false;
}
- zmq_assert (rc == 0);
+ xs_assert (rc == 0);
// We have first part of the message prefetched now. We will store the
// prefetched identity as well.
@@ -299,7 +299,7 @@ bool zmq::xrep_t::xhas_in ()
return true;
}
-bool zmq::xrep_t::xhas_out ()
+bool xs::xrep_t::xhas_out ()
{
// In theory, XREP socket is always ready for writing. Whether actual
// attempt to write succeeds depends on whitch pipe the message is going
@@ -307,7 +307,7 @@ bool zmq::xrep_t::xhas_out ()
return true;
}
-zmq::xrep_session_t::xrep_session_t (io_thread_t *io_thread_, bool connect_,
+xs::xrep_session_t::xrep_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
session_base_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -315,7 +315,7 @@ zmq::xrep_session_t::xrep_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::xrep_session_t::~xrep_session_t ()
+xs::xrep_session_t::~xrep_session_t ()
{
}
diff --git a/src/xrep.hpp b/src/xrep.hpp
index a6dd2d3..d73549b 100644
--- a/src/xrep.hpp
+++ b/src/xrep.hpp
@@ -4,14 +4,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -20,8 +20,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_XREP_HPP_INCLUDED__
-#define __ZMQ_XREP_HPP_INCLUDED__
+#ifndef __XS_XREP_HPP_INCLUDED__
+#define __XS_XREP_HPP_INCLUDED__
#include <map>
@@ -32,7 +32,7 @@
#include "msg.hpp"
#include "fq.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -44,18 +44,18 @@ namespace zmq
{
public:
- xrep_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ xrep_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~xrep_t ();
// Overloads of functions from socket_base_t.
- void xattach_pipe (zmq::pipe_t *pipe_);
+ void xattach_pipe (xs::pipe_t *pipe_);
int xsend (msg_t *msg_, int flags_);
int xrecv (msg_t *msg_, int flags_);
bool xhas_in ();
bool xhas_out ();
- void xread_activated (zmq::pipe_t *pipe_);
- void xwrite_activated (zmq::pipe_t *pipe_);
- void xterminated (zmq::pipe_t *pipe_);
+ void xread_activated (xs::pipe_t *pipe_);
+ void xwrite_activated (xs::pipe_t *pipe_);
+ void xterminated (xs::pipe_t *pipe_);
protected:
@@ -82,7 +82,7 @@ namespace zmq
struct outpipe_t
{
- zmq::pipe_t *pipe;
+ xs::pipe_t *pipe;
bool active;
};
@@ -91,7 +91,7 @@ namespace zmq
outpipes_t outpipes;
// The pipe we are currently writing to.
- zmq::pipe_t *current_out;
+ xs::pipe_t *current_out;
// If true, more outgoing message parts are expected.
bool more_out;
@@ -108,7 +108,7 @@ namespace zmq
{
public:
- xrep_session_t (zmq::io_thread_t *io_thread_, bool connect_,
+ xrep_session_t (xs::io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~xrep_session_t ();
diff --git a/src/xreq.cpp b/src/xreq.cpp
index 731fb1f..eaf318a 100644
--- a/src/xreq.cpp
+++ b/src/xreq.cpp
@@ -3,14 +3,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -23,11 +23,11 @@
#include "err.hpp"
#include "msg.hpp"
-zmq::xreq_t::xreq_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::xreq_t::xreq_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_),
prefetched (false)
{
- options.type = ZMQ_XREQ;
+ options.type = XS_XREQ;
// TODO: Uncomment the following line when XREQ will become true XREQ
// rather than generic dealer socket.
@@ -41,24 +41,24 @@ zmq::xreq_t::xreq_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
prefetched_msg.init ();
}
-zmq::xreq_t::~xreq_t ()
+xs::xreq_t::~xreq_t ()
{
prefetched_msg.close ();
}
-void zmq::xreq_t::xattach_pipe (pipe_t *pipe_)
+void xs::xreq_t::xattach_pipe (pipe_t *pipe_)
{
- zmq_assert (pipe_);
+ xs_assert (pipe_);
fq.attach (pipe_);
lb.attach (pipe_);
}
-int zmq::xreq_t::xsend (msg_t *msg_, int flags_)
+int xs::xreq_t::xsend (msg_t *msg_, int flags_)
{
return lb.send (msg_, flags_);
}
-int zmq::xreq_t::xrecv (msg_t *msg_, int flags_)
+int xs::xreq_t::xrecv (msg_t *msg_, int flags_)
{
// If there is a prefetched message, return it.
if (prefetched) {
@@ -79,43 +79,43 @@ int zmq::xreq_t::xrecv (msg_t *msg_, int flags_)
return 0;
}
-bool zmq::xreq_t::xhas_in ()
+bool xs::xreq_t::xhas_in ()
{
// We may already have a message pre-fetched.
if (prefetched)
return true;
// Try to read the next message to the pre-fetch buffer.
- int rc = xreq_t::xrecv (&prefetched_msg, ZMQ_DONTWAIT);
+ int rc = xreq_t::xrecv (&prefetched_msg, XS_DONTWAIT);
if (rc != 0 && errno == EAGAIN)
return false;
- zmq_assert (rc == 0);
+ xs_assert (rc == 0);
prefetched = true;
return true;
}
-bool zmq::xreq_t::xhas_out ()
+bool xs::xreq_t::xhas_out ()
{
return lb.has_out ();
}
-void zmq::xreq_t::xread_activated (pipe_t *pipe_)
+void xs::xreq_t::xread_activated (pipe_t *pipe_)
{
fq.activated (pipe_);
}
-void zmq::xreq_t::xwrite_activated (pipe_t *pipe_)
+void xs::xreq_t::xwrite_activated (pipe_t *pipe_)
{
lb.activated (pipe_);
}
-void zmq::xreq_t::xterminated (pipe_t *pipe_)
+void xs::xreq_t::xterminated (pipe_t *pipe_)
{
fq.terminated (pipe_);
lb.terminated (pipe_);
}
-zmq::xreq_session_t::xreq_session_t (io_thread_t *io_thread_, bool connect_,
+xs::xreq_session_t::xreq_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
session_base_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -123,7 +123,7 @@ zmq::xreq_session_t::xreq_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::xreq_session_t::~xreq_session_t ()
+xs::xreq_session_t::~xreq_session_t ()
{
}
diff --git a/src/xreq.hpp b/src/xreq.hpp
index 4542950..837cc8a 100644
--- a/src/xreq.hpp
+++ b/src/xreq.hpp
@@ -2,14 +2,14 @@
Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,15 +18,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_XREQ_HPP_INCLUDED__
-#define __ZMQ_XREQ_HPP_INCLUDED__
+#ifndef __XS_XREQ_HPP_INCLUDED__
+#define __XS_XREQ_HPP_INCLUDED__
#include "socket_base.hpp"
#include "session_base.hpp"
#include "fq.hpp"
#include "lb.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -40,20 +40,20 @@ namespace zmq
{
public:
- xreq_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ xreq_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~xreq_t ();
protected:
// Overloads of functions from socket_base_t.
- void xattach_pipe (zmq::pipe_t *pipe_);
- int xsend (zmq::msg_t *msg_, int flags_);
- int xrecv (zmq::msg_t *msg_, int flags_);
+ void xattach_pipe (xs::pipe_t *pipe_);
+ int xsend (xs::msg_t *msg_, int flags_);
+ int xrecv (xs::msg_t *msg_, int flags_);
bool xhas_in ();
bool xhas_out ();
- void xread_activated (zmq::pipe_t *pipe_);
- void xwrite_activated (zmq::pipe_t *pipe_);
- void xterminated (zmq::pipe_t *pipe_);
+ void xread_activated (xs::pipe_t *pipe_);
+ void xwrite_activated (xs::pipe_t *pipe_);
+ void xterminated (xs::pipe_t *pipe_);
private:
@@ -76,8 +76,8 @@ namespace zmq
{
public:
- xreq_session_t (zmq::io_thread_t *io_thread_, bool connect_,
- zmq::socket_base_t *socket_, const options_t &options_,
+ xreq_session_t (xs::io_thread_t *io_thread_, bool connect_,
+ xs::socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_);
~xreq_session_t ();
diff --git a/src/zmq.cpp b/src/xs.cpp
index 6417d8e..8fc8dd2 100644
--- a/src/zmq.cpp
+++ b/src/xs.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2011 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -21,30 +21,30 @@
#include "platform.hpp"
-#if defined ZMQ_FORCE_SELECT
-#define ZMQ_POLL_BASED_ON_SELECT
-#elif defined ZMQ_FORCE_POLL
-#define ZMQ_POLL_BASED_ON_POLL
-#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
- defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\
- defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\
- defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\
- defined ZMQ_HAVE_NETBSD
-#define ZMQ_POLL_BASED_ON_POLL
-#elif defined ZMQ_HAVE_WINDOWS || defined ZMQ_HAVE_OPENVMS ||\
- defined ZMQ_HAVE_CYGWIN
-#define ZMQ_POLL_BASED_ON_SELECT
+#if defined XS_FORCE_SELECT
+#define XS_POLL_BASED_ON_SELECT
+#elif defined XS_FORCE_POLL
+#define XS_POLL_BASED_ON_POLL
+#elif defined XS_HAVE_LINUX || defined XS_HAVE_FREEBSD ||\
+ defined XS_HAVE_OPENBSD || defined XS_HAVE_SOLARIS ||\
+ defined XS_HAVE_OSX || defined XS_HAVE_QNXNTO ||\
+ defined XS_HAVE_HPUX || defined XS_HAVE_AIX ||\
+ defined XS_HAVE_NETBSD
+#define XS_POLL_BASED_ON_POLL
+#elif defined XS_HAVE_WINDOWS || defined XS_HAVE_OPENVMS ||\
+ defined XS_HAVE_CYGWIN
+#define XS_POLL_BASED_ON_SELECT
#endif
// On AIX platform, poll.h has to be included first to get consistent
// definition of pollfd structure (AIX uses 'reqevents' and 'retnevents'
// instead of 'events' and 'revents' and defines macros to map from POSIX-y
// names to AIX-specific names).
-#if defined ZMQ_POLL_BASED_ON_POLL
+#if defined XS_POLL_BASED_ON_POLL
#include <poll.h>
#endif
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
#include "windows.hpp"
#else
#include <unistd.h>
@@ -65,32 +65,32 @@
#include "msg.hpp"
#include "fd.hpp"
-#if !defined ZMQ_HAVE_WINDOWS
+#if !defined XS_HAVE_WINDOWS
#include <unistd.h>
#endif
-#if defined ZMQ_HAVE_OPENPGM
+#if defined XS_HAVE_OPENPGM
#define __PGM_WININT_H__
#include <pgm/pgm.h>
#endif
-// Compile time check whether msg_t fits into zmq_msg_t.
+// Compile time check whether msg_t fits into xs_msg_t.
typedef char check_msg_t_size
- [sizeof (zmq::msg_t) == sizeof (zmq_msg_t) ? 1 : -1];
+ [sizeof (xs::msg_t) == sizeof (xs_msg_t) ? 1 : -1];
-void zmq_version (int *major_, int *minor_, int *patch_)
+void xs_version (int *major_, int *minor_, int *patch_)
{
- *major_ = ZMQ_VERSION_MAJOR;
- *minor_ = ZMQ_VERSION_MINOR;
- *patch_ = ZMQ_VERSION_PATCH;
+ *major_ = XS_VERSION_MAJOR;
+ *minor_ = XS_VERSION_MINOR;
+ *patch_ = XS_VERSION_PATCH;
}
-const char *zmq_strerror (int errnum_)
+const char *xs_strerror (int errnum_)
{
- return zmq::errno_to_string (errnum_);
+ return xs::errno_to_string (errnum_);
}
-void *zmq_init (int io_threads_)
+void *xs_init (int io_threads_)
{
// We need at least one I/O thread to run the monitor object in.
if (io_threads_ < 1) {
@@ -98,7 +98,7 @@ void *zmq_init (int io_threads_)
return NULL;
}
-#if defined ZMQ_HAVE_OPENPGM
+#if defined XS_HAVE_OPENPGM
// Init PGM transport. Ensure threading and timer are enabled. Find PGM
// protocol ID. Note that if you want to use gettimeofday and sleep for
@@ -109,7 +109,7 @@ void *zmq_init (int io_threads_)
if (ok != TRUE) {
// Invalid parameters don't set pgm_error_t
- zmq_assert (pgm_error != NULL);
+ xs_assert (pgm_error != NULL);
if (pgm_error->domain == PGM_ERROR_DOMAIN_TIME && (
pgm_error->code == PGM_ERROR_FAILED)) {
@@ -120,11 +120,11 @@ void *zmq_init (int io_threads_)
}
// PGM_ERROR_DOMAIN_ENGINE: WSAStartup errors or missing WSARecvMsg.
- zmq_assert (false);
+ xs_assert (false);
}
#endif
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
// Intialise Windows sockets. Note that WSAStartup can be called multiple
// times given that WSACleanup will be called for each WSAStartup.
// We do this before the ctx constructor since its embedded mailbox_t
@@ -132,133 +132,133 @@ void *zmq_init (int io_threads_)
WORD version_requested = MAKEWORD (2, 2);
WSADATA wsa_data;
int rc = WSAStartup (version_requested, &wsa_data);
- zmq_assert (rc == 0);
- zmq_assert (LOBYTE (wsa_data.wVersion) == 2 &&
+ xs_assert (rc == 0);
+ xs_assert (LOBYTE (wsa_data.wVersion) == 2 &&
HIBYTE (wsa_data.wVersion) == 2);
#endif
- // Create 0MQ context.
- zmq::ctx_t *ctx = new (std::nothrow) zmq::ctx_t ((uint32_t) io_threads_);
+ // Create the context.
+ xs::ctx_t *ctx = new (std::nothrow) xs::ctx_t ((uint32_t) io_threads_);
alloc_assert (ctx);
return (void*) ctx;
}
-int zmq_term (void *ctx_)
+int xs_term (void *ctx_)
{
- if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) {
+ if (!ctx_ || !((xs::ctx_t*) ctx_)->check_tag ()) {
errno = EFAULT;
return -1;
}
- int rc = ((zmq::ctx_t*) ctx_)->terminate ();
+ int rc = ((xs::ctx_t*) ctx_)->terminate ();
int en = errno;
-#ifdef ZMQ_HAVE_WINDOWS
+#ifdef XS_HAVE_WINDOWS
// On Windows, uninitialise socket layer.
rc = WSACleanup ();
wsa_assert (rc != SOCKET_ERROR);
#endif
-#if defined ZMQ_HAVE_OPENPGM
+#if defined XS_HAVE_OPENPGM
// Shut down the OpenPGM library.
if (pgm_shutdown () != TRUE)
- zmq_assert (false);
+ xs_assert (false);
#endif
errno = en;
return rc;
}
-void *zmq_socket (void *ctx_, int type_)
+void *xs_socket (void *ctx_, int type_)
{
- if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) {
+ if (!ctx_ || !((xs::ctx_t*) ctx_)->check_tag ()) {
errno = EFAULT;
return NULL;
}
- return (void*) (((zmq::ctx_t*) ctx_)->create_socket (type_));
+ return (void*) (((xs::ctx_t*) ctx_)->create_socket (type_));
}
-int zmq_close (void *s_)
+int xs_close (void *s_)
{
- if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ if (!s_ || !((xs::socket_base_t*) s_)->check_tag ()) {
errno = ENOTSOCK;
return -1;
}
- ((zmq::socket_base_t*) s_)->close ();
+ ((xs::socket_base_t*) s_)->close ();
return 0;
}
-int zmq_setsockopt (void *s_, int option_, const void *optval_,
+int xs_setsockopt (void *s_, int option_, const void *optval_,
size_t optvallen_)
{
- if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ if (!s_ || !((xs::socket_base_t*) s_)->check_tag ()) {
errno = ENOTSOCK;
return -1;
}
- return (((zmq::socket_base_t*) s_)->setsockopt (option_, optval_,
+ return (((xs::socket_base_t*) s_)->setsockopt (option_, optval_,
optvallen_));
}
-int zmq_getsockopt (void *s_, int option_, void *optval_, size_t *optvallen_)
+int xs_getsockopt (void *s_, int option_, void *optval_, size_t *optvallen_)
{
- if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ if (!s_ || !((xs::socket_base_t*) s_)->check_tag ()) {
errno = ENOTSOCK;
return -1;
}
- return (((zmq::socket_base_t*) s_)->getsockopt (option_, optval_,
+ return (((xs::socket_base_t*) s_)->getsockopt (option_, optval_,
optvallen_));
}
-int zmq_bind (void *s_, const char *addr_)
+int xs_bind (void *s_, const char *addr_)
{
- if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ if (!s_ || !((xs::socket_base_t*) s_)->check_tag ()) {
errno = ENOTSOCK;
return -1;
}
- return (((zmq::socket_base_t*) s_)->bind (addr_));
+ return (((xs::socket_base_t*) s_)->bind (addr_));
}
-int zmq_connect (void *s_, const char *addr_)
+int xs_connect (void *s_, const char *addr_)
{
- if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ if (!s_ || !((xs::socket_base_t*) s_)->check_tag ()) {
errno = ENOTSOCK;
return -1;
}
- return (((zmq::socket_base_t*) s_)->connect (addr_));
+ return (((xs::socket_base_t*) s_)->connect (addr_));
}
-int zmq_send (void *s_, const void *buf_, size_t len_, int flags_)
+int xs_send (void *s_, const void *buf_, size_t len_, int flags_)
{
- zmq_msg_t msg;
- int rc = zmq_msg_init_size (&msg, len_);
+ xs_msg_t msg;
+ int rc = xs_msg_init_size (&msg, len_);
if (rc != 0)
return -1;
- memcpy (zmq_msg_data (&msg), buf_, len_);
+ memcpy (xs_msg_data (&msg), buf_, len_);
- rc = zmq_sendmsg (s_, &msg, flags_);
+ rc = xs_sendmsg (s_, &msg, flags_);
if (unlikely (rc < 0)) {
int err = errno;
- int rc2 = zmq_msg_close (&msg);
+ int rc2 = xs_msg_close (&msg);
errno_assert (rc2 == 0);
errno = err;
return -1;
}
// Note the optimisation here. We don't close the msg object as it is
- // empty anyway. This may change when implementation of zmq_msg_t changes.
+ // empty anyway. This may change when implementation of xs_msg_t changes.
return rc;
}
-int zmq_recv (void *s_, void *buf_, size_t len_, int flags_)
+int xs_recv (void *s_, void *buf_, size_t len_, int flags_)
{
- zmq_msg_t msg;
- int rc = zmq_msg_init (&msg);
+ xs_msg_t msg;
+ int rc = xs_msg_init (&msg);
errno_assert (rc == 0);
- int nbytes = zmq_recvmsg (s_, &msg, flags_);
+ int nbytes = xs_recvmsg (s_, &msg, flags_);
if (unlikely (nbytes < 0)) {
int err = errno;
- rc = zmq_msg_close (&msg);
+ rc = xs_msg_close (&msg);
errno_assert (rc == 0);
errno = err;
return -1;
@@ -267,91 +267,91 @@ int zmq_recv (void *s_, void *buf_, size_t len_, int flags_)
// At the moment an oversized message is silently truncated.
// TODO: Build in a notification mechanism to report the overflows.
size_t to_copy = size_t (nbytes) < len_ ? size_t (nbytes) : len_;
- memcpy (buf_, zmq_msg_data (&msg), to_copy);
+ memcpy (buf_, xs_msg_data (&msg), to_copy);
- rc = zmq_msg_close (&msg);
+ rc = xs_msg_close (&msg);
errno_assert (rc == 0);
return nbytes;
}
-int zmq_sendmsg (void *s_, zmq_msg_t *msg_, int flags_)
+int xs_sendmsg (void *s_, xs_msg_t *msg_, int flags_)
{
- if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ if (!s_ || !((xs::socket_base_t*) s_)->check_tag ()) {
errno = ENOTSOCK;
return -1;
}
- int sz = (int) zmq_msg_size (msg_);
- int rc = (((zmq::socket_base_t*) s_)->send ((zmq::msg_t*) msg_, flags_));
+ int sz = (int) xs_msg_size (msg_);
+ int rc = (((xs::socket_base_t*) s_)->send ((xs::msg_t*) msg_, flags_));
if (unlikely (rc < 0))
return -1;
return sz;
}
-int zmq_recvmsg (void *s_, zmq_msg_t *msg_, int flags_)
+int xs_recvmsg (void *s_, xs_msg_t *msg_, int flags_)
{
- if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ if (!s_ || !((xs::socket_base_t*) s_)->check_tag ()) {
errno = ENOTSOCK;
return -1;
}
- int rc = (((zmq::socket_base_t*) s_)->recv ((zmq::msg_t*) msg_, flags_));
+ int rc = (((xs::socket_base_t*) s_)->recv ((xs::msg_t*) msg_, flags_));
if (unlikely (rc < 0))
return -1;
- return (int) zmq_msg_size (msg_);
+ return (int) xs_msg_size (msg_);
}
-int zmq_msg_init (zmq_msg_t *msg_)
+int xs_msg_init (xs_msg_t *msg_)
{
- return ((zmq::msg_t*) msg_)->init ();
+ return ((xs::msg_t*) msg_)->init ();
}
-int zmq_msg_init_size (zmq_msg_t *msg_, size_t size_)
+int xs_msg_init_size (xs_msg_t *msg_, size_t size_)
{
- return ((zmq::msg_t*) msg_)->init_size (size_);
+ return ((xs::msg_t*) msg_)->init_size (size_);
}
-int zmq_msg_init_data (zmq_msg_t *msg_, void *data_, size_t size_,
- zmq_free_fn *ffn_, void *hint_)
+int xs_msg_init_data (xs_msg_t *msg_, void *data_, size_t size_,
+ xs_free_fn *ffn_, void *hint_)
{
- return ((zmq::msg_t*) msg_)->init_data (data_, size_, ffn_, hint_);
+ return ((xs::msg_t*) msg_)->init_data (data_, size_, ffn_, hint_);
}
-int zmq_msg_close (zmq_msg_t *msg_)
+int xs_msg_close (xs_msg_t *msg_)
{
- return ((zmq::msg_t*) msg_)->close ();
+ return ((xs::msg_t*) msg_)->close ();
}
-int zmq_msg_move (zmq_msg_t *dest_, zmq_msg_t *src_)
+int xs_msg_move (xs_msg_t *dest_, xs_msg_t *src_)
{
- return ((zmq::msg_t*) dest_)->move (*(zmq::msg_t*) src_);
+ return ((xs::msg_t*) dest_)->move (*(xs::msg_t*) src_);
}
-int zmq_msg_copy (zmq_msg_t *dest_, zmq_msg_t *src_)
+int xs_msg_copy (xs_msg_t *dest_, xs_msg_t *src_)
{
- return ((zmq::msg_t*) dest_)->copy (*(zmq::msg_t*) src_);
+ return ((xs::msg_t*) dest_)->copy (*(xs::msg_t*) src_);
}
-void *zmq_msg_data (zmq_msg_t *msg_)
+void *xs_msg_data (xs_msg_t *msg_)
{
- return ((zmq::msg_t*) msg_)->data ();
+ return ((xs::msg_t*) msg_)->data ();
}
-size_t zmq_msg_size (zmq_msg_t *msg_)
+size_t xs_msg_size (xs_msg_t *msg_)
{
- return ((zmq::msg_t*) msg_)->size ();
+ return ((xs::msg_t*) msg_)->size ();
}
-int zmq_getmsgopt (zmq_msg_t *msg_, int option_, void *optval_,
+int xs_getmsgopt (xs_msg_t *msg_, int option_, void *optval_,
size_t *optvallen_)
{
switch (option_) {
- case ZMQ_MORE:
+ case XS_MORE:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
}
*((int*) optval_) =
- (((zmq::msg_t*) msg_)->flags () & zmq::msg_t::more) ? 1 : 0;
+ (((xs::msg_t*) msg_)->flags () & xs::msg_t::more) ? 1 : 0;
*optvallen_ = sizeof (int);
return 0;
default:
@@ -360,9 +360,9 @@ int zmq_getmsgopt (zmq_msg_t *msg_, int option_, void *optval_,
}
}
-int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
+int xs_poll (xs_pollitem_t *items_, int nitems_, long timeout_)
{
-#if defined ZMQ_POLL_BASED_ON_POLL
+#if defined XS_POLL_BASED_ON_POLL
if (unlikely (nitems_ < 0)) {
errno = EINVAL;
return -1;
@@ -370,10 +370,10 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
if (unlikely (nitems_ == 0)) {
if (timeout_ == 0)
return 0;
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
Sleep (timeout_ > 0 ? timeout_ : INFINITE);
return 0;
-#elif defined ZMQ_HAVE_ANDROID
+#elif defined XS_HAVE_ANDROID
usleep (timeout_ * 1000);
return 0;
#else
@@ -386,7 +386,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
return -1;
}
- zmq::clock_t clock;
+ xs::clock_t clock;
uint64_t now = 0;
uint64_t end = 0;
@@ -396,12 +396,12 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// Build pollset for poll () system call.
for (int i = 0; i != nitems_; i++) {
- // If the poll item is a 0MQ socket, we poll on the file descriptor
- // retrieved by the ZMQ_FD socket option.
+ // If the poll item is a Crossroads socket, we poll on the file
+ // descriptor retrieved by the XS_FD socket option.
if (items_ [i].socket) {
- size_t zmq_fd_size = sizeof (zmq::fd_t);
- if (zmq_getsockopt (items_ [i].socket, ZMQ_FD, &pollfds [i].fd,
- &zmq_fd_size) == -1) {
+ size_t xs_fd_size = sizeof (xs::fd_t);
+ if (xs_getsockopt (items_ [i].socket, XS_FD, &pollfds [i].fd,
+ &xs_fd_size) == -1) {
free (pollfds);
return -1;
}
@@ -412,8 +412,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
else {
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 & XS_POLLIN ? POLLIN : 0) |
+ (items_ [i].events & XS_POLLOUT ? POLLOUT : 0);
}
}
@@ -447,32 +447,32 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
items_ [i].revents = 0;
- // The poll item is a 0MQ socket. Retrieve pending events
- // using the ZMQ_EVENTS socket option.
+ // The poll item is a Crossroads socket. Retrieve pending events
+ // using the XS_EVENTS socket option.
if (items_ [i].socket) {
- size_t zmq_events_size = sizeof (uint32_t);
- uint32_t zmq_events;
- if (zmq_getsockopt (items_ [i].socket, ZMQ_EVENTS, &zmq_events,
- &zmq_events_size) == -1) {
+ size_t xs_events_size = sizeof (uint32_t);
+ uint32_t xs_events;
+ if (xs_getsockopt (items_ [i].socket, XS_EVENTS, &xs_events,
+ &xs_events_size) == -1) {
free (pollfds);
return -1;
}
- if ((items_ [i].events & ZMQ_POLLOUT) &&
- (zmq_events & ZMQ_POLLOUT))
- items_ [i].revents |= ZMQ_POLLOUT;
- if ((items_ [i].events & ZMQ_POLLIN) &&
- (zmq_events & ZMQ_POLLIN))
- items_ [i].revents |= ZMQ_POLLIN;
+ if ((items_ [i].events & XS_POLLOUT) &&
+ (xs_events & XS_POLLOUT))
+ items_ [i].revents |= XS_POLLOUT;
+ if ((items_ [i].events & XS_POLLIN) &&
+ (xs_events & XS_POLLIN))
+ items_ [i].revents |= XS_POLLIN;
}
// Else, the poll item is a raw file descriptor, simply convert
- // the events to zmq_pollitem_t-style format.
+ // the events to xs_pollitem_t-style format.
else {
if (pollfds [i].revents & POLLIN)
- items_ [i].revents |= ZMQ_POLLIN;
+ items_ [i].revents |= XS_POLLIN;
if (pollfds [i].revents & POLLOUT)
- items_ [i].revents |= ZMQ_POLLOUT;
+ items_ [i].revents |= XS_POLLOUT;
if (pollfds [i].revents & ~(POLLIN | POLLOUT))
- items_ [i].revents |= ZMQ_POLLERR;
+ items_ [i].revents |= XS_POLLERR;
}
if (items_ [i].revents)
@@ -517,7 +517,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
free (pollfds);
return nevents;
-#elif defined ZMQ_POLL_BASED_ON_SELECT
+#elif defined XS_POLL_BASED_ON_SELECT
if (unlikely (nitems_ < 0)) {
errno = EINVAL;
@@ -526,7 +526,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
if (unlikely (nitems_ == 0)) {
if (timeout_ == 0)
return 0;
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
Sleep (timeout_ > 0 ? timeout_ : INFINITE);
return 0;
#else
@@ -539,13 +539,13 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
return -1;
}
- zmq::clock_t clock;
+ xs::clock_t clock;
uint64_t now = 0;
uint64_t end = 0;
// Ensure we do not attempt to select () on more than FD_SETSIZE
// file descriptors.
- zmq_assert (nitems_ <= FD_SETSIZE);
+ xs_assert (nitems_ <= FD_SETSIZE);
fd_set pollset_in;
FD_ZERO (&pollset_in);
@@ -554,18 +554,19 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
fd_set pollset_err;
FD_ZERO (&pollset_err);
- zmq::fd_t maxfd = 0;
+ xs::fd_t maxfd = 0;
// Build the fd_sets for passing to select ().
for (int i = 0; i != nitems_; i++) {
- // If the poll item is a 0MQ socket we are interested in input on the
- // notification file descriptor retrieved by the ZMQ_FD socket option.
+ // If the poll item is a Crossroads socket we are interested in input
+ // on the notification file descriptor retrieved by the XS_FD socket
+ // option.
if (items_ [i].socket) {
- size_t zmq_fd_size = sizeof (zmq::fd_t);
- zmq::fd_t notify_fd;
- if (zmq_getsockopt (items_ [i].socket, ZMQ_FD, &notify_fd,
- &zmq_fd_size) == -1)
+ size_t xs_fd_size = sizeof (xs::fd_t);
+ xs::fd_t notify_fd;
+ if (xs_getsockopt (items_ [i].socket, XS_FD, &notify_fd,
+ &xs_fd_size) == -1)
return -1;
if (items_ [i].events) {
FD_SET (notify_fd, &pollset_in);
@@ -576,11 +577,11 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// Else, the poll item is a raw file descriptor. Convert the poll item
// events to the appropriate fd_sets.
else {
- if (items_ [i].events & ZMQ_POLLIN)
+ if (items_ [i].events & XS_POLLIN)
FD_SET (items_ [i].fd, &pollset_in);
- if (items_ [i].events & ZMQ_POLLOUT)
+ if (items_ [i].events & XS_POLLOUT)
FD_SET (items_ [i].fd, &pollset_out);
- if (items_ [i].events & ZMQ_POLLERR)
+ if (items_ [i].events & XS_POLLERR)
FD_SET (items_ [i].fd, &pollset_err);
if (maxfd < items_ [i].fd)
maxfd = items_ [i].fd;
@@ -614,10 +615,10 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
memcpy (&inset, &pollset_in, sizeof (fd_set));
memcpy (&outset, &pollset_out, sizeof (fd_set));
memcpy (&errset, &pollset_err, sizeof (fd_set));
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
int rc = select (0, &inset, &outset, &errset, ptimeout);
if (unlikely (rc == SOCKET_ERROR)) {
- zmq::wsa_error_to_errno ();
+ xs::wsa_error_to_errno ();
if (errno == ENOTSOCK)
return -1;
wsa_assert (false);
@@ -638,30 +639,30 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
items_ [i].revents = 0;
- // The poll item is a 0MQ socket. Retrieve pending events
- // using the ZMQ_EVENTS socket option.
+ // The poll item is a Crossroads socket. Retrieve pending events
+ // using the XS_EVENTS socket option.
if (items_ [i].socket) {
- size_t zmq_events_size = sizeof (uint32_t);
- uint32_t zmq_events;
- if (zmq_getsockopt (items_ [i].socket, ZMQ_EVENTS, &zmq_events,
- &zmq_events_size) == -1)
+ size_t xs_events_size = sizeof (uint32_t);
+ uint32_t xs_events;
+ if (xs_getsockopt (items_ [i].socket, XS_EVENTS, &xs_events,
+ &xs_events_size) == -1)
return -1;
- if ((items_ [i].events & ZMQ_POLLOUT) &&
- (zmq_events & ZMQ_POLLOUT))
- items_ [i].revents |= ZMQ_POLLOUT;
- if ((items_ [i].events & ZMQ_POLLIN) &&
- (zmq_events & ZMQ_POLLIN))
- items_ [i].revents |= ZMQ_POLLIN;
+ if ((items_ [i].events & XS_POLLOUT) &&
+ (xs_events & XS_POLLOUT))
+ items_ [i].revents |= XS_POLLOUT;
+ if ((items_ [i].events & XS_POLLIN) &&
+ (xs_events & XS_POLLIN))
+ items_ [i].revents |= XS_POLLIN;
}
// Else, the poll item is a raw file descriptor, simply convert
- // the events to zmq_pollitem_t-style format.
+ // the events to xs_pollitem_t-style format.
else {
if (FD_ISSET (items_ [i].fd, &inset))
- items_ [i].revents |= ZMQ_POLLIN;
+ items_ [i].revents |= XS_POLLIN;
if (FD_ISSET (items_ [i].fd, &outset))
- items_ [i].revents |= ZMQ_POLLOUT;
+ items_ [i].revents |= XS_POLLOUT;
if (FD_ISSET (items_ [i].fd, &errset))
- items_ [i].revents |= ZMQ_POLLERR;
+ items_ [i].revents |= XS_POLLERR;
}
if (items_ [i].revents)
@@ -712,15 +713,15 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
#endif
}
-int zmq_errno ()
+int xs_errno ()
{
return errno;
}
-#if defined ZMQ_POLL_BASED_ON_SELECT
-#undef ZMQ_POLL_BASED_ON_SELECT
+#if defined XS_POLL_BASED_ON_SELECT
+#undef XS_POLL_BASED_ON_SELECT
#endif
-#if defined ZMQ_POLL_BASED_ON_POLL
-#undef ZMQ_POLL_BASED_ON_POLL
+#if defined XS_POLL_BASED_ON_POLL
+#undef XS_POLL_BASED_ON_POLL
#endif
diff --git a/src/zmq_utils.cpp b/src/xs_utils.cpp
index 8f34134..e30ffe2 100644
--- a/src/zmq_utils.cpp
+++ b/src/xs_utils.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -21,7 +21,7 @@
#include "platform.hpp"
-#include "../include/zmq_utils.h"
+#include "../include/xs_utils.h"
#include <stdlib.h>
@@ -29,32 +29,32 @@
#include "clock.hpp"
#include "err.hpp"
-#if !defined ZMQ_HAVE_WINDOWS
+#if !defined XS_HAVE_WINDOWS
#include <unistd.h>
#else
#include "windows.hpp"
#endif
-void zmq_sleep (int seconds_)
+void xs_sleep (int seconds_)
{
-#if defined ZMQ_HAVE_WINDOWS
+#if defined XS_HAVE_WINDOWS
Sleep (seconds_ * 1000);
#else
sleep (seconds_);
#endif
}
-void *zmq_stopwatch_start ()
+void *xs_stopwatch_start ()
{
uint64_t *watch = (uint64_t*) malloc (sizeof (uint64_t));
alloc_assert (watch);
- *watch = zmq::clock_t::now_us ();
+ *watch = xs::clock_t::now_us ();
return (void*) watch;
}
-unsigned long zmq_stopwatch_stop (void *watch_)
+unsigned long xs_stopwatch_stop (void *watch_)
{
- uint64_t end = zmq::clock_t::now_us ();
+ uint64_t end = xs::clock_t::now_us ();
uint64_t start = *(uint64_t*) watch_;
free (watch_);
return (unsigned long) (end - start);
diff --git a/src/xsub.cpp b/src/xsub.cpp
index e227c75..edde39e 100644
--- a/src/xsub.cpp
+++ b/src/xsub.cpp
@@ -3,14 +3,14 @@
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -24,12 +24,12 @@
#include "xsub.hpp"
#include "err.hpp"
-zmq::xsub_t::xsub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
+xs::xsub_t::xsub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_),
has_message (false),
more (false)
{
- options.type = ZMQ_XSUB;
+ options.type = XS_XSUB;
// When socket is being closed down we don't want to wait till pending
// subscription commands are sent to the wire.
@@ -39,15 +39,15 @@ zmq::xsub_t::xsub_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
errno_assert (rc == 0);
}
-zmq::xsub_t::~xsub_t ()
+xs::xsub_t::~xsub_t ()
{
int rc = message.close ();
errno_assert (rc == 0);
}
-void zmq::xsub_t::xattach_pipe (pipe_t *pipe_)
+void xs::xsub_t::xattach_pipe (pipe_t *pipe_)
{
- zmq_assert (pipe_);
+ xs_assert (pipe_);
fq.attach (pipe_);
dist.attach (pipe_);
@@ -56,30 +56,30 @@ void zmq::xsub_t::xattach_pipe (pipe_t *pipe_)
pipe_->flush ();
}
-void zmq::xsub_t::xread_activated (pipe_t *pipe_)
+void xs::xsub_t::xread_activated (pipe_t *pipe_)
{
fq.activated (pipe_);
}
-void zmq::xsub_t::xwrite_activated (pipe_t *pipe_)
+void xs::xsub_t::xwrite_activated (pipe_t *pipe_)
{
dist.activated (pipe_);
}
-void zmq::xsub_t::xterminated (pipe_t *pipe_)
+void xs::xsub_t::xterminated (pipe_t *pipe_)
{
fq.terminated (pipe_);
dist.terminated (pipe_);
}
-void zmq::xsub_t::xhiccuped (pipe_t *pipe_)
+void xs::xsub_t::xhiccuped (pipe_t *pipe_)
{
// Send all the cached subscriptions to the hiccuped pipe.
subscriptions.apply (send_subscription, pipe_);
pipe_->flush ();
}
-int zmq::xsub_t::xsend (msg_t *msg_, int flags_)
+int xs::xsub_t::xsend (msg_t *msg_, int flags_)
{
size_t size = msg_->size ();
unsigned char *data = (unsigned char*) msg_->data ();
@@ -104,19 +104,19 @@ int zmq::xsub_t::xsend (msg_t *msg_, int flags_)
return 0;
}
- zmq_assert (false);
+ xs_assert (false);
return -1;
}
-bool zmq::xsub_t::xhas_out ()
+bool xs::xsub_t::xhas_out ()
{
// Subscription can be added/removed anytime.
return true;
}
-int zmq::xsub_t::xrecv (msg_t *msg_, int flags_)
+int xs::xsub_t::xrecv (msg_t *msg_, int flags_)
{
- // If there's already a message prepared by a previous call to zmq_poll,
+ // If there's already a message prepared by a previous call to xs_poll,
// return it straight ahead.
if (has_message) {
int rc = msg_->move (message);
@@ -149,19 +149,19 @@ int zmq::xsub_t::xrecv (msg_t *msg_, int flags_)
// Message doesn't match. Pop any remaining parts of the message
// from the pipe.
while (msg_->flags () & msg_t::more) {
- rc = fq.recv (msg_, ZMQ_DONTWAIT);
- zmq_assert (rc == 0);
+ rc = fq.recv (msg_, XS_DONTWAIT);
+ xs_assert (rc == 0);
}
}
}
-bool zmq::xsub_t::xhas_in ()
+bool xs::xsub_t::xhas_in ()
{
// There are subsequent parts of the partly-read message available.
if (more)
return true;
- // If there's already a message prepared by a previous call to zmq_poll,
+ // If there's already a message prepared by a previous call to xs_poll,
// return straight ahead.
if (has_message)
return true;
@@ -171,12 +171,12 @@ bool zmq::xsub_t::xhas_in ()
while (true) {
// Get a message using fair queueing algorithm.
- int rc = fq.recv (&message, ZMQ_DONTWAIT);
+ int rc = fq.recv (&message, XS_DONTWAIT);
// If there's no message available, return immediately.
// The same when error occurs.
if (rc != 0) {
- zmq_assert (errno == EAGAIN);
+ xs_assert (errno == EAGAIN);
return false;
}
@@ -189,18 +189,18 @@ bool zmq::xsub_t::xhas_in ()
// Message doesn't match. Pop any remaining parts of the message
// from the pipe.
while (message.flags () & msg_t::more) {
- rc = fq.recv (&message, ZMQ_DONTWAIT);
- zmq_assert (rc == 0);
+ rc = fq.recv (&message, XS_DONTWAIT);
+ xs_assert (rc == 0);
}
}
}
-bool zmq::xsub_t::match (msg_t *msg_)
+bool xs::xsub_t::match (msg_t *msg_)
{
return subscriptions.check ((unsigned char*) msg_->data (), msg_->size ());
}
-void zmq::xsub_t::send_subscription (unsigned char *data_, size_t size_,
+void xs::xsub_t::send_subscription (unsigned char *data_, size_t size_,
void *arg_)
{
pipe_t *pipe = (pipe_t*) arg_;
@@ -208,17 +208,17 @@ void zmq::xsub_t::send_subscription (unsigned char *data_, size_t size_,
// Create the subsctription message.
msg_t msg;
int rc = msg.init_size (size_ + 1);
- zmq_assert (rc == 0);
+ xs_assert (rc == 0);
unsigned char *data = (unsigned char*) msg.data ();
data [0] = 1;
memcpy (data + 1, data_, size_);
// Send it to the pipe.
bool sent = pipe->write (&msg);
- zmq_assert (sent);
+ xs_assert (sent);
}
-zmq::xsub_session_t::xsub_session_t (io_thread_t *io_thread_, bool connect_,
+xs::xsub_session_t::xsub_session_t (io_thread_t *io_thread_, bool connect_,
socket_base_t *socket_, const options_t &options_,
const char *protocol_, const char *address_) :
session_base_t (io_thread_, connect_, socket_, options_, protocol_,
@@ -226,7 +226,7 @@ zmq::xsub_session_t::xsub_session_t (io_thread_t *io_thread_, bool connect_,
{
}
-zmq::xsub_session_t::~xsub_session_t ()
+xs::xsub_session_t::~xsub_session_t ()
{
}
diff --git a/src/xsub.hpp b/src/xsub.hpp
index 97b2df2..6b1e26b 100644
--- a/src/xsub.hpp
+++ b/src/xsub.hpp
@@ -2,14 +2,14 @@
Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -18,8 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_XSUB_HPP_INCLUDED__
-#define __ZMQ_XSUB_HPP_INCLUDED__
+#ifndef __XS_XSUB_HPP_INCLUDED__
+#define __XS_XSUB_HPP_INCLUDED__
#include "socket_base.hpp"
#include "session_base.hpp"
@@ -27,7 +27,7 @@
#include "fq.hpp"
#include "trie.hpp"
-namespace zmq
+namespace xs
{
class ctx_t;
@@ -39,26 +39,26 @@ namespace zmq
{
public:
- xsub_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
+ xsub_t (xs::ctx_t *parent_, uint32_t tid_, int sid_);
~xsub_t ();
protected:
// Overloads of functions from socket_base_t.
- void xattach_pipe (zmq::pipe_t *pipe_);
- int xsend (zmq::msg_t *msg_, int flags_);
+ void xattach_pipe (xs::pipe_t *pipe_);
+ int xsend (xs::msg_t *msg_, int flags_);
bool xhas_out ();
- int xrecv (zmq::msg_t *msg_, int flags_);
+ int xrecv (xs::msg_t *msg_, int flags_);
bool xhas_in ();
- void xread_activated (zmq::pipe_t *pipe_);
- void xwrite_activated (zmq::pipe_t *pipe_);
+ void xread_activated (xs::pipe_t *pipe_);
+ void xwrite_activated (xs::pipe_t *pipe_);
void xhiccuped (pipe_t *pipe_);
- void xterminated (zmq::pipe_t *pipe_);
+ void xterminated (xs::pipe_t *pipe_);
private:
// Check whether the message matches at least one subscription.
- bool match (zmq::msg_t *msg_);
+ bool match (xs::msg_t *msg_);
// Function to be applied to the trie to send all the subsciptions
// upstream.
diff --git a/src/ypipe.hpp b/src/ypipe.hpp
index 74a96bc..019904e 100644
--- a/src/ypipe.hpp
+++ b/src/ypipe.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,14 +19,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_YPIPE_HPP_INCLUDED__
-#define __ZMQ_YPIPE_HPP_INCLUDED__
+#ifndef __XS_YPIPE_HPP_INCLUDED__
+#define __XS_YPIPE_HPP_INCLUDED__
#include "atomic_ptr.hpp"
#include "yqueue.hpp"
#include "platform.hpp"
-namespace zmq
+namespace xs
{
// Lock-free queue implementation.
@@ -59,10 +59,10 @@ namespace zmq
}
// Following function (write) deliberately copies uninitialised data
- // when used with zmq_msg. Initialising the VSM body for
+ // when used with xs_msg. Initialising the VSM body for
// non-VSM messages won't be good for performance.
-#ifdef ZMQ_HAVE_OPENVMS
+#ifdef XS_HAVE_OPENVMS
#pragma message save
#pragma message disable(UNINIT)
#endif
@@ -82,7 +82,7 @@ namespace zmq
f = &queue.back ();
}
-#ifdef ZMQ_HAVE_OPENVMS
+#ifdef XS_HAVE_OPENVMS
#pragma message restore
#endif
@@ -170,7 +170,7 @@ namespace zmq
inline bool probe (bool (*fn)(T &))
{
bool rc = check_read ();
- zmq_assert (rc);
+ xs_assert (rc);
return (*fn) (queue.front ());
}
diff --git a/src/yqueue.hpp b/src/yqueue.hpp
index 1c83cb8..8628258 100644
--- a/src/yqueue.hpp
+++ b/src/yqueue.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2009 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_YQUEUE_HPP_INCLUDED__
-#define __ZMQ_YQUEUE_HPP_INCLUDED__
+#ifndef __XS_YQUEUE_HPP_INCLUDED__
+#define __XS_YQUEUE_HPP_INCLUDED__
#include <stdlib.h>
#include <stddef.h>
@@ -28,7 +28,7 @@
#include "err.hpp"
#include "atomic_ptr.hpp"
-namespace zmq
+namespace xs
{
// yqueue is an efficient queue implementation. The main goal is
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fb0c6f8..06830e2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,7 @@
INCLUDES = -I$(top_builddir)/include \
-I$(top_srcdir)/include
-LDADD = $(top_builddir)/src/libzmq.la
+LDADD = $(top_builddir)/src/libxs.la
noinst_PROGRAMS = test_pair_inproc \
test_pair_tcp \
diff --git a/tests/test_hwm.cpp b/tests/test_hwm.cpp
index d887b31..a1db711 100644
--- a/tests/test_hwm.cpp
+++ b/tests/test_hwm.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -28,30 +28,30 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_hwm running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
// Create pair of socket, each with high watermark of 2. Thus the total
// buffer space should be 4 messages.
- void *sb = zmq_socket (ctx, ZMQ_PULL);
+ void *sb = xs_socket (ctx, XS_PULL);
assert (sb);
int hwm = 2;
- int rc = zmq_setsockopt (sb, ZMQ_RCVHWM, &hwm, sizeof (hwm));
+ int rc = xs_setsockopt (sb, XS_RCVHWM, &hwm, sizeof (hwm));
assert (rc == 0);
- rc = zmq_bind (sb, "inproc://a");
+ rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PUSH);
+ void *sc = xs_socket (ctx, XS_PUSH);
assert (sc);
- rc = zmq_setsockopt (sc, ZMQ_SNDHWM, &hwm, sizeof (hwm));
+ rc = xs_setsockopt (sc, XS_SNDHWM, &hwm, sizeof (hwm));
assert (rc == 0);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
// Try to send 10 messages. Only 4 should succeed.
for (int i = 0; i < 10; i++)
{
- int rc = zmq_send (sc, NULL, 0, ZMQ_DONTWAIT);
+ int rc = xs_send (sc, NULL, 0, XS_DONTWAIT);
if (i < 4)
assert (rc == 0);
else
@@ -60,25 +60,25 @@ int main (int argc, char *argv [])
// There should be now 4 messages pending, consume them.
for (int i = 0; i != 4; i++) {
- rc = zmq_recv (sb, NULL, 0, 0);
+ rc = xs_recv (sb, NULL, 0, 0);
assert (rc == 0);
}
// Now it should be possible to send one more.
- rc = zmq_send (sc, NULL, 0, 0);
+ rc = xs_send (sc, NULL, 0, 0);
assert (rc == 0);
// Consume the remaining message.
- rc = zmq_recv (sb, NULL, 0, 0);
+ rc = xs_recv (sb, NULL, 0, 0);
assert (rc == 0);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0;
diff --git a/tests/test_invalid_rep.cpp b/tests/test_invalid_rep.cpp
index 9c77cc4..9ed2145 100644
--- a/tests/test_invalid_rep.cpp
+++ b/tests/test_invalid_rep.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,7 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
+#include "../include/xs.h"
#include <assert.h>
#include <stdio.h>
@@ -28,24 +28,24 @@ int main (int argc, char *argv [])
fprintf (stderr, "test_invalid_rep running...\n");
// Create REQ/XREP wiring.
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *xrep_socket = zmq_socket (ctx, ZMQ_XREP);
+ void *xrep_socket = xs_socket (ctx, XS_XREP);
assert (xrep_socket);
- void *req_socket = zmq_socket (ctx, ZMQ_REQ);
+ void *req_socket = xs_socket (ctx, XS_REQ);
assert (req_socket);
int linger = 0;
- int rc = zmq_setsockopt (xrep_socket, ZMQ_LINGER, &linger, sizeof (int));
+ int rc = xs_setsockopt (xrep_socket, XS_LINGER, &linger, sizeof (int));
assert (rc == 0);
- rc = zmq_setsockopt (req_socket, ZMQ_LINGER, &linger, sizeof (int));
+ rc = xs_setsockopt (req_socket, XS_LINGER, &linger, sizeof (int));
assert (rc == 0);
- rc = zmq_bind (xrep_socket, "inproc://hi");
+ rc = xs_bind (xrep_socket, "inproc://hi");
assert (rc == 0);
- rc = zmq_connect (req_socket, "inproc://hi");
+ rc = xs_connect (req_socket, "inproc://hi");
assert (rc == 0);
// Initial request.
- rc = zmq_send (req_socket, "r", 1, 0);
+ rc = xs_send (req_socket, "r", 1, 0);
assert (rc == 1);
// Receive the request.
@@ -53,36 +53,36 @@ int main (int argc, char *argv [])
int addr_size;
char bottom [1];
char body [1];
- addr_size = zmq_recv (xrep_socket, addr, sizeof (addr), 0);
+ addr_size = xs_recv (xrep_socket, addr, sizeof (addr), 0);
assert (addr_size >= 0);
- rc = zmq_recv (xrep_socket, bottom, sizeof (bottom), 0);
+ rc = xs_recv (xrep_socket, bottom, sizeof (bottom), 0);
assert (rc == 0);
- rc = zmq_recv (xrep_socket, body, sizeof (body), 0);
+ rc = xs_recv (xrep_socket, body, sizeof (body), 0);
assert (rc == 1);
// Send invalid reply.
- rc = zmq_send (xrep_socket, addr, addr_size, 0);
+ rc = xs_send (xrep_socket, addr, addr_size, 0);
assert (rc == addr_size);
// Send valid reply.
- rc = zmq_send (xrep_socket, addr, addr_size, ZMQ_SNDMORE);
+ rc = xs_send (xrep_socket, addr, addr_size, XS_SNDMORE);
assert (rc == addr_size);
- rc = zmq_send (xrep_socket, bottom, 0, ZMQ_SNDMORE);
+ rc = xs_send (xrep_socket, bottom, 0, XS_SNDMORE);
assert (rc == 0);
- rc = zmq_send (xrep_socket, "b", 1, 0);
+ rc = xs_send (xrep_socket, "b", 1, 0);
assert (rc == 1);
// Check whether we've got the valid reply.
- rc = zmq_recv (req_socket, body, sizeof (body), 0);
+ rc = xs_recv (req_socket, body, sizeof (body), 0);
assert (rc == 1);
assert (body [0] == 'b');
// Tear down the wiring.
- rc = zmq_close (xrep_socket);
+ rc = xs_close (xrep_socket);
assert (rc == 0);
- rc = zmq_close (req_socket);
+ rc = xs_close (req_socket);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0;
diff --git a/tests/test_msg_flags.cpp b/tests/test_msg_flags.cpp
index f836184..535a7d5 100644
--- a/tests/test_msg_flags.cpp
+++ b/tests/test_msg_flags.cpp
@@ -2,14 +2,14 @@
Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -21,62 +21,62 @@
#include <assert.h>
#include <string.h>
-#include "../include/zmq.h"
+#include "../include/xs.h"
int main (int argc, char *argv [])
{
// Create the infrastructure
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_XREP);
+ void *sb = xs_socket (ctx, XS_XREP);
assert (sb);
- int rc = zmq_bind (sb, "inproc://a");
+ int rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_XREQ);
+ void *sc = xs_socket (ctx, XS_XREQ);
assert (sc);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
// Send 2-part message.
- rc = zmq_send (sc, "A", 1, ZMQ_SNDMORE);
+ rc = xs_send (sc, "A", 1, XS_SNDMORE);
assert (rc == 1);
- rc = zmq_send (sc, "B", 1, 0);
+ rc = xs_send (sc, "B", 1, 0);
assert (rc == 1);
// Identity comes first.
- zmq_msg_t msg;
- rc = zmq_msg_init (&msg);
+ xs_msg_t msg;
+ rc = xs_msg_init (&msg);
assert (rc == 0);
- rc = zmq_recvmsg (sb, &msg, 0);
+ rc = xs_recvmsg (sb, &msg, 0);
assert (rc >= 0);
int more;
size_t more_size = sizeof (more);
- rc = zmq_getmsgopt (&msg, ZMQ_MORE, &more, &more_size);
+ rc = xs_getmsgopt (&msg, XS_MORE, &more, &more_size);
assert (rc == 0);
assert (more == 1);
// Then the first part of the message body.
- rc = zmq_recvmsg (sb, &msg, 0);
+ rc = xs_recvmsg (sb, &msg, 0);
assert (rc == 1);
more_size = sizeof (more);
- rc = zmq_getmsgopt (&msg, ZMQ_MORE, &more, &more_size);
+ rc = xs_getmsgopt (&msg, XS_MORE, &more, &more_size);
assert (rc == 0);
assert (more == 1);
// And finally, the second part of the message body.
- rc = zmq_recvmsg (sb, &msg, 0);
+ rc = xs_recvmsg (sb, &msg, 0);
assert (rc == 1);
more_size = sizeof (more);
- rc = zmq_getmsgopt (&msg, ZMQ_MORE, &more, &more_size);
+ rc = xs_getmsgopt (&msg, XS_MORE, &more, &more_size);
assert (rc == 0);
assert (more == 0);
// Deallocate the infrastructure.
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
}
diff --git a/tests/test_pair_inproc.cpp b/tests/test_pair_inproc.cpp
index 75a9720..d8f3726 100644
--- a/tests/test_pair_inproc.cpp
+++ b/tests/test_pair_inproc.cpp
@@ -2,14 +2,14 @@
Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_pair_inproc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_PAIR);
+ void *sb = xs_socket (ctx, XS_PAIR);
assert (sb);
- int rc = zmq_bind (sb, "inproc://a");
+ int rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PAIR);
+ void *sc = xs_socket (ctx, XS_PAIR);
assert (sc);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_pair_ipc.cpp b/tests/test_pair_ipc.cpp
index 96a265f..5b9b536 100644
--- a/tests/test_pair_ipc.cpp
+++ b/tests/test_pair_ipc.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_pair_ipc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_PAIR);
+ void *sb = xs_socket (ctx, XS_PAIR);
assert (sb);
- int rc = zmq_bind (sb, "ipc:///tmp/tester");
+ int rc = xs_bind (sb, "ipc:///tmp/tester");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PAIR);
+ void *sc = xs_socket (ctx, XS_PAIR);
assert (sc);
- rc = zmq_connect (sc, "ipc:///tmp/tester");
+ rc = xs_connect (sc, "ipc:///tmp/tester");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_pair_tcp.cpp b/tests/test_pair_tcp.cpp
index 464be5a..1c4bbf1 100644
--- a/tests/test_pair_tcp.cpp
+++ b/tests/test_pair_tcp.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -27,28 +27,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_pair_tcp running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_PAIR);
+ void *sb = xs_socket (ctx, XS_PAIR);
assert (sb);
- int rc = zmq_bind (sb, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (sb, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PAIR);
+ void *sc = xs_socket (ctx, XS_PAIR);
assert (sc);
- rc = zmq_connect (sc, "tcp://127.0.0.1:5560");
+ rc = xs_connect (sc, "tcp://127.0.0.1:5560");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_device.cpp b/tests/test_reqrep_device.cpp
index d861cec..5571eed 100644
--- a/tests/test_reqrep_device.cpp
+++ b/tests/test_reqrep_device.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -23,119 +23,119 @@
#include <string.h>
#include <stdio.h>
-#include "../include/zmq.h"
+#include "../include/xs.h"
int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_device running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
// Create a req/rep device.
- void *xreq = zmq_socket (ctx, ZMQ_XREQ);
+ void *xreq = xs_socket (ctx, XS_XREQ);
assert (xreq);
- int rc = zmq_bind (xreq, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (xreq, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *xrep = zmq_socket (ctx, ZMQ_XREP);
+ void *xrep = xs_socket (ctx, XS_XREP);
assert (xrep);
- rc = zmq_bind (xrep, "tcp://127.0.0.1:5561");
+ rc = xs_bind (xrep, "tcp://127.0.0.1:5561");
assert (rc == 0);
// Create a worker.
- void *rep = zmq_socket (ctx, ZMQ_REP);
+ void *rep = xs_socket (ctx, XS_REP);
assert (rep);
- rc = zmq_connect (rep, "tcp://127.0.0.1:5560");
+ rc = xs_connect (rep, "tcp://127.0.0.1:5560");
assert (rc == 0);
// Create a client.
- void *req = zmq_socket (ctx, ZMQ_REQ);
+ void *req = xs_socket (ctx, XS_REQ);
assert (req);
- rc = zmq_connect (req, "tcp://127.0.0.1:5561");
+ rc = xs_connect (req, "tcp://127.0.0.1:5561");
assert (rc == 0);
// Send a request.
- rc = zmq_send (req, "ABC", 3, ZMQ_SNDMORE);
+ rc = xs_send (req, "ABC", 3, XS_SNDMORE);
assert (rc == 3);
- rc = zmq_send (req, "DEF", 3, 0);
+ rc = xs_send (req, "DEF", 3, 0);
assert (rc == 3);
// Pass the request through the device.
for (int i = 0; i != 4; i++) {
- zmq_msg_t msg;
- rc = zmq_msg_init (&msg);
+ xs_msg_t msg;
+ rc = xs_msg_init (&msg);
assert (rc == 0);
- rc = zmq_recvmsg (xrep, &msg, 0);
+ rc = xs_recvmsg (xrep, &msg, 0);
assert (rc >= 0);
int rcvmore;
size_t sz = sizeof (rcvmore);
- rc = zmq_getsockopt (xrep, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (xrep, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
- rc = zmq_sendmsg (xreq, &msg, rcvmore ? ZMQ_SNDMORE : 0);
+ rc = xs_sendmsg (xreq, &msg, rcvmore ? XS_SNDMORE : 0);
assert (rc >= 0);
}
// Receive the request.
char buff [3];
- rc = zmq_recv (rep, buff, 3, 0);
+ rc = xs_recv (rep, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "ABC", 3) == 0);
int rcvmore;
size_t sz = sizeof (rcvmore);
- rc = zmq_getsockopt (rep, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (rep, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (rcvmore);
- rc = zmq_recv (rep, buff, 3, 0);
+ rc = xs_recv (rep, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "DEF", 3) == 0);
- rc = zmq_getsockopt (rep, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (rep, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (!rcvmore);
// Send the reply.
- rc = zmq_send (rep, "GHI", 3, ZMQ_SNDMORE);
+ rc = xs_send (rep, "GHI", 3, XS_SNDMORE);
assert (rc == 3);
- rc = zmq_send (rep, "JKL", 3, 0);
+ rc = xs_send (rep, "JKL", 3, 0);
assert (rc == 3);
// Pass the reply through the device.
for (int i = 0; i != 4; i++) {
- zmq_msg_t msg;
- rc = zmq_msg_init (&msg);
+ xs_msg_t msg;
+ rc = xs_msg_init (&msg);
assert (rc == 0);
- rc = zmq_recvmsg (xreq, &msg, 0);
+ rc = xs_recvmsg (xreq, &msg, 0);
assert (rc >= 0);
int rcvmore;
- rc = zmq_getsockopt (xreq, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (xreq, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
- rc = zmq_sendmsg (xrep, &msg, rcvmore ? ZMQ_SNDMORE : 0);
+ rc = xs_sendmsg (xrep, &msg, rcvmore ? XS_SNDMORE : 0);
assert (rc >= 0);
}
// Receive the reply.
- rc = zmq_recv (req, buff, 3, 0);
+ rc = xs_recv (req, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "GHI", 3) == 0);
- rc = zmq_getsockopt (req, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (req, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (rcvmore);
- rc = zmq_recv (req, buff, 3, 0);
+ rc = xs_recv (req, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "JKL", 3) == 0);
- rc = zmq_getsockopt (req, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (req, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (!rcvmore);
// Clean up.
- rc = zmq_close (req);
+ rc = xs_close (req);
assert (rc == 0);
- rc = zmq_close (rep);
+ rc = xs_close (rep);
assert (rc == 0);
- rc = zmq_close (xrep);
+ rc = xs_close (xrep);
assert (rc == 0);
- rc = zmq_close (xreq);
+ rc = xs_close (xreq);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_inproc.cpp b/tests/test_reqrep_inproc.cpp
index ae998eb..f715e4c 100644
--- a/tests/test_reqrep_inproc.cpp
+++ b/tests/test_reqrep_inproc.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_inproc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_REP);
+ void *sb = xs_socket (ctx, XS_REP);
assert (sb);
- int rc = zmq_bind (sb, "inproc://a");
+ int rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_REQ);
+ void *sc = xs_socket (ctx, XS_REQ);
assert (sc);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_ipc.cpp b/tests/test_reqrep_ipc.cpp
index fd9b28d..652c372 100644
--- a/tests/test_reqrep_ipc.cpp
+++ b/tests/test_reqrep_ipc.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_ipc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_REP);
+ void *sb = xs_socket (ctx, XS_REP);
assert (sb);
- int rc = zmq_bind (sb, "ipc:///tmp/tester");
+ int rc = xs_bind (sb, "ipc:///tmp/tester");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_REQ);
+ void *sc = xs_socket (ctx, XS_REQ);
assert (sc);
- rc = zmq_connect (sc, "ipc:///tmp/tester");
+ rc = xs_connect (sc, "ipc:///tmp/tester");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_tcp.cpp b/tests/test_reqrep_tcp.cpp
index 1e6bbbb..ea33709 100644
--- a/tests/test_reqrep_tcp.cpp
+++ b/tests/test_reqrep_tcp.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -27,28 +27,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_tcp running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_REP);
+ void *sb = xs_socket (ctx, XS_REP);
assert (sb);
- int rc = zmq_bind (sb, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (sb, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_REQ);
+ void *sc = xs_socket (ctx, XS_REQ);
assert (sc);
- rc = zmq_connect (sc, "tcp://127.0.0.1:5560");
+ rc = xs_connect (sc, "tcp://127.0.0.1:5560");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_shutdown_stress.cpp b/tests/test_shutdown_stress.cpp
index 811637c..021a00e 100644
--- a/tests/test_shutdown_stress.cpp
+++ b/tests/test_shutdown_stress.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,7 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
+#include "../include/xs.h"
#include <assert.h>
#include <pthread.h>
#include <stddef.h>
@@ -33,11 +33,11 @@ extern "C"
{
int rc;
- rc = zmq_connect (s, "tcp://127.0.0.1:5560");
+ rc = xs_connect (s, "tcp://127.0.0.1:5560");
assert (rc == 0);
// Start closing the socket while the connecting process is underway.
- rc = zmq_close (s);
+ rc = xs_close (s);
assert (rc == 0);
return NULL;
@@ -59,17 +59,17 @@ int main (int argc, char *argv [])
for (j = 0; j != 10; j++) {
// Check the shutdown with many parallel I/O threads.
- ctx = zmq_init (7);
+ ctx = xs_init (7);
assert (ctx);
- s1 = zmq_socket (ctx, ZMQ_PUB);
+ s1 = xs_socket (ctx, XS_PUB);
assert (s1);
- rc = zmq_bind (s1, "tcp://127.0.0.1:5560");
+ rc = xs_bind (s1, "tcp://127.0.0.1:5560");
assert (rc == 0);
for (i = 0; i != THREAD_COUNT; i++) {
- s2 = zmq_socket (ctx, ZMQ_SUB);
+ s2 = xs_socket (ctx, XS_SUB);
assert (s2);
rc = pthread_create (&threads [i], NULL, worker, s2);
assert (rc == 0);
@@ -80,10 +80,10 @@ int main (int argc, char *argv [])
assert (rc == 0);
}
- rc = zmq_close (s1);
+ rc = xs_close (s1);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
}
diff --git a/tests/test_sub_forward.cpp b/tests/test_sub_forward.cpp
index 36a7f4a..56d34c7 100644
--- a/tests/test_sub_forward.cpp
+++ b/tests/test_sub_forward.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -22,76 +22,76 @@
#include <assert.h>
#include <stdio.h>
-#include "../include/zmq.h"
-#include "../include/zmq_utils.h"
+#include "../include/xs.h"
+#include "../include/xs_utils.h"
int main (int argc, char *argv [])
{
fprintf (stderr, "test_sub_forward running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
// First, create an intermediate device.
- void *xpub = zmq_socket (ctx, ZMQ_XPUB);
+ void *xpub = xs_socket (ctx, XS_XPUB);
assert (xpub);
- int rc = zmq_bind (xpub, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (xpub, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *xsub = zmq_socket (ctx, ZMQ_XSUB);
+ void *xsub = xs_socket (ctx, XS_XSUB);
assert (xsub);
- rc = zmq_bind (xsub, "tcp://127.0.0.1:5561");
+ rc = xs_bind (xsub, "tcp://127.0.0.1:5561");
assert (rc == 0);
// Create a publisher.
- void *pub = zmq_socket (ctx, ZMQ_PUB);
+ void *pub = xs_socket (ctx, XS_PUB);
assert (pub);
- rc = zmq_connect (pub, "tcp://127.0.0.1:5561");
+ rc = xs_connect (pub, "tcp://127.0.0.1:5561");
assert (rc == 0);
// Create a subscriber.
- void *sub = zmq_socket (ctx, ZMQ_SUB);
+ void *sub = xs_socket (ctx, XS_SUB);
assert (sub);
- rc = zmq_connect (sub, "tcp://127.0.0.1:5560");
+ rc = xs_connect (sub, "tcp://127.0.0.1:5560");
assert (rc == 0);
// Subscribe for all messages.
- rc = zmq_setsockopt (sub, ZMQ_SUBSCRIBE, "", 0);
+ rc = xs_setsockopt (sub, XS_SUBSCRIBE, "", 0);
assert (rc == 0);
// Pass the subscription upstream through the device.
char buff [32];
- rc = zmq_recv (xpub, buff, sizeof (buff), 0);
+ rc = xs_recv (xpub, buff, sizeof (buff), 0);
assert (rc >= 0);
- rc = zmq_send (xsub, buff, rc, 0);
+ rc = xs_send (xsub, buff, rc, 0);
assert (rc >= 0);
// Wait a bit till the subscription gets to the publisher.
- zmq_sleep (1);
+ xs_sleep (1);
// Send an empty message.
- rc = zmq_send (pub, NULL, 0, 0);
+ rc = xs_send (pub, NULL, 0, 0);
assert (rc == 0);
// Pass the message downstream through the device.
- rc = zmq_recv (xsub, buff, sizeof (buff), 0);
+ rc = xs_recv (xsub, buff, sizeof (buff), 0);
assert (rc >= 0);
- rc = zmq_send (xpub, buff, rc, 0);
+ rc = xs_send (xpub, buff, rc, 0);
assert (rc >= 0);
// Receive the message in the subscriber.
- rc = zmq_recv (sub, buff, sizeof (buff), 0);
+ rc = xs_recv (sub, buff, sizeof (buff), 0);
assert (rc == 0);
// Clean up.
- rc = zmq_close (xpub);
+ rc = xs_close (xpub);
assert (rc == 0);
- rc = zmq_close (xsub);
+ rc = xs_close (xsub);
assert (rc == 0);
- rc = zmq_close (pub);
+ rc = xs_close (pub);
assert (rc == 0);
- rc = zmq_close (sub);
+ rc = xs_close (sub);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_timeo.cpp b/tests/test_timeo.cpp
index e5ce0ac..79b4d39 100644
--- a/tests/test_timeo.cpp
+++ b/tests/test_timeo.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -23,8 +23,8 @@
#include <pthread.h>
#include <stdio.h>
-#include "../include/zmq.h"
-#include "../include/zmq_utils.h"
+#include "../include/xs.h"
+#include "../include/xs_utils.h"
extern "C"
{
@@ -32,13 +32,13 @@ extern "C"
{
// Worker thread connects after delay of 1 second. Then it waits
// for 1 more second, so that async connect has time to succeed.
- zmq_sleep (1);
- void *sc = zmq_socket (ctx, ZMQ_PUSH);
+ xs_sleep (1);
+ void *sc = xs_socket (ctx, XS_PUSH);
assert (sc);
- int rc = zmq_connect (sc, "inproc://timeout_test");
+ int rc = xs_connect (sc, "inproc://timeout_test");
assert (rc == 0);
- zmq_sleep (1);
- rc = zmq_close (sc);
+ xs_sleep (1);
+ rc = xs_close (sc);
assert (rc == 0);
return NULL;
}
@@ -48,69 +48,69 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_timeo running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
// Create a disconnected socket.
- void *sb = zmq_socket (ctx, ZMQ_PULL);
+ void *sb = xs_socket (ctx, XS_PULL);
assert (sb);
- int rc = zmq_bind (sb, "inproc://timeout_test");
+ int rc = xs_bind (sb, "inproc://timeout_test");
assert (rc == 0);
// Check whether non-blocking recv returns immediately.
char buf [] = "12345678ABCDEFGH12345678abcdefgh";
- rc = zmq_recv (sb, buf, 32, ZMQ_DONTWAIT);
+ rc = xs_recv (sb, buf, 32, XS_DONTWAIT);
assert (rc == -1);
- assert (zmq_errno() == EAGAIN);
+ assert (xs_errno() == EAGAIN);
// Check whether recv timeout is honoured.
int timeout = 500;
size_t timeout_size = sizeof timeout;
- rc = zmq_setsockopt(sb, ZMQ_RCVTIMEO, &timeout, timeout_size);
+ rc = xs_setsockopt(sb, XS_RCVTIMEO, &timeout, timeout_size);
assert (rc == 0);
- void *watch = zmq_stopwatch_start ();
- rc = zmq_recv (sb, buf, 32, 0);
+ void *watch = xs_stopwatch_start ();
+ rc = xs_recv (sb, buf, 32, 0);
assert (rc == -1);
- assert (zmq_errno () == EAGAIN);
- unsigned long elapsed = zmq_stopwatch_stop (watch);
+ assert (xs_errno () == EAGAIN);
+ unsigned long elapsed = xs_stopwatch_stop (watch);
assert (elapsed > 440000 && elapsed < 550000);
// Check whether connection during the wait doesn't distort the timeout.
timeout = 2000;
- rc = zmq_setsockopt(sb, ZMQ_RCVTIMEO, &timeout, timeout_size);
+ rc = xs_setsockopt(sb, XS_RCVTIMEO, &timeout, timeout_size);
assert (rc == 0);
pthread_t thread;
rc = pthread_create (&thread, NULL, worker, ctx);
assert (rc == 0);
- watch = zmq_stopwatch_start ();
- rc = zmq_recv (sb, buf, 32, 0);
+ watch = xs_stopwatch_start ();
+ rc = xs_recv (sb, buf, 32, 0);
assert (rc == -1);
- assert (zmq_errno () == EAGAIN);
- elapsed = zmq_stopwatch_stop (watch);
+ assert (xs_errno () == EAGAIN);
+ elapsed = xs_stopwatch_stop (watch);
assert (elapsed > 1900000 && elapsed < 2100000);
rc = pthread_join (thread, NULL);
assert (rc == 0);
// Check that timeouts don't break normal message transfer.
- void *sc = zmq_socket (ctx, ZMQ_PUSH);
+ void *sc = xs_socket (ctx, XS_PUSH);
assert (sc);
- rc = zmq_setsockopt(sb, ZMQ_RCVTIMEO, &timeout, timeout_size);
+ rc = xs_setsockopt(sb, XS_RCVTIMEO, &timeout, timeout_size);
assert (rc == 0);
- rc = zmq_setsockopt(sb, ZMQ_SNDTIMEO, &timeout, timeout_size);
+ rc = xs_setsockopt(sb, XS_SNDTIMEO, &timeout, timeout_size);
assert (rc == 0);
- rc = zmq_connect (sc, "inproc://timeout_test");
+ rc = xs_connect (sc, "inproc://timeout_test");
assert (rc == 0);
- rc = zmq_send (sc, buf, 32, 0);
+ rc = xs_send (sc, buf, 32, 0);
assert (rc == 32);
- rc = zmq_recv (sb, buf, 32, 0);
+ rc = xs_recv (sb, buf, 32, 0);
assert (rc == 32);
// Clean-up.
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/testutil.hpp b/tests/testutil.hpp
index e68dc32..8dbdbdb 100644
--- a/tests/testutil.hpp
+++ b/tests/testutil.hpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2009-2011 250bpm s.r.o.
+ Copyright (c) 2009-2012 250bpm s.r.o.
Copyright (c) 2007-2011 iMatix Corporation
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads 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,
+ Crossroads 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.
@@ -19,53 +19,53 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_TEST_TESTUTIL_HPP_INCLUDED__
-#define __ZMQ_TEST_TESTUTIL_HPP_INCLUDED__
+#ifndef __XS_TEST_TESTUTIL_HPP_INCLUDED__
+#define __XS_TEST_TESTUTIL_HPP_INCLUDED__
#include <assert.h>
#include <string.h>
-#include "../include/zmq.h"
+#include "../include/xs.h"
inline void bounce (void *sb, void *sc)
{
const char *content = "12345678ABCDEFGH12345678abcdefgh";
// Send the message.
- int rc = zmq_send (sc, content, 32, ZMQ_SNDMORE);
+ int rc = xs_send (sc, content, 32, XS_SNDMORE);
assert (rc == 32);
- rc = zmq_send (sc, content, 32, 0);
+ rc = xs_send (sc, content, 32, 0);
assert (rc == 32);
// Bounce the message back.
char buf1 [32];
- rc = zmq_recv (sb, buf1, 32, 0);
+ rc = xs_recv (sb, buf1, 32, 0);
assert (rc == 32);
int rcvmore;
size_t sz = sizeof (rcvmore);
- rc = zmq_getsockopt (sb, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (sb, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (rcvmore);
- rc = zmq_recv (sb, buf1, 32, 0);
+ rc = xs_recv (sb, buf1, 32, 0);
assert (rc == 32);
- rc = zmq_getsockopt (sb, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (sb, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (!rcvmore);
- rc = zmq_send (sb, buf1, 32, ZMQ_SNDMORE);
+ rc = xs_send (sb, buf1, 32, XS_SNDMORE);
assert (rc == 32);
- rc = zmq_send (sb, buf1, 32, 0);
+ rc = xs_send (sb, buf1, 32, 0);
assert (rc == 32);
// Receive the bounced message.
char buf2 [32];
- rc = zmq_recv (sc, buf2, 32, 0);
+ rc = xs_recv (sc, buf2, 32, 0);
assert (rc == 32);
- rc = zmq_getsockopt (sc, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (sc, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (rcvmore);
- rc = zmq_recv (sc, buf2, 32, 0);
+ rc = xs_recv (sc, buf2, 32, 0);
assert (rc == 32);
- rc = zmq_getsockopt (sc, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (sc, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (!rcvmore);
diff --git a/version.sh b/version.sh
index b4425d0..23c453f 100755
--- a/version.sh
+++ b/version.sh
@@ -1,17 +1,17 @@
#!/bin/sh
#
-# This script extracts the 0MQ version from include/zmq.h, which is the master
-# location for this information.
+# This script extracts the Crossroads version from include/xs.h,
+# which is the master location for this information.
#
-if [ ! -f include/zmq.h ]; then
- echo "version.sh: error: include/zmq.h does not exist" 1>&2
+if [ ! -f include/xs.h ]; then
+ echo "version.sh: error: include/xs.h does not exist" 1>&2
exit 1
fi
-MAJOR=`egrep '^#define +ZMQ_VERSION_MAJOR +[0-9]+$' include/zmq.h`
-MINOR=`egrep '^#define +ZMQ_VERSION_MINOR +[0-9]+$' include/zmq.h`
-PATCH=`egrep '^#define +ZMQ_VERSION_PATCH +[0-9]+$' include/zmq.h`
+MAJOR=`egrep '^#define +XS_VERSION_MAJOR +[0-9]+$' include/xs.h`
+MINOR=`egrep '^#define +XS_VERSION_MINOR +[0-9]+$' include/xs.h`
+PATCH=`egrep '^#define +XS_VERSION_PATCH +[0-9]+$' include/xs.h`
if [ -z "$MAJOR" -o -z "$MINOR" -o -z "$PATCH" ]; then
- echo "version.sh: error: could not extract version from include/zmq.h" 1>&2
+ echo "version.sh: error: could not extract version from include/xs.h" 1>&2
exit 1
fi
MAJOR=`echo $MAJOR | awk '{ print $3 }'`