aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli (think) <matthias@mpb.li>2013-11-08 18:14:57 +0100
committerMatthias P. Braendli (think) <matthias@mpb.li>2013-11-08 18:14:57 +0100
commitd930ee6b9a52f0eb9939b3fe55afd2361944edb2 (patch)
treea26c6c31bebe6681da54d9acd782c3fe96969da7 /src
parentc5306f81a9d3b87df7e16c852f2505ac913193ca (diff)
downloaddabmux-d930ee6b9a52f0eb9939b3fe55afd2361944edb2.tar.gz
dabmux-d930ee6b9a52f0eb9939b3fe55afd2361944edb2.tar.bz2
dabmux-d930ee6b9a52f0eb9939b3fe55afd2361944edb2.zip
add support for ZeroMQ output
Diffstat (limited to 'src')
-rw-r--r--src/DabMux.cpp10
-rw-r--r--src/Makefile.am11
-rw-r--r--src/Makefile.in27
-rw-r--r--src/dabOutput/dabOutput.h42
-rw-r--r--src/dabOutput/dabOutputFifo.cpp25
-rw-r--r--src/dabOutput/dabOutputFile.cpp25
-rw-r--r--src/dabOutput/dabOutputRaw.cpp25
-rw-r--r--src/dabOutput/dabOutputSimul.cpp25
-rw-r--r--src/dabOutput/dabOutputTcp.cpp25
-rw-r--r--src/dabOutput/dabOutputUdp.cpp26
-rw-r--r--src/dabOutput/dabOutputZMQ.cpp78
11 files changed, 314 insertions, 5 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 0e97340..ca0fb1a 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -494,6 +494,16 @@ int main(int argc, char *argv[])
} else if ((*output)->outputProto == "simul") {
(*output)->output = new DabOutputSimul();
#endif // defined(HAVE_OUTPUT_SIMUL)
+#if defined(HAVE_OUTPUT_ZEROMQ)
+ } else if ((*output)->outputProto == "zmq+tcp") {
+ (*output)->output = new DabOutputZMQ("tcp");
+ } else if ((*output)->outputProto == "zmq+ipc") {
+ (*output)->output = new DabOutputZMQ("ipc");
+ } else if ((*output)->outputProto == "zmq+pgm") {
+ (*output)->output = new DabOutputZMQ("pgm");
+ } else if ((*output)->outputProto == "zmq+epgm") {
+ (*output)->output = new DabOutputZMQ("epgm");
+#endif // defined(HAVE_OUTPUT_ZEROMQ)
} else {
etiLog.printHeader(TcpLog::ERR, "Output protcol unknown: %s\n",
(*output)->outputProto.c_str());
diff --git a/src/Makefile.am b/src/Makefile.am
index b67a09c..4815e96 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,8 +24,14 @@ bin_PROGRAMS=CRC-DabMux CRC-BridgeTest
FEC_FLAGS =
FEC_LIBS =-lfec
+if HAVE_OUTPUT_ZEROMQ_TEST
+ZMQ_LIBS =-lzmq
+else
+ZMQ_LIBS =
+endif
+
CRC_DabMux_CPPFLAGS =-I$(FARSYNC_DIR)
-CRC_DabMux_LDADD =$(FEC_LIBS) -lpthread
+CRC_DabMux_LDADD =$(FEC_LIBS) $(ZMQ_LIBS) -lpthread
CRC_DabMux_SOURCES =DabMux.cpp \
dabInput.h dabInput.cpp \
dabInputBridgeUdp.h dabInputBridgeUdp.cpp \
@@ -53,6 +59,7 @@ CRC_DabMux_SOURCES =DabMux.cpp \
dabOutput/dabOutputSimul.cpp \
dabOutput/dabOutputTcp.cpp \
dabOutput/dabOutputUdp.cpp \
+ dabOutput/dabOutputZMQ.cpp \
bridge.h bridge.c \
utils.cpp utils.h \
MuxElements.cpp MuxElements.h \
@@ -86,4 +93,4 @@ CRC-DabMux-cfg: CRC-DabMux
all: CRC-DabMux-cfg all-am
clean-local:
- rm CRC-DabMux-cfg
+ rm -f CRC-DabMux-cfg
diff --git a/src/Makefile.in b/src/Makefile.in
index 0daffbd..c978e7e 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -148,6 +148,7 @@ am_CRC_DabMux_OBJECTS = CRC_DabMux-DabMux.$(OBJEXT) \
dabOutput/CRC_DabMux-dabOutputSimul.$(OBJEXT) \
dabOutput/CRC_DabMux-dabOutputTcp.$(OBJEXT) \
dabOutput/CRC_DabMux-dabOutputUdp.$(OBJEXT) \
+ dabOutput/CRC_DabMux-dabOutputZMQ.$(OBJEXT) \
CRC_DabMux-bridge.$(OBJEXT) CRC_DabMux-utils.$(OBJEXT) \
CRC_DabMux-MuxElements.$(OBJEXT) \
CRC_DabMux-ParserCmdline.$(OBJEXT) \
@@ -160,7 +161,7 @@ am_CRC_DabMux_OBJECTS = CRC_DabMux-DabMux.$(OBJEXT) \
CRC_DabMux-TcpServer.$(OBJEXT) CRC_DabMux-TcpSocket.$(OBJEXT)
CRC_DabMux_OBJECTS = $(am_CRC_DabMux_OBJECTS)
am__DEPENDENCIES_1 =
-CRC_DabMux_DEPENDENCIES = $(am__DEPENDENCIES_1)
+CRC_DabMux_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@@ -345,8 +346,10 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
FEC_FLAGS =
FEC_LIBS = -lfec
+@HAVE_OUTPUT_ZEROMQ_TEST_FALSE@ZMQ_LIBS =
+@HAVE_OUTPUT_ZEROMQ_TEST_TRUE@ZMQ_LIBS = -lzmq
CRC_DabMux_CPPFLAGS = -I$(FARSYNC_DIR)
-CRC_DabMux_LDADD = $(FEC_LIBS) -lpthread
+CRC_DabMux_LDADD = $(FEC_LIBS) $(ZMQ_LIBS) -lpthread
CRC_DabMux_SOURCES = DabMux.cpp \
dabInput.h dabInput.cpp \
dabInputBridgeUdp.h dabInputBridgeUdp.cpp \
@@ -374,6 +377,7 @@ CRC_DabMux_SOURCES = DabMux.cpp \
dabOutput/dabOutputSimul.cpp \
dabOutput/dabOutputTcp.cpp \
dabOutput/dabOutputUdp.cpp \
+ dabOutput/dabOutputZMQ.cpp \
bridge.h bridge.c \
utils.cpp utils.h \
MuxElements.cpp MuxElements.h \
@@ -496,6 +500,8 @@ dabOutput/CRC_DabMux-dabOutputTcp.$(OBJEXT): \
dabOutput/$(am__dirstamp) dabOutput/$(DEPDIR)/$(am__dirstamp)
dabOutput/CRC_DabMux-dabOutputUdp.$(OBJEXT): \
dabOutput/$(am__dirstamp) dabOutput/$(DEPDIR)/$(am__dirstamp)
+dabOutput/CRC_DabMux-dabOutputZMQ.$(OBJEXT): \
+ dabOutput/$(am__dirstamp) dabOutput/$(DEPDIR)/$(am__dirstamp)
CRC-DabMux$(EXEEXT): $(CRC_DabMux_OBJECTS) $(CRC_DabMux_DEPENDENCIES) $(EXTRA_CRC_DabMux_DEPENDENCIES)
@rm -f CRC-DabMux$(EXEEXT)
@@ -554,6 +560,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@dabOutput/$(DEPDIR)/CRC_DabMux-dabOutputSimul.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@dabOutput/$(DEPDIR)/CRC_DabMux-dabOutputTcp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@dabOutput/$(DEPDIR)/CRC_DabMux-dabOutputUdp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dabOutput/$(DEPDIR)/CRC_DabMux-dabOutputZMQ.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -1035,6 +1042,20 @@ dabOutput/CRC_DabMux-dabOutputUdp.obj: dabOutput/dabOutputUdp.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CRC_DabMux_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dabOutput/CRC_DabMux-dabOutputUdp.obj `if test -f 'dabOutput/dabOutputUdp.cpp'; then $(CYGPATH_W) 'dabOutput/dabOutputUdp.cpp'; else $(CYGPATH_W) '$(srcdir)/dabOutput/dabOutputUdp.cpp'; fi`
+dabOutput/CRC_DabMux-dabOutputZMQ.o: dabOutput/dabOutputZMQ.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CRC_DabMux_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dabOutput/CRC_DabMux-dabOutputZMQ.o -MD -MP -MF dabOutput/$(DEPDIR)/CRC_DabMux-dabOutputZMQ.Tpo -c -o dabOutput/CRC_DabMux-dabOutputZMQ.o `test -f 'dabOutput/dabOutputZMQ.cpp' || echo '$(srcdir)/'`dabOutput/dabOutputZMQ.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) dabOutput/$(DEPDIR)/CRC_DabMux-dabOutputZMQ.Tpo dabOutput/$(DEPDIR)/CRC_DabMux-dabOutputZMQ.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='dabOutput/dabOutputZMQ.cpp' object='dabOutput/CRC_DabMux-dabOutputZMQ.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CRC_DabMux_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dabOutput/CRC_DabMux-dabOutputZMQ.o `test -f 'dabOutput/dabOutputZMQ.cpp' || echo '$(srcdir)/'`dabOutput/dabOutputZMQ.cpp
+
+dabOutput/CRC_DabMux-dabOutputZMQ.obj: dabOutput/dabOutputZMQ.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CRC_DabMux_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dabOutput/CRC_DabMux-dabOutputZMQ.obj -MD -MP -MF dabOutput/$(DEPDIR)/CRC_DabMux-dabOutputZMQ.Tpo -c -o dabOutput/CRC_DabMux-dabOutputZMQ.obj `if test -f 'dabOutput/dabOutputZMQ.cpp'; then $(CYGPATH_W) 'dabOutput/dabOutputZMQ.cpp'; else $(CYGPATH_W) '$(srcdir)/dabOutput/dabOutputZMQ.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) dabOutput/$(DEPDIR)/CRC_DabMux-dabOutputZMQ.Tpo dabOutput/$(DEPDIR)/CRC_DabMux-dabOutputZMQ.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='dabOutput/dabOutputZMQ.cpp' object='dabOutput/CRC_DabMux-dabOutputZMQ.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CRC_DabMux_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dabOutput/CRC_DabMux-dabOutputZMQ.obj `if test -f 'dabOutput/dabOutputZMQ.cpp'; then $(CYGPATH_W) 'dabOutput/dabOutputZMQ.cpp'; else $(CYGPATH_W) '$(srcdir)/dabOutput/dabOutputZMQ.cpp'; fi`
+
CRC_DabMux-utils.o: utils.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CRC_DabMux_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CRC_DabMux-utils.o -MD -MP -MF $(DEPDIR)/CRC_DabMux-utils.Tpo -c -o CRC_DabMux-utils.o `test -f 'utils.cpp' || echo '$(srcdir)/'`utils.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/CRC_DabMux-utils.Tpo $(DEPDIR)/CRC_DabMux-utils.Po
@@ -1447,7 +1468,7 @@ CRC-DabMux-cfg: CRC-DabMux
all: CRC-DabMux-cfg all-am
clean-local:
- rm CRC-DabMux-cfg
+ rm -f CRC-DabMux-cfg
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/dabOutput/dabOutput.h b/src/dabOutput/dabOutput.h
index 7f295b4..a39a6ca 100644
--- a/src/dabOutput/dabOutput.h
+++ b/src/dabOutput/dabOutput.h
@@ -30,6 +30,7 @@
#include "UdpSocket.h"
#include "TcpServer.h"
#include "TcpLog.h"
+#include <stdexcept>
#include <signal.h>
#ifdef _WIN32
# include <io.h>
@@ -45,6 +46,9 @@
# define O_BINARY 0
# endif // O_BINARY
#endif
+#ifdef HAVE_OUTPUT_ZEROMQ
+# include "zmq.hpp"
+#endif
extern TcpLog etiLog;
@@ -244,5 +248,43 @@ class DabOutputSimul : public DabOutput
#endif
};
+#if defined(HAVE_OUTPUT_ZEROMQ)
+// -------------- ZeroMQ message queue ------------------
+class DabOutputZMQ : public DabOutput
+{
+ public:
+ DabOutputZMQ() :
+ zmq_proto_(""), zmq_context_(1), zmq_pub_sock_(zmq_context_, ZMQ_PUB)
+ {
+ throw std::runtime_error("ERROR: No ZMQ protocol specified !");
+ }
+
+ DabOutputZMQ(std::string zmq_proto) :
+ zmq_proto_(zmq_proto), zmq_context_(1), zmq_pub_sock_(zmq_context_, ZMQ_PUB)
+ { }
+
+
+ DabOutputZMQ(const DabOutputZMQ& other) :
+ zmq_proto_(other.zmq_proto_), zmq_context_(1), zmq_pub_sock_(zmq_context_, ZMQ_PUB)
+ {
+ // cannot copy context
+ }
+
+ ~DabOutputZMQ()
+ {
+ zmq_pub_sock_.close();
+ }
+
+ int Open(const char* name);
+ int Write(void* buffer, int size);
+ int Close();
+ private:
+ std::string zmq_proto_;
+ zmq::context_t zmq_context_; // handle for the zmq context
+ zmq::socket_t zmq_pub_sock_; // handle for the zmq publisher socket
+};
+
+#endif
+
#endif
diff --git a/src/dabOutput/dabOutputFifo.cpp b/src/dabOutput/dabOutputFifo.cpp
index 49fc331..1674cd8 100644
--- a/src/dabOutput/dabOutputFifo.cpp
+++ b/src/dabOutput/dabOutputFifo.cpp
@@ -1,3 +1,28 @@
+/*
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Her Majesty the Queen in
+ Right of Canada (Communications Research Center Canada)
+
+ Copyright (C) 2013 Matthias P. Braendli
+ http://mpb.li
+
+ Fifo output is very similar to file, except it doesn't seek
+ */
+/*
+ This file is part of CRC-DabMux.
+
+ CRC-DabMux is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ CRC-DabMux 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with CRC-DabMux. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <cstdio>
#include <cstring>
#include <fcntl.h>
diff --git a/src/dabOutput/dabOutputFile.cpp b/src/dabOutput/dabOutputFile.cpp
index 349a308..6512c5a 100644
--- a/src/dabOutput/dabOutputFile.cpp
+++ b/src/dabOutput/dabOutputFile.cpp
@@ -1,3 +1,28 @@
+/*
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Her Majesty the Queen in
+ Right of Canada (Communications Research Center Canada)
+
+ Copyright (C) 2013 Matthias P. Braendli
+ http://mpb.li
+
+ File output
+ */
+/*
+ This file is part of CRC-DabMux.
+
+ CRC-DabMux is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ CRC-DabMux 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with CRC-DabMux. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <cstdio>
#include <cstring>
#include <fcntl.h>
diff --git a/src/dabOutput/dabOutputRaw.cpp b/src/dabOutput/dabOutputRaw.cpp
index 1a78b63..a9cd2a9 100644
--- a/src/dabOutput/dabOutputRaw.cpp
+++ b/src/dabOutput/dabOutputRaw.cpp
@@ -1,3 +1,28 @@
+/*
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Her Majesty the Queen in
+ Right of Canada (Communications Research Center Canada)
+
+ Copyright (C) 2013 Matthias P. Braendli
+ http://mpb.li
+
+ RAW output used for farsync
+ */
+/*
+ This file is part of CRC-DabMux.
+
+ CRC-DabMux is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ CRC-DabMux 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with CRC-DabMux. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <cstdio>
#include <cstring>
#include "dabOutput.h"
diff --git a/src/dabOutput/dabOutputSimul.cpp b/src/dabOutput/dabOutputSimul.cpp
index e53b4ba..176649b 100644
--- a/src/dabOutput/dabOutputSimul.cpp
+++ b/src/dabOutput/dabOutputSimul.cpp
@@ -1,3 +1,28 @@
+/*
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Her Majesty the Queen in
+ Right of Canada (Communications Research Center Canada)
+
+ Copyright (C) 2013 Matthias P. Braendli
+ http://mpb.li
+
+ SIMUL throttling output. It guarantees correct frame generation rate
+ */
+/*
+ This file is part of CRC-DabMux.
+
+ CRC-DabMux is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ CRC-DabMux 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with CRC-DabMux. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "dabOutput.h"
#include <cstring>
#include <cstdio>
diff --git a/src/dabOutput/dabOutputTcp.cpp b/src/dabOutput/dabOutputTcp.cpp
index a3d7a5a..c59eacb 100644
--- a/src/dabOutput/dabOutputTcp.cpp
+++ b/src/dabOutput/dabOutputTcp.cpp
@@ -1,3 +1,28 @@
+/*
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Her Majesty the Queen in
+ Right of Canada (Communications Research Center Canada)
+
+ Copyright (C) 2013 Matthias P. Braendli
+ http://mpb.li
+
+ TCP output
+ */
+/*
+ This file is part of CRC-DabMux.
+
+ CRC-DabMux is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ CRC-DabMux 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with CRC-DabMux. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <cstring>
#include <cstdio>
#include <signal.h>
diff --git a/src/dabOutput/dabOutputUdp.cpp b/src/dabOutput/dabOutputUdp.cpp
index 1410071..684cd50 100644
--- a/src/dabOutput/dabOutputUdp.cpp
+++ b/src/dabOutput/dabOutputUdp.cpp
@@ -1,3 +1,29 @@
+/*
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Her Majesty the Queen in
+ Right of Canada (Communications Research Center Canada)
+
+ Copyright (C) 2013 Matthias P. Braendli
+ http://mpb.li
+
+ UDP output
+ */
+/*
+ This file is part of CRC-DabMux.
+
+ CRC-DabMux is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ CRC-DabMux 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with CRC-DabMux. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include <cstring>
#include <cstdio>
#include <limits.h>
diff --git a/src/dabOutput/dabOutputZMQ.cpp b/src/dabOutput/dabOutputZMQ.cpp
new file mode 100644
index 0000000..271cfa1
--- /dev/null
+++ b/src/dabOutput/dabOutputZMQ.cpp
@@ -0,0 +1,78 @@
+/*
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Her Majesty the Queen in
+ Right of Canada (Communications Research Center Canada)
+
+ Copyright (C) 2013 Matthias P. Braendli
+ http://mpb.li
+
+ ZeroMQ output. see www.zeromq.org for more info
+
+ From the ZeroMQ manpage 'zmq':
+
+ The 0MQ lightweight messaging kernel is a library which extends the standard
+ socket interfaces with features traditionally provided by specialised
+ messaging middleware products. 0MQ sockets provide an abstraction of
+ asynchronous message queues, multiple messaging patterns, message filtering
+ (subscriptions), seamless access to multiple transport protocols and more.
+
+ */
+/*
+ This file is part of CRC-DabMux.
+
+ CRC-DabMux is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ CRC-DabMux 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with CRC-DabMux. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "config.h"
+
+#if defined(HAVE_OUTPUT_ZEROMQ)
+
+#include <stdexcept>
+#include <cstdio>
+#include <cstring>
+#include <signal.h>
+#include <limits.h>
+#include <unistd.h>
+#include <errno.h>
+#include <zmq.hpp>
+#include "dabOutput.h"
+
+using namespace std;
+
+int DabOutputZMQ::Open(const char* endpoint)
+ // the format for endpoint shall be as defined in the zmq_bind manpage
+ // but without specifying the protocol. The protocol has been given in
+ // the constructor
+{
+ // bind to uri
+ string proto_endpoint = zmq_proto_ + "://" + std::string(endpoint);
+ std::cerr << "ZMQ socket " << proto_endpoint << std::endl;
+ zmq_pub_sock_.bind(proto_endpoint.c_str());
+
+ return 0;
+}
+
+
+int DabOutputZMQ::Write(void* buffer, int size)
+{
+ int flags = 0;
+
+ return zmq_send(zmq_pub_sock_, buffer, size, flags);
+}
+
+
+int DabOutputZMQ::Close()
+{
+ return zmq_close(zmq_pub_sock_);
+}
+
+#endif