summaryrefslogtreecommitdiff
path: root/gr-zeromq/include/gnuradio
diff options
context:
space:
mode:
authorAndriy Gelman <andriy.gelman@gmail.com>2020-01-12 01:54:44 -0500
committermormj <34754695+mormj@users.noreply.github.com>2020-03-02 18:15:24 -0500
commit1b362a2336f6f9b0db57021e280ff65e32409905 (patch)
treec8fcaef950c4661a652b90862e34a9629bdc42ae /gr-zeromq/include/gnuradio
parent5f18a419e2cec9f46d67147cae957d304d7a0195 (diff)
gr-zeromq: Add optional key filtering
Fixes #2236 Allows to filter a multi-part message by key/topic on a sub source and insert key/topic on a pub sink. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Diffstat (limited to 'gr-zeromq/include/gnuradio')
-rw-r--r--gr-zeromq/include/gnuradio/zeromq/pub_sink.h18
-rw-r--r--gr-zeromq/include/gnuradio/zeromq/sub_source.h4
2 files changed, 16 insertions, 6 deletions
diff --git a/gr-zeromq/include/gnuradio/zeromq/pub_sink.h b/gr-zeromq/include/gnuradio/zeromq/pub_sink.h
index cef6a82a54..d9410c48cf 100644
--- a/gr-zeromq/include/gnuradio/zeromq/pub_sink.h
+++ b/gr-zeromq/include/gnuradio/zeromq/pub_sink.h
@@ -22,11 +22,17 @@ namespace zeromq {
* \ingroup zeromq
*
* \details
- * This block acts a a streaming sink for a GNU Radio flowgraph
- * and writes its contents to a ZMQ PUB socket. A PUB socket may
+ * This block acts as a streaming sink for a GNU Radio flowgraph
+ * and writes its contents to a ZMQ PUB socket. A PUB socket may
* have subscribers and will pass all incoming stream data to each
- * subscriber. Subscribers can be either another gr-zeromq source
- * block or a non-GNU Radio ZMQ socket.
+ * subscriber with a matching key. If the publisher's key is set to
+ * "GNURadio", the following example subscriber keys will match: "G",
+ * "GN", .., "GNURadio". In other words, the subscriber must contain
+ * the first set of characters from the publisher's key. If the subscriber
+ * sets an empty key "", it will accept all input messages from the
+ * publisher (including the key itself if one is set). Subscribers
+ * can either be another gr-zeromq source block or a non-GNU Radio
+ * ZMQ socket.
*/
class ZEROMQ_API pub_sink : virtual public gr::sync_block
{
@@ -42,13 +48,15 @@ public:
* \param timeout Receive timeout in milliseconds, default is 100ms, 1us increments.
* \param pass_tags Whether sink will serialize and pass tags over the link.
* \param hwm High Watermark to configure the socket to (-1 => zmq's default)
+ * \param key Prepend a key/topic to the start of each message (default is none)
*/
static sptr make(size_t itemsize,
size_t vlen,
char* address,
int timeout = 100,
bool pass_tags = false,
- int hwm = -1);
+ int hwm = -1,
+ const std::string& key = "");
/*!
* \brief Return a std::string of ZMQ_LAST_ENDPOINT from the underlying ZMQ socket.
diff --git a/gr-zeromq/include/gnuradio/zeromq/sub_source.h b/gr-zeromq/include/gnuradio/zeromq/sub_source.h
index 88d286b3b8..c2be39e615 100644
--- a/gr-zeromq/include/gnuradio/zeromq/sub_source.h
+++ b/gr-zeromq/include/gnuradio/zeromq/sub_source.h
@@ -39,13 +39,15 @@ public:
* \param timeout Receive timeout in milliseconds, default is 100ms, 1us increments.
* \param pass_tags Whether source will look for and deserialize tags.
* \param hwm High Watermark to configure the socket to (-1 => zmq's default)
+ * \param key Subscriber filter key. Leave empty to pass all messages.
*/
static sptr make(size_t itemsize,
size_t vlen,
char* address,
int timeout = 100,
bool pass_tags = false,
- int hwm = -1);
+ int hwm = -1,
+ const std::string& key = "");
/*!
* \brief Return a std::string of ZMQ_LAST_ENDPOINT from the underlying ZMQ socket.