Commit Graph

128 Commits

Author SHA1 Message Date
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
jdc8
177264d941 c++ style comments result in compile errors with non-c99 C compiler 2012-04-10 06:33:15 -04:00
Sergey KHripchenko
0c3d917926 initial implementation of tuning TCP keep-alives for TCP socket
currently not fully cross-platform
work on linux
possibly work in *bsd
and could be enhanced to work on windows
2012-04-05 19:39:53 +04:00
Pieter Hintjens
d8c58080a7 Fixed issue #351 2012-04-04 14:39:19 +01:00
Pieter Hintjens
f26e4ab784 Simplified zmq_msg_get/set functions
* Return integer property
* Fixed up man pages, which were inaccurate
* Fixed test case
2012-03-21 14:19:40 -05:00
Pieter Hintjens
6e71a54b1e Fixed issues #337, #341, and #340
* Implemented new ctx API (_new, _destroy, _get, _set)
* Removed 'typesafe' macros from zmq.h
* Added support for MAX_SOCKETS (was tied into change for #337)
* Created new man pages
2012-03-19 19:41:20 -05:00
Pieter Hintjens
9ac40c47d7 Fixed issue LIBZMQ-333
- reverted commit 941be8d217.
 - fixed zmq_device implementation for latest socket_base class
 - added back zmq_device.3 man page
2012-03-16 16:39:11 -05:00
Kobolog
cb70c5e75d fixed some typos 2012-03-15 15:15:44 +03:00
Kobolog
df584a3be0 an option to fail on unroutable messages in ROUTER sockets 2012-03-15 14:57:38 +03:00
boris@boressoft.ru
318ba8836f Add WinCE support.
* Added two new files: errno.hpp and errno.cpp. They are required to use errno functionality on WM.
* zmq.cpp, msg.h: removed inclusion of errno.h because it is included in zmq.h that is also included by .cpp.
* windows.hpp: process.h is included only for desktop builds.
* thread.cpp: on CE CreateThread is used instead of __beginthreadex
* socket_base.cpp, clock.cpp: on CE include cmnintrin.h instead on intrin.h
* signaler.cpp: on Windows should use special macro around event name (for unicode builds)
* err.hpp: make it include errno.hpp (my file) instead on errno.h when building for CE
* err.cpp: use FormatMessage when building for CE (because CE does not have ANSI API functions)
* zmq.h: do not include errno.h whe building for CE
* libzmq.vcproj: add tro new files
2012-03-14 19:12:28 +04:00
skaller
0fa6b8e793 Remove thread safe context init. 2012-02-18 02:32:15 +11:00
Mikko Koppanen
da1920d944 Revert NULL checks in the API 2012-02-17 09:48:04 +00:00
Chuck Remes
a457be315b Merge pull request #246 from pieterh/arguments
Return EFAULT if required arguments are null
2012-02-16 13:20:33 -08:00
Pieter Hintjens
3ee99ae81f Renamed scatter/gather methods, cleaned up source 2012-02-16 12:30:37 -06:00
Pieter Hintjens
8a497e2ffc Resolved conflicts after merge 2012-02-16 12:27:39 -06:00
Pieter Hintjens
0efb49f12f Fixed up all references to zmq_msg_size 2012-02-16 12:26:00 -06:00
Pieter Hintjens
02b81d42ce Changed return type of zmq_msg_size to ssize_t to allow error return 2012-02-16 12:25:58 -06:00
Pieter Hintjens
07b49ffb9c Fixed up all references to zmq_msg_size 2012-02-16 12:04:25 -06:00
Mikko Koppanen
2f44faa7ce Merge pull request #247 from pieterh/sendrecv
Added zmq_msg_send/recv functions
2012-02-16 08:58:03 -08:00
Pieter Hintjens
d092f2615c Renamed peek/poke to get/set 2012-02-15 19:28:29 -06:00
Pieter Hintjens
dcc1725a90 Renamed zmq_getmsgopt to zmq_msg_peek
* Added zmq_msg_poke for orthogonality
* Added zmq_msg_more for simplicity
* Fixed up man pages and test program
2012-02-15 18:44:28 -06:00
Pieter Hintjens
fb4748f257 Added zmq_msg_send/recv functions 2012-02-15 15:37:35 -06:00
Pieter Hintjens
6b2ec366b1 Changed return type of zmq_msg_size to ssize_t to allow error return 2012-02-15 15:17:01 -06:00
Pieter Hintjens
0c4a19c408 Deprecated XREQ/XREP 2012-02-15 10:48:31 -06:00
Ian Barber
b6c97230ed Merge branch 'master' of https://github.com/zeromq/libzmq 2012-02-14 23:10:15 +00:00
Ian Barber
b5d3373905 Moving to std::string in options 2012-02-14 23:10:06 +00:00
skaller
4807935605 Implement type safe sockets and contexts. 2012-02-12 10:15:51 +11:00
Ian Barber
91bf4944da Merge branch 'master' of https://github.com/zeromq/libzmq 2012-02-11 15:08:23 +00:00
Ian Barber
7fa14f3823 Merge branch 'master' of https://github.com/zeromq/libzmq 2012-02-08 22:06:50 +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
skaller
c3f7543ebe Fix uio support.
We have to use an incomplete type in the interface.
The definition of iovec is only in the implementation.
This appears to following existing practice in 0MQ.
It seems a bit flakey that zmq.h is not included in zmq.cpp,
which is normal practice to ensure the implementation matches
the specified interface. YMMV. I follow 0MQ style.
2012-02-08 13:15:47 +11:00
skaller
970a005399 Provide interface.
Also move iovec definition from implementation to interface.
Not clear to me at present if an incomplete type should
be used to avoid gratuitously including <sys/uio.h> in
the interface. The interface can't be used with this include.
2012-02-08 12:58:35 +11:00
skaller
520ad3c2d7 Set and arrange propagation of thread safe sockets flag.
We use a distinct context initialisation function to specify
all sockets derived therefrom will be thread safe.

However the inheritance is done exclusively in the C interface.
This is not really correct, but it is chosen to minimise
interference with the existing C++ code, including any
construct or other calls within the C++ code base.
Semantically the C++ code should be unchanged,
physically some data structures and extra methods are
provided by they're only used from the C binding.
2012-02-04 02:17:35 +11:00
Martin Sustrik
6f32361fea Version bumped to 3.1.1
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-12-19 15:43:38 +01:00
Chuck Remes
93529d8c5d Add zmq_getmsgopt to the API
The new function allows to retrieve options (flags)
from zmq_msg_t.

Signed-off-by: Chuck Remes <cremes@mac.com>
Renamed from zmq_msg_flags to zmq_getmsgopt
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-06 14:03:51 +01:00
Martin Sustrik
fe81827bd0 Version changed to 3.1.0
This version downgrade is done because of the previous refatoring.
It removed all the new features and reintroduced some of the old
ones (identities). Thus, it made trunk much closer to existing 3.0
branch than it used to be.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-05 10:18:38 +01:00
Martin Sustrik
21a0b49834 Obsolete ECANTROUTE errror code removed
This error code was used only by new-style ROUTER socket
which is not a part of the codebase.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-05 10:10:44 +01:00
Martin Sustrik
d20ea25b8c ZMQ_IDENTITY option re-introduced
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-02 14:33:58 +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
7842c71073 LABELS and COMMANDs removed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-01 13:39:54 +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
9227c38933 ROUTER and DEALER are aliases for XREP and XREQ
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31 15:51:11 +01:00
Martin Sustrik
dee8b2360a New style ROUTER socket removed.
Signed-off-by: Martin Sustrik <sustrik@turist.(none)>
2011-10-31 15:44:42 +01:00
Martin Sustrik
940c5b346b zmq_msg_t changed to structure
zmq_msg_t being defined as unsigned char[32] could not be stored
in STL containers. Fixed by this commit.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-31 15:23:00 +02:00
Martin Sustrik
714d3b288f EAFNOSUPPORT defined on Windows platform
Windows headers don't defined this error.
This patch defines it if not already defined.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-15 20:39:48 +02:00
Steven McCoy
784041f5b9 ZMQ_IPV4ONLY option added
At this point option exists, is documented and can be set,
however, it has no effect.

Signed-off-by: Steven McCoy <steven.mccoy@miru.hk>
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-08 12:10:31 +02:00
Martin Sustrik
a1e09facb2 ROUTER socket reports error when message cannot be routed
Till now, message was silently dropped if it was sent to
a non-existent peer. Now, ECANTROUTE error is returned.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-21 18:54:27 +02:00
Martin Sustrik
72a793f78a ZMQ_GENERIC renamed to ZMQ_ROUTER
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-21 18:43:50 +02:00
Martin Sustrik
bf78e230ad GENERIC socket type and COMMAND flag added
GENERIC allows to use 0MQ as a dumb networking framework.
It provides user with connect/disconnect notifications.
Also, each inbound message is labeled by ID of the connection
it originated from. Outbound messages should be labeled by
the ID of the connection to send them to.

To distinguish connect/disconnect notifications from common
messages, COMMAND flag was introduced.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-17 23:31:29 +02:00
Martin Sustrik
c8e8f2a24c ZMQ_IDENTITY socket option removed
This patch simplifies the whole codebase significantly,
including dropping depedency on libuuid.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-15 11:24:33 +02:00