summaryrefslogtreecommitdiff
path: root/src/xsub.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-05-30 10:07:34 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-05-30 10:07:34 +0200
commit0b59866a84f733e5a53b0d2f32570581691747ef (patch)
tree8861d97915544dc4385177931f299a6f27603c92 /src/xsub.hpp
parent311fb0d852374e769d8ff791c9df38f0464960c6 (diff)
Patches from sub-forward branch incorporated
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/xsub.hpp')
-rw-r--r--src/xsub.hpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/xsub.hpp b/src/xsub.hpp
index ebd6259..03b3178 100644
--- a/src/xsub.hpp
+++ b/src/xsub.hpp
@@ -22,7 +22,10 @@
#define __ZMQ_XSUB_HPP_INCLUDED__
#include "socket_base.hpp"
+#include "dist.hpp"
#include "fq.hpp"
+#include "trie.hpp"
+#include "msg.hpp"
namespace zmq
{
@@ -39,18 +42,43 @@ namespace zmq
// Overloads of functions from socket_base_t.
void xattach_pipe (class pipe_t *pipe_, const blob_t &peer_identity_);
- int xsend (class msg_t *msg_, int options_);
+ int xsend (class msg_t *msg_, int flags_);
bool xhas_out ();
int xrecv (class msg_t *msg_, int flags_);
bool xhas_in ();
void xread_activated (class pipe_t *pipe_);
+ void xwrite_activated (class pipe_t *pipe_);
+ void xhiccuped (pipe_t *pipe_);
void xterminated (class pipe_t *pipe_);
private:
+ // Check whether the message matches at least one subscription.
+ bool match (class msg_t *msg_);
+
+ // Function to be applied to the trie to send all the subsciptions
+ // upstream.
+ static void send_subscription (unsigned char *data_, size_t size_,
+ void *arg_);
+
// Fair queueing object for inbound pipes.
fq_t fq;
+ // Object for distributing the subscriptions upstream.
+ dist_t dist;
+
+ // The repository of subscriptions.
+ trie_t subscriptions;
+
+ // If true, 'message' contains a matching message to return on the
+ // next recv call.
+ bool has_message;
+ msg_t message;
+
+ // If true, part of a multipart message was already received, but
+ // there are following parts still waiting.
+ bool more;
+
xsub_t (const xsub_t&);
const xsub_t &operator = (const xsub_t&);
};