summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/app_thread.cpp5
-rw-r--r--src/pub.cpp39
-rw-r--r--src/pub.hpp41
-rw-r--r--src/sub.cpp12
-rw-r--r--src/sub.hpp2
6 files changed, 100 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index f4f338e..ce88b26 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -67,6 +67,7 @@ libzmq_la_SOURCES = $(pgm_sources) \
pipe.hpp \
platform.hpp \
poll.hpp \
+ pub.hpp \
select.hpp \
session.hpp \
simple_semaphore.hpp \
@@ -107,6 +108,7 @@ libzmq_la_SOURCES = $(pgm_sources) \
pgm_socket.cpp \
pipe.cpp \
poll.cpp \
+ pub.cpp \
select.cpp \
session.cpp \
socket_base.cpp \
diff --git a/src/app_thread.cpp b/src/app_thread.cpp
index 517b721..feaa4d6 100644
--- a/src/app_thread.cpp
+++ b/src/app_thread.cpp
@@ -35,6 +35,7 @@
#include "pipe.hpp"
#include "config.hpp"
#include "socket_base.hpp"
+#include "pub.hpp"
#include "sub.hpp"
// If the RDTSC is available we use it to prevent excessive
@@ -138,11 +139,13 @@ zmq::socket_base_t *zmq::app_thread_t::create_socket (int type_)
{
socket_base_t *s = NULL;
switch (type_) {
+ case ZMQ_PUB:
+ s = new pub_t (this);
+ break;
case ZMQ_SUB:
s = new sub_t (this);
break;
case ZMQ_P2P:
- case ZMQ_PUB:
case ZMQ_REQ:
case ZMQ_REP:
s = new socket_base_t (this, type_);
diff --git a/src/pub.cpp b/src/pub.cpp
new file mode 100644
index 0000000..9f2729b
--- /dev/null
+++ b/src/pub.cpp
@@ -0,0 +1,39 @@
+/*
+ Copyright (c) 2007-2009 FastMQ Inc.
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the Lesser GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "../c/zmq.h"
+
+#include "pub.hpp"
+#include "err.hpp"
+
+zmq::pub_t::pub_t (class app_thread_t *parent_) :
+ socket_base_t (parent_)
+{
+}
+
+zmq::pub_t::~pub_t ()
+{
+}
+
+int zmq::pub_t::recv (struct zmq_msg_t *msg_, int flags_)
+{
+ errno = EFAULT;
+ return -1;
+}
+
diff --git a/src/pub.hpp b/src/pub.hpp
new file mode 100644
index 0000000..2f03b8e
--- /dev/null
+++ b/src/pub.hpp
@@ -0,0 +1,41 @@
+/*
+ Copyright (c) 2007-2009 FastMQ Inc.
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the Lesser GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __ZMQ_PUB_INCLUDED__
+#define __ZMQ_PUB_INCLUDED__
+
+#include "socket_base.hpp"
+
+namespace zmq
+{
+
+ class pub_t : public socket_base_t
+ {
+ public:
+
+ pub_t (class app_thread_t *parent_);
+ ~pub_t ();
+
+ // Overloads of API functions from socket_base_t.
+ int recv (struct zmq_msg_t *msg_, int flags_);
+ };
+
+}
+
+#endif
diff --git a/src/sub.cpp b/src/sub.cpp
index 1503fe2..51e0c23 100644
--- a/src/sub.cpp
+++ b/src/sub.cpp
@@ -78,6 +78,18 @@ int zmq::sub_t::setsockopt (int option_, const void *optval_,
return socket_base_t::setsockopt (option_, optval_, optvallen_);
}
+int zmq::sub_t::send (struct zmq_msg_t *msg_, int flags_)
+{
+ errno = EFAULT;
+ return -1;
+}
+
+int zmq::sub_t::flush ()
+{
+ errno = EFAULT;
+ return -1;
+}
+
int zmq::sub_t::recv (struct zmq_msg_t *msg_, int flags_)
{
while (true) {
diff --git a/src/sub.hpp b/src/sub.hpp
index c88d30c..14fa687 100644
--- a/src/sub.hpp
+++ b/src/sub.hpp
@@ -37,6 +37,8 @@ namespace zmq
// Overloads of API functions from socket_base_t.
int setsockopt (int option_, const void *optval_, size_t optvallen_);
+ int send (struct zmq_msg_t *msg_, int flags_);
+ int flush ();
int recv (struct zmq_msg_t *msg_, int flags_);
private: