summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/test_hwm.cpp36
-rw-r--r--tests/test_invalid_rep.cpp48
-rw-r--r--tests/test_msg_flags.cpp44
-rw-r--r--tests/test_pair_inproc.cpp22
-rw-r--r--tests/test_pair_ipc.cpp24
-rw-r--r--tests/test_pair_tcp.cpp24
-rw-r--r--tests/test_reqrep_device.cpp82
-rw-r--r--tests/test_reqrep_inproc.cpp24
-rw-r--r--tests/test_reqrep_ipc.cpp24
-rw-r--r--tests/test_reqrep_tcp.cpp24
-rw-r--r--tests/test_shutdown_stress.cpp26
-rw-r--r--tests/test_sub_forward.cpp56
-rw-r--r--tests/test_timeo.cpp70
-rw-r--r--tests/testutil.hpp38
15 files changed, 272 insertions, 272 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fb0c6f8..06830e2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,7 @@
INCLUDES = -I$(top_builddir)/include \
-I$(top_srcdir)/include
-LDADD = $(top_builddir)/src/libzmq.la
+LDADD = $(top_builddir)/src/libxs.la
noinst_PROGRAMS = test_pair_inproc \
test_pair_tcp \
diff --git a/tests/test_hwm.cpp b/tests/test_hwm.cpp
index d887b31..a1db711 100644
--- a/tests/test_hwm.cpp
+++ b/tests/test_hwm.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -28,30 +28,30 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_hwm running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
// Create pair of socket, each with high watermark of 2. Thus the total
// buffer space should be 4 messages.
- void *sb = zmq_socket (ctx, ZMQ_PULL);
+ void *sb = xs_socket (ctx, XS_PULL);
assert (sb);
int hwm = 2;
- int rc = zmq_setsockopt (sb, ZMQ_RCVHWM, &hwm, sizeof (hwm));
+ int rc = xs_setsockopt (sb, XS_RCVHWM, &hwm, sizeof (hwm));
assert (rc == 0);
- rc = zmq_bind (sb, "inproc://a");
+ rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PUSH);
+ void *sc = xs_socket (ctx, XS_PUSH);
assert (sc);
- rc = zmq_setsockopt (sc, ZMQ_SNDHWM, &hwm, sizeof (hwm));
+ rc = xs_setsockopt (sc, XS_SNDHWM, &hwm, sizeof (hwm));
assert (rc == 0);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
// Try to send 10 messages. Only 4 should succeed.
for (int i = 0; i < 10; i++)
{
- int rc = zmq_send (sc, NULL, 0, ZMQ_DONTWAIT);
+ int rc = xs_send (sc, NULL, 0, XS_DONTWAIT);
if (i < 4)
assert (rc == 0);
else
@@ -60,25 +60,25 @@ int main (int argc, char *argv [])
// There should be now 4 messages pending, consume them.
for (int i = 0; i != 4; i++) {
- rc = zmq_recv (sb, NULL, 0, 0);
+ rc = xs_recv (sb, NULL, 0, 0);
assert (rc == 0);
}
// Now it should be possible to send one more.
- rc = zmq_send (sc, NULL, 0, 0);
+ rc = xs_send (sc, NULL, 0, 0);
assert (rc == 0);
// Consume the remaining message.
- rc = zmq_recv (sb, NULL, 0, 0);
+ rc = xs_recv (sb, NULL, 0, 0);
assert (rc == 0);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0;
diff --git a/tests/test_invalid_rep.cpp b/tests/test_invalid_rep.cpp
index 9c77cc4..9ed2145 100644
--- a/tests/test_invalid_rep.cpp
+++ b/tests/test_invalid_rep.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -19,7 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
+#include "../include/xs.h"
#include <assert.h>
#include <stdio.h>
@@ -28,24 +28,24 @@ int main (int argc, char *argv [])
fprintf (stderr, "test_invalid_rep running...\n");
// Create REQ/XREP wiring.
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *xrep_socket = zmq_socket (ctx, ZMQ_XREP);
+ void *xrep_socket = xs_socket (ctx, XS_XREP);
assert (xrep_socket);
- void *req_socket = zmq_socket (ctx, ZMQ_REQ);
+ void *req_socket = xs_socket (ctx, XS_REQ);
assert (req_socket);
int linger = 0;
- int rc = zmq_setsockopt (xrep_socket, ZMQ_LINGER, &linger, sizeof (int));
+ int rc = xs_setsockopt (xrep_socket, XS_LINGER, &linger, sizeof (int));
assert (rc == 0);
- rc = zmq_setsockopt (req_socket, ZMQ_LINGER, &linger, sizeof (int));
+ rc = xs_setsockopt (req_socket, XS_LINGER, &linger, sizeof (int));
assert (rc == 0);
- rc = zmq_bind (xrep_socket, "inproc://hi");
+ rc = xs_bind (xrep_socket, "inproc://hi");
assert (rc == 0);
- rc = zmq_connect (req_socket, "inproc://hi");
+ rc = xs_connect (req_socket, "inproc://hi");
assert (rc == 0);
// Initial request.
- rc = zmq_send (req_socket, "r", 1, 0);
+ rc = xs_send (req_socket, "r", 1, 0);
assert (rc == 1);
// Receive the request.
@@ -53,36 +53,36 @@ int main (int argc, char *argv [])
int addr_size;
char bottom [1];
char body [1];
- addr_size = zmq_recv (xrep_socket, addr, sizeof (addr), 0);
+ addr_size = xs_recv (xrep_socket, addr, sizeof (addr), 0);
assert (addr_size >= 0);
- rc = zmq_recv (xrep_socket, bottom, sizeof (bottom), 0);
+ rc = xs_recv (xrep_socket, bottom, sizeof (bottom), 0);
assert (rc == 0);
- rc = zmq_recv (xrep_socket, body, sizeof (body), 0);
+ rc = xs_recv (xrep_socket, body, sizeof (body), 0);
assert (rc == 1);
// Send invalid reply.
- rc = zmq_send (xrep_socket, addr, addr_size, 0);
+ rc = xs_send (xrep_socket, addr, addr_size, 0);
assert (rc == addr_size);
// Send valid reply.
- rc = zmq_send (xrep_socket, addr, addr_size, ZMQ_SNDMORE);
+ rc = xs_send (xrep_socket, addr, addr_size, XS_SNDMORE);
assert (rc == addr_size);
- rc = zmq_send (xrep_socket, bottom, 0, ZMQ_SNDMORE);
+ rc = xs_send (xrep_socket, bottom, 0, XS_SNDMORE);
assert (rc == 0);
- rc = zmq_send (xrep_socket, "b", 1, 0);
+ rc = xs_send (xrep_socket, "b", 1, 0);
assert (rc == 1);
// Check whether we've got the valid reply.
- rc = zmq_recv (req_socket, body, sizeof (body), 0);
+ rc = xs_recv (req_socket, body, sizeof (body), 0);
assert (rc == 1);
assert (body [0] == 'b');
// Tear down the wiring.
- rc = zmq_close (xrep_socket);
+ rc = xs_close (xrep_socket);
assert (rc == 0);
- rc = zmq_close (req_socket);
+ rc = xs_close (req_socket);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0;
diff --git a/tests/test_msg_flags.cpp b/tests/test_msg_flags.cpp
index f836184..535a7d5 100644
--- a/tests/test_msg_flags.cpp
+++ b/tests/test_msg_flags.cpp
@@ -2,14 +2,14 @@
Copyright (c) 2011-2012 250bpm s.r.o.
Copyright (c) 2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -21,62 +21,62 @@
#include <assert.h>
#include <string.h>
-#include "../include/zmq.h"
+#include "../include/xs.h"
int main (int argc, char *argv [])
{
// Create the infrastructure
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_XREP);
+ void *sb = xs_socket (ctx, XS_XREP);
assert (sb);
- int rc = zmq_bind (sb, "inproc://a");
+ int rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_XREQ);
+ void *sc = xs_socket (ctx, XS_XREQ);
assert (sc);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
// Send 2-part message.
- rc = zmq_send (sc, "A", 1, ZMQ_SNDMORE);
+ rc = xs_send (sc, "A", 1, XS_SNDMORE);
assert (rc == 1);
- rc = zmq_send (sc, "B", 1, 0);
+ rc = xs_send (sc, "B", 1, 0);
assert (rc == 1);
// Identity comes first.
- zmq_msg_t msg;
- rc = zmq_msg_init (&msg);
+ xs_msg_t msg;
+ rc = xs_msg_init (&msg);
assert (rc == 0);
- rc = zmq_recvmsg (sb, &msg, 0);
+ rc = xs_recvmsg (sb, &msg, 0);
assert (rc >= 0);
int more;
size_t more_size = sizeof (more);
- rc = zmq_getmsgopt (&msg, ZMQ_MORE, &more, &more_size);
+ rc = xs_getmsgopt (&msg, XS_MORE, &more, &more_size);
assert (rc == 0);
assert (more == 1);
// Then the first part of the message body.
- rc = zmq_recvmsg (sb, &msg, 0);
+ rc = xs_recvmsg (sb, &msg, 0);
assert (rc == 1);
more_size = sizeof (more);
- rc = zmq_getmsgopt (&msg, ZMQ_MORE, &more, &more_size);
+ rc = xs_getmsgopt (&msg, XS_MORE, &more, &more_size);
assert (rc == 0);
assert (more == 1);
// And finally, the second part of the message body.
- rc = zmq_recvmsg (sb, &msg, 0);
+ rc = xs_recvmsg (sb, &msg, 0);
assert (rc == 1);
more_size = sizeof (more);
- rc = zmq_getmsgopt (&msg, ZMQ_MORE, &more, &more_size);
+ rc = xs_getmsgopt (&msg, XS_MORE, &more, &more_size);
assert (rc == 0);
assert (more == 0);
// Deallocate the infrastructure.
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
}
diff --git a/tests/test_pair_inproc.cpp b/tests/test_pair_inproc.cpp
index 75a9720..d8f3726 100644
--- a/tests/test_pair_inproc.cpp
+++ b/tests/test_pair_inproc.cpp
@@ -2,14 +2,14 @@
Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_pair_inproc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_PAIR);
+ void *sb = xs_socket (ctx, XS_PAIR);
assert (sb);
- int rc = zmq_bind (sb, "inproc://a");
+ int rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PAIR);
+ void *sc = xs_socket (ctx, XS_PAIR);
assert (sc);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_pair_ipc.cpp b/tests/test_pair_ipc.cpp
index 96a265f..5b9b536 100644
--- a/tests/test_pair_ipc.cpp
+++ b/tests/test_pair_ipc.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_pair_ipc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_PAIR);
+ void *sb = xs_socket (ctx, XS_PAIR);
assert (sb);
- int rc = zmq_bind (sb, "ipc:///tmp/tester");
+ int rc = xs_bind (sb, "ipc:///tmp/tester");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PAIR);
+ void *sc = xs_socket (ctx, XS_PAIR);
assert (sc);
- rc = zmq_connect (sc, "ipc:///tmp/tester");
+ rc = xs_connect (sc, "ipc:///tmp/tester");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_pair_tcp.cpp b/tests/test_pair_tcp.cpp
index 464be5a..1c4bbf1 100644
--- a/tests/test_pair_tcp.cpp
+++ b/tests/test_pair_tcp.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -27,28 +27,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_pair_tcp running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_PAIR);
+ void *sb = xs_socket (ctx, XS_PAIR);
assert (sb);
- int rc = zmq_bind (sb, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (sb, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_PAIR);
+ void *sc = xs_socket (ctx, XS_PAIR);
assert (sc);
- rc = zmq_connect (sc, "tcp://127.0.0.1:5560");
+ rc = xs_connect (sc, "tcp://127.0.0.1:5560");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_device.cpp b/tests/test_reqrep_device.cpp
index d861cec..5571eed 100644
--- a/tests/test_reqrep_device.cpp
+++ b/tests/test_reqrep_device.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 VMware, Inc.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -23,119 +23,119 @@
#include <string.h>
#include <stdio.h>
-#include "../include/zmq.h"
+#include "../include/xs.h"
int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_device running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
// Create a req/rep device.
- void *xreq = zmq_socket (ctx, ZMQ_XREQ);
+ void *xreq = xs_socket (ctx, XS_XREQ);
assert (xreq);
- int rc = zmq_bind (xreq, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (xreq, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *xrep = zmq_socket (ctx, ZMQ_XREP);
+ void *xrep = xs_socket (ctx, XS_XREP);
assert (xrep);
- rc = zmq_bind (xrep, "tcp://127.0.0.1:5561");
+ rc = xs_bind (xrep, "tcp://127.0.0.1:5561");
assert (rc == 0);
// Create a worker.
- void *rep = zmq_socket (ctx, ZMQ_REP);
+ void *rep = xs_socket (ctx, XS_REP);
assert (rep);
- rc = zmq_connect (rep, "tcp://127.0.0.1:5560");
+ rc = xs_connect (rep, "tcp://127.0.0.1:5560");
assert (rc == 0);
// Create a client.
- void *req = zmq_socket (ctx, ZMQ_REQ);
+ void *req = xs_socket (ctx, XS_REQ);
assert (req);
- rc = zmq_connect (req, "tcp://127.0.0.1:5561");
+ rc = xs_connect (req, "tcp://127.0.0.1:5561");
assert (rc == 0);
// Send a request.
- rc = zmq_send (req, "ABC", 3, ZMQ_SNDMORE);
+ rc = xs_send (req, "ABC", 3, XS_SNDMORE);
assert (rc == 3);
- rc = zmq_send (req, "DEF", 3, 0);
+ rc = xs_send (req, "DEF", 3, 0);
assert (rc == 3);
// Pass the request through the device.
for (int i = 0; i != 4; i++) {
- zmq_msg_t msg;
- rc = zmq_msg_init (&msg);
+ xs_msg_t msg;
+ rc = xs_msg_init (&msg);
assert (rc == 0);
- rc = zmq_recvmsg (xrep, &msg, 0);
+ rc = xs_recvmsg (xrep, &msg, 0);
assert (rc >= 0);
int rcvmore;
size_t sz = sizeof (rcvmore);
- rc = zmq_getsockopt (xrep, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (xrep, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
- rc = zmq_sendmsg (xreq, &msg, rcvmore ? ZMQ_SNDMORE : 0);
+ rc = xs_sendmsg (xreq, &msg, rcvmore ? XS_SNDMORE : 0);
assert (rc >= 0);
}
// Receive the request.
char buff [3];
- rc = zmq_recv (rep, buff, 3, 0);
+ rc = xs_recv (rep, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "ABC", 3) == 0);
int rcvmore;
size_t sz = sizeof (rcvmore);
- rc = zmq_getsockopt (rep, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (rep, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (rcvmore);
- rc = zmq_recv (rep, buff, 3, 0);
+ rc = xs_recv (rep, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "DEF", 3) == 0);
- rc = zmq_getsockopt (rep, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (rep, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (!rcvmore);
// Send the reply.
- rc = zmq_send (rep, "GHI", 3, ZMQ_SNDMORE);
+ rc = xs_send (rep, "GHI", 3, XS_SNDMORE);
assert (rc == 3);
- rc = zmq_send (rep, "JKL", 3, 0);
+ rc = xs_send (rep, "JKL", 3, 0);
assert (rc == 3);
// Pass the reply through the device.
for (int i = 0; i != 4; i++) {
- zmq_msg_t msg;
- rc = zmq_msg_init (&msg);
+ xs_msg_t msg;
+ rc = xs_msg_init (&msg);
assert (rc == 0);
- rc = zmq_recvmsg (xreq, &msg, 0);
+ rc = xs_recvmsg (xreq, &msg, 0);
assert (rc >= 0);
int rcvmore;
- rc = zmq_getsockopt (xreq, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (xreq, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
- rc = zmq_sendmsg (xrep, &msg, rcvmore ? ZMQ_SNDMORE : 0);
+ rc = xs_sendmsg (xrep, &msg, rcvmore ? XS_SNDMORE : 0);
assert (rc >= 0);
}
// Receive the reply.
- rc = zmq_recv (req, buff, 3, 0);
+ rc = xs_recv (req, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "GHI", 3) == 0);
- rc = zmq_getsockopt (req, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (req, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (rcvmore);
- rc = zmq_recv (req, buff, 3, 0);
+ rc = xs_recv (req, buff, 3, 0);
assert (rc == 3);
assert (memcmp (buff, "JKL", 3) == 0);
- rc = zmq_getsockopt (req, ZMQ_RCVMORE, &rcvmore, &sz);
+ rc = xs_getsockopt (req, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
assert (!rcvmore);
// Clean up.
- rc = zmq_close (req);
+ rc = xs_close (req);
assert (rc == 0);
- rc = zmq_close (rep);
+ rc = xs_close (rep);
assert (rc == 0);
- rc = zmq_close (xrep);
+ rc = xs_close (xrep);
assert (rc == 0);
- rc = zmq_close (xreq);
+ rc = xs_close (xreq);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_inproc.cpp b/tests/test_reqrep_inproc.cpp
index ae998eb..f715e4c 100644
--- a/tests/test_reqrep_inproc.cpp
+++ b/tests/test_reqrep_inproc.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_inproc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_REP);
+ void *sb = xs_socket (ctx, XS_REP);
assert (sb);
- int rc = zmq_bind (sb, "inproc://a");
+ int rc = xs_bind (sb, "inproc://a");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_REQ);
+ void *sc = xs_socket (ctx, XS_REQ);
assert (sc);
- rc = zmq_connect (sc, "inproc://a");
+ rc = xs_connect (sc, "inproc://a");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_ipc.cpp b/tests/test_reqrep_ipc.cpp
index fd9b28d..652c372 100644
--- a/tests/test_reqrep_ipc.cpp
+++ b/tests/test_reqrep_ipc.cpp
@@ -1,15 +1,15 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -26,28 +26,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_ipc running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_REP);
+ void *sb = xs_socket (ctx, XS_REP);
assert (sb);
- int rc = zmq_bind (sb, "ipc:///tmp/tester");
+ int rc = xs_bind (sb, "ipc:///tmp/tester");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_REQ);
+ void *sc = xs_socket (ctx, XS_REQ);
assert (sc);
- rc = zmq_connect (sc, "ipc:///tmp/tester");
+ rc = xs_connect (sc, "ipc:///tmp/tester");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_reqrep_tcp.cpp b/tests/test_reqrep_tcp.cpp
index 1e6bbbb..ea33709 100644
--- a/tests/test_reqrep_tcp.cpp
+++ b/tests/test_reqrep_tcp.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -27,28 +27,28 @@ int main (int argc, char *argv [])
{
fprintf (stderr, "test_reqrep_tcp running...\n");
- void *ctx = zmq_init (1);
+ void *ctx = xs_init (1);
assert (ctx);
- void *sb = zmq_socket (ctx, ZMQ_REP);
+ void *sb = xs_socket (ctx, XS_REP);
assert (sb);
- int rc = zmq_bind (sb, "tcp://127.0.0.1:5560");
+ int rc = xs_bind (sb, "tcp://127.0.0.1:5560");
assert (rc == 0);
- void *sc = zmq_socket (ctx, ZMQ_REQ);
+ void *sc = xs_socket (ctx, XS_REQ);
assert (sc);
- rc = zmq_connect (sc, "tcp://127.0.0.1:5560");
+ rc = xs_connect (sc, "tcp://127.0.0.1:5560");
assert (rc == 0);
bounce (sb, sc);
- rc = zmq_close (sc);
+ rc = xs_close (sc);
assert (rc == 0);
- rc = zmq_close (sb);
+ rc = xs_close (sb);
assert (rc == 0);
- rc = zmq_term (ctx);
+ rc = xs_term (ctx);
assert (rc == 0);
return 0 ;
diff --git a/tests/test_shutdown_stress.cpp b/tests/test_shutdown_stress.cpp
index 811637c..021a00e 100644
--- a/tests/test_shutdown_stress.cpp
+++ b/tests/test_shutdown_stress.cpp
@@ -1,16 +1,16 @@
/*
- Copyright (c) 2010-2011 250bpm s.r.o.
+ Copyright (c) 2010-2012 250bpm s.r.o.
Copyright (c) 2011 iMatix Corporation
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
- This file is part of 0MQ.
+ This file is part of Crossroads project.
- 0MQ is free software; you can redistribute it and/or modify it under
+ Crossroads is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
- 0MQ is distributed in the hope that it will be useful,
+ Crossroads is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
@@ -19,7 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../include/zmq.h"
+#include "../include/xs.h"
#include <assert.h>
#include <pthread.h>
#include <stddef.h>
@@ -33,11 +33,11 @@ extern "C"
{
int rc;
- rc = zmq_connect (s, "tcp://127.0.0.1:5560");
+ rc = xs_connect (s, "tcp://127.0.0.1:5560");
assert (rc == 0);
// Start closing the socket while the connecting process is underway.
- rc = zmq_close (s);
+ rc = xs_close (s);
assert (rc == 0);
return NULL;
@@ -59,17 +59,17 @@ int main (int argc, char *argv [])
for (j = 0; j != 10; j++) {
// Check the shutdown with many parallel I/O threads.
- ctx = zmq_init (7);
+ ctx = xs_init (7);
assert (ctx);
- s1 = zmq_socket (ctx, ZMQ_PUB);
+ s1 = xs_socket (ctx, XS_PUB);
assert (s1);
- rc = zmq_bind (s1, "tcp://127.0.0.1:5560");
+ rc = xs_bind (s1, "tcp://127.0.0.1:5560");
assert (rc == 0);
for (i = 0; i != THREAD_COUNT; i++) {
- s2 = zmq_socket (ctx, ZMQ_SUB);
+ s2 = xs_socket (ctx, XS_SUB);
assert (s2);
rc = pthread_create (&threads [i], NULL, worker, s2);
assert (rc == 0);
@@ -80,10 +80,10 @@ int main (int argc, char *argv [])
assert (rc == 0);