czmq-ffi-gen 0.13.0-x86-mingw32 → 0.14.1-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +13 -0
  3. data/lib/czmq-ffi-gen/czmq/ffi.rb +224 -698
  4. data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +40 -7
  5. data/lib/czmq-ffi-gen/czmq/ffi/zargs.rb +259 -0
  6. data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +3 -3
  7. data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +15 -6
  8. data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +25 -11
  9. data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +18 -18
  10. data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +6 -6
  11. data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +27 -17
  12. data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +4 -4
  13. data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +36 -36
  14. data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +1 -1
  15. data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +27 -19
  16. data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +22 -21
  17. data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +54 -54
  18. data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +82 -80
  19. data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +30 -0
  20. data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +30 -30
  21. data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +44 -44
  22. data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +39 -39
  23. data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +46 -46
  24. data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +16 -16
  25. data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +237 -34
  26. data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +1201 -973
  27. data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +58 -19
  28. data/lib/czmq-ffi-gen/czmq/ffi/zsys.rb +836 -0
  29. data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +6 -6
  30. data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +10 -10
  31. data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +4 -4
  32. data/lib/czmq-ffi-gen/gem_version.rb +1 -1
  33. data/lib/czmq-ffi-gen/vendor.rb +9 -1
  34. data/vendor/local/bin/inproc_lat.exe +0 -0
  35. data/vendor/local/bin/inproc_thr.exe +0 -0
  36. data/vendor/local/bin/libczmq.dll +0 -0
  37. data/vendor/local/bin/libzmq.dll +0 -0
  38. data/vendor/local/bin/local_lat.exe +0 -0
  39. data/vendor/local/bin/local_thr.exe +0 -0
  40. data/vendor/local/bin/remote_lat.exe +0 -0
  41. data/vendor/local/bin/remote_thr.exe +0 -0
  42. data/vendor/local/bin/zmakecert.exe +0 -0
  43. data/vendor/local/include/czmq_library.h +18 -9
  44. data/vendor/local/include/czmq_prelude.h +104 -16
  45. data/vendor/local/include/zactor.h +25 -7
  46. data/vendor/local/include/zarmour.h +3 -3
  47. data/vendor/local/include/zcert.h +11 -6
  48. data/vendor/local/include/zcertstore.h +18 -9
  49. data/vendor/local/include/zchunk.h +18 -18
  50. data/vendor/local/include/zclock.h +6 -6
  51. data/vendor/local/include/zconfig.h +25 -16
  52. data/vendor/local/include/zdigest.h +4 -4
  53. data/vendor/local/include/zdir.h +36 -36
  54. data/vendor/local/include/zdir_patch.h +1 -1
  55. data/vendor/local/include/zfile.h +27 -19
  56. data/vendor/local/include/zframe.h +22 -21
  57. data/vendor/local/include/zgossip.h +5 -5
  58. data/vendor/local/include/zgossip_engine.inc +103 -22
  59. data/vendor/local/include/zgossip_msg.h +28 -30
  60. data/vendor/local/include/zhash.h +53 -53
  61. data/vendor/local/include/zhashx.h +75 -73
  62. data/vendor/local/include/ziflist.h +22 -1
  63. data/vendor/local/include/zlist.h +28 -28
  64. data/vendor/local/include/zlistx.h +41 -41
  65. data/vendor/local/include/zloop.h +36 -36
  66. data/vendor/local/include/zmsg.h +46 -46
  67. data/vendor/local/include/zpoller.h +16 -16
  68. data/vendor/local/include/zsock.h +414 -364
  69. data/vendor/local/include/zsock_option.inc +234 -1062
  70. data/vendor/local/include/zstr.h +44 -19
  71. data/vendor/local/include/zsys.h +63 -19
  72. data/vendor/local/include/zuuid.h +4 -4
  73. data/vendor/local/lib/libczmq.dll.a +0 -0
  74. data/vendor/local/lib/liblibzmq.dll.a +0 -0
  75. data/vendor/local/lib/pkgconfig/libczmq.pc +1 -1
  76. metadata +6 -3
@@ -19,8 +19,6 @@
19
19
  =========================================================================
20
20
  */
21
21
 
22
- #if (ZMQ_VERSION_MAJOR >= 4)
23
- # if (ZMQ_VERSION_MINOR >= 2)
24
22
  // --------------------------------------------------------------------------
25
23
  // Set socket ZMQ_HEARTBEAT_IVL value
26
24
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -723,11 +721,7 @@ zsock_vmci_connect_timeout (void *self)
723
721
  # endif
724
722
  }
725
723
 
726
- # endif
727
- #endif
728
724
 
729
- #if (ZMQ_VERSION_MAJOR >= 4)
730
- # if (ZMQ_VERSION_MINOR >= 1)
731
725
  // --------------------------------------------------------------------------
732
726
  // Set socket ZMQ_TOS value
733
727
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -970,10 +964,7 @@ zsock_set_xpub_nodrop (void *self, int xpub_nodrop)
970
964
  }
971
965
 
972
966
 
973
- # endif
974
- #endif
975
967
 
976
- #if (ZMQ_VERSION_MAJOR >= 4)
977
968
  // --------------------------------------------------------------------------
978
969
  // Set socket ZMQ_ROUTER_MANDATORY value
979
970
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -1856,33 +1847,6 @@ zsock_immediate (void *self)
1856
1847
  # endif
1857
1848
  }
1858
1849
 
1859
- #endif
1860
-
1861
- #if (ZMQ_VERSION_MAJOR >= 3)
1862
- // --------------------------------------------------------------------------
1863
- // Return socket ZMQ_TYPE value
1864
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1865
-
1866
- int
1867
- zsock_type (void *self)
1868
- {
1869
- assert (self);
1870
- # if defined (ZMQ_TYPE)
1871
- int major, minor, patch;
1872
- zmq_version (&major, &minor, &patch);
1873
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
1874
- zsys_error ("zsock type option not supported by libzmq version %d.%d.%d, "
1875
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
1876
- return 0;
1877
- }
1878
- int type;
1879
- size_t option_len = sizeof (int);
1880
- zmq_getsockopt (zsock_resolve (self), ZMQ_TYPE, &type, &option_len);
1881
- return type;
1882
- # else
1883
- return 0;
1884
- # endif
1885
- }
1886
1850
 
1887
1851
  // --------------------------------------------------------------------------
1888
1852
  // Set socket ZMQ_SNDHWM value
@@ -1979,962 +1943,338 @@ zsock_rcvhwm (void *self)
1979
1943
  }
1980
1944
 
1981
1945
  // --------------------------------------------------------------------------
1982
- // Set socket ZMQ_AFFINITY value
1946
+ // Set socket ZMQ_MAXMSGSIZE value
1983
1947
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1984
1948
 
1985
1949
  void
1986
- zsock_set_affinity (void *self, int affinity)
1950
+ zsock_set_maxmsgsize (void *self, int maxmsgsize)
1987
1951
  {
1988
1952
  assert (self);
1989
- # if defined (ZMQ_AFFINITY)
1953
+ # if defined (ZMQ_MAXMSGSIZE)
1990
1954
  int major, minor, patch;
1991
1955
  zmq_version (&major, &minor, &patch);
1992
1956
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
1993
- zsys_error ("zsock affinity option not supported by libzmq version %d.%d.%d, "
1957
+ zsys_error ("zsock maxmsgsize option not supported by libzmq version %d.%d.%d, "
1994
1958
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
1995
1959
  return;
1996
1960
  }
1997
- uint64_t value = affinity;
1998
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_AFFINITY, &value, sizeof (uint64_t));
1961
+ int64_t value = maxmsgsize;
1962
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &value, sizeof (int64_t));
1999
1963
  assert (rc == 0 || zmq_errno () == ETERM);
2000
1964
  # endif
2001
1965
  }
2002
1966
 
2003
1967
 
2004
1968
  // --------------------------------------------------------------------------
2005
- // Return socket ZMQ_AFFINITY value
1969
+ // Return socket ZMQ_MAXMSGSIZE value
2006
1970
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2007
1971
 
2008
1972
  int
2009
- zsock_affinity (void *self)
1973
+ zsock_maxmsgsize (void *self)
2010
1974
  {
2011
1975
  assert (self);
2012
- # if defined (ZMQ_AFFINITY)
1976
+ # if defined (ZMQ_MAXMSGSIZE)
2013
1977
  int major, minor, patch;
2014
1978
  zmq_version (&major, &minor, &patch);
2015
1979
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2016
- zsys_error ("zsock affinity option not supported by libzmq version %d.%d.%d, "
1980
+ zsys_error ("zsock maxmsgsize option not supported by libzmq version %d.%d.%d, "
2017
1981
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2018
1982
  return 0;
2019
1983
  }
2020
- uint64_t affinity;
2021
- size_t option_len = sizeof (uint64_t);
2022
- zmq_getsockopt (zsock_resolve (self), ZMQ_AFFINITY, &affinity, &option_len);
2023
- return (int) affinity;
1984
+ int64_t maxmsgsize;
1985
+ size_t option_len = sizeof (int64_t);
1986
+ zmq_getsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &maxmsgsize, &option_len);
1987
+ return (int) maxmsgsize;
2024
1988
  # else
2025
1989
  return 0;
2026
1990
  # endif
2027
1991
  }
2028
1992
 
2029
1993
  // --------------------------------------------------------------------------
2030
- // Set socket ZMQ_SUBSCRIBE value
1994
+ // Set socket ZMQ_MULTICAST_HOPS value
2031
1995
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2032
1996
 
2033
1997
  void
2034
- zsock_set_subscribe (void *self, const char * subscribe)
1998
+ zsock_set_multicast_hops (void *self, int multicast_hops)
2035
1999
  {
2036
2000
  assert (self);
2037
- # if defined (ZMQ_SUBSCRIBE)
2001
+ # if defined (ZMQ_MULTICAST_HOPS)
2038
2002
  int major, minor, patch;
2039
2003
  zmq_version (&major, &minor, &patch);
2040
2004
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2041
- zsys_error ("zsock subscribe option not supported by libzmq version %d.%d.%d, "
2005
+ zsys_error ("zsock multicast_hops option not supported by libzmq version %d.%d.%d, "
2042
2006
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2043
2007
  return;
2044
2008
  }
2045
- if (zsock_type (self) != ZMQ_SUB) {
2046
- printf ("ZMQ_SUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2047
- assert (false);
2048
- }
2049
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SUBSCRIBE, subscribe, strlen (subscribe));
2009
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, sizeof (int));
2050
2010
  assert (rc == 0 || zmq_errno () == ETERM);
2051
2011
  # endif
2052
2012
  }
2053
2013
 
2054
2014
 
2055
2015
  // --------------------------------------------------------------------------
2056
- // Set socket ZMQ_UNSUBSCRIBE value
2016
+ // Return socket ZMQ_MULTICAST_HOPS value
2057
2017
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2058
2018
 
2059
- void
2060
- zsock_set_unsubscribe (void *self, const char * unsubscribe)
2019
+ int
2020
+ zsock_multicast_hops (void *self)
2061
2021
  {
2062
2022
  assert (self);
2063
- # if defined (ZMQ_UNSUBSCRIBE)
2023
+ # if defined (ZMQ_MULTICAST_HOPS)
2064
2024
  int major, minor, patch;
2065
2025
  zmq_version (&major, &minor, &patch);
2066
2026
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2067
- zsys_error ("zsock unsubscribe option not supported by libzmq version %d.%d.%d, "
2027
+ zsys_error ("zsock multicast_hops option not supported by libzmq version %d.%d.%d, "
2068
2028
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2069
- return;
2070
- }
2071
- if (zsock_type (self) != ZMQ_SUB) {
2072
- printf ("ZMQ_UNSUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2073
- assert (false);
2029
+ return 0;
2074
2030
  }
2075
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_UNSUBSCRIBE, unsubscribe, strlen (unsubscribe));
2076
- assert (rc == 0 || zmq_errno () == ETERM);
2031
+ int multicast_hops;
2032
+ size_t option_len = sizeof (int);
2033
+ zmq_getsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, &option_len);
2034
+ return multicast_hops;
2035
+ # else
2036
+ return 0;
2077
2037
  # endif
2078
2038
  }
2079
2039
 
2080
-
2081
2040
  // --------------------------------------------------------------------------
2082
- // Set socket ZMQ_IDENTITY value
2041
+ // Set socket ZMQ_XPUB_VERBOSE value
2083
2042
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2084
2043
 
2085
2044
  void
2086
- zsock_set_identity (void *self, const char * identity)
2045
+ zsock_set_xpub_verbose (void *self, int xpub_verbose)
2087
2046
  {
2088
2047
  assert (self);
2089
- # if defined (ZMQ_IDENTITY)
2048
+ # if defined (ZMQ_XPUB_VERBOSE)
2090
2049
  int major, minor, patch;
2091
2050
  zmq_version (&major, &minor, &patch);
2092
2051
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2093
- zsys_error ("zsock identity option not supported by libzmq version %d.%d.%d, "
2052
+ zsys_error ("zsock xpub_verbose option not supported by libzmq version %d.%d.%d, "
2094
2053
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2095
2054
  return;
2096
2055
  }
2097
- if (zsock_type (self) != ZMQ_REQ
2098
- && zsock_type (self) != ZMQ_REP
2099
- && zsock_type (self) != ZMQ_DEALER
2100
- && zsock_type (self) != ZMQ_ROUTER) {
2101
- printf ("ZMQ_IDENTITY is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2056
+ if (zsock_type (self) != ZMQ_XPUB) {
2057
+ printf ("ZMQ_XPUB_VERBOSE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2102
2058
  assert (false);
2103
2059
  }
2104
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, strlen (identity));
2060
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_XPUB_VERBOSE, &xpub_verbose, sizeof (int));
2105
2061
  assert (rc == 0 || zmq_errno () == ETERM);
2106
2062
  # endif
2107
2063
  }
2108
2064
 
2109
2065
 
2110
2066
  // --------------------------------------------------------------------------
2111
- // Return socket ZMQ_IDENTITY value
2112
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2113
-
2114
- char *
2115
- zsock_identity (void *self)
2116
- {
2117
- assert (self);
2118
- # if defined (ZMQ_IDENTITY)
2119
- int major, minor, patch;
2120
- zmq_version (&major, &minor, &patch);
2121
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2122
- zsys_error ("zsock identity option not supported by libzmq version %d.%d.%d, "
2123
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2124
- return 0;
2125
- }
2126
- size_t option_len = 255;
2127
- char *identity = (char *) zmalloc (option_len);
2128
- zmq_getsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, &option_len);
2129
- return (char *) identity;
2130
- # else
2131
- return NULL;
2132
- # endif
2133
- }
2134
-
2135
- // --------------------------------------------------------------------------
2136
- // Set socket ZMQ_RATE value
2067
+ // Set socket ZMQ_TCP_KEEPALIVE value
2137
2068
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2138
2069
 
2139
2070
  void
2140
- zsock_set_rate (void *self, int rate)
2071
+ zsock_set_tcp_keepalive (void *self, int tcp_keepalive)
2141
2072
  {
2142
2073
  assert (self);
2143
- # if defined (ZMQ_RATE)
2074
+ # if defined (ZMQ_TCP_KEEPALIVE)
2144
2075
  int major, minor, patch;
2145
2076
  zmq_version (&major, &minor, &patch);
2146
2077
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2147
- zsys_error ("zsock rate option not supported by libzmq version %d.%d.%d, "
2078
+ zsys_error ("zsock tcp_keepalive option not supported by libzmq version %d.%d.%d, "
2148
2079
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2149
2080
  return;
2150
2081
  }
2151
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RATE, &rate, sizeof (int));
2082
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, sizeof (int));
2152
2083
  assert (rc == 0 || zmq_errno () == ETERM);
2153
2084
  # endif
2154
2085
  }
2155
2086
 
2156
2087
 
2157
2088
  // --------------------------------------------------------------------------
2158
- // Return socket ZMQ_RATE value
2089
+ // Return socket ZMQ_TCP_KEEPALIVE value
2159
2090
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2160
2091
 
2161
2092
  int
2162
- zsock_rate (void *self)
2093
+ zsock_tcp_keepalive (void *self)
2163
2094
  {
2164
2095
  assert (self);
2165
- # if defined (ZMQ_RATE)
2096
+ # if defined (ZMQ_TCP_KEEPALIVE)
2166
2097
  int major, minor, patch;
2167
2098
  zmq_version (&major, &minor, &patch);
2168
2099
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2169
- zsys_error ("zsock rate option not supported by libzmq version %d.%d.%d, "
2100
+ zsys_error ("zsock tcp_keepalive option not supported by libzmq version %d.%d.%d, "
2170
2101
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2171
2102
  return 0;
2172
2103
  }
2173
- int rate;
2104
+ int tcp_keepalive;
2174
2105
  size_t option_len = sizeof (int);
2175
- zmq_getsockopt (zsock_resolve (self), ZMQ_RATE, &rate, &option_len);
2176
- return rate;
2106
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, &option_len);
2107
+ return tcp_keepalive;
2177
2108
  # else
2178
2109
  return 0;
2179
2110
  # endif
2180
2111
  }
2181
2112
 
2182
2113
  // --------------------------------------------------------------------------
2183
- // Set socket ZMQ_RECOVERY_IVL value
2114
+ // Set socket ZMQ_TCP_KEEPALIVE_IDLE value
2184
2115
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2185
2116
 
2186
2117
  void
2187
- zsock_set_recovery_ivl (void *self, int recovery_ivl)
2118
+ zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle)
2188
2119
  {
2189
2120
  assert (self);
2190
- # if defined (ZMQ_RECOVERY_IVL)
2121
+ # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
2191
2122
  int major, minor, patch;
2192
2123
  zmq_version (&major, &minor, &patch);
2193
2124
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2194
- zsys_error ("zsock recovery_ivl option not supported by libzmq version %d.%d.%d, "
2125
+ zsys_error ("zsock tcp_keepalive_idle option not supported by libzmq version %d.%d.%d, "
2195
2126
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2196
2127
  return;
2197
2128
  }
2198
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, sizeof (int));
2129
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, sizeof (int));
2199
2130
  assert (rc == 0 || zmq_errno () == ETERM);
2200
2131
  # endif
2201
2132
  }
2202
2133
 
2203
2134
 
2204
2135
  // --------------------------------------------------------------------------
2205
- // Return socket ZMQ_RECOVERY_IVL value
2136
+ // Return socket ZMQ_TCP_KEEPALIVE_IDLE value
2206
2137
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2207
2138
 
2208
2139
  int
2209
- zsock_recovery_ivl (void *self)
2140
+ zsock_tcp_keepalive_idle (void *self)
2210
2141
  {
2211
2142
  assert (self);
2212
- # if defined (ZMQ_RECOVERY_IVL)
2143
+ # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
2213
2144
  int major, minor, patch;
2214
2145
  zmq_version (&major, &minor, &patch);
2215
2146
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2216
- zsys_error ("zsock recovery_ivl option not supported by libzmq version %d.%d.%d, "
2147
+ zsys_error ("zsock tcp_keepalive_idle option not supported by libzmq version %d.%d.%d, "
2217
2148
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2218
2149
  return 0;
2219
2150
  }
2220
- int recovery_ivl;
2151
+ int tcp_keepalive_idle;
2221
2152
  size_t option_len = sizeof (int);
2222
- zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
2223
- return recovery_ivl;
2153
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, &option_len);
2154
+ return tcp_keepalive_idle;
2224
2155
  # else
2225
2156
  return 0;
2226
2157
  # endif
2227
2158
  }
2228
2159
 
2229
2160
  // --------------------------------------------------------------------------
2230
- // Set socket ZMQ_SNDBUF value
2161
+ // Set socket ZMQ_TCP_KEEPALIVE_CNT value
2231
2162
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2232
2163
 
2233
2164
  void
2234
- zsock_set_sndbuf (void *self, int sndbuf)
2165
+ zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt)
2235
2166
  {
2236
2167
  assert (self);
2237
- # if defined (ZMQ_SNDBUF)
2168
+ # if defined (ZMQ_TCP_KEEPALIVE_CNT)
2238
2169
  int major, minor, patch;
2239
2170
  zmq_version (&major, &minor, &patch);
2240
2171
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2241
- zsys_error ("zsock sndbuf option not supported by libzmq version %d.%d.%d, "
2172
+ zsys_error ("zsock tcp_keepalive_cnt option not supported by libzmq version %d.%d.%d, "
2242
2173
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2243
2174
  return;
2244
2175
  }
2245
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, sizeof (int));
2176
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, sizeof (int));
2246
2177
  assert (rc == 0 || zmq_errno () == ETERM);
2247
2178
  # endif
2248
2179
  }
2249
2180
 
2250
2181
 
2251
2182
  // --------------------------------------------------------------------------
2252
- // Return socket ZMQ_SNDBUF value
2183
+ // Return socket ZMQ_TCP_KEEPALIVE_CNT value
2253
2184
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2254
2185
 
2255
2186
  int
2256
- zsock_sndbuf (void *self)
2187
+ zsock_tcp_keepalive_cnt (void *self)
2257
2188
  {
2258
2189
  assert (self);
2259
- # if defined (ZMQ_SNDBUF)
2190
+ # if defined (ZMQ_TCP_KEEPALIVE_CNT)
2260
2191
  int major, minor, patch;
2261
2192
  zmq_version (&major, &minor, &patch);
2262
2193
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2263
- zsys_error ("zsock sndbuf option not supported by libzmq version %d.%d.%d, "
2194
+ zsys_error ("zsock tcp_keepalive_cnt option not supported by libzmq version %d.%d.%d, "
2264
2195
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2265
2196
  return 0;
2266
2197
  }
2267
- int sndbuf;
2198
+ int tcp_keepalive_cnt;
2268
2199
  size_t option_len = sizeof (int);
2269
- zmq_getsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, &option_len);
2270
- return sndbuf;
2200
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, &option_len);
2201
+ return tcp_keepalive_cnt;
2271
2202
  # else
2272
2203
  return 0;
2273
2204
  # endif
2274
2205
  }
2275
2206
 
2276
2207
  // --------------------------------------------------------------------------
2277
- // Set socket ZMQ_RCVBUF value
2208
+ // Set socket ZMQ_TCP_KEEPALIVE_INTVL value
2278
2209
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2279
2210
 
2280
2211
  void
2281
- zsock_set_rcvbuf (void *self, int rcvbuf)
2212
+ zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl)
2282
2213
  {
2283
2214
  assert (self);
2284
- # if defined (ZMQ_RCVBUF)
2215
+ # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
2285
2216
  int major, minor, patch;
2286
2217
  zmq_version (&major, &minor, &patch);
2287
2218
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2288
- zsys_error ("zsock rcvbuf option not supported by libzmq version %d.%d.%d, "
2219
+ zsys_error ("zsock tcp_keepalive_intvl option not supported by libzmq version %d.%d.%d, "
2289
2220
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2290
2221
  return;
2291
2222
  }
2292
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, sizeof (int));
2223
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, sizeof (int));
2293
2224
  assert (rc == 0 || zmq_errno () == ETERM);
2294
2225
  # endif
2295
2226
  }
2296
2227
 
2297
2228
 
2298
2229
  // --------------------------------------------------------------------------
2299
- // Return socket ZMQ_RCVBUF value
2230
+ // Return socket ZMQ_TCP_KEEPALIVE_INTVL value
2300
2231
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2301
2232
 
2302
2233
  int
2303
- zsock_rcvbuf (void *self)
2234
+ zsock_tcp_keepalive_intvl (void *self)
2304
2235
  {
2305
2236
  assert (self);
2306
- # if defined (ZMQ_RCVBUF)
2237
+ # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
2307
2238
  int major, minor, patch;
2308
2239
  zmq_version (&major, &minor, &patch);
2309
2240
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2310
- zsys_error ("zsock rcvbuf option not supported by libzmq version %d.%d.%d, "
2241
+ zsys_error ("zsock tcp_keepalive_intvl option not supported by libzmq version %d.%d.%d, "
2311
2242
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2312
2243
  return 0;
2313
2244
  }
2314
- int rcvbuf;
2245
+ int tcp_keepalive_intvl;
2315
2246
  size_t option_len = sizeof (int);
2316
- zmq_getsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, &option_len);
2317
- return rcvbuf;
2247
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, &option_len);
2248
+ return tcp_keepalive_intvl;
2318
2249
  # else
2319
2250
  return 0;
2320
2251
  # endif
2321
2252
  }
2322
2253
 
2323
2254
  // --------------------------------------------------------------------------
2324
- // Set socket ZMQ_LINGER value
2255
+ // Set socket ZMQ_TCP_ACCEPT_FILTER value
2325
2256
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2326
2257
 
2327
2258
  void
2328
- zsock_set_linger (void *self, int linger)
2259
+ zsock_set_tcp_accept_filter (void *self, const char * tcp_accept_filter)
2329
2260
  {
2330
2261
  assert (self);
2331
- # if defined (ZMQ_LINGER)
2262
+ # if defined (ZMQ_TCP_ACCEPT_FILTER)
2332
2263
  int major, minor, patch;
2333
2264
  zmq_version (&major, &minor, &patch);
2334
2265
  if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2335
- zsys_error ("zsock linger option not supported by libzmq version %d.%d.%d, "
2266
+ zsys_error ("zsock tcp_accept_filter option not supported by libzmq version %d.%d.%d, "
2336
2267
  "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2337
2268
  return;
2338
2269
  }
2339
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, sizeof (int));
2270
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, strlen (tcp_accept_filter));
2340
2271
  assert (rc == 0 || zmq_errno () == ETERM);
2341
2272
  # endif
2342
2273
  }
2343
2274
 
2344
2275
 
2345
2276
  // --------------------------------------------------------------------------
2346
- // Return socket ZMQ_LINGER value
2347
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2348
-
2349
- int
2350
- zsock_linger (void *self)
2351
- {
2352
- assert (self);
2353
- # if defined (ZMQ_LINGER)
2354
- int major, minor, patch;
2355
- zmq_version (&major, &minor, &patch);
2356
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2357
- zsys_error ("zsock linger option not supported by libzmq version %d.%d.%d, "
2358
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2359
- return 0;
2360
- }
2361
- int linger;
2362
- size_t option_len = sizeof (int);
2363
- zmq_getsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, &option_len);
2364
- return linger;
2365
- # else
2366
- return 0;
2367
- # endif
2368
- }
2369
-
2370
- // --------------------------------------------------------------------------
2371
- // Set socket ZMQ_RECONNECT_IVL value
2372
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2373
-
2374
- void
2375
- zsock_set_reconnect_ivl (void *self, int reconnect_ivl)
2376
- {
2377
- assert (self);
2378
- # if defined (ZMQ_RECONNECT_IVL)
2379
- int major, minor, patch;
2380
- zmq_version (&major, &minor, &patch);
2381
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2382
- zsys_error ("zsock reconnect_ivl option not supported by libzmq version %d.%d.%d, "
2383
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2384
- return;
2385
- }
2386
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
2387
- assert (rc == 0 || zmq_errno () == ETERM);
2388
- # endif
2389
- }
2390
-
2391
-
2392
- // --------------------------------------------------------------------------
2393
- // Return socket ZMQ_RECONNECT_IVL value
2394
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2395
-
2396
- int
2397
- zsock_reconnect_ivl (void *self)
2398
- {
2399
- assert (self);
2400
- # if defined (ZMQ_RECONNECT_IVL)
2401
- int major, minor, patch;
2402
- zmq_version (&major, &minor, &patch);
2403
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2404
- zsys_error ("zsock reconnect_ivl option not supported by libzmq version %d.%d.%d, "
2405
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2406
- return 0;
2407
- }
2408
- int reconnect_ivl;
2409
- size_t option_len = sizeof (int);
2410
- zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, &option_len);
2411
- return reconnect_ivl;
2412
- # else
2413
- return 0;
2414
- # endif
2415
- }
2416
-
2417
- // --------------------------------------------------------------------------
2418
- // Set socket ZMQ_RECONNECT_IVL_MAX value
2419
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2420
-
2421
- void
2422
- zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max)
2423
- {
2424
- assert (self);
2425
- # if defined (ZMQ_RECONNECT_IVL_MAX)
2426
- int major, minor, patch;
2427
- zmq_version (&major, &minor, &patch);
2428
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2429
- zsys_error ("zsock reconnect_ivl_max option not supported by libzmq version %d.%d.%d, "
2430
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2431
- return;
2432
- }
2433
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
2434
- assert (rc == 0 || zmq_errno () == ETERM);
2435
- # endif
2436
- }
2437
-
2438
-
2439
- // --------------------------------------------------------------------------
2440
- // Return socket ZMQ_RECONNECT_IVL_MAX value
2441
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2442
-
2443
- int
2444
- zsock_reconnect_ivl_max (void *self)
2445
- {
2446
- assert (self);
2447
- # if defined (ZMQ_RECONNECT_IVL_MAX)
2448
- int major, minor, patch;
2449
- zmq_version (&major, &minor, &patch);
2450
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2451
- zsys_error ("zsock reconnect_ivl_max option not supported by libzmq version %d.%d.%d, "
2452
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2453
- return 0;
2454
- }
2455
- int reconnect_ivl_max;
2456
- size_t option_len = sizeof (int);
2457
- zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, &option_len);
2458
- return reconnect_ivl_max;
2459
- # else
2460
- return 0;
2461
- # endif
2462
- }
2463
-
2464
- // --------------------------------------------------------------------------
2465
- // Set socket ZMQ_BACKLOG value
2466
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2467
-
2468
- void
2469
- zsock_set_backlog (void *self, int backlog)
2470
- {
2471
- assert (self);
2472
- # if defined (ZMQ_BACKLOG)
2473
- int major, minor, patch;
2474
- zmq_version (&major, &minor, &patch);
2475
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2476
- zsys_error ("zsock backlog option not supported by libzmq version %d.%d.%d, "
2477
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2478
- return;
2479
- }
2480
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, sizeof (int));
2481
- assert (rc == 0 || zmq_errno () == ETERM);
2482
- # endif
2483
- }
2484
-
2485
-
2486
- // --------------------------------------------------------------------------
2487
- // Return socket ZMQ_BACKLOG value
2488
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2489
-
2490
- int
2491
- zsock_backlog (void *self)
2492
- {
2493
- assert (self);
2494
- # if defined (ZMQ_BACKLOG)
2495
- int major, minor, patch;
2496
- zmq_version (&major, &minor, &patch);
2497
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2498
- zsys_error ("zsock backlog option not supported by libzmq version %d.%d.%d, "
2499
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2500
- return 0;
2501
- }
2502
- int backlog;
2503
- size_t option_len = sizeof (int);
2504
- zmq_getsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, &option_len);
2505
- return backlog;
2506
- # else
2507
- return 0;
2508
- # endif
2509
- }
2510
-
2511
- // --------------------------------------------------------------------------
2512
- // Set socket ZMQ_MAXMSGSIZE value
2513
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2514
-
2515
- void
2516
- zsock_set_maxmsgsize (void *self, int maxmsgsize)
2517
- {
2518
- assert (self);
2519
- # if defined (ZMQ_MAXMSGSIZE)
2520
- int major, minor, patch;
2521
- zmq_version (&major, &minor, &patch);
2522
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2523
- zsys_error ("zsock maxmsgsize option not supported by libzmq version %d.%d.%d, "
2524
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2525
- return;
2526
- }
2527
- int64_t value = maxmsgsize;
2528
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &value, sizeof (int64_t));
2529
- assert (rc == 0 || zmq_errno () == ETERM);
2530
- # endif
2531
- }
2532
-
2533
-
2534
- // --------------------------------------------------------------------------
2535
- // Return socket ZMQ_MAXMSGSIZE value
2536
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2537
-
2538
- int
2539
- zsock_maxmsgsize (void *self)
2540
- {
2541
- assert (self);
2542
- # if defined (ZMQ_MAXMSGSIZE)
2543
- int major, minor, patch;
2544
- zmq_version (&major, &minor, &patch);
2545
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2546
- zsys_error ("zsock maxmsgsize option not supported by libzmq version %d.%d.%d, "
2547
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2548
- return 0;
2549
- }
2550
- int64_t maxmsgsize;
2551
- size_t option_len = sizeof (int64_t);
2552
- zmq_getsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &maxmsgsize, &option_len);
2553
- return (int) maxmsgsize;
2554
- # else
2555
- return 0;
2556
- # endif
2557
- }
2558
-
2559
- // --------------------------------------------------------------------------
2560
- // Set socket ZMQ_MULTICAST_HOPS value
2561
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2562
-
2563
- void
2564
- zsock_set_multicast_hops (void *self, int multicast_hops)
2565
- {
2566
- assert (self);
2567
- # if defined (ZMQ_MULTICAST_HOPS)
2568
- int major, minor, patch;
2569
- zmq_version (&major, &minor, &patch);
2570
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2571
- zsys_error ("zsock multicast_hops option not supported by libzmq version %d.%d.%d, "
2572
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2573
- return;
2574
- }
2575
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, sizeof (int));
2576
- assert (rc == 0 || zmq_errno () == ETERM);
2577
- # endif
2578
- }
2579
-
2580
-
2581
- // --------------------------------------------------------------------------
2582
- // Return socket ZMQ_MULTICAST_HOPS value
2583
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2584
-
2585
- int
2586
- zsock_multicast_hops (void *self)
2587
- {
2588
- assert (self);
2589
- # if defined (ZMQ_MULTICAST_HOPS)
2590
- int major, minor, patch;
2591
- zmq_version (&major, &minor, &patch);
2592
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2593
- zsys_error ("zsock multicast_hops option not supported by libzmq version %d.%d.%d, "
2594
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2595
- return 0;
2596
- }
2597
- int multicast_hops;
2598
- size_t option_len = sizeof (int);
2599
- zmq_getsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, &option_len);
2600
- return multicast_hops;
2601
- # else
2602
- return 0;
2603
- # endif
2604
- }
2605
-
2606
- // --------------------------------------------------------------------------
2607
- // Set socket ZMQ_RCVTIMEO value
2608
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2609
-
2610
- void
2611
- zsock_set_rcvtimeo (void *self, int rcvtimeo)
2612
- {
2613
- assert (self);
2614
- # if defined (ZMQ_RCVTIMEO)
2615
- int major, minor, patch;
2616
- zmq_version (&major, &minor, &patch);
2617
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2618
- zsys_error ("zsock rcvtimeo option not supported by libzmq version %d.%d.%d, "
2619
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2620
- return;
2621
- }
2622
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
2623
- assert (rc == 0 || zmq_errno () == ETERM);
2624
- # endif
2625
- }
2626
-
2627
-
2628
- // --------------------------------------------------------------------------
2629
- // Return socket ZMQ_RCVTIMEO value
2630
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2631
-
2632
- int
2633
- zsock_rcvtimeo (void *self)
2634
- {
2635
- assert (self);
2636
- # if defined (ZMQ_RCVTIMEO)
2637
- int major, minor, patch;
2638
- zmq_version (&major, &minor, &patch);
2639
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2640
- zsys_error ("zsock rcvtimeo option not supported by libzmq version %d.%d.%d, "
2641
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2642
- return 0;
2643
- }
2644
- int rcvtimeo;
2645
- size_t option_len = sizeof (int);
2646
- zmq_getsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, &option_len);
2647
- return rcvtimeo;
2648
- # else
2649
- return 0;
2650
- # endif
2651
- }
2652
-
2653
- // --------------------------------------------------------------------------
2654
- // Set socket ZMQ_SNDTIMEO value
2655
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2656
-
2657
- void
2658
- zsock_set_sndtimeo (void *self, int sndtimeo)
2659
- {
2660
- assert (self);
2661
- # if defined (ZMQ_SNDTIMEO)
2662
- int major, minor, patch;
2663
- zmq_version (&major, &minor, &patch);
2664
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2665
- zsys_error ("zsock sndtimeo option not supported by libzmq version %d.%d.%d, "
2666
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2667
- return;
2668
- }
2669
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
2670
- assert (rc == 0 || zmq_errno () == ETERM);
2671
- # endif
2672
- }
2673
-
2674
-
2675
- // --------------------------------------------------------------------------
2676
- // Return socket ZMQ_SNDTIMEO value
2677
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2678
-
2679
- int
2680
- zsock_sndtimeo (void *self)
2681
- {
2682
- assert (self);
2683
- # if defined (ZMQ_SNDTIMEO)
2684
- int major, minor, patch;
2685
- zmq_version (&major, &minor, &patch);
2686
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2687
- zsys_error ("zsock sndtimeo option not supported by libzmq version %d.%d.%d, "
2688
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2689
- return 0;
2690
- }
2691
- int sndtimeo;
2692
- size_t option_len = sizeof (int);
2693
- zmq_getsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, &option_len);
2694
- return sndtimeo;
2695
- # else
2696
- return 0;
2697
- # endif
2698
- }
2699
-
2700
- // --------------------------------------------------------------------------
2701
- // Set socket ZMQ_XPUB_VERBOSE value
2702
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2703
-
2704
- void
2705
- zsock_set_xpub_verbose (void *self, int xpub_verbose)
2706
- {
2707
- assert (self);
2708
- # if defined (ZMQ_XPUB_VERBOSE)
2709
- int major, minor, patch;
2710
- zmq_version (&major, &minor, &patch);
2711
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2712
- zsys_error ("zsock xpub_verbose option not supported by libzmq version %d.%d.%d, "
2713
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2714
- return;
2715
- }
2716
- if (zsock_type (self) != ZMQ_XPUB) {
2717
- printf ("ZMQ_XPUB_VERBOSE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2718
- assert (false);
2719
- }
2720
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_XPUB_VERBOSE, &xpub_verbose, sizeof (int));
2721
- assert (rc == 0 || zmq_errno () == ETERM);
2722
- # endif
2723
- }
2724
-
2725
-
2726
- // --------------------------------------------------------------------------
2727
- // Set socket ZMQ_TCP_KEEPALIVE value
2728
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2729
-
2730
- void
2731
- zsock_set_tcp_keepalive (void *self, int tcp_keepalive)
2732
- {
2733
- assert (self);
2734
- # if defined (ZMQ_TCP_KEEPALIVE)
2735
- int major, minor, patch;
2736
- zmq_version (&major, &minor, &patch);
2737
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2738
- zsys_error ("zsock tcp_keepalive option not supported by libzmq version %d.%d.%d, "
2739
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2740
- return;
2741
- }
2742
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, sizeof (int));
2743
- assert (rc == 0 || zmq_errno () == ETERM);
2744
- # endif
2745
- }
2746
-
2747
-
2748
- // --------------------------------------------------------------------------
2749
- // Return socket ZMQ_TCP_KEEPALIVE value
2750
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2751
-
2752
- int
2753
- zsock_tcp_keepalive (void *self)
2754
- {
2755
- assert (self);
2756
- # if defined (ZMQ_TCP_KEEPALIVE)
2757
- int major, minor, patch;
2758
- zmq_version (&major, &minor, &patch);
2759
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2760
- zsys_error ("zsock tcp_keepalive option not supported by libzmq version %d.%d.%d, "
2761
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2762
- return 0;
2763
- }
2764
- int tcp_keepalive;
2765
- size_t option_len = sizeof (int);
2766
- zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, &option_len);
2767
- return tcp_keepalive;
2768
- # else
2769
- return 0;
2770
- # endif
2771
- }
2772
-
2773
- // --------------------------------------------------------------------------
2774
- // Set socket ZMQ_TCP_KEEPALIVE_IDLE value
2775
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2776
-
2777
- void
2778
- zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle)
2779
- {
2780
- assert (self);
2781
- # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
2782
- int major, minor, patch;
2783
- zmq_version (&major, &minor, &patch);
2784
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2785
- zsys_error ("zsock tcp_keepalive_idle option not supported by libzmq version %d.%d.%d, "
2786
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2787
- return;
2788
- }
2789
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, sizeof (int));
2790
- assert (rc == 0 || zmq_errno () == ETERM);
2791
- # endif
2792
- }
2793
-
2794
-
2795
- // --------------------------------------------------------------------------
2796
- // Return socket ZMQ_TCP_KEEPALIVE_IDLE value
2797
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2798
-
2799
- int
2800
- zsock_tcp_keepalive_idle (void *self)
2801
- {
2802
- assert (self);
2803
- # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
2804
- int major, minor, patch;
2805
- zmq_version (&major, &minor, &patch);
2806
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2807
- zsys_error ("zsock tcp_keepalive_idle option not supported by libzmq version %d.%d.%d, "
2808
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2809
- return 0;
2810
- }
2811
- int tcp_keepalive_idle;
2812
- size_t option_len = sizeof (int);
2813
- zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, &option_len);
2814
- return tcp_keepalive_idle;
2815
- # else
2816
- return 0;
2817
- # endif
2818
- }
2819
-
2820
- // --------------------------------------------------------------------------
2821
- // Set socket ZMQ_TCP_KEEPALIVE_CNT value
2822
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2823
-
2824
- void
2825
- zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt)
2826
- {
2827
- assert (self);
2828
- # if defined (ZMQ_TCP_KEEPALIVE_CNT)
2829
- int major, minor, patch;
2830
- zmq_version (&major, &minor, &patch);
2831
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2832
- zsys_error ("zsock tcp_keepalive_cnt option not supported by libzmq version %d.%d.%d, "
2833
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2834
- return;
2835
- }
2836
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, sizeof (int));
2837
- assert (rc == 0 || zmq_errno () == ETERM);
2838
- # endif
2839
- }
2840
-
2841
-
2842
- // --------------------------------------------------------------------------
2843
- // Return socket ZMQ_TCP_KEEPALIVE_CNT value
2844
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2845
-
2846
- int
2847
- zsock_tcp_keepalive_cnt (void *self)
2848
- {
2849
- assert (self);
2850
- # if defined (ZMQ_TCP_KEEPALIVE_CNT)
2851
- int major, minor, patch;
2852
- zmq_version (&major, &minor, &patch);
2853
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2854
- zsys_error ("zsock tcp_keepalive_cnt option not supported by libzmq version %d.%d.%d, "
2855
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2856
- return 0;
2857
- }
2858
- int tcp_keepalive_cnt;
2859
- size_t option_len = sizeof (int);
2860
- zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, &option_len);
2861
- return tcp_keepalive_cnt;
2862
- # else
2863
- return 0;
2864
- # endif
2865
- }
2866
-
2867
- // --------------------------------------------------------------------------
2868
- // Set socket ZMQ_TCP_KEEPALIVE_INTVL value
2869
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2870
-
2871
- void
2872
- zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl)
2873
- {
2874
- assert (self);
2875
- # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
2876
- int major, minor, patch;
2877
- zmq_version (&major, &minor, &patch);
2878
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2879
- zsys_error ("zsock tcp_keepalive_intvl option not supported by libzmq version %d.%d.%d, "
2880
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2881
- return;
2882
- }
2883
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, sizeof (int));
2884
- assert (rc == 0 || zmq_errno () == ETERM);
2885
- # endif
2886
- }
2887
-
2888
-
2889
- // --------------------------------------------------------------------------
2890
- // Return socket ZMQ_TCP_KEEPALIVE_INTVL value
2891
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2892
-
2893
- int
2894
- zsock_tcp_keepalive_intvl (void *self)
2895
- {
2896
- assert (self);
2897
- # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
2898
- int major, minor, patch;
2899
- zmq_version (&major, &minor, &patch);
2900
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2901
- zsys_error ("zsock tcp_keepalive_intvl option not supported by libzmq version %d.%d.%d, "
2902
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2903
- return 0;
2904
- }
2905
- int tcp_keepalive_intvl;
2906
- size_t option_len = sizeof (int);
2907
- zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, &option_len);
2908
- return tcp_keepalive_intvl;
2909
- # else
2910
- return 0;
2911
- # endif
2912
- }
2913
-
2914
- // --------------------------------------------------------------------------
2915
- // Set socket ZMQ_TCP_ACCEPT_FILTER value
2916
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2917
-
2918
- void
2919
- zsock_set_tcp_accept_filter (void *self, const char * tcp_accept_filter)
2920
- {
2921
- assert (self);
2922
- # if defined (ZMQ_TCP_ACCEPT_FILTER)
2923
- int major, minor, patch;
2924
- zmq_version (&major, &minor, &patch);
2925
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2926
- zsys_error ("zsock tcp_accept_filter option not supported by libzmq version %d.%d.%d, "
2927
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2928
- return;
2929
- }
2930
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, strlen (tcp_accept_filter));
2931
- assert (rc == 0 || zmq_errno () == ETERM);
2932
- # endif
2933
- }
2934
-
2935
-
2936
- // --------------------------------------------------------------------------
2937
- // Return socket ZMQ_TCP_ACCEPT_FILTER value
2277
+ // Return socket ZMQ_TCP_ACCEPT_FILTER value
2938
2278
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2939
2279
 
2940
2280
  char *
@@ -2958,81 +2298,6 @@ zsock_tcp_accept_filter (void *self)
2958
2298
  # endif
2959
2299
  }
2960
2300
 
2961
- // --------------------------------------------------------------------------
2962
- // Return socket ZMQ_RCVMORE value
2963
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2964
-
2965
- int
2966
- zsock_rcvmore (void *self)
2967
- {
2968
- assert (self);
2969
- # if defined (ZMQ_RCVMORE)
2970
- int major, minor, patch;
2971
- zmq_version (&major, &minor, &patch);
2972
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2973
- zsys_error ("zsock rcvmore option not supported by libzmq version %d.%d.%d, "
2974
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2975
- return 0;
2976
- }
2977
- int rcvmore;
2978
- size_t option_len = sizeof (int);
2979
- zmq_getsockopt (zsock_resolve (self), ZMQ_RCVMORE, &rcvmore, &option_len);
2980
- return rcvmore;
2981
- # else
2982
- return 0;
2983
- # endif
2984
- }
2985
-
2986
- // --------------------------------------------------------------------------
2987
- // Return socket ZMQ_FD value
2988
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2989
-
2990
- SOCKET
2991
- zsock_fd (void *self)
2992
- {
2993
- assert (self);
2994
- # if defined (ZMQ_FD)
2995
- int major, minor, patch;
2996
- zmq_version (&major, &minor, &patch);
2997
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2998
- zsys_error ("zsock fd option not supported by libzmq version %d.%d.%d, "
2999
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
3000
- return 0;
3001
- }
3002
- SOCKET fd;
3003
- size_t option_len = sizeof (SOCKET);
3004
- zmq_getsockopt (zsock_resolve (self), ZMQ_FD, &fd, &option_len);
3005
- return fd;
3006
- # else
3007
- return 0;
3008
- # endif
3009
- }
3010
-
3011
- // --------------------------------------------------------------------------
3012
- // Return socket ZMQ_EVENTS value
3013
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3014
-
3015
- int
3016
- zsock_events (void *self)
3017
- {
3018
- assert (self);
3019
- # if defined (ZMQ_EVENTS)
3020
- int major, minor, patch;
3021
- zmq_version (&major, &minor, &patch);
3022
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
3023
- zsys_error ("zsock events option not supported by libzmq version %d.%d.%d, "
3024
- "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
3025
- return 0;
3026
- }
3027
- int events;
3028
- size_t option_len = sizeof (int);
3029
- zmq_getsockopt (zsock_resolve (self), ZMQ_EVENTS, &events, &option_len);
3030
- return events;
3031
- # else
3032
- return 0;
3033
- # endif
3034
- }
3035
-
3036
2301
  // --------------------------------------------------------------------------
3037
2302
  // Return socket ZMQ_LAST_ENDPOINT value
3038
2303
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -3153,9 +2418,7 @@ zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect)
3153
2418
  }
3154
2419
 
3155
2420
 
3156
- #endif
3157
2421
 
3158
- #if (ZMQ_VERSION_MAJOR >= 2) && (ZMQ_VERSION_MAJOR < 3)
3159
2422
  // --------------------------------------------------------------------------
3160
2423
  // Set socket ZMQ_HWM value
3161
2424
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -3267,10 +2530,9 @@ zsock_set_affinity (void *self, int affinity)
3267
2530
  # if defined (ZMQ_AFFINITY)
3268
2531
  int major, minor, patch;
3269
2532
  zmq_version (&major, &minor, &patch);
3270
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3271
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2533
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3272
2534
  zsys_error ("zsock affinity option not supported by libzmq version %d.%d.%d, "
3273
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
2535
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3274
2536
  return;
3275
2537
  }
3276
2538
  uint64_t value = affinity;
@@ -3291,10 +2553,9 @@ zsock_affinity (void *self)
3291
2553
  # if defined (ZMQ_AFFINITY)
3292
2554
  int major, minor, patch;
3293
2555
  zmq_version (&major, &minor, &patch);
3294
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3295
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2556
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3296
2557
  zsys_error ("zsock affinity option not supported by libzmq version %d.%d.%d, "
3297
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
2558
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3298
2559
  return 0;
3299
2560
  }
3300
2561
  uint64_t affinity;
@@ -3317,12 +2578,18 @@ zsock_set_identity (void *self, const char * identity)
3317
2578
  # if defined (ZMQ_IDENTITY)
3318
2579
  int major, minor, patch;
3319
2580
  zmq_version (&major, &minor, &patch);
3320
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3321
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2581
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3322
2582
  zsys_error ("zsock identity option not supported by libzmq version %d.%d.%d, "
3323
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
2583
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3324
2584
  return;
3325
2585
  }
2586
+ if (zsock_type (self) != ZMQ_REQ
2587
+ && zsock_type (self) != ZMQ_REP
2588
+ && zsock_type (self) != ZMQ_DEALER
2589
+ && zsock_type (self) != ZMQ_ROUTER) {
2590
+ printf ("ZMQ_IDENTITY is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2591
+ assert (false);
2592
+ }
3326
2593
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, strlen (identity));
3327
2594
  assert (rc == 0 || zmq_errno () == ETERM);
3328
2595
  # endif
@@ -3340,10 +2607,9 @@ zsock_identity (void *self)
3340
2607
  # if defined (ZMQ_IDENTITY)
3341
2608
  int major, minor, patch;
3342
2609
  zmq_version (&major, &minor, &patch);
3343
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3344
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2610
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3345
2611
  zsys_error ("zsock identity option not supported by libzmq version %d.%d.%d, "
3346
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
2612
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3347
2613
  return 0;
3348
2614
  }
3349
2615
  size_t option_len = 255;
@@ -3366,14 +2632,17 @@ zsock_set_rate (void *self, int rate)
3366
2632
  # if defined (ZMQ_RATE)
3367
2633
  int major, minor, patch;
3368
2634
  zmq_version (&major, &minor, &patch);
3369
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3370
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2635
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3371
2636
  zsys_error ("zsock rate option not supported by libzmq version %d.%d.%d, "
3372
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
2637
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3373
2638
  return;
3374
2639
  }
2640
+ # if ZMQ_VERSION_MAJOR < 3
3375
2641
  int64_t value = rate;
3376
2642
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RATE, &value, sizeof (int64_t));
2643
+ # else
2644
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RATE, &rate, sizeof (int));
2645
+ # endif
3377
2646
  assert (rc == 0 || zmq_errno () == ETERM);
3378
2647
  # endif
3379
2648
  }
@@ -3390,16 +2659,22 @@ zsock_rate (void *self)
3390
2659
  # if defined (ZMQ_RATE)
3391
2660
  int major, minor, patch;
3392
2661
  zmq_version (&major, &minor, &patch);
3393
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3394
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2662
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3395
2663
  zsys_error ("zsock rate option not supported by libzmq version %d.%d.%d, "
3396
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
2664
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3397
2665
  return 0;
3398
2666
  }
2667
+ # if ZMQ_VERSION_MAJOR < 3
3399
2668
  int64_t rate;
3400
2669
  size_t option_len = sizeof (int64_t);
3401
2670
  zmq_getsockopt (zsock_resolve (self), ZMQ_RATE, &rate, &option_len);
3402
2671
  return (int) rate;
2672
+ # else
2673
+ int rate;
2674
+ size_t option_len = sizeof (int);
2675
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RATE, &rate, &option_len);
2676
+ return rate;
2677
+ # endif
3403
2678
  # else
3404
2679
  return 0;
3405
2680
  # endif
@@ -3416,14 +2691,17 @@ zsock_set_recovery_ivl (void *self, int recovery_ivl)
3416
2691
  # if defined (ZMQ_RECOVERY_IVL)
3417
2692
  int major, minor, patch;
3418
2693
  zmq_version (&major, &minor, &patch);
3419
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3420
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2694
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3421
2695
  zsys_error ("zsock recovery_ivl option not supported by libzmq version %d.%d.%d, "
3422
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
2696
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3423
2697
  return;
3424
2698
  }
2699
+ # if ZMQ_VERSION_MAJOR < 3
3425
2700
  int64_t value = recovery_ivl;
3426
2701
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &value, sizeof (int64_t));
2702
+ # else
2703
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, sizeof (int));
2704
+ # endif
3427
2705
  assert (rc == 0 || zmq_errno () == ETERM);
3428
2706
  # endif
3429
2707
  }
@@ -3440,16 +2718,22 @@ zsock_recovery_ivl (void *self)
3440
2718
  # if defined (ZMQ_RECOVERY_IVL)
3441
2719
  int major, minor, patch;
3442
2720
  zmq_version (&major, &minor, &patch);
3443
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3444
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2721
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3445
2722
  zsys_error ("zsock recovery_ivl option not supported by libzmq version %d.%d.%d, "
3446
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
2723
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3447
2724
  return 0;
3448
2725
  }
2726
+ # if ZMQ_VERSION_MAJOR < 3
3449
2727
  int64_t recovery_ivl;
3450
2728
  size_t option_len = sizeof (int64_t);
3451
2729
  zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
3452
2730
  return (int) recovery_ivl;
2731
+ # else
2732
+ int recovery_ivl;
2733
+ size_t option_len = sizeof (int);
2734
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
2735
+ return recovery_ivl;
2736
+ # endif
3453
2737
  # else
3454
2738
  return 0;
3455
2739
  # endif
@@ -3566,10 +2850,9 @@ zsock_set_rcvtimeo (void *self, int rcvtimeo)
3566
2850
  # if defined (ZMQ_RCVTIMEO)
3567
2851
  int major, minor, patch;
3568
2852
  zmq_version (&major, &minor, &patch);
3569
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)
3570
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2853
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)) {
3571
2854
  zsys_error ("zsock rcvtimeo option not supported by libzmq version %d.%d.%d, "
3572
- "run with libzmq >= 2.2.0 and < 3.0.0\n", major, minor, patch, NULL);
2855
+ "run with libzmq >= 2.2.0\n", major, minor, patch, NULL);
3573
2856
  return;
3574
2857
  }
3575
2858
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
@@ -3589,10 +2872,9 @@ zsock_rcvtimeo (void *self)
3589
2872
  # if defined (ZMQ_RCVTIMEO)
3590
2873
  int major, minor, patch;
3591
2874
  zmq_version (&major, &minor, &patch);
3592
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)
3593
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2875
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)) {
3594
2876
  zsys_error ("zsock rcvtimeo option not supported by libzmq version %d.%d.%d, "
3595
- "run with libzmq >= 2.2.0 and < 3.0.0\n", major, minor, patch, NULL);
2877
+ "run with libzmq >= 2.2.0\n", major, minor, patch, NULL);
3596
2878
  return 0;
3597
2879
  }
3598
2880
  int rcvtimeo;
@@ -3615,10 +2897,9 @@ zsock_set_sndtimeo (void *self, int sndtimeo)
3615
2897
  # if defined (ZMQ_SNDTIMEO)
3616
2898
  int major, minor, patch;
3617
2899
  zmq_version (&major, &minor, &patch);
3618
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)
3619
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2900
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)) {
3620
2901
  zsys_error ("zsock sndtimeo option not supported by libzmq version %d.%d.%d, "
3621
- "run with libzmq >= 2.2.0 and < 3.0.0\n", major, minor, patch, NULL);
2902
+ "run with libzmq >= 2.2.0\n", major, minor, patch, NULL);
3622
2903
  return;
3623
2904
  }
3624
2905
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
@@ -3638,10 +2919,9 @@ zsock_sndtimeo (void *self)
3638
2919
  # if defined (ZMQ_SNDTIMEO)
3639
2920
  int major, minor, patch;
3640
2921
  zmq_version (&major, &minor, &patch);
3641
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)
3642
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2922
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)) {
3643
2923
  zsys_error ("zsock sndtimeo option not supported by libzmq version %d.%d.%d, "
3644
- "run with libzmq >= 2.2.0 and < 3.0.0\n", major, minor, patch, NULL);
2924
+ "run with libzmq >= 2.2.0\n", major, minor, patch, NULL);
3645
2925
  return 0;
3646
2926
  }
3647
2927
  int sndtimeo;
@@ -3664,14 +2944,17 @@ zsock_set_sndbuf (void *self, int sndbuf)
3664
2944
  # if defined (ZMQ_SNDBUF)
3665
2945
  int major, minor, patch;
3666
2946
  zmq_version (&major, &minor, &patch);
3667
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3668
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2947
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3669
2948
  zsys_error ("zsock sndbuf option not supported by libzmq version %d.%d.%d, "
3670
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
2949
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3671
2950
  return;
3672
2951
  }
2952
+ # if ZMQ_VERSION_MAJOR < 3
3673
2953
  uint64_t value = sndbuf;
3674
2954
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDBUF, &value, sizeof (uint64_t));
2955
+ # else
2956
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, sizeof (int));
2957
+ # endif
3675
2958
  assert (rc == 0 || zmq_errno () == ETERM);
3676
2959
  # endif
3677
2960
  }
@@ -3688,16 +2971,22 @@ zsock_sndbuf (void *self)
3688
2971
  # if defined (ZMQ_SNDBUF)
3689
2972
  int major, minor, patch;
3690
2973
  zmq_version (&major, &minor, &patch);
3691
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3692
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
2974
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3693
2975
  zsys_error ("zsock sndbuf option not supported by libzmq version %d.%d.%d, "
3694
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
2976
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3695
2977
  return 0;
3696
2978
  }
2979
+ # if ZMQ_VERSION_MAJOR < 3
3697
2980
  uint64_t sndbuf;
3698
2981
  size_t option_len = sizeof (uint64_t);
3699
2982
  zmq_getsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, &option_len);
3700
2983
  return (int) sndbuf;
2984
+ # else
2985
+ int sndbuf;
2986
+ size_t option_len = sizeof (int);
2987
+ zmq_getsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, &option_len);
2988
+ return sndbuf;
2989
+ # endif
3701
2990
  # else
3702
2991
  return 0;
3703
2992
  # endif
@@ -3714,14 +3003,17 @@ zsock_set_rcvbuf (void *self, int rcvbuf)
3714
3003
  # if defined (ZMQ_RCVBUF)
3715
3004
  int major, minor, patch;
3716
3005
  zmq_version (&major, &minor, &patch);
3717
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3718
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3006
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3719
3007
  zsys_error ("zsock rcvbuf option not supported by libzmq version %d.%d.%d, "
3720
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3008
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3721
3009
  return;
3722
3010
  }
3011
+ # if ZMQ_VERSION_MAJOR < 3
3723
3012
  uint64_t value = rcvbuf;
3724
3013
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVBUF, &value, sizeof (uint64_t));
3014
+ # else
3015
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, sizeof (int));
3016
+ # endif
3725
3017
  assert (rc == 0 || zmq_errno () == ETERM);
3726
3018
  # endif
3727
3019
  }
@@ -3738,16 +3030,22 @@ zsock_rcvbuf (void *self)
3738
3030
  # if defined (ZMQ_RCVBUF)
3739
3031
  int major, minor, patch;
3740
3032
  zmq_version (&major, &minor, &patch);
3741
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3742
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3033
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3743
3034
  zsys_error ("zsock rcvbuf option not supported by libzmq version %d.%d.%d, "
3744
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3035
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3745
3036
  return 0;
3746
3037
  }
3038
+ # if ZMQ_VERSION_MAJOR < 3
3747
3039
  uint64_t rcvbuf;
3748
3040
  size_t option_len = sizeof (uint64_t);
3749
3041
  zmq_getsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, &option_len);
3750
3042
  return (int) rcvbuf;
3043
+ # else
3044
+ int rcvbuf;
3045
+ size_t option_len = sizeof (int);
3046
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, &option_len);
3047
+ return rcvbuf;
3048
+ # endif
3751
3049
  # else
3752
3050
  return 0;
3753
3051
  # endif
@@ -3764,10 +3062,9 @@ zsock_set_linger (void *self, int linger)
3764
3062
  # if defined (ZMQ_LINGER)
3765
3063
  int major, minor, patch;
3766
3064
  zmq_version (&major, &minor, &patch);
3767
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3768
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3065
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3769
3066
  zsys_error ("zsock linger option not supported by libzmq version %d.%d.%d, "
3770
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3067
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3771
3068
  return;
3772
3069
  }
3773
3070
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, sizeof (int));
@@ -3787,10 +3084,9 @@ zsock_linger (void *self)
3787
3084
  # if defined (ZMQ_LINGER)
3788
3085
  int major, minor, patch;
3789
3086
  zmq_version (&major, &minor, &patch);
3790
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3791
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3087
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3792
3088
  zsys_error ("zsock linger option not supported by libzmq version %d.%d.%d, "
3793
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3089
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3794
3090
  return 0;
3795
3091
  }
3796
3092
  int linger;
@@ -3813,10 +3109,9 @@ zsock_set_reconnect_ivl (void *self, int reconnect_ivl)
3813
3109
  # if defined (ZMQ_RECONNECT_IVL)
3814
3110
  int major, minor, patch;
3815
3111
  zmq_version (&major, &minor, &patch);
3816
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3817
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3112
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3818
3113
  zsys_error ("zsock reconnect_ivl option not supported by libzmq version %d.%d.%d, "
3819
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3114
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3820
3115
  return;
3821
3116
  }
3822
3117
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
@@ -3836,10 +3131,9 @@ zsock_reconnect_ivl (void *self)
3836
3131
  # if defined (ZMQ_RECONNECT_IVL)
3837
3132
  int major, minor, patch;
3838
3133
  zmq_version (&major, &minor, &patch);
3839
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3840
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3134
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3841
3135
  zsys_error ("zsock reconnect_ivl option not supported by libzmq version %d.%d.%d, "
3842
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3136
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3843
3137
  return 0;
3844
3138
  }
3845
3139
  int reconnect_ivl;
@@ -3862,10 +3156,9 @@ zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max)
3862
3156
  # if defined (ZMQ_RECONNECT_IVL_MAX)
3863
3157
  int major, minor, patch;
3864
3158
  zmq_version (&major, &minor, &patch);
3865
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3866
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3159
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3867
3160
  zsys_error ("zsock reconnect_ivl_max option not supported by libzmq version %d.%d.%d, "
3868
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3161
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3869
3162
  return;
3870
3163
  }
3871
3164
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
@@ -3885,10 +3178,9 @@ zsock_reconnect_ivl_max (void *self)
3885
3178
  # if defined (ZMQ_RECONNECT_IVL_MAX)
3886
3179
  int major, minor, patch;
3887
3180
  zmq_version (&major, &minor, &patch);
3888
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3889
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3181
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3890
3182
  zsys_error ("zsock reconnect_ivl_max option not supported by libzmq version %d.%d.%d, "
3891
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3183
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3892
3184
  return 0;
3893
3185
  }
3894
3186
  int reconnect_ivl_max;
@@ -3911,10 +3203,9 @@ zsock_set_backlog (void *self, int backlog)
3911
3203
  # if defined (ZMQ_BACKLOG)
3912
3204
  int major, minor, patch;
3913
3205
  zmq_version (&major, &minor, &patch);
3914
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3915
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3206
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3916
3207
  zsys_error ("zsock backlog option not supported by libzmq version %d.%d.%d, "
3917
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3208
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3918
3209
  return;
3919
3210
  }
3920
3211
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, sizeof (int));
@@ -3934,10 +3225,9 @@ zsock_backlog (void *self)
3934
3225
  # if defined (ZMQ_BACKLOG)
3935
3226
  int major, minor, patch;
3936
3227
  zmq_version (&major, &minor, &patch);
3937
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3938
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3228
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3939
3229
  zsys_error ("zsock backlog option not supported by libzmq version %d.%d.%d, "
3940
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3230
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3941
3231
  return 0;
3942
3232
  }
3943
3233
  int backlog;
@@ -3960,10 +3250,9 @@ zsock_set_subscribe (void *self, const char * subscribe)
3960
3250
  # if defined (ZMQ_SUBSCRIBE)
3961
3251
  int major, minor, patch;
3962
3252
  zmq_version (&major, &minor, &patch);
3963
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3964
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3253
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3965
3254
  zsys_error ("zsock subscribe option not supported by libzmq version %d.%d.%d, "
3966
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3255
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3967
3256
  return;
3968
3257
  }
3969
3258
  if (zsock_type (self) != ZMQ_SUB) {
@@ -3987,10 +3276,9 @@ zsock_set_unsubscribe (void *self, const char * unsubscribe)
3987
3276
  # if defined (ZMQ_UNSUBSCRIBE)
3988
3277
  int major, minor, patch;
3989
3278
  zmq_version (&major, &minor, &patch);
3990
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3991
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3279
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
3992
3280
  zsys_error ("zsock unsubscribe option not supported by libzmq version %d.%d.%d, "
3993
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3281
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
3994
3282
  return;
3995
3283
  }
3996
3284
  if (zsock_type (self) != ZMQ_SUB) {
@@ -4014,10 +3302,9 @@ zsock_type (void *self)
4014
3302
  # if defined (ZMQ_TYPE)
4015
3303
  int major, minor, patch;
4016
3304
  zmq_version (&major, &minor, &patch);
4017
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
4018
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3305
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
4019
3306
  zsys_error ("zsock type option not supported by libzmq version %d.%d.%d, "
4020
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3307
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
4021
3308
  return 0;
4022
3309
  }
4023
3310
  int type;
@@ -4040,16 +3327,22 @@ zsock_rcvmore (void *self)
4040
3327
  # if defined (ZMQ_RCVMORE)
4041
3328
  int major, minor, patch;
4042
3329
  zmq_version (&major, &minor, &patch);
4043
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
4044
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3330
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
4045
3331
  zsys_error ("zsock rcvmore option not supported by libzmq version %d.%d.%d, "
4046
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3332
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
4047
3333
  return 0;
4048
3334
  }
3335
+ # if ZMQ_VERSION_MAJOR < 3
4049
3336
  int64_t rcvmore;
4050
3337
  size_t option_len = sizeof (int64_t);
4051
3338
  zmq_getsockopt (zsock_resolve (self), ZMQ_RCVMORE, &rcvmore, &option_len);
4052
3339
  return (int) rcvmore;
3340
+ # else
3341
+ int rcvmore;
3342
+ size_t option_len = sizeof (int);
3343
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVMORE, &rcvmore, &option_len);
3344
+ return rcvmore;
3345
+ # endif
4053
3346
  # else
4054
3347
  return 0;
4055
3348
  # endif
@@ -4066,10 +3359,9 @@ zsock_fd (void *self)
4066
3359
  # if defined (ZMQ_FD)
4067
3360
  int major, minor, patch;
4068
3361
  zmq_version (&major, &minor, &patch);
4069
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
4070
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3362
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
4071
3363
  zsys_error ("zsock fd option not supported by libzmq version %d.%d.%d, "
4072
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3364
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
4073
3365
  return 0;
4074
3366
  }
4075
3367
  SOCKET fd;
@@ -4092,22 +3384,27 @@ zsock_events (void *self)
4092
3384
  # if defined (ZMQ_EVENTS)
4093
3385
  int major, minor, patch;
4094
3386
  zmq_version (&major, &minor, &patch);
4095
- if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
4096
- || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3387
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)) {
4097
3388
  zsys_error ("zsock events option not supported by libzmq version %d.%d.%d, "
4098
- "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3389
+ "run with libzmq >= 2.0.0\n", major, minor, patch, NULL);
4099
3390
  return 0;
4100
3391
  }
3392
+ # if ZMQ_VERSION_MAJOR < 3
4101
3393
  uint32_t events;
4102
3394
  size_t option_len = sizeof (uint32_t);
4103
3395
  zmq_getsockopt (zsock_resolve (self), ZMQ_EVENTS, &events, &option_len);
4104
3396
  return (int) events;
3397
+ # else
3398
+ int events;
3399
+ size_t option_len = sizeof (int);
3400
+ zmq_getsockopt (zsock_resolve (self), ZMQ_EVENTS, &events, &option_len);
3401
+ return events;
3402
+ # endif
4105
3403
  # else
4106
3404
  return 0;
4107
3405
  # endif
4108
3406
  }
4109
3407
 
4110
- #endif
4111
3408
 
4112
3409
  // --------------------------------------------------------------------------
4113
3410
  // Selftest
@@ -4255,7 +3552,7 @@ zsock_option_test (bool verbose)
4255
3552
  zsock_set_socks_proxy (self, "127.0.0.1");
4256
3553
  char *socks_proxy = zsock_socks_proxy (self);
4257
3554
  assert (socks_proxy);
4258
- free (socks_proxy);
3555
+ freen (socks_proxy);
4259
3556
  zsock_destroy (&self);
4260
3557
  # endif
4261
3558
  # if defined (ZMQ_XPUB_NODROP)
@@ -4304,7 +3601,7 @@ zsock_option_test (bool verbose)
4304
3601
  zsock_set_zap_domain (self, "test");
4305
3602
  char *zap_domain = zsock_zap_domain (self);
4306
3603
  assert (zap_domain);
4307
- free (zap_domain);
3604
+ freen (zap_domain);
4308
3605
  zsock_destroy (&self);
4309
3606
  # endif
4310
3607
  # if defined (ZMQ_MECHANISM)
@@ -4327,7 +3624,7 @@ zsock_option_test (bool verbose)
4327
3624
  zsock_set_plain_username (self, "test");
4328
3625
  char *plain_username = zsock_plain_username (self);
4329
3626
  assert (plain_username);
4330
- free (plain_username);
3627
+ freen (plain_username);
4331
3628
  zsock_destroy (&self);
4332
3629
  # endif
4333
3630
  # if defined (ZMQ_PLAIN_PASSWORD)
@@ -4336,7 +3633,7 @@ zsock_option_test (bool verbose)
4336
3633
  zsock_set_plain_password (self, "test");
4337
3634
  char *plain_password = zsock_plain_password (self);
4338
3635
  assert (plain_password);
4339
- free (plain_password);
3636
+ freen (plain_password);
4340
3637
  zsock_destroy (&self);
4341
3638
  # endif
4342
3639
  # if defined (ZMQ_IPV6)
@@ -4358,12 +3655,6 @@ zsock_option_test (bool verbose)
4358
3655
  #endif
4359
3656
 
4360
3657
  #if (ZMQ_VERSION_MAJOR >= 3)
4361
- # if defined (ZMQ_TYPE)
4362
- self = zsock_new (ZMQ_SUB);
4363
- assert (self);
4364
- zsock_type (self);
4365
- zsock_destroy (&self);
4366
- # endif
4367
3658
  # if defined (ZMQ_SNDHWM)
4368
3659
  self = zsock_new (ZMQ_PUB);
4369
3660
  assert (self);
@@ -4380,99 +3671,6 @@ zsock_option_test (bool verbose)
4380
3671
  zsock_rcvhwm (self);
4381
3672
  zsock_destroy (&self);
4382
3673
  # endif
4383
- # if defined (ZMQ_AFFINITY)
4384
- self = zsock_new (ZMQ_SUB);
4385
- assert (self);
4386
- zsock_set_affinity (self, 1);
4387
- assert (zsock_affinity (self) == 1);
4388
- zsock_affinity (self);
4389
- zsock_destroy (&self);
4390
- # endif
4391
- # if defined (ZMQ_SUBSCRIBE)
4392
- self = zsock_new (ZMQ_SUB);
4393
- assert (self);
4394
- zsock_set_subscribe (self, "test");
4395
- zsock_destroy (&self);
4396
- # endif
4397
- # if defined (ZMQ_UNSUBSCRIBE)
4398
- self = zsock_new (ZMQ_SUB);
4399
- assert (self);
4400
- zsock_set_unsubscribe (self, "test");
4401
- zsock_destroy (&self);
4402
- # endif
4403
- # if defined (ZMQ_IDENTITY)
4404
- self = zsock_new (ZMQ_DEALER);
4405
- assert (self);
4406
- zsock_set_identity (self, "test");
4407
- char *identity = zsock_identity (self);
4408
- assert (identity);
4409
- free (identity);
4410
- zsock_destroy (&self);
4411
- # endif
4412
- # if defined (ZMQ_RATE)
4413
- self = zsock_new (ZMQ_SUB);
4414
- assert (self);
4415
- zsock_set_rate (self, 1);
4416
- assert (zsock_rate (self) == 1);
4417
- zsock_rate (self);
4418
- zsock_destroy (&self);
4419
- # endif
4420
- # if defined (ZMQ_RECOVERY_IVL)
4421
- self = zsock_new (ZMQ_SUB);
4422
- assert (self);
4423
- zsock_set_recovery_ivl (self, 1);
4424
- assert (zsock_recovery_ivl (self) == 1);
4425
- zsock_recovery_ivl (self);
4426
- zsock_destroy (&self);
4427
- # endif
4428
- # if defined (ZMQ_SNDBUF)
4429
- self = zsock_new (ZMQ_PUB);
4430
- assert (self);
4431
- zsock_set_sndbuf (self, 1);
4432
- assert (zsock_sndbuf (self) == 1);
4433
- zsock_sndbuf (self);
4434
- zsock_destroy (&self);
4435
- # endif
4436
- # if defined (ZMQ_RCVBUF)
4437
- self = zsock_new (ZMQ_SUB);
4438
- assert (self);
4439
- zsock_set_rcvbuf (self, 1);
4440
- assert (zsock_rcvbuf (self) == 1);
4441
- zsock_rcvbuf (self);
4442
- zsock_destroy (&self);
4443
- # endif
4444
- # if defined (ZMQ_LINGER)
4445
- self = zsock_new (ZMQ_SUB);
4446
- assert (self);
4447
- zsock_set_linger (self, 1);
4448
- assert (zsock_linger (self) == 1);
4449
- zsock_linger (self);
4450
- zsock_destroy (&self);
4451
- # endif
4452
- # if defined (ZMQ_RECONNECT_IVL)
4453
- self = zsock_new (ZMQ_SUB);
4454
- assert (self);
4455
- zsock_set_reconnect_ivl (self, 1);
4456
- assert (zsock_reconnect_ivl (self) == 1);
4457
- zsock_reconnect_ivl (self);
4458
- zsock_destroy (&self);
4459
- # endif
4460
- # if defined (ZMQ_RECONNECT_IVL_MAX)
4461
- self = zsock_new (ZMQ_SUB);
4462
- assert (self);
4463
- zsock_set_reconnect_ivl_max (self, 1);
4464
- assert (zsock_reconnect_ivl_max (self) == 1);
4465
- zsock_reconnect_ivl_max (self);
4466
- zsock_destroy (&self);
4467
- # endif
4468
- # if defined (ZMQ_BACKLOG)
4469
- self = zsock_new (ZMQ_SUB);
4470
- assert (self);
4471
- zsock_set_backlog (self, 1);
4472
- assert (zsock_backlog (self) == 1);
4473
- zsock_backlog (self);
4474
- zsock_destroy (&self);
4475
- # endif
4476
3674
  # if defined (ZMQ_MAXMSGSIZE)
4477
3675
  self = zsock_new (ZMQ_SUB);
4478
3676
  assert (self);
@@ -4489,22 +3687,6 @@ zsock_option_test (bool verbose)
4489
3687
  zsock_multicast_hops (self);
4490
3688
  zsock_destroy (&self);
4491
3689
  # endif
4492
- # if defined (ZMQ_RCVTIMEO)
4493
- self = zsock_new (ZMQ_SUB);
4494
- assert (self);
4495
- zsock_set_rcvtimeo (self, 1);
4496
- assert (zsock_rcvtimeo (self) == 1);
4497
- zsock_rcvtimeo (self);
4498
- zsock_destroy (&self);
4499
- # endif
4500
- # if defined (ZMQ_SNDTIMEO)
4501
- self = zsock_new (ZMQ_SUB);
4502
- assert (self);
4503
- zsock_set_sndtimeo (self, 1);
4504
- assert (zsock_sndtimeo (self) == 1);
4505
- zsock_sndtimeo (self);
4506
- zsock_destroy (&self);
4507
- # endif
4508
3690
  # if defined (ZMQ_XPUB_VERBOSE)
4509
3691
  self = zsock_new (ZMQ_XPUB);
4510
3692
  assert (self);
@@ -4549,25 +3731,7 @@ zsock_option_test (bool verbose)
4549
3731
  zsock_set_tcp_accept_filter (self, "127.0.0.1");
4550
3732
  char *tcp_accept_filter = zsock_tcp_accept_filter (self);
4551
3733
  assert (tcp_accept_filter);
4552
- free (tcp_accept_filter);
4553
- zsock_destroy (&self);
4554
- # endif
4555
- # if defined (ZMQ_RCVMORE)
4556
- self = zsock_new (ZMQ_SUB);
4557
- assert (self);
4558
- zsock_rcvmore (self);
4559
- zsock_destroy (&self);
4560
- # endif
4561
- # if defined (ZMQ_FD)
4562
- self = zsock_new (ZMQ_SUB);
4563
- assert (self);
4564
- zsock_fd (self);
4565
- zsock_destroy (&self);
4566
- # endif
4567
- # if defined (ZMQ_EVENTS)
4568
- self = zsock_new (ZMQ_SUB);
4569
- assert (self);
4570
- zsock_events (self);
3734
+ freen (tcp_accept_filter);
4571
3735
  zsock_destroy (&self);
4572
3736
  # endif
4573
3737
  # if defined (ZMQ_LAST_ENDPOINT)
@@ -4575,7 +3739,7 @@ zsock_option_test (bool verbose)
4575
3739
  assert (self);
4576
3740
  char *last_endpoint = zsock_last_endpoint (self);
4577
3741
  assert (last_endpoint);
4578
- free (last_endpoint);
3742
+ freen (last_endpoint);
4579
3743
  zsock_destroy (&self);
4580
3744
  # endif
4581
3745
  # if defined (ZMQ_ROUTER_RAW)
@@ -4600,7 +3764,8 @@ zsock_option_test (bool verbose)
4600
3764
  # endif
4601
3765
  #endif
4602
3766
 
4603
- #if (ZMQ_VERSION_MAJOR >= 2) && (ZMQ_VERSION_MAJOR < 3)
3767
+ #if (ZMQ_VERSION_MAJOR >= 2)
3768
+ # if (ZMQ_VERSION_MAJOR < 3)
4604
3769
  # if defined (ZMQ_HWM)
4605
3770
  self = zsock_new (ZMQ_SUB);
4606
3771
  assert (self);
@@ -4609,6 +3774,8 @@ zsock_option_test (bool verbose)
4609
3774
  zsock_hwm (self);
4610
3775
  zsock_destroy (&self);
4611
3776
  # endif
3777
+ # endif
3778
+ # if (ZMQ_VERSION_MAJOR < 3)
4612
3779
  # if defined (ZMQ_SWAP)
4613
3780
  self = zsock_new (ZMQ_SUB);
4614
3781
  assert (self);
@@ -4617,6 +3784,7 @@ zsock_option_test (bool verbose)
4617
3784
  zsock_swap (self);
4618
3785
  zsock_destroy (&self);
4619
3786
  # endif
3787
+ # endif
4620
3788
  # if defined (ZMQ_AFFINITY)
4621
3789
  self = zsock_new (ZMQ_SUB);
4622
3790
  assert (self);
@@ -4626,12 +3794,12 @@ zsock_option_test (bool verbose)
4626
3794
  zsock_destroy (&self);
4627
3795
  # endif
4628
3796
  # if defined (ZMQ_IDENTITY)
4629
- self = zsock_new (ZMQ_SUB);
3797
+ self = zsock_new (ZMQ_DEALER);
4630
3798
  assert (self);
4631
3799
  zsock_set_identity (self, "test");
4632
3800
  char *identity = zsock_identity (self);
4633
3801
  assert (identity);
4634
- free (identity);
3802
+ freen (identity);
4635
3803
  zsock_destroy (&self);
4636
3804
  # endif
4637
3805
  # if defined (ZMQ_RATE)
@@ -4650,6 +3818,7 @@ zsock_option_test (bool verbose)
4650
3818
  zsock_recovery_ivl (self);
4651
3819
  zsock_destroy (&self);
4652
3820
  # endif
3821
+ # if (ZMQ_VERSION_MAJOR < 3)
4653
3822
  # if defined (ZMQ_RECOVERY_IVL_MSEC)
4654
3823
  self = zsock_new (ZMQ_SUB);
4655
3824
  assert (self);
@@ -4658,6 +3827,8 @@ zsock_option_test (bool verbose)
4658
3827
  zsock_recovery_ivl_msec (self);
4659
3828
  zsock_destroy (&self);
4660
3829
  # endif
3830
+ # endif
3831
+ # if (ZMQ_VERSION_MAJOR < 3)
4661
3832
  # if defined (ZMQ_MCAST_LOOP)
4662
3833
  self = zsock_new (ZMQ_SUB);
4663
3834
  assert (self);
@@ -4666,6 +3837,7 @@ zsock_option_test (bool verbose)
4666
3837
  zsock_mcast_loop (self);
4667
3838
  zsock_destroy (&self);
4668
3839
  # endif
3840
+ # endif
4669
3841
  # if defined (ZMQ_RCVTIMEO)
4670
3842
  self = zsock_new (ZMQ_SUB);
4671
3843
  assert (self);