zeromq/czmq — pull request #336 by brianknox (2013-12-09 13:12:34+00:00)
Title: zproxy backwards compatibility refactor

This pull request contains some fairly significant changes to zproxy. The zproxy_bind function signature and some accessor methods now change based on what version of libzmq czmq is built against.

I have tested forwards compatibility of the unit tests against a dynamically linked libzmq from 2.2 to current head.

Swapping out the underlying libzmq for an *older* version will cause breakage - but as discussed on the mailing list, this is the case for much of czmq, and I see no real use case for backwards dynamic lib compatibility.

From the discuss section of zproxy:
----------------------------------------------------

I've modified zproxy to "do the right thing" depending
on both the underlying version of libzmq and arguments passed
to zproxy_bind. While this introduces quite a
bit of complexity in this czmq class, the hope is that it
reduces a lot of complexity on behalf of the actual czmq user.

Note that because the zproxy_bind function signature changes
based on version of libzmq compiled against, swapping out the
underlying libzmq for an older version than compiled against
will cause code to fail. This is intended behavior.

I have tested swapping out the underlying libzmq for newer
versions than compiled against, and this works.

The behavior for various cases is as follows:

------------------------------------------
ZMQ_VERSION >= ZPROXY_HAS_STEERABLE

int
zproxy_bind (zproxy_t *self, char *frontend_addr,
char *backend_addr, char *capture_addr,
char *control_addr);

capture? | control? | should call
YES | YES | zmq_proxy_steerable
NO | YES | zmq_proxy_steerable
YES | NO | zmq_proxy
NO | NO | zmq_proxy

------------------------------------------
ZMQ_VERSION >= ZPROXY_HAS_PROXY &&
ZMQ_VERSION < ZPROXY_HAS_STEERABLE

int
zproxy_bind (zproxy_t *self, char *frontend_addr,
char *backend_addr, char *capture_addr);

capture? | should call
YES | zmq_proxy
NO | zmq_proxy

------------------------------------------
ZMQ_VERSION < ZPROXY_HAS_PROXY

int
zproxy_bind (zproxy_t *self, char *frontend_addr,
char *backend_addr);

should call
zmq_proxy