Commit Graph

165 Commits

Author SHA1 Message Date
Jeremy Rossi
19ca8a0fc0 Add the Socket Identity info to the ZAP Messages
This change adds the socket identity infomartion from the socket to the
zap frames.  In doing this the ZAP is able preform different operations
based on different sockets.  This is not compaitable with the current ZAP
RFC, but that can be updated.  As the ZAP rfc is currently draft for I
did not change the version number.

Tests also modified and passing.
2013-08-20 13:48:05 -04:00
Pieter Hintjens
1011e8ad20 Merge pull request #624 from ricnewton/master
Port tests to windows and add to cmake build.
2013-08-18 00:51:39 -07:00
Uli Köhler
10becae7eb Added zmq_send_const test 2013-08-17 20:37:07 +02:00
Richard Newton
a83baa9b0b Fix up threading code from port tests to windows. 2013-08-17 14:23:22 +01:00
Richard Newton
7f74fc7c99 Port tests to windows and add to cmake build. 2013-08-17 13:43:45 +01:00
Christian Kamm
423ca36b17 Rename ZMQ_REQ_SEND_RESETS -> ZMQ_REQ_STRICT.
It defaults to enabled. Switch it off to be able to send a new message
before the previous reply has been received.
2013-08-03 14:35:18 +02:00
Christian Kamm
a0cc87a9d9 Add ZMQ_REQ_SEND_RESETS option.
This allows making a new request on a REQ socket by sending a new
message. Without the option set, calling send() after the first message
is done will continue to return an EFSM error.

It's useful for when a REQ is not getting a response. Previously that
meant creating a new socket or switching to DEALER.
2013-07-28 11:43:38 +02:00
Christian Kamm
b9646f2aac Add ZMQ_REQ_REQUEST_IDS option.
* Documentation:
The default behavior of REQ sockets is to rely on the ordering of messages
to match requests and responses and that is usually sufficient. When this option
is set to 1, the REQ socket will prefix outgoing messages with an extra frame
containing a request id. That means the full message is (request id, 0,
user frames...). The REQ socket will discard all incoming messages that don't
begin with these two frames.

* Behavior change: When a REQ socket gets an invalid reply, it used to
  discard the message and return EAGAIN. REQ sockets still discard
  invalid messages, but keep looking at the next one automatically
  until a good one is found or there are no more messages.
* Add test_req_request_ids.
2013-07-26 21:38:21 +02:00
Martin Hurton
53bc53da04 Update PLAIN mechanism to the latest ZAP revision 2013-07-18 10:59:34 +02:00
Martin Hurton
d65231be1c Update CURVE mechanism to the latest ZAP revision 2013-07-18 10:59:31 +02:00
Pieter Hintjens
d46c2ee2fc Disabled last step in test_spec_req so build can complete 2013-07-14 13:04:31 +02:00
Christian Kamm
7de23c0c8d Fix intermittent failure in test_spec_req.
There still is a problem when a stale peer's message
arrives at the REQ just after a request was sent to that peer.
2013-07-14 11:57:15 +02:00
Pieter Hintjens
bccf3d6126 Merge pull request #613 from ckamm/coding-style-spec-tests
Fix coding style in spec tests.
2013-07-14 02:32:20 -07:00
Christian Kamm
bbc9a61197 Fix coding style in spec tests. 2013-07-14 08:33:33 +02:00
Christian Kamm
c56d797bf9 REQ sockets drop replies from unasked peers.
* Add lb_t::sendpipe() that returns the pipe that was used for sending,
  similar to fq_t::recvpipe().
* Add forwarder functions to dealer_t to access these two.
* Add logic to req_t to ignore replies on pipes that are not the one
  where the request was sent.
* Enable test in test_spec_req.
2013-07-14 07:55:47 +02:00
Pieter Hintjens
9ca6898f24 Got new test cases working with libzmq
* disabled the specific tests that do not work (yet) on libzmq
* cleaned up one source (test_spec_rep.c) but the others need similar work
* added sleep in test_spec_rep to allow connects time to happen; this would
  not be needed if we connected out to the REP peers instead in from them,
  but I didn't want to change the logic of the test code.
2013-07-07 12:49:24 +02:00
Christian Kamm
dfba19c4b6 Make pipeline/reqrep tests try tcp:// endpoints.
The inproc:// endpoints sometimes use different code paths so
testing with regular tcp:// endpoints as well can show different
issues.
2013-07-05 17:58:01 +02:00
Christian Kamm
8fd163cf5c Add tests for PUSH/PULL sockets. 2013-07-05 15:20:42 +02:00
Christian Kamm
798b394087 Add tests for Request-Reply pattern sockets.
* See http://rfc.zeromq.org/spec:28/REQREP
* Not all testable statements are covered.
* At this point, there are several failures:
  - test_spec_req: The REQ socket does not correctly discard messages
    from peers that are not currently being talked to.
  - test_spec_dealer/router: On disconnect, the queues seem to not be
    emptied. The DEALER can still receive a message the disconnected
    peer sent, the ROUTER can still send to the identity of the dis-
    connected peer.
2013-07-02 15:04:31 +02:00
Richard Newton
998610602e Fix tab/space formatting issue 2013-07-01 12:10:57 +01:00
Richard Newton
f6e972d546 Fix montior tests to handle the monitor stopped event correctly 2013-07-01 10:31:57 +00:00
Martin Hurton
783bb890a9 Check socket types during mechanism handshake 2013-07-01 10:12:08 +02:00
Pieter Hintjens
7041770108 Added Z85 support
The use of binary for CURVE keys is painful; you cannot easily copy
these in e.g. email, or use them directly in source code. There are
various encoding possibilities. Base16 and Base64 are not optimal.
Ascii85 is not safe for source (it generates quotes and escapes).

So, I've designed a new Base85 encoding, Z85, which is safe to use
in code and elsewhere, and I've modified libzmq to use this where
it also uses binary keys (in get/setsockopt).

Very simply, if you use a 32-byte value, it's Base256 (binary),
and if you use a 40-byte value, it's Base85 (Z85).

I've put the Z85 codec into z85_codec.hpp, it's not elegant C++
but it is minimal and it works. Feel free to rewrap as a real class
if this annoys you.
2013-06-28 22:10:22 +02:00
Pieter Hintjens
7832addd20 Updated security mechanisms to use variable-length commands
RFC23, RFC24, RFC26 now use variable-length command names that
end in null octet (valid C strings) instead of fixed-length
space padded strings.
2013-06-28 11:42:54 +02:00
Pieter Hintjens
ad77937956 Added ZMQ_STREAM socket type
- designed for TCP clients and servers
- added HTTP client / server example in tests/test_stream.cpp
- same as ZMQ_ROUTER + ZMQ_ROUTER_RAW + ZMQ_ROUTER_MANDATORY
- includes b893ce set ZMQ_IDENTITY on outgoing connect
- deprecates ZMQ_ROUTER_RAW
2013-06-27 20:53:15 +02:00
Ian Barber
211bf2b08e Added security curve test
Test is skipped if no libsodium.
Added warning if libsodium not configured
2013-06-22 16:17:25 +01:00
Pieter Hintjens
fadfcac1de Fixed compile error, needed unistd.h 2013-06-22 13:50:22 +02:00
Pieter Hintjens
675bd4640b Merge pull request #584 from hurtonm/master
Fix test_disconnect_inproc to work on ILP64 systems
2013-06-22 04:18:27 -07:00
Martin Hurton
1b86324396 Fix test_disconnect_inproc to work on ILP64 systems 2013-06-22 13:05:46 +02:00
Ian Barber
f4c51db842 Fix small streamengine issue w/ term and handshake
Also tidy up monitor test a little.
2013-06-22 10:58:16 +01:00
shripchenko
627190c8be another iteration on ZMQ_PROBE_ROUTER
now it properly works for ROUTER
2013-06-10 02:31:00 -07:00
Pieter Hintjens
6ff51ee909 Updated ZAP request for changed protocol draft
- username and password sent as two string frames
- fixed test case to match
2013-06-07 15:50:36 +02:00
Martin Hurton
2928c91a6d Implement ZAP and integrate it with PLAIN mechanism 2013-06-06 13:28:21 +02:00
Pieter Hintjens
a9679da764 Packaging on ZMQ_PROBE_ROUTER
- renamed to ZMQ_PROBE_ROUTER
2013-06-05 15:55:15 +02:00
Pieter Hintjens
2344131db3 Packaging of ZMQ_PROBE
- Cleaned up man page a little
- Wrote test case tests/test_router_probe.cpp
2013-06-05 15:29:40 +02:00
Pieter Hintjens
c7c865da75 Whitespace fixes 2013-05-21 18:52:44 +02:00
Pieter Hintjens
f06abca046 Disable failing test for now 2013-05-17 17:26:54 +01:00
Pieter Hintjens
f909b9c722 plain_mechanism now uses options.as_server
- we need to switch to PLAIN according to options.mechanism
- we need to catch case when both peers are as-server (or neither is)
- and to use username/password from options, for client
2013-05-17 17:21:59 +01:00
Pieter Hintjens
da1e9a178a Cleaned up test pingpong code 2013-05-17 17:20:33 +01:00
Pieter Hintjens
e1f797b048 Added configuration for PLAIN security
* ZMQ_PLAIN_SERVER, ZMQ_PLAIN_USERNAME, ZMQ_PLAIN_PASSWORD options
* Man page changes to zmq_setsockopt and zmq_getsockopt
* Man pages for ZMQ_NULL, ZMQ_PLAIN, and ZMQ_CURVE
* Test program test_security
2013-05-15 17:55:21 +02:00
Martin Hurton
a7032e9ca8 Update test_raw_sock to work with ZMTP/3.0 2013-04-28 14:13:40 +02:00
Pieter Hintjens
cb2ee7a5c2 Fixed up test_iov case 2013-04-27 14:53:14 +02:00
Jon Dyte
56ead84490 Experimental function zmq_recviov doesnt work correctly in a couple of cases
1) VSM - you cannot hand out the 'data' address as it was not allocated on the heap
2) for other messages the 'data' address cannot be handed out either, as it not the address
originally returned by malloc and hence cannot be passed to 'free'.
see msg.cpp
u.lmsg.content = (content_t*) malloc (sizeof (content_t) + size_);
....
u.lmsg.content->data = u.lmsg.content + 1;

So the function is changed to always malloc a data buffer and copy the data into it.
There is a possible optimisation using memmove for the non-VSM case but that is not done yet.
2013-04-25 21:58:26 +01:00
Pieter Hintjens
257debf659 Removed IPC endpoint from test; not portable, and fragile (#80) 2013-03-24 15:12:34 +01:00
Pieter Hintjens
f1738b9b92 More copyright cleanups 2013-03-12 17:04:51 +01:00
Pieter Hintjens
d826c53b9b Bumped ZMTP revision to 2
* Starting draft ZMTP/2.1 protocol (revision 2)
* Basis for adding security to the wire protocol
* Maintains backward compatibility
2013-03-12 15:49:23 +01:00
Pieter Hintjens
785ef41f67 Refactored codecs to match ZMTP version numbers 2013-03-12 15:29:37 +01:00
Guido Goldstein
b0b8ab27c5 Changed message structure for event notifications. 2013-03-08 13:48:18 +01:00
Guido Goldstein
21eeb03b6c Simplified the zmq_event_t structure for easier access and better usability towards language bindings. 2013-03-08 10:34:25 +01:00
Pieter Hintjens
51cfcb117a Some DNSs will resolve ANY domain name so I made more reliable errors. 2013-02-10 08:39:27 +01:00