summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
129 files changed, 2363 insertions, 2359 deletions
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