0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-04 13:05:41 +08:00

80 Commits

Author SHA1 Message Date
Simon Giesecke
12a97bb769 Problem: redundant else after return
Solution: remove else
2018-05-26 09:34:45 +02:00
Simon Giesecke
c581f43c97 Problem: parameter naming style inconsistent
Solution: define and apply parameter naming style: lower_case_
2018-05-26 09:34:44 +02:00
Simon Giesecke
4e616f30dd Problem: C-style casts used
Solution: replace by C++-style casts
2018-05-18 17:04:01 +02:00
Lionel Flandrin
524affc4c3 Problem: UDP address parser uses ad hoc code to detect multicast address
Solution: factor the code into ip_resolver, add IPv6 support and unit tests.
2018-05-04 10:44:01 +02:00
Lionel Flandrin
4cd2c2ebf8 Problem: address parsing code is tied to the TCP code
Solution: Factor the code into a different file with a well defined API and add
unit tests.
2018-05-02 18:06:01 +02:00
Manuel Segura
4726f7262d Pull request to merge porting to WindRiver VxWorks 6.x (#2966)
* Problem: Still need to port over more files to VxWorks 6.x

Solution: Port more files to VxWorks 6.x

* Problem: Need to port over remaining files to VxWorks 6.x. Also remove POSIX thread dependency for VxWorks (because of priority inversion problem in POSIX mutexes with VxWorks 6.x processes)

Solution: Port over remaining files to VxWorks 6.x. Also removed POSIX thread dependency for VxWorks

* Problem: Needed to modify TCP, UDP, TIPC classes with #ifdefs to be compatible with VxWorks 6.x.

Solution:  Modify TCP, UDP, TIPC classes with #ifdefs to be compatible with VxWorks 6.x
2018-03-10 11:03:02 +00:00
sigiesec
41f459e1dc Problem: formatting inconsistent
Solution: applied clang-format
2018-02-02 15:47:43 +01:00
Luca Boccassi
6853e3f935 Merge pull request #2514 from lytboris/freebsd-enable-ai_v4mapped
re-enable AI_V4MAPPED on FreeBSD & DragonFlyBSD
2017-04-09 10:24:50 +01:00
Boris Lytochkin
ef8b0c60fc re-enable AI_V4MAPPED on FreeBSD & DragonFlyBSD
Detect AI_V4MAPPED is not supported in getaddrinfo() on the fly
and retry query. This issue was seen on ancient FreeBSD releases
and current implementation does support this flag correctly.
2017-04-09 11:49:21 +03:00
Boris Lytochkin
2b1bbf1673 fix a typo - assigment was used instead of comparison 2017-04-09 11:37:22 +03:00
Boris Lytochkin
8bc92bde34 choose IP(v6) address based on ipv6_ flag in a correct way 2017-04-08 23:00:23 +03:00
bbdb68
1d58a00992 Problem: no windows UWP support
* add define for windows/UWP

* prevent issue with COM references

* gettickcount not available on uwp

* add compiler definitions

* add convenitnece cmake file

* brute force uwp compilation

* fix compiler version

* cosmetics
2017-04-04 09:50:33 +01:00
pavel.pimenov
4d6fbe17e0 "%" -> '%' 2016-12-10 17:27:42 +03:00
Caleb Epstein
10181d7641 Untabify 2016-11-15 14:33:47 -05:00
Dmitriy-GH
e7b12b3c2a Add WinXP compatibility
#define ZMQ_HAVE_WINDOWS_TARGET_XP  disable uncompatible WinAPI

1. Disable call if_indextoname()
2. Emulate windows Condition Variable API in class condition_variable_t with std::condition_variable
 	
This code can be compiled in MSVC 2015 with option "Platform toolset: Visual Studio 2015 - Windows XP (v140_xp)"
2016-11-02 15:44:27 +05:00
Phillip Mienk
28fbee74c8 Suppress warning on uninitialized variable use by initializing variable. 2016-10-31 12:25:30 -07:00
Juha Reunanen
bb7421dda2 Problem: Does not build in Visual Studio 2013 / Win32
Solution: #include <netioapi.h> and change some IP_ADAPTER_UNICAST_ADDRESS data types
2016-10-21 21:18:45 +03:00
Mário Kašuba
f6962903a7 Implemented network interface name resolution on Windows platform
Added fallback mechanism for specific socket binding on Windows platform with IPv6 enabled
2016-10-10 17:29:53 +02:00
yasirs
36af3edee2 Update tcp_address.cpp 2016-10-09 00:48:35 -04:00
Jim Garlick
d090a871bc Problem: getifaddrs can fail with ECONNREFUSED
getifaddrs() can fail transiently with ECONNREFUSED on Linux.
This has been observed with Linux 3.10 when multiple processes
call zmq::tcp_address_t::resolve_nic_name() simultaneously.

Before asserting in this case, make 10 attempts, with exponential
backoff, given by (1 msec * 2^i), where i is the attempt number.

Fixes #2051
2016-07-20 09:33:33 -07:00
Adam Seering
b1e2b87f0f On systems where getifaddrs() exists but isn't implemented, behave as if 'resolve_nic_name()' were entirely unsupported 2016-05-27 00:02:37 -04:00
Matt Powley
f2018ab317 Fixes for Windows XP compatibility
A Visual Studio build from master (commit id: dac5b45dfb224ff184a7aed39c5859ae5bac3803) using the v140_xp toolset yields a binary that is not XP compatible.

Two libraries contain exports that cannot be found:
 -  IPHLPAPI.DLL : if_nametoindex
 - KERNEL32.DLL : InitializeConditionVariable

The latter export is already dealt with in the file './src/condition_variable.hpp'; however this requires setting the _WIN32_WINNT pre-processor definition.
I am not experienced enough to figure a work around for the 'if_nametoindex' method, so I have created a new pre-processor definition 'ZMQ_HAVE_WINDOWS_TARGET_XP' and removed the calling of the function with the limitation that these builds cannot handle a IPv6 address with an adapter name.

To make it easier for people targeting XP with an MSVC build I have modified the MSBuild property file to add/modify the pre-processor definitions if they are building using a XP targeting tool set; such as v140_xp.
2016-03-31 15:45:00 +01:00
Jim Klimov
e9c8557e92 zeromq-4.1.4/src/tcp_address.cpp : fix relaxed use of sizeof() without parenthesis 2016-03-29 18:43:26 +02:00
Osiris
4a5af9d58b Problem: Precompiled headers not being used
Solution: Phase I - make precompiled.hpp be first file included in every source file
2016-02-18 10:56:52 -06:00
Pieter Hintjens
25ce52e449 Problem: tcp_address.cpp has messy include usage
It's all over the place.

Solution: remove duplicates and try to move main includes to start
of source. Also, include net/if.h always, so that the code will
compile if ZMQ_HAVE_IFADDRS isn't defined.
2016-02-12 11:01:52 +01:00
Constantin Rack
a539b0c6e8 Problem: copyright year is still 2015
Solution: update to 2016
2016-01-28 15:07:31 +01:00
Ilya Kulakov
6c9974770b Family is not set when resolving NIC on android.
Make it ready to enable ipv6 for AIX or HP/UX
2016-01-21 19:53:35 +06:00
Ilya Kulakov
e5894d5197 Fix missing headers which makes compilation fail on Android. 2016-01-21 13:44:01 +06:00
Laszlo Boszormenyi (GCS)
be5ab6d5c9 GNU/Hurd support 2016-01-16 02:26:20 +01:00
Sathish Yenna
7cfa93352e Add missing support for IPv6 link local addresses (which include % followed by the interface name) 2015-12-09 16:26:34 -06:00
Boris Lytochkin
a4baa36ba4 acutally allow specifying interfaces as source address 2015-10-27 00:37:53 +03:00
Joe Eli McIlvain
fb57110b94 Merge pull request #1577 from hintjens/master
Various cleanups for CLIENT-SERVER sockets
2015-09-11 14:24:51 -07:00
Pieter Hintjens
7be6ad0504 Replaced tabs in some files, with spaces 2015-09-11 13:03:31 -04:00
Constantin Rack
bd923f0fbb Problem: some comments contain typos 2015-09-06 18:46:32 +02:00
Markus Pfeiffer
ee984b1fe6 Make DragonFly a first class citizen in terms of compilation 2015-09-03 09:00:12 +01:00
Joe Eli McIlvain
33419425eb Problem: Private/internal macros defined in public header.
Solution: Move the macros to a private header.
2015-08-21 16:12:22 -07:00
reza.ebrahimi
63260d8701 rename ZMQ_UNUSED macro to LIBZMQ_UNUSED 2015-08-22 00:31:25 +04:30
reza.ebrahimi
bff2284a50 place a ZMQ_UNUSED macro and replace all unused variables with ZMQ_UNUSED macro 2015-08-14 15:40:39 +04:30
Kapp Arnaud
8ffd723271 Probably fix build issue on Solaris.
See #1220 recent comments. This change is untested yet seems
safe.
2015-06-13 22:08:14 +02:00
Pieter Hintjens
8620c3e032 Problem: source file headers are somewhat confusing about LGPLv3
Of course people still "can" distributed the sources under the
LGPLv3. However we provide COPYING.LESSER with additional grants.

Solution: specify these grants in the header of each source file.
2015-06-02 22:33:55 +02:00
Pieter Hintjens
94d9a4ffdf Problem: copyright statements are out of date
Solution: update for 2015

Fixes #1320
2015-01-22 10:32:37 +01:00
Martin Hurton
079ff8b759 Code cleanup 2014-07-01 09:17:19 +02:00
Pieter Hintjens
6e91330a0c Added clarifying comment 2014-06-25 14:37:54 +02:00
Pieter Hintjens
58c067ff0e Revert "Problem: tcp_address.cpp allowed [ and ] around address"
This reverts commit 78a7b469a1993b681031f513d0c750c3a8454bb8.
2014-06-25 14:36:55 +02:00
Pieter Hintjens
78a7b469a1 Problem: tcp_address.cpp allowed [ and ] around address
This syntax is undocumented and has no known meaning. It was in libzmq
since 3.x.

Solution: remove this code.
2014-06-24 14:36:21 +02:00
Pieter Hintjens
deaad00ad9 Problem: zmq_connect() does not validate TCP addresses
Since https://github.com/zeromq/libzmq/commit/350a1a, TCP addresses
get resolved asynchronously, so zmq_connect no longer returned an
error on incorrect addresses.

This is troublesome since we rely on some error checking to catch
blatant errors.

Solution add some upfront syntax checking that catches at least the
obvious kinds of errors (invalid characters, wrong or missing port
number).
2014-06-24 14:33:38 +02:00
chrox
bdf6427a00 Fixed build with arm-linux-androideabi toolchain 2014-06-22 18:13:05 +08:00
Martin Hurton
b62d1c7d5f Code cleanup 2014-06-15 19:45:09 +02:00
Martin Hurton
f447386936 Style fixes 2014-06-03 10:42:29 +02:00
Richard Newton
2f08477292 Initialise _has_src_addr variable, fixes hang on Windows. 2014-05-03 13:59:37 +01:00
nikita kozlov
acb6807041 Allow to set up a source address and port for outgoing tcp connections in zmq_connect()
Few examples:
tcp:://192.168.0.4:55555;192.168.0.254:1234
tcp:://192.168.0.4:0;192.168.0.254:1234
tcp:://eth2:55555;192.168.0.254:1234
2014-04-30 14:43:37 +02:00
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
Pieter Hintjens
f0f16505e5 Removed corporate advertisements from source file headers
Copyrights had become ads for Sustrik's corporate sponsors, going against the original
agreement to share copyrights with the community (that agreement was: one line stating
iMatix copyright + one reference to AUTHORS file). The proliferation of corporate ads
is also unfair to the many individual authors. I've removed ALL corporate title from
the source files so the copyright statements can now be centralized in AUTHORS and
source files can be properly updated on an annual basis.
2013-03-12 13:24:57 +01:00
Pieter Hintjens
309740e197 Fixed issue #499 2013-01-31 20:47:45 +01:00
Arthur O'Dwyer
3b984d40e9 Silence all "unused parameter" warnings from Clang.
Compiling without warnings is a good goal, because it makes
new warnings (which probably indicate bugs) stand out rather
than getting lost in the spam.

My fixes fall into two categories:

    - Adding (void) casts of unused parameters, where their
      unusedness seems like a TODO (or in some cases a bug?).

    - Removing parameter names altogether, where the function
      is clearly a stub that will never use its parameters.

Should be no change in behavior.
2012-08-27 16:05:51 -07:00
Arthur O'Dwyer
537a802788 Add a missing null-check, turning a segfault into an assertion.
Static analysis says:
src\tcp_address.cpp(297): error V595: The 'res' pointer was utilized before it was verified against nullptr. Check lines: 297, 301.
src\tcp_address.cpp(603): error V106: Implicit type conversion third argument 'full_bytes' of function 'memcmp' to memsize type.
src\tcp_address.cpp(603): error V526: The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes.

In fact the use of "memcmp" is correct, but the enclosing "if" isn't
necessary, and the compiler is happier if "full_bytes" is a size_t.
2012-08-24 16:38:46 -07:00
Pieter Hintjens
8d64fc6af8 Reverted fix for #393, was already fixed 2012-07-06 17:33:41 +09:00
Pieter Hintjens
9aa8452b80 Fixed issue #393, compilation warnings 2012-07-06 12:23:51 +09:00
Javier Lopez
eb6c668c2a libzmq3.x not compiling on Android crosscompiler
- Android crosscompiler shows a warning about two signed/unsigned checks
  on compilation, this patch adds casts to avoid this, so zmq3.x can
  compile on it.
2012-06-14 12:14:55 -07:00
Martin Hurton
24b79c7e0b Prefer errno_assert/alloc_assert to zmq_assert 2012-05-28 23:17:03 +02:00
Sergey KHripchenko
7b8e728e43 implement zmq_unbind(),zmq_disconnect(), zmq->sock->getsockopt(ZMQ_LAST_ENDPOINT_ID) 2012-04-18 23:42:11 +04:00
Sergey KHripchenko
b89a53ee7a fix bug in zmq::tcp_address_t::resolve_interface() where all resolved interface ip's overwrited by 0.0.0.0 2012-04-18 14:06:39 +04:00
Sergey KHripchenko
c77dc98b5c some spaces cleanups + delete unused anymore zmq::max_sockets + some minor code chages 2012-04-13 13:26:57 +04:00
Sergey KHripchenko
acba6bdd6c Implement ZMQ_TCP_ACCEPT_FILTER setsockopt() for listening TCP sockets.
Assign arbitrary number of filters that will be applied for each new TCP transport
connection on a listening socket.
If no filters applied, then TCP transport allows connections from any ip.
If at least one filter is applied then new connection source ip should be matched.
To clear all filters call zmq_setsockopt(socket, ZMQ_TCP_ACCEPT_FILTER, NULL, 0).
Filter is a null-terminated string with ipv6 or ipv4 CIDR.

For example:
localhost
127.0.0.1
mail.ru/24
::1
::1/128
3ffe:1::
3ffe:1::/56

Returns -1 if the filter couldn't be assigned(format error or ipv6 filter with ZMQ_IPV4ONLY set)

P.S.
The only thing that worries me is that I had to re-enable 'default assign by reference constructor/operator'
for 'tcp_address_t' (and for my inherited class tcp_address_mask_t) to store it in std::vector in 'options_t'...
2012-04-12 18:37:14 +04:00
Martin Hurton
9c46e87588 tcp_address: minor cleanups 2012-03-27 07:44:39 +02:00
Martin Hurton
700e08c3c2 tcp_address: make port number conversion more robust
This still rejects 00 as port number.
2012-03-27 07:44:10 +02:00
Martin Hurton
c428f6aece tcp_address: check address length before manipulating it 2012-03-27 07:37:28 +02:00
Martin Hurton
c2e9997a3c Don't set the AI_V4MAPPED flag on FreeBSD
The problem is that even though the AI_V4MAPPED flag is defined
on FreeBSD, the getaddrinfo function does not support it and
returns EAI_BADFLAGS.

The patch also sets the flag on Windows if it is defined there.
This is true for Windows Vista and later.

Fixes issue #331.
2012-03-26 00:14:17 +02:00
Staffan Gimåker
b9fb48f47b Resolve addresses in the calling thread on connect.
This allows us to actually report an error to the caller on resolve
failure, rather than asserting later on in the io thread.

Signed-off-by: Staffan Gimåker <staffan@spotify.com>
2012-02-16 14:42:55 +01:00
Ian Barber
770f84331f Allowing value 0, and moving code to get_address functions based on feedback 2012-02-11 15:09:03 +00:00
Ian Barber
7b32c9cb51 Adding ZMQ_LAST_ENDPOINT for wildcard support on TCP and IPC sockets 2012-02-08 22:06:46 +00:00
Martin Sustrik
83975c1b21 Missing "defined" tokens added
The missing tokens broke the build if you used -Werror -Wundef

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-15 08:40:46 +01:00
Brett Cameron
de1d32daae Fix getaddrinfo calls to work on OpenVMS
Signed-off by: Brett Cameron <Brett.Cameron@hp.com>
2011-11-04 14:15:06 +01:00
Martin Sustrik
8e21d64c97 Copyright dates adjusted to reflect reality
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-01 18:06:11 +01:00
Martin Sustrik
ac7717b7b3 250bpm copyrights added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31 16:20:30 +01:00
Martin Sustrik
193fa1c079 Accept square brackets around IPv6 address
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-03 10:19:08 +02:00
Martin Sustrik
8b7ac4c2a9 Close file descriptors on exec (issue 218)
When exec is executed to start a different process image old
0MQ file descriptors could stay open, thus blocking TCP ports
and alike. This patch should solve the problem.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-02 15:34:12 +02:00
Martin Sustrik
80a5f60e33 NIC name resolution moved to tcp_address_t
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-19 12:34:31 +02:00
Martin Sustrik
898ee99dc1 Windows build fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-18 17:58:46 +02:00
Martin Sustrik
b6ecb00d23 TCP address related functionality moved to tcp_address_t
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-18 17:40:42 +02:00