Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
d20ea25b
Commit
d20ea25b
authored
Nov 02, 2011
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZMQ_IDENTITY option re-introduced
Signed-off-by:
Martin Sustrik
<
sustrik@250bpm.com
>
parent
8e21d64c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
100 additions
and
0 deletions
+100
-0
zmq_getsockopt.txt
doc/zmq_getsockopt.txt
+16
-0
zmq_setsockopt.txt
doc/zmq_setsockopt.txt
+17
-0
zmq.h
include/zmq.h
+1
-0
Makefile.am
src/Makefile.am
+1
-0
blob.hpp
src/blob.hpp
+35
-0
options.cpp
src/options.cpp
+25
-0
options.hpp
src/options.hpp
+5
-0
No files found.
doc/zmq_getsockopt.txt
View file @
d20ea25b
...
...
@@ -117,6 +117,22 @@ Option value unit:: N/A (bitmap)
Default value:: 0
Applicable socket types:: N/A
ZMQ_IDENTITY: Set socket identity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_IDENTITY' option shall retrieve the identity of the specified 'socket'.
Socket identity is used only by request/reply pattern. Namely, it can be used
in tandem with ROUTER socket to route messages to the peer with specific
identity.
Identity should be at least one byte and at most 255 bytes long. Identities
starting with binary zero are reserved for use by 0MQ infrastructure.
[horizontal]
Option value type:: binary data
Option value unit:: N/A
Default value:: NULL
Applicable socket types:: all
ZMQ_RATE: Retrieve multicast data rate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
doc/zmq_setsockopt.txt
View file @
d20ea25b
...
...
@@ -122,6 +122,23 @@ Default value:: N/A
Applicable socket types:: ZMQ_SUB
ZMQ_IDENTITY: Set socket identity
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_IDENTITY' option shall set the identity of the specified 'socket'.
Socket identity is used only by request/reply pattern. Namely, it can be used
in tandem with ROUTER socket to route messages to the peer with specific
identity.
Identity should be at least one byte and at most 255 bytes long. Identities
starting with binary zero are reserved for use by 0MQ infrastructure.
[horizontal]
Option value type:: binary data
Option value unit:: N/A
Default value:: NULL
Applicable socket types:: all
ZMQ_RATE: Set multicast data rate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_RATE' option shall set the maximum send or receive data rate for
...
...
include/zmq.h
View file @
d20ea25b
...
...
@@ -170,6 +170,7 @@ ZMQ_EXPORT int zmq_term (void *context);
/* Socket options. */
#define ZMQ_AFFINITY 4
#define ZMQ_IDENTITY 5
#define ZMQ_SUBSCRIBE 6
#define ZMQ_UNSUBSCRIBE 7
#define ZMQ_RATE 8
...
...
src/Makefile.am
View file @
d20ea25b
...
...
@@ -9,6 +9,7 @@ libzmq_la_SOURCES = \
array.hpp
\
atomic_counter.hpp
\
atomic_ptr.hpp
\
blob.hpp
\
clock.hpp
\
command.hpp
\
config.hpp
\
...
...
src/blob.hpp
0 → 100644
View file @
d20ea25b
/*
Copyright (c) 2010 250bpm s.r.o.
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ZMQ_BLOB_HPP_INCLUDED__
#define __ZMQ_BLOB_HPP_INCLUDED__
#include <string>
namespace
zmq
{
// Object to hold dynamically allocated opaque binary data.
typedef
std
::
basic_string
<
unsigned
char
>
blob_t
;
}
#endif
src/options.cpp
View file @
d20ea25b
/*
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
;
...
...
src/options.hpp
View file @
d20ea25b
/*
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.
...
...
@@ -42,6 +43,10 @@ namespace zmq
// I/O thread affinity.
uint64_t
affinity
;
// Socket identity
unsigned
char
identity_size
;
unsigned
char
identity
[
256
];
// Maximum tranfer rate [kb/s]. Default 100kb/s.
int
rate
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment