diff options
author | Martin Lucina <martin@lucina.net> | 2012-04-27 14:18:08 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-04-29 09:02:14 +0200 |
commit | 512f3a604924fec9d89e2b4bfd6f73aa66309fa7 (patch) | |
tree | 563b8ec0bb0babc8093f39d2ed52d2ae308335ba /src/options.cpp | |
parent | a84a77a4861c8fc1b0b6d3ec0931e83395cb34b5 (diff) |
Implement protocol versioning (except PGM)
Implements SP protocol versioning, legacy protocol support, and the
following pattern protocol versions:
PAIR: v2
PUBSUB: v1 (legacy), v3
REQREP: v1
PIPELINE: v2
SURVEY: v1
Engine support is only for stream_engine_t at this stage.
Signed-off-by: Martin Lucina <martin@lucina.net>
Diffstat (limited to 'src/options.cpp')
-rw-r--r-- | src/options.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/options.cpp b/src/options.cpp index f7bbdc4..d362c18 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -48,7 +48,11 @@ xs::options_t::options_t () : sndtimeo (-1), ipv4only (1), keepalive (0), - protocol (0), + legacy_protocol (false), + sp_pattern (-1), + sp_version (-1), + sp_role (-1), + sp_complement (-1), filter (XS_FILTER_PREFIX), survey_timeout (-1), delay_on_close (true), @@ -236,21 +240,6 @@ int xs::options_t::setsockopt (int option_, const void *optval_, return 0; } - case XS_PROTOCOL: - { - if (optvallen_ != sizeof (int)) { - errno = EINVAL; - return -1; - } - int val = *((int*) optval_); - if (val < 0) { - errno = EINVAL; - return -1; - } - protocol = val; - return 0; - } - case XS_FILTER: if (optvallen_ != sizeof (int)) { errno = EINVAL; @@ -457,7 +446,7 @@ int xs::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) errno = EINVAL; return -1; } - *((int*) optval_) = protocol; + *((int*) optval_) = sp_version; *optvallen_ = sizeof (int); return 0; |