rbczmq 1.6.2 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (398) hide show
  1. data/.gitignore +4 -3
  2. data/.gitmodules +6 -0
  3. data/.travis.yml +5 -1
  4. data/CHANGELOG.rdoc +15 -0
  5. data/Gemfile.lock +2 -2
  6. data/README.rdoc +5 -2
  7. data/Rakefile +8 -3
  8. data/ext/czmq/.gitignore +52 -0
  9. data/ext/czmq/.travis.yml +18 -0
  10. data/ext/czmq/AUTHORS +9 -0
  11. data/ext/czmq/COPYING +674 -0
  12. data/ext/czmq/COPYING.LESSER +178 -0
  13. data/ext/czmq/ChangeLog +0 -0
  14. data/ext/czmq/Makefile.am +22 -0
  15. data/ext/czmq/NEWS +263 -0
  16. data/ext/czmq/README +0 -0
  17. data/ext/czmq/README.md +1122 -0
  18. data/ext/czmq/README.txt +327 -0
  19. data/ext/czmq/autogen.sh +46 -0
  20. data/ext/czmq/builds/android/Android.mk +35 -0
  21. data/ext/czmq/builds/android/Application.mk +1 -0
  22. data/ext/czmq/builds/android/build.sh +59 -0
  23. data/ext/czmq/builds/android/clean.sh +26 -0
  24. data/ext/czmq/builds/mingw32/Makefile.mingw32 +38 -0
  25. data/ext/czmq/builds/mingw32/platform.h +0 -0
  26. data/ext/czmq/builds/msvc/.gitignore +18 -0
  27. data/ext/czmq/builds/msvc/README.txt +17 -0
  28. data/ext/czmq/builds/msvc/czmq.sln +69 -0
  29. data/ext/czmq/builds/msvc/czmq.vcproj +2246 -0
  30. data/ext/czmq/builds/msvc/czmq.vcxproj +329 -0
  31. data/ext/czmq/builds/msvc/czmq.vcxproj.filters +117 -0
  32. data/ext/czmq/builds/msvc/czmq11.sln +36 -0
  33. data/ext/czmq/builds/msvc/czmq_selftest.vcproj +840 -0
  34. data/ext/czmq/builds/msvc/czmq_selftest.vcxproj +189 -0
  35. data/ext/czmq/builds/msvc/czmq_selftest.vcxproj.filters +14 -0
  36. data/ext/czmq/c +520 -0
  37. data/ext/czmq/configure.ac +229 -0
  38. data/ext/czmq/doc/Makefile.am +49 -0
  39. data/ext/czmq/doc/asciidoc.conf +57 -0
  40. data/ext/czmq/doc/czmq.txt +334 -0
  41. data/ext/czmq/doc/mkman +100 -0
  42. data/ext/czmq/doc/mksite +65 -0
  43. data/ext/czmq/doc/wdput +43 -0
  44. data/ext/czmq/doc/xml2wd.pl +242 -0
  45. data/ext/czmq/doc/zbeacon.txt +173 -0
  46. data/ext/czmq/doc/zclock.txt +51 -0
  47. data/ext/czmq/doc/zconfig.txt +92 -0
  48. data/ext/czmq/doc/zctx.txt +111 -0
  49. data/ext/czmq/doc/zfile.txt +77 -0
  50. data/ext/czmq/doc/zframe.txt +222 -0
  51. data/ext/czmq/doc/zhash.txt +225 -0
  52. data/ext/czmq/doc/zlist.txt +176 -0
  53. data/ext/czmq/doc/zloop.txt +106 -0
  54. data/ext/czmq/doc/zmsg.txt +315 -0
  55. data/ext/czmq/doc/zmutex.txt +54 -0
  56. data/ext/czmq/doc/zsocket.txt +110 -0
  57. data/ext/czmq/doc/zsockopt.txt +528 -0
  58. data/ext/czmq/doc/zstr.txt +80 -0
  59. data/ext/czmq/doc/zsys.txt +44 -0
  60. data/ext/czmq/doc/zthread.txt +126 -0
  61. data/ext/czmq/doc/ztree.txt +236 -0
  62. data/ext/czmq/images/README_1.png +0 -0
  63. data/ext/czmq/images/README_2.png +0 -0
  64. data/ext/czmq/include/czmq.h +64 -0
  65. data/ext/czmq/include/czmq_prelude.h +504 -0
  66. data/ext/czmq/include/zbeacon.h +91 -0
  67. data/ext/czmq/include/zclock.h +56 -0
  68. data/ext/czmq/include/zconfig.h +117 -0
  69. data/ext/czmq/include/zctx.h +96 -0
  70. data/ext/czmq/include/zfile.h +82 -0
  71. data/ext/czmq/include/zframe.h +145 -0
  72. data/ext/czmq/include/zhash.h +127 -0
  73. data/ext/czmq/include/zlist.h +113 -0
  74. data/ext/czmq/include/zloop.h +98 -0
  75. data/ext/czmq/include/zmsg.h +165 -0
  76. data/ext/czmq/include/zmutex.h +62 -0
  77. data/ext/czmq/include/zsocket.h +104 -0
  78. data/ext/czmq/include/zsockopt.h +249 -0
  79. data/ext/czmq/include/zstr.h +69 -0
  80. data/ext/czmq/include/zsys.h +66 -0
  81. data/ext/czmq/include/zthread.h +62 -0
  82. data/ext/czmq/include/ztree.h +133 -0
  83. data/ext/czmq/mkdoc +14 -0
  84. data/ext/czmq/model/generate +2 -0
  85. data/ext/czmq/model/sockopts.xml +101 -0
  86. data/ext/czmq/notes.txt +21 -0
  87. data/ext/czmq/scripts/sockopts.gsl +325 -0
  88. data/ext/czmq/src/Makefile.am +61 -0
  89. data/ext/czmq/src/czmq_selftest.c +60 -0
  90. data/ext/czmq/src/libczmq.pc.in +11 -0
  91. data/ext/czmq/src/selftest +7 -0
  92. data/ext/czmq/src/selftest.cfg +5 -0
  93. data/ext/czmq/src/valgrind.supp +14 -0
  94. data/ext/czmq/src/vg +2 -0
  95. data/ext/czmq/src/zbeacon.c +787 -0
  96. data/ext/czmq/src/zclock.c +143 -0
  97. data/ext/czmq/src/zconfig.c +691 -0
  98. data/ext/czmq/src/zctx.c +287 -0
  99. data/ext/czmq/src/zfile.c +237 -0
  100. data/ext/czmq/src/zframe.c +551 -0
  101. data/ext/czmq/src/zhash.c +664 -0
  102. data/ext/czmq/src/zlist.c +459 -0
  103. data/ext/czmq/src/zloop.c +496 -0
  104. data/ext/czmq/src/zmsg.c +854 -0
  105. data/ext/czmq/src/zmutex.c +134 -0
  106. data/ext/czmq/src/zsocket.c +313 -0
  107. data/ext/czmq/src/zsockopt.c +1756 -0
  108. data/ext/czmq/src/zstr.c +297 -0
  109. data/ext/czmq/src/zsys.c +136 -0
  110. data/ext/czmq/src/zthread.c +269 -0
  111. data/ext/czmq/src/ztree.c +888 -0
  112. data/ext/czmq/version.sh +21 -0
  113. data/ext/rbczmq/extconf.rb +1 -18
  114. data/ext/rbczmq/poller.c +4 -1
  115. data/ext/rbczmq/socket.c +28 -5
  116. data/ext/rbczmq/socket.h +1 -0
  117. data/ext/zeromq/AUTHORS +110 -0
  118. data/ext/zeromq/CMakeLists.txt +392 -0
  119. data/ext/zeromq/COPYING +674 -0
  120. data/ext/zeromq/COPYING.LESSER +179 -0
  121. data/ext/zeromq/INSTALL +246 -0
  122. data/ext/zeromq/MAINTAINERS +56 -0
  123. data/ext/zeromq/Makefile.am +40 -0
  124. data/ext/zeromq/NEWS +333 -0
  125. data/ext/zeromq/README +39 -0
  126. data/ext/zeromq/acinclude.m4 +930 -0
  127. data/ext/zeromq/autogen.sh +45 -0
  128. data/ext/zeromq/branding.bmp +0 -0
  129. data/ext/zeromq/builds/msvc/Makefile.am +33 -0
  130. data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat.vcproj +176 -0
  131. data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat.vcxproj +87 -0
  132. data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcproj +176 -0
  133. data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcxproj +87 -0
  134. data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat.vcproj +176 -0
  135. data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat.vcxproj +87 -0
  136. data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcproj +176 -0
  137. data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcxproj +87 -0
  138. data/ext/zeromq/builds/msvc/errno.cpp +32 -0
  139. data/ext/zeromq/builds/msvc/errno.hpp +56 -0
  140. data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcproj +174 -0
  141. data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcxproj +86 -0
  142. data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcproj +174 -0
  143. data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcxproj +86 -0
  144. data/ext/zeromq/builds/msvc/libzmq/libzmq.vcproj +804 -0
  145. data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj +252 -0
  146. data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj.filters +431 -0
  147. data/ext/zeromq/builds/msvc/msvc.sln +89 -0
  148. data/ext/zeromq/builds/msvc/msvc10.sln +116 -0
  149. data/ext/zeromq/builds/msvc/platform.hpp +32 -0
  150. data/ext/zeromq/builds/msvc/properties/Common.props +21 -0
  151. data/ext/zeromq/builds/msvc/properties/Debug.props +19 -0
  152. data/ext/zeromq/builds/msvc/properties/Dynamic.props +20 -0
  153. data/ext/zeromq/builds/msvc/properties/Executable.props +19 -0
  154. data/ext/zeromq/builds/msvc/properties/Precompiled.props +14 -0
  155. data/ext/zeromq/builds/msvc/properties/Release.props +22 -0
  156. data/ext/zeromq/builds/msvc/properties/Win32.props +12 -0
  157. data/ext/zeromq/builds/msvc/properties/Win32_Release.props +17 -0
  158. data/ext/zeromq/builds/msvc/properties/WithOpenPGM.props +12 -0
  159. data/ext/zeromq/builds/msvc/properties/ZeroMQ.props +23 -0
  160. data/ext/zeromq/builds/msvc/properties/x64.props +12 -0
  161. data/ext/zeromq/builds/redhat/zeromq.spec.in +160 -0
  162. data/ext/zeromq/builds/valgrind/valgrind.supp +14 -0
  163. data/ext/zeromq/builds/valgrind/vg +1 -0
  164. data/ext/zeromq/cmake/Modules/TestZMQVersion.cmake +35 -0
  165. data/ext/zeromq/cmake/Modules/zmq_version.cpp +31 -0
  166. data/ext/zeromq/cmake/NSIS.template32.in +952 -0
  167. data/ext/zeromq/cmake/NSIS.template64.in +960 -0
  168. data/ext/zeromq/configure.in +428 -0
  169. data/ext/zeromq/doc/Makefile.am +51 -0
  170. data/ext/zeromq/doc/asciidoc.conf +56 -0
  171. data/ext/zeromq/doc/zmq.txt +233 -0
  172. data/ext/zeromq/doc/zmq_bind.txt +102 -0
  173. data/ext/zeromq/doc/zmq_close.txt +52 -0
  174. data/ext/zeromq/doc/zmq_connect.txt +98 -0
  175. data/ext/zeromq/doc/zmq_ctx_destroy.txt +66 -0
  176. data/ext/zeromq/doc/zmq_ctx_get.txt +67 -0
  177. data/ext/zeromq/doc/zmq_ctx_new.txt +49 -0
  178. data/ext/zeromq/doc/zmq_ctx_set.txt +75 -0
  179. data/ext/zeromq/doc/zmq_disconnect.txt +67 -0
  180. data/ext/zeromq/doc/zmq_epgm.txt +162 -0
  181. data/ext/zeromq/doc/zmq_errno.txt +50 -0
  182. data/ext/zeromq/doc/zmq_getsockopt.txt +516 -0
  183. data/ext/zeromq/doc/zmq_init.txt +52 -0
  184. data/ext/zeromq/doc/zmq_inproc.txt +85 -0
  185. data/ext/zeromq/doc/zmq_ipc.txt +85 -0
  186. data/ext/zeromq/doc/zmq_msg_close.txt +55 -0
  187. data/ext/zeromq/doc/zmq_msg_copy.txt +57 -0
  188. data/ext/zeromq/doc/zmq_msg_data.txt +48 -0
  189. data/ext/zeromq/doc/zmq_msg_get.txt +72 -0
  190. data/ext/zeromq/doc/zmq_msg_init.txt +65 -0
  191. data/ext/zeromq/doc/zmq_msg_init_data.txt +85 -0
  192. data/ext/zeromq/doc/zmq_msg_init_size.txt +58 -0
  193. data/ext/zeromq/doc/zmq_msg_more.txt +63 -0
  194. data/ext/zeromq/doc/zmq_msg_move.txt +52 -0
  195. data/ext/zeromq/doc/zmq_msg_recv.txt +125 -0
  196. data/ext/zeromq/doc/zmq_msg_send.txt +122 -0
  197. data/ext/zeromq/doc/zmq_msg_set.txt +45 -0
  198. data/ext/zeromq/doc/zmq_msg_size.txt +48 -0
  199. data/ext/zeromq/doc/zmq_pgm.txt +162 -0
  200. data/ext/zeromq/doc/zmq_poll.txt +132 -0
  201. data/ext/zeromq/doc/zmq_proxy.txt +97 -0
  202. data/ext/zeromq/doc/zmq_recv.txt +93 -0
  203. data/ext/zeromq/doc/zmq_recvmsg.txt +123 -0
  204. data/ext/zeromq/doc/zmq_send.txt +100 -0
  205. data/ext/zeromq/doc/zmq_sendmsg.txt +119 -0
  206. data/ext/zeromq/doc/zmq_setsockopt.txt +523 -0
  207. data/ext/zeromq/doc/zmq_socket.txt +369 -0
  208. data/ext/zeromq/doc/zmq_socket_monitor.txt +288 -0
  209. data/ext/zeromq/doc/zmq_strerror.txt +55 -0
  210. data/ext/zeromq/doc/zmq_tcp.txt +101 -0
  211. data/ext/zeromq/doc/zmq_term.txt +66 -0
  212. data/ext/zeromq/doc/zmq_unbind.txt +65 -0
  213. data/ext/zeromq/doc/zmq_version.txt +53 -0
  214. data/ext/zeromq/foreign/openpgm/Makefile.am +8 -0
  215. data/ext/zeromq/foreign/openpgm/libpgm-5.1.118~dfsg.tar.gz +0 -0
  216. data/ext/zeromq/include/zmq.h +402 -0
  217. data/ext/zeromq/include/zmq_utils.h +64 -0
  218. data/ext/zeromq/installer.ico +0 -0
  219. data/ext/zeromq/perf/Makefile.am +22 -0
  220. data/ext/zeromq/perf/inproc_lat.cpp +233 -0
  221. data/ext/zeromq/perf/inproc_thr.cpp +241 -0
  222. data/ext/zeromq/perf/local_lat.cpp +109 -0
  223. data/ext/zeromq/perf/local_thr.cpp +133 -0
  224. data/ext/zeromq/perf/remote_lat.cpp +122 -0
  225. data/ext/zeromq/perf/remote_thr.cpp +105 -0
  226. data/ext/zeromq/src/Makefile.am +171 -0
  227. data/ext/zeromq/src/address.cpp +78 -0
  228. data/ext/zeromq/src/address.hpp +52 -0
  229. data/ext/zeromq/src/array.hpp +155 -0
  230. data/ext/zeromq/src/atomic_counter.hpp +197 -0
  231. data/ext/zeromq/src/atomic_ptr.hpp +196 -0
  232. data/ext/zeromq/src/blob.hpp +129 -0
  233. data/ext/zeromq/src/clock.cpp +147 -0
  234. data/ext/zeromq/src/clock.hpp +60 -0
  235. data/ext/zeromq/src/command.hpp +154 -0
  236. data/ext/zeromq/src/config.hpp +89 -0
  237. data/ext/zeromq/src/ctx.cpp +352 -0
  238. data/ext/zeromq/src/ctx.hpp +173 -0
  239. data/ext/zeromq/src/dealer.cpp +133 -0
  240. data/ext/zeromq/src/dealer.hpp +92 -0
  241. data/ext/zeromq/src/decoder.cpp +166 -0
  242. data/ext/zeromq/src/decoder.hpp +248 -0
  243. data/ext/zeromq/src/devpoll.cpp +190 -0
  244. data/ext/zeromq/src/devpoll.hpp +105 -0
  245. data/ext/zeromq/src/dist.cpp +194 -0
  246. data/ext/zeromq/src/dist.hpp +105 -0
  247. data/ext/zeromq/src/encoder.cpp +102 -0
  248. data/ext/zeromq/src/encoder.hpp +200 -0
  249. data/ext/zeromq/src/epoll.cpp +178 -0
  250. data/ext/zeromq/src/epoll.hpp +101 -0
  251. data/ext/zeromq/src/err.cpp +291 -0
  252. data/ext/zeromq/src/err.hpp +155 -0
  253. data/ext/zeromq/src/fd.hpp +45 -0
  254. data/ext/zeromq/src/fq.cpp +141 -0
  255. data/ext/zeromq/src/fq.hpp +74 -0
  256. data/ext/zeromq/src/i_decoder.hpp +49 -0
  257. data/ext/zeromq/src/i_encoder.hpp +55 -0
  258. data/ext/zeromq/src/i_engine.hpp +55 -0
  259. data/ext/zeromq/src/i_msg_sink.hpp +43 -0
  260. data/ext/zeromq/src/i_msg_source.hpp +44 -0
  261. data/ext/zeromq/src/i_poll_events.hpp +47 -0
  262. data/ext/zeromq/src/io_object.cpp +108 -0
  263. data/ext/zeromq/src/io_object.hpp +81 -0
  264. data/ext/zeromq/src/io_thread.cpp +104 -0
  265. data/ext/zeromq/src/io_thread.hpp +91 -0
  266. data/ext/zeromq/src/ip.cpp +109 -0
  267. data/ext/zeromq/src/ip.hpp +41 -0
  268. data/ext/zeromq/src/ipc_address.cpp +84 -0
  269. data/ext/zeromq/src/ipc_address.hpp +67 -0
  270. data/ext/zeromq/src/ipc_connecter.cpp +265 -0
  271. data/ext/zeromq/src/ipc_connecter.hpp +128 -0
  272. data/ext/zeromq/src/ipc_listener.cpp +206 -0
  273. data/ext/zeromq/src/ipc_listener.hpp +99 -0
  274. data/ext/zeromq/src/kqueue.cpp +201 -0
  275. data/ext/zeromq/src/kqueue.hpp +107 -0
  276. data/ext/zeromq/src/lb.cpp +148 -0
  277. data/ext/zeromq/src/lb.hpp +73 -0
  278. data/ext/zeromq/src/libzmq.pc.in +10 -0
  279. data/ext/zeromq/src/likely.hpp +33 -0
  280. data/ext/zeromq/src/mailbox.cpp +87 -0
  281. data/ext/zeromq/src/mailbox.hpp +75 -0
  282. data/ext/zeromq/src/msg.cpp +299 -0
  283. data/ext/zeromq/src/msg.hpp +148 -0
  284. data/ext/zeromq/src/mtrie.cpp +428 -0
  285. data/ext/zeromq/src/mtrie.hpp +93 -0
  286. data/ext/zeromq/src/mutex.hpp +118 -0
  287. data/ext/zeromq/src/object.cpp +393 -0
  288. data/ext/zeromq/src/object.hpp +134 -0
  289. data/ext/zeromq/src/options.cpp +562 -0
  290. data/ext/zeromq/src/options.hpp +135 -0
  291. data/ext/zeromq/src/own.cpp +206 -0
  292. data/ext/zeromq/src/own.hpp +145 -0
  293. data/ext/zeromq/src/pair.cpp +136 -0
  294. data/ext/zeromq/src/pair.hpp +79 -0
  295. data/ext/zeromq/src/pgm_receiver.cpp +283 -0
  296. data/ext/zeromq/src/pgm_receiver.hpp +141 -0
  297. data/ext/zeromq/src/pgm_sender.cpp +218 -0
  298. data/ext/zeromq/src/pgm_sender.hpp +113 -0
  299. data/ext/zeromq/src/pgm_socket.cpp +706 -0
  300. data/ext/zeromq/src/pgm_socket.hpp +124 -0
  301. data/ext/zeromq/src/pipe.cpp +447 -0
  302. data/ext/zeromq/src/pipe.hpp +207 -0
  303. data/ext/zeromq/src/poll.cpp +176 -0
  304. data/ext/zeromq/src/poll.hpp +105 -0
  305. data/ext/zeromq/src/poller.hpp +82 -0
  306. data/ext/zeromq/src/poller_base.cpp +99 -0
  307. data/ext/zeromq/src/poller_base.hpp +86 -0
  308. data/ext/zeromq/src/precompiled.cpp +21 -0
  309. data/ext/zeromq/src/precompiled.hpp +47 -0
  310. data/ext/zeromq/src/proxy.cpp +150 -0
  311. data/ext/zeromq/src/proxy.hpp +32 -0
  312. data/ext/zeromq/src/pub.cpp +57 -0
  313. data/ext/zeromq/src/pub.hpp +69 -0
  314. data/ext/zeromq/src/pull.cpp +79 -0
  315. data/ext/zeromq/src/pull.hpp +81 -0
  316. data/ext/zeromq/src/push.cpp +76 -0
  317. data/ext/zeromq/src/push.hpp +80 -0
  318. data/ext/zeromq/src/random.cpp +52 -0
  319. data/ext/zeromq/src/random.hpp +37 -0
  320. data/ext/zeromq/src/reaper.cpp +117 -0
  321. data/ext/zeromq/src/reaper.hpp +80 -0
  322. data/ext/zeromq/src/rep.cpp +137 -0
  323. data/ext/zeromq/src/rep.hpp +80 -0
  324. data/ext/zeromq/src/req.cpp +185 -0
  325. data/ext/zeromq/src/req.hpp +91 -0
  326. data/ext/zeromq/src/router.cpp +364 -0
  327. data/ext/zeromq/src/router.hpp +138 -0
  328. data/ext/zeromq/src/select.cpp +216 -0
  329. data/ext/zeromq/src/select.hpp +126 -0
  330. data/ext/zeromq/src/session_base.cpp +503 -0
  331. data/ext/zeromq/src/session_base.hpp +156 -0
  332. data/ext/zeromq/src/signaler.cpp +406 -0
  333. data/ext/zeromq/src/signaler.hpp +63 -0
  334. data/ext/zeromq/src/socket_base.cpp +1236 -0
  335. data/ext/zeromq/src/socket_base.hpp +255 -0
  336. data/ext/zeromq/src/stdint.hpp +63 -0
  337. data/ext/zeromq/src/stream_engine.cpp +594 -0
  338. data/ext/zeromq/src/stream_engine.hpp +149 -0
  339. data/ext/zeromq/src/sub.cpp +93 -0
  340. data/ext/zeromq/src/sub.hpp +71 -0
  341. data/ext/zeromq/src/tcp.cpp +131 -0
  342. data/ext/zeromq/src/tcp.hpp +38 -0
  343. data/ext/zeromq/src/tcp_address.cpp +613 -0
  344. data/ext/zeromq/src/tcp_address.hpp +100 -0
  345. data/ext/zeromq/src/tcp_connecter.cpp +319 -0
  346. data/ext/zeromq/src/tcp_connecter.hpp +123 -0
  347. data/ext/zeromq/src/tcp_listener.cpp +293 -0
  348. data/ext/zeromq/src/tcp_listener.hpp +91 -0
  349. data/ext/zeromq/src/thread.cpp +107 -0
  350. data/ext/zeromq/src/thread.hpp +79 -0
  351. data/ext/zeromq/src/trie.cpp +337 -0
  352. data/ext/zeromq/src/trie.hpp +79 -0
  353. data/ext/zeromq/src/v1_decoder.cpp +162 -0
  354. data/ext/zeromq/src/v1_decoder.hpp +68 -0
  355. data/ext/zeromq/src/v1_encoder.cpp +103 -0
  356. data/ext/zeromq/src/v1_encoder.hpp +60 -0
  357. data/ext/zeromq/src/v1_protocol.hpp +43 -0
  358. data/ext/zeromq/src/version.rc.in +93 -0
  359. data/ext/zeromq/src/windows.hpp +181 -0
  360. data/ext/zeromq/src/wire.hpp +99 -0
  361. data/ext/zeromq/src/xpub.cpp +200 -0
  362. data/ext/zeromq/src/xpub.hpp +110 -0
  363. data/ext/zeromq/src/xsub.cpp +242 -0
  364. data/ext/zeromq/src/xsub.hpp +108 -0
  365. data/ext/zeromq/src/ypipe.hpp +210 -0
  366. data/ext/zeromq/src/yqueue.hpp +199 -0
  367. data/ext/zeromq/src/zmq.cpp +1058 -0
  368. data/ext/zeromq/src/zmq_utils.cpp +61 -0
  369. data/ext/zeromq/tests/Makefile.am +55 -0
  370. data/ext/zeromq/tests/test_connect_delay.cpp +260 -0
  371. data/ext/zeromq/tests/test_connect_resolve.cpp +54 -0
  372. data/ext/zeromq/tests/test_disconnect_inproc.cpp +120 -0
  373. data/ext/zeromq/tests/test_hwm.cpp +83 -0
  374. data/ext/zeromq/tests/test_invalid_rep.cpp +92 -0
  375. data/ext/zeromq/tests/test_last_endpoint.cpp +60 -0
  376. data/ext/zeromq/tests/test_monitor.cpp +289 -0
  377. data/ext/zeromq/tests/test_msg_flags.cpp +78 -0
  378. data/ext/zeromq/tests/test_pair_inproc.cpp +53 -0
  379. data/ext/zeromq/tests/test_pair_ipc.cpp +53 -0
  380. data/ext/zeromq/tests/test_pair_tcp.cpp +54 -0
  381. data/ext/zeromq/tests/test_reqrep_device.cpp +143 -0
  382. data/ext/zeromq/tests/test_reqrep_inproc.cpp +53 -0
  383. data/ext/zeromq/tests/test_reqrep_ipc.cpp +53 -0
  384. data/ext/zeromq/tests/test_reqrep_tcp.cpp +54 -0
  385. data/ext/zeromq/tests/test_router_mandatory.cpp +62 -0
  386. data/ext/zeromq/tests/test_shutdown_stress.cpp +93 -0
  387. data/ext/zeromq/tests/test_sub_forward.cpp +99 -0
  388. data/ext/zeromq/tests/test_term_endpoint.cpp +118 -0
  389. data/ext/zeromq/tests/test_timeo.cpp +119 -0
  390. data/ext/zeromq/tests/testutil.hpp +77 -0
  391. data/ext/zeromq/version.sh +21 -0
  392. data/lib/zmq/version.rb +1 -1
  393. data/rbczmq.gemspec +16 -3
  394. data/test/test_socket.rb +13 -1
  395. metadata +398 -9
  396. checksums.yaml +0 -15
  397. data/ext/czmq-1.4.1.tar.gz +0 -0
  398. data/ext/zeromq-3.2.3.tar.gz +0 -0
@@ -0,0 +1,134 @@
1
+ /* =========================================================================
2
+ zmutex - working with mutexes
3
+
4
+ -------------------------------------------------------------------------
5
+ Copyright (c) 1991-2013 iMatix Corporation <www.imatix.com>
6
+ Copyright other contributors as noted in the AUTHORS file.
7
+
8
+ This file is part of CZMQ, the high-level C binding for 0MQ:
9
+ http://czmq.zeromq.org.
10
+
11
+ This is free software; you can redistribute it and/or modify it under
12
+ the terms of the GNU Lesser General Public License as published by the
13
+ Free Software Foundation; either version 3 of the License, or (at your
14
+ option) any later version.
15
+
16
+ This software is distributed in the hope that it will be useful, but
17
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABIL-
18
+ ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
19
+ Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public License
22
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ =========================================================================
24
+ */
25
+
26
+ /*
27
+ @header
28
+ The zmutex class provides a portable wrapper for mutexes. Please do not
29
+ use this class to do multi-threading. It is for the rare case where you
30
+ absolutely need thread-safe global state. This should happen in system
31
+ code only. DO NOT USE THIS TO SHARE SOCKETS BETWEEN THREADS, OR DARK
32
+ THINGS WILL HAPPEN TO YOUR CODE.
33
+ @discuss
34
+ @end
35
+ */
36
+
37
+ #include "../include/czmq.h"
38
+
39
+ // Structure of our class
40
+
41
+ struct _zmutex_t {
42
+ #if defined (__UNIX__)
43
+ pthread_mutex_t mutex;
44
+ #elif defined (__WINDOWS__)
45
+ CRITICAL_SECTION mutex;
46
+ #endif
47
+ };
48
+
49
+
50
+ // --------------------------------------------------------------------------
51
+ // Constructor
52
+
53
+ zmutex_t *
54
+ zmutex_new (void)
55
+ {
56
+ zmutex_t
57
+ *self;
58
+
59
+ self = (zmutex_t *) zmalloc (sizeof (zmutex_t));
60
+ #if defined (__UNIX__)
61
+ pthread_mutex_init (&self->mutex, NULL);
62
+ #elif defined (__WINDOWS__)
63
+ InitializeCriticalSection (&self->mutex);
64
+ #endif
65
+ return self;
66
+ }
67
+
68
+
69
+ // --------------------------------------------------------------------------
70
+ // Destructor
71
+
72
+ void
73
+ zmutex_destroy (zmutex_t **self_p)
74
+ {
75
+ assert (self_p);
76
+ if (*self_p) {
77
+ zmutex_t *self = *self_p;
78
+ #if defined (__UNIX__)
79
+ pthread_mutex_destroy (&self->mutex);
80
+ #elif defined (__WINDOWS__)
81
+ DeleteCriticalSection (&self->mutex);
82
+ #endif
83
+ free (self);
84
+ *self_p = NULL;
85
+ }
86
+ }
87
+
88
+
89
+
90
+ // --------------------------------------------------------------------------
91
+ // Lock mutex
92
+
93
+ void
94
+ zmutex_lock (zmutex_t *self)
95
+ {
96
+ #if defined (__UNIX__)
97
+ pthread_mutex_lock (&self->mutex);
98
+ #elif defined (__WINDOWS__)
99
+ EnterCriticalSection (&self->mutex);
100
+ #endif
101
+ }
102
+
103
+
104
+ // --------------------------------------------------------------------------
105
+ // Unlock mutex
106
+
107
+ void
108
+ zmutex_unlock (zmutex_t *self)
109
+ {
110
+ #if defined (__UNIX__)
111
+ pthread_mutex_unlock (&self->mutex);
112
+ #elif defined (__WINDOWS__)
113
+ LeaveCriticalSection (&self->mutex);
114
+ #endif
115
+ }
116
+
117
+
118
+ // --------------------------------------------------------------------------
119
+ // Selftest
120
+
121
+ int
122
+ zmutex_test (bool verbose)
123
+ {
124
+ printf (" * zmutex: ");
125
+
126
+ // @selftest
127
+ zmutex_t *mutex = zmutex_new ();
128
+ zmutex_lock (mutex);
129
+ zmutex_unlock (mutex);
130
+ zmutex_destroy (&mutex);
131
+ // @end
132
+ printf ("OK\n");
133
+ return 0;
134
+ }
@@ -0,0 +1,313 @@
1
+ /* =========================================================================
2
+ zsocket - working with 0MQ sockets
3
+
4
+ -------------------------------------------------------------------------
5
+ Copyright (c) 1991-2013 iMatix Corporation <www.imatix.com>
6
+ Copyright other contributors as noted in the AUTHORS file.
7
+
8
+ This file is part of CZMQ, the high-level C binding for 0MQ:
9
+ http://czmq.zeromq.org.
10
+
11
+ This is free software; you can redistribute it and/or modify it under
12
+ the terms of the GNU Lesser General Public License as published by the
13
+ Free Software Foundation; either version 3 of the License, or (at your
14
+ option) any later version.
15
+
16
+ This software is distributed in the hope that it will be useful, but
17
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABIL-
18
+ ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
19
+ Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public License
22
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ =========================================================================
24
+ */
25
+
26
+ /*
27
+ @header
28
+ The zsocket class provides helper functions for 0MQ sockets. It doesn't
29
+ wrap the 0MQ socket type, to avoid breaking all libzmq socket-related
30
+ calls.
31
+ @discuss
32
+ @end
33
+ */
34
+
35
+ #include "../include/czmq.h"
36
+
37
+ // --------------------------------------------------------------------------
38
+ // Create a new socket within our czmq context, replaces zmq_socket.
39
+ // Use this to get automatic management of the socket at shutdown.
40
+ // Note: SUB sockets do not automatically subscribe to everything; you
41
+ // must set filters explicitly.
42
+
43
+ void *
44
+ zsocket_new (zctx_t *ctx, int type)
45
+ {
46
+ void *self = zctx__socket_new (ctx, type);
47
+ return self;
48
+ }
49
+
50
+
51
+ // --------------------------------------------------------------------------
52
+ // Destroy the socket. You must use this for any socket created via the
53
+ // zsocket_new method. If socket is null, does nothing.
54
+
55
+ void
56
+ zsocket_destroy (zctx_t *ctx, void *self)
57
+ {
58
+ if (self)
59
+ zctx__socket_destroy (ctx, self);
60
+ }
61
+
62
+
63
+ // --------------------------------------------------------------------------
64
+ // Bind a socket to a formatted endpoint. If the port is specified as
65
+ // '*', binds to any free port from ZSOCKET_DYNFROM to ZSOCKET_DYNTO
66
+ // and returns the actual port number used. Always returns the
67
+ // port number if successful. Note that if a previous process or thread
68
+ // used the same port, peers may connect to the caller thinking it was
69
+ // the previous process/thread.
70
+
71
+ int
72
+ zsocket_bind (void *self, const char *format, ...)
73
+ {
74
+ // Ephemeral port needs 4 additional characters
75
+ char endpoint [256 + 4];
76
+ va_list argptr;
77
+ va_start (argptr, format);
78
+ int endpoint_size = vsnprintf (endpoint, 256, format, argptr);
79
+ va_end (argptr);
80
+
81
+ // Port must be at end of endpoint
82
+ if (endpoint [endpoint_size - 2] == ':'
83
+ && endpoint [endpoint_size - 1] == '*') {
84
+ int port = ZSOCKET_DYNFROM;
85
+ while (port <= ZSOCKET_DYNTO) {
86
+ // Try to bind on the next plausible port
87
+ sprintf (endpoint + endpoint_size - 1, "%d", port);
88
+ if (zmq_bind (self, endpoint) == 0)
89
+ return port;
90
+ port++;
91
+ }
92
+ return -1;
93
+ }
94
+ else {
95
+ // Return actual port used for binding
96
+ int rc = zmq_bind (self, endpoint);
97
+ if (rc == 0)
98
+ rc = atoi (strrchr (endpoint, ':') + 1);
99
+ else
100
+ rc = -1;
101
+ return rc;
102
+ }
103
+ }
104
+
105
+
106
+ // --------------------------------------------------------------------------
107
+ // Connect a socket to a formatted endpoint
108
+ // Returns 0 if the endpoint is valid, -1 if the connect failed.
109
+
110
+ int
111
+ zsocket_connect (void *self, const char *format, ...)
112
+ {
113
+ char endpoint [256];
114
+ va_list argptr;
115
+ va_start (argptr, format);
116
+ vsnprintf (endpoint, 256, format, argptr);
117
+ va_end (argptr);
118
+ return zmq_connect (self, endpoint);
119
+ }
120
+
121
+ // --------------------------------------------------------------------------
122
+ // Disconnect a socket from a formatted endpoint
123
+ // Returns 0 if disconnection is complete -1 if the disconnection failed.
124
+
125
+ int
126
+ zsocket_disconnect (void *self, const char *format, ...)
127
+ {
128
+ #if (ZMQ_VERSION >= ZMQ_MAKE_VERSION(3,2,0))
129
+ char endpoint [256];
130
+ va_list argptr;
131
+ va_start (argptr, format);
132
+ vsnprintf (endpoint, 256, format, argptr);
133
+ va_end (argptr);
134
+ return zmq_disconnect (self, endpoint);
135
+ #else
136
+ return -1;
137
+ #endif
138
+ }
139
+
140
+ // --------------------------------------------------------------------------
141
+ // Poll for input events on the socket. Returns true if there is input
142
+ // ready on the socket, else false.
143
+
144
+ bool
145
+ zsocket_poll (void *self, int msecs)
146
+ {
147
+ zmq_pollitem_t items [] = { { self, 0, ZMQ_POLLIN, 0 } };
148
+ int rc = zmq_poll (items, 1, msecs);
149
+ return rc != -1 && (items [0].revents & ZMQ_POLLIN) != 0;
150
+ }
151
+
152
+
153
+ // --------------------------------------------------------------------------
154
+ // Returns socket type as printable constant string
155
+
156
+ char *
157
+ zsocket_type_str (void *self)
158
+ {
159
+ char *type_name [] = {
160
+ "PAIR", "PUB", "SUB", "REQ", "REP",
161
+ "DEALER", "ROUTER", "PULL", "PUSH",
162
+ "XPUB", "XSUB"
163
+ };
164
+ int type = zsockopt_type (self);
165
+ if (type < 0 || type > ZMQ_XSUB)
166
+ return "UNKNOWN";
167
+ else
168
+ return type_name [type];
169
+ }
170
+
171
+ // --------------------------------------------------------------------------
172
+ // Send data over a socket as a single message frame.
173
+ // Accepts these flags: ZFRAME_MORE and ZFRAME_DONTWAIT.
174
+
175
+ int
176
+ zsocket_sendmem (void *zocket, const void* data, size_t size, int flags)
177
+ {
178
+ assert (zocket);
179
+ assert (size == 0 || data);
180
+
181
+ int snd_flags = (flags & ZFRAME_MORE)? ZMQ_SNDMORE : 0;
182
+ snd_flags |= (flags & ZFRAME_DONTWAIT)? ZMQ_DONTWAIT : 0;
183
+
184
+ zmq_msg_t msg;
185
+ zmq_msg_init_size (&msg, size);
186
+ memcpy (zmq_msg_data (&msg), data, size);
187
+
188
+ int rc = zmq_sendmsg (zocket, &msg, snd_flags);
189
+ return rc == -1? -1: 0;
190
+ }
191
+
192
+
193
+ // --------------------------------------------------------------------------
194
+ // Send data over a socket as a single message frame
195
+ // Accepts these flags: ZFRAME_MORE and ZFRAME_DONTWAIT.
196
+ // NOTE: this method is DEPRECATED and is slated for removal. These are the
197
+ // problems with the method:
198
+ // - premature optimization: do we really need this? It makes the API more
199
+ // complex; high-performance applications would not use this in any case,
200
+ // they would work directly with zmq_msg objects.
201
+ // - selftest method leaks memory
202
+ // (PH, 2013/05/18)
203
+
204
+ int
205
+ zsocket_sendmem_zero_copy (void *zocket, void *data, size_t size,
206
+ zsocket_free_fn *free_fn, void *hint, int flags)
207
+ {
208
+ assert (zocket);
209
+ assert (size == 0 || data);
210
+
211
+ int snd_flags = (flags & ZFRAME_MORE)? ZMQ_SNDMORE : 0;
212
+ snd_flags |= (flags & ZFRAME_DONTWAIT)? ZMQ_DONTWAIT : 0;
213
+
214
+ zmq_msg_t msg;
215
+ zmq_msg_init_data (&msg, data, size, free_fn, hint);
216
+ int rc = zmq_sendmsg (zocket, &msg, snd_flags);
217
+ return rc == -1? -1: 0;
218
+ }
219
+
220
+ static void
221
+ s_test_free_str_cb (void *str, void *arg)
222
+ {
223
+ assert (str);
224
+ free (str);
225
+ }
226
+
227
+ // --------------------------------------------------------------------------
228
+ // Selftest
229
+
230
+ int
231
+ zsocket_test (bool verbose)
232
+ {
233
+ printf (" * zsocket: ");
234
+
235
+ // @selftest
236
+ zctx_t *ctx = zctx_new ();
237
+ assert (ctx);
238
+
239
+ // Create a detached thread, let it run
240
+ char *interf = "*";
241
+ char *domain = "localhost";
242
+ int service = 5560;
243
+
244
+ void *writer = zsocket_new (ctx, ZMQ_PUSH);
245
+ assert (writer);
246
+ void *reader = zsocket_new (ctx, ZMQ_PULL);
247
+ assert (reader);
248
+ assert (streq (zsocket_type_str (writer), "PUSH"));
249
+ assert (streq (zsocket_type_str (reader), "PULL"));
250
+ int rc = zsocket_bind (writer, "tcp://%s:%d", interf, service);
251
+ assert (rc == service);
252
+ rc = zsocket_connect (reader, "tcp://%s:%d", domain, service);
253
+ assert (rc == 0);
254
+ zstr_send (writer, "HELLO");
255
+ char *message = zstr_recv (reader);
256
+ assert (message);
257
+ assert (streq (message, "HELLO"));
258
+ free (message);
259
+
260
+ // Test binding to ports
261
+ int port = zsocket_bind (writer, "tcp://%s:*", interf);
262
+ assert (port >= ZSOCKET_DYNFROM && port <= ZSOCKET_DYNTO);
263
+
264
+ assert (zsocket_poll (writer, 100) == false);
265
+
266
+ rc = zsocket_connect (reader, "txp://%s:%d", domain, service);
267
+ assert (rc == -1);
268
+
269
+ // Test sending frames to socket
270
+ rc = zsocket_sendmem (writer,"ABC", 3, ZFRAME_MORE);
271
+ assert (rc == 0);
272
+ rc = zsocket_sendmem (writer, "DEFG", 4, 0);
273
+ assert (rc == 0);
274
+
275
+ zframe_t *frame = zframe_recv (reader);
276
+ assert (frame);
277
+ assert (zframe_streq (frame, "ABC"));
278
+ assert (zframe_more (frame));
279
+ zframe_destroy (&frame);
280
+
281
+ frame = zframe_recv (reader);
282
+ assert (frame);
283
+ assert (zframe_streq (frame, "DEFG"));
284
+ assert (!zframe_more (frame));
285
+ zframe_destroy (&frame);
286
+
287
+ // Test zframe_sendmem_zero_copy
288
+ rc = zsocket_sendmem_zero_copy (writer, strdup ("ABC"), 3,
289
+ s_test_free_str_cb, NULL, ZFRAME_MORE);
290
+ assert (rc == 0);
291
+ rc = zsocket_sendmem_zero_copy (writer, strdup ("DEFG"), 4,
292
+ s_test_free_str_cb, NULL, 0);
293
+ assert (rc == 0);
294
+
295
+ frame = zframe_recv (reader);
296
+ assert (frame);
297
+ assert (zframe_streq (frame, "ABC"));
298
+ assert (zframe_more (frame));
299
+ zframe_destroy (&frame);
300
+
301
+ frame = zframe_recv (reader);
302
+ assert (frame);
303
+ assert (zframe_streq (frame, "DEFG"));
304
+ assert (!zframe_more (frame));
305
+ zframe_destroy (&frame);
306
+
307
+ zsocket_destroy (ctx, writer);
308
+ zctx_destroy (&ctx);
309
+ // @end
310
+
311
+ printf ("OK\n");
312
+ return 0;
313
+ }
@@ -0,0 +1,1756 @@
1
+ /* =========================================================================
2
+ zsockopt - get/set 0MQ socket options
3
+
4
+ ****************************************************
5
+ * GENERATED SOURCE CODE, DO NOT EDIT!! *
6
+ * TO CHANGE THIS, EDIT scripts/sockopts.gsl *
7
+ * AND RUN ./generate in models/. *
8
+ ****************************************************
9
+ -------------------------------------------------------------------------
10
+ Copyright (c) 1991-2013 iMatix Corporation <www.imatix.com>
11
+ Copyright other contributors as noted in the AUTHORS file.
12
+
13
+ This file is part of CZMQ, the high-level C binding for 0MQ:
14
+ http://czmq.zeromq.org.
15
+
16
+ This is free software; you can redistribute it and/or modify it under
17
+ the terms of the GNU Lesser General Public License as published by the
18
+ Free Software Foundation; either version 3 of the License, or (at your
19
+ option) any later version.
20
+
21
+ This software is distributed in the hope that it will be useful, but
22
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABIL-
23
+ ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
24
+ Public License for more details.
25
+
26
+ You should have received a copy of the GNU Lesser General Public License
27
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
28
+ =========================================================================
29
+ */
30
+
31
+ /*
32
+ @header
33
+ The zsockopt class provides access to the 0MQ getsockopt/setsockopt API.
34
+ @discuss
35
+ This class is generated, using the GSL code generator. See the sockopts
36
+ XML file, which provides the metadata, and the sockopts.gsl template,
37
+ which does the work.
38
+ @end
39
+ */
40
+
41
+ #include "../include/czmq.h"
42
+
43
+ #if (ZMQ_VERSION_MAJOR == 2)
44
+ // --------------------------------------------------------------------------
45
+ // Set socket ZMQ_HWM value
46
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
47
+
48
+ void
49
+ zsocket_set_hwm (void *zocket, int hwm)
50
+ {
51
+ # if defined (ZMQ_HWM)
52
+ uint64_t value = hwm;
53
+ int rc = zmq_setsockopt (zocket, ZMQ_HWM, &value, sizeof (uint64_t));
54
+ assert (rc == 0 || errno == ETERM);
55
+ # endif
56
+ }
57
+
58
+
59
+ // --------------------------------------------------------------------------
60
+ // Return socket ZMQ_HWM value
61
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
62
+
63
+ int
64
+ zsocket_hwm (void *zocket)
65
+ {
66
+ # if defined (ZMQ_HWM)
67
+ uint64_t hwm;
68
+ size_t option_len = sizeof (uint64_t);
69
+ zmq_getsockopt (zocket, ZMQ_HWM, &hwm, &option_len);
70
+ return (int) hwm;
71
+ # endif
72
+ }
73
+
74
+
75
+ // --------------------------------------------------------------------------
76
+ // Set socket ZMQ_SWAP value
77
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
78
+
79
+ void
80
+ zsocket_set_swap (void *zocket, int swap)
81
+ {
82
+ # if defined (ZMQ_SWAP)
83
+ int64_t value = swap;
84
+ int rc = zmq_setsockopt (zocket, ZMQ_SWAP, &value, sizeof (int64_t));
85
+ assert (rc == 0 || errno == ETERM);
86
+ # endif
87
+ }
88
+
89
+
90
+ // --------------------------------------------------------------------------
91
+ // Return socket ZMQ_SWAP value
92
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
93
+
94
+ int
95
+ zsocket_swap (void *zocket)
96
+ {
97
+ # if defined (ZMQ_SWAP)
98
+ int64_t swap;
99
+ size_t option_len = sizeof (int64_t);
100
+ zmq_getsockopt (zocket, ZMQ_SWAP, &swap, &option_len);
101
+ return (int) swap;
102
+ # endif
103
+ }
104
+
105
+
106
+ // --------------------------------------------------------------------------
107
+ // Set socket ZMQ_AFFINITY value
108
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
109
+
110
+ void
111
+ zsocket_set_affinity (void *zocket, int affinity)
112
+ {
113
+ # if defined (ZMQ_AFFINITY)
114
+ uint64_t value = affinity;
115
+ int rc = zmq_setsockopt (zocket, ZMQ_AFFINITY, &value, sizeof (uint64_t));
116
+ assert (rc == 0 || errno == ETERM);
117
+ # endif
118
+ }
119
+
120
+
121
+ // --------------------------------------------------------------------------
122
+ // Return socket ZMQ_AFFINITY value
123
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
124
+
125
+ int
126
+ zsocket_affinity (void *zocket)
127
+ {
128
+ # if defined (ZMQ_AFFINITY)
129
+ uint64_t affinity;
130
+ size_t option_len = sizeof (uint64_t);
131
+ zmq_getsockopt (zocket, ZMQ_AFFINITY, &affinity, &option_len);
132
+ return (int) affinity;
133
+ # endif
134
+ }
135
+
136
+
137
+ // --------------------------------------------------------------------------
138
+ // Set socket ZMQ_IDENTITY value
139
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
140
+
141
+ void
142
+ zsocket_set_identity (void *zocket, const char * identity)
143
+ {
144
+ # if defined (ZMQ_IDENTITY)
145
+ int rc = zmq_setsockopt (zocket, ZMQ_IDENTITY, identity, strlen (identity));
146
+ assert (rc == 0 || errno == ETERM);
147
+ # endif
148
+ }
149
+
150
+
151
+ // --------------------------------------------------------------------------
152
+ // Return socket ZMQ_IDENTITY value
153
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
154
+
155
+ char *
156
+ zsocket_identity (void *zocket)
157
+ {
158
+ # if defined (ZMQ_IDENTITY)
159
+ size_t option_len = 255;
160
+ char *identity = (char *) zmalloc (option_len);
161
+ zmq_getsockopt (zocket, ZMQ_IDENTITY, identity, &option_len);
162
+ return (char *) identity;
163
+ # endif
164
+ }
165
+
166
+
167
+ // --------------------------------------------------------------------------
168
+ // Set socket ZMQ_RATE value
169
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
170
+
171
+ void
172
+ zsocket_set_rate (void *zocket, int rate)
173
+ {
174
+ # if defined (ZMQ_RATE)
175
+ int64_t value = rate;
176
+ int rc = zmq_setsockopt (zocket, ZMQ_RATE, &value, sizeof (int64_t));
177
+ assert (rc == 0 || errno == ETERM);
178
+ # endif
179
+ }
180
+
181
+
182
+ // --------------------------------------------------------------------------
183
+ // Return socket ZMQ_RATE value
184
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
185
+
186
+ int
187
+ zsocket_rate (void *zocket)
188
+ {
189
+ # if defined (ZMQ_RATE)
190
+ int64_t rate;
191
+ size_t option_len = sizeof (int64_t);
192
+ zmq_getsockopt (zocket, ZMQ_RATE, &rate, &option_len);
193
+ return (int) rate;
194
+ # endif
195
+ }
196
+
197
+
198
+ // --------------------------------------------------------------------------
199
+ // Set socket ZMQ_RECOVERY_IVL value
200
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
201
+
202
+ void
203
+ zsocket_set_recovery_ivl (void *zocket, int recovery_ivl)
204
+ {
205
+ # if defined (ZMQ_RECOVERY_IVL)
206
+ int64_t value = recovery_ivl;
207
+ int rc = zmq_setsockopt (zocket, ZMQ_RECOVERY_IVL, &value, sizeof (int64_t));
208
+ assert (rc == 0 || errno == ETERM);
209
+ # endif
210
+ }
211
+
212
+
213
+ // --------------------------------------------------------------------------
214
+ // Return socket ZMQ_RECOVERY_IVL value
215
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
216
+
217
+ int
218
+ zsocket_recovery_ivl (void *zocket)
219
+ {
220
+ # if defined (ZMQ_RECOVERY_IVL)
221
+ int64_t recovery_ivl;
222
+ size_t option_len = sizeof (int64_t);
223
+ zmq_getsockopt (zocket, ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
224
+ return (int) recovery_ivl;
225
+ # endif
226
+ }
227
+
228
+
229
+ // --------------------------------------------------------------------------
230
+ // Set socket ZMQ_RECOVERY_IVL_MSEC value
231
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
232
+
233
+ void
234
+ zsocket_set_recovery_ivl_msec (void *zocket, int recovery_ivl_msec)
235
+ {
236
+ # if defined (ZMQ_RECOVERY_IVL_MSEC)
237
+ int64_t value = recovery_ivl_msec;
238
+ int rc = zmq_setsockopt (zocket, ZMQ_RECOVERY_IVL_MSEC, &value, sizeof (int64_t));
239
+ assert (rc == 0 || errno == ETERM);
240
+ # endif
241
+ }
242
+
243
+
244
+ // --------------------------------------------------------------------------
245
+ // Return socket ZMQ_RECOVERY_IVL_MSEC value
246
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
247
+
248
+ int
249
+ zsocket_recovery_ivl_msec (void *zocket)
250
+ {
251
+ # if defined (ZMQ_RECOVERY_IVL_MSEC)
252
+ int64_t recovery_ivl_msec;
253
+ size_t option_len = sizeof (int64_t);
254
+ zmq_getsockopt (zocket, ZMQ_RECOVERY_IVL_MSEC, &recovery_ivl_msec, &option_len);
255
+ return (int) recovery_ivl_msec;
256
+ # endif
257
+ }
258
+
259
+
260
+ // --------------------------------------------------------------------------
261
+ // Set socket ZMQ_MCAST_LOOP value
262
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
263
+
264
+ void
265
+ zsocket_set_mcast_loop (void *zocket, int mcast_loop)
266
+ {
267
+ # if defined (ZMQ_MCAST_LOOP)
268
+ int64_t value = mcast_loop;
269
+ int rc = zmq_setsockopt (zocket, ZMQ_MCAST_LOOP, &value, sizeof (int64_t));
270
+ assert (rc == 0 || errno == ETERM);
271
+ # endif
272
+ }
273
+
274
+
275
+ // --------------------------------------------------------------------------
276
+ // Return socket ZMQ_MCAST_LOOP value
277
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
278
+
279
+ int
280
+ zsocket_mcast_loop (void *zocket)
281
+ {
282
+ # if defined (ZMQ_MCAST_LOOP)
283
+ int64_t mcast_loop;
284
+ size_t option_len = sizeof (int64_t);
285
+ zmq_getsockopt (zocket, ZMQ_MCAST_LOOP, &mcast_loop, &option_len);
286
+ return (int) mcast_loop;
287
+ # endif
288
+ }
289
+
290
+
291
+ # if (ZMQ_VERSION_MINOR == 2)
292
+ // --------------------------------------------------------------------------
293
+ // Set socket ZMQ_RCVTIMEO value
294
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
295
+
296
+ void
297
+ zsocket_set_rcvtimeo (void *zocket, int rcvtimeo)
298
+ {
299
+ # if defined (ZMQ_RCVTIMEO)
300
+ int rc = zmq_setsockopt (zocket, ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
301
+ assert (rc == 0 || errno == ETERM);
302
+ # endif
303
+ }
304
+
305
+
306
+ // --------------------------------------------------------------------------
307
+ // Return socket ZMQ_RCVTIMEO value
308
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
309
+
310
+ int
311
+ zsocket_rcvtimeo (void *zocket)
312
+ {
313
+ # if defined (ZMQ_RCVTIMEO)
314
+ int rcvtimeo;
315
+ size_t option_len = sizeof (int);
316
+ zmq_getsockopt (zocket, ZMQ_RCVTIMEO, &rcvtimeo, &option_len);
317
+ return rcvtimeo;
318
+ # endif
319
+ }
320
+
321
+
322
+ # endif
323
+ # if (ZMQ_VERSION_MINOR == 2)
324
+ // --------------------------------------------------------------------------
325
+ // Set socket ZMQ_SNDTIMEO value
326
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
327
+
328
+ void
329
+ zsocket_set_sndtimeo (void *zocket, int sndtimeo)
330
+ {
331
+ # if defined (ZMQ_SNDTIMEO)
332
+ int rc = zmq_setsockopt (zocket, ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
333
+ assert (rc == 0 || errno == ETERM);
334
+ # endif
335
+ }
336
+
337
+
338
+ // --------------------------------------------------------------------------
339
+ // Return socket ZMQ_SNDTIMEO value
340
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
341
+
342
+ int
343
+ zsocket_sndtimeo (void *zocket)
344
+ {
345
+ # if defined (ZMQ_SNDTIMEO)
346
+ int sndtimeo;
347
+ size_t option_len = sizeof (int);
348
+ zmq_getsockopt (zocket, ZMQ_SNDTIMEO, &sndtimeo, &option_len);
349
+ return sndtimeo;
350
+ # endif
351
+ }
352
+
353
+
354
+ # endif
355
+ // --------------------------------------------------------------------------
356
+ // Set socket ZMQ_SNDBUF value
357
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
358
+
359
+ void
360
+ zsocket_set_sndbuf (void *zocket, int sndbuf)
361
+ {
362
+ # if defined (ZMQ_SNDBUF)
363
+ uint64_t value = sndbuf;
364
+ int rc = zmq_setsockopt (zocket, ZMQ_SNDBUF, &value, sizeof (uint64_t));
365
+ assert (rc == 0 || errno == ETERM);
366
+ # endif
367
+ }
368
+
369
+
370
+ // --------------------------------------------------------------------------
371
+ // Return socket ZMQ_SNDBUF value
372
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
373
+
374
+ int
375
+ zsocket_sndbuf (void *zocket)
376
+ {
377
+ # if defined (ZMQ_SNDBUF)
378
+ uint64_t sndbuf;
379
+ size_t option_len = sizeof (uint64_t);
380
+ zmq_getsockopt (zocket, ZMQ_SNDBUF, &sndbuf, &option_len);
381
+ return (int) sndbuf;
382
+ # endif
383
+ }
384
+
385
+
386
+ // --------------------------------------------------------------------------
387
+ // Set socket ZMQ_RCVBUF value
388
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
389
+
390
+ void
391
+ zsocket_set_rcvbuf (void *zocket, int rcvbuf)
392
+ {
393
+ # if defined (ZMQ_RCVBUF)
394
+ uint64_t value = rcvbuf;
395
+ int rc = zmq_setsockopt (zocket, ZMQ_RCVBUF, &value, sizeof (uint64_t));
396
+ assert (rc == 0 || errno == ETERM);
397
+ # endif
398
+ }
399
+
400
+
401
+ // --------------------------------------------------------------------------
402
+ // Return socket ZMQ_RCVBUF value
403
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
404
+
405
+ int
406
+ zsocket_rcvbuf (void *zocket)
407
+ {
408
+ # if defined (ZMQ_RCVBUF)
409
+ uint64_t rcvbuf;
410
+ size_t option_len = sizeof (uint64_t);
411
+ zmq_getsockopt (zocket, ZMQ_RCVBUF, &rcvbuf, &option_len);
412
+ return (int) rcvbuf;
413
+ # endif
414
+ }
415
+
416
+
417
+ // --------------------------------------------------------------------------
418
+ // Set socket ZMQ_LINGER value
419
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
420
+
421
+ void
422
+ zsocket_set_linger (void *zocket, int linger)
423
+ {
424
+ # if defined (ZMQ_LINGER)
425
+ int rc = zmq_setsockopt (zocket, ZMQ_LINGER, &linger, sizeof (int));
426
+ assert (rc == 0 || errno == ETERM);
427
+ # endif
428
+ }
429
+
430
+
431
+ // --------------------------------------------------------------------------
432
+ // Return socket ZMQ_LINGER value
433
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
434
+
435
+ int
436
+ zsocket_linger (void *zocket)
437
+ {
438
+ # if defined (ZMQ_LINGER)
439
+ int linger;
440
+ size_t option_len = sizeof (int);
441
+ zmq_getsockopt (zocket, ZMQ_LINGER, &linger, &option_len);
442
+ return linger;
443
+ # endif
444
+ }
445
+
446
+
447
+ // --------------------------------------------------------------------------
448
+ // Set socket ZMQ_RECONNECT_IVL value
449
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
450
+
451
+ void
452
+ zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl)
453
+ {
454
+ # if defined (ZMQ_RECONNECT_IVL)
455
+ int rc = zmq_setsockopt (zocket, ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
456
+ assert (rc == 0 || errno == ETERM);
457
+ # endif
458
+ }
459
+
460
+
461
+ // --------------------------------------------------------------------------
462
+ // Return socket ZMQ_RECONNECT_IVL value
463
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
464
+
465
+ int
466
+ zsocket_reconnect_ivl (void *zocket)
467
+ {
468
+ # if defined (ZMQ_RECONNECT_IVL)
469
+ int reconnect_ivl;
470
+ size_t option_len = sizeof (int);
471
+ zmq_getsockopt (zocket, ZMQ_RECONNECT_IVL, &reconnect_ivl, &option_len);
472
+ return reconnect_ivl;
473
+ # endif
474
+ }
475
+
476
+
477
+ // --------------------------------------------------------------------------
478
+ // Set socket ZMQ_RECONNECT_IVL_MAX value
479
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
480
+
481
+ void
482
+ zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max)
483
+ {
484
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
485
+ int rc = zmq_setsockopt (zocket, ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
486
+ assert (rc == 0 || errno == ETERM);
487
+ # endif
488
+ }
489
+
490
+
491
+ // --------------------------------------------------------------------------
492
+ // Return socket ZMQ_RECONNECT_IVL_MAX value
493
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
494
+
495
+ int
496
+ zsocket_reconnect_ivl_max (void *zocket)
497
+ {
498
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
499
+ int reconnect_ivl_max;
500
+ size_t option_len = sizeof (int);
501
+ zmq_getsockopt (zocket, ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, &option_len);
502
+ return reconnect_ivl_max;
503
+ # endif
504
+ }
505
+
506
+
507
+ // --------------------------------------------------------------------------
508
+ // Set socket ZMQ_BACKLOG value
509
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
510
+
511
+ void
512
+ zsocket_set_backlog (void *zocket, int backlog)
513
+ {
514
+ # if defined (ZMQ_BACKLOG)
515
+ int rc = zmq_setsockopt (zocket, ZMQ_BACKLOG, &backlog, sizeof (int));
516
+ assert (rc == 0 || errno == ETERM);
517
+ # endif
518
+ }
519
+
520
+
521
+ // --------------------------------------------------------------------------
522
+ // Return socket ZMQ_BACKLOG value
523
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
524
+
525
+ int
526
+ zsocket_backlog (void *zocket)
527
+ {
528
+ # if defined (ZMQ_BACKLOG)
529
+ int backlog;
530
+ size_t option_len = sizeof (int);
531
+ zmq_getsockopt (zocket, ZMQ_BACKLOG, &backlog, &option_len);
532
+ return backlog;
533
+ # endif
534
+ }
535
+
536
+
537
+ // --------------------------------------------------------------------------
538
+ // Set socket ZMQ_SUBSCRIBE value
539
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
540
+
541
+ void
542
+ zsocket_set_subscribe (void *zocket, const char * subscribe)
543
+ {
544
+ # if defined (ZMQ_SUBSCRIBE)
545
+ if (zsockopt_type (zocket) != ZMQ_SUB) {
546
+ printf ("ZMQ_SUBSCRIBE is not valid on %s sockets\n", zsocket_type_str (zocket));
547
+ assert (false);
548
+ }
549
+ int rc = zmq_setsockopt (zocket, ZMQ_SUBSCRIBE, subscribe, strlen (subscribe));
550
+ assert (rc == 0 || errno == ETERM);
551
+ # endif
552
+ }
553
+
554
+
555
+ // --------------------------------------------------------------------------
556
+ // Set socket ZMQ_UNSUBSCRIBE value
557
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
558
+
559
+ void
560
+ zsocket_set_unsubscribe (void *zocket, const char * unsubscribe)
561
+ {
562
+ # if defined (ZMQ_UNSUBSCRIBE)
563
+ if (zsockopt_type (zocket) != ZMQ_SUB) {
564
+ printf ("ZMQ_UNSUBSCRIBE is not valid on %s sockets\n", zsocket_type_str (zocket));
565
+ assert (false);
566
+ }
567
+ int rc = zmq_setsockopt (zocket, ZMQ_UNSUBSCRIBE, unsubscribe, strlen (unsubscribe));
568
+ assert (rc == 0 || errno == ETERM);
569
+ # endif
570
+ }
571
+
572
+
573
+ // --------------------------------------------------------------------------
574
+ // Return socket ZMQ_TYPE value
575
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
576
+
577
+ int
578
+ zsocket_type (void *zocket)
579
+ {
580
+ # if defined (ZMQ_TYPE)
581
+ int type;
582
+ size_t option_len = sizeof (int);
583
+ zmq_getsockopt (zocket, ZMQ_TYPE, &type, &option_len);
584
+ return type;
585
+ # endif
586
+ }
587
+
588
+
589
+ // --------------------------------------------------------------------------
590
+ // Return socket ZMQ_RCVMORE value
591
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
592
+
593
+ int
594
+ zsocket_rcvmore (void *zocket)
595
+ {
596
+ # if defined (ZMQ_RCVMORE)
597
+ int64_t rcvmore;
598
+ size_t option_len = sizeof (int64_t);
599
+ zmq_getsockopt (zocket, ZMQ_RCVMORE, &rcvmore, &option_len);
600
+ return (int) rcvmore;
601
+ # endif
602
+ }
603
+
604
+
605
+ // --------------------------------------------------------------------------
606
+ // Return socket ZMQ_FD value
607
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
608
+
609
+ int
610
+ zsocket_fd (void *zocket)
611
+ {
612
+ # if defined (ZMQ_FD)
613
+ int fd;
614
+ size_t option_len = sizeof (int);
615
+ zmq_getsockopt (zocket, ZMQ_FD, &fd, &option_len);
616
+ return fd;
617
+ # endif
618
+ }
619
+
620
+
621
+ // --------------------------------------------------------------------------
622
+ // Return socket ZMQ_EVENTS value
623
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
624
+
625
+ int
626
+ zsocket_events (void *zocket)
627
+ {
628
+ # if defined (ZMQ_EVENTS)
629
+ uint32_t events;
630
+ size_t option_len = sizeof (uint32_t);
631
+ zmq_getsockopt (zocket, ZMQ_EVENTS, &events, &option_len);
632
+ return (int) events;
633
+ # endif
634
+ }
635
+
636
+
637
+ #endif
638
+
639
+ #if (ZMQ_VERSION_MAJOR == 3)
640
+ // --------------------------------------------------------------------------
641
+ // Return socket ZMQ_TYPE value
642
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
643
+
644
+ int
645
+ zsocket_type (void *zocket)
646
+ {
647
+ # if defined (ZMQ_TYPE)
648
+ int type;
649
+ size_t option_len = sizeof (int);
650
+ zmq_getsockopt (zocket, ZMQ_TYPE, &type, &option_len);
651
+ return type;
652
+ # endif
653
+ }
654
+
655
+
656
+ // --------------------------------------------------------------------------
657
+ // Set socket ZMQ_SNDHWM value
658
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
659
+
660
+ void
661
+ zsocket_set_sndhwm (void *zocket, int sndhwm)
662
+ {
663
+ # if defined (ZMQ_SNDHWM)
664
+ int rc = zmq_setsockopt (zocket, ZMQ_SNDHWM, &sndhwm, sizeof (int));
665
+ assert (rc == 0 || errno == ETERM);
666
+ # endif
667
+ }
668
+
669
+
670
+ // --------------------------------------------------------------------------
671
+ // Return socket ZMQ_SNDHWM value
672
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
673
+
674
+ int
675
+ zsocket_sndhwm (void *zocket)
676
+ {
677
+ # if defined (ZMQ_SNDHWM)
678
+ int sndhwm;
679
+ size_t option_len = sizeof (int);
680
+ zmq_getsockopt (zocket, ZMQ_SNDHWM, &sndhwm, &option_len);
681
+ return sndhwm;
682
+ # endif
683
+ }
684
+
685
+
686
+ // --------------------------------------------------------------------------
687
+ // Set socket ZMQ_RCVHWM value
688
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
689
+
690
+ void
691
+ zsocket_set_rcvhwm (void *zocket, int rcvhwm)
692
+ {
693
+ # if defined (ZMQ_RCVHWM)
694
+ int rc = zmq_setsockopt (zocket, ZMQ_RCVHWM, &rcvhwm, sizeof (int));
695
+ assert (rc == 0 || errno == ETERM);
696
+ # endif
697
+ }
698
+
699
+
700
+ // --------------------------------------------------------------------------
701
+ // Return socket ZMQ_RCVHWM value
702
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
703
+
704
+ int
705
+ zsocket_rcvhwm (void *zocket)
706
+ {
707
+ # if defined (ZMQ_RCVHWM)
708
+ int rcvhwm;
709
+ size_t option_len = sizeof (int);
710
+ zmq_getsockopt (zocket, ZMQ_RCVHWM, &rcvhwm, &option_len);
711
+ return rcvhwm;
712
+ # endif
713
+ }
714
+
715
+
716
+ // --------------------------------------------------------------------------
717
+ // Set socket ZMQ_AFFINITY value
718
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
719
+
720
+ void
721
+ zsocket_set_affinity (void *zocket, int affinity)
722
+ {
723
+ # if defined (ZMQ_AFFINITY)
724
+ uint64_t value = affinity;
725
+ int rc = zmq_setsockopt (zocket, ZMQ_AFFINITY, &value, sizeof (uint64_t));
726
+ assert (rc == 0 || errno == ETERM);
727
+ # endif
728
+ }
729
+
730
+
731
+ // --------------------------------------------------------------------------
732
+ // Return socket ZMQ_AFFINITY value
733
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
734
+
735
+ int
736
+ zsocket_affinity (void *zocket)
737
+ {
738
+ # if defined (ZMQ_AFFINITY)
739
+ uint64_t affinity;
740
+ size_t option_len = sizeof (uint64_t);
741
+ zmq_getsockopt (zocket, ZMQ_AFFINITY, &affinity, &option_len);
742
+ return (int) affinity;
743
+ # endif
744
+ }
745
+
746
+
747
+ // --------------------------------------------------------------------------
748
+ // Set socket ZMQ_SUBSCRIBE value
749
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
750
+
751
+ void
752
+ zsocket_set_subscribe (void *zocket, const char * subscribe)
753
+ {
754
+ # if defined (ZMQ_SUBSCRIBE)
755
+ if (zsockopt_type (zocket) != ZMQ_SUB) {
756
+ printf ("ZMQ_SUBSCRIBE is not valid on %s sockets\n", zsocket_type_str (zocket));
757
+ assert (false);
758
+ }
759
+ int rc = zmq_setsockopt (zocket, ZMQ_SUBSCRIBE, subscribe, strlen (subscribe));
760
+ assert (rc == 0 || errno == ETERM);
761
+ # endif
762
+ }
763
+
764
+
765
+ // --------------------------------------------------------------------------
766
+ // Set socket ZMQ_UNSUBSCRIBE value
767
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
768
+
769
+ void
770
+ zsocket_set_unsubscribe (void *zocket, const char * unsubscribe)
771
+ {
772
+ # if defined (ZMQ_UNSUBSCRIBE)
773
+ if (zsockopt_type (zocket) != ZMQ_SUB) {
774
+ printf ("ZMQ_UNSUBSCRIBE is not valid on %s sockets\n", zsocket_type_str (zocket));
775
+ assert (false);
776
+ }
777
+ int rc = zmq_setsockopt (zocket, ZMQ_UNSUBSCRIBE, unsubscribe, strlen (unsubscribe));
778
+ assert (rc == 0 || errno == ETERM);
779
+ # endif
780
+ }
781
+
782
+
783
+ // --------------------------------------------------------------------------
784
+ // Set socket ZMQ_IDENTITY value
785
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
786
+
787
+ void
788
+ zsocket_set_identity (void *zocket, const char * identity)
789
+ {
790
+ # if defined (ZMQ_IDENTITY)
791
+ if (zsockopt_type (zocket) != ZMQ_REQ
792
+ && zsockopt_type (zocket) != ZMQ_REP
793
+ && zsockopt_type (zocket) != ZMQ_DEALER
794
+ && zsockopt_type (zocket) != ZMQ_ROUTER) {
795
+ printf ("ZMQ_IDENTITY is not valid on %s sockets\n", zsocket_type_str (zocket));
796
+ assert (false);
797
+ }
798
+ int rc = zmq_setsockopt (zocket, ZMQ_IDENTITY, identity, strlen (identity));
799
+ assert (rc == 0 || errno == ETERM);
800
+ # endif
801
+ }
802
+
803
+
804
+ // --------------------------------------------------------------------------
805
+ // Return socket ZMQ_IDENTITY value
806
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
807
+
808
+ char *
809
+ zsocket_identity (void *zocket)
810
+ {
811
+ # if defined (ZMQ_IDENTITY)
812
+ size_t option_len = 255;
813
+ char *identity = (char *) zmalloc (option_len);
814
+ zmq_getsockopt (zocket, ZMQ_IDENTITY, identity, &option_len);
815
+ return (char *) identity;
816
+ # endif
817
+ }
818
+
819
+
820
+ // --------------------------------------------------------------------------
821
+ // Set socket ZMQ_RATE value
822
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
823
+
824
+ void
825
+ zsocket_set_rate (void *zocket, int rate)
826
+ {
827
+ # if defined (ZMQ_RATE)
828
+ int rc = zmq_setsockopt (zocket, ZMQ_RATE, &rate, sizeof (int));
829
+ assert (rc == 0 || errno == ETERM);
830
+ # endif
831
+ }
832
+
833
+
834
+ // --------------------------------------------------------------------------
835
+ // Return socket ZMQ_RATE value
836
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
837
+
838
+ int
839
+ zsocket_rate (void *zocket)
840
+ {
841
+ # if defined (ZMQ_RATE)
842
+ int rate;
843
+ size_t option_len = sizeof (int);
844
+ zmq_getsockopt (zocket, ZMQ_RATE, &rate, &option_len);
845
+ return rate;
846
+ # endif
847
+ }
848
+
849
+
850
+ // --------------------------------------------------------------------------
851
+ // Set socket ZMQ_RECOVERY_IVL value
852
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
853
+
854
+ void
855
+ zsocket_set_recovery_ivl (void *zocket, int recovery_ivl)
856
+ {
857
+ # if defined (ZMQ_RECOVERY_IVL)
858
+ int rc = zmq_setsockopt (zocket, ZMQ_RECOVERY_IVL, &recovery_ivl, sizeof (int));
859
+ assert (rc == 0 || errno == ETERM);
860
+ # endif
861
+ }
862
+
863
+
864
+ // --------------------------------------------------------------------------
865
+ // Return socket ZMQ_RECOVERY_IVL value
866
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
867
+
868
+ int
869
+ zsocket_recovery_ivl (void *zocket)
870
+ {
871
+ # if defined (ZMQ_RECOVERY_IVL)
872
+ int recovery_ivl;
873
+ size_t option_len = sizeof (int);
874
+ zmq_getsockopt (zocket, ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
875
+ return recovery_ivl;
876
+ # endif
877
+ }
878
+
879
+
880
+ // --------------------------------------------------------------------------
881
+ // Set socket ZMQ_SNDBUF value
882
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
883
+
884
+ void
885
+ zsocket_set_sndbuf (void *zocket, int sndbuf)
886
+ {
887
+ # if defined (ZMQ_SNDBUF)
888
+ int rc = zmq_setsockopt (zocket, ZMQ_SNDBUF, &sndbuf, sizeof (int));
889
+ assert (rc == 0 || errno == ETERM);
890
+ # endif
891
+ }
892
+
893
+
894
+ // --------------------------------------------------------------------------
895
+ // Return socket ZMQ_SNDBUF value
896
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
897
+
898
+ int
899
+ zsocket_sndbuf (void *zocket)
900
+ {
901
+ # if defined (ZMQ_SNDBUF)
902
+ int sndbuf;
903
+ size_t option_len = sizeof (int);
904
+ zmq_getsockopt (zocket, ZMQ_SNDBUF, &sndbuf, &option_len);
905
+ return sndbuf;
906
+ # endif
907
+ }
908
+
909
+
910
+ // --------------------------------------------------------------------------
911
+ // Set socket ZMQ_RCVBUF value
912
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
913
+
914
+ void
915
+ zsocket_set_rcvbuf (void *zocket, int rcvbuf)
916
+ {
917
+ # if defined (ZMQ_RCVBUF)
918
+ int rc = zmq_setsockopt (zocket, ZMQ_RCVBUF, &rcvbuf, sizeof (int));
919
+ assert (rc == 0 || errno == ETERM);
920
+ # endif
921
+ }
922
+
923
+
924
+ // --------------------------------------------------------------------------
925
+ // Return socket ZMQ_RCVBUF value
926
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
927
+
928
+ int
929
+ zsocket_rcvbuf (void *zocket)
930
+ {
931
+ # if defined (ZMQ_RCVBUF)
932
+ int rcvbuf;
933
+ size_t option_len = sizeof (int);
934
+ zmq_getsockopt (zocket, ZMQ_RCVBUF, &rcvbuf, &option_len);
935
+ return rcvbuf;
936
+ # endif
937
+ }
938
+
939
+
940
+ // --------------------------------------------------------------------------
941
+ // Set socket ZMQ_LINGER value
942
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
943
+
944
+ void
945
+ zsocket_set_linger (void *zocket, int linger)
946
+ {
947
+ # if defined (ZMQ_LINGER)
948
+ int rc = zmq_setsockopt (zocket, ZMQ_LINGER, &linger, sizeof (int));
949
+ assert (rc == 0 || errno == ETERM);
950
+ # endif
951
+ }
952
+
953
+
954
+ // --------------------------------------------------------------------------
955
+ // Return socket ZMQ_LINGER value
956
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
957
+
958
+ int
959
+ zsocket_linger (void *zocket)
960
+ {
961
+ # if defined (ZMQ_LINGER)
962
+ int linger;
963
+ size_t option_len = sizeof (int);
964
+ zmq_getsockopt (zocket, ZMQ_LINGER, &linger, &option_len);
965
+ return linger;
966
+ # endif
967
+ }
968
+
969
+
970
+ // --------------------------------------------------------------------------
971
+ // Set socket ZMQ_RECONNECT_IVL value
972
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
973
+
974
+ void
975
+ zsocket_set_reconnect_ivl (void *zocket, int reconnect_ivl)
976
+ {
977
+ # if defined (ZMQ_RECONNECT_IVL)
978
+ int rc = zmq_setsockopt (zocket, ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
979
+ assert (rc == 0 || errno == ETERM);
980
+ # endif
981
+ }
982
+
983
+
984
+ // --------------------------------------------------------------------------
985
+ // Return socket ZMQ_RECONNECT_IVL value
986
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
987
+
988
+ int
989
+ zsocket_reconnect_ivl (void *zocket)
990
+ {
991
+ # if defined (ZMQ_RECONNECT_IVL)
992
+ int reconnect_ivl;
993
+ size_t option_len = sizeof (int);
994
+ zmq_getsockopt (zocket, ZMQ_RECONNECT_IVL, &reconnect_ivl, &option_len);
995
+ return reconnect_ivl;
996
+ # endif
997
+ }
998
+
999
+
1000
+ // --------------------------------------------------------------------------
1001
+ // Set socket ZMQ_RECONNECT_IVL_MAX value
1002
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1003
+
1004
+ void
1005
+ zsocket_set_reconnect_ivl_max (void *zocket, int reconnect_ivl_max)
1006
+ {
1007
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
1008
+ int rc = zmq_setsockopt (zocket, ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
1009
+ assert (rc == 0 || errno == ETERM);
1010
+ # endif
1011
+ }
1012
+
1013
+
1014
+ // --------------------------------------------------------------------------
1015
+ // Return socket ZMQ_RECONNECT_IVL_MAX value
1016
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1017
+
1018
+ int
1019
+ zsocket_reconnect_ivl_max (void *zocket)
1020
+ {
1021
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
1022
+ int reconnect_ivl_max;
1023
+ size_t option_len = sizeof (int);
1024
+ zmq_getsockopt (zocket, ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, &option_len);
1025
+ return reconnect_ivl_max;
1026
+ # endif
1027
+ }
1028
+
1029
+
1030
+ // --------------------------------------------------------------------------
1031
+ // Set socket ZMQ_BACKLOG value
1032
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1033
+
1034
+ void
1035
+ zsocket_set_backlog (void *zocket, int backlog)
1036
+ {
1037
+ # if defined (ZMQ_BACKLOG)
1038
+ int rc = zmq_setsockopt (zocket, ZMQ_BACKLOG, &backlog, sizeof (int));
1039
+ assert (rc == 0 || errno == ETERM);
1040
+ # endif
1041
+ }
1042
+
1043
+
1044
+ // --------------------------------------------------------------------------
1045
+ // Return socket ZMQ_BACKLOG value
1046
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1047
+
1048
+ int
1049
+ zsocket_backlog (void *zocket)
1050
+ {
1051
+ # if defined (ZMQ_BACKLOG)
1052
+ int backlog;
1053
+ size_t option_len = sizeof (int);
1054
+ zmq_getsockopt (zocket, ZMQ_BACKLOG, &backlog, &option_len);
1055
+ return backlog;
1056
+ # endif
1057
+ }
1058
+
1059
+
1060
+ // --------------------------------------------------------------------------
1061
+ // Set socket ZMQ_MAXMSGSIZE value
1062
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1063
+
1064
+ void
1065
+ zsocket_set_maxmsgsize (void *zocket, int maxmsgsize)
1066
+ {
1067
+ # if defined (ZMQ_MAXMSGSIZE)
1068
+ int64_t value = maxmsgsize;
1069
+ int rc = zmq_setsockopt (zocket, ZMQ_MAXMSGSIZE, &value, sizeof (int64_t));
1070
+ assert (rc == 0 || errno == ETERM);
1071
+ # endif
1072
+ }
1073
+
1074
+
1075
+ // --------------------------------------------------------------------------
1076
+ // Return socket ZMQ_MAXMSGSIZE value
1077
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1078
+
1079
+ int
1080
+ zsocket_maxmsgsize (void *zocket)
1081
+ {
1082
+ # if defined (ZMQ_MAXMSGSIZE)
1083
+ int64_t maxmsgsize;
1084
+ size_t option_len = sizeof (int64_t);
1085
+ zmq_getsockopt (zocket, ZMQ_MAXMSGSIZE, &maxmsgsize, &option_len);
1086
+ return (int) maxmsgsize;
1087
+ # endif
1088
+ }
1089
+
1090
+
1091
+ // --------------------------------------------------------------------------
1092
+ // Set socket ZMQ_MULTICAST_HOPS value
1093
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1094
+
1095
+ void
1096
+ zsocket_set_multicast_hops (void *zocket, int multicast_hops)
1097
+ {
1098
+ # if defined (ZMQ_MULTICAST_HOPS)
1099
+ int rc = zmq_setsockopt (zocket, ZMQ_MULTICAST_HOPS, &multicast_hops, sizeof (int));
1100
+ assert (rc == 0 || errno == ETERM);
1101
+ # endif
1102
+ }
1103
+
1104
+
1105
+ // --------------------------------------------------------------------------
1106
+ // Return socket ZMQ_MULTICAST_HOPS value
1107
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1108
+
1109
+ int
1110
+ zsocket_multicast_hops (void *zocket)
1111
+ {
1112
+ # if defined (ZMQ_MULTICAST_HOPS)
1113
+ int multicast_hops;
1114
+ size_t option_len = sizeof (int);
1115
+ zmq_getsockopt (zocket, ZMQ_MULTICAST_HOPS, &multicast_hops, &option_len);
1116
+ return multicast_hops;
1117
+ # endif
1118
+ }
1119
+
1120
+
1121
+ // --------------------------------------------------------------------------
1122
+ // Set socket ZMQ_RCVTIMEO value
1123
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1124
+
1125
+ void
1126
+ zsocket_set_rcvtimeo (void *zocket, int rcvtimeo)
1127
+ {
1128
+ # if defined (ZMQ_RCVTIMEO)
1129
+ int rc = zmq_setsockopt (zocket, ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
1130
+ assert (rc == 0 || errno == ETERM);
1131
+ # endif
1132
+ }
1133
+
1134
+
1135
+ // --------------------------------------------------------------------------
1136
+ // Return socket ZMQ_RCVTIMEO value
1137
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1138
+
1139
+ int
1140
+ zsocket_rcvtimeo (void *zocket)
1141
+ {
1142
+ # if defined (ZMQ_RCVTIMEO)
1143
+ int rcvtimeo;
1144
+ size_t option_len = sizeof (int);
1145
+ zmq_getsockopt (zocket, ZMQ_RCVTIMEO, &rcvtimeo, &option_len);
1146
+ return rcvtimeo;
1147
+ # endif
1148
+ }
1149
+
1150
+
1151
+ // --------------------------------------------------------------------------
1152
+ // Set socket ZMQ_SNDTIMEO value
1153
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1154
+
1155
+ void
1156
+ zsocket_set_sndtimeo (void *zocket, int sndtimeo)
1157
+ {
1158
+ # if defined (ZMQ_SNDTIMEO)
1159
+ int rc = zmq_setsockopt (zocket, ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
1160
+ assert (rc == 0 || errno == ETERM);
1161
+ # endif
1162
+ }
1163
+
1164
+
1165
+ // --------------------------------------------------------------------------
1166
+ // Return socket ZMQ_SNDTIMEO value
1167
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1168
+
1169
+ int
1170
+ zsocket_sndtimeo (void *zocket)
1171
+ {
1172
+ # if defined (ZMQ_SNDTIMEO)
1173
+ int sndtimeo;
1174
+ size_t option_len = sizeof (int);
1175
+ zmq_getsockopt (zocket, ZMQ_SNDTIMEO, &sndtimeo, &option_len);
1176
+ return sndtimeo;
1177
+ # endif
1178
+ }
1179
+
1180
+
1181
+ // --------------------------------------------------------------------------
1182
+ // Set socket ZMQ_IPV4ONLY value
1183
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1184
+
1185
+ void
1186
+ zsocket_set_ipv4only (void *zocket, int ipv4only)
1187
+ {
1188
+ # if defined (ZMQ_IPV4ONLY)
1189
+ int rc = zmq_setsockopt (zocket, ZMQ_IPV4ONLY, &ipv4only, sizeof (int));
1190
+ assert (rc == 0 || errno == ETERM);
1191
+ # endif
1192
+ }
1193
+
1194
+
1195
+ // --------------------------------------------------------------------------
1196
+ // Return socket ZMQ_IPV4ONLY value
1197
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1198
+
1199
+ int
1200
+ zsocket_ipv4only (void *zocket)
1201
+ {
1202
+ # if defined (ZMQ_IPV4ONLY)
1203
+ int ipv4only;
1204
+ size_t option_len = sizeof (int);
1205
+ zmq_getsockopt (zocket, ZMQ_IPV4ONLY, &ipv4only, &option_len);
1206
+ return ipv4only;
1207
+ # endif
1208
+ }
1209
+
1210
+
1211
+ // --------------------------------------------------------------------------
1212
+ // Set socket ZMQ_DELAY_ATTACH_ON_CONNECT value
1213
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1214
+
1215
+ void
1216
+ zsocket_set_delay_attach_on_connect (void *zocket, int delay_attach_on_connect)
1217
+ {
1218
+ # if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
1219
+ int rc = zmq_setsockopt (zocket, ZMQ_DELAY_ATTACH_ON_CONNECT, &delay_attach_on_connect, sizeof (int));
1220
+ assert (rc == 0 || errno == ETERM);
1221
+ # endif
1222
+ }
1223
+
1224
+
1225
+ // --------------------------------------------------------------------------
1226
+ // Set socket ZMQ_ROUTER_MANDATORY value
1227
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1228
+
1229
+ void
1230
+ zsocket_set_router_mandatory (void *zocket, int router_mandatory)
1231
+ {
1232
+ # if defined (ZMQ_ROUTER_MANDATORY)
1233
+ if (zsockopt_type (zocket) != ZMQ_ROUTER) {
1234
+ printf ("ZMQ_ROUTER_MANDATORY is not valid on %s sockets\n", zsocket_type_str (zocket));
1235
+ assert (false);
1236
+ }
1237
+ int rc = zmq_setsockopt (zocket, ZMQ_ROUTER_MANDATORY, &router_mandatory, sizeof (int));
1238
+ assert (rc == 0 || errno == ETERM);
1239
+ # endif
1240
+ }
1241
+
1242
+
1243
+ // --------------------------------------------------------------------------
1244
+ // Set socket ZMQ_ROUTER_RAW value
1245
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1246
+
1247
+ void
1248
+ zsocket_set_router_raw (void *zocket, int router_raw)
1249
+ {
1250
+ # if defined (ZMQ_ROUTER_RAW)
1251
+ if (zsockopt_type (zocket) != ZMQ_ROUTER) {
1252
+ printf ("ZMQ_ROUTER_RAW is not valid on %s sockets\n", zsocket_type_str (zocket));
1253
+ assert (false);
1254
+ }
1255
+ int rc = zmq_setsockopt (zocket, ZMQ_ROUTER_RAW, &router_raw, sizeof (int));
1256
+ assert (rc == 0 || errno == ETERM);
1257
+ # endif
1258
+ }
1259
+
1260
+
1261
+ // --------------------------------------------------------------------------
1262
+ // Set socket ZMQ_XPUB_VERBOSE value
1263
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1264
+
1265
+ void
1266
+ zsocket_set_xpub_verbose (void *zocket, int xpub_verbose)
1267
+ {
1268
+ # if defined (ZMQ_XPUB_VERBOSE)
1269
+ if (zsockopt_type (zocket) != ZMQ_XPUB) {
1270
+ printf ("ZMQ_XPUB_VERBOSE is not valid on %s sockets\n", zsocket_type_str (zocket));
1271
+ assert (false);
1272
+ }
1273
+ int rc = zmq_setsockopt (zocket, ZMQ_XPUB_VERBOSE, &xpub_verbose, sizeof (int));
1274
+ assert (rc == 0 || errno == ETERM);
1275
+ # endif
1276
+ }
1277
+
1278
+
1279
+ // --------------------------------------------------------------------------
1280
+ // Return socket ZMQ_RCVMORE value
1281
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1282
+
1283
+ int
1284
+ zsocket_rcvmore (void *zocket)
1285
+ {
1286
+ # if defined (ZMQ_RCVMORE)
1287
+ int rcvmore;
1288
+ size_t option_len = sizeof (int);
1289
+ zmq_getsockopt (zocket, ZMQ_RCVMORE, &rcvmore, &option_len);
1290
+ return rcvmore;
1291
+ # endif
1292
+ }
1293
+
1294
+
1295
+ // --------------------------------------------------------------------------
1296
+ // Return socket ZMQ_FD value
1297
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1298
+
1299
+ int
1300
+ zsocket_fd (void *zocket)
1301
+ {
1302
+ # if defined (ZMQ_FD)
1303
+ int fd;
1304
+ size_t option_len = sizeof (int);
1305
+ zmq_getsockopt (zocket, ZMQ_FD, &fd, &option_len);
1306
+ return fd;
1307
+ # endif
1308
+ }
1309
+
1310
+
1311
+ // --------------------------------------------------------------------------
1312
+ // Return socket ZMQ_EVENTS value
1313
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1314
+
1315
+ int
1316
+ zsocket_events (void *zocket)
1317
+ {
1318
+ # if defined (ZMQ_EVENTS)
1319
+ int events;
1320
+ size_t option_len = sizeof (int);
1321
+ zmq_getsockopt (zocket, ZMQ_EVENTS, &events, &option_len);
1322
+ return events;
1323
+ # endif
1324
+ }
1325
+
1326
+
1327
+ // --------------------------------------------------------------------------
1328
+ // Return socket ZMQ_LAST_ENDPOINT value
1329
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1330
+
1331
+ char *
1332
+ zsocket_last_endpoint (void *zocket)
1333
+ {
1334
+ # if defined (ZMQ_LAST_ENDPOINT)
1335
+ size_t option_len = 255;
1336
+ char *last_endpoint = (char *) zmalloc (option_len);
1337
+ zmq_getsockopt (zocket, ZMQ_LAST_ENDPOINT, last_endpoint, &option_len);
1338
+ return (char *) last_endpoint;
1339
+ # endif
1340
+ }
1341
+
1342
+
1343
+ // --------------------------------------------------------------------------
1344
+ // Set socket high-water mark, emulating 2.x API
1345
+
1346
+ void
1347
+ zsocket_set_hwm (void *zocket, int hwm)
1348
+ {
1349
+ zsocket_set_sndhwm (zocket, hwm);
1350
+ zsocket_set_rcvhwm (zocket, hwm);
1351
+ }
1352
+
1353
+ #endif
1354
+
1355
+ // --------------------------------------------------------------------------
1356
+ // Selftest
1357
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1358
+
1359
+ int
1360
+ zsockopt_test (bool verbose)
1361
+ {
1362
+ printf (" * zsockopt: ");
1363
+
1364
+ // @selftest
1365
+ zctx_t *ctx = zctx_new ();
1366
+ assert (ctx);
1367
+ void *zocket;
1368
+ #if (ZMQ_VERSION_MAJOR == 2)
1369
+ # if defined (ZMQ_HWM)
1370
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1371
+ assert (zocket);
1372
+ zsocket_set_hwm (zocket, 1);
1373
+ assert (zsocket_hwm (zocket) == 1);
1374
+ zsocket_hwm (zocket);
1375
+ zsocket_destroy (ctx, zocket);
1376
+ # endif
1377
+ # if defined (ZMQ_SWAP)
1378
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1379
+ assert (zocket);
1380
+ zsocket_set_swap (zocket, 1);
1381
+ assert (zsocket_swap (zocket) == 1);
1382
+ zsocket_swap (zocket);
1383
+ zsocket_destroy (ctx, zocket);
1384
+ # endif
1385
+ # if defined (ZMQ_AFFINITY)
1386
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1387
+ assert (zocket);
1388
+ zsocket_set_affinity (zocket, 1);
1389
+ assert (zsocket_affinity (zocket) == 1);
1390
+ zsocket_affinity (zocket);
1391
+ zsocket_destroy (ctx, zocket);
1392
+ # endif
1393
+ # if defined (ZMQ_IDENTITY)
1394
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1395
+ assert (zocket);
1396
+ zsocket_set_identity (zocket, "test");
1397
+ char *identity = zsocket_identity (zocket);
1398
+ assert (identity);
1399
+ free (identity);
1400
+ zsocket_destroy (ctx, zocket);
1401
+ # endif
1402
+ # if defined (ZMQ_RATE)
1403
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1404
+ assert (zocket);
1405
+ zsocket_set_rate (zocket, 1);
1406
+ assert (zsocket_rate (zocket) == 1);
1407
+ zsocket_rate (zocket);
1408
+ zsocket_destroy (ctx, zocket);
1409
+ # endif
1410
+ # if defined (ZMQ_RECOVERY_IVL)
1411
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1412
+ assert (zocket);
1413
+ zsocket_set_recovery_ivl (zocket, 1);
1414
+ assert (zsocket_recovery_ivl (zocket) == 1);
1415
+ zsocket_recovery_ivl (zocket);
1416
+ zsocket_destroy (ctx, zocket);
1417
+ # endif
1418
+ # if defined (ZMQ_RECOVERY_IVL_MSEC)
1419
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1420
+ assert (zocket);
1421
+ zsocket_set_recovery_ivl_msec (zocket, 1);
1422
+ assert (zsocket_recovery_ivl_msec (zocket) == 1);
1423
+ zsocket_recovery_ivl_msec (zocket);
1424
+ zsocket_destroy (ctx, zocket);
1425
+ # endif
1426
+ # if defined (ZMQ_MCAST_LOOP)
1427
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1428
+ assert (zocket);
1429
+ zsocket_set_mcast_loop (zocket, 1);
1430
+ assert (zsocket_mcast_loop (zocket) == 1);
1431
+ zsocket_mcast_loop (zocket);
1432
+ zsocket_destroy (ctx, zocket);
1433
+ # endif
1434
+ # if (ZMQ_VERSION_MINOR == 2)
1435
+ # if defined (ZMQ_RCVTIMEO)
1436
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1437
+ assert (zocket);
1438
+ zsocket_set_rcvtimeo (zocket, 1);
1439
+ assert (zsocket_rcvtimeo (zocket) == 1);
1440
+ zsocket_rcvtimeo (zocket);
1441
+ zsocket_destroy (ctx, zocket);
1442
+ # endif
1443
+ # endif
1444
+ # if (ZMQ_VERSION_MINOR == 2)
1445
+ # if defined (ZMQ_SNDTIMEO)
1446
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1447
+ assert (zocket);
1448
+ zsocket_set_sndtimeo (zocket, 1);
1449
+ assert (zsocket_sndtimeo (zocket) == 1);
1450
+ zsocket_sndtimeo (zocket);
1451
+ zsocket_destroy (ctx, zocket);
1452
+ # endif
1453
+ # endif
1454
+ # if defined (ZMQ_SNDBUF)
1455
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1456
+ assert (zocket);
1457
+ zsocket_set_sndbuf (zocket, 1);
1458
+ assert (zsocket_sndbuf (zocket) == 1);
1459
+ zsocket_sndbuf (zocket);
1460
+ zsocket_destroy (ctx, zocket);
1461
+ # endif
1462
+ # if defined (ZMQ_RCVBUF)
1463
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1464
+ assert (zocket);
1465
+ zsocket_set_rcvbuf (zocket, 1);
1466
+ assert (zsocket_rcvbuf (zocket) == 1);
1467
+ zsocket_rcvbuf (zocket);
1468
+ zsocket_destroy (ctx, zocket);
1469
+ # endif
1470
+ # if defined (ZMQ_LINGER)
1471
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1472
+ assert (zocket);
1473
+ zsocket_set_linger (zocket, 1);
1474
+ assert (zsocket_linger (zocket) == 1);
1475
+ zsocket_linger (zocket);
1476
+ zsocket_destroy (ctx, zocket);
1477
+ # endif
1478
+ # if defined (ZMQ_RECONNECT_IVL)
1479
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1480
+ assert (zocket);
1481
+ zsocket_set_reconnect_ivl (zocket, 1);
1482
+ assert (zsocket_reconnect_ivl (zocket) == 1);
1483
+ zsocket_reconnect_ivl (zocket);
1484
+ zsocket_destroy (ctx, zocket);
1485
+ # endif
1486
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
1487
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1488
+ assert (zocket);
1489
+ zsocket_set_reconnect_ivl_max (zocket, 1);
1490
+ assert (zsocket_reconnect_ivl_max (zocket) == 1);
1491
+ zsocket_reconnect_ivl_max (zocket);
1492
+ zsocket_destroy (ctx, zocket);
1493
+ # endif
1494
+ # if defined (ZMQ_BACKLOG)
1495
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1496
+ assert (zocket);
1497
+ zsocket_set_backlog (zocket, 1);
1498
+ assert (zsocket_backlog (zocket) == 1);
1499
+ zsocket_backlog (zocket);
1500
+ zsocket_destroy (ctx, zocket);
1501
+ # endif
1502
+ # if defined (ZMQ_SUBSCRIBE)
1503
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1504
+ assert (zocket);
1505
+ zsocket_set_subscribe (zocket, "test");
1506
+ zsocket_destroy (ctx, zocket);
1507
+ # endif
1508
+ # if defined (ZMQ_UNSUBSCRIBE)
1509
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1510
+ assert (zocket);
1511
+ zsocket_set_unsubscribe (zocket, "test");
1512
+ zsocket_destroy (ctx, zocket);
1513
+ # endif
1514
+ # if defined (ZMQ_TYPE)
1515
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1516
+ assert (zocket);
1517
+ zsocket_type (zocket);
1518
+ zsocket_destroy (ctx, zocket);
1519
+ # endif
1520
+ # if defined (ZMQ_RCVMORE)
1521
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1522
+ assert (zocket);
1523
+ zsocket_rcvmore (zocket);
1524
+ zsocket_destroy (ctx, zocket);
1525
+ # endif
1526
+ # if defined (ZMQ_FD)
1527
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1528
+ assert (zocket);
1529
+ zsocket_fd (zocket);
1530
+ zsocket_destroy (ctx, zocket);
1531
+ # endif
1532
+ # if defined (ZMQ_EVENTS)
1533
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1534
+ assert (zocket);
1535
+ zsocket_events (zocket);
1536
+ zsocket_destroy (ctx, zocket);
1537
+ # endif
1538
+ #endif
1539
+
1540
+ #if (ZMQ_VERSION_MAJOR == 3)
1541
+ # if defined (ZMQ_TYPE)
1542
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1543
+ assert (zocket);
1544
+ zsocket_type (zocket);
1545
+ zsocket_destroy (ctx, zocket);
1546
+ # endif
1547
+ # if defined (ZMQ_SNDHWM)
1548
+ zocket = zsocket_new (ctx, ZMQ_PUB);
1549
+ assert (zocket);
1550
+ zsocket_set_sndhwm (zocket, 1);
1551
+ assert (zsocket_sndhwm (zocket) == 1);
1552
+ zsocket_sndhwm (zocket);
1553
+ zsocket_destroy (ctx, zocket);
1554
+ # endif
1555
+ # if defined (ZMQ_RCVHWM)
1556
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1557
+ assert (zocket);
1558
+ zsocket_set_rcvhwm (zocket, 1);
1559
+ assert (zsocket_rcvhwm (zocket) == 1);
1560
+ zsocket_rcvhwm (zocket);
1561
+ zsocket_destroy (ctx, zocket);
1562
+ # endif
1563
+ # if defined (ZMQ_AFFINITY)
1564
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1565
+ assert (zocket);
1566
+ zsocket_set_affinity (zocket, 1);
1567
+ assert (zsocket_affinity (zocket) == 1);
1568
+ zsocket_affinity (zocket);
1569
+ zsocket_destroy (ctx, zocket);
1570
+ # endif
1571
+ # if defined (ZMQ_SUBSCRIBE)
1572
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1573
+ assert (zocket);
1574
+ zsocket_set_subscribe (zocket, "test");
1575
+ zsocket_destroy (ctx, zocket);
1576
+ # endif
1577
+ # if defined (ZMQ_UNSUBSCRIBE)
1578
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1579
+ assert (zocket);
1580
+ zsocket_set_unsubscribe (zocket, "test");
1581
+ zsocket_destroy (ctx, zocket);
1582
+ # endif
1583
+ # if defined (ZMQ_IDENTITY)
1584
+ zocket = zsocket_new (ctx, ZMQ_DEALER);
1585
+ assert (zocket);
1586
+ zsocket_set_identity (zocket, "test");
1587
+ char *identity = zsocket_identity (zocket);
1588
+ assert (identity);
1589
+ free (identity);
1590
+ zsocket_destroy (ctx, zocket);
1591
+ # endif
1592
+ # if defined (ZMQ_RATE)
1593
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1594
+ assert (zocket);
1595
+ zsocket_set_rate (zocket, 1);
1596
+ assert (zsocket_rate (zocket) == 1);
1597
+ zsocket_rate (zocket);
1598
+ zsocket_destroy (ctx, zocket);
1599
+ # endif
1600
+ # if defined (ZMQ_RECOVERY_IVL)
1601
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1602
+ assert (zocket);
1603
+ zsocket_set_recovery_ivl (zocket, 1);
1604
+ assert (zsocket_recovery_ivl (zocket) == 1);
1605
+ zsocket_recovery_ivl (zocket);
1606
+ zsocket_destroy (ctx, zocket);
1607
+ # endif
1608
+ # if defined (ZMQ_SNDBUF)
1609
+ zocket = zsocket_new (ctx, ZMQ_PUB);
1610
+ assert (zocket);
1611
+ zsocket_set_sndbuf (zocket, 1);
1612
+ assert (zsocket_sndbuf (zocket) == 1);
1613
+ zsocket_sndbuf (zocket);
1614
+ zsocket_destroy (ctx, zocket);
1615
+ # endif
1616
+ # if defined (ZMQ_RCVBUF)
1617
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1618
+ assert (zocket);
1619
+ zsocket_set_rcvbuf (zocket, 1);
1620
+ assert (zsocket_rcvbuf (zocket) == 1);
1621
+ zsocket_rcvbuf (zocket);
1622
+ zsocket_destroy (ctx, zocket);
1623
+ # endif
1624
+ # if defined (ZMQ_LINGER)
1625
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1626
+ assert (zocket);
1627
+ zsocket_set_linger (zocket, 1);
1628
+ assert (zsocket_linger (zocket) == 1);
1629
+ zsocket_linger (zocket);
1630
+ zsocket_destroy (ctx, zocket);
1631
+ # endif
1632
+ # if defined (ZMQ_RECONNECT_IVL)
1633
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1634
+ assert (zocket);
1635
+ zsocket_set_reconnect_ivl (zocket, 1);
1636
+ assert (zsocket_reconnect_ivl (zocket) == 1);
1637
+ zsocket_reconnect_ivl (zocket);
1638
+ zsocket_destroy (ctx, zocket);
1639
+ # endif
1640
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
1641
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1642
+ assert (zocket);
1643
+ zsocket_set_reconnect_ivl_max (zocket, 1);
1644
+ assert (zsocket_reconnect_ivl_max (zocket) == 1);
1645
+ zsocket_reconnect_ivl_max (zocket);
1646
+ zsocket_destroy (ctx, zocket);
1647
+ # endif
1648
+ # if defined (ZMQ_BACKLOG)
1649
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1650
+ assert (zocket);
1651
+ zsocket_set_backlog (zocket, 1);
1652
+ assert (zsocket_backlog (zocket) == 1);
1653
+ zsocket_backlog (zocket);
1654
+ zsocket_destroy (ctx, zocket);
1655
+ # endif
1656
+ # if defined (ZMQ_MAXMSGSIZE)
1657
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1658
+ assert (zocket);
1659
+ zsocket_set_maxmsgsize (zocket, 1);
1660
+ assert (zsocket_maxmsgsize (zocket) == 1);
1661
+ zsocket_maxmsgsize (zocket);
1662
+ zsocket_destroy (ctx, zocket);
1663
+ # endif
1664
+ # if defined (ZMQ_MULTICAST_HOPS)
1665
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1666
+ assert (zocket);
1667
+ zsocket_set_multicast_hops (zocket, 1);
1668
+ assert (zsocket_multicast_hops (zocket) == 1);
1669
+ zsocket_multicast_hops (zocket);
1670
+ zsocket_destroy (ctx, zocket);
1671
+ # endif
1672
+ # if defined (ZMQ_RCVTIMEO)
1673
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1674
+ assert (zocket);
1675
+ zsocket_set_rcvtimeo (zocket, 1);
1676
+ assert (zsocket_rcvtimeo (zocket) == 1);
1677
+ zsocket_rcvtimeo (zocket);
1678
+ zsocket_destroy (ctx, zocket);
1679
+ # endif
1680
+ # if defined (ZMQ_SNDTIMEO)
1681
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1682
+ assert (zocket);
1683
+ zsocket_set_sndtimeo (zocket, 1);
1684
+ assert (zsocket_sndtimeo (zocket) == 1);
1685
+ zsocket_sndtimeo (zocket);
1686
+ zsocket_destroy (ctx, zocket);
1687
+ # endif
1688
+ # if defined (ZMQ_IPV4ONLY)
1689
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1690
+ assert (zocket);
1691
+ zsocket_set_ipv4only (zocket, 1);
1692
+ assert (zsocket_ipv4only (zocket) == 1);
1693
+ zsocket_ipv4only (zocket);
1694
+ zsocket_destroy (ctx, zocket);
1695
+ # endif
1696
+ # if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
1697
+ zocket = zsocket_new (ctx, ZMQ_PUB);
1698
+ assert (zocket);
1699
+ zsocket_set_delay_attach_on_connect (zocket, 1);
1700
+ zsocket_destroy (ctx, zocket);
1701
+ # endif
1702
+ # if defined (ZMQ_ROUTER_MANDATORY)
1703
+ zocket = zsocket_new (ctx, ZMQ_ROUTER);
1704
+ assert (zocket);
1705
+ zsocket_set_router_mandatory (zocket, 1);
1706
+ zsocket_destroy (ctx, zocket);
1707
+ # endif
1708
+ # if defined (ZMQ_ROUTER_RAW)
1709
+ zocket = zsocket_new (ctx, ZMQ_ROUTER);
1710
+ assert (zocket);
1711
+ zsocket_set_router_raw (zocket, 1);
1712
+ zsocket_destroy (ctx, zocket);
1713
+ # endif
1714
+ # if defined (ZMQ_XPUB_VERBOSE)
1715
+ zocket = zsocket_new (ctx, ZMQ_XPUB);
1716
+ assert (zocket);
1717
+ zsocket_set_xpub_verbose (zocket, 1);
1718
+ zsocket_destroy (ctx, zocket);
1719
+ # endif
1720
+ # if defined (ZMQ_RCVMORE)
1721
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1722
+ assert (zocket);
1723
+ zsocket_rcvmore (zocket);
1724
+ zsocket_destroy (ctx, zocket);
1725
+ # endif
1726
+ # if defined (ZMQ_FD)
1727
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1728
+ assert (zocket);
1729
+ zsocket_fd (zocket);
1730
+ zsocket_destroy (ctx, zocket);
1731
+ # endif
1732
+ # if defined (ZMQ_EVENTS)
1733
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1734
+ assert (zocket);
1735
+ zsocket_events (zocket);
1736
+ zsocket_destroy (ctx, zocket);
1737
+ # endif
1738
+ # if defined (ZMQ_LAST_ENDPOINT)
1739
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1740
+ assert (zocket);
1741
+ char *last_endpoint = zsocket_last_endpoint (zocket);
1742
+ assert (last_endpoint);
1743
+ free (last_endpoint);
1744
+ zsocket_destroy (ctx, zocket);
1745
+ # endif
1746
+
1747
+ zocket = zsocket_new (ctx, ZMQ_SUB);
1748
+ zsocket_set_hwm (zocket, 1);
1749
+ #endif
1750
+
1751
+ zctx_destroy (&ctx);
1752
+ // @end
1753
+
1754
+ printf ("OK\n");
1755
+ return 0;
1756
+ }