Skip to content
Browse files

Added support for ZMQ_ROUTER_RAW

  • Loading branch information...
1 parent 5743f4e commit 78821eb2a926049e3c9278b5986073426fb70c80 @hintjens hintjens committed Nov 6, 2012
Showing with 28 additions and 0 deletions.
  1. +2 −0 include/zsockopt.h
  2. +3 −0 sockopts.xml
  3. +23 −0 src/zsockopt.c
View
2 include/zsockopt.h
@@ -135,6 +135,7 @@ CZMQ_EXPORT void zsocket_set_sndtimeo (void *zocket, int sndtimeo);
CZMQ_EXPORT void zsocket_set_ipv4only (void *zocket, int ipv4only);
CZMQ_EXPORT void zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect);
CZMQ_EXPORT void zsocket_set_router_mandatory (void *zocket, int router_mandatory);
+CZMQ_EXPORT void zsocket_set_router_raw (void *zocket, int router_raw);
CZMQ_EXPORT void zsocket_set_xpub_verbose (void *zocket, int xpub_verbose);
// Emulation of widely-used 2.x socket options
@@ -232,6 +233,7 @@ int zsockopt_test (bool verbose);
#define zsockopt_set_ipv4only zsocket_set_ipv4only
#define zsockopt_set_delay_attach_on_connect zsocket_set_delay_attach_on_connect
#define zsockopt_set_router_mandatory zsocket_set_router_mandatory
+#define zsockopt_set_router_raw zsocket_set_router_raw
#define zsockopt_set_xpub_verbose zsocket_set_xpub_verbose
#define zsockopt_rcvmore zsocket_rcvmore
#define zsockopt_fd zsocket_fd
View
3 sockopts.xml
@@ -68,6 +68,9 @@
<option name = "router_mandatory" type = "int" mode = "w" test = "ROUTER">
<restrict type = "ROUTER" />
</option>
+ <option name = "router_raw" type = "int" mode = "w" test = "ROUTER">
+ <restrict type = "ROUTER" />
+ </option>
<option name = "xpub_verbose" type = "int" mode = "w" test = "XPUB">
<restrict type = "XPUB" />
</option>
View
23 src/zsockopt.c
@@ -1161,6 +1161,23 @@ zsocket_set_router_mandatory (void *zocket, int router_mandatory)
// --------------------------------------------------------------------------
+// Set socket ZMQ_ROUTER_RAW value
+
+void
+zsocket_set_router_raw (void *zocket, int router_raw)
+{
+# if defined (ZMQ_ROUTER_RAW)
+ if (zsockopt_type (zocket) != ZMQ_ROUTER) {
+ printf ("ZMQ_ROUTER_RAW is not valid on %s sockets\n", zsocket_type_str (zocket));
+ assert (false);
+ }
+ int rc = zmq_setsockopt (zocket, ZMQ_ROUTER_RAW, &router_raw, sizeof (int));
+ assert (rc == 0 || errno == ETERM);
+# endif
+}
+
+
+// --------------------------------------------------------------------------
// Set socket ZMQ_XPUB_VERBOSE value
void
@@ -1601,6 +1618,12 @@ zsockopt_test (bool verbose)
zsocket_set_router_mandatory (zocket, 1);
zsocket_destroy (ctx, zocket);
# endif
+# if defined (ZMQ_ROUTER_RAW)
+ zocket = zsocket_new (ctx, ZMQ_ROUTER);
+ assert (zocket);
+ zsocket_set_router_raw (zocket, 1);
+ zsocket_destroy (ctx, zocket);
+# endif
# if defined (ZMQ_XPUB_VERBOSE)
zocket = zsocket_new (ctx, ZMQ_XPUB);
assert (zocket);

0 comments on commit 78821eb

Please sign in to comment.
Something went wrong with that request. Please try again.