mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-04 07:27:26 +01:00
Merge branch 'master' of https://github.com/zeromq/libzmq into inproc_connect_before_bind
This commit is contained in:
commit
d5bd68b60b
@ -542,11 +542,13 @@ ZMQ_CURVE_PUBLICKEY: Retrieve current CURVE public key
|
||||
|
||||
Retrieves the current long term public key for the socket. You can
|
||||
provide either a 32 byte buffer, to retrieve the binary key value, or
|
||||
a 40 byte buffer, to retrieve the key in a printable Z85 format.
|
||||
a 41 byte buffer, to retrieve the key in a printable Z85 format.
|
||||
NOTE: to fetch a printable key, the buffer must be 41 bytes large
|
||||
to hold the 40-char key value and one null byte.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: binary data or Z85 text string
|
||||
Option value size:: 32 or 40
|
||||
Option value size:: 32 or 41
|
||||
Default value:: null
|
||||
Applicable socket types:: all, when using TCP transport
|
||||
|
||||
@ -556,11 +558,11 @@ ZMQ_CURVE_SECRETKEY: Retrieve current CURVE secret key
|
||||
|
||||
Retrieves the current long term secret key for the socket. You can
|
||||
provide either a 32 byte buffer, to retrieve the binary key value, or
|
||||
a 40 byte buffer, to retrieve the key in a printable Z85 format.
|
||||
a 41 byte buffer, to retrieve the key in a printable Z85 format.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: binary data or Z85 text string
|
||||
Option value size:: 32 or 40
|
||||
Option value size:: 32 or 41
|
||||
Default value:: null
|
||||
Applicable socket types:: all, when using TCP transport
|
||||
|
||||
@ -574,7 +576,7 @@ a 40 byte buffer, to retrieve the key in a printable Z85 format.
|
||||
|
||||
[horizontal]
|
||||
Option value type:: binary data or Z85 text string
|
||||
Option value size:: 32 or 40
|
||||
Option value size:: 32 or 41
|
||||
Default value:: null
|
||||
Applicable socket types:: all, when using TCP transport
|
||||
|
||||
|
@ -590,7 +590,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
if (*optvallen_ == CURVE_KEYSIZE_Z85) {
|
||||
if (*optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
|
||||
Z85_encode ((char *) optval_, curve_public_key, CURVE_KEYSIZE);
|
||||
return 0;
|
||||
}
|
||||
@ -602,7 +602,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
if (*optvallen_ == CURVE_KEYSIZE_Z85) {
|
||||
if (*optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
|
||||
Z85_encode ((char *) optval_, curve_secret_key, CURVE_KEYSIZE);
|
||||
return 0;
|
||||
}
|
||||
@ -614,7 +614,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
if (*optvallen_ == CURVE_KEYSIZE_Z85) {
|
||||
if (*optvallen_ == CURVE_KEYSIZE_Z85 + 1) {
|
||||
Z85_encode ((char *) optval_, curve_server_key, CURVE_KEYSIZE);
|
||||
return 0;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace zmq
|
||||
unsigned char identity_size;
|
||||
unsigned char identity [256];
|
||||
|
||||
// Maximum tranfer rate [kb/s]. Default 100kb/s.
|
||||
// Maximum transfer rate [kb/s]. Default 100kb/s.
|
||||
int rate;
|
||||
|
||||
// Reliability time interval [ms]. Default 10 seconds.
|
||||
|
@ -48,7 +48,8 @@ static uint8_t decoder [96] = {
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Encode a binary frame as a string; destination string MUST be at least
|
||||
// size * 5 / 4 bytes long. Returns dest. Size must be a multiple of 4.
|
||||
// size * 5 / 4 bytes long plus 1 byte for the null terminator. Returns
|
||||
// dest. Size must be a multiple of 4.
|
||||
|
||||
char *
|
||||
Z85_encode (char *dest, uint8_t *data, size_t size)
|
||||
|
@ -50,6 +50,8 @@ bounce (void *server, void *client)
|
||||
char buffer [32];
|
||||
rc = zmq_recv (server, buffer, 32, 0);
|
||||
assert (rc == 32);
|
||||
// Check that message is still the same
|
||||
assert (memcmp (buffer, content, 32) == 0);
|
||||
int rcvmore;
|
||||
size_t sz = sizeof (rcvmore);
|
||||
rc = zmq_getsockopt (server, ZMQ_RCVMORE, &rcvmore, &sz);
|
||||
@ -57,6 +59,8 @@ bounce (void *server, void *client)
|
||||
assert (rcvmore);
|
||||
rc = zmq_recv (server, buffer, 32, 0);
|
||||
assert (rc == 32);
|
||||
// Check that message is still the same
|
||||
assert (memcmp (buffer, content, 32) == 0);
|
||||
rc = zmq_getsockopt (server, ZMQ_RCVMORE, &rcvmore, &sz);
|
||||
assert (rc == 0);
|
||||
assert (!rcvmore);
|
||||
@ -70,17 +74,18 @@ bounce (void *server, void *client)
|
||||
// Receive the two parts at the client side
|
||||
rc = zmq_recv (client, buffer, 32, 0);
|
||||
assert (rc == 32);
|
||||
// Check that message is still the same
|
||||
assert (memcmp (buffer, content, 32) == 0);
|
||||
rc = zmq_getsockopt (client, ZMQ_RCVMORE, &rcvmore, &sz);
|
||||
assert (rc == 0);
|
||||
assert (rcvmore);
|
||||
rc = zmq_recv (client, buffer, 32, 0);
|
||||
assert (rc == 32);
|
||||
// Check that message is still the same
|
||||
assert (memcmp (buffer, content, 32) == 0);
|
||||
rc = zmq_getsockopt (client, ZMQ_RCVMORE, &rcvmore, &sz);
|
||||
assert (rc == 0);
|
||||
assert (!rcvmore);
|
||||
|
||||
// Check that message is still the same
|
||||
assert (memcmp (buffer, content, 32) == 0);
|
||||
}
|
||||
|
||||
// Same as bounce, but expect messages to never arrive
|
||||
|
@ -1 +1,11 @@
|
||||
EXTRA_DIST = curve_keygen.c z85_codec.h
|
||||
|
||||
INCLUDES = -I$(top_builddir)/include \
|
||||
-I$(top_srcdir)/include
|
||||
# INCLUDES = -I$(top_srcdir)/include
|
||||
|
||||
bin_PROGRAMS = curve_keygen
|
||||
|
||||
curve_keygen_LDADD = $(top_builddir)/src/libzmq.la
|
||||
curve_keygen_SOURCES = curve_keygen.c
|
||||
|
||||
|
@ -50,7 +50,8 @@ static uint8_t decoder [96] = {
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Encode a binary frame as a string; destination string MUST be at least
|
||||
// size * 5 / 4 bytes long. Returns dest. Size must be a multiple of 4.
|
||||
// size * 5 / 4 bytes long plus 1 byte for the null terminator. Returns
|
||||
// dest. Size must be a multiple of 4.
|
||||
|
||||
char *
|
||||
Z85_encode (char *dest, uint8_t *data, size_t size)
|
||||
|
Loading…
x
Reference in New Issue
Block a user