Commit Graph

4474 Commits

Author SHA1 Message Date
Pieter Hintjens
b49a60410a Problem: use of libsodium vs. tweetnacl is confused
It's unclear which we need and in the source code, conditional code
treats tweetnacl as a subclass of libsodium, which is inaccurate.

Solution: redesign the configure/cmake API for this:

* tweetnacl is present by default and cannot be enabled
* libsodium can be enabled using --with-libsodium, which replaces
  the built-in tweetnacl
* CURVE encryption can be disabled entirely using --enable-curve=no

The macros we define in platform.hpp are:

    ZMQ_HAVE_CURVE    1        //  When CURVE is enabled
    HAVE_LIBSODIUM    1        //  When we are using libsodium
    HAVE_TWEETNACL    1        //  When we're using tweetnacl (default)

As of this patch, the default build of libzmq always has CURVE
security, and always uses tweetnacl.
2016-02-11 13:32:01 +01:00
Min RK
42ab88e486 Merge pull request #1786 from hintjens/master
Cleaning up recent option names
2016-02-09 12:50:30 +01:00
Pieter Hintjens
62c66ae7f7 Problem: test_large_msg kills my system temporarily
And I'm on a reasonably sized laptop. I think allocating INT_MAX
memory is dangerous in a test case.

Solution: expose this as a context option. I've used ZMQ_MAX_MSGSZ
and documented it and implemented the API. However I don't know how
to get the parent context for a socket, so the code in zmq.cpp is
still unfinished.
2016-02-09 10:55:09 +01:00
Pieter Hintjens
7470c00d4d Problem: ZMQ_TCP_RECV_BUFFER/SEND_BUFFER are redundant
These options are confusing and redundant. Their names suggest
they apply to the tcp:// transport, yet they are used for all
stream protocols. The methods zmq::set_tcp_receive_buffer and
zmq::set_tcp_send_buffer don't use these values at all, they use
ZMQ_SNDBUF and ZMQ_RCVBUF.

Solution: merge these new options into ZMQ_SNDBUF and ZMQ_RCVBUF.

This means defaulting these two options to 8192, and removing the
new options. We now have ZMQ_SNDBUF and ZMQ_RCVBUF being used both
for TCP socket control, and for input/output buffering.

Note: the default for SNDBUF and RCVBUF are otherwise 4096.
2016-02-09 10:53:52 +01:00
Pieter Hintjens
884c7f78e9 Problem: zmq_getsockopt wrongly referred to ZMQ_THREADSAFE
The proper name is ZMQ_THREAD_SAFE

Solution: fix in the documentation.
2016-02-09 10:53:52 +01:00
Pieter Hintjens
7f6ed167fc Problem: ZMQ_XPUB_VERBOSE_UNSUBSCRIBE is clumsy
This option has a few issues. The name is long and clumsy. The
functonality is not smooth: one must set both this and
ZMQ_XPUB_VERBOSE at the same time, or things will break mysteriously.

Solution: rename to ZMQ_XPUB_VERBOSER and make an atomic option.

That is, implicitly does ZMQ_XPUB_VERBOSE.
2016-02-09 10:53:52 +01:00
Pieter Hintjens
da8ce55a14 Problem: ZMQ_TCP_RETRANSMIT_TIMEOUT is a clumsy name
Solution: rename to ZMQ_MAXRT

This is the option name used on Windows, so easier to use and
remember.
2016-02-09 10:53:52 +01:00
Pieter Hintjens
5eccd874d6 Merge pull request #1785 from bluca/one_more_rename
Problem: ZMQ_USEFD does not follow conventions
2016-02-09 10:40:39 +01:00
Luca Boccassi
edc4ee03e8 Problem: ZMQ_USEFD does not follow conventions
Solution: rename socket option (and variables and files) from usefd
to use_fd.
2016-02-09 09:36:14 +00:00
Constantin Rack
15846f2fe4 Merge pull request #1784 from bluca/rename_pre_allocated_fd
Problem: ZMQ_PRE_ALLOCATED_FD is too long
2016-02-09 00:10:47 +01:00
Luca Boccassi
c158178798 Problem: ZMQ_PRE_ALLOCATED_FD is too long
Solution: rename socket option (and variables and files) from
pre_allocated_fd to usefd.
2016-02-08 22:46:34 +00:00
Pieter Hintjens
66d9a5f5ae Merge pull request #1783 from bluca/travis_tweetnacl
CMake and tweetnacl CI
2016-02-08 14:46:02 +01:00
Luca Boccassi
c23cc65735 Problem: no CMake Travis CI build
Solution: add builds/cmake/ci_build.sh and call it from travis.yml
2016-02-08 13:30:25 +00:00
Luca Boccassi
918c1ec620 Problem: CMake uses command added in 2.8.12
Solution: bump CMake required version to 2.8.12 to avoid:

CMake Error at tests/CMakeLists.txt:110 (target_include_directories):
  Unknown CMake command "target_include_directories".
2016-02-08 13:13:55 +00:00
Luca Boccassi
84544ca6e2 Problem: no CI build with tweetnacl
Solution: add builds/tweetnacl/ci_build.sh and add it in travis.yml
2016-02-08 12:31:05 +00:00
Luca Boccassi
6681bcf08c Problem: tweetnacl/contrib/randombytes need C++0x
Solution: disable -pedantic when building with tweetnacl to avoid
warning about "long long" not existing in ISO C++ 98
2016-02-08 12:31:05 +00:00
Pieter Hintjens
c59670dbc2 Merge pull request #1782 from minrk/configure-with-tweetnacl
fallback on tweetnacl if libsodium is not found and not explicitly requested
2016-02-08 12:00:40 +01:00
Min RK
e86650794f fallback on tweetnacl if libsodium is not found and not explicitly requested 2016-02-08 11:58:30 +01:00
Min RK
2902fd60b9 add --with-tweetnacl to configure
allows building with tweetnacl without cmake
2016-02-08 11:40:50 +01:00
Luca Boccassi
135c4112c8 Merge pull request #1780 from hintjens/master
Fixes to Windows builds
2016-02-07 11:33:43 +00:00
Pieter Hintjens
58059939fc Problem: compile warnings on Windows in new radio/dish code
Solution: fix these.
2016-02-07 12:27:23 +01:00
Pieter Hintjens
e0f02bdfb8 Problem: libzmq uses different build.bat style than zproject
Solution: at least for vs2015, add vs2015/build.bat to work the
same was as zproject.
2016-02-07 10:36:17 +01:00
Pieter Hintjens
07cba2307d Merge pull request #1779 from obache/neatsrc/fix-a-typo-for-ZMTP-heartbeats
Fix a typo in "Add ZMTP heartbeats" changes
2016-02-07 10:31:33 +01:00
Pieter Hintjens
8a1dcca8c2 Merge pull request #1778 from obache/neatsrc/fix1768
Change to detect POSIX Thread priority support properly
2016-02-07 10:31:19 +01:00
Pieter Hintjens
4c6753346b Merge pull request #1777 from brian-peloton/master
Use memcpy instead of assuming option values are aligned
2016-02-07 10:31:06 +01:00
OBATA Akio
99495bbab8 Fix a typo in "Add ZMTP heartbeats" changes 2016-02-07 17:09:19 +09:00
OBATA Akio
7cd60fae59 Change to detect POSIX Thread priority support properly 2016-02-07 16:43:46 +09:00
Brian Silverman
273b54715e Use memcpy instead of assuming option values are aligned
Otherwise, it's undefined behavior. ubsan catches alignment issues in
the libzmq test suite without this.
2016-02-06 22:22:51 -05:00
Constantin Rack
ffe4a1c615 Merge pull request #1776 from hintjens/master
Refinement of #f4fe375
2016-02-06 14:26:03 +01:00
Pieter Hintjens
a1f51b695f Problem: unclear rules for passing null arguments
Solution: be more explicit in the code, and in the zmq_recv man
page (which is the most unobvious case). Assert if length is not
zero and buffer is nonetheless null.
2016-02-06 14:13:13 +01:00
Pieter Hintjens
27a8961c37 Problem: resolution of int optval_ was made more verbose
There's no value in this as the same pattern is repeated in several
places and it's fair to expect people to understand it.

Solution: revert to the old, one-liner style.
2016-02-06 14:12:43 +01:00
Pieter Hintjens
c8318912f5 Problem: test case is using internal API
It is poor style for test cases to use the internal API (i.e.
libzmq classes or header files), as this code serves the purpose
of teaching developers how to use the library (it doesn't do this
very well, it's an ambition).

Also, including headers in src/ creates problems when compiling.

Solution: remove use of src/macros.hpp.
2016-02-06 14:12:43 +01:00
Pieter Hintjens
0d7e7bfac0 Problem: MSVC project filters were out of date
Solution: update (with correct one from VS2015)
2016-02-06 14:12:43 +01:00
Pieter Hintjens
39563d70c5 Merge pull request #1775 from CommanderBubble/patch-2
updates for bumped _WIN32_WINNT version with mingw builds
2016-02-06 13:56:45 +01:00
Michael
7270d4de65 windows.hpp needs to be included before zmq.h
windows.hpp must be included first due to increases _WIN32_WINNT version
2016-02-06 23:31:56 +11:00
Pieter Hintjens
a9666d7f0c Merge pull request #1774 from brian-peloton/master
Don't call memcpy with 0 size and NULL pointer(s)
2016-02-06 13:19:31 +01:00
Michael
d06314df84 added windows includes as well as unix includes
added conditional includes for unix / windows
2016-02-06 23:19:10 +11:00
Michael
75bea4bc13 update for mingw's default _WIN32_WINNT
mingw defaults with _WIN32_WINNT as 0x0502 which doesn't define inet_pton(), so add a conditional check
2016-02-06 23:03:12 +11:00
Michael
05b5633b8d update for mingw's default _WIN32_WINNT
mingw defaults with _WIN32_WINNT as 0x0502 which doesn't define inet_pton(), so add a conditional check
2016-02-06 23:01:26 +11:00
Michael
596fd2408a added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage 2016-02-06 22:59:58 +11:00
Michael
b98b1495af added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage 2016-02-06 22:59:13 +11:00
Michael
595181d301 added ZMQ_HAVE_WINDOWS check to _WIN32_WINNT usage 2016-02-06 22:58:38 +11:00
Michael
56efddd182 remove c++11 requirement and -Werror=sign-compare
used static_cast<signed int> around WSA_WAIT_FAILED as it is an unsigned implicitly defined as (0xFFFFFFFF ion winbase.h) and causes a comparison error.

removed use of c++11 style initialiser list for 'sockaddr addr { 0 }' and changed it to 'sockaddr addr = { 0 }'
2016-02-06 22:55:24 +11:00
Michael
988d33bcf8 added windows.hpp with include check
includes windows.hpp if on windows build for mingw build errors from including zmq.h before windows.h
2016-02-06 22:39:53 +11:00
Michael
f472893da1 changed order of includes 2016-02-06 22:37:45 +11:00
Michael
3cdc9218c2 remove include that is already in header 2016-02-06 22:36:37 +11:00
Michael
def0336e9a increase mingw's minimum _WIN32_WINNT version 2016-02-06 22:26:50 +11:00
Brian Silverman
f4fe375bd1 Don't call memcpy with 0 size and NULL pointer(s)
It's undefined behavior, and ubsan flags it.
2016-02-05 14:04:22 -05:00
Joe Eli McIlvain
c9c9a777d6 Merge pull request #1773 from bluca/libsodium_stable
Problem: CI builds libsodium from dev branch
2016-02-04 16:45:27 -08:00
Luca Boccassi
3641f705e1 Problem: CI builds libsodium from dev branch
Solution: checkout stable branch instead.
Several warnings are printed when building from the master branch,
and developers recommend using the stable branch instead.
2016-02-04 23:47:16 +00:00