From 91e1aea0dbe771bad98c07b852acc4003125a2bf Mon Sep 17 00:00:00 2001 From: tomspur Date: Sun, 25 Jul 2010 12:19:21 +0000 Subject: [PATCH 01/71] initial commit (#603233) --- .cvsignore | 1 + sources | 1 + zeromq.spec | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 zeromq.spec diff --git a/.cvsignore b/.cvsignore index e69de29..9abced5 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +zeromq-2.0.7.tar.gz diff --git a/sources b/sources index e69de29..58f57d6 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +c9cb3ee4499df1781f8ddc03c20d656b zeromq-2.0.7.tar.gz diff --git a/zeromq.spec b/zeromq.spec new file mode 100644 index 0000000..6fc4719 --- /dev/null +++ b/zeromq.spec @@ -0,0 +1,108 @@ +Name: zeromq +Version: 2.0.7 +Release: 4%{?dist} +Summary: Software library for fast, message-based applications + +Group: System Environment/Libraries +License: LGPLv3+ +URL: http://www.zeromq.org +# VCS: git:http://github.com/zeromq/zeromq2.git +Source0: http://www.zeromq.org/local--files/area:download/zeromq-%{version}.tar.gz + +BuildRequires: glib2-devel +BuildRequires: libuuid-devel + + +%description +The 0MQ lightweight messaging kernel is a library which extends the +standard socket interfaces with features traditionally provided by +specialized messaging middle-ware 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 package contains the ZeroMQ shared library. + + +%package devel +Summary: Development files for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + + +%package utils +Summary: Utility files for %{name} +Group: Development/Tools +Requires: %{name} = %{version}-%{release} + + +%description utils +This package contains ZeroMQ related utility files, +e.g. zmq_forwarder, zmq_streamer and zmq_queue. + + +%prep +%setup -q + + +%build +%configure --disable-static +make %{?_smp_mflags} + + +%install +make install DESTDIR=%{buildroot} INSTALL="install -p" + +# remove *.la +rm %{buildroot}%{_libdir}/libzmq.la + + +%post -p /sbin/ldconfig + + +%postun -p /sbin/ldconfig + + +%files +%defattr(-,root,root,-) +%doc AUTHORS ChangeLog COPYING COPYING.LESSER NEWS README +%{_libdir}/libzmq.so.* + +%files devel +%defattr(-,root,root,-) +%{_libdir}/libzmq.so +%{_libdir}/pkgconfig/libzmq.pc +%{_includedir}/zmq.* +%{_mandir}/man3/zmq* +%{_mandir}/man7/zmq* + + +%files utils +%defattr(-,root,root,-) +%{_bindir}/zmq_forwarder +%{_bindir}/zmq_queue +%{_bindir}/zmq_streamer +%{_mandir}/man1/zmq* + + +%changelog +* Fri Jul 23 2010 Thomas Spura - 2.0.7-4 +- upstream VCS changed +- remove buildroot / %%clean +- change descriptions + +* Tue Jul 20 2010 Thomas Spura - 2.0.7-3 +- move binaries to seperate utils package + +* Sat Jun 12 2010 Thomas Spura - 2.0.7-2 +- remove BR: libstdc++-devel +- move man3 to the devel package +- change group to System Environment/Libraries + +* Sat Jun 12 2010 Thomas Spura - 2.0.7-1 +- initial package (based on upstreams example one) From 45c5ededdbb7cf121fd204a64c44c04ea8c1a838 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 29 Jul 2010 16:29:13 +0000 Subject: [PATCH 02/71] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- 2 files changed, 21 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index b93c38a..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: zeromq -# $Id$ -NAME := zeromq -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) From 86b7e03b6f1193ea37e9dfa085669216b49d4f86 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Fri, 27 Aug 2010 13:17:49 +0200 Subject: [PATCH 03/71] update to new version --- .gitignore | 1 + sources | 2 +- zeromq.spec | 10 ++++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 9abced5..8321145 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ zeromq-2.0.7.tar.gz +/zeromq-2.0.8.tar.gz diff --git a/sources b/sources index 58f57d6..2ea3fae 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c9cb3ee4499df1781f8ddc03c20d656b zeromq-2.0.7.tar.gz +6a5c362deaaa24e0e94b42e13f68da51 zeromq-2.0.8.tar.gz diff --git a/zeromq.spec b/zeromq.spec index 6fc4719..e768840 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,6 +1,6 @@ Name: zeromq -Version: 2.0.7 -Release: 4%{?dist} +Version: 2.0.8 +Release: 1%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -77,7 +77,7 @@ rm %{buildroot}%{_libdir}/libzmq.la %defattr(-,root,root,-) %{_libdir}/libzmq.so %{_libdir}/pkgconfig/libzmq.pc -%{_includedir}/zmq.* +%{_includedir}/zmq* %{_mandir}/man3/zmq* %{_mandir}/man7/zmq* @@ -87,10 +87,12 @@ rm %{buildroot}%{_libdir}/libzmq.la %{_bindir}/zmq_forwarder %{_bindir}/zmq_queue %{_bindir}/zmq_streamer -%{_mandir}/man1/zmq* %changelog +* Fri Aug 27 2010 Thomas Spura - 2.0.8-1 +- update to new version + * Fri Jul 23 2010 Thomas Spura - 2.0.7-4 - upstream VCS changed - remove buildroot / %%clean From 54ea8ea83267ecc6fcb7ec45dc0beb4e12b078c5 Mon Sep 17 00:00:00 2001 From: Pavel Zhukov Date: Thu, 13 Jan 2011 11:08:04 +0100 Subject: [PATCH 04/71] - update version - add rpath delete - change includedir filelist Signed-off-by: Thomas Spura --- .gitignore | 1 + sources | 2 +- zeromq.spec | 14 +++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8321145..81dc9ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ zeromq-2.0.7.tar.gz /zeromq-2.0.8.tar.gz +/zeromq-2.0.10.tar.gz diff --git a/sources b/sources index 2ea3fae..41c204a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -6a5c362deaaa24e0e94b42e13f68da51 zeromq-2.0.8.tar.gz +ab794a174210b9e8096a4efd1d1a4d42 zeromq-2.0.10.tar.gz diff --git a/zeromq.spec b/zeromq.spec index e768840..5b175d9 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,5 +1,5 @@ Name: zeromq -Version: 2.0.8 +Version: 2.0.10 Release: 1%{?dist} Summary: Software library for fast, message-based applications @@ -11,6 +11,7 @@ Source0: http://www.zeromq.org/local--files/area:download/zeromq-%{versio BuildRequires: glib2-devel BuildRequires: libuuid-devel +BuildRequires: chrpath %description @@ -61,6 +62,11 @@ make install DESTDIR=%{buildroot} INSTALL="install -p" # remove *.la rm %{buildroot}%{_libdir}/libzmq.la +# remove rpath +chrpath --delete %{buildroot}/%{_bindir}/zmq_forwarder +chrpath --delete %{buildroot}/%{_bindir}/zmq_queue +chrpath --delete %{buildroot}/%{_bindir}/zmq_streamer + %post -p /sbin/ldconfig @@ -87,9 +93,15 @@ rm %{buildroot}%{_libdir}/libzmq.la %{_bindir}/zmq_forwarder %{_bindir}/zmq_queue %{_bindir}/zmq_streamer +%{_mandir}/man1/zmq* %changelog +* Thu Jan 13 2011 Pavel Zhukov - 2.0.10-1 +- update version +- add rpath delete +- change includedir filelist + * Fri Aug 27 2010 Thomas Spura - 2.0.8-1 - update to new version From fe77403e22092917b7337e56689cda4651873667 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Tue, 8 Feb 2011 02:49:28 -0600 Subject: [PATCH 05/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 5b175d9..d621960 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,6 +1,6 @@ Name: zeromq Version: 2.0.10 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -97,6 +97,9 @@ chrpath --delete %{buildroot}/%{_bindir}/zmq_streamer %changelog +* Tue Feb 08 2011 Fedora Release Engineering - 2.0.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + * Thu Jan 13 2011 Pavel Zhukov - 2.0.10-1 - update version - add rpath delete From bac64aedf214ccd02537bb578edffca819b3873f Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 23 Mar 2011 17:17:59 +0100 Subject: [PATCH 06/71] update to new version and obsolete -utils subpackage --- zeromq.spec | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/zeromq.spec b/zeromq.spec index d621960..0e9f2ec 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,18 +1,20 @@ Name: zeromq -Version: 2.0.10 -Release: 2%{?dist} +Version: 2.1.3 +Release: 1%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries License: LGPLv3+ URL: http://www.zeromq.org # VCS: git:http://github.com/zeromq/zeromq2.git -Source0: http://www.zeromq.org/local--files/area:download/zeromq-%{version}.tar.gz +Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz BuildRequires: glib2-devel BuildRequires: libuuid-devel -BuildRequires: chrpath +# utils subpackage was removed in F-16 +# -> can be deleted in F-19 +Obsoletes: zeromq-utils < 2.1.3-1 %description The 0MQ lightweight messaging kernel is a library which extends the @@ -28,7 +30,7 @@ This package contains the ZeroMQ shared library. %package devel Summary: Development files for %{name} Group: Development/Libraries -Requires: %{name} = %{version}-%{release} +Requires: %{name}%{?_isa} = %{version}-%{release} %description devel @@ -36,17 +38,6 @@ The %{name}-devel package contains libraries and header files for developing applications that use %{name}. -%package utils -Summary: Utility files for %{name} -Group: Development/Tools -Requires: %{name} = %{version}-%{release} - - -%description utils -This package contains ZeroMQ related utility files, -e.g. zmq_forwarder, zmq_streamer and zmq_queue. - - %prep %setup -q @@ -62,11 +53,6 @@ make install DESTDIR=%{buildroot} INSTALL="install -p" # remove *.la rm %{buildroot}%{_libdir}/libzmq.la -# remove rpath -chrpath --delete %{buildroot}/%{_bindir}/zmq_forwarder -chrpath --delete %{buildroot}/%{_bindir}/zmq_queue -chrpath --delete %{buildroot}/%{_bindir}/zmq_streamer - %post -p /sbin/ldconfig @@ -88,15 +74,12 @@ chrpath --delete %{buildroot}/%{_bindir}/zmq_streamer %{_mandir}/man7/zmq* -%files utils -%defattr(-,root,root,-) -%{_bindir}/zmq_forwarder -%{_bindir}/zmq_queue -%{_bindir}/zmq_streamer -%{_mandir}/man1/zmq* - - %changelog +* Wed Mar 23 2011 Thomas Spura - 2.1.3-1 +- update to new version (#690199) +- utils subpackage was removed upstream + (obsolete it) + * Tue Feb 08 2011 Fedora Release Engineering - 2.0.10-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild From d5704206f1e8201558285de1bdc001e4df4e432b Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 23 Mar 2011 17:23:12 +0100 Subject: [PATCH 07/71] upload new sources --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 81dc9ab..a6b88fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ zeromq-2.0.7.tar.gz /zeromq-2.0.8.tar.gz /zeromq-2.0.10.tar.gz +/zeromq-2.1.3.tar.gz diff --git a/sources b/sources index 41c204a..b8b7faf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -ab794a174210b9e8096a4efd1d1a4d42 zeromq-2.0.10.tar.gz +ae681af2df1b7191aeecfcb23bb73864 zeromq-2.1.3.tar.gz From c007567440afaff8073f8e7e78eef7c7894df61a Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 6 Apr 2011 10:12:35 +0200 Subject: [PATCH 08/71] update to new version 2.1.4 (#690199) --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 0e9f2ec..7943566 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,5 +1,5 @@ Name: zeromq -Version: 2.1.3 +Version: 2.1.4 Release: 1%{?dist} Summary: Software library for fast, message-based applications @@ -75,6 +75,9 @@ rm %{buildroot}%{_libdir}/libzmq.la %changelog +* Wed Apr 6 2011 Thomas Spura - 2.1.4-1 +- update to new version (#690199) + * Wed Mar 23 2011 Thomas Spura - 2.1.3-1 - update to new version (#690199) - utils subpackage was removed upstream From 21335c1108cc7f0e006f964537617893eb6de1c9 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 6 Apr 2011 10:28:48 +0200 Subject: [PATCH 09/71] also upload new sources --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a6b88fe..cfa06ac 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ zeromq-2.0.7.tar.gz /zeromq-2.0.8.tar.gz /zeromq-2.0.10.tar.gz /zeromq-2.1.3.tar.gz +/zeromq-2.1.4.tar.gz diff --git a/sources b/sources index b8b7faf..b89bd59 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -ae681af2df1b7191aeecfcb23bb73864 zeromq-2.1.3.tar.gz +b9a8043792be3bfbf791e77bf3f259e8 zeromq-2.1.4.tar.gz From cbe2c061436293bb9cc9710abec3d57ca9958db2 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 21 Sep 2011 11:04:22 +0200 Subject: [PATCH 10/71] - update to 2.1.9 - add check section --- .gitignore | 1 + sources | 2 +- zeromq.spec | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index cfa06ac..065b726 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ zeromq-2.0.7.tar.gz /zeromq-2.0.10.tar.gz /zeromq-2.1.3.tar.gz /zeromq-2.1.4.tar.gz +/zeromq-2.1.9.tar.gz diff --git a/sources b/sources index b89bd59..b8c03fe 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -b9a8043792be3bfbf791e77bf3f259e8 zeromq-2.1.4.tar.gz +94c5e0262a79c5f82bc0b178c1f8a33d zeromq-2.1.9.tar.gz diff --git a/zeromq.spec b/zeromq.spec index 7943566..1625483 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,5 +1,5 @@ Name: zeromq -Version: 2.1.4 +Version: 2.1.9 Release: 1%{?dist} Summary: Software library for fast, message-based applications @@ -54,6 +54,10 @@ make install DESTDIR=%{buildroot} INSTALL="install -p" rm %{buildroot}%{_libdir}/libzmq.la +%check +make check + + %post -p /sbin/ldconfig @@ -75,6 +79,10 @@ rm %{buildroot}%{_libdir}/libzmq.la %changelog +* Tue Sep 20 2011 Thomas Spura - 2.1.9-1 +- update to 2.1.9 +- add check section + * Wed Apr 6 2011 Thomas Spura - 2.1.4-1 - update to new version (#690199) From e847db07f61650616e204785cae49feb0db9a59d Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 21 Sep 2011 11:15:14 +0200 Subject: [PATCH 11/71] Don't turn warnings into errors --- zeromq.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zeromq.spec b/zeromq.spec index 1625483..47aaa88 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -41,6 +41,10 @@ developing applications that use %{name}. %prep %setup -q +# Don't turn warnings into errors +sed -i "s/libzmq_werror=\"yes\"/libzmq_werror=\"no\"/g" \ + configure + %build %configure --disable-static From 7bb1f0682a3de2f801610b2d33cca9e01c9c4ff2 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 21 Sep 2011 19:01:40 +0200 Subject: [PATCH 12/71] libuuid-devel is e2fsprogs-devel in el5 according to Thomas S Hatch (Thanks for that info.) --- zeromq.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zeromq.spec b/zeromq.spec index 47aaa88..0fdbed8 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -10,7 +10,11 @@ URL: http://www.zeromq.org Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz BuildRequires: glib2-devel +%if ! 0%{?epel} > 5 +BuildRequires: e2fsprogs-devel +%else BuildRequires: libuuid-devel +%endif # utils subpackage was removed in F-16 # -> can be deleted in F-19 From df2bd545b9eb7d15054bbf126a83d8ad1ef1a3d4 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 21 Sep 2011 19:12:47 +0200 Subject: [PATCH 13/71] s/epel/rhel/g in macros --- zeromq.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 0fdbed8..61d69fe 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -10,7 +10,7 @@ URL: http://www.zeromq.org Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz BuildRequires: glib2-devel -%if ! 0%{?epel} > 5 +%if ! (0%{?rhel} > 5) BuildRequires: e2fsprogs-devel %else BuildRequires: libuuid-devel From e79487ceb6535f9ccbea07fff6fd8a6f918e89d6 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 21 Sep 2011 19:23:27 +0200 Subject: [PATCH 14/71] buildroot is needed on el5 --- zeromq.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/zeromq.spec b/zeromq.spec index 61d69fe..bcc543a 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -12,6 +12,7 @@ Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz BuildRequires: glib2-devel %if ! (0%{?rhel} > 5) BuildRequires: e2fsprogs-devel +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %else BuildRequires: libuuid-devel %endif From 5383752075a03b6d9c1f41f1f4d2fe9fcb202b58 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 21 Sep 2011 19:25:39 +0200 Subject: [PATCH 15/71] remove buildroot before installing (needed for el5) --- zeromq.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/zeromq.spec b/zeromq.spec index bcc543a..dd94f6e 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -57,6 +57,7 @@ make %{?_smp_mflags} %install +rm -rf %{buildroot} make install DESTDIR=%{buildroot} INSTALL="install -p" # remove *.la From c1495c09e95b2f0988d4211ae9a07afb8ac36c78 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Sun, 23 Oct 2011 01:39:41 +0200 Subject: [PATCH 16/71] handle epel6=fedora --- zeromq.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index dd94f6e..855c528 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -10,7 +10,7 @@ URL: http://www.zeromq.org Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz BuildRequires: glib2-devel -%if ! (0%{?rhel} > 5) +%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) BuildRequires: e2fsprogs-devel BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %else From 6a434707f2722024698d9f3a7a7649ca3c1bb9ea Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Sat, 7 Jan 2012 00:48:33 +0100 Subject: [PATCH 17/71] update to 2.1.11 --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 855c528..ca0026c 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,5 +1,5 @@ Name: zeromq -Version: 2.1.9 +Version: 2.1.11 Release: 1%{?dist} Summary: Software library for fast, message-based applications @@ -89,6 +89,9 @@ make check %changelog +* Sat Jan 7 2012 Thomas Spura - 2.1.11-1 +- update to 2.1.11 (as part of rebuilding with gcc-4.7) + * Tue Sep 20 2011 Thomas Spura - 2.1.9-1 - update to 2.1.9 - add check section From e206a0779b74c0f9f881e2e9b9b3fc2ac11542f7 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Sat, 7 Jan 2012 00:49:22 +0100 Subject: [PATCH 18/71] Upload sources for 2.1.11 --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 065b726..afc214e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ zeromq-2.0.7.tar.gz /zeromq-2.1.3.tar.gz /zeromq-2.1.4.tar.gz /zeromq-2.1.9.tar.gz +/zeromq-2.1.11.tar.gz diff --git a/sources b/sources index b8c03fe..fa4e8fa 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -94c5e0262a79c5f82bc0b178c1f8a33d zeromq-2.1.9.tar.gz +f0f9fd62acb1f0869d7aa80379b1f6b7 zeromq-2.1.11.tar.gz From 4ae1eb5fc51a8aa8da0d879024f3316be86eb57c Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Thu, 26 Apr 2012 13:09:41 +0200 Subject: [PATCH 19/71] update to 2.2.0 --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index ca0026c..bab1b59 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,5 +1,5 @@ Name: zeromq -Version: 2.1.11 +Version: 2.2.0 Release: 1%{?dist} Summary: Software library for fast, message-based applications @@ -89,6 +89,9 @@ make check %changelog +* Thu Apr 26 2012 Thomas Spura - 2.2.0-1 +- update to 2.2.0 + * Sat Jan 7 2012 Thomas Spura - 2.1.11-1 - update to 2.1.11 (as part of rebuilding with gcc-4.7) From 3b50b0b1d38ed177d722f8cb94ec53892c22f9c8 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Thu, 26 Apr 2012 13:11:11 +0200 Subject: [PATCH 20/71] upload sources for 2.2.0 --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index afc214e..6ee068f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ zeromq-2.0.7.tar.gz /zeromq-2.1.4.tar.gz /zeromq-2.1.9.tar.gz /zeromq-2.1.11.tar.gz +/zeromq-2.2.0.tar.gz diff --git a/sources b/sources index fa4e8fa..1fda5c2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -f0f9fd62acb1f0869d7aa80379b1f6b7 zeromq-2.1.11.tar.gz +1b11aae09b19d18276d0717b2ea288f6 zeromq-2.2.0.tar.gz From c802ef060e650ee773dbe5e8c131caa2011d6af4 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sun, 22 Jul 2012 03:14:11 -0500 Subject: [PATCH 21/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index bab1b59..6f3e29a 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,6 +1,6 @@ Name: zeromq Version: 2.2.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -89,6 +89,9 @@ make check %changelog +* Sun Jul 22 2012 Fedora Release Engineering - 2.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + * Thu Apr 26 2012 Thomas Spura - 2.2.0-1 - update to 2.2.0 From 084946f586a7f2519b136fa010827cda0afb2e13 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Mon, 24 Dec 2012 18:50:04 +0100 Subject: [PATCH 22/71] Build against openpgm - add bcond_without pgm macro (Jose Pedro Oliveira, #867182) - remove bundled pgm - build against openpgm --- zeromq.spec | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/zeromq.spec b/zeromq.spec index 6f3e29a..dea35a7 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,6 +1,8 @@ +%bcond_without pgm + Name: zeromq Version: 2.2.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -16,6 +18,9 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %else BuildRequires: libuuid-devel %endif +%if %{with pgm} +BuildRequires: openpgm-devel >= 5.1 +%endif # utils subpackage was removed in F-16 # -> can be deleted in F-19 @@ -50,9 +55,16 @@ developing applications that use %{name}. sed -i "s/libzmq_werror=\"yes\"/libzmq_werror=\"no\"/g" \ configure +# remove bundled libraries +rm -rvf foreign/*/*tar* + %build -%configure --disable-static +%configure \ +%if %{with pgm} + --with-system-pgm \ +%endif + --disable-static make %{?_smp_mflags} @@ -89,6 +101,11 @@ make check %changelog +* Mon Dec 24 2012 Thomas Spura - 2.2.0-3 +- add bcond_without pgm macro (Jose Pedro Oliveira, #867182) +- remove bundled pgm +- build against openpgm + * Sun Jul 22 2012 Fedora Release Engineering - 2.2.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild From 541d320bf12f0adad0d959fd146998a033818597 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Mon, 14 Jan 2013 09:18:53 +0100 Subject: [PATCH 23/71] delete foreign files with dubious license in %%prep (#892111) --- zeromq.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zeromq.spec b/zeromq.spec index dea35a7..efd41bf 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 2.2.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -55,8 +55,8 @@ developing applications that use %{name}. sed -i "s/libzmq_werror=\"yes\"/libzmq_werror=\"no\"/g" \ configure -# remove bundled libraries -rm -rvf foreign/*/*tar* +# remove all files in foreign except Makefiles +rm -v $(find foreign -type f | grep -v Makefile) %build @@ -101,6 +101,9 @@ make check %changelog +* Mon Jan 14 2013 Thomas Spura - 2.2.0-4 +- delete foreign files with dubious license in %%prep (#892111) + * Mon Dec 24 2012 Thomas Spura - 2.2.0-3 - add bcond_without pgm macro (Jose Pedro Oliveira, #867182) - remove bundled pgm From 7ca72a2b57129032075cb7d6794d7f084553f63b Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 14 Feb 2013 22:19:15 -0600 Subject: [PATCH 24/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index efd41bf..807df1b 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 2.2.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -101,6 +101,9 @@ make check %changelog +* Fri Feb 15 2013 Fedora Release Engineering - 2.2.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + * Mon Jan 14 2013 Thomas Spura - 2.2.0-4 - delete foreign files with dubious license in %%prep (#892111) From 9684f06abb6ddde5f57adc9e95a1d991a436bbdb Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 27 Mar 2013 16:37:00 +0100 Subject: [PATCH 25/71] run autoreconf before configure so aarch64 is supported (#926859) --- zeromq.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 807df1b..814da22 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 2.2.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -11,6 +11,8 @@ URL: http://www.zeromq.org # VCS: git:http://github.com/zeromq/zeromq2.git Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz +BuildRequires: autoconf + BuildRequires: glib2-devel %if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) BuildRequires: e2fsprogs-devel @@ -60,6 +62,7 @@ rm -v $(find foreign -type f | grep -v Makefile) %build +autoreconf -fi %configure \ %if %{with pgm} --with-system-pgm \ @@ -101,6 +104,9 @@ make check %changelog +* Wed Mar 27 2013 Thomas Spura - 2.2.0-6 +- run autoreconf before configure so aarch64 is supported (#926859) + * Fri Feb 15 2013 Fedora Release Engineering - 2.2.0-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild From 44f92545161960429c4777f57d640c3f7aa5dfcc Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 27 Mar 2013 16:54:07 +0100 Subject: [PATCH 26/71] also add automake to BR --- zeromq.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/zeromq.spec b/zeromq.spec index 814da22..a42adc1 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -12,6 +12,7 @@ URL: http://www.zeromq.org Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz BuildRequires: autoconf +BuildRequires: automake BuildRequires: glib2-devel %if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) From afc37757d4d2f02a8bf4edf073d3b6f700d88f11 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 27 Mar 2013 17:05:26 +0100 Subject: [PATCH 27/71] also add libtool to BR --- zeromq.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/zeromq.spec b/zeromq.spec index a42adc1..475a5d5 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -13,6 +13,7 @@ Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz BuildRequires: autoconf BuildRequires: automake +BuildRequires: libtool BuildRequires: glib2-devel %if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) From 38435b15259209ea73347f2e0dd0595833bc152e Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Fri, 17 May 2013 15:17:40 +0200 Subject: [PATCH 28/71] Rebuilt for openpm-5.2 and sed correct version into configure (#963894) --- zeromq.spec | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/zeromq.spec b/zeromq.spec index 475a5d5..39ce448 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 2.2.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -23,7 +23,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: libuuid-devel %endif %if %{with pgm} -BuildRequires: openpgm-devel >= 5.1 +BuildRequires: openpgm-devel %endif # utils subpackage was removed in F-16 @@ -59,6 +59,12 @@ developing applications that use %{name}. sed -i "s/libzmq_werror=\"yes\"/libzmq_werror=\"no\"/g" \ configure +# Sed version number of openpgm into configure +%global openpgm_pc $(basename %{_libdir}/pkgconfig/openpgm*.pc .pc) +sed -i "s/openpgm-[0-9].[0-9]/%{openpgm_pc}/g" \ + configure + + # remove all files in foreign except Makefiles rm -v $(find foreign -type f | grep -v Makefile) @@ -106,6 +112,9 @@ make check %changelog +* Fri May 17 2013 Thomas Spura - 2.2.0-7 +- Rebuilt for openpm-5.2 and sed correct version into configure (#963894) + * Wed Mar 27 2013 Thomas Spura - 2.2.0-6 - run autoreconf before configure so aarch64 is supported (#926859) From f4c4f8f588f9bd780e51716cc06f922bd910374d Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Fri, 17 May 2013 15:35:50 +0200 Subject: [PATCH 29/71] Rewrite openpgm version in configure* --- zeromq.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 39ce448..0f286ad 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -62,7 +62,7 @@ sed -i "s/libzmq_werror=\"yes\"/libzmq_werror=\"no\"/g" \ # Sed version number of openpgm into configure %global openpgm_pc $(basename %{_libdir}/pkgconfig/openpgm*.pc .pc) sed -i "s/openpgm-[0-9].[0-9]/%{openpgm_pc}/g" \ - configure + configure* # remove all files in foreign except Makefiles From 1737a29108690cdd0259ec129d7178efca0ba031 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sun, 4 Aug 2013 04:49:37 -0500 Subject: [PATCH 30/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 0f286ad..52d38b2 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 2.2.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -112,6 +112,9 @@ make check %changelog +* Sun Aug 04 2013 Fedora Release Engineering - 2.2.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + * Fri May 17 2013 Thomas Spura - 2.2.0-7 - Rebuilt for openpm-5.2 and sed correct version into configure (#963894) From f3126646bb0db81d9d19fb98bfd6ad743c6b2929 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sat, 7 Jun 2014 13:07:22 -0500 Subject: [PATCH 31/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 52d38b2..1d0bd00 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 2.2.0 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -112,6 +112,9 @@ make check %changelog +* Sat Jun 07 2014 Fedora Release Engineering - 2.2.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + * Sun Aug 04 2013 Fedora Release Engineering - 2.2.0-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild From 81d32678f978e2af58f871cde96ac7a0fa695f89 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 18 Aug 2014 11:36:00 +0000 Subject: [PATCH 32/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 1d0bd00..f8ec1fa 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 2.2.0 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -112,6 +112,9 @@ make check %changelog +* Mon Aug 18 2014 Fedora Release Engineering - 2.2.0-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + * Sat Jun 07 2014 Fedora Release Engineering - 2.2.0-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild From 1340e1cf54cc6573c2e2ee521e3ffb4532cf4f4c Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Mon, 17 Nov 2014 08:44:51 +0100 Subject: [PATCH 33/71] update to 4.0.5 --- .gitignore | 1 + sources | 2 +- zeromq.spec | 15 +++++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 6ee068f..513bb95 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ zeromq-2.0.7.tar.gz /zeromq-2.1.9.tar.gz /zeromq-2.1.11.tar.gz /zeromq-2.2.0.tar.gz +/zeromq-4.0.5.tar.gz diff --git a/sources b/sources index 1fda5c2..e82bc8c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -1b11aae09b19d18276d0717b2ea288f6 zeromq-2.2.0.tar.gz +73c39f5eb01b9d7eaf74a5d899f1d03d zeromq-4.0.5.tar.gz diff --git a/zeromq.spec b/zeromq.spec index f8ec1fa..1b00dff 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,8 +1,8 @@ %bcond_without pgm Name: zeromq -Version: 2.2.0 -Release: 10%{?dist} +Version: 4.0.5 +Release: 1%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -55,6 +55,9 @@ developing applications that use %{name}. %prep %setup -q +# zeromq.x86_64: W: file-not-utf8 /usr/share/doc/zeromq/ChangeLog +iconv -f iso8859-1 -t utf-8 ChangeLog > ChangeLog.conv && mv -f ChangeLog.conv ChangeLog + # Don't turn warnings into errors sed -i "s/libzmq_werror=\"yes\"/libzmq_werror=\"no\"/g" \ configure @@ -76,7 +79,7 @@ autoreconf -fi --with-system-pgm \ %endif --disable-static -make %{?_smp_mflags} +make %{?_smp_mflags} V=1 %install @@ -99,7 +102,8 @@ make check %files %defattr(-,root,root,-) -%doc AUTHORS ChangeLog COPYING COPYING.LESSER NEWS README +%doc AUTHORS ChangeLog COPYING COPYING.LESSER NEWS README.md +%{_bindir}/curve_keygen %{_libdir}/libzmq.so.* %files devel @@ -112,6 +116,9 @@ make check %changelog +* Mon Nov 17 2014 Thomas Spura - 4.0.5-1 +- update to 4.0.5 + * Mon Aug 18 2014 Fedora Release Engineering - 2.2.0-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild From a3f209629dfa7fc12f64171b68cbba8426423c76 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Sat, 2 May 2015 18:51:44 +0200 Subject: [PATCH 34/71] Rebuilt for GCC 5 C++11 ABI change --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 1b00dff..2bccb37 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.0.5 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -116,6 +116,9 @@ make check %changelog +* Sat May 02 2015 Kalev Lember - 4.0.5-2 +- Rebuilt for GCC 5 C++11 ABI change + * Mon Nov 17 2014 Thomas Spura - 4.0.5-1 - update to 4.0.5 From 1f0ba93f7f1173a733c1381c79f54f9955860ccc Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Tue, 19 May 2015 23:29:32 +0200 Subject: [PATCH 35/71] Cherry-pick patch for protocol downgrade attack (#1221666) --- zeromq-4.0.5-downgrade-attack.patch | 430 ++++++++++++++++++++++++++++ zeromq.spec | 7 +- 2 files changed, 436 insertions(+), 1 deletion(-) create mode 100644 zeromq-4.0.5-downgrade-attack.patch diff --git a/zeromq-4.0.5-downgrade-attack.patch b/zeromq-4.0.5-downgrade-attack.patch new file mode 100644 index 0000000..1526b05 --- /dev/null +++ b/zeromq-4.0.5-downgrade-attack.patch @@ -0,0 +1,430 @@ +From 77ef79e3b565f120172c6d1c30fabec6185553da Mon Sep 17 00:00:00 2001 +From: Pieter Hintjens +Date: Fri, 5 Dec 2014 09:07:37 +0100 +Subject: [PATCH] Problem: issue #1273, protocol downgrade attack + +Solution: backport fix from libzmq master. Also backported test +cases. +--- + NEWS | 4 +- + src/session_base.cpp | 8 +++ + src/session_base.hpp | 3 +- + src/stream_engine.cpp | 15 ++++++ + tests/test_security_curve.cpp | 66 ++++++++++++++++++++--- + tests/test_security_null.cpp | 121 ++++++++++++++++++++++++++---------------- + tests/test_security_plain.cpp | 37 ++++++++++++- + 7 files changed, 197 insertions(+), 57 deletions(-) + +diff --git a/src/session_base.cpp b/src/session_base.cpp +index 537dcb3..0b58436 100644 +--- a/src/session_base.cpp ++++ b/src/session_base.cpp +@@ -323,6 +323,14 @@ int zmq::session_base_t::zap_connect () + return 0; + } + ++bool zmq::session_base_t::zap_enabled () ++{ ++ return ( ++ options.mechanism != ZMQ_NULL || ++ (options.mechanism == ZMQ_NULL && options.zap_domain.length() > 0) ++ ); ++} ++ + void zmq::session_base_t::process_attach (i_engine *engine_) + { + zmq_assert (engine_ != NULL); +diff --git a/src/session_base.hpp b/src/session_base.hpp +index 2ef7dc5..63e16bd 100644 +--- a/src/session_base.hpp ++++ b/src/session_base.hpp +@@ -68,7 +68,8 @@ namespace zmq + int push_msg (msg_t *msg_); + + int zap_connect (); +- ++ bool zap_enabled (); ++ + // Fetches a message. Returns 0 if successful; -1 otherwise. + // The caller is responsible for freeing the message when no + // longer used. +diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp +index 4d252d8..3d84d8f 100644 +--- a/src/stream_engine.cpp ++++ b/src/stream_engine.cpp +@@ -464,6 +464,11 @@ bool zmq::stream_engine_t::handshake () + // Is the peer using ZMTP/1.0 with no revision number? + // If so, we send and receive rest of identity message + if (greeting_recv [0] != 0xff || !(greeting_recv [9] & 0x01)) { ++ if (session->zap_enabled ()) { ++ // Reject ZMTP 1.0 connections if ZAP is enabled ++ error (); ++ return false; ++ } + encoder = new (std::nothrow) v1_encoder_t (out_batch_size); + alloc_assert (encoder); + +@@ -505,6 +510,11 @@ bool zmq::stream_engine_t::handshake () + } + else + if (greeting_recv [revision_pos] == ZMTP_1_0) { ++ if (session->zap_enabled ()) { ++ // Reject ZMTP 1.0 connections if ZAP is enabled ++ error (); ++ return false; ++ } + encoder = new (std::nothrow) v1_encoder_t ( + out_batch_size); + alloc_assert (encoder); +@@ -515,6 +525,11 @@ bool zmq::stream_engine_t::handshake () + } + else + if (greeting_recv [revision_pos] == ZMTP_2_0) { ++ if (session->zap_enabled ()) { ++ // Reject ZMTP 1.0 connections if ZAP is enabled ++ error (); ++ return false; ++ } + encoder = new (std::nothrow) v2_encoder_t (out_batch_size); + alloc_assert (encoder); + +diff --git a/tests/test_security_curve.cpp b/tests/test_security_curve.cpp +index a24466f..e99a4b3 100644 +--- a/tests/test_security_curve.cpp ++++ b/tests/test_security_curve.cpp +@@ -18,12 +18,23 @@ + */ + + #include "testutil.hpp" ++#if defined (ZMQ_HAVE_WINDOWS) ++# include ++# include ++# include ++# define close closesocket ++#else ++# include ++# include ++# include ++# include ++#endif + + // We'll generate random test keys at startup +-static char client_public [40]; +-static char client_secret [40]; +-static char server_public [40]; +-static char server_secret [40]; ++static char client_public [41]; ++static char client_secret [41]; ++static char server_public [41]; ++static char server_secret [41]; + + // -------------------------------------------------------------------------- + // This methods receives and validates ZAP requestes (allowing or denying +@@ -46,7 +57,7 @@ static void zap_handler (void *handler) + int size = zmq_recv (handler, client_key, 32, 0); + assert (size == 32); + +- char client_key_text [40]; ++ char client_key_text [41]; + zmq_z85_encode (client_key_text, client_key, 32); + + assert (streq (version, "1.0")); +@@ -181,8 +192,8 @@ int main (void) + + // Check CURVE security with bogus client credentials + // This must be caught by the ZAP handler +- char bogus_public [40]; +- char bogus_secret [40]; ++ char bogus_public [41]; ++ char bogus_secret [41]; + zmq_curve_keypair (bogus_public, bogus_secret); + + client = zmq_socket (ctx, ZMQ_DEALER); +@@ -217,7 +228,46 @@ int main (void) + assert (rc == 0); + expect_bounce_fail (server, client); + close_zero_linger (client); +- ++ ++ // Unauthenticated messages from a vanilla socket shouldn't be received ++ struct sockaddr_in ip4addr; ++ int s; ++ ++ ip4addr.sin_family = AF_INET; ++ ip4addr.sin_port = htons (9998); ++ inet_pton (AF_INET, "127.0.0.1", &ip4addr.sin_addr); ++ ++ s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); ++ rc = connect (s, (struct sockaddr*) &ip4addr, sizeof (ip4addr)); ++ assert (rc > -1); ++ // send anonymous ZMTP/1.0 greeting ++ send (s, "\x01\x00", 2, 0); ++ // send sneaky message that shouldn't be received ++ send (s, "\x08\x00sneaky\0", 9, 0); ++ int timeout = 150; ++ zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout)); ++ char *buf = s_recv (server); ++ if (buf != NULL) { ++ printf ("Received unauthenticated message: %s\n", buf); ++ assert (buf == NULL); ++ } ++ close (s); ++ ++ // Check return codes for invalid buffer sizes ++ client = zmq_socket (ctx, ZMQ_DEALER); ++ assert (client); ++ errno = 0; ++ rc = zmq_setsockopt (client, ZMQ_CURVE_SERVERKEY, server_public, 123); ++ assert (rc == -1 && errno == EINVAL); ++ errno = 0; ++ rc = zmq_setsockopt (client, ZMQ_CURVE_PUBLICKEY, client_public, 123); ++ assert (rc == -1 && errno == EINVAL); ++ errno = 0; ++ rc = zmq_setsockopt (client, ZMQ_CURVE_SECRETKEY, client_secret, 123); ++ assert (rc == -1 && errno == EINVAL); ++ rc = zmq_close (client); ++ assert (rc == 0); ++ + // Shutdown + rc = zmq_close (server); + assert (rc == 0); +diff --git a/tests/test_security_null.cpp b/tests/test_security_null.cpp +index 8a55632..6b74e8c 100644 +--- a/tests/test_security_null.cpp ++++ b/tests/test_security_null.cpp +@@ -1,5 +1,5 @@ + /* +- Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file ++ Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file + + This file is part of 0MQ. + +@@ -18,6 +18,17 @@ + */ + + #include "testutil.hpp" ++#if defined (ZMQ_HAVE_WINDOWS) ++# include ++# include ++# include ++# define close closesocket ++#else ++# include ++# include ++# include ++# include ++#endif + + static void + zap_handler (void *handler) +@@ -27,6 +38,7 @@ zap_handler (void *handler) + char *version = s_recv (handler); + if (!version) + break; // Terminating ++ + char *sequence = s_recv (handler); + char *domain = s_recv (handler); + char *address = s_recv (handler); +@@ -57,7 +69,7 @@ zap_handler (void *handler) + free (identity); + free (mechanism); + } +- zmq_close (handler); ++ close_zero_linger (handler); + } + + int main (void) +@@ -76,72 +88,89 @@ int main (void) + void *zap_thread = zmq_threadstart (&zap_handler, handler); + + // We bounce between a binding server and a connecting client ++ ++ // We first test client/server with no ZAP domain ++ // Libzmq does not call our ZAP handler, the connect must succeed + void *server = zmq_socket (ctx, ZMQ_DEALER); + assert (server); + void *client = zmq_socket (ctx, ZMQ_DEALER); + assert (client); +- +- // We first test client/server with no ZAP domain +- // Libzmq does not call our ZAP handler, the connect must succeed + rc = zmq_bind (server, "tcp://127.0.0.1:9000"); + assert (rc == 0); +- rc = zmq_connect (client, "tcp://localhost:9000"); ++ rc = zmq_connect (client, "tcp://127.0.0.1:9000"); + assert (rc == 0); + bounce (server, client); +- zmq_unbind (server, "tcp://127.0.0.1:9000"); +- zmq_disconnect (client, "tcp://localhost:9000"); +- ++ close_zero_linger (client); ++ close_zero_linger (server); ++ + // Now define a ZAP domain for the server; this enables + // authentication. We're using the wrong domain so this test + // must fail. +- // ************************************************************** +- // PH: the following causes libzmq to get confused, so that the +- // next step fails. To reproduce, uncomment this block. Note that +- // even creating a new client/server socket pair, the behaviour +- // does not change. +- // ************************************************************** +- // Destroying the old sockets and creating new ones isn't needed, +- // but it shows that the problem isn't related to specific sockets. +- //close_zero_linger (client); +- //close_zero_linger (server); +- //server = zmq_socket (ctx, ZMQ_DEALER); +- //assert (server); +- //client = zmq_socket (ctx, ZMQ_DEALER); +- //assert (client); +- //// The above code should not be required +- //rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5); +- //assert (rc == 0); +- //rc = zmq_bind (server, "tcp://127.0.0.1:9001"); +- //assert (rc == 0); +- //rc = zmq_connect (client, "tcp://localhost:9001"); +- //assert (rc == 0); +- //expect_bounce_fail (server, client); +- //zmq_unbind (server, "tcp://127.0.0.1:9001"); +- //zmq_disconnect (client, "tcp://localhost:9001"); +- ++ server = zmq_socket (ctx, ZMQ_DEALER); ++ assert (server); ++ client = zmq_socket (ctx, ZMQ_DEALER); ++ assert (client); ++ rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5); ++ assert (rc == 0); ++ rc = zmq_bind (server, "tcp://127.0.0.1:9001"); ++ assert (rc == 0); ++ rc = zmq_connect (client, "tcp://127.0.0.1:9001"); ++ assert (rc == 0); ++ expect_bounce_fail (server, client); ++ close_zero_linger (client); ++ close_zero_linger (server); ++ + // Now use the right domain, the test must pass ++ server = zmq_socket (ctx, ZMQ_DEALER); ++ assert (server); ++ client = zmq_socket (ctx, ZMQ_DEALER); ++ assert (client); + rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "TEST", 4); + assert (rc == 0); + rc = zmq_bind (server, "tcp://127.0.0.1:9002"); + assert (rc == 0); +- rc = zmq_connect (client, "tcp://localhost:9002"); ++ rc = zmq_connect (client, "tcp://127.0.0.1:9002"); + assert (rc == 0); +- // ************************************************************** +- // PH: it fails here; though the ZAP reply is 200 OK, and +- // null_mechanism.cpp correctly parses that, the connection +- // never succeeds and the test hangs. +- // ************************************************************** + bounce (server, client); +- zmq_unbind (server, "tcp://127.0.0.1:9002"); +- zmq_disconnect (client, "tcp://localhost:9002"); +- +- // Shutdown + close_zero_linger (client); + close_zero_linger (server); +- rc = zmq_ctx_term (ctx); ++ ++ // Unauthenticated messages from a vanilla socket shouldn't be received ++ server = zmq_socket (ctx, ZMQ_DEALER); ++ assert (server); ++ rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5); + assert (rc == 0); ++ rc = zmq_bind (server, "tcp://127.0.0.1:9003"); ++ assert (rc == 0); ++ ++ struct sockaddr_in ip4addr; ++ int s; ++ ++ ip4addr.sin_family = AF_INET; ++ ip4addr.sin_port = htons(9003); ++ inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); + +- // Wait until ZAP handler terminates. ++ s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); ++ rc = connect (s, (struct sockaddr*) &ip4addr, sizeof ip4addr); ++ assert (rc > -1); ++ // send anonymous ZMTP/1.0 greeting ++ send (s, "\x01\x00", 2, 0); ++ // send sneaky message that shouldn't be received ++ send (s, "\x08\x00sneaky\0", 9, 0); ++ int timeout = 150; ++ zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout)); ++ char *buf = s_recv (server); ++ if (buf != NULL) { ++ printf ("Received unauthenticated message: %s\n", buf); ++ assert (buf == NULL); ++ } ++ close (s); ++ close_zero_linger (server); ++ ++ // Shutdown ++ rc = zmq_ctx_term (ctx); ++ assert (rc == 0); ++ // Wait until ZAP handler terminates + zmq_threadclose (zap_thread); + + return 0; +diff --git a/tests/test_security_plain.cpp b/tests/test_security_plain.cpp +index 74973fd..c257840 100644 +--- a/tests/test_security_plain.cpp ++++ b/tests/test_security_plain.cpp +@@ -1,5 +1,5 @@ + /* +- Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file ++ Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file + + This file is part of 0MQ. + +@@ -18,6 +18,17 @@ + */ + + #include "testutil.hpp" ++#if defined (ZMQ_HAVE_WINDOWS) ++# include ++# include ++# include ++# define close closesocket ++#else ++# include ++# include ++# include ++# include ++#endif + + static void + zap_handler (void *ctx) +@@ -137,6 +148,30 @@ int main (void) + expect_bounce_fail (server, client); + close_zero_linger (client); + ++ // Unauthenticated messages from a vanilla socket shouldn't be received ++ struct sockaddr_in ip4addr; ++ int s; ++ ++ ip4addr.sin_family = AF_INET; ++ ip4addr.sin_port = htons (9998); ++ inet_pton (AF_INET, "127.0.0.1", &ip4addr.sin_addr); ++ ++ s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); ++ rc = connect (s, (struct sockaddr*) &ip4addr, sizeof (ip4addr)); ++ assert (rc > -1); ++ // send anonymous ZMTP/1.0 greeting ++ send (s, "\x01\x00", 2, 0); ++ // send sneaky message that shouldn't be received ++ send (s, "\x08\x00sneaky\0", 9, 0); ++ int timeout = 150; ++ zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout)); ++ char *buf = s_recv (server); ++ if (buf != NULL) { ++ printf ("Received unauthenticated message: %s\n", buf); ++ assert (buf == NULL); ++ } ++ close (s); ++ + // Shutdown + rc = zmq_close (server); + assert (rc == 0); diff --git a/zeromq.spec b/zeromq.spec index 2bccb37..5dd3ece 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.0.5 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -10,6 +10,7 @@ License: LGPLv3+ URL: http://www.zeromq.org # VCS: git:http://github.com/zeromq/zeromq2.git Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz +Patch0: zeromq-4.0.5-downgrade-attack.patch BuildRequires: autoconf BuildRequires: automake @@ -54,6 +55,7 @@ developing applications that use %{name}. %prep %setup -q +%patch0 -p1 # zeromq.x86_64: W: file-not-utf8 /usr/share/doc/zeromq/ChangeLog iconv -f iso8859-1 -t utf-8 ChangeLog > ChangeLog.conv && mv -f ChangeLog.conv ChangeLog @@ -116,6 +118,9 @@ make check %changelog +* Tue May 19 2015 Thomas Spura - 4.0.5-3 +- Cherry-pick patch for protocol downgrade attack (#1221666) + * Sat May 02 2015 Kalev Lember - 4.0.5-2 - Rebuilt for GCC 5 C++11 ABI change From 778f84a18386e613b65c2d640816a6113a3f40a7 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Tue, 19 May 2015 23:30:20 +0200 Subject: [PATCH 36/71] Remove Provides:zeromq-utils --- zeromq.spec | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/zeromq.spec b/zeromq.spec index 5dd3ece..c45a6dc 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -27,10 +27,6 @@ BuildRequires: libuuid-devel BuildRequires: openpgm-devel %endif -# utils subpackage was removed in F-16 -# -> can be deleted in F-19 -Obsoletes: zeromq-utils < 2.1.3-1 - %description The 0MQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by @@ -120,6 +116,7 @@ make check %changelog * Tue May 19 2015 Thomas Spura - 4.0.5-3 - Cherry-pick patch for protocol downgrade attack (#1221666) +- Remove Provides:zeromq-utils * Sat May 02 2015 Kalev Lember - 4.0.5-2 - Rebuilt for GCC 5 C++11 ABI change From e6cddf9458ac82a9ab555746a0c1d7c388662ea7 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Tue, 19 May 2015 23:31:38 +0200 Subject: [PATCH 37/71] remove %%defattr --- zeromq.spec | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zeromq.spec b/zeromq.spec index c45a6dc..22964e7 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -45,7 +45,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release} %description devel -The %{name}-devel package contains libraries and header files for +The %{name}-devel package contains libraries and header files for developing applications that use %{name}. @@ -99,13 +99,11 @@ make check %files -%defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING COPYING.LESSER NEWS README.md %{_bindir}/curve_keygen %{_libdir}/libzmq.so.* %files devel -%defattr(-,root,root,-) %{_libdir}/libzmq.so %{_libdir}/pkgconfig/libzmq.pc %{_includedir}/zmq* @@ -117,6 +115,7 @@ make check * Tue May 19 2015 Thomas Spura - 4.0.5-3 - Cherry-pick patch for protocol downgrade attack (#1221666) - Remove Provides:zeromq-utils +- Remove %%defattr * Sat May 02 2015 Kalev Lember - 4.0.5-2 - Rebuilt for GCC 5 C++11 ABI change From 66b20ffa04a64dba662611091f62dfebc7c31df2 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Wed, 20 May 2015 00:03:21 +0200 Subject: [PATCH 38/71] Fix changelog. Obsoletes:zeromq-utils was removed not Provides: --- zeromq.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 22964e7..cac27ba 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -114,7 +114,7 @@ make check %changelog * Tue May 19 2015 Thomas Spura - 4.0.5-3 - Cherry-pick patch for protocol downgrade attack (#1221666) -- Remove Provides:zeromq-utils +- Remove Obsoletes:zeromq-utils - Remove %%defattr * Sat May 02 2015 Kalev Lember - 4.0.5-2 From f7093ac2e380ae9f69163e4f2037dd8a43b2718a Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Thu, 21 May 2015 16:41:46 +0200 Subject: [PATCH 39/71] Add cve for protocol downgrad attack --- zeromq.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index cac27ba..652de8e 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -113,7 +113,7 @@ make check %changelog * Tue May 19 2015 Thomas Spura - 4.0.5-3 -- Cherry-pick patch for protocol downgrade attack (#1221666) +- Cherry-pick patch for protocol downgrade attack (#1221666, CVE-2014-9721) - Remove Obsoletes:zeromq-utils - Remove %%defattr From 4c7a024ec39daf62a93d9774a04d5b38fc744d64 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Mon, 8 Jun 2015 10:20:50 +0200 Subject: [PATCH 40/71] Add zmq.hpp, which originally belonged to zeromq --- LICENSE | 17 ++ zeromq.spec | 31 ++- zmq.hpp | 602 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 647 insertions(+), 3 deletions(-) create mode 100644 LICENSE create mode 100644 zmq.hpp diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ae98bd8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,17 @@ + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. diff --git a/zeromq.spec b/zeromq.spec index 652de8e..2bbe06c 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.0.5 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -11,6 +11,8 @@ URL: http://www.zeromq.org # VCS: git:http://github.com/zeromq/zeromq2.git Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz Patch0: zeromq-4.0.5-downgrade-attack.patch +Source1: https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp +Source2: https://raw.githubusercontent.com/zeromq/cppzmq/master/LICENSE BuildRequires: autoconf BuildRequires: automake @@ -49,9 +51,22 @@ The %{name}-devel package contains libraries and header files for developing applications that use %{name}. +%package -n cppzmq-devel +Summary: Development files for cppzmq +Group: Development/Libraries +License: MIT +Requires: %{name}-devel%{?_isa} = %{version}-%{release} + + +%description -n cppzmq-devel +The cppzmq-devel package contains libraries and header files for +developing applications that use the C++ header files of %{name}. + + %prep %setup -q %patch0 -p1 +cp -a %{SOURCE2} . # zeromq.x86_64: W: file-not-utf8 /usr/share/doc/zeromq/ChangeLog iconv -f iso8859-1 -t utf-8 ChangeLog > ChangeLog.conv && mv -f ChangeLog.conv ChangeLog @@ -83,6 +98,7 @@ make %{?_smp_mflags} V=1 %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} INSTALL="install -p" +install -m 644 -p %{SOURCE1} %{buildroot}%{_includedir}/ # remove *.la rm %{buildroot}%{_libdir}/libzmq.la @@ -99,19 +115,28 @@ make check %files -%doc AUTHORS ChangeLog COPYING COPYING.LESSER NEWS README.md +%doc AUTHORS ChangeLog NEWS README.md +%license COPYING COPYING.LESSER %{_bindir}/curve_keygen %{_libdir}/libzmq.so.* %files devel %{_libdir}/libzmq.so %{_libdir}/pkgconfig/libzmq.pc -%{_includedir}/zmq* +%{_includedir}/zmq*.h %{_mandir}/man3/zmq* %{_mandir}/man7/zmq* +%files -n cppzmq-devel +%license LICENSE +%{_includedir}/zmq.hpp + %changelog +* Mon Jun 08 2015 Thomas Spura - 4.0.5-4 +- Add zmq.hpp, which originally belonged to zeromq: + https://github.com/zeromq/cppzmq/issues/48 + * Tue May 19 2015 Thomas Spura - 4.0.5-3 - Cherry-pick patch for protocol downgrade attack (#1221666, CVE-2014-9721) - Remove Obsoletes:zeromq-utils diff --git a/zmq.hpp b/zmq.hpp new file mode 100644 index 0000000..eb5416e --- /dev/null +++ b/zmq.hpp @@ -0,0 +1,602 @@ +/* + Copyright (c) 2009-2011 250bpm s.r.o. + Copyright (c) 2011 Botond Ballo + Copyright (c) 2007-2009 iMatix Corporation + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. +*/ + +#ifndef __ZMQ_HPP_INCLUDED__ +#define __ZMQ_HPP_INCLUDED__ + +#include + +#include +#include +#include +#include +#include + +// Detect whether the compiler supports C++11 rvalue references. +#if (defined(__GNUC__) && (__GNUC__ > 4 || \ + (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && \ + defined(__GXX_EXPERIMENTAL_CXX0X__)) + #define ZMQ_HAS_RVALUE_REFS + #define ZMQ_DELETED_FUNCTION = delete +#elif defined(__clang__) + #if __has_feature(cxx_rvalue_references) + #define ZMQ_HAS_RVALUE_REFS + #endif + + #if __has_feature(cxx_deleted_functions) + #define ZMQ_DELETED_FUNCTION = delete + #else + #define ZMQ_DELETED_FUNCTION + #endif +#elif defined(_MSC_VER) && (_MSC_VER >= 1600) + #define ZMQ_HAS_RVALUE_REFS + #define ZMQ_DELETED_FUNCTION +#else + #define ZMQ_DELETED_FUNCTION +#endif + +#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3, 3, 0) +#define ZMQ_NEW_MONITOR_EVENT_LAYOUT +#endif + +#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) +#define ZMQ_HAS_PROXY_STEERABLE +/* Socket event data */ +typedef struct { + uint16_t event; // id of the event as bitfield + int32_t value ; // value is either error code, fd or reconnect interval +} zmq_event_t; +#endif + +// In order to prevent unused variable warnings when building in non-debug +// mode use this macro to make assertions. +#ifndef NDEBUG +# define ZMQ_ASSERT(expression) assert(expression) +#else +# define ZMQ_ASSERT(expression) (void)(expression) +#endif + +namespace zmq +{ + + typedef zmq_free_fn free_fn; + typedef zmq_pollitem_t pollitem_t; + + class error_t : public std::exception + { + public: + + error_t () : errnum (zmq_errno ()) {} + + virtual const char *what () const throw () + { + return zmq_strerror (errnum); + } + + int num () const + { + return errnum; + } + + private: + + int errnum; + }; + + inline int poll (zmq_pollitem_t *items_, int nitems_, long timeout_ = -1) + { + int rc = zmq_poll (items_, nitems_, timeout_); + if (rc < 0) + throw error_t (); + return rc; + } + + inline void proxy (void *frontend, void *backend, void *capture) + { + int rc = zmq_proxy (frontend, backend, capture); + if (rc != 0) + throw error_t (); + } + +#ifdef ZMQ_HAS_PROXY_STEERABLE + inline void proxy_steerable (void *frontend, void *backend, void *capture, void *control) + { + int rc = zmq_proxy_steerable (frontend, backend, capture, control); + if (rc != 0) + throw error_t (); + } +#endif + + inline void version (int *major_, int *minor_, int *patch_) + { + zmq_version (major_, minor_, patch_); + } + + class message_t + { + friend class socket_t; + + public: + + inline message_t () + { + int rc = zmq_msg_init (&msg); + if (rc != 0) + throw error_t (); + } + + inline explicit message_t (size_t size_) + { + int rc = zmq_msg_init_size (&msg, size_); + if (rc != 0) + throw error_t (); + } + + inline message_t (void *data_, size_t size_, free_fn *ffn_, + void *hint_ = NULL) + { + int rc = zmq_msg_init_data (&msg, data_, size_, ffn_, hint_); + if (rc != 0) + throw error_t (); + } + +#ifdef ZMQ_HAS_RVALUE_REFS + inline message_t (message_t &&rhs) : msg (rhs.msg) + { + int rc = zmq_msg_init (&rhs.msg); + if (rc != 0) + throw error_t (); + } + + inline message_t &operator = (message_t &&rhs) + { + std::swap (msg, rhs.msg); + return *this; + } +#endif + + inline ~message_t () + { + int rc = zmq_msg_close (&msg); + ZMQ_ASSERT (rc == 0); + } + + inline void rebuild () + { + int rc = zmq_msg_close (&msg); + if (rc != 0) + throw error_t (); + rc = zmq_msg_init (&msg); + if (rc != 0) + throw error_t (); + } + + inline void rebuild (size_t size_) + { + int rc = zmq_msg_close (&msg); + if (rc != 0) + throw error_t (); + rc = zmq_msg_init_size (&msg, size_); + if (rc != 0) + throw error_t (); + } + + inline void rebuild (void *data_, size_t size_, free_fn *ffn_, + void *hint_ = NULL) + { + int rc = zmq_msg_close (&msg); + if (rc != 0) + throw error_t (); + rc = zmq_msg_init_data (&msg, data_, size_, ffn_, hint_); + if (rc != 0) + throw error_t (); + } + + inline void move (message_t *msg_) + { + int rc = zmq_msg_move (&msg, &(msg_->msg)); + if (rc != 0) + throw error_t (); + } + + inline void copy (message_t *msg_) + { + int rc = zmq_msg_copy (&msg, &(msg_->msg)); + if (rc != 0) + throw error_t (); + } + + inline bool more () + { + int rc = zmq_msg_more (&msg); + return rc != 0; + } + + inline void *data () + { + return zmq_msg_data (&msg); + } + + inline const void* data () const + { + return zmq_msg_data (const_cast(&msg)); + } + + inline size_t size () const + { + return zmq_msg_size (const_cast(&msg)); + } + + private: + + // The underlying message + zmq_msg_t msg; + + // Disable implicit message copying, so that users won't use shared + // messages (less efficient) without being aware of the fact. + message_t (const message_t&); + void operator = (const message_t&); + }; + + class context_t + { + friend class socket_t; + + public: + inline context_t () + { + ptr = zmq_ctx_new (); + if (ptr == NULL) + throw error_t (); + } + + + inline explicit context_t (int io_threads_, int max_sockets_ = ZMQ_MAX_SOCKETS_DFLT) + { + ptr = zmq_ctx_new (); + if (ptr == NULL) + throw error_t (); + + int rc = zmq_ctx_set (ptr, ZMQ_IO_THREADS, io_threads_); + ZMQ_ASSERT (rc == 0); + + rc = zmq_ctx_set (ptr, ZMQ_MAX_SOCKETS, max_sockets_); + ZMQ_ASSERT (rc == 0); + } + +#ifdef ZMQ_HAS_RVALUE_REFS + inline context_t (context_t &&rhs) : ptr (rhs.ptr) + { + rhs.ptr = NULL; + } + inline context_t &operator = (context_t &&rhs) + { + std::swap (ptr, rhs.ptr); + return *this; + } +#endif + + inline ~context_t () + { + close(); + } + + inline void close() + { + if (ptr == NULL) + return; + int rc = zmq_ctx_destroy (ptr); + ZMQ_ASSERT (rc == 0); + ptr = NULL; + } + + // Be careful with this, it's probably only useful for + // using the C api together with an existing C++ api. + // Normally you should never need to use this. + inline operator void* () + { + return ptr; + } + + private: + + void *ptr; + + context_t (const context_t&); + void operator = (const context_t&); + }; + + class socket_t + { + friend class monitor_t; + public: + + inline socket_t (context_t &context_, int type_) + { + ctxptr = context_.ptr; + ptr = zmq_socket (context_.ptr, type_); + if (ptr == NULL) + throw error_t (); + } + +#ifdef ZMQ_HAS_RVALUE_REFS + inline socket_t(socket_t&& rhs) : ptr(rhs.ptr) + { + rhs.ptr = NULL; + } + inline socket_t& operator=(socket_t&& rhs) + { + std::swap(ptr, rhs.ptr); + return *this; + } +#endif + + inline ~socket_t () + { + close(); + } + + inline operator void* () + { + return ptr; + } + + inline void close() + { + if(ptr == NULL) + // already closed + return ; + int rc = zmq_close (ptr); + ZMQ_ASSERT (rc == 0); + ptr = 0 ; + } + + inline void setsockopt (int option_, const void *optval_, + size_t optvallen_) + { + int rc = zmq_setsockopt (ptr, option_, optval_, optvallen_); + if (rc != 0) + throw error_t (); + } + + inline void getsockopt (int option_, void *optval_, + size_t *optvallen_) + { + int rc = zmq_getsockopt (ptr, option_, optval_, optvallen_); + if (rc != 0) + throw error_t (); + } + + inline void bind (const char *addr_) + { + int rc = zmq_bind (ptr, addr_); + if (rc != 0) + throw error_t (); + } + + inline void unbind (const char *addr_) + { + int rc = zmq_unbind (ptr, addr_); + if (rc != 0) + throw error_t (); + } + + inline void connect (const char *addr_) + { + int rc = zmq_connect (ptr, addr_); + if (rc != 0) + throw error_t (); + } + + inline void disconnect (const char *addr_) + { + int rc = zmq_disconnect (ptr, addr_); + if (rc != 0) + throw error_t (); + } + + inline bool connected() + { + return(ptr != NULL); + } + + inline size_t send (const void *buf_, size_t len_, int flags_ = 0) + { + int nbytes = zmq_send (ptr, buf_, len_, flags_); + if (nbytes >= 0) + return (size_t) nbytes; + if (zmq_errno () == EAGAIN) + return 0; + throw error_t (); + } + + inline bool send (message_t &msg_, int flags_ = 0) + { + int nbytes = zmq_msg_send (&(msg_.msg), ptr, flags_); + if (nbytes >= 0) + return true; + if (zmq_errno () == EAGAIN) + return false; + throw error_t (); + } + +#ifdef ZMQ_HAS_RVALUE_REFS + inline bool send (message_t &&msg_, int flags_ = 0) + { + return send(msg_, flags_); + } +#endif + + inline size_t recv (void *buf_, size_t len_, int flags_ = 0) + { + int nbytes = zmq_recv (ptr, buf_, len_, flags_); + if (nbytes >= 0) + return (size_t) nbytes; + if (zmq_errno () == EAGAIN) + return 0; + throw error_t (); + } + + inline bool recv (message_t *msg_, int flags_ = 0) + { + int nbytes = zmq_msg_recv (&(msg_->msg), ptr, flags_); + if (nbytes >= 0) + return true; + if (zmq_errno () == EAGAIN) + return false; + throw error_t (); + } + + private: + void *ptr; + void *ctxptr; + + socket_t (const socket_t&) ZMQ_DELETED_FUNCTION; + void operator = (const socket_t&) ZMQ_DELETED_FUNCTION; + }; + + class monitor_t + { + public: + monitor_t() : socketPtr(NULL) {} + virtual ~monitor_t() {} + + void monitor(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) + { + int rc = zmq_socket_monitor(socket.ptr, addr_, events); + if (rc != 0) + throw error_t (); + + socketPtr = socket.ptr; + void *s = zmq_socket (socket.ctxptr, ZMQ_PAIR); + assert (s); + + rc = zmq_connect (s, addr_); + assert (rc == 0); + + on_monitor_started(); + + while (true) { + zmq_msg_t eventMsg; + zmq_msg_init (&eventMsg); + rc = zmq_recvmsg (s, &eventMsg, 0); + if (rc == -1 && zmq_errno() == ETERM) + break; + assert (rc != -1); +#if ZMQ_VERSION_MAJOR >= 4 + const char* data = static_cast(zmq_msg_data(&eventMsg)); + zmq_event_t msgEvent; + memcpy(&msgEvent.event, data, sizeof(uint16_t)); data += sizeof(uint16_t); + memcpy(&msgEvent.value, data, sizeof(int32_t)); + zmq_event_t* event = &msgEvent; +#else + zmq_event_t* event = static_cast(zmq_msg_data(&eventMsg)); +#endif + +#ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT + zmq_msg_t addrMsg; + zmq_msg_init (&addrMsg); + rc = zmq_recvmsg (s, &addrMsg, 0); + if (rc == -1 && zmq_errno() == ETERM) + break; + assert (rc != -1); + const char* str = static_cast(zmq_msg_data (&addrMsg)); + std::string address(str, str + zmq_msg_size(&addrMsg)); + zmq_msg_close (&addrMsg); +#else + // Bit of a hack, but all events in the zmq_event_t union have the same layout so this will work for all event types. + std::string address = event->data.connected.addr; +#endif + +#ifdef ZMQ_EVENT_MONITOR_STOPPED + if (event->event == ZMQ_EVENT_MONITOR_STOPPED) + break; +#endif + + switch (event->event) { + case ZMQ_EVENT_CONNECTED: + on_event_connected(*event, address.c_str()); + break; + case ZMQ_EVENT_CONNECT_DELAYED: + on_event_connect_delayed(*event, address.c_str()); + break; + case ZMQ_EVENT_CONNECT_RETRIED: + on_event_connect_retried(*event, address.c_str()); + break; + case ZMQ_EVENT_LISTENING: + on_event_listening(*event, address.c_str()); + break; + case ZMQ_EVENT_BIND_FAILED: + on_event_bind_failed(*event, address.c_str()); + break; + case ZMQ_EVENT_ACCEPTED: + on_event_accepted(*event, address.c_str()); + break; + case ZMQ_EVENT_ACCEPT_FAILED: + on_event_accept_failed(*event, address.c_str()); + break; + case ZMQ_EVENT_CLOSED: + on_event_closed(*event, address.c_str()); + break; + case ZMQ_EVENT_CLOSE_FAILED: + on_event_close_failed(*event, address.c_str()); + break; + case ZMQ_EVENT_DISCONNECTED: + on_event_disconnected(*event, address.c_str()); + break; + default: + on_event_unknown(*event, address.c_str()); + break; + } + zmq_msg_close (&eventMsg); + } + zmq_close (s); + socketPtr = NULL; + } + +#ifdef ZMQ_EVENT_MONITOR_STOPPED + void abort() + { + if (socketPtr) + zmq_socket_monitor(socketPtr, NULL, 0); + } +#endif + virtual void on_monitor_started() {} + virtual void on_event_connected(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_connect_delayed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_connect_retried(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_listening(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_bind_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_accepted(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_accept_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_closed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_close_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_disconnected(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + virtual void on_event_unknown(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } + private: + void* socketPtr; + }; +} + +#endif From d9734a97793dcb7adf2c80ce8c6619ab3b0e88bd Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Fri, 19 Jun 2015 04:46:03 +0000 Subject: [PATCH 41/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 2bbe06c..16fd209 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.0.5 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -133,6 +133,9 @@ make check %changelog +* Fri Jun 19 2015 Fedora Release Engineering - 4.0.5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + * Mon Jun 08 2015 Thomas Spura - 4.0.5-4 - Add zmq.hpp, which originally belonged to zeromq: https://github.com/zeromq/cppzmq/issues/48 From d930586b918d8c6490610e321fa0091480849f9b Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Tue, 23 Jun 2015 10:58:13 +0200 Subject: [PATCH 42/71] update to 4.1.2 with a upstream patch to fix a problem with ipv6 --- .gitignore | 1 + sources | 2 +- zeromq-4.0.5-downgrade-attack.patch | 430 ---------------------------- zeromq-4.1.2-ipv6.patch | 43 +++ zeromq.spec | 18 +- 5 files changed, 54 insertions(+), 440 deletions(-) delete mode 100644 zeromq-4.0.5-downgrade-attack.patch create mode 100644 zeromq-4.1.2-ipv6.patch diff --git a/.gitignore b/.gitignore index 513bb95..293c7f6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ zeromq-2.0.7.tar.gz /zeromq-2.1.11.tar.gz /zeromq-2.2.0.tar.gz /zeromq-4.0.5.tar.gz +/zeromq-4.1.2.tar.gz diff --git a/sources b/sources index e82bc8c..de466cc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -73c39f5eb01b9d7eaf74a5d899f1d03d zeromq-4.0.5.tar.gz +159c0c56a895472f02668e692d122685 zeromq-4.1.2.tar.gz diff --git a/zeromq-4.0.5-downgrade-attack.patch b/zeromq-4.0.5-downgrade-attack.patch deleted file mode 100644 index 1526b05..0000000 --- a/zeromq-4.0.5-downgrade-attack.patch +++ /dev/null @@ -1,430 +0,0 @@ -From 77ef79e3b565f120172c6d1c30fabec6185553da Mon Sep 17 00:00:00 2001 -From: Pieter Hintjens -Date: Fri, 5 Dec 2014 09:07:37 +0100 -Subject: [PATCH] Problem: issue #1273, protocol downgrade attack - -Solution: backport fix from libzmq master. Also backported test -cases. ---- - NEWS | 4 +- - src/session_base.cpp | 8 +++ - src/session_base.hpp | 3 +- - src/stream_engine.cpp | 15 ++++++ - tests/test_security_curve.cpp | 66 ++++++++++++++++++++--- - tests/test_security_null.cpp | 121 ++++++++++++++++++++++++++---------------- - tests/test_security_plain.cpp | 37 ++++++++++++- - 7 files changed, 197 insertions(+), 57 deletions(-) - -diff --git a/src/session_base.cpp b/src/session_base.cpp -index 537dcb3..0b58436 100644 ---- a/src/session_base.cpp -+++ b/src/session_base.cpp -@@ -323,6 +323,14 @@ int zmq::session_base_t::zap_connect () - return 0; - } - -+bool zmq::session_base_t::zap_enabled () -+{ -+ return ( -+ options.mechanism != ZMQ_NULL || -+ (options.mechanism == ZMQ_NULL && options.zap_domain.length() > 0) -+ ); -+} -+ - void zmq::session_base_t::process_attach (i_engine *engine_) - { - zmq_assert (engine_ != NULL); -diff --git a/src/session_base.hpp b/src/session_base.hpp -index 2ef7dc5..63e16bd 100644 ---- a/src/session_base.hpp -+++ b/src/session_base.hpp -@@ -68,7 +68,8 @@ namespace zmq - int push_msg (msg_t *msg_); - - int zap_connect (); -- -+ bool zap_enabled (); -+ - // Fetches a message. Returns 0 if successful; -1 otherwise. - // The caller is responsible for freeing the message when no - // longer used. -diff --git a/src/stream_engine.cpp b/src/stream_engine.cpp -index 4d252d8..3d84d8f 100644 ---- a/src/stream_engine.cpp -+++ b/src/stream_engine.cpp -@@ -464,6 +464,11 @@ bool zmq::stream_engine_t::handshake () - // Is the peer using ZMTP/1.0 with no revision number? - // If so, we send and receive rest of identity message - if (greeting_recv [0] != 0xff || !(greeting_recv [9] & 0x01)) { -+ if (session->zap_enabled ()) { -+ // Reject ZMTP 1.0 connections if ZAP is enabled -+ error (); -+ return false; -+ } - encoder = new (std::nothrow) v1_encoder_t (out_batch_size); - alloc_assert (encoder); - -@@ -505,6 +510,11 @@ bool zmq::stream_engine_t::handshake () - } - else - if (greeting_recv [revision_pos] == ZMTP_1_0) { -+ if (session->zap_enabled ()) { -+ // Reject ZMTP 1.0 connections if ZAP is enabled -+ error (); -+ return false; -+ } - encoder = new (std::nothrow) v1_encoder_t ( - out_batch_size); - alloc_assert (encoder); -@@ -515,6 +525,11 @@ bool zmq::stream_engine_t::handshake () - } - else - if (greeting_recv [revision_pos] == ZMTP_2_0) { -+ if (session->zap_enabled ()) { -+ // Reject ZMTP 1.0 connections if ZAP is enabled -+ error (); -+ return false; -+ } - encoder = new (std::nothrow) v2_encoder_t (out_batch_size); - alloc_assert (encoder); - -diff --git a/tests/test_security_curve.cpp b/tests/test_security_curve.cpp -index a24466f..e99a4b3 100644 ---- a/tests/test_security_curve.cpp -+++ b/tests/test_security_curve.cpp -@@ -18,12 +18,23 @@ - */ - - #include "testutil.hpp" -+#if defined (ZMQ_HAVE_WINDOWS) -+# include -+# include -+# include -+# define close closesocket -+#else -+# include -+# include -+# include -+# include -+#endif - - // We'll generate random test keys at startup --static char client_public [40]; --static char client_secret [40]; --static char server_public [40]; --static char server_secret [40]; -+static char client_public [41]; -+static char client_secret [41]; -+static char server_public [41]; -+static char server_secret [41]; - - // -------------------------------------------------------------------------- - // This methods receives and validates ZAP requestes (allowing or denying -@@ -46,7 +57,7 @@ static void zap_handler (void *handler) - int size = zmq_recv (handler, client_key, 32, 0); - assert (size == 32); - -- char client_key_text [40]; -+ char client_key_text [41]; - zmq_z85_encode (client_key_text, client_key, 32); - - assert (streq (version, "1.0")); -@@ -181,8 +192,8 @@ int main (void) - - // Check CURVE security with bogus client credentials - // This must be caught by the ZAP handler -- char bogus_public [40]; -- char bogus_secret [40]; -+ char bogus_public [41]; -+ char bogus_secret [41]; - zmq_curve_keypair (bogus_public, bogus_secret); - - client = zmq_socket (ctx, ZMQ_DEALER); -@@ -217,7 +228,46 @@ int main (void) - assert (rc == 0); - expect_bounce_fail (server, client); - close_zero_linger (client); -- -+ -+ // Unauthenticated messages from a vanilla socket shouldn't be received -+ struct sockaddr_in ip4addr; -+ int s; -+ -+ ip4addr.sin_family = AF_INET; -+ ip4addr.sin_port = htons (9998); -+ inet_pton (AF_INET, "127.0.0.1", &ip4addr.sin_addr); -+ -+ s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); -+ rc = connect (s, (struct sockaddr*) &ip4addr, sizeof (ip4addr)); -+ assert (rc > -1); -+ // send anonymous ZMTP/1.0 greeting -+ send (s, "\x01\x00", 2, 0); -+ // send sneaky message that shouldn't be received -+ send (s, "\x08\x00sneaky\0", 9, 0); -+ int timeout = 150; -+ zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout)); -+ char *buf = s_recv (server); -+ if (buf != NULL) { -+ printf ("Received unauthenticated message: %s\n", buf); -+ assert (buf == NULL); -+ } -+ close (s); -+ -+ // Check return codes for invalid buffer sizes -+ client = zmq_socket (ctx, ZMQ_DEALER); -+ assert (client); -+ errno = 0; -+ rc = zmq_setsockopt (client, ZMQ_CURVE_SERVERKEY, server_public, 123); -+ assert (rc == -1 && errno == EINVAL); -+ errno = 0; -+ rc = zmq_setsockopt (client, ZMQ_CURVE_PUBLICKEY, client_public, 123); -+ assert (rc == -1 && errno == EINVAL); -+ errno = 0; -+ rc = zmq_setsockopt (client, ZMQ_CURVE_SECRETKEY, client_secret, 123); -+ assert (rc == -1 && errno == EINVAL); -+ rc = zmq_close (client); -+ assert (rc == 0); -+ - // Shutdown - rc = zmq_close (server); - assert (rc == 0); -diff --git a/tests/test_security_null.cpp b/tests/test_security_null.cpp -index 8a55632..6b74e8c 100644 ---- a/tests/test_security_null.cpp -+++ b/tests/test_security_null.cpp -@@ -1,5 +1,5 @@ - /* -- Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file -+ Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file - - This file is part of 0MQ. - -@@ -18,6 +18,17 @@ - */ - - #include "testutil.hpp" -+#if defined (ZMQ_HAVE_WINDOWS) -+# include -+# include -+# include -+# define close closesocket -+#else -+# include -+# include -+# include -+# include -+#endif - - static void - zap_handler (void *handler) -@@ -27,6 +38,7 @@ zap_handler (void *handler) - char *version = s_recv (handler); - if (!version) - break; // Terminating -+ - char *sequence = s_recv (handler); - char *domain = s_recv (handler); - char *address = s_recv (handler); -@@ -57,7 +69,7 @@ zap_handler (void *handler) - free (identity); - free (mechanism); - } -- zmq_close (handler); -+ close_zero_linger (handler); - } - - int main (void) -@@ -76,72 +88,89 @@ int main (void) - void *zap_thread = zmq_threadstart (&zap_handler, handler); - - // We bounce between a binding server and a connecting client -+ -+ // We first test client/server with no ZAP domain -+ // Libzmq does not call our ZAP handler, the connect must succeed - void *server = zmq_socket (ctx, ZMQ_DEALER); - assert (server); - void *client = zmq_socket (ctx, ZMQ_DEALER); - assert (client); -- -- // We first test client/server with no ZAP domain -- // Libzmq does not call our ZAP handler, the connect must succeed - rc = zmq_bind (server, "tcp://127.0.0.1:9000"); - assert (rc == 0); -- rc = zmq_connect (client, "tcp://localhost:9000"); -+ rc = zmq_connect (client, "tcp://127.0.0.1:9000"); - assert (rc == 0); - bounce (server, client); -- zmq_unbind (server, "tcp://127.0.0.1:9000"); -- zmq_disconnect (client, "tcp://localhost:9000"); -- -+ close_zero_linger (client); -+ close_zero_linger (server); -+ - // Now define a ZAP domain for the server; this enables - // authentication. We're using the wrong domain so this test - // must fail. -- // ************************************************************** -- // PH: the following causes libzmq to get confused, so that the -- // next step fails. To reproduce, uncomment this block. Note that -- // even creating a new client/server socket pair, the behaviour -- // does not change. -- // ************************************************************** -- // Destroying the old sockets and creating new ones isn't needed, -- // but it shows that the problem isn't related to specific sockets. -- //close_zero_linger (client); -- //close_zero_linger (server); -- //server = zmq_socket (ctx, ZMQ_DEALER); -- //assert (server); -- //client = zmq_socket (ctx, ZMQ_DEALER); -- //assert (client); -- //// The above code should not be required -- //rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5); -- //assert (rc == 0); -- //rc = zmq_bind (server, "tcp://127.0.0.1:9001"); -- //assert (rc == 0); -- //rc = zmq_connect (client, "tcp://localhost:9001"); -- //assert (rc == 0); -- //expect_bounce_fail (server, client); -- //zmq_unbind (server, "tcp://127.0.0.1:9001"); -- //zmq_disconnect (client, "tcp://localhost:9001"); -- -+ server = zmq_socket (ctx, ZMQ_DEALER); -+ assert (server); -+ client = zmq_socket (ctx, ZMQ_DEALER); -+ assert (client); -+ rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5); -+ assert (rc == 0); -+ rc = zmq_bind (server, "tcp://127.0.0.1:9001"); -+ assert (rc == 0); -+ rc = zmq_connect (client, "tcp://127.0.0.1:9001"); -+ assert (rc == 0); -+ expect_bounce_fail (server, client); -+ close_zero_linger (client); -+ close_zero_linger (server); -+ - // Now use the right domain, the test must pass -+ server = zmq_socket (ctx, ZMQ_DEALER); -+ assert (server); -+ client = zmq_socket (ctx, ZMQ_DEALER); -+ assert (client); - rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "TEST", 4); - assert (rc == 0); - rc = zmq_bind (server, "tcp://127.0.0.1:9002"); - assert (rc == 0); -- rc = zmq_connect (client, "tcp://localhost:9002"); -+ rc = zmq_connect (client, "tcp://127.0.0.1:9002"); - assert (rc == 0); -- // ************************************************************** -- // PH: it fails here; though the ZAP reply is 200 OK, and -- // null_mechanism.cpp correctly parses that, the connection -- // never succeeds and the test hangs. -- // ************************************************************** - bounce (server, client); -- zmq_unbind (server, "tcp://127.0.0.1:9002"); -- zmq_disconnect (client, "tcp://localhost:9002"); -- -- // Shutdown - close_zero_linger (client); - close_zero_linger (server); -- rc = zmq_ctx_term (ctx); -+ -+ // Unauthenticated messages from a vanilla socket shouldn't be received -+ server = zmq_socket (ctx, ZMQ_DEALER); -+ assert (server); -+ rc = zmq_setsockopt (server, ZMQ_ZAP_DOMAIN, "WRONG", 5); - assert (rc == 0); -+ rc = zmq_bind (server, "tcp://127.0.0.1:9003"); -+ assert (rc == 0); -+ -+ struct sockaddr_in ip4addr; -+ int s; -+ -+ ip4addr.sin_family = AF_INET; -+ ip4addr.sin_port = htons(9003); -+ inet_pton(AF_INET, "127.0.0.1", &ip4addr.sin_addr); - -- // Wait until ZAP handler terminates. -+ s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); -+ rc = connect (s, (struct sockaddr*) &ip4addr, sizeof ip4addr); -+ assert (rc > -1); -+ // send anonymous ZMTP/1.0 greeting -+ send (s, "\x01\x00", 2, 0); -+ // send sneaky message that shouldn't be received -+ send (s, "\x08\x00sneaky\0", 9, 0); -+ int timeout = 150; -+ zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout)); -+ char *buf = s_recv (server); -+ if (buf != NULL) { -+ printf ("Received unauthenticated message: %s\n", buf); -+ assert (buf == NULL); -+ } -+ close (s); -+ close_zero_linger (server); -+ -+ // Shutdown -+ rc = zmq_ctx_term (ctx); -+ assert (rc == 0); -+ // Wait until ZAP handler terminates - zmq_threadclose (zap_thread); - - return 0; -diff --git a/tests/test_security_plain.cpp b/tests/test_security_plain.cpp -index 74973fd..c257840 100644 ---- a/tests/test_security_plain.cpp -+++ b/tests/test_security_plain.cpp -@@ -1,5 +1,5 @@ - /* -- Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file -+ Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file - - This file is part of 0MQ. - -@@ -18,6 +18,17 @@ - */ - - #include "testutil.hpp" -+#if defined (ZMQ_HAVE_WINDOWS) -+# include -+# include -+# include -+# define close closesocket -+#else -+# include -+# include -+# include -+# include -+#endif - - static void - zap_handler (void *ctx) -@@ -137,6 +148,30 @@ int main (void) - expect_bounce_fail (server, client); - close_zero_linger (client); - -+ // Unauthenticated messages from a vanilla socket shouldn't be received -+ struct sockaddr_in ip4addr; -+ int s; -+ -+ ip4addr.sin_family = AF_INET; -+ ip4addr.sin_port = htons (9998); -+ inet_pton (AF_INET, "127.0.0.1", &ip4addr.sin_addr); -+ -+ s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); -+ rc = connect (s, (struct sockaddr*) &ip4addr, sizeof (ip4addr)); -+ assert (rc > -1); -+ // send anonymous ZMTP/1.0 greeting -+ send (s, "\x01\x00", 2, 0); -+ // send sneaky message that shouldn't be received -+ send (s, "\x08\x00sneaky\0", 9, 0); -+ int timeout = 150; -+ zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (timeout)); -+ char *buf = s_recv (server); -+ if (buf != NULL) { -+ printf ("Received unauthenticated message: %s\n", buf); -+ assert (buf == NULL); -+ } -+ close (s); -+ - // Shutdown - rc = zmq_close (server); - assert (rc == 0); diff --git a/zeromq-4.1.2-ipv6.patch b/zeromq-4.1.2-ipv6.patch new file mode 100644 index 0000000..d934a2e --- /dev/null +++ b/zeromq-4.1.2-ipv6.patch @@ -0,0 +1,43 @@ +From 81464652d2453c608bbbb52fd59e9e9f20857178 Mon Sep 17 00:00:00 2001 +From: Constantin Rack +Date: Tue, 23 Jun 2015 08:29:36 +0200 +Subject: [PATCH] Solution: allow brackets in tcp address. Fixes #43 + +--- + src/socket_base.cpp | 5 +++-- + tests/test_connect_resolve.cpp | 3 +++ + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/socket_base.cpp b/src/socket_base.cpp +index bff7068..f79af6f 100644 +--- a/src/socket_base.cpp ++++ b/src/socket_base.cpp +@@ -603,11 +603,12 @@ int zmq::socket_base_t::connect (const char *addr_) + // Following code is quick and dirty check to catch obvious errors, + // without trying to be fully accurate. + const char *check = address.c_str (); +- if (isalnum (*check) || isxdigit (*check)) { ++ if (isalnum (*check) || isxdigit (*check) || *check == '[') { + check++; + while (isalnum (*check) + || isxdigit (*check) +- || *check == '.' || *check == '-' || *check == ':'|| *check == ';') ++ || *check == '.' || *check == '-' || *check == ':'|| *check == ';' ++ || *check == ']') + check++; + } + // Assume the worst, now look for success +diff --git a/tests/test_connect_resolve.cpp b/tests/test_connect_resolve.cpp +index f9a7b9d..cb5353f 100644 +--- a/tests/test_connect_resolve.cpp ++++ b/tests/test_connect_resolve.cpp +@@ -41,6 +41,9 @@ int main (void) + int rc = zmq_connect (sock, "tcp://localhost:1234"); + assert (rc == 0); + ++ rc = zmq_connect (sock, "tcp://[::1]:4506"); ++ assert (rc == 0); ++ + rc = zmq_connect (sock, "tcp://localhost:invalid"); + assert (rc == -1); + diff --git a/zeromq.spec b/zeromq.spec index 16fd209..bd9bc70 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,8 +1,8 @@ %bcond_without pgm Name: zeromq -Version: 4.0.5 -Release: 5%{?dist} +Version: 4.1.2 +Release: 1%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -10,7 +10,7 @@ License: LGPLv3+ URL: http://www.zeromq.org # VCS: git:http://github.com/zeromq/zeromq2.git Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz -Patch0: zeromq-4.0.5-downgrade-attack.patch +Patch0: zeromq-4.1.2-ipv6.patch Source1: https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp Source2: https://raw.githubusercontent.com/zeromq/cppzmq/master/LICENSE @@ -81,10 +81,6 @@ sed -i "s/openpgm-[0-9].[0-9]/%{openpgm_pc}/g" \ configure* -# remove all files in foreign except Makefiles -rm -v $(find foreign -type f | grep -v Makefile) - - %build autoreconf -fi %configure \ @@ -105,7 +101,7 @@ rm %{buildroot}%{_libdir}/libzmq.la %check -make check +make check V=1 %post -p /sbin/ldconfig @@ -115,7 +111,7 @@ make check %files -%doc AUTHORS ChangeLog NEWS README.md +%doc AUTHORS ChangeLog MAINTAINERS NEWS %license COPYING COPYING.LESSER %{_bindir}/curve_keygen %{_libdir}/libzmq.so.* @@ -133,6 +129,10 @@ make check %changelog +* Tue Jun 23 2015 Thomas Spura - 4.1.2-1 +- update to 4.1.2 +- add upstream patch to fix problem with ipv6 + * Fri Jun 19 2015 Fedora Release Engineering - 4.0.5-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild From f003bc5816c2c3c1d26e051bc2af199a4edfd8b1 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Tue, 23 Jun 2015 11:08:49 +0200 Subject: [PATCH 43/71] Add missing BR:libsodium-devel --- zeromq.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/zeromq.spec b/zeromq.spec index bd9bc70..a93dd44 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -17,6 +17,7 @@ Source2: https://raw.githubusercontent.com/zeromq/cppzmq/master/LICENSE BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool +BuildRequires: libsodium-devel BuildRequires: glib2-devel %if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) From 729573e58e5b596dc3d0887543705a7cbb6b77db Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Mon, 24 Aug 2015 10:43:28 +0200 Subject: [PATCH 44/71] update to 4.1.3 - ipv6 patch included upstream - refresh zmq.hpp --- .gitignore | 1 + sources | 2 +- zeromq-4.1.2-ipv6.patch | 43 -------- zeromq.spec | 9 +- zmq.hpp | 227 +++++++++++++++++++++++++++++++++------- 5 files changed, 199 insertions(+), 83 deletions(-) delete mode 100644 zeromq-4.1.2-ipv6.patch diff --git a/.gitignore b/.gitignore index 293c7f6..3b6313f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ zeromq-2.0.7.tar.gz /zeromq-2.2.0.tar.gz /zeromq-4.0.5.tar.gz /zeromq-4.1.2.tar.gz +/zeromq-4.1.3.tar.gz diff --git a/sources b/sources index de466cc..840c944 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -159c0c56a895472f02668e692d122685 zeromq-4.1.2.tar.gz +d0824317348cfb44b8692e19cc73dc3a zeromq-4.1.3.tar.gz diff --git a/zeromq-4.1.2-ipv6.patch b/zeromq-4.1.2-ipv6.patch deleted file mode 100644 index d934a2e..0000000 --- a/zeromq-4.1.2-ipv6.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 81464652d2453c608bbbb52fd59e9e9f20857178 Mon Sep 17 00:00:00 2001 -From: Constantin Rack -Date: Tue, 23 Jun 2015 08:29:36 +0200 -Subject: [PATCH] Solution: allow brackets in tcp address. Fixes #43 - ---- - src/socket_base.cpp | 5 +++-- - tests/test_connect_resolve.cpp | 3 +++ - 2 files changed, 6 insertions(+), 2 deletions(-) - -diff --git a/src/socket_base.cpp b/src/socket_base.cpp -index bff7068..f79af6f 100644 ---- a/src/socket_base.cpp -+++ b/src/socket_base.cpp -@@ -603,11 +603,12 @@ int zmq::socket_base_t::connect (const char *addr_) - // Following code is quick and dirty check to catch obvious errors, - // without trying to be fully accurate. - const char *check = address.c_str (); -- if (isalnum (*check) || isxdigit (*check)) { -+ if (isalnum (*check) || isxdigit (*check) || *check == '[') { - check++; - while (isalnum (*check) - || isxdigit (*check) -- || *check == '.' || *check == '-' || *check == ':'|| *check == ';') -+ || *check == '.' || *check == '-' || *check == ':'|| *check == ';' -+ || *check == ']') - check++; - } - // Assume the worst, now look for success -diff --git a/tests/test_connect_resolve.cpp b/tests/test_connect_resolve.cpp -index f9a7b9d..cb5353f 100644 ---- a/tests/test_connect_resolve.cpp -+++ b/tests/test_connect_resolve.cpp -@@ -41,6 +41,9 @@ int main (void) - int rc = zmq_connect (sock, "tcp://localhost:1234"); - assert (rc == 0); - -+ rc = zmq_connect (sock, "tcp://[::1]:4506"); -+ assert (rc == 0); -+ - rc = zmq_connect (sock, "tcp://localhost:invalid"); - assert (rc == -1); - diff --git a/zeromq.spec b/zeromq.spec index a93dd44..0dd9cc4 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,7 +1,7 @@ %bcond_without pgm Name: zeromq -Version: 4.1.2 +Version: 4.1.3 Release: 1%{?dist} Summary: Software library for fast, message-based applications @@ -10,7 +10,6 @@ License: LGPLv3+ URL: http://www.zeromq.org # VCS: git:http://github.com/zeromq/zeromq2.git Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz -Patch0: zeromq-4.1.2-ipv6.patch Source1: https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp Source2: https://raw.githubusercontent.com/zeromq/cppzmq/master/LICENSE @@ -66,7 +65,6 @@ developing applications that use the C++ header files of %{name}. %prep %setup -q -%patch0 -p1 cp -a %{SOURCE2} . # zeromq.x86_64: W: file-not-utf8 /usr/share/doc/zeromq/ChangeLog @@ -130,6 +128,11 @@ make check V=1 %changelog +* Mon Aug 24 2015 Thomas Spura - 4.1.3-1 +- update to 4.1.3 (#1256209) +- ipv6 patch included upstream +- refresh zmq.hpp + * Tue Jun 23 2015 Thomas Spura - 4.1.2-1 - update to 4.1.2 - add upstream patch to fix problem with ipv6 diff --git a/zmq.hpp b/zmq.hpp index eb5416e..40177e5 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -25,6 +25,16 @@ #ifndef __ZMQ_HPP_INCLUDED__ #define __ZMQ_HPP_INCLUDED__ +#if __cplusplus >= 201103L +#define ZMQ_CPP11 +#define ZMQ_NOTHROW noexcept +#define ZMQ_EXPLICIT explicit +#else + #define ZMQ_CPP03 + #define ZMQ_NOTHROW + #define ZMQ_EXPLICIT +#endif + #include #include @@ -32,6 +42,13 @@ #include #include #include +#include +#include + +#ifdef ZMQ_CPP11 +#include +#include +#endif // Detect whether the compiler supports C++11 rvalue references. #if (defined(__GNUC__) && (__GNUC__ > 4 || \ @@ -104,14 +121,38 @@ namespace zmq int errnum; }; - inline int poll (zmq_pollitem_t *items_, int nitems_, long timeout_ = -1) + inline int poll (zmq_pollitem_t const* items_, int nitems_, long timeout_ = -1) { - int rc = zmq_poll (items_, nitems_, timeout_); + int rc = zmq_poll (const_cast(items_), nitems_, timeout_); if (rc < 0) throw error_t (); return rc; } + inline int poll(zmq_pollitem_t const* items, size_t nitems) + { + return poll(items, nitems, -1 ); + } + + #ifdef ZMQ_CPP11 + inline int poll(zmq_pollitem_t const* items, size_t nitems, std::chrono::milliseconds timeout) + { + return poll(items, nitems, timeout.count() ); + } + + inline int poll(std::vector const& items, std::chrono::milliseconds timeout) + { + return poll(items.data(), items.size(), timeout.count() ); + } + #endif + + inline int poll(std::vector const& items, long timeout_ = -1) + { + return poll(items.data(), items.size(), timeout_); + } + + + inline void proxy (void *frontend, void *backend, void *capture) { int rc = zmq_proxy (frontend, backend, capture); @@ -133,6 +174,15 @@ namespace zmq zmq_version (major_, minor_, patch_); } + #ifdef ZMQ_CPP11 + inline std::tuple version() + { + std::tuple v; + zmq_version(&std::get<0>(v), &std::get<1>(v), &std::get<2>(v) ); + return v; + } + #endif + class message_t { friend class socket_t; @@ -153,6 +203,19 @@ namespace zmq throw error_t (); } + template message_t(I first, I last): + msg() + { + typedef typename std::iterator_traits::difference_type size_type; + typedef typename std::iterator_traits::pointer pointer_t; + + size_type const size_ = std::distance(first, last); + int const rc = zmq_msg_init_size (&msg, size_); + if (rc != 0) + throw error_t (); + std::copy(first, last, static_cast(zmq_msg_data (&msg)) ); + } + inline message_t (void *data_, size_t size_, free_fn *ffn_, void *hint_ = NULL) { @@ -162,21 +225,21 @@ namespace zmq } #ifdef ZMQ_HAS_RVALUE_REFS - inline message_t (message_t &&rhs) : msg (rhs.msg) + inline message_t (message_t &&rhs): msg (rhs.msg) { int rc = zmq_msg_init (&rhs.msg); if (rc != 0) throw error_t (); } - inline message_t &operator = (message_t &&rhs) + inline message_t &operator = (message_t &&rhs) ZMQ_NOTHROW { std::swap (msg, rhs.msg); return *this; } #endif - inline ~message_t () + inline ~message_t () ZMQ_NOTHROW { int rc = zmq_msg_close (&msg); ZMQ_ASSERT (rc == 0); @@ -213,50 +276,60 @@ namespace zmq throw error_t (); } - inline void move (message_t *msg_) + inline void move (message_t const *msg_) { - int rc = zmq_msg_move (&msg, &(msg_->msg)); + int rc = zmq_msg_move (&msg, const_cast(&(msg_->msg))); if (rc != 0) throw error_t (); } - inline void copy (message_t *msg_) + inline void copy (message_t const *msg_) { - int rc = zmq_msg_copy (&msg, &(msg_->msg)); + int rc = zmq_msg_copy (&msg, const_cast(&(msg_->msg))); if (rc != 0) throw error_t (); } - inline bool more () + inline bool more () const ZMQ_NOTHROW { - int rc = zmq_msg_more (&msg); + int rc = zmq_msg_more (const_cast(&msg) ); return rc != 0; } - inline void *data () + inline void *data () ZMQ_NOTHROW { return zmq_msg_data (&msg); } - inline const void* data () const + inline const void* data () const ZMQ_NOTHROW { return zmq_msg_data (const_cast(&msg)); } - inline size_t size () const + inline size_t size () const ZMQ_NOTHROW { return zmq_msg_size (const_cast(&msg)); } - private: + template T* data() ZMQ_NOTHROW + { + return static_cast( data() ); + } + template T const* data() const ZMQ_NOTHROW + { + return static_cast( data() ); + } + + + private: // The underlying message zmq_msg_t msg; // Disable implicit message copying, so that users won't use shared // messages (less efficient) without being aware of the fact. - message_t (const message_t&); - void operator = (const message_t&); + message_t (const message_t&) ZMQ_DELETED_FUNCTION; + void operator = (const message_t&) ZMQ_DELETED_FUNCTION; }; class context_t @@ -286,23 +359,23 @@ namespace zmq } #ifdef ZMQ_HAS_RVALUE_REFS - inline context_t (context_t &&rhs) : ptr (rhs.ptr) + inline context_t (context_t &&rhs) ZMQ_NOTHROW : ptr (rhs.ptr) { rhs.ptr = NULL; } - inline context_t &operator = (context_t &&rhs) + inline context_t &operator = (context_t &&rhs) ZMQ_NOTHROW { std::swap (ptr, rhs.ptr); return *this; } #endif - inline ~context_t () + inline ~context_t () ZMQ_NOTHROW { close(); } - inline void close() + inline void close() ZMQ_NOTHROW { if (ptr == NULL) return; @@ -314,55 +387,85 @@ namespace zmq // Be careful with this, it's probably only useful for // using the C api together with an existing C++ api. // Normally you should never need to use this. - inline operator void* () + inline ZMQ_EXPLICIT operator void* () ZMQ_NOTHROW { return ptr; } + inline ZMQ_EXPLICIT operator void const* () const ZMQ_NOTHROW + { + return ptr; + } private: void *ptr; - context_t (const context_t&); - void operator = (const context_t&); + context_t (const context_t&) ZMQ_DELETED_FUNCTION; + void operator = (const context_t&) ZMQ_DELETED_FUNCTION; + }; + + #ifdef ZMQ_CPP11 + enum class socket_type: int + { + req = ZMQ_REQ, + rep = ZMQ_REP, + dealer = ZMQ_DEALER, + router = ZMQ_ROUTER, + pub = ZMQ_PUB, + sub = ZMQ_SUB, + xpub = ZMQ_XPUB, + xsub = ZMQ_XSUB, + push = ZMQ_PUSH, + pull = ZMQ_PULL, + pair = ZMQ_PAIR, + stream = ZMQ_STREAM }; + #endif class socket_t { friend class monitor_t; public: + inline socket_t(context_t& context_, int type_) + { + init(context_, type_); + } - inline socket_t (context_t &context_, int type_) + #ifdef ZMQ_CPP11 + inline socket_t(context_t& context_, socket_type type_) { - ctxptr = context_.ptr; - ptr = zmq_socket (context_.ptr, type_); - if (ptr == NULL) - throw error_t (); + init(context_, static_cast(type_)); } + #endif #ifdef ZMQ_HAS_RVALUE_REFS - inline socket_t(socket_t&& rhs) : ptr(rhs.ptr) + inline socket_t(socket_t&& rhs) ZMQ_NOTHROW : ptr(rhs.ptr) { rhs.ptr = NULL; } - inline socket_t& operator=(socket_t&& rhs) + inline socket_t& operator=(socket_t&& rhs) ZMQ_NOTHROW { std::swap(ptr, rhs.ptr); return *this; } #endif - inline ~socket_t () + inline ~socket_t () ZMQ_NOTHROW { close(); } - inline operator void* () + inline ZMQ_EXPLICIT operator void* () ZMQ_NOTHROW + { + return ptr; + } + + inline ZMQ_EXPLICIT operator void const* () const ZMQ_NOTHROW { return ptr; } - inline void close() + inline void close() ZMQ_NOTHROW { if(ptr == NULL) // already closed @@ -372,6 +475,11 @@ namespace zmq ptr = 0 ; } + template void setsockopt(int option_, T const& optval) + { + setsockopt(option_, &optval, sizeof(T) ); + } + inline void setsockopt (int option_, const void *optval_, size_t optvallen_) { @@ -387,7 +495,20 @@ namespace zmq if (rc != 0) throw error_t (); } - + + template T getsockopt(int option_) + { + T optval; + size_t optlen = sizeof(T); + getsockopt(option_, &optval, &optlen ); + return optval; + } + + inline void bind(std::string const& addr) + { + bind(addr.c_str()); + } + inline void bind (const char *addr_) { int rc = zmq_bind (ptr, addr_); @@ -395,6 +516,11 @@ namespace zmq throw error_t (); } + inline void unbind(std::string const& addr) + { + unbind(addr.c_str()); + } + inline void unbind (const char *addr_) { int rc = zmq_unbind (ptr, addr_); @@ -402,6 +528,11 @@ namespace zmq throw error_t (); } + inline void connect(std::string const& addr) + { + connect(addr.c_str()); + } + inline void connect (const char *addr_) { int rc = zmq_connect (ptr, addr_); @@ -409,6 +540,11 @@ namespace zmq throw error_t (); } + inline void disconnect(std::string const& addr) + { + disconnect(addr.c_str()); + } + inline void disconnect (const char *addr_) { int rc = zmq_disconnect (ptr, addr_); @@ -416,7 +552,7 @@ namespace zmq throw error_t (); } - inline bool connected() + inline bool connected() const ZMQ_NOTHROW { return(ptr != NULL); } @@ -441,6 +577,12 @@ namespace zmq throw error_t (); } + template bool send(I first, I last, int flags_=0) + { + zmq::message_t msg(first, last); + return send(msg, flags_); + } + #ifdef ZMQ_HAS_RVALUE_REFS inline bool send (message_t &&msg_, int flags_ = 0) { @@ -469,6 +611,14 @@ namespace zmq } private: + inline void init(context_t& context_, int type_) + { + ctxptr = context_.ptr; + ptr = zmq_socket (context_.ptr, type_ ); + if (ptr == NULL) + throw error_t (); + } + void *ptr; void *ctxptr; @@ -482,6 +632,11 @@ namespace zmq monitor_t() : socketPtr(NULL) {} virtual ~monitor_t() {} + void monitor(socket_t &socket, std::string const& addr, int events = ZMQ_EVENT_ALL) + { + monitor(socket, addr.c_str(), events); + } + void monitor(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) { int rc = zmq_socket_monitor(socket.ptr, addr_, events); From eb3bd66bd0ed2fc5804e1a8fd8064562e5858a18 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Sat, 19 Dec 2015 12:52:50 +0100 Subject: [PATCH 45/71] Update to 4.1.4 (#1292814) and refresh zmq.hpp --- .gitignore | 1 + sources | 2 +- zeromq.spec | 6 ++++- zmq.hpp | 64 +++++++++++++++++++++++++++++++++++++++-------------- 4 files changed, 55 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 3b6313f..d02af11 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ zeromq-2.0.7.tar.gz /zeromq-4.0.5.tar.gz /zeromq-4.1.2.tar.gz /zeromq-4.1.3.tar.gz +/zeromq-4.1.4.tar.gz diff --git a/sources b/sources index 840c944..6ce4e29 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d0824317348cfb44b8692e19cc73dc3a zeromq-4.1.3.tar.gz +a611ecc93fffeb6d058c0e6edf4ad4fb zeromq-4.1.4.tar.gz diff --git a/zeromq.spec b/zeromq.spec index 0dd9cc4..03ac70d 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,7 +1,7 @@ %bcond_without pgm Name: zeromq -Version: 4.1.3 +Version: 4.1.4 Release: 1%{?dist} Summary: Software library for fast, message-based applications @@ -128,6 +128,10 @@ make check V=1 %changelog +* Sat Dec 19 2015 Thomas Spura - 4.1.4-1 +- update to 4.1.4 (#1292814) +- refresh zmq.hpp + * Mon Aug 24 2015 Thomas Spura - 4.1.3-1 - update to 4.1.3 (#1256209) - ipv6 patch included upstream diff --git a/zmq.hpp b/zmq.hpp index 40177e5..e4ed26d 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -86,6 +86,12 @@ typedef struct { } zmq_event_t; #endif +// Avoid using deprecated message receive function when possible +#if ZMQ_VERSION < ZMQ_MAKE_VERSION(3, 2, 0) +# define zmq_msg_recv(msg, socket, flags) zmq_recvmsg(socket, msg, flags) +#endif + + // In order to prevent unused variable warnings when building in non-debug // mode use this macro to make assertions. #ifndef NDEBUG @@ -121,9 +127,9 @@ namespace zmq int errnum; }; - inline int poll (zmq_pollitem_t const* items_, int nitems_, long timeout_ = -1) + inline int poll (zmq_pollitem_t const* items_, size_t nitems_, long timeout_ = -1) { - int rc = zmq_poll (const_cast(items_), nitems_, timeout_); + int rc = zmq_poll (const_cast(items_), static_cast(nitems_), timeout_); if (rc < 0) throw error_t (); return rc; @@ -131,7 +137,7 @@ namespace zmq inline int poll(zmq_pollitem_t const* items, size_t nitems) { - return poll(items, nitems, -1 ); + return poll(items, nitems, -1); } #ifdef ZMQ_CPP11 @@ -144,12 +150,12 @@ namespace zmq { return poll(items.data(), items.size(), timeout.count() ); } - #endif inline int poll(std::vector const& items, long timeout_ = -1) { return poll(items.data(), items.size(), timeout_); } + #endif @@ -207,13 +213,26 @@ namespace zmq msg() { typedef typename std::iterator_traits::difference_type size_type; - typedef typename std::iterator_traits::pointer pointer_t; + typedef typename std::iterator_traits::value_type value_t; - size_type const size_ = std::distance(first, last); + size_type const size_ = std::distance(first, last)*sizeof(value_t); int const rc = zmq_msg_init_size (&msg, size_); if (rc != 0) throw error_t (); - std::copy(first, last, static_cast(zmq_msg_data (&msg)) ); + value_t* dest = data(); + while (first != last) + { + *dest = *first; + ++dest; ++first; + } + } + + inline message_t (const void *data_, size_t size_) + { + int rc = zmq_msg_init_size (&msg, size_); + if (rc != 0) + throw error_t (); + memcpy(data(), data_, size_); } inline message_t (void *data_, size_t size_, free_fn *ffn_, @@ -265,6 +284,17 @@ namespace zmq throw error_t (); } + inline void rebuild (const void *data_, size_t size_) + { + int rc = zmq_msg_close (&msg); + if (rc != 0) + throw error_t (); + rc = zmq_msg_init_size (&msg, size_); + if (rc != 0) + throw error_t (); + memcpy(data(), data_, size_); + } + inline void rebuild (void *data_, size_t size_, free_fn *ffn_, void *hint_ = NULL) { @@ -372,16 +402,14 @@ namespace zmq inline ~context_t () ZMQ_NOTHROW { - close(); + int rc = zmq_ctx_destroy (ptr); + ZMQ_ASSERT (rc == 0); } inline void close() ZMQ_NOTHROW { - if (ptr == NULL) - return; - int rc = zmq_ctx_destroy (ptr); + int rc = zmq_ctx_shutdown (ptr); ZMQ_ASSERT (rc == 0); - ptr = NULL; } // Be careful with this, it's probably only useful for @@ -417,8 +445,12 @@ namespace zmq xsub = ZMQ_XSUB, push = ZMQ_PUSH, pull = ZMQ_PULL, +#if ZMQ_VERSION_MAJOR < 4 + pair = ZMQ_PAIR +#else pair = ZMQ_PAIR, stream = ZMQ_STREAM +#endif }; #endif @@ -489,14 +521,14 @@ namespace zmq } inline void getsockopt (int option_, void *optval_, - size_t *optvallen_) + size_t *optvallen_) const { int rc = zmq_getsockopt (ptr, option_, optval_, optvallen_); if (rc != 0) throw error_t (); } - template T getsockopt(int option_) + template T getsockopt(int option_) const { T optval; size_t optlen = sizeof(T); @@ -655,7 +687,7 @@ namespace zmq while (true) { zmq_msg_t eventMsg; zmq_msg_init (&eventMsg); - rc = zmq_recvmsg (s, &eventMsg, 0); + rc = zmq_msg_recv (&eventMsg, s, 0); if (rc == -1 && zmq_errno() == ETERM) break; assert (rc != -1); @@ -672,7 +704,7 @@ namespace zmq #ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT zmq_msg_t addrMsg; zmq_msg_init (&addrMsg); - rc = zmq_recvmsg (s, &addrMsg, 0); + rc = zmq_msg_recv (&addrMsg, s, 0); if (rc == -1 && zmq_errno() == ETERM) break; assert (rc != -1); From 401097680976425e80a539a29675035362be3bef Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Sun, 24 Jan 2016 17:04:08 +0100 Subject: [PATCH 46/71] Enable krb5 and fix building of pgm (#1301197) --- zeromq.spec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zeromq.spec b/zeromq.spec index 03ac70d..60d4c69 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -27,6 +27,7 @@ BuildRequires: libuuid-devel %endif %if %{with pgm} BuildRequires: openpgm-devel +BuildRequires: krb5-devel %endif %description @@ -84,7 +85,8 @@ sed -i "s/openpgm-[0-9].[0-9]/%{openpgm_pc}/g" \ autoreconf -fi %configure \ %if %{with pgm} - --with-system-pgm \ + --with-pgm \ + --with-libgssapi_krb5 \ %endif --disable-static make %{?_smp_mflags} V=1 @@ -128,6 +130,9 @@ make check V=1 %changelog +* Sun Jan 24 2016 Thomas Spura - 4.1.4-2 +- Enable krb5 and fix building of pgm (#1301197) + * Sat Dec 19 2015 Thomas Spura - 4.1.4-1 - update to 4.1.4 (#1292814) - refresh zmq.hpp From 9466daf312c8ff7308e21866c9ece417849d9cd5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 5 Feb 2016 04:05:35 +0000 Subject: [PATCH 47/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 60d4c69..4fa2220 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.4 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -130,6 +130,9 @@ make check V=1 %changelog +* Fri Feb 05 2016 Fedora Release Engineering - 4.1.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + * Sun Jan 24 2016 Thomas Spura - 4.1.4-2 - Enable krb5 and fix building of pgm (#1301197) From eff758a05cb638ffaeedb3818e066745c11a7124 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Sun, 14 Feb 2016 17:06:49 +0100 Subject: [PATCH 48/71] Remove Werror from compile flags --- zeromq.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 4fa2220..2e84806 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.4 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -83,6 +83,9 @@ sed -i "s/openpgm-[0-9].[0-9]/%{openpgm_pc}/g" \ %build autoreconf -fi +# Don't turn warnings into errors +sed -i "s/libzmq_werror=\"yes\"/libzmq_werror=\"no\"/g" \ + configure %configure \ %if %{with pgm} --with-pgm \ @@ -130,6 +133,9 @@ make check V=1 %changelog +* Sun Feb 14 2016 Thomas Spura - 4.1.4-4 +- Remove Werror from compile flags + * Fri Feb 05 2016 Fedora Release Engineering - 4.1.4-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild From 6e875bede41526b5710021fcce22f303582b3a52 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 7 Mar 2016 13:17:48 +0100 Subject: [PATCH 49/71] rebuild for new libsodium soname --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 2e84806..c7fe1aa 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.4 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -133,6 +133,9 @@ make check V=1 %changelog +* Mon Mar 07 2016 Remi Collet - 4.1.4-5 +- rebuild for new libsodium soname + * Sun Feb 14 2016 Thomas Spura - 4.1.4-4 - Remove Werror from compile flags From 2c2ab1232d8e941e5e64549465b4198c0d84a811 Mon Sep 17 00:00:00 2001 From: Denis Arnaud Date: Sun, 12 Jun 2016 04:36:50 +0200 Subject: [PATCH 50/71] Improved the .gitignore file --- .gitignore | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index d02af11..2ba455d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,9 @@ -zeromq-2.0.7.tar.gz -/zeromq-2.0.8.tar.gz -/zeromq-2.0.10.tar.gz -/zeromq-2.1.3.tar.gz -/zeromq-2.1.4.tar.gz -/zeromq-2.1.9.tar.gz -/zeromq-2.1.11.tar.gz -/zeromq-2.2.0.tar.gz -/zeromq-4.0.5.tar.gz -/zeromq-4.1.2.tar.gz -/zeromq-4.1.3.tar.gz -/zeromq-4.1.4.tar.gz +/zeromq-*.tar.* +/zeromq-*.src.rpm +/zeromq-*.*.*/ +/clog +.build-*.*.log +/noarch/ +/x86_64/ +/i?86/ +/tarballs/ From be57c1acb7de58dd0366be5d93b12114dd9d3bf9 Mon Sep 17 00:00:00 2001 From: Thomas Spura Date: Sun, 13 Nov 2016 10:41:58 +0100 Subject: [PATCH 51/71] Update to 4.1.6 --- sources | 2 +- zeromq.spec | 11 ++++++----- zmq.hpp | 47 +++++++++++++++++++++++++++++++++++------------ 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/sources b/sources index 6ce4e29..c7d0911 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a611ecc93fffeb6d058c0e6edf4ad4fb zeromq-4.1.4.tar.gz +c89db4dbc0b90c34c9f4983cbff6d321 zeromq-4.1.6.tar.gz diff --git a/zeromq.spec b/zeromq.spec index c7fe1aa..1792a46 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,15 +1,15 @@ %bcond_without pgm Name: zeromq -Version: 4.1.4 -Release: 5%{?dist} +Version: 4.1.6 +Release: 1%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries License: LGPLv3+ URL: http://www.zeromq.org # VCS: git:http://github.com/zeromq/zeromq2.git -Source0: http://download.zeromq.org/zeromq-%{version}.tar.gz +Source0: https://github.com/zeromq/zeromq4-1/releases/download/v%{version}/zeromq-%{version}.tar.gz Source1: https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp Source2: https://raw.githubusercontent.com/zeromq/cppzmq/master/LICENSE @@ -124,8 +124,6 @@ make check V=1 %{_libdir}/libzmq.so %{_libdir}/pkgconfig/libzmq.pc %{_includedir}/zmq*.h -%{_mandir}/man3/zmq* -%{_mandir}/man7/zmq* %files -n cppzmq-devel %license LICENSE @@ -133,6 +131,9 @@ make check V=1 %changelog +* Sun Nov 13 2016 Thomas Spura - 4.1.6-1 +- update to 4.1.6 + * Mon Mar 07 2016 Remi Collet - 4.1.4-5 - rebuild for new libsodium soname diff --git a/zmq.hpp b/zmq.hpp index e4ed26d..28dc67b 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -25,10 +25,14 @@ #ifndef __ZMQ_HPP_INCLUDED__ #define __ZMQ_HPP_INCLUDED__ -#if __cplusplus >= 201103L -#define ZMQ_CPP11 -#define ZMQ_NOTHROW noexcept -#define ZMQ_EXPLICIT explicit +#if (__cplusplus >= 201103L) + #define ZMQ_CPP11 + #define ZMQ_NOTHROW noexcept + #define ZMQ_EXPLICIT explicit +#elif (defined(_MSC_VER) && (_MSC_VER >= 1900)) + #define ZMQ_CPP11 + #define ZMQ_NOTHROW noexcept + #define ZMQ_EXPLICIT explicit #else #define ZMQ_CPP03 #define ZMQ_NOTHROW @@ -66,6 +70,9 @@ #else #define ZMQ_DELETED_FUNCTION #endif +#elif defined(_MSC_VER) && (_MSC_VER >= 1900) + #define ZMQ_HAS_RVALUE_REFS + #define ZMQ_DELETED_FUNCTION = delete #elif defined(_MSC_VER) && (_MSC_VER >= 1600) #define ZMQ_HAS_RVALUE_REFS #define ZMQ_DELETED_FUNCTION @@ -111,12 +118,17 @@ namespace zmq public: error_t () : errnum (zmq_errno ()) {} - - virtual const char *what () const throw () +#ifdef ZMQ_CPP11 + virtual const char *what () const noexcept { return zmq_strerror (errnum); } - +#else + virtual const char *what() const throw () + { + return zmq_strerror(errnum); + } +#endif int num () const { return errnum; @@ -351,6 +363,14 @@ namespace zmq return static_cast( data() ); } + inline bool equal(const message_t* other) const ZMQ_NOTHROW + { + if (size() != other->size()) + return false; + std::string a(data(), size()); + std::string b(other->data(), other->size()); + return a == b; + } private: // The underlying message @@ -402,14 +422,17 @@ namespace zmq inline ~context_t () ZMQ_NOTHROW { - int rc = zmq_ctx_destroy (ptr); - ZMQ_ASSERT (rc == 0); + close(); } inline void close() ZMQ_NOTHROW { - int rc = zmq_ctx_shutdown (ptr); + if (ptr == NULL) + return; + + int rc = zmq_ctx_destroy (ptr); ZMQ_ASSERT (rc == 0); + ptr = NULL; } // Be careful with this, it's probably only useful for @@ -487,12 +510,12 @@ namespace zmq close(); } - inline ZMQ_EXPLICIT operator void* () ZMQ_NOTHROW + inline operator void* () ZMQ_NOTHROW { return ptr; } - inline ZMQ_EXPLICIT operator void const* () const ZMQ_NOTHROW + inline operator void const* () const ZMQ_NOTHROW { return ptr; } From e69895fec72d58a910173aa0a04a48931b4e976e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 11 Feb 2017 18:23:50 +0000 Subject: [PATCH 52/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 1792a46..995c934 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.6 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -131,6 +131,9 @@ make check V=1 %changelog +* Sat Feb 11 2017 Fedora Release Engineering - 4.1.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + * Sun Nov 13 2016 Thomas Spura - 4.1.6-1 - update to 4.1.6 From 8f64d3da257c11868d0106c3e2cf97b450bb00f2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 15 May 2017 20:51:56 +0000 Subject: [PATCH 53/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 995c934..5f47fc8 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.6 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -131,6 +131,9 @@ make check V=1 %changelog +* Mon May 15 2017 Fedora Release Engineering - 4.1.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild + * Sat Feb 11 2017 Fedora Release Engineering - 4.1.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild From ce3866b8d64322e75a3bf36fe971b1eb18811aed Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 27 Jul 2017 22:42:07 +0000 Subject: [PATCH 54/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 5f47fc8..1ef2967 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.6 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -131,6 +131,9 @@ make check V=1 %changelog +* Thu Jul 27 2017 Fedora Release Engineering - 4.1.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + * Mon May 15 2017 Fedora Release Engineering - 4.1.6-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild From 85bad0539d2b71ed9d87514028bc9f1c20c4901b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 3 Aug 2017 11:10:21 +0000 Subject: [PATCH 55/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 1ef2967..67826b8 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.6 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -131,6 +131,9 @@ make check V=1 %changelog +* Thu Aug 03 2017 Fedora Release Engineering - 4.1.6-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + * Thu Jul 27 2017 Fedora Release Engineering - 4.1.6-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild From 015e3956e4223135493ceed266123eef980bee6e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 2 Oct 2017 09:08:17 +0200 Subject: [PATCH 56/71] rebuild for libsodium --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 67826b8..8ee7f05 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.6 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -131,6 +131,9 @@ make check V=1 %changelog +* Mon Oct 02 2017 Remi Collet - 4.1.6-6 +- rebuild for libsodium + * Thu Aug 03 2017 Fedora Release Engineering - 4.1.6-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild From 2cefe819576e5715631d9b53143baeb292d0442c Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 3 Feb 2018 17:43:00 +0100 Subject: [PATCH 57/71] Switch to %ldconfig_scriptlets Signed-off-by: Igor Gnatenko --- zeromq.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zeromq.spec b/zeromq.spec index 8ee7f05..8062540 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.6 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -108,10 +108,7 @@ rm %{buildroot}%{_libdir}/libzmq.la make check V=1 -%post -p /sbin/ldconfig - - -%postun -p /sbin/ldconfig +%ldconfig_scriptlets %files @@ -131,6 +128,9 @@ make check V=1 %changelog +* Sat Feb 03 2018 Igor Gnatenko - 4.1.6-7 +- Switch to %%ldconfig_scriptlets + * Mon Oct 02 2017 Remi Collet - 4.1.6-6 - rebuild for libsodium From 1b73cea19e5ba0758c614e8beac558b692dfd782 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 9 Feb 2018 22:26:52 +0000 Subject: [PATCH 58/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 8062540..72c8d8a 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.6 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -128,6 +128,9 @@ make check V=1 %changelog +* Fri Feb 09 2018 Fedora Release Engineering - 4.1.6-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + * Sat Feb 03 2018 Igor Gnatenko - 4.1.6-7 - Switch to %%ldconfig_scriptlets From 3eaf98a78b757afb2ab141deb80dabbdaf1987ef Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Wed, 14 Feb 2018 00:52:39 +0100 Subject: [PATCH 59/71] Remove BuildRoot definition None of currently supported distributions need that. It was needed last for EL5 which is EOL now Signed-off-by: Igor Gnatenko --- zeromq.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 72c8d8a..05e6666 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -21,7 +21,6 @@ BuildRequires: libsodium-devel BuildRequires: glib2-devel %if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) BuildRequires: e2fsprogs-devel -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %else BuildRequires: libuuid-devel %endif From 2e18705528cce7ba46965e3a9c9431777f5d8196 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 14 Jul 2018 09:49:31 +0000 Subject: [PATCH 60/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 05e6666..1de23a3 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.6 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -127,6 +127,9 @@ make check V=1 %changelog +* Sat Jul 14 2018 Fedora Release Engineering - 4.1.6-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Fri Feb 09 2018 Fedora Release Engineering - 4.1.6-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild From 23d1f54267313a406692bcda16ec84fb6a00ae4f Mon Sep 17 00:00:00 2001 From: Pavel Zhukov Date: Tue, 28 Aug 2018 15:40:35 +0200 Subject: [PATCH 61/71] Add gcc-c++ build requirement. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1606788 --- zeromq.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 1de23a3..8b95d8c 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.6 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Software library for fast, message-based applications Group: System Environment/Libraries @@ -17,6 +17,7 @@ BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool BuildRequires: libsodium-devel +BuildRequires: gcc-c++ BuildRequires: glib2-devel %if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) @@ -127,6 +128,9 @@ make check V=1 %changelog +* Tue Aug 28 2018 Pavel Zhukov - 4.1.6-10 +- Add gcc-c++ BR + * Sat Jul 14 2018 Fedora Release Engineering - 4.1.6-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From 7a004a7f33527d3d4f58ebf572ee33801503bcd2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 21 Jan 2019 05:06:02 -0500 Subject: [PATCH 62/71] Remove some old stuff. --- zeromq.spec | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/zeromq.spec b/zeromq.spec index 8b95d8c..ff23ee8 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -5,10 +5,8 @@ Version: 4.1.6 Release: 10%{?dist} Summary: Software library for fast, message-based applications -Group: System Environment/Libraries License: LGPLv3+ URL: http://www.zeromq.org -# VCS: git:http://github.com/zeromq/zeromq2.git Source0: https://github.com/zeromq/zeromq4-1/releases/download/v%{version}/zeromq-%{version}.tar.gz Source1: https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp Source2: https://raw.githubusercontent.com/zeromq/cppzmq/master/LICENSE @@ -20,11 +18,7 @@ BuildRequires: libsodium-devel BuildRequires: gcc-c++ BuildRequires: glib2-devel -%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) -BuildRequires: e2fsprogs-devel -%else BuildRequires: libuuid-devel -%endif %if %{with pgm} BuildRequires: openpgm-devel BuildRequires: krb5-devel @@ -43,7 +37,6 @@ This package contains the ZeroMQ shared library. %package devel Summary: Development files for %{name} -Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} @@ -54,7 +47,6 @@ developing applications that use %{name}. %package -n cppzmq-devel Summary: Development files for cppzmq -Group: Development/Libraries License: MIT Requires: %{name}-devel%{?_isa} = %{version}-%{release} @@ -68,36 +60,24 @@ developing applications that use the C++ header files of %{name}. %setup -q cp -a %{SOURCE2} . -# zeromq.x86_64: W: file-not-utf8 /usr/share/doc/zeromq/ChangeLog -iconv -f iso8859-1 -t utf-8 ChangeLog > ChangeLog.conv && mv -f ChangeLog.conv ChangeLog - # Don't turn warnings into errors sed -i "s/libzmq_werror=\"yes\"/libzmq_werror=\"no\"/g" \ - configure - -# Sed version number of openpgm into configure -%global openpgm_pc $(basename %{_libdir}/pkgconfig/openpgm*.pc .pc) -sed -i "s/openpgm-[0-9].[0-9]/%{openpgm_pc}/g" \ - configure* + configure.ac %build autoreconf -fi -# Don't turn warnings into errors -sed -i "s/libzmq_werror=\"yes\"/libzmq_werror=\"no\"/g" \ - configure %configure \ %if %{with pgm} --with-pgm \ --with-libgssapi_krb5 \ %endif --disable-static -make %{?_smp_mflags} V=1 +%make_build %install -rm -rf %{buildroot} -make install DESTDIR=%{buildroot} INSTALL="install -p" +%make_install install -m 644 -p %{SOURCE1} %{buildroot}%{_includedir}/ # remove *.la From dc326129809968a1c86773992089c31038fd0d25 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 21 Jan 2019 05:45:12 -0500 Subject: [PATCH 63/71] Backport patch to fix test failure. --- 1260.patch | 25 +++++++++++++++++++++++++ zeromq.spec | 9 +++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 1260.patch diff --git a/1260.patch b/1260.patch new file mode 100644 index 0000000..bc70ec5 --- /dev/null +++ b/1260.patch @@ -0,0 +1,25 @@ +From 32b2d3034b04a54118bc95c3f83ea5af78f9de41 Mon Sep 17 00:00:00 2001 +From: Nikolay Amiantov +Date: Thu, 20 Nov 2014 05:08:45 +0300 +Subject: [PATCH] Fix test_filter_ipc for cleared supplementary groups + +This should fix part of [https://github.com/zeromq/libzmq/issues/1129]. +--- + tests/test_filter_ipc.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/test_filter_ipc.cpp b/tests/test_filter_ipc.cpp +index 00518f710..83035949b 100644 +--- a/tests/test_filter_ipc.cpp ++++ b/tests/test_filter_ipc.cpp +@@ -122,8 +122,8 @@ int main (void) + // Get the group and supplimental groups of the process owner + gid_t groups[100]; + int ngroups = getgroups(100, groups); +- assert (ngroups != -1 && ngroups != 0); +- gid_t group = getgid(), supgroup = groups[0], notgroup = groups[ngroups - 1] + 1; ++ assert (ngroups != -1); ++ gid_t group = getgid(), supgroup = group, notgroup = group + 1; + for (int i = 0; i < ngroups; i++) { + if (supgroup == group && group != groups[i]) + supgroup = groups[i]; diff --git a/zeromq.spec b/zeromq.spec index ff23ee8..3c22a49 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.1.6 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Software library for fast, message-based applications License: LGPLv3+ @@ -10,6 +10,7 @@ URL: http://www.zeromq.org Source0: https://github.com/zeromq/zeromq4-1/releases/download/v%{version}/zeromq-%{version}.tar.gz Source1: https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp Source2: https://raw.githubusercontent.com/zeromq/cppzmq/master/LICENSE +Patch0001: https://github.com/zeromq/libzmq/pull/1260.patch BuildRequires: autoconf BuildRequires: automake @@ -57,7 +58,7 @@ developing applications that use the C++ header files of %{name}. %prep -%setup -q +%autosetup -p1 cp -a %{SOURCE2} . # Don't turn warnings into errors @@ -108,6 +109,10 @@ make check V=1 %changelog +* Mon Jan 21 2019 Elliott Sales de Andrade - 4.1.6-11 +- Backport patch to fix test failures in build +- Cleanup spec a little + * Tue Aug 28 2018 Pavel Zhukov - 4.1.6-10 - Add gcc-c++ BR From 689cc9f6d7af68c47eb7fabed3b3f652a9015b96 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 21 Jan 2019 17:34:51 -0500 Subject: [PATCH 64/71] Use explicit soname version. --- zeromq.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 3c22a49..32f789c 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -96,7 +96,7 @@ make check V=1 %doc AUTHORS ChangeLog MAINTAINERS NEWS %license COPYING COPYING.LESSER %{_bindir}/curve_keygen -%{_libdir}/libzmq.so.* +%{_libdir}/libzmq.so.5* %files devel %{_libdir}/libzmq.so @@ -112,6 +112,7 @@ make check V=1 * Mon Jan 21 2019 Elliott Sales de Andrade - 4.1.6-11 - Backport patch to fix test failures in build - Cleanup spec a little +- Use explicit soname version in file list * Tue Aug 28 2018 Pavel Zhukov - 4.1.6-10 - Add gcc-c++ BR From 6a4c51171535057c592da573fd7d7f554499eb56 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 21 Jan 2019 19:40:05 -0500 Subject: [PATCH 65/71] Backport another patch to fix s390x. --- 1574.patch | 27 +++++++++++++++++++++++++++ zeromq.spec | 6 ++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 1574.patch diff --git a/1574.patch b/1574.patch new file mode 100644 index 0000000..cbce755 --- /dev/null +++ b/1574.patch @@ -0,0 +1,27 @@ +From 25a50ca0d5d3ea076c63c23692e4cb9868bfb55d Mon Sep 17 00:00:00 2001 +From: KIU Shueng Chuan +Date: Tue, 8 Sep 2015 17:26:31 +0800 +Subject: [PATCH] avoid dereferencing uint32_t on unaligned address + +--- + src/socket_base.cpp | 21 +++++---------------- + 1 file changed, 5 insertions(+), 16 deletions(-) + +diff --git a/src/socket_base.cpp b/src/socket_base.cpp +index a980015fc..ea178a868 100644 +--- a/src/socket_base.cpp ++++ b/src/socket_base.cpp +@@ -1361,8 +1361,11 @@ void zmq::socket_base_t::monitor_event (int event_, int value_, const std::strin + zmq_msg_t msg; + zmq_msg_init_size (&msg, 6); + uint8_t *data = (uint8_t *) zmq_msg_data (&msg); +- *(uint16_t *) (data + 0) = (uint16_t) event_; +- *(uint32_t *) (data + 2) = (uint32_t) value_; ++ // Avoid dereferencing uint32_t on unaligned address ++ uint16_t event = (uint16_t) event_; ++ uint32_t value = (uint32_t) value_; ++ memcpy (data + 0, &event, sizeof(event)); ++ memcpy (data + 2, &value, sizeof(value)); + zmq_sendmsg (monitor_socket, &msg, ZMQ_SNDMORE); + + // Send address in second frame diff --git a/zeromq.spec b/zeromq.spec index 32f789c..a2ff707 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -11,6 +11,7 @@ Source0: https://github.com/zeromq/zeromq4-1/releases/download/v%{version Source1: https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp Source2: https://raw.githubusercontent.com/zeromq/cppzmq/master/LICENSE Patch0001: https://github.com/zeromq/libzmq/pull/1260.patch +Patch0002: https://github.com/zeromq/libzmq/pull/1574.patch BuildRequires: autoconf BuildRequires: automake @@ -86,7 +87,8 @@ rm %{buildroot}%{_libdir}/libzmq.la %check -make check V=1 +make check V=1 || ( cat test-suite.log && exit 1 ) + %ldconfig_scriptlets @@ -110,7 +112,7 @@ make check V=1 %changelog * Mon Jan 21 2019 Elliott Sales de Andrade - 4.1.6-11 -- Backport patch to fix test failures in build +- Backport patches to fix test failures in build - Cleanup spec a little - Use explicit soname version in file list From 5652a7377f6eafd2324e7bdd6909b4c7f26f66b8 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 22 Jan 2019 00:28:36 -0500 Subject: [PATCH 66/71] Update to latest version of libzmq and cppzmq. --- .gitignore | 1 + 1260.patch | 25 - 1574.patch | 27 - sources | 2 +- zeromq.spec | 39 +- zmq.hpp | 1543 +++++++++++++++++++++++++++++++-------------------- 6 files changed, 959 insertions(+), 678 deletions(-) delete mode 100644 1260.patch delete mode 100644 1574.patch diff --git a/.gitignore b/.gitignore index 2ba455d..5f933d7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /x86_64/ /i?86/ /tarballs/ +/libzmq-4.3.1.tar.gz diff --git a/1260.patch b/1260.patch deleted file mode 100644 index bc70ec5..0000000 --- a/1260.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 32b2d3034b04a54118bc95c3f83ea5af78f9de41 Mon Sep 17 00:00:00 2001 -From: Nikolay Amiantov -Date: Thu, 20 Nov 2014 05:08:45 +0300 -Subject: [PATCH] Fix test_filter_ipc for cleared supplementary groups - -This should fix part of [https://github.com/zeromq/libzmq/issues/1129]. ---- - tests/test_filter_ipc.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/test_filter_ipc.cpp b/tests/test_filter_ipc.cpp -index 00518f710..83035949b 100644 ---- a/tests/test_filter_ipc.cpp -+++ b/tests/test_filter_ipc.cpp -@@ -122,8 +122,8 @@ int main (void) - // Get the group and supplimental groups of the process owner - gid_t groups[100]; - int ngroups = getgroups(100, groups); -- assert (ngroups != -1 && ngroups != 0); -- gid_t group = getgid(), supgroup = groups[0], notgroup = groups[ngroups - 1] + 1; -+ assert (ngroups != -1); -+ gid_t group = getgid(), supgroup = group, notgroup = group + 1; - for (int i = 0; i < ngroups; i++) { - if (supgroup == group && group != groups[i]) - supgroup = groups[i]; diff --git a/1574.patch b/1574.patch deleted file mode 100644 index cbce755..0000000 --- a/1574.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 25a50ca0d5d3ea076c63c23692e4cb9868bfb55d Mon Sep 17 00:00:00 2001 -From: KIU Shueng Chuan -Date: Tue, 8 Sep 2015 17:26:31 +0800 -Subject: [PATCH] avoid dereferencing uint32_t on unaligned address - ---- - src/socket_base.cpp | 21 +++++---------------- - 1 file changed, 5 insertions(+), 16 deletions(-) - -diff --git a/src/socket_base.cpp b/src/socket_base.cpp -index a980015fc..ea178a868 100644 ---- a/src/socket_base.cpp -+++ b/src/socket_base.cpp -@@ -1361,8 +1361,11 @@ void zmq::socket_base_t::monitor_event (int event_, int value_, const std::strin - zmq_msg_t msg; - zmq_msg_init_size (&msg, 6); - uint8_t *data = (uint8_t *) zmq_msg_data (&msg); -- *(uint16_t *) (data + 0) = (uint16_t) event_; -- *(uint32_t *) (data + 2) = (uint32_t) value_; -+ // Avoid dereferencing uint32_t on unaligned address -+ uint16_t event = (uint16_t) event_; -+ uint32_t value = (uint32_t) value_; -+ memcpy (data + 0, &event, sizeof(event)); -+ memcpy (data + 2, &value, sizeof(value)); - zmq_sendmsg (monitor_socket, &msg, ZMQ_SNDMORE); - - // Send address in second frame diff --git a/sources b/sources index c7d0911..02cfb10 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c89db4dbc0b90c34c9f4983cbff6d321 zeromq-4.1.6.tar.gz +SHA512 (libzmq-4.3.1.tar.gz) = 64855a73331a194c43b01aa86a985a149eba4ed32b9f6483d2a7415cfd8bba557aab5b7b33d160cd177141de02360b73c20e4696a19c2cd798eb5f82eeb72840 diff --git a/zeromq.spec b/zeromq.spec index a2ff707..c181069 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,26 +1,26 @@ %bcond_without pgm +# TODO: Split into a separate package? +%global cppzmq_version 4.3.0 + Name: zeromq -Version: 4.1.6 -Release: 11%{?dist} +Version: 4.3.1 +Release: 1%{?dist} Summary: Software library for fast, message-based applications License: LGPLv3+ URL: http://www.zeromq.org -Source0: https://github.com/zeromq/zeromq4-1/releases/download/v%{version}/zeromq-%{version}.tar.gz -Source1: https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp -Source2: https://raw.githubusercontent.com/zeromq/cppzmq/master/LICENSE -Patch0001: https://github.com/zeromq/libzmq/pull/1260.patch -Patch0002: https://github.com/zeromq/libzmq/pull/1574.patch +Source0: https://github.com/zeromq/libzmq/archive/v%{version}/libzmq-%{version}.tar.gz +Source1: https://github.com/zeromq/cppzmq/raw/v%{cppzmq_version}/zmq.hpp +Source2: https://github.com/zeromq/cppzmq/raw/v%{cppzmq_version}/LICENSE BuildRequires: autoconf BuildRequires: automake +BuildRequires: gcc-c++ BuildRequires: libtool BuildRequires: libsodium-devel -BuildRequires: gcc-c++ +BuildRequires: libunwind-devel -BuildRequires: glib2-devel -BuildRequires: libuuid-devel %if %{with pgm} BuildRequires: openpgm-devel BuildRequires: krb5-devel @@ -49,6 +49,7 @@ developing applications that use %{name}. %package -n cppzmq-devel Summary: Development files for cppzmq +Version: %{cppzmq_version} License: MIT Requires: %{name}-devel%{?_isa} = %{version}-%{release} @@ -59,12 +60,14 @@ developing applications that use the C++ header files of %{name}. %prep -%autosetup -p1 +%autosetup -p1 -n libzmq-%{version} cp -a %{SOURCE2} . -# Don't turn warnings into errors -sed -i "s/libzmq_werror=\"yes\"/libzmq_werror=\"no\"/g" \ - configure.ac +# Remove bundled code. +rm -rf external/wepoll + +# Fix permissions. +chmod -x src/xsub.hpp %build @@ -74,6 +77,9 @@ autoreconf -fi --with-pgm \ --with-libgssapi_krb5 \ %endif + --with-libsodium \ + --enable-libunwind \ + --disable-Werror \ --disable-static %make_build @@ -95,7 +101,7 @@ make check V=1 || ( cat test-suite.log && exit 1 ) %files -%doc AUTHORS ChangeLog MAINTAINERS NEWS +%doc README.md AUTHORS NEWS %license COPYING COPYING.LESSER %{_bindir}/curve_keygen %{_libdir}/libzmq.so.5* @@ -111,6 +117,9 @@ make check V=1 || ( cat test-suite.log && exit 1 ) %changelog +* Tue Jan 22 2019 Elliott Sales de Andrade - 4.3.1-1 +- Update to latest version of libzmq and cppzmq + * Mon Jan 21 2019 Elliott Sales de Andrade - 4.1.6-11 - Backport patches to fix test failures in build - Cleanup spec a little diff --git a/zmq.hpp b/zmq.hpp index 28dc67b..97bca4e 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -1,4 +1,5 @@ /* + Copyright (c) 2016-2017 ZeroMQ community Copyright (c) 2009-2011 250bpm s.r.o. Copyright (c) 2011 Botond Ballo Copyright (c) 2007-2009 iMatix Corporation @@ -25,59 +26,81 @@ #ifndef __ZMQ_HPP_INCLUDED__ #define __ZMQ_HPP_INCLUDED__ +#if (__cplusplus >= 201402L) +#define ZMQ_DEPRECATED(msg) [[deprecated(msg)]] +#elif defined(_MSC_VER) +#define ZMQ_DEPRECATED(msg) __declspec(deprecated(msg)) +#elif defined(__GNUC__) +#define ZMQ_DEPRECATED(msg) __attribute__((deprecated(msg))) +#endif + #if (__cplusplus >= 201103L) - #define ZMQ_CPP11 - #define ZMQ_NOTHROW noexcept - #define ZMQ_EXPLICIT explicit -#elif (defined(_MSC_VER) && (_MSC_VER >= 1900)) - #define ZMQ_CPP11 - #define ZMQ_NOTHROW noexcept - #define ZMQ_EXPLICIT explicit +#define ZMQ_CPP11 +#define ZMQ_NOTHROW noexcept +#define ZMQ_EXPLICIT explicit +#elif (defined(_MSC_VER) && (_MSC_VER >= 1900)) +#define ZMQ_CPP11 +#define ZMQ_NOTHROW noexcept +#define ZMQ_EXPLICIT explicit #else - #define ZMQ_CPP03 - #define ZMQ_NOTHROW - #define ZMQ_EXPLICIT +#define ZMQ_CPP03 +#define ZMQ_NOTHROW +#define ZMQ_EXPLICIT #endif #include -#include #include #include -#include + +#include #include -#include +#include #include +#include +#include +#include + +/* Version macros for compile-time API version detection */ +#define CPPZMQ_VERSION_MAJOR 4 +#define CPPZMQ_VERSION_MINOR 3 +#define CPPZMQ_VERSION_PATCH 0 + +#define CPPZMQ_VERSION \ + ZMQ_MAKE_VERSION(CPPZMQ_VERSION_MAJOR, CPPZMQ_VERSION_MINOR, \ + CPPZMQ_VERSION_PATCH) #ifdef ZMQ_CPP11 #include #include +#include +#include +#include #endif // Detect whether the compiler supports C++11 rvalue references. -#if (defined(__GNUC__) && (__GNUC__ > 4 || \ - (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && \ - defined(__GXX_EXPERIMENTAL_CXX0X__)) - #define ZMQ_HAS_RVALUE_REFS - #define ZMQ_DELETED_FUNCTION = delete +#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) \ + && defined(__GXX_EXPERIMENTAL_CXX0X__)) +#define ZMQ_HAS_RVALUE_REFS +#define ZMQ_DELETED_FUNCTION = delete #elif defined(__clang__) - #if __has_feature(cxx_rvalue_references) - #define ZMQ_HAS_RVALUE_REFS - #endif - - #if __has_feature(cxx_deleted_functions) - #define ZMQ_DELETED_FUNCTION = delete - #else - #define ZMQ_DELETED_FUNCTION - #endif +#if __has_feature(cxx_rvalue_references) +#define ZMQ_HAS_RVALUE_REFS +#endif + +#if __has_feature(cxx_deleted_functions) +#define ZMQ_DELETED_FUNCTION = delete +#else +#define ZMQ_DELETED_FUNCTION +#endif #elif defined(_MSC_VER) && (_MSC_VER >= 1900) - #define ZMQ_HAS_RVALUE_REFS - #define ZMQ_DELETED_FUNCTION = delete +#define ZMQ_HAS_RVALUE_REFS +#define ZMQ_DELETED_FUNCTION = delete #elif defined(_MSC_VER) && (_MSC_VER >= 1600) - #define ZMQ_HAS_RVALUE_REFS - #define ZMQ_DELETED_FUNCTION +#define ZMQ_HAS_RVALUE_REFS +#define ZMQ_DELETED_FUNCTION #else - #define ZMQ_DELETED_FUNCTION +#define ZMQ_DELETED_FUNCTION #endif #if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3, 3, 0) @@ -87,726 +110,1026 @@ #if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) #define ZMQ_HAS_PROXY_STEERABLE /* Socket event data */ -typedef struct { - uint16_t event; // id of the event as bitfield - int32_t value ; // value is either error code, fd or reconnect interval +typedef struct +{ + uint16_t event; // id of the event as bitfield + int32_t value; // value is either error code, fd or reconnect interval } zmq_event_t; #endif // Avoid using deprecated message receive function when possible #if ZMQ_VERSION < ZMQ_MAKE_VERSION(3, 2, 0) -# define zmq_msg_recv(msg, socket, flags) zmq_recvmsg(socket, msg, flags) +#define zmq_msg_recv(msg, socket, flags) zmq_recvmsg(socket, msg, flags) #endif // In order to prevent unused variable warnings when building in non-debug // mode use this macro to make assertions. #ifndef NDEBUG -# define ZMQ_ASSERT(expression) assert(expression) +#define ZMQ_ASSERT(expression) assert(expression) #else -# define ZMQ_ASSERT(expression) (void)(expression) +#define ZMQ_ASSERT(expression) (void) (expression) #endif namespace zmq { +typedef zmq_free_fn free_fn; +typedef zmq_pollitem_t pollitem_t; + +class error_t : public std::exception +{ + public: + error_t() : errnum(zmq_errno()) {} +#ifdef ZMQ_CPP11 + virtual const char *what() const noexcept { return zmq_strerror(errnum); } +#else + virtual const char *what() const throw() { return zmq_strerror(errnum); } +#endif + int num() const { return errnum; } - typedef zmq_free_fn free_fn; - typedef zmq_pollitem_t pollitem_t; + private: + int errnum; +}; - class error_t : public std::exception - { - public: +inline int poll(zmq_pollitem_t const *items_, size_t nitems_, long timeout_ = -1) +{ + int rc = zmq_poll(const_cast(items_), + static_cast(nitems_), timeout_); + if (rc < 0) + throw error_t(); + return rc; +} - error_t () : errnum (zmq_errno ()) {} #ifdef ZMQ_CPP11 - virtual const char *what () const noexcept - { - return zmq_strerror (errnum); - } -#else - virtual const char *what() const throw () - { - return zmq_strerror(errnum); - } -#endif - int num () const - { - return errnum; - } +inline int +poll(zmq_pollitem_t const *items, size_t nitems, std::chrono::milliseconds timeout) +{ + return poll(items, nitems, static_cast(timeout.count())); +} + +inline int poll(std::vector const &items, + std::chrono::milliseconds timeout) +{ + return poll(items.data(), items.size(), static_cast(timeout.count())); +} - private: +inline int poll(std::vector const &items, long timeout_ = -1) +{ + return poll(items.data(), items.size(), timeout_); +} +#endif - int errnum; - }; - inline int poll (zmq_pollitem_t const* items_, size_t nitems_, long timeout_ = -1) +inline void proxy(void *frontend, void *backend, void *capture) +{ + int rc = zmq_proxy(frontend, backend, capture); + if (rc != 0) + throw error_t(); +} + +#ifdef ZMQ_HAS_PROXY_STEERABLE +inline void +proxy_steerable(void *frontend, void *backend, void *capture, void *control) +{ + int rc = zmq_proxy_steerable(frontend, backend, capture, control); + if (rc != 0) + throw error_t(); +} +#endif + +inline void version(int *major_, int *minor_, int *patch_) +{ + zmq_version(major_, minor_, patch_); +} + +#ifdef ZMQ_CPP11 +inline std::tuple version() +{ + std::tuple v; + zmq_version(&std::get<0>(v), &std::get<1>(v), &std::get<2>(v)); + return v; +} +#endif + +class message_t +{ + friend class socket_t; + + public: + inline message_t() { - int rc = zmq_poll (const_cast(items_), static_cast(nitems_), timeout_); - if (rc < 0) - throw error_t (); - return rc; + int rc = zmq_msg_init(&msg); + if (rc != 0) + throw error_t(); } - inline int poll(zmq_pollitem_t const* items, size_t nitems) + inline explicit message_t(size_t size_) { - return poll(items, nitems, -1); + int rc = zmq_msg_init_size(&msg, size_); + if (rc != 0) + throw error_t(); } - #ifdef ZMQ_CPP11 - inline int poll(zmq_pollitem_t const* items, size_t nitems, std::chrono::milliseconds timeout) + template message_t(T first, T last) : msg() { - return poll(items, nitems, timeout.count() ); + typedef typename std::iterator_traits::difference_type size_type; + typedef typename std::iterator_traits::value_type value_t; + + size_type const size_ = std::distance(first, last) * sizeof(value_t); + int const rc = zmq_msg_init_size(&msg, size_); + if (rc != 0) + throw error_t(); + value_t *dest = data(); + while (first != last) { + *dest = *first; + ++dest; + ++first; + } } - inline int poll(std::vector const& items, std::chrono::milliseconds timeout) + inline message_t(const void *data_, size_t size_) { - return poll(items.data(), items.size(), timeout.count() ); + int rc = zmq_msg_init_size(&msg, size_); + if (rc != 0) + throw error_t(); + memcpy(data(), data_, size_); + } + + inline message_t(void *data_, size_t size_, free_fn *ffn_, void *hint_ = NULL) + { + int rc = zmq_msg_init_data(&msg, data_, size_, ffn_, hint_); + if (rc != 0) + throw error_t(); } - inline int poll(std::vector const& items, long timeout_ = -1) +#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) + template + message_t(const T &msg_) : message_t(std::begin(msg_), std::end(msg_)) { - return poll(items.data(), items.size(), timeout_); } - #endif +#endif + +#ifdef ZMQ_HAS_RVALUE_REFS + inline message_t(message_t &&rhs) : msg(rhs.msg) + { + int rc = zmq_msg_init(&rhs.msg); + if (rc != 0) + throw error_t(); + } + inline message_t &operator=(message_t &&rhs) ZMQ_NOTHROW + { + std::swap(msg, rhs.msg); + return *this; + } +#endif + inline ~message_t() ZMQ_NOTHROW + { + int rc = zmq_msg_close(&msg); + ZMQ_ASSERT(rc == 0); + } - inline void proxy (void *frontend, void *backend, void *capture) + inline void rebuild() { - int rc = zmq_proxy (frontend, backend, capture); + int rc = zmq_msg_close(&msg); + if (rc != 0) + throw error_t(); + rc = zmq_msg_init(&msg); if (rc != 0) - throw error_t (); + throw error_t(); } - -#ifdef ZMQ_HAS_PROXY_STEERABLE - inline void proxy_steerable (void *frontend, void *backend, void *capture, void *control) + + inline void rebuild(size_t size_) { - int rc = zmq_proxy_steerable (frontend, backend, capture, control); + int rc = zmq_msg_close(&msg); + if (rc != 0) + throw error_t(); + rc = zmq_msg_init_size(&msg, size_); if (rc != 0) - throw error_t (); + throw error_t(); } -#endif - - inline void version (int *major_, int *minor_, int *patch_) + + inline void rebuild(const void *data_, size_t size_) { - zmq_version (major_, minor_, patch_); + int rc = zmq_msg_close(&msg); + if (rc != 0) + throw error_t(); + rc = zmq_msg_init_size(&msg, size_); + if (rc != 0) + throw error_t(); + memcpy(data(), data_, size_); } - #ifdef ZMQ_CPP11 - inline std::tuple version() + inline void rebuild(void *data_, size_t size_, free_fn *ffn_, void *hint_ = NULL) { - std::tuple v; - zmq_version(&std::get<0>(v), &std::get<1>(v), &std::get<2>(v) ); - return v; + int rc = zmq_msg_close(&msg); + if (rc != 0) + throw error_t(); + rc = zmq_msg_init_data(&msg, data_, size_, ffn_, hint_); + if (rc != 0) + throw error_t(); } - #endif - class message_t + inline void move(message_t const *msg_) { - friend class socket_t; + int rc = zmq_msg_move(&msg, const_cast(&(msg_->msg))); + if (rc != 0) + throw error_t(); + } - public: + inline void copy(message_t const *msg_) + { + int rc = zmq_msg_copy(&msg, const_cast(&(msg_->msg))); + if (rc != 0) + throw error_t(); + } - inline message_t () - { - int rc = zmq_msg_init (&msg); - if (rc != 0) - throw error_t (); - } + inline bool more() const ZMQ_NOTHROW + { + int rc = zmq_msg_more(const_cast(&msg)); + return rc != 0; + } - inline explicit message_t (size_t size_) - { - int rc = zmq_msg_init_size (&msg, size_); - if (rc != 0) - throw error_t (); - } + inline void *data() ZMQ_NOTHROW { return zmq_msg_data(&msg); } - template message_t(I first, I last): - msg() - { - typedef typename std::iterator_traits::difference_type size_type; - typedef typename std::iterator_traits::value_type value_t; - - size_type const size_ = std::distance(first, last)*sizeof(value_t); - int const rc = zmq_msg_init_size (&msg, size_); - if (rc != 0) - throw error_t (); - value_t* dest = data(); - while (first != last) - { - *dest = *first; - ++dest; ++first; - } - } + inline const void *data() const ZMQ_NOTHROW + { + return zmq_msg_data(const_cast(&msg)); + } - inline message_t (const void *data_, size_t size_) - { - int rc = zmq_msg_init_size (&msg, size_); - if (rc != 0) - throw error_t (); - memcpy(data(), data_, size_); - } + inline size_t size() const ZMQ_NOTHROW + { + return zmq_msg_size(const_cast(&msg)); + } - inline message_t (void *data_, size_t size_, free_fn *ffn_, - void *hint_ = NULL) - { - int rc = zmq_msg_init_data (&msg, data_, size_, ffn_, hint_); - if (rc != 0) - throw error_t (); - } + template T *data() ZMQ_NOTHROW { return static_cast(data()); } -#ifdef ZMQ_HAS_RVALUE_REFS - inline message_t (message_t &&rhs): msg (rhs.msg) - { - int rc = zmq_msg_init (&rhs.msg); - if (rc != 0) - throw error_t (); - } + template T const *data() const ZMQ_NOTHROW + { + return static_cast(data()); + } - inline message_t &operator = (message_t &&rhs) ZMQ_NOTHROW - { - std::swap (msg, rhs.msg); - return *this; - } + ZMQ_DEPRECATED("from 4.3.0, use operator== instead") + inline bool equal(const message_t *other) const ZMQ_NOTHROW + { + return *this == *other; + } + + inline bool operator==(const message_t &other) const ZMQ_NOTHROW + { + const size_t my_size = size(); + return my_size == other.size() && 0 == memcmp(data(), other.data(), my_size); + } + + inline bool operator!=(const message_t &other) const ZMQ_NOTHROW + { + return !(*this == other); + } + +#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) + inline const char *gets(const char *property_) + { + const char *value = zmq_msg_gets(&msg, property_); + if (value == NULL) + throw error_t(); + return value; + } #endif - inline ~message_t () ZMQ_NOTHROW - { - int rc = zmq_msg_close (&msg); - ZMQ_ASSERT (rc == 0); - } +#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0) + inline uint32_t routing_id() const + { + return zmq_msg_routing_id(const_cast(&msg)); + } - inline void rebuild () - { - int rc = zmq_msg_close (&msg); - if (rc != 0) - throw error_t (); - rc = zmq_msg_init (&msg); - if (rc != 0) - throw error_t (); - } + inline void set_routing_id(uint32_t routing_id) + { + int rc = zmq_msg_set_routing_id(&msg, routing_id); + if (rc != 0) + throw error_t(); + } - inline void rebuild (size_t size_) - { - int rc = zmq_msg_close (&msg); - if (rc != 0) - throw error_t (); - rc = zmq_msg_init_size (&msg, size_); - if (rc != 0) - throw error_t (); - } + inline const char* group() const + { + return zmq_msg_group(const_cast(&msg)); + } - inline void rebuild (const void *data_, size_t size_) - { - int rc = zmq_msg_close (&msg); - if (rc != 0) - throw error_t (); - rc = zmq_msg_init_size (&msg, size_); - if (rc != 0) - throw error_t (); - memcpy(data(), data_, size_); - } + inline void set_group(const char* group) + { + int rc = zmq_msg_set_group(&msg, group); + if (rc != 0) + throw error_t(); + } +#endif - inline void rebuild (void *data_, size_t size_, free_fn *ffn_, - void *hint_ = NULL) - { - int rc = zmq_msg_close (&msg); - if (rc != 0) - throw error_t (); - rc = zmq_msg_init_data (&msg, data_, size_, ffn_, hint_); - if (rc != 0) - throw error_t (); + /** Dump content to string. Ascii chars are readable, the rest is printed as hex. + * Probably ridiculously slow. + */ + inline std::string str() const + { + // Partly mutuated from the same method in zmq::multipart_t + std::stringstream os; + + const unsigned char *msg_data = this->data(); + unsigned char byte; + size_t size = this->size(); + int is_ascii[2] = {0, 0}; + + os << "zmq::message_t [size " << std::dec << std::setw(3) + << std::setfill('0') << size << "] ("; + // Totally arbitrary + if (size >= 1000) { + os << "... too big to print)"; + } else { + while (size--) { + byte = *msg_data++; + + is_ascii[1] = (byte >= 33 && byte < 127); + if (is_ascii[1] != is_ascii[0]) + os << " "; // Separate text/non text + + if (is_ascii[1]) { + os << byte; + } else { + os << std::hex << std::uppercase << std::setw(2) + << std::setfill('0') << static_cast(byte); + } + is_ascii[0] = is_ascii[1]; + } + os << ")"; } + return os.str(); + } - inline void move (message_t const *msg_) - { - int rc = zmq_msg_move (&msg, const_cast(&(msg_->msg))); - if (rc != 0) - throw error_t (); - } + private: + // The underlying message + zmq_msg_t msg; - inline void copy (message_t const *msg_) - { - int rc = zmq_msg_copy (&msg, const_cast(&(msg_->msg))); - if (rc != 0) - throw error_t (); - } + // Disable implicit message copying, so that users won't use shared + // messages (less efficient) without being aware of the fact. + message_t(const message_t &) ZMQ_DELETED_FUNCTION; + void operator=(const message_t &) ZMQ_DELETED_FUNCTION; +}; - inline bool more () const ZMQ_NOTHROW - { - int rc = zmq_msg_more (const_cast(&msg) ); - return rc != 0; - } +class context_t +{ + friend class socket_t; - inline void *data () ZMQ_NOTHROW - { - return zmq_msg_data (&msg); - } + public: + inline context_t() + { + ptr = zmq_ctx_new(); + if (ptr == NULL) + throw error_t(); + } - inline const void* data () const ZMQ_NOTHROW - { - return zmq_msg_data (const_cast(&msg)); - } - inline size_t size () const ZMQ_NOTHROW - { - return zmq_msg_size (const_cast(&msg)); - } + inline explicit context_t(int io_threads_, + int max_sockets_ = ZMQ_MAX_SOCKETS_DFLT) + { + ptr = zmq_ctx_new(); + if (ptr == NULL) + throw error_t(); - template T* data() ZMQ_NOTHROW - { - return static_cast( data() ); - } + int rc = zmq_ctx_set(ptr, ZMQ_IO_THREADS, io_threads_); + ZMQ_ASSERT(rc == 0); - template T const* data() const ZMQ_NOTHROW - { - return static_cast( data() ); - } + rc = zmq_ctx_set(ptr, ZMQ_MAX_SOCKETS, max_sockets_); + ZMQ_ASSERT(rc == 0); + } - inline bool equal(const message_t* other) const ZMQ_NOTHROW - { - if (size() != other->size()) - return false; - std::string a(data(), size()); - std::string b(other->data(), other->size()); - return a == b; - } +#ifdef ZMQ_HAS_RVALUE_REFS + inline context_t(context_t &&rhs) ZMQ_NOTHROW : ptr(rhs.ptr) { rhs.ptr = NULL; } + inline context_t &operator=(context_t &&rhs) ZMQ_NOTHROW + { + std::swap(ptr, rhs.ptr); + return *this; + } +#endif - private: - // The underlying message - zmq_msg_t msg; + inline int setctxopt(int option_, int optval_) + { + int rc = zmq_ctx_set(ptr, option_, optval_); + ZMQ_ASSERT(rc == 0); + return rc; + } + + inline int getctxopt(int option_) { return zmq_ctx_get(ptr, option_); } - // Disable implicit message copying, so that users won't use shared - // messages (less efficient) without being aware of the fact. - message_t (const message_t&) ZMQ_DELETED_FUNCTION; - void operator = (const message_t&) ZMQ_DELETED_FUNCTION; - }; + inline ~context_t() ZMQ_NOTHROW { close(); } - class context_t + inline void close() ZMQ_NOTHROW { - friend class socket_t; + if (ptr == NULL) + return; - public: - inline context_t () - { - ptr = zmq_ctx_new (); - if (ptr == NULL) - throw error_t (); - } + int rc = zmq_ctx_destroy(ptr); + ZMQ_ASSERT(rc == 0); + ptr = NULL; + } + // Be careful with this, it's probably only useful for + // using the C api together with an existing C++ api. + // Normally you should never need to use this. + inline ZMQ_EXPLICIT operator void *() ZMQ_NOTHROW { return ptr; } - inline explicit context_t (int io_threads_, int max_sockets_ = ZMQ_MAX_SOCKETS_DFLT) - { - ptr = zmq_ctx_new (); - if (ptr == NULL) - throw error_t (); + inline ZMQ_EXPLICIT operator void const *() const ZMQ_NOTHROW { return ptr; } - int rc = zmq_ctx_set (ptr, ZMQ_IO_THREADS, io_threads_); - ZMQ_ASSERT (rc == 0); + inline operator bool() const ZMQ_NOTHROW { return ptr != NULL; } - rc = zmq_ctx_set (ptr, ZMQ_MAX_SOCKETS, max_sockets_); - ZMQ_ASSERT (rc == 0); - } + private: + void *ptr; + + context_t(const context_t &) ZMQ_DELETED_FUNCTION; + void operator=(const context_t &) ZMQ_DELETED_FUNCTION; +}; + +#ifdef ZMQ_CPP11 +enum class socket_type : int +{ + req = ZMQ_REQ, + rep = ZMQ_REP, + dealer = ZMQ_DEALER, + router = ZMQ_ROUTER, + pub = ZMQ_PUB, + sub = ZMQ_SUB, + xpub = ZMQ_XPUB, + xsub = ZMQ_XSUB, + push = ZMQ_PUSH, + pull = ZMQ_PULL, +#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0) + server = ZMQ_SERVER, + client = ZMQ_CLIENT, + radio = ZMQ_RADIO, + dish = ZMQ_DISH, +#endif +#if ZMQ_VERSION_MAJOR >= 4 + stream = ZMQ_STREAM, +#endif + pair = ZMQ_PAIR +}; +#endif + +class socket_t +{ + friend class monitor_t; + + public: + inline socket_t(context_t &context_, int type_) { init(context_, type_); } + +#ifdef ZMQ_CPP11 + inline socket_t(context_t &context_, socket_type type_) + { + init(context_, static_cast(type_)); + } +#endif #ifdef ZMQ_HAS_RVALUE_REFS - inline context_t (context_t &&rhs) ZMQ_NOTHROW : ptr (rhs.ptr) - { - rhs.ptr = NULL; - } - inline context_t &operator = (context_t &&rhs) ZMQ_NOTHROW - { - std::swap (ptr, rhs.ptr); - return *this; - } + inline socket_t(socket_t &&rhs) ZMQ_NOTHROW : ptr(rhs.ptr), ctxptr(rhs.ctxptr) + { + rhs.ptr = NULL; + rhs.ctxptr = NULL; + } + inline socket_t &operator=(socket_t &&rhs) ZMQ_NOTHROW + { + std::swap(ptr, rhs.ptr); + return *this; + } #endif - inline ~context_t () ZMQ_NOTHROW - { - close(); - } + inline ~socket_t() ZMQ_NOTHROW { close(); } - inline void close() ZMQ_NOTHROW - { - if (ptr == NULL) - return; + inline operator void *() ZMQ_NOTHROW { return ptr; } - int rc = zmq_ctx_destroy (ptr); - ZMQ_ASSERT (rc == 0); - ptr = NULL; - } + inline operator void const *() const ZMQ_NOTHROW { return ptr; } - // Be careful with this, it's probably only useful for - // using the C api together with an existing C++ api. - // Normally you should never need to use this. - inline ZMQ_EXPLICIT operator void* () ZMQ_NOTHROW - { - return ptr; - } + inline void close() ZMQ_NOTHROW + { + if (ptr == NULL) + // already closed + return; + int rc = zmq_close(ptr); + ZMQ_ASSERT(rc == 0); + ptr = 0; + } - inline ZMQ_EXPLICIT operator void const* () const ZMQ_NOTHROW - { - return ptr; - } - private: - - void *ptr; - - context_t (const context_t&) ZMQ_DELETED_FUNCTION; - void operator = (const context_t&) ZMQ_DELETED_FUNCTION; - }; - - #ifdef ZMQ_CPP11 - enum class socket_type: int - { - req = ZMQ_REQ, - rep = ZMQ_REP, - dealer = ZMQ_DEALER, - router = ZMQ_ROUTER, - pub = ZMQ_PUB, - sub = ZMQ_SUB, - xpub = ZMQ_XPUB, - xsub = ZMQ_XSUB, - push = ZMQ_PUSH, - pull = ZMQ_PULL, -#if ZMQ_VERSION_MAJOR < 4 - pair = ZMQ_PAIR -#else - pair = ZMQ_PAIR, - stream = ZMQ_STREAM -#endif - }; - #endif + template void setsockopt(int option_, T const &optval) + { + setsockopt(option_, &optval, sizeof(T)); + } - class socket_t + inline void setsockopt(int option_, const void *optval_, size_t optvallen_) { - friend class monitor_t; - public: - inline socket_t(context_t& context_, int type_) - { - init(context_, type_); - } + int rc = zmq_setsockopt(ptr, option_, optval_, optvallen_); + if (rc != 0) + throw error_t(); + } - #ifdef ZMQ_CPP11 - inline socket_t(context_t& context_, socket_type type_) - { - init(context_, static_cast(type_)); - } - #endif + inline void getsockopt(int option_, void *optval_, size_t *optvallen_) const + { + int rc = zmq_getsockopt(ptr, option_, optval_, optvallen_); + if (rc != 0) + throw error_t(); + } -#ifdef ZMQ_HAS_RVALUE_REFS - inline socket_t(socket_t&& rhs) ZMQ_NOTHROW : ptr(rhs.ptr) - { - rhs.ptr = NULL; - } - inline socket_t& operator=(socket_t&& rhs) ZMQ_NOTHROW - { - std::swap(ptr, rhs.ptr); - return *this; - } -#endif + template T getsockopt(int option_) const + { + T optval; + size_t optlen = sizeof(T); + getsockopt(option_, &optval, &optlen); + return optval; + } - inline ~socket_t () ZMQ_NOTHROW - { - close(); - } + inline void bind(std::string const &addr) { bind(addr.c_str()); } - inline operator void* () ZMQ_NOTHROW - { - return ptr; - } + inline void bind(const char *addr_) + { + int rc = zmq_bind(ptr, addr_); + if (rc != 0) + throw error_t(); + } - inline operator void const* () const ZMQ_NOTHROW - { - return ptr; - } + inline void unbind(std::string const &addr) { unbind(addr.c_str()); } - inline void close() ZMQ_NOTHROW - { - if(ptr == NULL) - // already closed - return ; - int rc = zmq_close (ptr); - ZMQ_ASSERT (rc == 0); - ptr = 0 ; - } + inline void unbind(const char *addr_) + { + int rc = zmq_unbind(ptr, addr_); + if (rc != 0) + throw error_t(); + } - template void setsockopt(int option_, T const& optval) - { - setsockopt(option_, &optval, sizeof(T) ); - } + inline void connect(std::string const &addr) { connect(addr.c_str()); } - inline void setsockopt (int option_, const void *optval_, - size_t optvallen_) - { - int rc = zmq_setsockopt (ptr, option_, optval_, optvallen_); - if (rc != 0) - throw error_t (); - } + inline void connect(const char *addr_) + { + int rc = zmq_connect(ptr, addr_); + if (rc != 0) + throw error_t(); + } - inline void getsockopt (int option_, void *optval_, - size_t *optvallen_) const - { - int rc = zmq_getsockopt (ptr, option_, optval_, optvallen_); - if (rc != 0) - throw error_t (); - } + inline void disconnect(std::string const &addr) { disconnect(addr.c_str()); } - template T getsockopt(int option_) const - { - T optval; - size_t optlen = sizeof(T); - getsockopt(option_, &optval, &optlen ); - return optval; - } + inline void disconnect(const char *addr_) + { + int rc = zmq_disconnect(ptr, addr_); + if (rc != 0) + throw error_t(); + } - inline void bind(std::string const& addr) - { - bind(addr.c_str()); - } + inline bool connected() const ZMQ_NOTHROW { return (ptr != NULL); } - inline void bind (const char *addr_) - { - int rc = zmq_bind (ptr, addr_); - if (rc != 0) - throw error_t (); - } + inline size_t send(const void *buf_, size_t len_, int flags_ = 0) + { + int nbytes = zmq_send(ptr, buf_, len_, flags_); + if (nbytes >= 0) + return (size_t) nbytes; + if (zmq_errno() == EAGAIN) + return 0; + throw error_t(); + } - inline void unbind(std::string const& addr) - { - unbind(addr.c_str()); - } + inline bool send(message_t &msg_, int flags_ = 0) + { + int nbytes = zmq_msg_send(&(msg_.msg), ptr, flags_); + if (nbytes >= 0) + return true; + if (zmq_errno() == EAGAIN) + return false; + throw error_t(); + } - inline void unbind (const char *addr_) - { - int rc = zmq_unbind (ptr, addr_); - if (rc != 0) - throw error_t (); - } + template bool send(T first, T last, int flags_ = 0) + { + zmq::message_t msg(first, last); + return send(msg, flags_); + } - inline void connect(std::string const& addr) - { - connect(addr.c_str()); - } +#ifdef ZMQ_HAS_RVALUE_REFS + inline bool send(message_t &&msg_, int flags_ = 0) { return send(msg_, flags_); } +#endif - inline void connect (const char *addr_) - { - int rc = zmq_connect (ptr, addr_); - if (rc != 0) - throw error_t (); - } + inline size_t recv(void *buf_, size_t len_, int flags_ = 0) + { + int nbytes = zmq_recv(ptr, buf_, len_, flags_); + if (nbytes >= 0) + return (size_t) nbytes; + if (zmq_errno() == EAGAIN) + return 0; + throw error_t(); + } - inline void disconnect(std::string const& addr) - { - disconnect(addr.c_str()); - } + inline bool recv(message_t *msg_, int flags_ = 0) + { + int nbytes = zmq_msg_recv(&(msg_->msg), ptr, flags_); + if (nbytes >= 0) + return true; + if (zmq_errno() == EAGAIN) + return false; + throw error_t(); + } - inline void disconnect (const char *addr_) - { - int rc = zmq_disconnect (ptr, addr_); - if (rc != 0) - throw error_t (); - } +#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0) + inline void join(const char* group) + { + int rc = zmq_join(ptr, group); + if (rc != 0) + throw error_t(); + } - inline bool connected() const ZMQ_NOTHROW - { - return(ptr != NULL); - } - - inline size_t send (const void *buf_, size_t len_, int flags_ = 0) - { - int nbytes = zmq_send (ptr, buf_, len_, flags_); - if (nbytes >= 0) - return (size_t) nbytes; - if (zmq_errno () == EAGAIN) - return 0; - throw error_t (); - } + inline void leave(const char* group) + { + int rc = zmq_leave(ptr, group); + if (rc != 0) + throw error_t(); + } +#endif - inline bool send (message_t &msg_, int flags_ = 0) - { - int nbytes = zmq_msg_send (&(msg_.msg), ptr, flags_); - if (nbytes >= 0) - return true; - if (zmq_errno () == EAGAIN) - return false; - throw error_t (); - } + private: + inline void init(context_t &context_, int type_) + { + ctxptr = context_.ptr; + ptr = zmq_socket(context_.ptr, type_); + if (ptr == NULL) + throw error_t(); + } + + void *ptr; + void *ctxptr; + + socket_t(const socket_t &) ZMQ_DELETED_FUNCTION; + void operator=(const socket_t &) ZMQ_DELETED_FUNCTION; +}; + +class monitor_t +{ + public: + monitor_t() : socketPtr(NULL), monitor_socket(NULL) {} + + virtual ~monitor_t() + { + if (socketPtr) + zmq_socket_monitor(socketPtr, NULL, 0); + + if (monitor_socket) + zmq_close(monitor_socket); + } - template bool send(I first, I last, int flags_=0) - { - zmq::message_t msg(first, last); - return send(msg, flags_); - } #ifdef ZMQ_HAS_RVALUE_REFS - inline bool send (message_t &&msg_, int flags_ = 0) - { - return send(msg_, flags_); - } + monitor_t(monitor_t &&rhs) ZMQ_NOTHROW : socketPtr(rhs.socketPtr), + monitor_socket(rhs.monitor_socket) + { + rhs.socketPtr = NULL; + rhs.monitor_socket = NULL; + } + + socket_t &operator=(socket_t &&rhs) ZMQ_DELETED_FUNCTION; #endif - inline size_t recv (void *buf_, size_t len_, int flags_ = 0) - { - int nbytes = zmq_recv (ptr, buf_, len_, flags_); - if (nbytes >= 0) - return (size_t) nbytes; - if (zmq_errno () == EAGAIN) - return 0; - throw error_t (); - } - inline bool recv (message_t *msg_, int flags_ = 0) - { - int nbytes = zmq_msg_recv (&(msg_->msg), ptr, flags_); - if (nbytes >= 0) - return true; - if (zmq_errno () == EAGAIN) - return false; - throw error_t (); - } - - private: - inline void init(context_t& context_, int type_) - { - ctxptr = context_.ptr; - ptr = zmq_socket (context_.ptr, type_ ); - if (ptr == NULL) - throw error_t (); + void + monitor(socket_t &socket, std::string const &addr, int events = ZMQ_EVENT_ALL) + { + monitor(socket, addr.c_str(), events); + } + + void monitor(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) + { + init(socket, addr_, events); + while (true) { + check_event(-1); } + } + + void init(socket_t &socket, std::string const &addr, int events = ZMQ_EVENT_ALL) + { + init(socket, addr.c_str(), events); + } + + void init(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) + { + int rc = zmq_socket_monitor(socket.ptr, addr_, events); + if (rc != 0) + throw error_t(); + + socketPtr = socket.ptr; + monitor_socket = zmq_socket(socket.ctxptr, ZMQ_PAIR); + assert(monitor_socket); - void *ptr; - void *ctxptr; + rc = zmq_connect(monitor_socket, addr_); + assert(rc == 0); - socket_t (const socket_t&) ZMQ_DELETED_FUNCTION; - void operator = (const socket_t&) ZMQ_DELETED_FUNCTION; - }; + on_monitor_started(); + } - class monitor_t + bool check_event(int timeout = 0) { - public: - monitor_t() : socketPtr(NULL) {} - virtual ~monitor_t() {} + assert(monitor_socket); - void monitor(socket_t &socket, std::string const& addr, int events = ZMQ_EVENT_ALL) - { - monitor(socket, addr.c_str(), events); + zmq_msg_t eventMsg; + zmq_msg_init(&eventMsg); + + zmq::pollitem_t items[] = { + {monitor_socket, 0, ZMQ_POLLIN, 0}, + }; + + zmq::poll(&items[0], 1, timeout); + + if (items[0].revents & ZMQ_POLLIN) { + int rc = zmq_msg_recv(&eventMsg, monitor_socket, 0); + if (rc == -1 && zmq_errno() == ETERM) + return false; + assert(rc != -1); + + } else { + zmq_msg_close(&eventMsg); + return false; } - void monitor(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) - { - int rc = zmq_socket_monitor(socket.ptr, addr_, events); - if (rc != 0) - throw error_t (); - - socketPtr = socket.ptr; - void *s = zmq_socket (socket.ctxptr, ZMQ_PAIR); - assert (s); - - rc = zmq_connect (s, addr_); - assert (rc == 0); - - on_monitor_started(); - - while (true) { - zmq_msg_t eventMsg; - zmq_msg_init (&eventMsg); - rc = zmq_msg_recv (&eventMsg, s, 0); - if (rc == -1 && zmq_errno() == ETERM) - break; - assert (rc != -1); #if ZMQ_VERSION_MAJOR >= 4 - const char* data = static_cast(zmq_msg_data(&eventMsg)); - zmq_event_t msgEvent; - memcpy(&msgEvent.event, data, sizeof(uint16_t)); data += sizeof(uint16_t); - memcpy(&msgEvent.value, data, sizeof(int32_t)); - zmq_event_t* event = &msgEvent; + const char *data = static_cast(zmq_msg_data(&eventMsg)); + zmq_event_t msgEvent; + memcpy(&msgEvent.event, data, sizeof(uint16_t)); + data += sizeof(uint16_t); + memcpy(&msgEvent.value, data, sizeof(int32_t)); + zmq_event_t *event = &msgEvent; #else - zmq_event_t* event = static_cast(zmq_msg_data(&eventMsg)); + zmq_event_t *event = static_cast(zmq_msg_data(&eventMsg)); #endif - + #ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT - zmq_msg_t addrMsg; - zmq_msg_init (&addrMsg); - rc = zmq_msg_recv (&addrMsg, s, 0); - if (rc == -1 && zmq_errno() == ETERM) - break; - assert (rc != -1); - const char* str = static_cast(zmq_msg_data (&addrMsg)); - std::string address(str, str + zmq_msg_size(&addrMsg)); - zmq_msg_close (&addrMsg); + zmq_msg_t addrMsg; + zmq_msg_init(&addrMsg); + int rc = zmq_msg_recv(&addrMsg, monitor_socket, 0); + if (rc == -1 && zmq_errno() == ETERM) { + zmq_msg_close(&eventMsg); + return false; + } + + assert(rc != -1); + const char *str = static_cast(zmq_msg_data(&addrMsg)); + std::string address(str, str + zmq_msg_size(&addrMsg)); + zmq_msg_close(&addrMsg); #else - // Bit of a hack, but all events in the zmq_event_t union have the same layout so this will work for all event types. - std::string address = event->data.connected.addr; + // Bit of a hack, but all events in the zmq_event_t union have the same layout so this will work for all event types. + std::string address = event->data.connected.addr; #endif #ifdef ZMQ_EVENT_MONITOR_STOPPED - if (event->event == ZMQ_EVENT_MONITOR_STOPPED) - break; -#endif - - switch (event->event) { - case ZMQ_EVENT_CONNECTED: - on_event_connected(*event, address.c_str()); - break; - case ZMQ_EVENT_CONNECT_DELAYED: - on_event_connect_delayed(*event, address.c_str()); - break; - case ZMQ_EVENT_CONNECT_RETRIED: - on_event_connect_retried(*event, address.c_str()); - break; - case ZMQ_EVENT_LISTENING: - on_event_listening(*event, address.c_str()); - break; - case ZMQ_EVENT_BIND_FAILED: - on_event_bind_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_ACCEPTED: - on_event_accepted(*event, address.c_str()); - break; - case ZMQ_EVENT_ACCEPT_FAILED: - on_event_accept_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_CLOSED: - on_event_closed(*event, address.c_str()); - break; - case ZMQ_EVENT_CLOSE_FAILED: - on_event_close_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_DISCONNECTED: - on_event_disconnected(*event, address.c_str()); - break; - default: - on_event_unknown(*event, address.c_str()); - break; - } - zmq_msg_close (&eventMsg); - } - zmq_close (s); - socketPtr = NULL; + if (event->event == ZMQ_EVENT_MONITOR_STOPPED) { + zmq_msg_close(&eventMsg); + return false; + } + +#endif + + switch (event->event) { + case ZMQ_EVENT_CONNECTED: + on_event_connected(*event, address.c_str()); + break; + case ZMQ_EVENT_CONNECT_DELAYED: + on_event_connect_delayed(*event, address.c_str()); + break; + case ZMQ_EVENT_CONNECT_RETRIED: + on_event_connect_retried(*event, address.c_str()); + break; + case ZMQ_EVENT_LISTENING: + on_event_listening(*event, address.c_str()); + break; + case ZMQ_EVENT_BIND_FAILED: + on_event_bind_failed(*event, address.c_str()); + break; + case ZMQ_EVENT_ACCEPTED: + on_event_accepted(*event, address.c_str()); + break; + case ZMQ_EVENT_ACCEPT_FAILED: + on_event_accept_failed(*event, address.c_str()); + break; + case ZMQ_EVENT_CLOSED: + on_event_closed(*event, address.c_str()); + break; + case ZMQ_EVENT_CLOSE_FAILED: + on_event_close_failed(*event, address.c_str()); + break; + case ZMQ_EVENT_DISCONNECTED: + on_event_disconnected(*event, address.c_str()); + break; +#ifdef ZMQ_BUILD_DRAFT_API +#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) + case ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL: + on_event_handshake_failed_no_detail(*event, address.c_str()); + break; + case ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL: + on_event_handshake_failed_protocol(*event, address.c_str()); + break; + case ZMQ_EVENT_HANDSHAKE_FAILED_AUTH: + on_event_handshake_failed_auth(*event, address.c_str()); + break; + case ZMQ_EVENT_HANDSHAKE_SUCCEEDED: + on_event_handshake_succeeded(*event, address.c_str()); + break; +#elif ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 1) + case ZMQ_EVENT_HANDSHAKE_FAILED: + on_event_handshake_failed(*event, address.c_str()); + break; + case ZMQ_EVENT_HANDSHAKE_SUCCEED: + on_event_handshake_succeed(*event, address.c_str()); + break; +#endif +#endif + default: + on_event_unknown(*event, address.c_str()); + break; } + zmq_msg_close(&eventMsg); + + return true; + } #ifdef ZMQ_EVENT_MONITOR_STOPPED - void abort() - { - if (socketPtr) - zmq_socket_monitor(socketPtr, NULL, 0); + void abort() + { + if (socketPtr) + zmq_socket_monitor(socketPtr, NULL, 0); + + socketPtr = NULL; + } +#endif + virtual void on_monitor_started() {} + virtual void on_event_connected(const zmq_event_t &event_, const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_connect_delayed(const zmq_event_t &event_, + const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_connect_retried(const zmq_event_t &event_, + const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_listening(const zmq_event_t &event_, const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_bind_failed(const zmq_event_t &event_, const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_accepted(const zmq_event_t &event_, const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_accept_failed(const zmq_event_t &event_, const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_closed(const zmq_event_t &event_, const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_close_failed(const zmq_event_t &event_, const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_disconnected(const zmq_event_t &event_, const char *addr_) + { + (void) event_; + (void) addr_; + } +#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) + virtual void on_event_handshake_failed_no_detail(const zmq_event_t &event_, + const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_handshake_failed_protocol(const zmq_event_t &event_, + const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_handshake_failed_auth(const zmq_event_t &event_, + const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_handshake_succeeded(const zmq_event_t &event_, + const char *addr_) + { + (void) event_; + (void) addr_; + } +#elif ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 1) + virtual void on_event_handshake_failed(const zmq_event_t &event_, + const char *addr_) + { + (void) event_; + (void) addr_; + } + virtual void on_event_handshake_succeed(const zmq_event_t &event_, + const char *addr_) + { + (void) event_; + (void) addr_; + } +#endif + virtual void on_event_unknown(const zmq_event_t &event_, const char *addr_) + { + (void) event_; + (void) addr_; + } + + private: + monitor_t(const monitor_t &) ZMQ_DELETED_FUNCTION; + void operator=(const monitor_t &) ZMQ_DELETED_FUNCTION; + + void *socketPtr; + void *monitor_socket; +}; + +#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER) +template class poller_t +{ + public: + void add(zmq::socket_t &socket, short events, T *user_data) + { + if (0 + != zmq_poller_add(poller_ptr.get(), static_cast(socket), + user_data, events)) { + throw error_t(); + } + } + + void remove(zmq::socket_t &socket) + { + if (0 != zmq_poller_remove(poller_ptr.get(), static_cast(socket))) { + throw error_t(); } + } + + void modify(zmq::socket_t &socket, short events) + { + if (0 + != zmq_poller_modify(poller_ptr.get(), static_cast(socket), + events)) { + throw error_t(); + } + } + + size_t wait_all(std::vector &poller_events, + const std::chrono::microseconds timeout) + { + int rc = zmq_poller_wait_all(poller_ptr.get(), poller_events.data(), + static_cast(poller_events.size()), + static_cast(timeout.count())); + if (rc > 0) + return static_cast(rc); + +#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) + if (zmq_errno() == EAGAIN) +#else + if (zmq_errno() == ETIMEDOUT) #endif - virtual void on_monitor_started() {} - virtual void on_event_connected(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_connect_delayed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_connect_retried(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_listening(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_bind_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_accepted(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_accept_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_closed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_close_failed(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_disconnected(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - virtual void on_event_unknown(const zmq_event_t &event_, const char* addr_) { (void)event_; (void)addr_; } - private: - void* socketPtr; - }; + return 0; + + throw error_t(); + } + + private: + std::unique_ptr> poller_ptr{ + []() { + auto poller_new = zmq_poller_new(); + if (poller_new) + return poller_new; + throw error_t(); + }(), + [](void *ptr) { + int rc = zmq_poller_destroy(&ptr); + ZMQ_ASSERT(rc == 0); + }}; +}; +#endif // defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER) + +inline std::ostream &operator<<(std::ostream &os, const message_t &msg) +{ + return os << msg.str(); } -#endif +} // namespace zmq + +#endif // __ZMQ_HPP_INCLUDED__ From 5aea20bcd5c67f99e1c1c36a05673b9ff2447f94 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 22 Jan 2019 01:38:29 -0500 Subject: [PATCH 67/71] Split cppzmq into its own package. --- LICENSE | 17 - zeromq.spec | 24 +- zmq.hpp | 1135 --------------------------------------------------- 3 files changed, 1 insertion(+), 1175 deletions(-) delete mode 100644 LICENSE delete mode 100644 zmq.hpp diff --git a/LICENSE b/LICENSE deleted file mode 100644 index ae98bd8..0000000 --- a/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. diff --git a/zeromq.spec b/zeromq.spec index c181069..8bf63e3 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,8 +1,5 @@ %bcond_without pgm -# TODO: Split into a separate package? -%global cppzmq_version 4.3.0 - Name: zeromq Version: 4.3.1 Release: 1%{?dist} @@ -11,8 +8,6 @@ Summary: Software library for fast, message-based applications License: LGPLv3+ URL: http://www.zeromq.org Source0: https://github.com/zeromq/libzmq/archive/v%{version}/libzmq-%{version}.tar.gz -Source1: https://github.com/zeromq/cppzmq/raw/v%{cppzmq_version}/zmq.hpp -Source2: https://github.com/zeromq/cppzmq/raw/v%{cppzmq_version}/LICENSE BuildRequires: autoconf BuildRequires: automake @@ -47,21 +42,8 @@ The %{name}-devel package contains libraries and header files for developing applications that use %{name}. -%package -n cppzmq-devel -Summary: Development files for cppzmq -Version: %{cppzmq_version} -License: MIT -Requires: %{name}-devel%{?_isa} = %{version}-%{release} - - -%description -n cppzmq-devel -The cppzmq-devel package contains libraries and header files for -developing applications that use the C++ header files of %{name}. - - %prep %autosetup -p1 -n libzmq-%{version} -cp -a %{SOURCE2} . # Remove bundled code. rm -rf external/wepoll @@ -86,7 +68,6 @@ autoreconf -fi %install %make_install -install -m 644 -p %{SOURCE1} %{buildroot}%{_includedir}/ # remove *.la rm %{buildroot}%{_libdir}/libzmq.la @@ -111,14 +92,11 @@ make check V=1 || ( cat test-suite.log && exit 1 ) %{_libdir}/pkgconfig/libzmq.pc %{_includedir}/zmq*.h -%files -n cppzmq-devel -%license LICENSE -%{_includedir}/zmq.hpp - %changelog * Tue Jan 22 2019 Elliott Sales de Andrade - 4.3.1-1 - Update to latest version of libzmq and cppzmq +- Split cppzmq subpackage into its own package * Mon Jan 21 2019 Elliott Sales de Andrade - 4.1.6-11 - Backport patches to fix test failures in build diff --git a/zmq.hpp b/zmq.hpp deleted file mode 100644 index 97bca4e..0000000 --- a/zmq.hpp +++ /dev/null @@ -1,1135 +0,0 @@ -/* - Copyright (c) 2016-2017 ZeroMQ community - Copyright (c) 2009-2011 250bpm s.r.o. - Copyright (c) 2011 Botond Ballo - Copyright (c) 2007-2009 iMatix Corporation - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. -*/ - -#ifndef __ZMQ_HPP_INCLUDED__ -#define __ZMQ_HPP_INCLUDED__ - -#if (__cplusplus >= 201402L) -#define ZMQ_DEPRECATED(msg) [[deprecated(msg)]] -#elif defined(_MSC_VER) -#define ZMQ_DEPRECATED(msg) __declspec(deprecated(msg)) -#elif defined(__GNUC__) -#define ZMQ_DEPRECATED(msg) __attribute__((deprecated(msg))) -#endif - -#if (__cplusplus >= 201103L) -#define ZMQ_CPP11 -#define ZMQ_NOTHROW noexcept -#define ZMQ_EXPLICIT explicit -#elif (defined(_MSC_VER) && (_MSC_VER >= 1900)) -#define ZMQ_CPP11 -#define ZMQ_NOTHROW noexcept -#define ZMQ_EXPLICIT explicit -#else -#define ZMQ_CPP03 -#define ZMQ_NOTHROW -#define ZMQ_EXPLICIT -#endif - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/* Version macros for compile-time API version detection */ -#define CPPZMQ_VERSION_MAJOR 4 -#define CPPZMQ_VERSION_MINOR 3 -#define CPPZMQ_VERSION_PATCH 0 - -#define CPPZMQ_VERSION \ - ZMQ_MAKE_VERSION(CPPZMQ_VERSION_MAJOR, CPPZMQ_VERSION_MINOR, \ - CPPZMQ_VERSION_PATCH) - -#ifdef ZMQ_CPP11 -#include -#include -#include -#include -#include -#endif - -// Detect whether the compiler supports C++11 rvalue references. -#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) \ - && defined(__GXX_EXPERIMENTAL_CXX0X__)) -#define ZMQ_HAS_RVALUE_REFS -#define ZMQ_DELETED_FUNCTION = delete -#elif defined(__clang__) -#if __has_feature(cxx_rvalue_references) -#define ZMQ_HAS_RVALUE_REFS -#endif - -#if __has_feature(cxx_deleted_functions) -#define ZMQ_DELETED_FUNCTION = delete -#else -#define ZMQ_DELETED_FUNCTION -#endif -#elif defined(_MSC_VER) && (_MSC_VER >= 1900) -#define ZMQ_HAS_RVALUE_REFS -#define ZMQ_DELETED_FUNCTION = delete -#elif defined(_MSC_VER) && (_MSC_VER >= 1600) -#define ZMQ_HAS_RVALUE_REFS -#define ZMQ_DELETED_FUNCTION -#else -#define ZMQ_DELETED_FUNCTION -#endif - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3, 3, 0) -#define ZMQ_NEW_MONITOR_EVENT_LAYOUT -#endif - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) -#define ZMQ_HAS_PROXY_STEERABLE -/* Socket event data */ -typedef struct -{ - uint16_t event; // id of the event as bitfield - int32_t value; // value is either error code, fd or reconnect interval -} zmq_event_t; -#endif - -// Avoid using deprecated message receive function when possible -#if ZMQ_VERSION < ZMQ_MAKE_VERSION(3, 2, 0) -#define zmq_msg_recv(msg, socket, flags) zmq_recvmsg(socket, msg, flags) -#endif - - -// In order to prevent unused variable warnings when building in non-debug -// mode use this macro to make assertions. -#ifndef NDEBUG -#define ZMQ_ASSERT(expression) assert(expression) -#else -#define ZMQ_ASSERT(expression) (void) (expression) -#endif - -namespace zmq -{ -typedef zmq_free_fn free_fn; -typedef zmq_pollitem_t pollitem_t; - -class error_t : public std::exception -{ - public: - error_t() : errnum(zmq_errno()) {} -#ifdef ZMQ_CPP11 - virtual const char *what() const noexcept { return zmq_strerror(errnum); } -#else - virtual const char *what() const throw() { return zmq_strerror(errnum); } -#endif - int num() const { return errnum; } - - private: - int errnum; -}; - -inline int poll(zmq_pollitem_t const *items_, size_t nitems_, long timeout_ = -1) -{ - int rc = zmq_poll(const_cast(items_), - static_cast(nitems_), timeout_); - if (rc < 0) - throw error_t(); - return rc; -} - -#ifdef ZMQ_CPP11 -inline int -poll(zmq_pollitem_t const *items, size_t nitems, std::chrono::milliseconds timeout) -{ - return poll(items, nitems, static_cast(timeout.count())); -} - -inline int poll(std::vector const &items, - std::chrono::milliseconds timeout) -{ - return poll(items.data(), items.size(), static_cast(timeout.count())); -} - -inline int poll(std::vector const &items, long timeout_ = -1) -{ - return poll(items.data(), items.size(), timeout_); -} -#endif - - -inline void proxy(void *frontend, void *backend, void *capture) -{ - int rc = zmq_proxy(frontend, backend, capture); - if (rc != 0) - throw error_t(); -} - -#ifdef ZMQ_HAS_PROXY_STEERABLE -inline void -proxy_steerable(void *frontend, void *backend, void *capture, void *control) -{ - int rc = zmq_proxy_steerable(frontend, backend, capture, control); - if (rc != 0) - throw error_t(); -} -#endif - -inline void version(int *major_, int *minor_, int *patch_) -{ - zmq_version(major_, minor_, patch_); -} - -#ifdef ZMQ_CPP11 -inline std::tuple version() -{ - std::tuple v; - zmq_version(&std::get<0>(v), &std::get<1>(v), &std::get<2>(v)); - return v; -} -#endif - -class message_t -{ - friend class socket_t; - - public: - inline message_t() - { - int rc = zmq_msg_init(&msg); - if (rc != 0) - throw error_t(); - } - - inline explicit message_t(size_t size_) - { - int rc = zmq_msg_init_size(&msg, size_); - if (rc != 0) - throw error_t(); - } - - template message_t(T first, T last) : msg() - { - typedef typename std::iterator_traits::difference_type size_type; - typedef typename std::iterator_traits::value_type value_t; - - size_type const size_ = std::distance(first, last) * sizeof(value_t); - int const rc = zmq_msg_init_size(&msg, size_); - if (rc != 0) - throw error_t(); - value_t *dest = data(); - while (first != last) { - *dest = *first; - ++dest; - ++first; - } - } - - inline message_t(const void *data_, size_t size_) - { - int rc = zmq_msg_init_size(&msg, size_); - if (rc != 0) - throw error_t(); - memcpy(data(), data_, size_); - } - - inline message_t(void *data_, size_t size_, free_fn *ffn_, void *hint_ = NULL) - { - int rc = zmq_msg_init_data(&msg, data_, size_, ffn_, hint_); - if (rc != 0) - throw error_t(); - } - -#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) - template - message_t(const T &msg_) : message_t(std::begin(msg_), std::end(msg_)) - { - } -#endif - -#ifdef ZMQ_HAS_RVALUE_REFS - inline message_t(message_t &&rhs) : msg(rhs.msg) - { - int rc = zmq_msg_init(&rhs.msg); - if (rc != 0) - throw error_t(); - } - - inline message_t &operator=(message_t &&rhs) ZMQ_NOTHROW - { - std::swap(msg, rhs.msg); - return *this; - } -#endif - - inline ~message_t() ZMQ_NOTHROW - { - int rc = zmq_msg_close(&msg); - ZMQ_ASSERT(rc == 0); - } - - inline void rebuild() - { - int rc = zmq_msg_close(&msg); - if (rc != 0) - throw error_t(); - rc = zmq_msg_init(&msg); - if (rc != 0) - throw error_t(); - } - - inline void rebuild(size_t size_) - { - int rc = zmq_msg_close(&msg); - if (rc != 0) - throw error_t(); - rc = zmq_msg_init_size(&msg, size_); - if (rc != 0) - throw error_t(); - } - - inline void rebuild(const void *data_, size_t size_) - { - int rc = zmq_msg_close(&msg); - if (rc != 0) - throw error_t(); - rc = zmq_msg_init_size(&msg, size_); - if (rc != 0) - throw error_t(); - memcpy(data(), data_, size_); - } - - inline void rebuild(void *data_, size_t size_, free_fn *ffn_, void *hint_ = NULL) - { - int rc = zmq_msg_close(&msg); - if (rc != 0) - throw error_t(); - rc = zmq_msg_init_data(&msg, data_, size_, ffn_, hint_); - if (rc != 0) - throw error_t(); - } - - inline void move(message_t const *msg_) - { - int rc = zmq_msg_move(&msg, const_cast(&(msg_->msg))); - if (rc != 0) - throw error_t(); - } - - inline void copy(message_t const *msg_) - { - int rc = zmq_msg_copy(&msg, const_cast(&(msg_->msg))); - if (rc != 0) - throw error_t(); - } - - inline bool more() const ZMQ_NOTHROW - { - int rc = zmq_msg_more(const_cast(&msg)); - return rc != 0; - } - - inline void *data() ZMQ_NOTHROW { return zmq_msg_data(&msg); } - - inline const void *data() const ZMQ_NOTHROW - { - return zmq_msg_data(const_cast(&msg)); - } - - inline size_t size() const ZMQ_NOTHROW - { - return zmq_msg_size(const_cast(&msg)); - } - - template T *data() ZMQ_NOTHROW { return static_cast(data()); } - - template T const *data() const ZMQ_NOTHROW - { - return static_cast(data()); - } - - ZMQ_DEPRECATED("from 4.3.0, use operator== instead") - inline bool equal(const message_t *other) const ZMQ_NOTHROW - { - return *this == *other; - } - - inline bool operator==(const message_t &other) const ZMQ_NOTHROW - { - const size_t my_size = size(); - return my_size == other.size() && 0 == memcmp(data(), other.data(), my_size); - } - - inline bool operator!=(const message_t &other) const ZMQ_NOTHROW - { - return !(*this == other); - } - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) - inline const char *gets(const char *property_) - { - const char *value = zmq_msg_gets(&msg, property_); - if (value == NULL) - throw error_t(); - return value; - } -#endif - -#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0) - inline uint32_t routing_id() const - { - return zmq_msg_routing_id(const_cast(&msg)); - } - - inline void set_routing_id(uint32_t routing_id) - { - int rc = zmq_msg_set_routing_id(&msg, routing_id); - if (rc != 0) - throw error_t(); - } - - inline const char* group() const - { - return zmq_msg_group(const_cast(&msg)); - } - - inline void set_group(const char* group) - { - int rc = zmq_msg_set_group(&msg, group); - if (rc != 0) - throw error_t(); - } -#endif - - /** Dump content to string. Ascii chars are readable, the rest is printed as hex. - * Probably ridiculously slow. - */ - inline std::string str() const - { - // Partly mutuated from the same method in zmq::multipart_t - std::stringstream os; - - const unsigned char *msg_data = this->data(); - unsigned char byte; - size_t size = this->size(); - int is_ascii[2] = {0, 0}; - - os << "zmq::message_t [size " << std::dec << std::setw(3) - << std::setfill('0') << size << "] ("; - // Totally arbitrary - if (size >= 1000) { - os << "... too big to print)"; - } else { - while (size--) { - byte = *msg_data++; - - is_ascii[1] = (byte >= 33 && byte < 127); - if (is_ascii[1] != is_ascii[0]) - os << " "; // Separate text/non text - - if (is_ascii[1]) { - os << byte; - } else { - os << std::hex << std::uppercase << std::setw(2) - << std::setfill('0') << static_cast(byte); - } - is_ascii[0] = is_ascii[1]; - } - os << ")"; - } - return os.str(); - } - - private: - // The underlying message - zmq_msg_t msg; - - // Disable implicit message copying, so that users won't use shared - // messages (less efficient) without being aware of the fact. - message_t(const message_t &) ZMQ_DELETED_FUNCTION; - void operator=(const message_t &) ZMQ_DELETED_FUNCTION; -}; - -class context_t -{ - friend class socket_t; - - public: - inline context_t() - { - ptr = zmq_ctx_new(); - if (ptr == NULL) - throw error_t(); - } - - - inline explicit context_t(int io_threads_, - int max_sockets_ = ZMQ_MAX_SOCKETS_DFLT) - { - ptr = zmq_ctx_new(); - if (ptr == NULL) - throw error_t(); - - int rc = zmq_ctx_set(ptr, ZMQ_IO_THREADS, io_threads_); - ZMQ_ASSERT(rc == 0); - - rc = zmq_ctx_set(ptr, ZMQ_MAX_SOCKETS, max_sockets_); - ZMQ_ASSERT(rc == 0); - } - -#ifdef ZMQ_HAS_RVALUE_REFS - inline context_t(context_t &&rhs) ZMQ_NOTHROW : ptr(rhs.ptr) { rhs.ptr = NULL; } - inline context_t &operator=(context_t &&rhs) ZMQ_NOTHROW - { - std::swap(ptr, rhs.ptr); - return *this; - } -#endif - - inline int setctxopt(int option_, int optval_) - { - int rc = zmq_ctx_set(ptr, option_, optval_); - ZMQ_ASSERT(rc == 0); - return rc; - } - - inline int getctxopt(int option_) { return zmq_ctx_get(ptr, option_); } - - inline ~context_t() ZMQ_NOTHROW { close(); } - - inline void close() ZMQ_NOTHROW - { - if (ptr == NULL) - return; - - int rc = zmq_ctx_destroy(ptr); - ZMQ_ASSERT(rc == 0); - ptr = NULL; - } - - // Be careful with this, it's probably only useful for - // using the C api together with an existing C++ api. - // Normally you should never need to use this. - inline ZMQ_EXPLICIT operator void *() ZMQ_NOTHROW { return ptr; } - - inline ZMQ_EXPLICIT operator void const *() const ZMQ_NOTHROW { return ptr; } - - inline operator bool() const ZMQ_NOTHROW { return ptr != NULL; } - - private: - void *ptr; - - context_t(const context_t &) ZMQ_DELETED_FUNCTION; - void operator=(const context_t &) ZMQ_DELETED_FUNCTION; -}; - -#ifdef ZMQ_CPP11 -enum class socket_type : int -{ - req = ZMQ_REQ, - rep = ZMQ_REP, - dealer = ZMQ_DEALER, - router = ZMQ_ROUTER, - pub = ZMQ_PUB, - sub = ZMQ_SUB, - xpub = ZMQ_XPUB, - xsub = ZMQ_XSUB, - push = ZMQ_PUSH, - pull = ZMQ_PULL, -#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0) - server = ZMQ_SERVER, - client = ZMQ_CLIENT, - radio = ZMQ_RADIO, - dish = ZMQ_DISH, -#endif -#if ZMQ_VERSION_MAJOR >= 4 - stream = ZMQ_STREAM, -#endif - pair = ZMQ_PAIR -}; -#endif - -class socket_t -{ - friend class monitor_t; - - public: - inline socket_t(context_t &context_, int type_) { init(context_, type_); } - -#ifdef ZMQ_CPP11 - inline socket_t(context_t &context_, socket_type type_) - { - init(context_, static_cast(type_)); - } -#endif - -#ifdef ZMQ_HAS_RVALUE_REFS - inline socket_t(socket_t &&rhs) ZMQ_NOTHROW : ptr(rhs.ptr), ctxptr(rhs.ctxptr) - { - rhs.ptr = NULL; - rhs.ctxptr = NULL; - } - inline socket_t &operator=(socket_t &&rhs) ZMQ_NOTHROW - { - std::swap(ptr, rhs.ptr); - return *this; - } -#endif - - inline ~socket_t() ZMQ_NOTHROW { close(); } - - inline operator void *() ZMQ_NOTHROW { return ptr; } - - inline operator void const *() const ZMQ_NOTHROW { return ptr; } - - inline void close() ZMQ_NOTHROW - { - if (ptr == NULL) - // already closed - return; - int rc = zmq_close(ptr); - ZMQ_ASSERT(rc == 0); - ptr = 0; - } - - template void setsockopt(int option_, T const &optval) - { - setsockopt(option_, &optval, sizeof(T)); - } - - inline void setsockopt(int option_, const void *optval_, size_t optvallen_) - { - int rc = zmq_setsockopt(ptr, option_, optval_, optvallen_); - if (rc != 0) - throw error_t(); - } - - inline void getsockopt(int option_, void *optval_, size_t *optvallen_) const - { - int rc = zmq_getsockopt(ptr, option_, optval_, optvallen_); - if (rc != 0) - throw error_t(); - } - - template T getsockopt(int option_) const - { - T optval; - size_t optlen = sizeof(T); - getsockopt(option_, &optval, &optlen); - return optval; - } - - inline void bind(std::string const &addr) { bind(addr.c_str()); } - - inline void bind(const char *addr_) - { - int rc = zmq_bind(ptr, addr_); - if (rc != 0) - throw error_t(); - } - - inline void unbind(std::string const &addr) { unbind(addr.c_str()); } - - inline void unbind(const char *addr_) - { - int rc = zmq_unbind(ptr, addr_); - if (rc != 0) - throw error_t(); - } - - inline void connect(std::string const &addr) { connect(addr.c_str()); } - - inline void connect(const char *addr_) - { - int rc = zmq_connect(ptr, addr_); - if (rc != 0) - throw error_t(); - } - - inline void disconnect(std::string const &addr) { disconnect(addr.c_str()); } - - inline void disconnect(const char *addr_) - { - int rc = zmq_disconnect(ptr, addr_); - if (rc != 0) - throw error_t(); - } - - inline bool connected() const ZMQ_NOTHROW { return (ptr != NULL); } - - inline size_t send(const void *buf_, size_t len_, int flags_ = 0) - { - int nbytes = zmq_send(ptr, buf_, len_, flags_); - if (nbytes >= 0) - return (size_t) nbytes; - if (zmq_errno() == EAGAIN) - return 0; - throw error_t(); - } - - inline bool send(message_t &msg_, int flags_ = 0) - { - int nbytes = zmq_msg_send(&(msg_.msg), ptr, flags_); - if (nbytes >= 0) - return true; - if (zmq_errno() == EAGAIN) - return false; - throw error_t(); - } - - template bool send(T first, T last, int flags_ = 0) - { - zmq::message_t msg(first, last); - return send(msg, flags_); - } - -#ifdef ZMQ_HAS_RVALUE_REFS - inline bool send(message_t &&msg_, int flags_ = 0) { return send(msg_, flags_); } -#endif - - inline size_t recv(void *buf_, size_t len_, int flags_ = 0) - { - int nbytes = zmq_recv(ptr, buf_, len_, flags_); - if (nbytes >= 0) - return (size_t) nbytes; - if (zmq_errno() == EAGAIN) - return 0; - throw error_t(); - } - - inline bool recv(message_t *msg_, int flags_ = 0) - { - int nbytes = zmq_msg_recv(&(msg_->msg), ptr, flags_); - if (nbytes >= 0) - return true; - if (zmq_errno() == EAGAIN) - return false; - throw error_t(); - } - -#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 0) - inline void join(const char* group) - { - int rc = zmq_join(ptr, group); - if (rc != 0) - throw error_t(); - } - - inline void leave(const char* group) - { - int rc = zmq_leave(ptr, group); - if (rc != 0) - throw error_t(); - } -#endif - - private: - inline void init(context_t &context_, int type_) - { - ctxptr = context_.ptr; - ptr = zmq_socket(context_.ptr, type_); - if (ptr == NULL) - throw error_t(); - } - - void *ptr; - void *ctxptr; - - socket_t(const socket_t &) ZMQ_DELETED_FUNCTION; - void operator=(const socket_t &) ZMQ_DELETED_FUNCTION; -}; - -class monitor_t -{ - public: - monitor_t() : socketPtr(NULL), monitor_socket(NULL) {} - - virtual ~monitor_t() - { - if (socketPtr) - zmq_socket_monitor(socketPtr, NULL, 0); - - if (monitor_socket) - zmq_close(monitor_socket); - } - - -#ifdef ZMQ_HAS_RVALUE_REFS - monitor_t(monitor_t &&rhs) ZMQ_NOTHROW : socketPtr(rhs.socketPtr), - monitor_socket(rhs.monitor_socket) - { - rhs.socketPtr = NULL; - rhs.monitor_socket = NULL; - } - - socket_t &operator=(socket_t &&rhs) ZMQ_DELETED_FUNCTION; -#endif - - - void - monitor(socket_t &socket, std::string const &addr, int events = ZMQ_EVENT_ALL) - { - monitor(socket, addr.c_str(), events); - } - - void monitor(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) - { - init(socket, addr_, events); - while (true) { - check_event(-1); - } - } - - void init(socket_t &socket, std::string const &addr, int events = ZMQ_EVENT_ALL) - { - init(socket, addr.c_str(), events); - } - - void init(socket_t &socket, const char *addr_, int events = ZMQ_EVENT_ALL) - { - int rc = zmq_socket_monitor(socket.ptr, addr_, events); - if (rc != 0) - throw error_t(); - - socketPtr = socket.ptr; - monitor_socket = zmq_socket(socket.ctxptr, ZMQ_PAIR); - assert(monitor_socket); - - rc = zmq_connect(monitor_socket, addr_); - assert(rc == 0); - - on_monitor_started(); - } - - bool check_event(int timeout = 0) - { - assert(monitor_socket); - - zmq_msg_t eventMsg; - zmq_msg_init(&eventMsg); - - zmq::pollitem_t items[] = { - {monitor_socket, 0, ZMQ_POLLIN, 0}, - }; - - zmq::poll(&items[0], 1, timeout); - - if (items[0].revents & ZMQ_POLLIN) { - int rc = zmq_msg_recv(&eventMsg, monitor_socket, 0); - if (rc == -1 && zmq_errno() == ETERM) - return false; - assert(rc != -1); - - } else { - zmq_msg_close(&eventMsg); - return false; - } - -#if ZMQ_VERSION_MAJOR >= 4 - const char *data = static_cast(zmq_msg_data(&eventMsg)); - zmq_event_t msgEvent; - memcpy(&msgEvent.event, data, sizeof(uint16_t)); - data += sizeof(uint16_t); - memcpy(&msgEvent.value, data, sizeof(int32_t)); - zmq_event_t *event = &msgEvent; -#else - zmq_event_t *event = static_cast(zmq_msg_data(&eventMsg)); -#endif - -#ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT - zmq_msg_t addrMsg; - zmq_msg_init(&addrMsg); - int rc = zmq_msg_recv(&addrMsg, monitor_socket, 0); - if (rc == -1 && zmq_errno() == ETERM) { - zmq_msg_close(&eventMsg); - return false; - } - - assert(rc != -1); - const char *str = static_cast(zmq_msg_data(&addrMsg)); - std::string address(str, str + zmq_msg_size(&addrMsg)); - zmq_msg_close(&addrMsg); -#else - // Bit of a hack, but all events in the zmq_event_t union have the same layout so this will work for all event types. - std::string address = event->data.connected.addr; -#endif - -#ifdef ZMQ_EVENT_MONITOR_STOPPED - if (event->event == ZMQ_EVENT_MONITOR_STOPPED) { - zmq_msg_close(&eventMsg); - return false; - } - -#endif - - switch (event->event) { - case ZMQ_EVENT_CONNECTED: - on_event_connected(*event, address.c_str()); - break; - case ZMQ_EVENT_CONNECT_DELAYED: - on_event_connect_delayed(*event, address.c_str()); - break; - case ZMQ_EVENT_CONNECT_RETRIED: - on_event_connect_retried(*event, address.c_str()); - break; - case ZMQ_EVENT_LISTENING: - on_event_listening(*event, address.c_str()); - break; - case ZMQ_EVENT_BIND_FAILED: - on_event_bind_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_ACCEPTED: - on_event_accepted(*event, address.c_str()); - break; - case ZMQ_EVENT_ACCEPT_FAILED: - on_event_accept_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_CLOSED: - on_event_closed(*event, address.c_str()); - break; - case ZMQ_EVENT_CLOSE_FAILED: - on_event_close_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_DISCONNECTED: - on_event_disconnected(*event, address.c_str()); - break; -#ifdef ZMQ_BUILD_DRAFT_API -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) - case ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL: - on_event_handshake_failed_no_detail(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL: - on_event_handshake_failed_protocol(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_FAILED_AUTH: - on_event_handshake_failed_auth(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_SUCCEEDED: - on_event_handshake_succeeded(*event, address.c_str()); - break; -#elif ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 1) - case ZMQ_EVENT_HANDSHAKE_FAILED: - on_event_handshake_failed(*event, address.c_str()); - break; - case ZMQ_EVENT_HANDSHAKE_SUCCEED: - on_event_handshake_succeed(*event, address.c_str()); - break; -#endif -#endif - default: - on_event_unknown(*event, address.c_str()); - break; - } - zmq_msg_close(&eventMsg); - - return true; - } - -#ifdef ZMQ_EVENT_MONITOR_STOPPED - void abort() - { - if (socketPtr) - zmq_socket_monitor(socketPtr, NULL, 0); - - socketPtr = NULL; - } -#endif - virtual void on_monitor_started() {} - virtual void on_event_connected(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_connect_delayed(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_connect_retried(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_listening(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_bind_failed(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_accepted(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_accept_failed(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_closed(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_close_failed(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_disconnected(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) - virtual void on_event_handshake_failed_no_detail(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_handshake_failed_protocol(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_handshake_failed_auth(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_handshake_succeeded(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } -#elif ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 1) - virtual void on_event_handshake_failed(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } - virtual void on_event_handshake_succeed(const zmq_event_t &event_, - const char *addr_) - { - (void) event_; - (void) addr_; - } -#endif - virtual void on_event_unknown(const zmq_event_t &event_, const char *addr_) - { - (void) event_; - (void) addr_; - } - - private: - monitor_t(const monitor_t &) ZMQ_DELETED_FUNCTION; - void operator=(const monitor_t &) ZMQ_DELETED_FUNCTION; - - void *socketPtr; - void *monitor_socket; -}; - -#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER) -template class poller_t -{ - public: - void add(zmq::socket_t &socket, short events, T *user_data) - { - if (0 - != zmq_poller_add(poller_ptr.get(), static_cast(socket), - user_data, events)) { - throw error_t(); - } - } - - void remove(zmq::socket_t &socket) - { - if (0 != zmq_poller_remove(poller_ptr.get(), static_cast(socket))) { - throw error_t(); - } - } - - void modify(zmq::socket_t &socket, short events) - { - if (0 - != zmq_poller_modify(poller_ptr.get(), static_cast(socket), - events)) { - throw error_t(); - } - } - - size_t wait_all(std::vector &poller_events, - const std::chrono::microseconds timeout) - { - int rc = zmq_poller_wait_all(poller_ptr.get(), poller_events.data(), - static_cast(poller_events.size()), - static_cast(timeout.count())); - if (rc > 0) - return static_cast(rc); - -#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 2, 3) - if (zmq_errno() == EAGAIN) -#else - if (zmq_errno() == ETIMEDOUT) -#endif - return 0; - - throw error_t(); - } - - private: - std::unique_ptr> poller_ptr{ - []() { - auto poller_new = zmq_poller_new(); - if (poller_new) - return poller_new; - throw error_t(); - }(), - [](void *ptr) { - int rc = zmq_poller_destroy(&ptr); - ZMQ_ASSERT(rc == 0); - }}; -}; -#endif // defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) && defined(ZMQ_HAVE_POLLER) - -inline std::ostream &operator<<(std::ostream &os, const message_t &msg) -{ - return os << msg.str(); -} - -} // namespace zmq - -#endif // __ZMQ_HPP_INCLUDED__ From 9e5b263a81c62e1794d0297c1e01a16c891fb3fb Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 3 Feb 2019 13:09:55 +0000 Subject: [PATCH 68/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 8bf63e3..bbc948a 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.3.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Software library for fast, message-based applications License: LGPLv3+ @@ -94,6 +94,9 @@ make check V=1 || ( cat test-suite.log && exit 1 ) %changelog +* Sun Feb 03 2019 Fedora Release Engineering - 4.3.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Tue Jan 22 2019 Elliott Sales de Andrade - 4.3.1-1 - Update to latest version of libzmq and cppzmq - Split cppzmq subpackage into its own package From 3fa0303d29b0dbd2807ec8fdf05a378e9c0f544a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 16 Feb 2019 16:32:57 -0500 Subject: [PATCH 69/71] Disable libunwind on unsupported arches. --- zeromq.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index bbc948a..4eceec7 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.3.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Software library for fast, message-based applications License: LGPLv3+ @@ -14,7 +14,9 @@ BuildRequires: automake BuildRequires: gcc-c++ BuildRequires: libtool BuildRequires: libsodium-devel +%ifarch %{arm} aarch64 hppa ia64 mips ppc %{power64} %{ix86} x86_64 BuildRequires: libunwind-devel +%endif %if %{with pgm} BuildRequires: openpgm-devel @@ -60,7 +62,9 @@ autoreconf -fi --with-libgssapi_krb5 \ %endif --with-libsodium \ +%ifarch %{arm} aarch64 hppa ia64 mips ppc %{power64} %{ix86} x86_64 --enable-libunwind \ +%endif --disable-Werror \ --disable-static %make_build @@ -94,6 +98,9 @@ make check V=1 || ( cat test-suite.log && exit 1 ) %changelog +* Sat Feb 16 2019 Elliott Sales de Andrade - 4.3.1-3 +- Disable libunwind on unsupported arches (#1676262) + * Sun Feb 03 2019 Fedora Release Engineering - 4.3.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild From 8b1b433149364e846c6ea11acb14d966867fa871 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 27 Jul 2019 04:58:52 +0000 Subject: [PATCH 70/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- zeromq.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zeromq.spec b/zeromq.spec index 4eceec7..926c06b 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -2,7 +2,7 @@ Name: zeromq Version: 4.3.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Software library for fast, message-based applications License: LGPLv3+ @@ -98,6 +98,9 @@ make check V=1 || ( cat test-suite.log && exit 1 ) %changelog +* Sat Jul 27 2019 Fedora Release Engineering - 4.3.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Sat Feb 16 2019 Elliott Sales de Andrade - 4.3.1-3 - Disable libunwind on unsupported arches (#1676262) From a31484cb1d294349d8bca4da42668bdac8d5a7ca Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 8 Sep 2019 03:33:08 -0400 Subject: [PATCH 71/71] Update to latest version. --- .gitignore | 1 + sources | 2 +- zeromq.spec | 10 +++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 5f933d7..9833261 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /i?86/ /tarballs/ /libzmq-4.3.1.tar.gz +/libzmq-4.3.2.tar.gz diff --git a/sources b/sources index 02cfb10..3ae9ba4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libzmq-4.3.1.tar.gz) = 64855a73331a194c43b01aa86a985a149eba4ed32b9f6483d2a7415cfd8bba557aab5b7b33d160cd177141de02360b73c20e4696a19c2cd798eb5f82eeb72840 +SHA512 (libzmq-4.3.2.tar.gz) = 3c0a2dfc60c2265311f6ba16c47fab37e71312949b4cf2aa8855530431763bb6b8844c7d72c4b112c21125f0590c663d2a3192249b14611df64a2c6d3e5ac1c7 diff --git a/zeromq.spec b/zeromq.spec index 926c06b..0dbeacd 100644 --- a/zeromq.spec +++ b/zeromq.spec @@ -1,12 +1,12 @@ %bcond_without pgm Name: zeromq -Version: 4.3.1 -Release: 4%{?dist} +Version: 4.3.2 +Release: 1%{?dist} Summary: Software library for fast, message-based applications License: LGPLv3+ -URL: http://www.zeromq.org +URL: https://zeromq.org Source0: https://github.com/zeromq/libzmq/archive/v%{version}/libzmq-%{version}.tar.gz BuildRequires: autoconf @@ -98,6 +98,10 @@ make check V=1 || ( cat test-suite.log && exit 1 ) %changelog +* Sun Sep 08 2019 Elliott Sales de Andrade - 4.3.2-1 +- Update to latest version +- Fix CVE-2019-13132 (#1729830) + * Sat Jul 27 2019 Fedora Release Engineering - 4.3.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild