From ac7717b7b35f441fc3aeeb1528e63f147c00913a Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Mon, 31 Oct 2011 16:20:30 +0100 Subject: 250bpm copyrights added Signed-off-by: Martin Sustrik --- src/options.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/options.cpp') diff --git a/src/options.cpp b/src/options.cpp index 8a3e527..b2f07c5 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1,4 +1,5 @@ /* + Copyright (c) 2009-2011 250bpm s.r.o. Copyright (c) 2007-2011 iMatix Corporation Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file -- cgit v1.2.3 From 8e21d64c974344b5b2b83cac85d12c51392fe74b Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 1 Nov 2011 18:06:11 +0100 Subject: Copyright dates adjusted to reflect reality Signed-off-by: Martin Sustrik --- src/options.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/options.cpp') diff --git a/src/options.cpp b/src/options.cpp index b2f07c5..ddf2965 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1,6 +1,6 @@ /* Copyright (c) 2009-2011 250bpm s.r.o. - Copyright (c) 2007-2011 iMatix Corporation + Copyright (c) 2007-2009 iMatix Corporation Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file This file is part of 0MQ. -- cgit v1.2.3 From d20ea25b8c63e148fe48cc2b85bac9c896f1073b Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 2 Nov 2011 14:33:58 +0100 Subject: ZMQ_IDENTITY option re-introduced Signed-off-by: Martin Sustrik --- src/options.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/options.cpp') diff --git a/src/options.cpp b/src/options.cpp index ddf2965..aa94a21 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1,6 +1,7 @@ /* Copyright (c) 2009-2011 250bpm s.r.o. Copyright (c) 2007-2009 iMatix Corporation + Copyright (c) 2011 VMware, Inc. Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file This file is part of 0MQ. @@ -28,6 +29,7 @@ zmq::options_t::options_t () : sndhwm (1000), rcvhwm (1000), affinity (0), + identity_size (0), rate (100), recovery_ivl (10000), multicast_hops (1), @@ -77,6 +79,20 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, affinity = *((uint64_t*) optval_); return 0; + case ZMQ_IDENTITY: + + // Empty identity is invalid as well as identity longer than + // 255 bytes. Identity starting with binary zero is invalid + // as these are used for auto-generated identities. + if (optvallen_ < 1 || optvallen_ > 255 || + *((const unsigned char*) optval_) == 0) { + errno = EINVAL; + return -1; + } + identity_size = optvallen_; + memcpy (identity, optval_, identity_size); + return 0; + case ZMQ_RATE: if (optvallen_ != sizeof (int) || *((int*) optval_) <= 0) { errno = EINVAL; @@ -233,6 +249,15 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) *optvallen_ = sizeof (uint64_t); return 0; + case ZMQ_IDENTITY: + if (*optvallen_ < identity_size) { + errno = EINVAL; + return -1; + } + memcpy (optval_, identity, identity_size); + *optvallen_ = identity_size; + return 0; + case ZMQ_RATE: if (*optvallen_ < sizeof (int)) { errno = EINVAL; -- cgit v1.2.3 From a4843b65d24f9caa188bb2454b28080f0cee8484 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Fri, 4 Nov 2011 08:00:47 +0100 Subject: Identities re-introduced However, the "durable socket" behaviour wasn't re-added. Identities are used solely for routing in REQ/REP pattern. Signed-off-by: Martin Sustrik --- src/options.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/options.cpp') diff --git a/src/options.cpp b/src/options.cpp index aa94a21..4db1a6c 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -46,7 +46,9 @@ zmq::options_t::options_t () : ipv4only (1), delay_on_close (true), delay_on_disconnect (true), - filter (false) + filter (false), + send_identity (false), + recv_identity (false) { } -- cgit v1.2.3