czmq-ffi-gen 0.9.2-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +1 -0
  3. data/CHANGES.md +92 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE +14 -0
  6. data/README.md +112 -0
  7. data/lib/czmq-ffi-gen.rb +7 -0
  8. data/lib/czmq-ffi-gen/czmq/ffi.rb +1210 -0
  9. data/lib/czmq-ffi-gen/czmq/ffi/version.rb +15 -0
  10. data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +186 -0
  11. data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +286 -0
  12. data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +307 -0
  13. data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +222 -0
  14. data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +388 -0
  15. data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +140 -0
  16. data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +442 -0
  17. data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +156 -0
  18. data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +283 -0
  19. data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +194 -0
  20. data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +353 -0
  21. data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +359 -0
  22. data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +416 -0
  23. data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +659 -0
  24. data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +189 -0
  25. data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +365 -0
  26. data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +478 -0
  27. data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +396 -0
  28. data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +515 -0
  29. data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +194 -0
  30. data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +294 -0
  31. data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +3479 -0
  32. data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +203 -0
  33. data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +203 -0
  34. data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +221 -0
  35. data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +227 -0
  36. data/lib/czmq-ffi-gen/errors.rb +12 -0
  37. data/lib/czmq-ffi-gen/gem_version.rb +5 -0
  38. data/lib/czmq-ffi-gen/legacy.rb +16 -0
  39. data/lib/czmq-ffi-gen/libzmq.rb +18 -0
  40. data/lib/czmq-ffi-gen/signals.rb +27 -0
  41. data/lib/czmq-ffi-gen/vendor.rb +5 -0
  42. data/lib/czmq-ffi-gen/versions.rb +19 -0
  43. data/vendor/local/bin/inproc_lat.exe +0 -0
  44. data/vendor/local/bin/inproc_thr.exe +0 -0
  45. data/vendor/local/bin/libczmq.dll +0 -0
  46. data/vendor/local/bin/libgcc_s_seh-1.dll +0 -0
  47. data/vendor/local/bin/libstdc++-6.dll +0 -0
  48. data/vendor/local/bin/libzmq.dll +0 -0
  49. data/vendor/local/bin/local_lat.exe +0 -0
  50. data/vendor/local/bin/local_thr.exe +0 -0
  51. data/vendor/local/bin/remote_lat.exe +0 -0
  52. data/vendor/local/bin/remote_thr.exe +0 -0
  53. data/vendor/local/include/czmq.h +31 -0
  54. data/vendor/local/include/czmq_library.h +199 -0
  55. data/vendor/local/include/czmq_prelude.h +641 -0
  56. data/vendor/local/include/readme.txt +83 -0
  57. data/vendor/local/include/sha1.h +76 -0
  58. data/vendor/local/include/sha1.inc_c +335 -0
  59. data/vendor/local/include/slre.h +92 -0
  60. data/vendor/local/include/slre.inc_c +660 -0
  61. data/vendor/local/include/zactor.h +76 -0
  62. data/vendor/local/include/zarmour.h +114 -0
  63. data/vendor/local/include/zauth.h +100 -0
  64. data/vendor/local/include/zauth_v2.h +88 -0
  65. data/vendor/local/include/zbeacon.h +86 -0
  66. data/vendor/local/include/zbeacon_v2.h +75 -0
  67. data/vendor/local/include/zcert.h +136 -0
  68. data/vendor/local/include/zcertstore.h +100 -0
  69. data/vendor/local/include/zchunk.h +163 -0
  70. data/vendor/local/include/zclock.h +73 -0
  71. data/vendor/local/include/zconfig.h +185 -0
  72. data/vendor/local/include/zctx.h +107 -0
  73. data/vendor/local/include/zdigest.h +65 -0
  74. data/vendor/local/include/zdir.h +149 -0
  75. data/vendor/local/include/zdir_patch.h +82 -0
  76. data/vendor/local/include/zfile.h +177 -0
  77. data/vendor/local/include/zframe.h +176 -0
  78. data/vendor/local/include/zgossip.h +95 -0
  79. data/vendor/local/include/zgossip_engine.inc +927 -0
  80. data/vendor/local/include/zgossip_msg.h +129 -0
  81. data/vendor/local/include/zhash.h +195 -0
  82. data/vendor/local/include/zhash_primes.inc +329 -0
  83. data/vendor/local/include/zhashx.h +298 -0
  84. data/vendor/local/include/ziflist.h +77 -0
  85. data/vendor/local/include/zlist.h +158 -0
  86. data/vendor/local/include/zlistx.h +205 -0
  87. data/vendor/local/include/zloop.h +168 -0
  88. data/vendor/local/include/zmonitor.h +73 -0
  89. data/vendor/local/include/zmonitor_v2.h +56 -0
  90. data/vendor/local/include/zmq.h +617 -0
  91. data/vendor/local/include/zmq_utils.h +48 -0
  92. data/vendor/local/include/zmsg.h +280 -0
  93. data/vendor/local/include/zmutex.h +55 -0
  94. data/vendor/local/include/zpoller.h +92 -0
  95. data/vendor/local/include/zproc.h +168 -0
  96. data/vendor/local/include/zproxy.h +111 -0
  97. data/vendor/local/include/zproxy_v2.h +62 -0
  98. data/vendor/local/include/zrex.h +82 -0
  99. data/vendor/local/include/zsock.h +912 -0
  100. data/vendor/local/include/zsock_option.inc +4126 -0
  101. data/vendor/local/include/zsocket.h +110 -0
  102. data/vendor/local/include/zsockopt.h +256 -0
  103. data/vendor/local/include/zstr.h +110 -0
  104. data/vendor/local/include/zsys.h +386 -0
  105. data/vendor/local/include/zthread.h +50 -0
  106. data/vendor/local/include/ztimerset.h +90 -0
  107. data/vendor/local/include/ztrie.h +106 -0
  108. data/vendor/local/include/zuuid.h +96 -0
  109. data/vendor/local/lib/libczmq.dll.a +0 -0
  110. data/vendor/local/lib/liblibzmq.dll.a +0 -0
  111. data/vendor/local/lib/libzmq-static.a +0 -0
  112. data/vendor/local/lib/pkgconfig/libczmq.pc +23 -0
  113. data/vendor/local/lib/pkgconfig/libzmq.pc +11 -0
  114. data/vendor/local/share/zmq/AUTHORS.txt +147 -0
  115. data/vendor/local/share/zmq/COPYING.LESSER.txt +181 -0
  116. data/vendor/local/share/zmq/COPYING.txt +674 -0
  117. data/vendor/local/share/zmq/NEWS.txt +978 -0
  118. metadata +230 -0
@@ -0,0 +1,4126 @@
1
+ /* =========================================================================
2
+ zsock_option - get/set ZeroMQ socket options
3
+
4
+ ******************************************************************
5
+ * GENERATED SOURCE CODE, DO NOT EDIT!! *
6
+ * TO CHANGE THIS FILE: *
7
+ * - EDIT src/zsock_option.gsl and/or *
8
+ * - EDIT src/zsock_option.xml and then *
9
+ * - RUN 'make code' *
10
+ ******************************************************************
11
+
12
+ Copyright (c) the Contributors as noted in the AUTHORS file.
13
+ This file is part of CZMQ, the high-level C binding for ZeroMQ:
14
+ http://czmq.zeromq.org.
15
+
16
+ This Source Code Form is subject to the terms of the Mozilla Public
17
+ License, v. 2.0. If a copy of the MPL was not distributed with this
18
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
19
+ =========================================================================
20
+ */
21
+
22
+ #if (ZMQ_VERSION_MAJOR == 4)
23
+ // --------------------------------------------------------------------------
24
+ // Set socket ZMQ_HEARTBEAT_IVL value
25
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
26
+
27
+ void
28
+ zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl)
29
+ {
30
+ assert (self);
31
+ # if defined (ZMQ_HEARTBEAT_IVL)
32
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_IVL, &heartbeat_ivl, sizeof (int));
33
+ assert (rc == 0 || zmq_errno () == ETERM);
34
+ # endif
35
+ }
36
+
37
+
38
+ // --------------------------------------------------------------------------
39
+ // Return socket ZMQ_HEARTBEAT_IVL value
40
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
41
+
42
+ int
43
+ zsock_heartbeat_ivl (void *self)
44
+ {
45
+ assert (self);
46
+ # if defined (ZMQ_HEARTBEAT_IVL)
47
+ int heartbeat_ivl;
48
+ size_t option_len = sizeof (int);
49
+ zmq_getsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_IVL, &heartbeat_ivl, &option_len);
50
+ return heartbeat_ivl;
51
+ # else
52
+ return 0;
53
+ # endif
54
+ }
55
+
56
+ // --------------------------------------------------------------------------
57
+ // Set socket ZMQ_HEARTBEAT_TTL value
58
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
59
+
60
+ void
61
+ zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl)
62
+ {
63
+ assert (self);
64
+ # if defined (ZMQ_HEARTBEAT_TTL)
65
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_TTL, &heartbeat_ttl, sizeof (int));
66
+ assert (rc == 0 || zmq_errno () == ETERM);
67
+ # endif
68
+ }
69
+
70
+
71
+ // --------------------------------------------------------------------------
72
+ // Return socket ZMQ_HEARTBEAT_TTL value
73
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
74
+
75
+ int
76
+ zsock_heartbeat_ttl (void *self)
77
+ {
78
+ assert (self);
79
+ # if defined (ZMQ_HEARTBEAT_TTL)
80
+ int heartbeat_ttl;
81
+ size_t option_len = sizeof (int);
82
+ zmq_getsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_TTL, &heartbeat_ttl, &option_len);
83
+ return heartbeat_ttl;
84
+ # else
85
+ return 0;
86
+ # endif
87
+ }
88
+
89
+ // --------------------------------------------------------------------------
90
+ // Set socket ZMQ_HEARTBEAT_TIMEOUT value
91
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
92
+
93
+ void
94
+ zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout)
95
+ {
96
+ assert (self);
97
+ # if defined (ZMQ_HEARTBEAT_TIMEOUT)
98
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_TIMEOUT, &heartbeat_timeout, sizeof (int));
99
+ assert (rc == 0 || zmq_errno () == ETERM);
100
+ # endif
101
+ }
102
+
103
+
104
+ // --------------------------------------------------------------------------
105
+ // Return socket ZMQ_HEARTBEAT_TIMEOUT value
106
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
107
+
108
+ int
109
+ zsock_heartbeat_timeout (void *self)
110
+ {
111
+ assert (self);
112
+ # if defined (ZMQ_HEARTBEAT_TIMEOUT)
113
+ int heartbeat_timeout;
114
+ size_t option_len = sizeof (int);
115
+ zmq_getsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_TIMEOUT, &heartbeat_timeout, &option_len);
116
+ return heartbeat_timeout;
117
+ # else
118
+ return 0;
119
+ # endif
120
+ }
121
+
122
+ // --------------------------------------------------------------------------
123
+ // Set socket ZMQ_USE_FD value
124
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
125
+
126
+ void
127
+ zsock_set_use_fd (void *self, int use_fd)
128
+ {
129
+ assert (self);
130
+ # if defined (ZMQ_USE_FD)
131
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_USE_FD, &use_fd, sizeof (int));
132
+ assert (rc == 0 || zmq_errno () == ETERM);
133
+ # endif
134
+ }
135
+
136
+
137
+ // --------------------------------------------------------------------------
138
+ // Return socket ZMQ_USE_FD value
139
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
140
+
141
+ int
142
+ zsock_use_fd (void *self)
143
+ {
144
+ assert (self);
145
+ # if defined (ZMQ_USE_FD)
146
+ int use_fd;
147
+ size_t option_len = sizeof (int);
148
+ zmq_getsockopt (zsock_resolve (self), ZMQ_USE_FD, &use_fd, &option_len);
149
+ return use_fd;
150
+ # else
151
+ return 0;
152
+ # endif
153
+ }
154
+
155
+ // --------------------------------------------------------------------------
156
+ // Set socket ZMQ_TOS value
157
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
158
+
159
+ void
160
+ zsock_set_tos (void *self, int tos)
161
+ {
162
+ assert (self);
163
+ # if defined (ZMQ_TOS)
164
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TOS, &tos, sizeof (int));
165
+ assert (rc == 0 || zmq_errno () == ETERM);
166
+ # endif
167
+ }
168
+
169
+
170
+ // --------------------------------------------------------------------------
171
+ // Return socket ZMQ_TOS value
172
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
173
+
174
+ int
175
+ zsock_tos (void *self)
176
+ {
177
+ assert (self);
178
+ # if defined (ZMQ_TOS)
179
+ int tos;
180
+ size_t option_len = sizeof (int);
181
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TOS, &tos, &option_len);
182
+ return tos;
183
+ # else
184
+ return 0;
185
+ # endif
186
+ }
187
+
188
+ // --------------------------------------------------------------------------
189
+ // Set socket ZMQ_ROUTER_HANDOVER value
190
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
191
+
192
+ void
193
+ zsock_set_router_handover (void *self, int router_handover)
194
+ {
195
+ assert (self);
196
+ # if defined (ZMQ_ROUTER_HANDOVER)
197
+ if (zsock_type (self) != ZMQ_ROUTER) {
198
+ printf ("ZMQ_ROUTER_HANDOVER is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
199
+ assert (false);
200
+ }
201
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_ROUTER_HANDOVER, &router_handover, sizeof (int));
202
+ assert (rc == 0 || zmq_errno () == ETERM);
203
+ # endif
204
+ }
205
+
206
+
207
+ // --------------------------------------------------------------------------
208
+ // Set socket ZMQ_ROUTER_MANDATORY value
209
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
210
+
211
+ void
212
+ zsock_set_router_mandatory (void *self, int router_mandatory)
213
+ {
214
+ assert (self);
215
+ # if defined (ZMQ_ROUTER_MANDATORY)
216
+ if (zsock_type (self) != ZMQ_ROUTER) {
217
+ printf ("ZMQ_ROUTER_MANDATORY is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
218
+ assert (false);
219
+ }
220
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_ROUTER_MANDATORY, &router_mandatory, sizeof (int));
221
+ assert (rc == 0 || zmq_errno () == ETERM);
222
+ # endif
223
+ }
224
+
225
+
226
+ // --------------------------------------------------------------------------
227
+ // Set socket ZMQ_PROBE_ROUTER value
228
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
229
+
230
+ void
231
+ zsock_set_probe_router (void *self, int probe_router)
232
+ {
233
+ assert (self);
234
+ # if defined (ZMQ_PROBE_ROUTER)
235
+ if (zsock_type (self) != ZMQ_ROUTER
236
+ && zsock_type (self) != ZMQ_DEALER
237
+ && zsock_type (self) != ZMQ_REQ) {
238
+ printf ("ZMQ_PROBE_ROUTER is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
239
+ assert (false);
240
+ }
241
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_PROBE_ROUTER, &probe_router, sizeof (int));
242
+ assert (rc == 0 || zmq_errno () == ETERM);
243
+ # endif
244
+ }
245
+
246
+
247
+ // --------------------------------------------------------------------------
248
+ // Set socket ZMQ_REQ_RELAXED value
249
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
250
+
251
+ void
252
+ zsock_set_req_relaxed (void *self, int req_relaxed)
253
+ {
254
+ assert (self);
255
+ # if defined (ZMQ_REQ_RELAXED)
256
+ if (zsock_type (self) != ZMQ_REQ) {
257
+ printf ("ZMQ_REQ_RELAXED is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
258
+ assert (false);
259
+ }
260
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_REQ_RELAXED, &req_relaxed, sizeof (int));
261
+ assert (rc == 0 || zmq_errno () == ETERM);
262
+ # endif
263
+ }
264
+
265
+
266
+ // --------------------------------------------------------------------------
267
+ // Set socket ZMQ_REQ_CORRELATE value
268
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
269
+
270
+ void
271
+ zsock_set_req_correlate (void *self, int req_correlate)
272
+ {
273
+ assert (self);
274
+ # if defined (ZMQ_REQ_CORRELATE)
275
+ if (zsock_type (self) != ZMQ_REQ) {
276
+ printf ("ZMQ_REQ_CORRELATE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
277
+ assert (false);
278
+ }
279
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_REQ_CORRELATE, &req_correlate, sizeof (int));
280
+ assert (rc == 0 || zmq_errno () == ETERM);
281
+ # endif
282
+ }
283
+
284
+
285
+ // --------------------------------------------------------------------------
286
+ // Set socket ZMQ_CONFLATE value
287
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
288
+
289
+ void
290
+ zsock_set_conflate (void *self, int conflate)
291
+ {
292
+ assert (self);
293
+ # if defined (ZMQ_CONFLATE)
294
+ if (zsock_type (self) != ZMQ_PUSH
295
+ && zsock_type (self) != ZMQ_PULL
296
+ && zsock_type (self) != ZMQ_PUB
297
+ && zsock_type (self) != ZMQ_SUB
298
+ && zsock_type (self) != ZMQ_DEALER) {
299
+ printf ("ZMQ_CONFLATE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
300
+ assert (false);
301
+ }
302
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CONFLATE, &conflate, sizeof (int));
303
+ assert (rc == 0 || zmq_errno () == ETERM);
304
+ # endif
305
+ }
306
+
307
+
308
+ // --------------------------------------------------------------------------
309
+ // Set socket ZMQ_ZAP_DOMAIN value
310
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
311
+
312
+ void
313
+ zsock_set_zap_domain (void *self, const char * zap_domain)
314
+ {
315
+ assert (self);
316
+ # if defined (ZMQ_ZAP_DOMAIN)
317
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_ZAP_DOMAIN, zap_domain, strlen (zap_domain));
318
+ assert (rc == 0 || zmq_errno () == ETERM);
319
+ # endif
320
+ }
321
+
322
+
323
+ // --------------------------------------------------------------------------
324
+ // Return socket ZMQ_ZAP_DOMAIN value
325
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
326
+
327
+ char *
328
+ zsock_zap_domain (void *self)
329
+ {
330
+ assert (self);
331
+ # if defined (ZMQ_ZAP_DOMAIN)
332
+ size_t option_len = 255;
333
+ char *zap_domain = (char *) zmalloc (option_len);
334
+ zmq_getsockopt (zsock_resolve (self), ZMQ_ZAP_DOMAIN, zap_domain, &option_len);
335
+ return (char *) zap_domain;
336
+ # else
337
+ return NULL;
338
+ # endif
339
+ }
340
+
341
+ // --------------------------------------------------------------------------
342
+ // Return socket ZMQ_MECHANISM value
343
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
344
+
345
+ int
346
+ zsock_mechanism (void *self)
347
+ {
348
+ assert (self);
349
+ # if defined (ZMQ_MECHANISM)
350
+ int mechanism;
351
+ size_t option_len = sizeof (int);
352
+ zmq_getsockopt (zsock_resolve (self), ZMQ_MECHANISM, &mechanism, &option_len);
353
+ return mechanism;
354
+ # else
355
+ return 0;
356
+ # endif
357
+ }
358
+
359
+ // --------------------------------------------------------------------------
360
+ // Set socket ZMQ_PLAIN_SERVER value
361
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
362
+
363
+ void
364
+ zsock_set_plain_server (void *self, int plain_server)
365
+ {
366
+ assert (self);
367
+ # if defined (ZMQ_PLAIN_SERVER)
368
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_PLAIN_SERVER, &plain_server, sizeof (int));
369
+ assert (rc == 0 || zmq_errno () == ETERM);
370
+ # endif
371
+ }
372
+
373
+
374
+ // --------------------------------------------------------------------------
375
+ // Return socket ZMQ_PLAIN_SERVER value
376
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
377
+
378
+ int
379
+ zsock_plain_server (void *self)
380
+ {
381
+ assert (self);
382
+ # if defined (ZMQ_PLAIN_SERVER)
383
+ int plain_server;
384
+ size_t option_len = sizeof (int);
385
+ zmq_getsockopt (zsock_resolve (self), ZMQ_PLAIN_SERVER, &plain_server, &option_len);
386
+ return plain_server;
387
+ # else
388
+ return 0;
389
+ # endif
390
+ }
391
+
392
+ // --------------------------------------------------------------------------
393
+ // Set socket ZMQ_PLAIN_USERNAME value
394
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
395
+
396
+ void
397
+ zsock_set_plain_username (void *self, const char * plain_username)
398
+ {
399
+ assert (self);
400
+ # if defined (ZMQ_PLAIN_USERNAME)
401
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_PLAIN_USERNAME, plain_username, strlen (plain_username));
402
+ assert (rc == 0 || zmq_errno () == ETERM);
403
+ # endif
404
+ }
405
+
406
+
407
+ // --------------------------------------------------------------------------
408
+ // Return socket ZMQ_PLAIN_USERNAME value
409
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
410
+
411
+ char *
412
+ zsock_plain_username (void *self)
413
+ {
414
+ assert (self);
415
+ # if defined (ZMQ_PLAIN_USERNAME)
416
+ size_t option_len = 255;
417
+ char *plain_username = (char *) zmalloc (option_len);
418
+ zmq_getsockopt (zsock_resolve (self), ZMQ_PLAIN_USERNAME, plain_username, &option_len);
419
+ return (char *) plain_username;
420
+ # else
421
+ return NULL;
422
+ # endif
423
+ }
424
+
425
+ // --------------------------------------------------------------------------
426
+ // Set socket ZMQ_PLAIN_PASSWORD value
427
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
428
+
429
+ void
430
+ zsock_set_plain_password (void *self, const char * plain_password)
431
+ {
432
+ assert (self);
433
+ # if defined (ZMQ_PLAIN_PASSWORD)
434
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_PLAIN_PASSWORD, plain_password, strlen (plain_password));
435
+ assert (rc == 0 || zmq_errno () == ETERM);
436
+ # endif
437
+ }
438
+
439
+
440
+ // --------------------------------------------------------------------------
441
+ // Return socket ZMQ_PLAIN_PASSWORD value
442
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
443
+
444
+ char *
445
+ zsock_plain_password (void *self)
446
+ {
447
+ assert (self);
448
+ # if defined (ZMQ_PLAIN_PASSWORD)
449
+ size_t option_len = 255;
450
+ char *plain_password = (char *) zmalloc (option_len);
451
+ zmq_getsockopt (zsock_resolve (self), ZMQ_PLAIN_PASSWORD, plain_password, &option_len);
452
+ return (char *) plain_password;
453
+ # else
454
+ return NULL;
455
+ # endif
456
+ }
457
+
458
+ // --------------------------------------------------------------------------
459
+ // Set socket ZMQ_CURVE_SERVER value
460
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
461
+
462
+ void
463
+ zsock_set_curve_server (void *self, int curve_server)
464
+ {
465
+ assert (self);
466
+ # if defined (ZMQ_CURVE_SERVER)
467
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_SERVER, &curve_server, sizeof (int));
468
+ assert (rc == 0 || zmq_errno () == ETERM);
469
+ # endif
470
+ }
471
+
472
+
473
+ // --------------------------------------------------------------------------
474
+ // Return socket ZMQ_CURVE_SERVER value
475
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
476
+
477
+ int
478
+ zsock_curve_server (void *self)
479
+ {
480
+ assert (self);
481
+ # if defined (ZMQ_CURVE_SERVER)
482
+ int curve_server;
483
+ size_t option_len = sizeof (int);
484
+ zmq_getsockopt (zsock_resolve (self), ZMQ_CURVE_SERVER, &curve_server, &option_len);
485
+ return curve_server;
486
+ # else
487
+ return 0;
488
+ # endif
489
+ }
490
+
491
+ // --------------------------------------------------------------------------
492
+ // Set socket ZMQ_CURVE_PUBLICKEY value
493
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
494
+
495
+ void
496
+ zsock_set_curve_publickey (void *self, const char * curve_publickey)
497
+ {
498
+ assert (self);
499
+ # if defined (ZMQ_CURVE_PUBLICKEY)
500
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_PUBLICKEY, curve_publickey, strlen (curve_publickey));
501
+ assert (rc == 0 || zmq_errno () == ETERM);
502
+ # endif
503
+ }
504
+
505
+
506
+ // --------------------------------------------------------------------------
507
+ // Set socket ZMQ_CURVE_PUBLICKEY value from 32-octet binary
508
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
509
+
510
+ void
511
+ zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey)
512
+ {
513
+ # if defined (ZMQ_CURVE_PUBLICKEY)
514
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_PUBLICKEY, curve_publickey, 32);
515
+ assert (rc == 0 || zmq_errno () == ETERM);
516
+ # endif
517
+ }
518
+
519
+
520
+ // --------------------------------------------------------------------------
521
+ // Return socket ZMQ_CURVE_PUBLICKEY value
522
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
523
+
524
+ char *
525
+ zsock_curve_publickey (void *self)
526
+ {
527
+ assert (self);
528
+ # if defined (ZMQ_CURVE_PUBLICKEY)
529
+ size_t option_len = 40 + 1; // Z85 key + terminator
530
+ char *curve_publickey = (char *) zmalloc (option_len);
531
+ zmq_getsockopt (zsock_resolve (self), ZMQ_CURVE_PUBLICKEY, curve_publickey, &option_len);
532
+ return (char *) curve_publickey;
533
+ # else
534
+ return NULL;
535
+ # endif
536
+ }
537
+
538
+ // --------------------------------------------------------------------------
539
+ // Set socket ZMQ_CURVE_SECRETKEY value
540
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
541
+
542
+ void
543
+ zsock_set_curve_secretkey (void *self, const char * curve_secretkey)
544
+ {
545
+ assert (self);
546
+ # if defined (ZMQ_CURVE_SECRETKEY)
547
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_SECRETKEY, curve_secretkey, strlen (curve_secretkey));
548
+ assert (rc == 0 || zmq_errno () == ETERM);
549
+ # endif
550
+ }
551
+
552
+
553
+ // --------------------------------------------------------------------------
554
+ // Set socket ZMQ_CURVE_SECRETKEY value from 32-octet binary
555
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
556
+
557
+ void
558
+ zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey)
559
+ {
560
+ # if defined (ZMQ_CURVE_SECRETKEY)
561
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_SECRETKEY, curve_secretkey, 32);
562
+ assert (rc == 0 || zmq_errno () == ETERM);
563
+ # endif
564
+ }
565
+
566
+
567
+ // --------------------------------------------------------------------------
568
+ // Return socket ZMQ_CURVE_SECRETKEY value
569
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
570
+
571
+ char *
572
+ zsock_curve_secretkey (void *self)
573
+ {
574
+ assert (self);
575
+ # if defined (ZMQ_CURVE_SECRETKEY)
576
+ size_t option_len = 40 + 1; // Z85 key + terminator
577
+ char *curve_secretkey = (char *) zmalloc (option_len);
578
+ zmq_getsockopt (zsock_resolve (self), ZMQ_CURVE_SECRETKEY, curve_secretkey, &option_len);
579
+ return (char *) curve_secretkey;
580
+ # else
581
+ return NULL;
582
+ # endif
583
+ }
584
+
585
+ // --------------------------------------------------------------------------
586
+ // Set socket ZMQ_CURVE_SERVERKEY value
587
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
588
+
589
+ void
590
+ zsock_set_curve_serverkey (void *self, const char * curve_serverkey)
591
+ {
592
+ assert (self);
593
+ # if defined (ZMQ_CURVE_SERVERKEY)
594
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_SERVERKEY, curve_serverkey, strlen (curve_serverkey));
595
+ assert (rc == 0 || zmq_errno () == ETERM);
596
+ # endif
597
+ }
598
+
599
+
600
+ // --------------------------------------------------------------------------
601
+ // Set socket ZMQ_CURVE_SERVERKEY value from 32-octet binary
602
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
603
+
604
+ void
605
+ zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey)
606
+ {
607
+ # if defined (ZMQ_CURVE_SERVERKEY)
608
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_SERVERKEY, curve_serverkey, 32);
609
+ assert (rc == 0 || zmq_errno () == ETERM);
610
+ # endif
611
+ }
612
+
613
+
614
+ // --------------------------------------------------------------------------
615
+ // Return socket ZMQ_CURVE_SERVERKEY value
616
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
617
+
618
+ char *
619
+ zsock_curve_serverkey (void *self)
620
+ {
621
+ assert (self);
622
+ # if defined (ZMQ_CURVE_SERVERKEY)
623
+ size_t option_len = 40 + 1; // Z85 key + terminator
624
+ char *curve_serverkey = (char *) zmalloc (option_len);
625
+ zmq_getsockopt (zsock_resolve (self), ZMQ_CURVE_SERVERKEY, curve_serverkey, &option_len);
626
+ return (char *) curve_serverkey;
627
+ # else
628
+ return NULL;
629
+ # endif
630
+ }
631
+
632
+ // --------------------------------------------------------------------------
633
+ // Set socket ZMQ_GSSAPI_SERVER value
634
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
635
+
636
+ void
637
+ zsock_set_gssapi_server (void *self, int gssapi_server)
638
+ {
639
+ assert (self);
640
+ # if defined (ZMQ_GSSAPI_SERVER)
641
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_GSSAPI_SERVER, &gssapi_server, sizeof (int));
642
+ assert (rc == 0 || zmq_errno () == ETERM);
643
+ # endif
644
+ }
645
+
646
+
647
+ // --------------------------------------------------------------------------
648
+ // Return socket ZMQ_GSSAPI_SERVER value
649
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
650
+
651
+ int
652
+ zsock_gssapi_server (void *self)
653
+ {
654
+ assert (self);
655
+ # if defined (ZMQ_GSSAPI_SERVER)
656
+ int gssapi_server;
657
+ size_t option_len = sizeof (int);
658
+ zmq_getsockopt (zsock_resolve (self), ZMQ_GSSAPI_SERVER, &gssapi_server, &option_len);
659
+ return gssapi_server;
660
+ # else
661
+ return 0;
662
+ # endif
663
+ }
664
+
665
+ // --------------------------------------------------------------------------
666
+ // Set socket ZMQ_GSSAPI_PLAINTEXT value
667
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
668
+
669
+ void
670
+ zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext)
671
+ {
672
+ assert (self);
673
+ # if defined (ZMQ_GSSAPI_PLAINTEXT)
674
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_GSSAPI_PLAINTEXT, &gssapi_plaintext, sizeof (int));
675
+ assert (rc == 0 || zmq_errno () == ETERM);
676
+ # endif
677
+ }
678
+
679
+
680
+ // --------------------------------------------------------------------------
681
+ // Return socket ZMQ_GSSAPI_PLAINTEXT value
682
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
683
+
684
+ int
685
+ zsock_gssapi_plaintext (void *self)
686
+ {
687
+ assert (self);
688
+ # if defined (ZMQ_GSSAPI_PLAINTEXT)
689
+ int gssapi_plaintext;
690
+ size_t option_len = sizeof (int);
691
+ zmq_getsockopt (zsock_resolve (self), ZMQ_GSSAPI_PLAINTEXT, &gssapi_plaintext, &option_len);
692
+ return gssapi_plaintext;
693
+ # else
694
+ return 0;
695
+ # endif
696
+ }
697
+
698
+ // --------------------------------------------------------------------------
699
+ // Set socket ZMQ_GSSAPI_PRINCIPAL value
700
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
701
+
702
+ void
703
+ zsock_set_gssapi_principal (void *self, const char * gssapi_principal)
704
+ {
705
+ assert (self);
706
+ # if defined (ZMQ_GSSAPI_PRINCIPAL)
707
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_GSSAPI_PRINCIPAL, gssapi_principal, strlen (gssapi_principal));
708
+ assert (rc == 0 || zmq_errno () == ETERM);
709
+ # endif
710
+ }
711
+
712
+
713
+ // --------------------------------------------------------------------------
714
+ // Return socket ZMQ_GSSAPI_PRINCIPAL value
715
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
716
+
717
+ char *
718
+ zsock_gssapi_principal (void *self)
719
+ {
720
+ assert (self);
721
+ # if defined (ZMQ_GSSAPI_PRINCIPAL)
722
+ size_t option_len = 255;
723
+ char *gssapi_principal = (char *) zmalloc (option_len);
724
+ zmq_getsockopt (zsock_resolve (self), ZMQ_GSSAPI_PRINCIPAL, gssapi_principal, &option_len);
725
+ return (char *) gssapi_principal;
726
+ # else
727
+ return NULL;
728
+ # endif
729
+ }
730
+
731
+ // --------------------------------------------------------------------------
732
+ // Set socket ZMQ_GSSAPI_SERVICE_PRINCIPAL value
733
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
734
+
735
+ void
736
+ zsock_set_gssapi_service_principal (void *self, const char * gssapi_service_principal)
737
+ {
738
+ assert (self);
739
+ # if defined (ZMQ_GSSAPI_SERVICE_PRINCIPAL)
740
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_GSSAPI_SERVICE_PRINCIPAL, gssapi_service_principal, strlen (gssapi_service_principal));
741
+ assert (rc == 0 || zmq_errno () == ETERM);
742
+ # endif
743
+ }
744
+
745
+
746
+ // --------------------------------------------------------------------------
747
+ // Return socket ZMQ_GSSAPI_SERVICE_PRINCIPAL value
748
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
749
+
750
+ char *
751
+ zsock_gssapi_service_principal (void *self)
752
+ {
753
+ assert (self);
754
+ # if defined (ZMQ_GSSAPI_SERVICE_PRINCIPAL)
755
+ size_t option_len = 255;
756
+ char *gssapi_service_principal = (char *) zmalloc (option_len);
757
+ zmq_getsockopt (zsock_resolve (self), ZMQ_GSSAPI_SERVICE_PRINCIPAL, gssapi_service_principal, &option_len);
758
+ return (char *) gssapi_service_principal;
759
+ # else
760
+ return NULL;
761
+ # endif
762
+ }
763
+
764
+ // --------------------------------------------------------------------------
765
+ // Set socket ZMQ_IPV6 value
766
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
767
+
768
+ void
769
+ zsock_set_ipv6 (void *self, int ipv6)
770
+ {
771
+ assert (self);
772
+ # if defined (ZMQ_IPV6)
773
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IPV6, &ipv6, sizeof (int));
774
+ assert (rc == 0 || zmq_errno () == ETERM);
775
+ # endif
776
+ }
777
+
778
+
779
+ // --------------------------------------------------------------------------
780
+ // Return socket ZMQ_IPV6 value
781
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
782
+
783
+ int
784
+ zsock_ipv6 (void *self)
785
+ {
786
+ assert (self);
787
+ # if defined (ZMQ_IPV6)
788
+ int ipv6;
789
+ size_t option_len = sizeof (int);
790
+ zmq_getsockopt (zsock_resolve (self), ZMQ_IPV6, &ipv6, &option_len);
791
+ return ipv6;
792
+ # else
793
+ return 0;
794
+ # endif
795
+ }
796
+
797
+ // --------------------------------------------------------------------------
798
+ // Set socket ZMQ_IMMEDIATE value
799
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
800
+
801
+ void
802
+ zsock_set_immediate (void *self, int immediate)
803
+ {
804
+ assert (self);
805
+ # if defined (ZMQ_IMMEDIATE)
806
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IMMEDIATE, &immediate, sizeof (int));
807
+ assert (rc == 0 || zmq_errno () == ETERM);
808
+ # endif
809
+ }
810
+
811
+
812
+ // --------------------------------------------------------------------------
813
+ // Return socket ZMQ_IMMEDIATE value
814
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
815
+
816
+ int
817
+ zsock_immediate (void *self)
818
+ {
819
+ assert (self);
820
+ # if defined (ZMQ_IMMEDIATE)
821
+ int immediate;
822
+ size_t option_len = sizeof (int);
823
+ zmq_getsockopt (zsock_resolve (self), ZMQ_IMMEDIATE, &immediate, &option_len);
824
+ return immediate;
825
+ # else
826
+ return 0;
827
+ # endif
828
+ }
829
+
830
+ // --------------------------------------------------------------------------
831
+ // Set socket ZMQ_ROUTER_RAW value
832
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
833
+
834
+ void
835
+ zsock_set_router_raw (void *self, int router_raw)
836
+ {
837
+ assert (self);
838
+ # if defined (ZMQ_ROUTER_RAW)
839
+ if (zsock_type (self) != ZMQ_ROUTER) {
840
+ printf ("ZMQ_ROUTER_RAW is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
841
+ assert (false);
842
+ }
843
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_ROUTER_RAW, &router_raw, sizeof (int));
844
+ assert (rc == 0 || zmq_errno () == ETERM);
845
+ # endif
846
+ }
847
+
848
+
849
+ // --------------------------------------------------------------------------
850
+ // Set socket ZMQ_IPV4ONLY value
851
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
852
+
853
+ void
854
+ zsock_set_ipv4only (void *self, int ipv4only)
855
+ {
856
+ assert (self);
857
+ # if defined (ZMQ_IPV4ONLY)
858
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IPV4ONLY, &ipv4only, sizeof (int));
859
+ assert (rc == 0 || zmq_errno () == ETERM);
860
+ # endif
861
+ }
862
+
863
+
864
+ // --------------------------------------------------------------------------
865
+ // Return socket ZMQ_IPV4ONLY value
866
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
867
+
868
+ int
869
+ zsock_ipv4only (void *self)
870
+ {
871
+ assert (self);
872
+ # if defined (ZMQ_IPV4ONLY)
873
+ int ipv4only;
874
+ size_t option_len = sizeof (int);
875
+ zmq_getsockopt (zsock_resolve (self), ZMQ_IPV4ONLY, &ipv4only, &option_len);
876
+ return ipv4only;
877
+ # else
878
+ return 0;
879
+ # endif
880
+ }
881
+
882
+ // --------------------------------------------------------------------------
883
+ // Set socket ZMQ_DELAY_ATTACH_ON_CONNECT value
884
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
885
+
886
+ void
887
+ zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect)
888
+ {
889
+ assert (self);
890
+ # if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
891
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_DELAY_ATTACH_ON_CONNECT, &delay_attach_on_connect, sizeof (int));
892
+ assert (rc == 0 || zmq_errno () == ETERM);
893
+ # endif
894
+ }
895
+
896
+
897
+ // --------------------------------------------------------------------------
898
+ // Return socket ZMQ_TYPE value
899
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
900
+
901
+ int
902
+ zsock_type (void *self)
903
+ {
904
+ assert (self);
905
+ # if defined (ZMQ_TYPE)
906
+ int type;
907
+ size_t option_len = sizeof (int);
908
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TYPE, &type, &option_len);
909
+ return type;
910
+ # else
911
+ return 0;
912
+ # endif
913
+ }
914
+
915
+ // --------------------------------------------------------------------------
916
+ // Set socket ZMQ_SNDHWM value
917
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
918
+
919
+ void
920
+ zsock_set_sndhwm (void *self, int sndhwm)
921
+ {
922
+ assert (self);
923
+ # if defined (ZMQ_SNDHWM)
924
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDHWM, &sndhwm, sizeof (int));
925
+ assert (rc == 0 || zmq_errno () == ETERM);
926
+ # endif
927
+ }
928
+
929
+
930
+ // --------------------------------------------------------------------------
931
+ // Return socket ZMQ_SNDHWM value
932
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
933
+
934
+ int
935
+ zsock_sndhwm (void *self)
936
+ {
937
+ assert (self);
938
+ # if defined (ZMQ_SNDHWM)
939
+ int sndhwm;
940
+ size_t option_len = sizeof (int);
941
+ zmq_getsockopt (zsock_resolve (self), ZMQ_SNDHWM, &sndhwm, &option_len);
942
+ return sndhwm;
943
+ # else
944
+ return 0;
945
+ # endif
946
+ }
947
+
948
+ // --------------------------------------------------------------------------
949
+ // Set socket ZMQ_RCVHWM value
950
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
951
+
952
+ void
953
+ zsock_set_rcvhwm (void *self, int rcvhwm)
954
+ {
955
+ assert (self);
956
+ # if defined (ZMQ_RCVHWM)
957
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVHWM, &rcvhwm, sizeof (int));
958
+ assert (rc == 0 || zmq_errno () == ETERM);
959
+ # endif
960
+ }
961
+
962
+
963
+ // --------------------------------------------------------------------------
964
+ // Return socket ZMQ_RCVHWM value
965
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
966
+
967
+ int
968
+ zsock_rcvhwm (void *self)
969
+ {
970
+ assert (self);
971
+ # if defined (ZMQ_RCVHWM)
972
+ int rcvhwm;
973
+ size_t option_len = sizeof (int);
974
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVHWM, &rcvhwm, &option_len);
975
+ return rcvhwm;
976
+ # else
977
+ return 0;
978
+ # endif
979
+ }
980
+
981
+ // --------------------------------------------------------------------------
982
+ // Set socket ZMQ_AFFINITY value
983
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
984
+
985
+ void
986
+ zsock_set_affinity (void *self, int affinity)
987
+ {
988
+ assert (self);
989
+ # if defined (ZMQ_AFFINITY)
990
+ uint64_t value = affinity;
991
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_AFFINITY, &value, sizeof (uint64_t));
992
+ assert (rc == 0 || zmq_errno () == ETERM);
993
+ # endif
994
+ }
995
+
996
+
997
+ // --------------------------------------------------------------------------
998
+ // Return socket ZMQ_AFFINITY value
999
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1000
+
1001
+ int
1002
+ zsock_affinity (void *self)
1003
+ {
1004
+ assert (self);
1005
+ # if defined (ZMQ_AFFINITY)
1006
+ uint64_t affinity;
1007
+ size_t option_len = sizeof (uint64_t);
1008
+ zmq_getsockopt (zsock_resolve (self), ZMQ_AFFINITY, &affinity, &option_len);
1009
+ return (int) affinity;
1010
+ # else
1011
+ return 0;
1012
+ # endif
1013
+ }
1014
+
1015
+ // --------------------------------------------------------------------------
1016
+ // Set socket ZMQ_SUBSCRIBE value
1017
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1018
+
1019
+ void
1020
+ zsock_set_subscribe (void *self, const char * subscribe)
1021
+ {
1022
+ assert (self);
1023
+ # if defined (ZMQ_SUBSCRIBE)
1024
+ if (zsock_type (self) != ZMQ_SUB) {
1025
+ printf ("ZMQ_SUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1026
+ assert (false);
1027
+ }
1028
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SUBSCRIBE, subscribe, strlen (subscribe));
1029
+ assert (rc == 0 || zmq_errno () == ETERM);
1030
+ # endif
1031
+ }
1032
+
1033
+
1034
+ // --------------------------------------------------------------------------
1035
+ // Set socket ZMQ_UNSUBSCRIBE value
1036
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1037
+
1038
+ void
1039
+ zsock_set_unsubscribe (void *self, const char * unsubscribe)
1040
+ {
1041
+ assert (self);
1042
+ # if defined (ZMQ_UNSUBSCRIBE)
1043
+ if (zsock_type (self) != ZMQ_SUB) {
1044
+ printf ("ZMQ_UNSUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1045
+ assert (false);
1046
+ }
1047
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_UNSUBSCRIBE, unsubscribe, strlen (unsubscribe));
1048
+ assert (rc == 0 || zmq_errno () == ETERM);
1049
+ # endif
1050
+ }
1051
+
1052
+
1053
+ // --------------------------------------------------------------------------
1054
+ // Set socket ZMQ_IDENTITY value
1055
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1056
+
1057
+ void
1058
+ zsock_set_identity (void *self, const char * identity)
1059
+ {
1060
+ assert (self);
1061
+ # if defined (ZMQ_IDENTITY)
1062
+ if (zsock_type (self) != ZMQ_REQ
1063
+ && zsock_type (self) != ZMQ_REP
1064
+ && zsock_type (self) != ZMQ_DEALER
1065
+ && zsock_type (self) != ZMQ_ROUTER) {
1066
+ printf ("ZMQ_IDENTITY is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1067
+ assert (false);
1068
+ }
1069
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, strlen (identity));
1070
+ assert (rc == 0 || zmq_errno () == ETERM);
1071
+ # endif
1072
+ }
1073
+
1074
+
1075
+ // --------------------------------------------------------------------------
1076
+ // Return socket ZMQ_IDENTITY value
1077
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1078
+
1079
+ char *
1080
+ zsock_identity (void *self)
1081
+ {
1082
+ assert (self);
1083
+ # if defined (ZMQ_IDENTITY)
1084
+ size_t option_len = 255;
1085
+ char *identity = (char *) zmalloc (option_len);
1086
+ zmq_getsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, &option_len);
1087
+ return (char *) identity;
1088
+ # else
1089
+ return NULL;
1090
+ # endif
1091
+ }
1092
+
1093
+ // --------------------------------------------------------------------------
1094
+ // Set socket ZMQ_RATE value
1095
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1096
+
1097
+ void
1098
+ zsock_set_rate (void *self, int rate)
1099
+ {
1100
+ assert (self);
1101
+ # if defined (ZMQ_RATE)
1102
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RATE, &rate, sizeof (int));
1103
+ assert (rc == 0 || zmq_errno () == ETERM);
1104
+ # endif
1105
+ }
1106
+
1107
+
1108
+ // --------------------------------------------------------------------------
1109
+ // Return socket ZMQ_RATE value
1110
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1111
+
1112
+ int
1113
+ zsock_rate (void *self)
1114
+ {
1115
+ assert (self);
1116
+ # if defined (ZMQ_RATE)
1117
+ int rate;
1118
+ size_t option_len = sizeof (int);
1119
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RATE, &rate, &option_len);
1120
+ return rate;
1121
+ # else
1122
+ return 0;
1123
+ # endif
1124
+ }
1125
+
1126
+ // --------------------------------------------------------------------------
1127
+ // Set socket ZMQ_RECOVERY_IVL value
1128
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1129
+
1130
+ void
1131
+ zsock_set_recovery_ivl (void *self, int recovery_ivl)
1132
+ {
1133
+ assert (self);
1134
+ # if defined (ZMQ_RECOVERY_IVL)
1135
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, sizeof (int));
1136
+ assert (rc == 0 || zmq_errno () == ETERM);
1137
+ # endif
1138
+ }
1139
+
1140
+
1141
+ // --------------------------------------------------------------------------
1142
+ // Return socket ZMQ_RECOVERY_IVL value
1143
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1144
+
1145
+ int
1146
+ zsock_recovery_ivl (void *self)
1147
+ {
1148
+ assert (self);
1149
+ # if defined (ZMQ_RECOVERY_IVL)
1150
+ int recovery_ivl;
1151
+ size_t option_len = sizeof (int);
1152
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
1153
+ return recovery_ivl;
1154
+ # else
1155
+ return 0;
1156
+ # endif
1157
+ }
1158
+
1159
+ // --------------------------------------------------------------------------
1160
+ // Set socket ZMQ_SNDBUF value
1161
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1162
+
1163
+ void
1164
+ zsock_set_sndbuf (void *self, int sndbuf)
1165
+ {
1166
+ assert (self);
1167
+ # if defined (ZMQ_SNDBUF)
1168
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, sizeof (int));
1169
+ assert (rc == 0 || zmq_errno () == ETERM);
1170
+ # endif
1171
+ }
1172
+
1173
+
1174
+ // --------------------------------------------------------------------------
1175
+ // Return socket ZMQ_SNDBUF value
1176
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1177
+
1178
+ int
1179
+ zsock_sndbuf (void *self)
1180
+ {
1181
+ assert (self);
1182
+ # if defined (ZMQ_SNDBUF)
1183
+ int sndbuf;
1184
+ size_t option_len = sizeof (int);
1185
+ zmq_getsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, &option_len);
1186
+ return sndbuf;
1187
+ # else
1188
+ return 0;
1189
+ # endif
1190
+ }
1191
+
1192
+ // --------------------------------------------------------------------------
1193
+ // Set socket ZMQ_RCVBUF value
1194
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1195
+
1196
+ void
1197
+ zsock_set_rcvbuf (void *self, int rcvbuf)
1198
+ {
1199
+ assert (self);
1200
+ # if defined (ZMQ_RCVBUF)
1201
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, sizeof (int));
1202
+ assert (rc == 0 || zmq_errno () == ETERM);
1203
+ # endif
1204
+ }
1205
+
1206
+
1207
+ // --------------------------------------------------------------------------
1208
+ // Return socket ZMQ_RCVBUF value
1209
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1210
+
1211
+ int
1212
+ zsock_rcvbuf (void *self)
1213
+ {
1214
+ assert (self);
1215
+ # if defined (ZMQ_RCVBUF)
1216
+ int rcvbuf;
1217
+ size_t option_len = sizeof (int);
1218
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, &option_len);
1219
+ return rcvbuf;
1220
+ # else
1221
+ return 0;
1222
+ # endif
1223
+ }
1224
+
1225
+ // --------------------------------------------------------------------------
1226
+ // Set socket ZMQ_LINGER value
1227
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1228
+
1229
+ void
1230
+ zsock_set_linger (void *self, int linger)
1231
+ {
1232
+ assert (self);
1233
+ # if defined (ZMQ_LINGER)
1234
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, sizeof (int));
1235
+ assert (rc == 0 || zmq_errno () == ETERM);
1236
+ # endif
1237
+ }
1238
+
1239
+
1240
+ // --------------------------------------------------------------------------
1241
+ // Return socket ZMQ_LINGER value
1242
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1243
+
1244
+ int
1245
+ zsock_linger (void *self)
1246
+ {
1247
+ assert (self);
1248
+ # if defined (ZMQ_LINGER)
1249
+ int linger;
1250
+ size_t option_len = sizeof (int);
1251
+ zmq_getsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, &option_len);
1252
+ return linger;
1253
+ # else
1254
+ return 0;
1255
+ # endif
1256
+ }
1257
+
1258
+ // --------------------------------------------------------------------------
1259
+ // Set socket ZMQ_RECONNECT_IVL value
1260
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1261
+
1262
+ void
1263
+ zsock_set_reconnect_ivl (void *self, int reconnect_ivl)
1264
+ {
1265
+ assert (self);
1266
+ # if defined (ZMQ_RECONNECT_IVL)
1267
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
1268
+ assert (rc == 0 || zmq_errno () == ETERM);
1269
+ # endif
1270
+ }
1271
+
1272
+
1273
+ // --------------------------------------------------------------------------
1274
+ // Return socket ZMQ_RECONNECT_IVL value
1275
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1276
+
1277
+ int
1278
+ zsock_reconnect_ivl (void *self)
1279
+ {
1280
+ assert (self);
1281
+ # if defined (ZMQ_RECONNECT_IVL)
1282
+ int reconnect_ivl;
1283
+ size_t option_len = sizeof (int);
1284
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, &option_len);
1285
+ return reconnect_ivl;
1286
+ # else
1287
+ return 0;
1288
+ # endif
1289
+ }
1290
+
1291
+ // --------------------------------------------------------------------------
1292
+ // Set socket ZMQ_RECONNECT_IVL_MAX value
1293
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1294
+
1295
+ void
1296
+ zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max)
1297
+ {
1298
+ assert (self);
1299
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
1300
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
1301
+ assert (rc == 0 || zmq_errno () == ETERM);
1302
+ # endif
1303
+ }
1304
+
1305
+
1306
+ // --------------------------------------------------------------------------
1307
+ // Return socket ZMQ_RECONNECT_IVL_MAX value
1308
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1309
+
1310
+ int
1311
+ zsock_reconnect_ivl_max (void *self)
1312
+ {
1313
+ assert (self);
1314
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
1315
+ int reconnect_ivl_max;
1316
+ size_t option_len = sizeof (int);
1317
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, &option_len);
1318
+ return reconnect_ivl_max;
1319
+ # else
1320
+ return 0;
1321
+ # endif
1322
+ }
1323
+
1324
+ // --------------------------------------------------------------------------
1325
+ // Set socket ZMQ_BACKLOG value
1326
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1327
+
1328
+ void
1329
+ zsock_set_backlog (void *self, int backlog)
1330
+ {
1331
+ assert (self);
1332
+ # if defined (ZMQ_BACKLOG)
1333
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, sizeof (int));
1334
+ assert (rc == 0 || zmq_errno () == ETERM);
1335
+ # endif
1336
+ }
1337
+
1338
+
1339
+ // --------------------------------------------------------------------------
1340
+ // Return socket ZMQ_BACKLOG value
1341
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1342
+
1343
+ int
1344
+ zsock_backlog (void *self)
1345
+ {
1346
+ assert (self);
1347
+ # if defined (ZMQ_BACKLOG)
1348
+ int backlog;
1349
+ size_t option_len = sizeof (int);
1350
+ zmq_getsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, &option_len);
1351
+ return backlog;
1352
+ # else
1353
+ return 0;
1354
+ # endif
1355
+ }
1356
+
1357
+ // --------------------------------------------------------------------------
1358
+ // Set socket ZMQ_MAXMSGSIZE value
1359
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1360
+
1361
+ void
1362
+ zsock_set_maxmsgsize (void *self, int maxmsgsize)
1363
+ {
1364
+ assert (self);
1365
+ # if defined (ZMQ_MAXMSGSIZE)
1366
+ int64_t value = maxmsgsize;
1367
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &value, sizeof (int64_t));
1368
+ assert (rc == 0 || zmq_errno () == ETERM);
1369
+ # endif
1370
+ }
1371
+
1372
+
1373
+ // --------------------------------------------------------------------------
1374
+ // Return socket ZMQ_MAXMSGSIZE value
1375
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1376
+
1377
+ int
1378
+ zsock_maxmsgsize (void *self)
1379
+ {
1380
+ assert (self);
1381
+ # if defined (ZMQ_MAXMSGSIZE)
1382
+ int64_t maxmsgsize;
1383
+ size_t option_len = sizeof (int64_t);
1384
+ zmq_getsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &maxmsgsize, &option_len);
1385
+ return (int) maxmsgsize;
1386
+ # else
1387
+ return 0;
1388
+ # endif
1389
+ }
1390
+
1391
+ // --------------------------------------------------------------------------
1392
+ // Set socket ZMQ_MULTICAST_HOPS value
1393
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1394
+
1395
+ void
1396
+ zsock_set_multicast_hops (void *self, int multicast_hops)
1397
+ {
1398
+ assert (self);
1399
+ # if defined (ZMQ_MULTICAST_HOPS)
1400
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, sizeof (int));
1401
+ assert (rc == 0 || zmq_errno () == ETERM);
1402
+ # endif
1403
+ }
1404
+
1405
+
1406
+ // --------------------------------------------------------------------------
1407
+ // Return socket ZMQ_MULTICAST_HOPS value
1408
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1409
+
1410
+ int
1411
+ zsock_multicast_hops (void *self)
1412
+ {
1413
+ assert (self);
1414
+ # if defined (ZMQ_MULTICAST_HOPS)
1415
+ int multicast_hops;
1416
+ size_t option_len = sizeof (int);
1417
+ zmq_getsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, &option_len);
1418
+ return multicast_hops;
1419
+ # else
1420
+ return 0;
1421
+ # endif
1422
+ }
1423
+
1424
+ // --------------------------------------------------------------------------
1425
+ // Set socket ZMQ_RCVTIMEO value
1426
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1427
+
1428
+ void
1429
+ zsock_set_rcvtimeo (void *self, int rcvtimeo)
1430
+ {
1431
+ assert (self);
1432
+ # if defined (ZMQ_RCVTIMEO)
1433
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
1434
+ assert (rc == 0 || zmq_errno () == ETERM);
1435
+ # endif
1436
+ }
1437
+
1438
+
1439
+ // --------------------------------------------------------------------------
1440
+ // Return socket ZMQ_RCVTIMEO value
1441
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1442
+
1443
+ int
1444
+ zsock_rcvtimeo (void *self)
1445
+ {
1446
+ assert (self);
1447
+ # if defined (ZMQ_RCVTIMEO)
1448
+ int rcvtimeo;
1449
+ size_t option_len = sizeof (int);
1450
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, &option_len);
1451
+ return rcvtimeo;
1452
+ # else
1453
+ return 0;
1454
+ # endif
1455
+ }
1456
+
1457
+ // --------------------------------------------------------------------------
1458
+ // Set socket ZMQ_SNDTIMEO value
1459
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1460
+
1461
+ void
1462
+ zsock_set_sndtimeo (void *self, int sndtimeo)
1463
+ {
1464
+ assert (self);
1465
+ # if defined (ZMQ_SNDTIMEO)
1466
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
1467
+ assert (rc == 0 || zmq_errno () == ETERM);
1468
+ # endif
1469
+ }
1470
+
1471
+
1472
+ // --------------------------------------------------------------------------
1473
+ // Return socket ZMQ_SNDTIMEO value
1474
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1475
+
1476
+ int
1477
+ zsock_sndtimeo (void *self)
1478
+ {
1479
+ assert (self);
1480
+ # if defined (ZMQ_SNDTIMEO)
1481
+ int sndtimeo;
1482
+ size_t option_len = sizeof (int);
1483
+ zmq_getsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, &option_len);
1484
+ return sndtimeo;
1485
+ # else
1486
+ return 0;
1487
+ # endif
1488
+ }
1489
+
1490
+ // --------------------------------------------------------------------------
1491
+ // Set socket ZMQ_XPUB_VERBOSE value
1492
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1493
+
1494
+ void
1495
+ zsock_set_xpub_verbose (void *self, int xpub_verbose)
1496
+ {
1497
+ assert (self);
1498
+ # if defined (ZMQ_XPUB_VERBOSE)
1499
+ if (zsock_type (self) != ZMQ_XPUB) {
1500
+ printf ("ZMQ_XPUB_VERBOSE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1501
+ assert (false);
1502
+ }
1503
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_XPUB_VERBOSE, &xpub_verbose, sizeof (int));
1504
+ assert (rc == 0 || zmq_errno () == ETERM);
1505
+ # endif
1506
+ }
1507
+
1508
+
1509
+ // --------------------------------------------------------------------------
1510
+ // Set socket ZMQ_TCP_KEEPALIVE value
1511
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1512
+
1513
+ void
1514
+ zsock_set_tcp_keepalive (void *self, int tcp_keepalive)
1515
+ {
1516
+ assert (self);
1517
+ # if defined (ZMQ_TCP_KEEPALIVE)
1518
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, sizeof (int));
1519
+ assert (rc == 0 || zmq_errno () == ETERM);
1520
+ # endif
1521
+ }
1522
+
1523
+
1524
+ // --------------------------------------------------------------------------
1525
+ // Return socket ZMQ_TCP_KEEPALIVE value
1526
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1527
+
1528
+ int
1529
+ zsock_tcp_keepalive (void *self)
1530
+ {
1531
+ assert (self);
1532
+ # if defined (ZMQ_TCP_KEEPALIVE)
1533
+ int tcp_keepalive;
1534
+ size_t option_len = sizeof (int);
1535
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, &option_len);
1536
+ return tcp_keepalive;
1537
+ # else
1538
+ return 0;
1539
+ # endif
1540
+ }
1541
+
1542
+ // --------------------------------------------------------------------------
1543
+ // Set socket ZMQ_TCP_KEEPALIVE_IDLE value
1544
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1545
+
1546
+ void
1547
+ zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle)
1548
+ {
1549
+ assert (self);
1550
+ # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
1551
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, sizeof (int));
1552
+ assert (rc == 0 || zmq_errno () == ETERM);
1553
+ # endif
1554
+ }
1555
+
1556
+
1557
+ // --------------------------------------------------------------------------
1558
+ // Return socket ZMQ_TCP_KEEPALIVE_IDLE value
1559
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1560
+
1561
+ int
1562
+ zsock_tcp_keepalive_idle (void *self)
1563
+ {
1564
+ assert (self);
1565
+ # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
1566
+ int tcp_keepalive_idle;
1567
+ size_t option_len = sizeof (int);
1568
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, &option_len);
1569
+ return tcp_keepalive_idle;
1570
+ # else
1571
+ return 0;
1572
+ # endif
1573
+ }
1574
+
1575
+ // --------------------------------------------------------------------------
1576
+ // Set socket ZMQ_TCP_KEEPALIVE_CNT value
1577
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1578
+
1579
+ void
1580
+ zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt)
1581
+ {
1582
+ assert (self);
1583
+ # if defined (ZMQ_TCP_KEEPALIVE_CNT)
1584
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, sizeof (int));
1585
+ assert (rc == 0 || zmq_errno () == ETERM);
1586
+ # endif
1587
+ }
1588
+
1589
+
1590
+ // --------------------------------------------------------------------------
1591
+ // Return socket ZMQ_TCP_KEEPALIVE_CNT value
1592
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1593
+
1594
+ int
1595
+ zsock_tcp_keepalive_cnt (void *self)
1596
+ {
1597
+ assert (self);
1598
+ # if defined (ZMQ_TCP_KEEPALIVE_CNT)
1599
+ int tcp_keepalive_cnt;
1600
+ size_t option_len = sizeof (int);
1601
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, &option_len);
1602
+ return tcp_keepalive_cnt;
1603
+ # else
1604
+ return 0;
1605
+ # endif
1606
+ }
1607
+
1608
+ // --------------------------------------------------------------------------
1609
+ // Set socket ZMQ_TCP_KEEPALIVE_INTVL value
1610
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1611
+
1612
+ void
1613
+ zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl)
1614
+ {
1615
+ assert (self);
1616
+ # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
1617
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, sizeof (int));
1618
+ assert (rc == 0 || zmq_errno () == ETERM);
1619
+ # endif
1620
+ }
1621
+
1622
+
1623
+ // --------------------------------------------------------------------------
1624
+ // Return socket ZMQ_TCP_KEEPALIVE_INTVL value
1625
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1626
+
1627
+ int
1628
+ zsock_tcp_keepalive_intvl (void *self)
1629
+ {
1630
+ assert (self);
1631
+ # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
1632
+ int tcp_keepalive_intvl;
1633
+ size_t option_len = sizeof (int);
1634
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, &option_len);
1635
+ return tcp_keepalive_intvl;
1636
+ # else
1637
+ return 0;
1638
+ # endif
1639
+ }
1640
+
1641
+ // --------------------------------------------------------------------------
1642
+ // Set socket ZMQ_TCP_ACCEPT_FILTER value
1643
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1644
+
1645
+ void
1646
+ zsock_set_tcp_accept_filter (void *self, const char * tcp_accept_filter)
1647
+ {
1648
+ assert (self);
1649
+ # if defined (ZMQ_TCP_ACCEPT_FILTER)
1650
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, strlen (tcp_accept_filter));
1651
+ assert (rc == 0 || zmq_errno () == ETERM);
1652
+ # endif
1653
+ }
1654
+
1655
+
1656
+ // --------------------------------------------------------------------------
1657
+ // Return socket ZMQ_TCP_ACCEPT_FILTER value
1658
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1659
+
1660
+ char *
1661
+ zsock_tcp_accept_filter (void *self)
1662
+ {
1663
+ assert (self);
1664
+ # if defined (ZMQ_TCP_ACCEPT_FILTER)
1665
+ size_t option_len = 255;
1666
+ char *tcp_accept_filter = (char *) zmalloc (option_len);
1667
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, &option_len);
1668
+ return (char *) tcp_accept_filter;
1669
+ # else
1670
+ return NULL;
1671
+ # endif
1672
+ }
1673
+
1674
+ // --------------------------------------------------------------------------
1675
+ // Return socket ZMQ_RCVMORE value
1676
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1677
+
1678
+ int
1679
+ zsock_rcvmore (void *self)
1680
+ {
1681
+ assert (self);
1682
+ # if defined (ZMQ_RCVMORE)
1683
+ int rcvmore;
1684
+ size_t option_len = sizeof (int);
1685
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVMORE, &rcvmore, &option_len);
1686
+ return rcvmore;
1687
+ # else
1688
+ return 0;
1689
+ # endif
1690
+ }
1691
+
1692
+ // --------------------------------------------------------------------------
1693
+ // Return socket ZMQ_FD value
1694
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1695
+
1696
+ SOCKET
1697
+ zsock_fd (void *self)
1698
+ {
1699
+ assert (self);
1700
+ # if defined (ZMQ_FD)
1701
+ SOCKET fd;
1702
+ size_t option_len = sizeof (SOCKET);
1703
+ zmq_getsockopt (zsock_resolve (self), ZMQ_FD, &fd, &option_len);
1704
+ return fd;
1705
+ # else
1706
+ return 0;
1707
+ # endif
1708
+ }
1709
+
1710
+ // --------------------------------------------------------------------------
1711
+ // Return socket ZMQ_EVENTS value
1712
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1713
+
1714
+ int
1715
+ zsock_events (void *self)
1716
+ {
1717
+ assert (self);
1718
+ # if defined (ZMQ_EVENTS)
1719
+ int events;
1720
+ size_t option_len = sizeof (int);
1721
+ zmq_getsockopt (zsock_resolve (self), ZMQ_EVENTS, &events, &option_len);
1722
+ return events;
1723
+ # else
1724
+ return 0;
1725
+ # endif
1726
+ }
1727
+
1728
+ // --------------------------------------------------------------------------
1729
+ // Return socket ZMQ_LAST_ENDPOINT value
1730
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1731
+
1732
+ char *
1733
+ zsock_last_endpoint (void *self)
1734
+ {
1735
+ assert (self);
1736
+ # if defined (ZMQ_LAST_ENDPOINT)
1737
+ size_t option_len = 255;
1738
+ char *last_endpoint = (char *) zmalloc (option_len);
1739
+ zmq_getsockopt (zsock_resolve (self), ZMQ_LAST_ENDPOINT, last_endpoint, &option_len);
1740
+ return (char *) last_endpoint;
1741
+ # else
1742
+ return NULL;
1743
+ # endif
1744
+ }
1745
+
1746
+ #endif
1747
+
1748
+ #if (ZMQ_VERSION_MAJOR == 3)
1749
+ // --------------------------------------------------------------------------
1750
+ // Set socket ZMQ_ROUTER_RAW value
1751
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1752
+
1753
+ void
1754
+ zsock_set_router_raw (void *self, int router_raw)
1755
+ {
1756
+ assert (self);
1757
+ # if defined (ZMQ_ROUTER_RAW)
1758
+ if (zsock_type (self) != ZMQ_ROUTER) {
1759
+ printf ("ZMQ_ROUTER_RAW is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1760
+ assert (false);
1761
+ }
1762
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_ROUTER_RAW, &router_raw, sizeof (int));
1763
+ assert (rc == 0 || zmq_errno () == ETERM);
1764
+ # endif
1765
+ }
1766
+
1767
+
1768
+ // --------------------------------------------------------------------------
1769
+ // Set socket ZMQ_IPV4ONLY value
1770
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1771
+
1772
+ void
1773
+ zsock_set_ipv4only (void *self, int ipv4only)
1774
+ {
1775
+ assert (self);
1776
+ # if defined (ZMQ_IPV4ONLY)
1777
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IPV4ONLY, &ipv4only, sizeof (int));
1778
+ assert (rc == 0 || zmq_errno () == ETERM);
1779
+ # endif
1780
+ }
1781
+
1782
+
1783
+ // --------------------------------------------------------------------------
1784
+ // Return socket ZMQ_IPV4ONLY value
1785
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1786
+
1787
+ int
1788
+ zsock_ipv4only (void *self)
1789
+ {
1790
+ assert (self);
1791
+ # if defined (ZMQ_IPV4ONLY)
1792
+ int ipv4only;
1793
+ size_t option_len = sizeof (int);
1794
+ zmq_getsockopt (zsock_resolve (self), ZMQ_IPV4ONLY, &ipv4only, &option_len);
1795
+ return ipv4only;
1796
+ # else
1797
+ return 0;
1798
+ # endif
1799
+ }
1800
+
1801
+ // --------------------------------------------------------------------------
1802
+ // Set socket ZMQ_DELAY_ATTACH_ON_CONNECT value
1803
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1804
+
1805
+ void
1806
+ zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect)
1807
+ {
1808
+ assert (self);
1809
+ # if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
1810
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_DELAY_ATTACH_ON_CONNECT, &delay_attach_on_connect, sizeof (int));
1811
+ assert (rc == 0 || zmq_errno () == ETERM);
1812
+ # endif
1813
+ }
1814
+
1815
+
1816
+ // --------------------------------------------------------------------------
1817
+ // Return socket ZMQ_TYPE value
1818
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1819
+
1820
+ int
1821
+ zsock_type (void *self)
1822
+ {
1823
+ assert (self);
1824
+ # if defined (ZMQ_TYPE)
1825
+ int type;
1826
+ size_t option_len = sizeof (int);
1827
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TYPE, &type, &option_len);
1828
+ return type;
1829
+ # else
1830
+ return 0;
1831
+ # endif
1832
+ }
1833
+
1834
+ // --------------------------------------------------------------------------
1835
+ // Set socket ZMQ_SNDHWM value
1836
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1837
+
1838
+ void
1839
+ zsock_set_sndhwm (void *self, int sndhwm)
1840
+ {
1841
+ assert (self);
1842
+ # if defined (ZMQ_SNDHWM)
1843
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDHWM, &sndhwm, sizeof (int));
1844
+ assert (rc == 0 || zmq_errno () == ETERM);
1845
+ # endif
1846
+ }
1847
+
1848
+
1849
+ // --------------------------------------------------------------------------
1850
+ // Return socket ZMQ_SNDHWM value
1851
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1852
+
1853
+ int
1854
+ zsock_sndhwm (void *self)
1855
+ {
1856
+ assert (self);
1857
+ # if defined (ZMQ_SNDHWM)
1858
+ int sndhwm;
1859
+ size_t option_len = sizeof (int);
1860
+ zmq_getsockopt (zsock_resolve (self), ZMQ_SNDHWM, &sndhwm, &option_len);
1861
+ return sndhwm;
1862
+ # else
1863
+ return 0;
1864
+ # endif
1865
+ }
1866
+
1867
+ // --------------------------------------------------------------------------
1868
+ // Set socket ZMQ_RCVHWM value
1869
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1870
+
1871
+ void
1872
+ zsock_set_rcvhwm (void *self, int rcvhwm)
1873
+ {
1874
+ assert (self);
1875
+ # if defined (ZMQ_RCVHWM)
1876
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVHWM, &rcvhwm, sizeof (int));
1877
+ assert (rc == 0 || zmq_errno () == ETERM);
1878
+ # endif
1879
+ }
1880
+
1881
+
1882
+ // --------------------------------------------------------------------------
1883
+ // Return socket ZMQ_RCVHWM value
1884
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1885
+
1886
+ int
1887
+ zsock_rcvhwm (void *self)
1888
+ {
1889
+ assert (self);
1890
+ # if defined (ZMQ_RCVHWM)
1891
+ int rcvhwm;
1892
+ size_t option_len = sizeof (int);
1893
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVHWM, &rcvhwm, &option_len);
1894
+ return rcvhwm;
1895
+ # else
1896
+ return 0;
1897
+ # endif
1898
+ }
1899
+
1900
+ // --------------------------------------------------------------------------
1901
+ // Set socket ZMQ_AFFINITY value
1902
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1903
+
1904
+ void
1905
+ zsock_set_affinity (void *self, int affinity)
1906
+ {
1907
+ assert (self);
1908
+ # if defined (ZMQ_AFFINITY)
1909
+ uint64_t value = affinity;
1910
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_AFFINITY, &value, sizeof (uint64_t));
1911
+ assert (rc == 0 || zmq_errno () == ETERM);
1912
+ # endif
1913
+ }
1914
+
1915
+
1916
+ // --------------------------------------------------------------------------
1917
+ // Return socket ZMQ_AFFINITY value
1918
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1919
+
1920
+ int
1921
+ zsock_affinity (void *self)
1922
+ {
1923
+ assert (self);
1924
+ # if defined (ZMQ_AFFINITY)
1925
+ uint64_t affinity;
1926
+ size_t option_len = sizeof (uint64_t);
1927
+ zmq_getsockopt (zsock_resolve (self), ZMQ_AFFINITY, &affinity, &option_len);
1928
+ return (int) affinity;
1929
+ # else
1930
+ return 0;
1931
+ # endif
1932
+ }
1933
+
1934
+ // --------------------------------------------------------------------------
1935
+ // Set socket ZMQ_SUBSCRIBE value
1936
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1937
+
1938
+ void
1939
+ zsock_set_subscribe (void *self, const char * subscribe)
1940
+ {
1941
+ assert (self);
1942
+ # if defined (ZMQ_SUBSCRIBE)
1943
+ if (zsock_type (self) != ZMQ_SUB) {
1944
+ printf ("ZMQ_SUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1945
+ assert (false);
1946
+ }
1947
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SUBSCRIBE, subscribe, strlen (subscribe));
1948
+ assert (rc == 0 || zmq_errno () == ETERM);
1949
+ # endif
1950
+ }
1951
+
1952
+
1953
+ // --------------------------------------------------------------------------
1954
+ // Set socket ZMQ_UNSUBSCRIBE value
1955
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1956
+
1957
+ void
1958
+ zsock_set_unsubscribe (void *self, const char * unsubscribe)
1959
+ {
1960
+ assert (self);
1961
+ # if defined (ZMQ_UNSUBSCRIBE)
1962
+ if (zsock_type (self) != ZMQ_SUB) {
1963
+ printf ("ZMQ_UNSUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1964
+ assert (false);
1965
+ }
1966
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_UNSUBSCRIBE, unsubscribe, strlen (unsubscribe));
1967
+ assert (rc == 0 || zmq_errno () == ETERM);
1968
+ # endif
1969
+ }
1970
+
1971
+
1972
+ // --------------------------------------------------------------------------
1973
+ // Set socket ZMQ_IDENTITY value
1974
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1975
+
1976
+ void
1977
+ zsock_set_identity (void *self, const char * identity)
1978
+ {
1979
+ assert (self);
1980
+ # if defined (ZMQ_IDENTITY)
1981
+ if (zsock_type (self) != ZMQ_REQ
1982
+ && zsock_type (self) != ZMQ_REP
1983
+ && zsock_type (self) != ZMQ_DEALER
1984
+ && zsock_type (self) != ZMQ_ROUTER) {
1985
+ printf ("ZMQ_IDENTITY is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1986
+ assert (false);
1987
+ }
1988
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, strlen (identity));
1989
+ assert (rc == 0 || zmq_errno () == ETERM);
1990
+ # endif
1991
+ }
1992
+
1993
+
1994
+ // --------------------------------------------------------------------------
1995
+ // Return socket ZMQ_IDENTITY value
1996
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1997
+
1998
+ char *
1999
+ zsock_identity (void *self)
2000
+ {
2001
+ assert (self);
2002
+ # if defined (ZMQ_IDENTITY)
2003
+ size_t option_len = 255;
2004
+ char *identity = (char *) zmalloc (option_len);
2005
+ zmq_getsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, &option_len);
2006
+ return (char *) identity;
2007
+ # else
2008
+ return NULL;
2009
+ # endif
2010
+ }
2011
+
2012
+ // --------------------------------------------------------------------------
2013
+ // Set socket ZMQ_RATE value
2014
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2015
+
2016
+ void
2017
+ zsock_set_rate (void *self, int rate)
2018
+ {
2019
+ assert (self);
2020
+ # if defined (ZMQ_RATE)
2021
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RATE, &rate, sizeof (int));
2022
+ assert (rc == 0 || zmq_errno () == ETERM);
2023
+ # endif
2024
+ }
2025
+
2026
+
2027
+ // --------------------------------------------------------------------------
2028
+ // Return socket ZMQ_RATE value
2029
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2030
+
2031
+ int
2032
+ zsock_rate (void *self)
2033
+ {
2034
+ assert (self);
2035
+ # if defined (ZMQ_RATE)
2036
+ int rate;
2037
+ size_t option_len = sizeof (int);
2038
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RATE, &rate, &option_len);
2039
+ return rate;
2040
+ # else
2041
+ return 0;
2042
+ # endif
2043
+ }
2044
+
2045
+ // --------------------------------------------------------------------------
2046
+ // Set socket ZMQ_RECOVERY_IVL value
2047
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2048
+
2049
+ void
2050
+ zsock_set_recovery_ivl (void *self, int recovery_ivl)
2051
+ {
2052
+ assert (self);
2053
+ # if defined (ZMQ_RECOVERY_IVL)
2054
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, sizeof (int));
2055
+ assert (rc == 0 || zmq_errno () == ETERM);
2056
+ # endif
2057
+ }
2058
+
2059
+
2060
+ // --------------------------------------------------------------------------
2061
+ // Return socket ZMQ_RECOVERY_IVL value
2062
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2063
+
2064
+ int
2065
+ zsock_recovery_ivl (void *self)
2066
+ {
2067
+ assert (self);
2068
+ # if defined (ZMQ_RECOVERY_IVL)
2069
+ int recovery_ivl;
2070
+ size_t option_len = sizeof (int);
2071
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
2072
+ return recovery_ivl;
2073
+ # else
2074
+ return 0;
2075
+ # endif
2076
+ }
2077
+
2078
+ // --------------------------------------------------------------------------
2079
+ // Set socket ZMQ_SNDBUF value
2080
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2081
+
2082
+ void
2083
+ zsock_set_sndbuf (void *self, int sndbuf)
2084
+ {
2085
+ assert (self);
2086
+ # if defined (ZMQ_SNDBUF)
2087
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, sizeof (int));
2088
+ assert (rc == 0 || zmq_errno () == ETERM);
2089
+ # endif
2090
+ }
2091
+
2092
+
2093
+ // --------------------------------------------------------------------------
2094
+ // Return socket ZMQ_SNDBUF value
2095
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2096
+
2097
+ int
2098
+ zsock_sndbuf (void *self)
2099
+ {
2100
+ assert (self);
2101
+ # if defined (ZMQ_SNDBUF)
2102
+ int sndbuf;
2103
+ size_t option_len = sizeof (int);
2104
+ zmq_getsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, &option_len);
2105
+ return sndbuf;
2106
+ # else
2107
+ return 0;
2108
+ # endif
2109
+ }
2110
+
2111
+ // --------------------------------------------------------------------------
2112
+ // Set socket ZMQ_RCVBUF value
2113
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2114
+
2115
+ void
2116
+ zsock_set_rcvbuf (void *self, int rcvbuf)
2117
+ {
2118
+ assert (self);
2119
+ # if defined (ZMQ_RCVBUF)
2120
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, sizeof (int));
2121
+ assert (rc == 0 || zmq_errno () == ETERM);
2122
+ # endif
2123
+ }
2124
+
2125
+
2126
+ // --------------------------------------------------------------------------
2127
+ // Return socket ZMQ_RCVBUF value
2128
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2129
+
2130
+ int
2131
+ zsock_rcvbuf (void *self)
2132
+ {
2133
+ assert (self);
2134
+ # if defined (ZMQ_RCVBUF)
2135
+ int rcvbuf;
2136
+ size_t option_len = sizeof (int);
2137
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, &option_len);
2138
+ return rcvbuf;
2139
+ # else
2140
+ return 0;
2141
+ # endif
2142
+ }
2143
+
2144
+ // --------------------------------------------------------------------------
2145
+ // Set socket ZMQ_LINGER value
2146
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2147
+
2148
+ void
2149
+ zsock_set_linger (void *self, int linger)
2150
+ {
2151
+ assert (self);
2152
+ # if defined (ZMQ_LINGER)
2153
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, sizeof (int));
2154
+ assert (rc == 0 || zmq_errno () == ETERM);
2155
+ # endif
2156
+ }
2157
+
2158
+
2159
+ // --------------------------------------------------------------------------
2160
+ // Return socket ZMQ_LINGER value
2161
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2162
+
2163
+ int
2164
+ zsock_linger (void *self)
2165
+ {
2166
+ assert (self);
2167
+ # if defined (ZMQ_LINGER)
2168
+ int linger;
2169
+ size_t option_len = sizeof (int);
2170
+ zmq_getsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, &option_len);
2171
+ return linger;
2172
+ # else
2173
+ return 0;
2174
+ # endif
2175
+ }
2176
+
2177
+ // --------------------------------------------------------------------------
2178
+ // Set socket ZMQ_RECONNECT_IVL value
2179
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2180
+
2181
+ void
2182
+ zsock_set_reconnect_ivl (void *self, int reconnect_ivl)
2183
+ {
2184
+ assert (self);
2185
+ # if defined (ZMQ_RECONNECT_IVL)
2186
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
2187
+ assert (rc == 0 || zmq_errno () == ETERM);
2188
+ # endif
2189
+ }
2190
+
2191
+
2192
+ // --------------------------------------------------------------------------
2193
+ // Return socket ZMQ_RECONNECT_IVL value
2194
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2195
+
2196
+ int
2197
+ zsock_reconnect_ivl (void *self)
2198
+ {
2199
+ assert (self);
2200
+ # if defined (ZMQ_RECONNECT_IVL)
2201
+ int reconnect_ivl;
2202
+ size_t option_len = sizeof (int);
2203
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, &option_len);
2204
+ return reconnect_ivl;
2205
+ # else
2206
+ return 0;
2207
+ # endif
2208
+ }
2209
+
2210
+ // --------------------------------------------------------------------------
2211
+ // Set socket ZMQ_RECONNECT_IVL_MAX value
2212
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2213
+
2214
+ void
2215
+ zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max)
2216
+ {
2217
+ assert (self);
2218
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
2219
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
2220
+ assert (rc == 0 || zmq_errno () == ETERM);
2221
+ # endif
2222
+ }
2223
+
2224
+
2225
+ // --------------------------------------------------------------------------
2226
+ // Return socket ZMQ_RECONNECT_IVL_MAX value
2227
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2228
+
2229
+ int
2230
+ zsock_reconnect_ivl_max (void *self)
2231
+ {
2232
+ assert (self);
2233
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
2234
+ int reconnect_ivl_max;
2235
+ size_t option_len = sizeof (int);
2236
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, &option_len);
2237
+ return reconnect_ivl_max;
2238
+ # else
2239
+ return 0;
2240
+ # endif
2241
+ }
2242
+
2243
+ // --------------------------------------------------------------------------
2244
+ // Set socket ZMQ_BACKLOG value
2245
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2246
+
2247
+ void
2248
+ zsock_set_backlog (void *self, int backlog)
2249
+ {
2250
+ assert (self);
2251
+ # if defined (ZMQ_BACKLOG)
2252
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, sizeof (int));
2253
+ assert (rc == 0 || zmq_errno () == ETERM);
2254
+ # endif
2255
+ }
2256
+
2257
+
2258
+ // --------------------------------------------------------------------------
2259
+ // Return socket ZMQ_BACKLOG value
2260
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2261
+
2262
+ int
2263
+ zsock_backlog (void *self)
2264
+ {
2265
+ assert (self);
2266
+ # if defined (ZMQ_BACKLOG)
2267
+ int backlog;
2268
+ size_t option_len = sizeof (int);
2269
+ zmq_getsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, &option_len);
2270
+ return backlog;
2271
+ # else
2272
+ return 0;
2273
+ # endif
2274
+ }
2275
+
2276
+ // --------------------------------------------------------------------------
2277
+ // Set socket ZMQ_MAXMSGSIZE value
2278
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2279
+
2280
+ void
2281
+ zsock_set_maxmsgsize (void *self, int maxmsgsize)
2282
+ {
2283
+ assert (self);
2284
+ # if defined (ZMQ_MAXMSGSIZE)
2285
+ int64_t value = maxmsgsize;
2286
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &value, sizeof (int64_t));
2287
+ assert (rc == 0 || zmq_errno () == ETERM);
2288
+ # endif
2289
+ }
2290
+
2291
+
2292
+ // --------------------------------------------------------------------------
2293
+ // Return socket ZMQ_MAXMSGSIZE value
2294
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2295
+
2296
+ int
2297
+ zsock_maxmsgsize (void *self)
2298
+ {
2299
+ assert (self);
2300
+ # if defined (ZMQ_MAXMSGSIZE)
2301
+ int64_t maxmsgsize;
2302
+ size_t option_len = sizeof (int64_t);
2303
+ zmq_getsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &maxmsgsize, &option_len);
2304
+ return (int) maxmsgsize;
2305
+ # else
2306
+ return 0;
2307
+ # endif
2308
+ }
2309
+
2310
+ // --------------------------------------------------------------------------
2311
+ // Set socket ZMQ_MULTICAST_HOPS value
2312
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2313
+
2314
+ void
2315
+ zsock_set_multicast_hops (void *self, int multicast_hops)
2316
+ {
2317
+ assert (self);
2318
+ # if defined (ZMQ_MULTICAST_HOPS)
2319
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, sizeof (int));
2320
+ assert (rc == 0 || zmq_errno () == ETERM);
2321
+ # endif
2322
+ }
2323
+
2324
+
2325
+ // --------------------------------------------------------------------------
2326
+ // Return socket ZMQ_MULTICAST_HOPS value
2327
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2328
+
2329
+ int
2330
+ zsock_multicast_hops (void *self)
2331
+ {
2332
+ assert (self);
2333
+ # if defined (ZMQ_MULTICAST_HOPS)
2334
+ int multicast_hops;
2335
+ size_t option_len = sizeof (int);
2336
+ zmq_getsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, &option_len);
2337
+ return multicast_hops;
2338
+ # else
2339
+ return 0;
2340
+ # endif
2341
+ }
2342
+
2343
+ // --------------------------------------------------------------------------
2344
+ // Set socket ZMQ_RCVTIMEO value
2345
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2346
+
2347
+ void
2348
+ zsock_set_rcvtimeo (void *self, int rcvtimeo)
2349
+ {
2350
+ assert (self);
2351
+ # if defined (ZMQ_RCVTIMEO)
2352
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
2353
+ assert (rc == 0 || zmq_errno () == ETERM);
2354
+ # endif
2355
+ }
2356
+
2357
+
2358
+ // --------------------------------------------------------------------------
2359
+ // Return socket ZMQ_RCVTIMEO value
2360
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2361
+
2362
+ int
2363
+ zsock_rcvtimeo (void *self)
2364
+ {
2365
+ assert (self);
2366
+ # if defined (ZMQ_RCVTIMEO)
2367
+ int rcvtimeo;
2368
+ size_t option_len = sizeof (int);
2369
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, &option_len);
2370
+ return rcvtimeo;
2371
+ # else
2372
+ return 0;
2373
+ # endif
2374
+ }
2375
+
2376
+ // --------------------------------------------------------------------------
2377
+ // Set socket ZMQ_SNDTIMEO value
2378
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2379
+
2380
+ void
2381
+ zsock_set_sndtimeo (void *self, int sndtimeo)
2382
+ {
2383
+ assert (self);
2384
+ # if defined (ZMQ_SNDTIMEO)
2385
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
2386
+ assert (rc == 0 || zmq_errno () == ETERM);
2387
+ # endif
2388
+ }
2389
+
2390
+
2391
+ // --------------------------------------------------------------------------
2392
+ // Return socket ZMQ_SNDTIMEO value
2393
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2394
+
2395
+ int
2396
+ zsock_sndtimeo (void *self)
2397
+ {
2398
+ assert (self);
2399
+ # if defined (ZMQ_SNDTIMEO)
2400
+ int sndtimeo;
2401
+ size_t option_len = sizeof (int);
2402
+ zmq_getsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, &option_len);
2403
+ return sndtimeo;
2404
+ # else
2405
+ return 0;
2406
+ # endif
2407
+ }
2408
+
2409
+ // --------------------------------------------------------------------------
2410
+ // Set socket ZMQ_XPUB_VERBOSE value
2411
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2412
+
2413
+ void
2414
+ zsock_set_xpub_verbose (void *self, int xpub_verbose)
2415
+ {
2416
+ assert (self);
2417
+ # if defined (ZMQ_XPUB_VERBOSE)
2418
+ if (zsock_type (self) != ZMQ_XPUB) {
2419
+ printf ("ZMQ_XPUB_VERBOSE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2420
+ assert (false);
2421
+ }
2422
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_XPUB_VERBOSE, &xpub_verbose, sizeof (int));
2423
+ assert (rc == 0 || zmq_errno () == ETERM);
2424
+ # endif
2425
+ }
2426
+
2427
+
2428
+ // --------------------------------------------------------------------------
2429
+ // Set socket ZMQ_TCP_KEEPALIVE value
2430
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2431
+
2432
+ void
2433
+ zsock_set_tcp_keepalive (void *self, int tcp_keepalive)
2434
+ {
2435
+ assert (self);
2436
+ # if defined (ZMQ_TCP_KEEPALIVE)
2437
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, sizeof (int));
2438
+ assert (rc == 0 || zmq_errno () == ETERM);
2439
+ # endif
2440
+ }
2441
+
2442
+
2443
+ // --------------------------------------------------------------------------
2444
+ // Return socket ZMQ_TCP_KEEPALIVE value
2445
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2446
+
2447
+ int
2448
+ zsock_tcp_keepalive (void *self)
2449
+ {
2450
+ assert (self);
2451
+ # if defined (ZMQ_TCP_KEEPALIVE)
2452
+ int tcp_keepalive;
2453
+ size_t option_len = sizeof (int);
2454
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, &option_len);
2455
+ return tcp_keepalive;
2456
+ # else
2457
+ return 0;
2458
+ # endif
2459
+ }
2460
+
2461
+ // --------------------------------------------------------------------------
2462
+ // Set socket ZMQ_TCP_KEEPALIVE_IDLE value
2463
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2464
+
2465
+ void
2466
+ zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle)
2467
+ {
2468
+ assert (self);
2469
+ # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
2470
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, sizeof (int));
2471
+ assert (rc == 0 || zmq_errno () == ETERM);
2472
+ # endif
2473
+ }
2474
+
2475
+
2476
+ // --------------------------------------------------------------------------
2477
+ // Return socket ZMQ_TCP_KEEPALIVE_IDLE value
2478
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2479
+
2480
+ int
2481
+ zsock_tcp_keepalive_idle (void *self)
2482
+ {
2483
+ assert (self);
2484
+ # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
2485
+ int tcp_keepalive_idle;
2486
+ size_t option_len = sizeof (int);
2487
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, &option_len);
2488
+ return tcp_keepalive_idle;
2489
+ # else
2490
+ return 0;
2491
+ # endif
2492
+ }
2493
+
2494
+ // --------------------------------------------------------------------------
2495
+ // Set socket ZMQ_TCP_KEEPALIVE_CNT value
2496
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2497
+
2498
+ void
2499
+ zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt)
2500
+ {
2501
+ assert (self);
2502
+ # if defined (ZMQ_TCP_KEEPALIVE_CNT)
2503
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, sizeof (int));
2504
+ assert (rc == 0 || zmq_errno () == ETERM);
2505
+ # endif
2506
+ }
2507
+
2508
+
2509
+ // --------------------------------------------------------------------------
2510
+ // Return socket ZMQ_TCP_KEEPALIVE_CNT value
2511
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2512
+
2513
+ int
2514
+ zsock_tcp_keepalive_cnt (void *self)
2515
+ {
2516
+ assert (self);
2517
+ # if defined (ZMQ_TCP_KEEPALIVE_CNT)
2518
+ int tcp_keepalive_cnt;
2519
+ size_t option_len = sizeof (int);
2520
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, &option_len);
2521
+ return tcp_keepalive_cnt;
2522
+ # else
2523
+ return 0;
2524
+ # endif
2525
+ }
2526
+
2527
+ // --------------------------------------------------------------------------
2528
+ // Set socket ZMQ_TCP_KEEPALIVE_INTVL value
2529
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2530
+
2531
+ void
2532
+ zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl)
2533
+ {
2534
+ assert (self);
2535
+ # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
2536
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, sizeof (int));
2537
+ assert (rc == 0 || zmq_errno () == ETERM);
2538
+ # endif
2539
+ }
2540
+
2541
+
2542
+ // --------------------------------------------------------------------------
2543
+ // Return socket ZMQ_TCP_KEEPALIVE_INTVL value
2544
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2545
+
2546
+ int
2547
+ zsock_tcp_keepalive_intvl (void *self)
2548
+ {
2549
+ assert (self);
2550
+ # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
2551
+ int tcp_keepalive_intvl;
2552
+ size_t option_len = sizeof (int);
2553
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, &option_len);
2554
+ return tcp_keepalive_intvl;
2555
+ # else
2556
+ return 0;
2557
+ # endif
2558
+ }
2559
+
2560
+ // --------------------------------------------------------------------------
2561
+ // Set socket ZMQ_TCP_ACCEPT_FILTER value
2562
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2563
+
2564
+ void
2565
+ zsock_set_tcp_accept_filter (void *self, const char * tcp_accept_filter)
2566
+ {
2567
+ assert (self);
2568
+ # if defined (ZMQ_TCP_ACCEPT_FILTER)
2569
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, strlen (tcp_accept_filter));
2570
+ assert (rc == 0 || zmq_errno () == ETERM);
2571
+ # endif
2572
+ }
2573
+
2574
+
2575
+ // --------------------------------------------------------------------------
2576
+ // Return socket ZMQ_TCP_ACCEPT_FILTER value
2577
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2578
+
2579
+ char *
2580
+ zsock_tcp_accept_filter (void *self)
2581
+ {
2582
+ assert (self);
2583
+ # if defined (ZMQ_TCP_ACCEPT_FILTER)
2584
+ size_t option_len = 255;
2585
+ char *tcp_accept_filter = (char *) zmalloc (option_len);
2586
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, &option_len);
2587
+ return (char *) tcp_accept_filter;
2588
+ # else
2589
+ return NULL;
2590
+ # endif
2591
+ }
2592
+
2593
+ // --------------------------------------------------------------------------
2594
+ // Return socket ZMQ_RCVMORE value
2595
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2596
+
2597
+ int
2598
+ zsock_rcvmore (void *self)
2599
+ {
2600
+ assert (self);
2601
+ # if defined (ZMQ_RCVMORE)
2602
+ int rcvmore;
2603
+ size_t option_len = sizeof (int);
2604
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVMORE, &rcvmore, &option_len);
2605
+ return rcvmore;
2606
+ # else
2607
+ return 0;
2608
+ # endif
2609
+ }
2610
+
2611
+ // --------------------------------------------------------------------------
2612
+ // Return socket ZMQ_FD value
2613
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2614
+
2615
+ SOCKET
2616
+ zsock_fd (void *self)
2617
+ {
2618
+ assert (self);
2619
+ # if defined (ZMQ_FD)
2620
+ SOCKET fd;
2621
+ size_t option_len = sizeof (SOCKET);
2622
+ zmq_getsockopt (zsock_resolve (self), ZMQ_FD, &fd, &option_len);
2623
+ return fd;
2624
+ # else
2625
+ return 0;
2626
+ # endif
2627
+ }
2628
+
2629
+ // --------------------------------------------------------------------------
2630
+ // Return socket ZMQ_EVENTS value
2631
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2632
+
2633
+ int
2634
+ zsock_events (void *self)
2635
+ {
2636
+ assert (self);
2637
+ # if defined (ZMQ_EVENTS)
2638
+ int events;
2639
+ size_t option_len = sizeof (int);
2640
+ zmq_getsockopt (zsock_resolve (self), ZMQ_EVENTS, &events, &option_len);
2641
+ return events;
2642
+ # else
2643
+ return 0;
2644
+ # endif
2645
+ }
2646
+
2647
+ // --------------------------------------------------------------------------
2648
+ // Return socket ZMQ_LAST_ENDPOINT value
2649
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2650
+
2651
+ char *
2652
+ zsock_last_endpoint (void *self)
2653
+ {
2654
+ assert (self);
2655
+ # if defined (ZMQ_LAST_ENDPOINT)
2656
+ size_t option_len = 255;
2657
+ char *last_endpoint = (char *) zmalloc (option_len);
2658
+ zmq_getsockopt (zsock_resolve (self), ZMQ_LAST_ENDPOINT, last_endpoint, &option_len);
2659
+ return (char *) last_endpoint;
2660
+ # else
2661
+ return NULL;
2662
+ # endif
2663
+ }
2664
+
2665
+ #endif
2666
+
2667
+ #if (ZMQ_VERSION_MAJOR == 2)
2668
+ // --------------------------------------------------------------------------
2669
+ // Set socket ZMQ_HWM value
2670
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2671
+
2672
+ void
2673
+ zsock_set_hwm (void *self, int hwm)
2674
+ {
2675
+ assert (self);
2676
+ # if defined (ZMQ_HWM)
2677
+ uint64_t value = hwm;
2678
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_HWM, &value, sizeof (uint64_t));
2679
+ assert (rc == 0 || zmq_errno () == ETERM);
2680
+ # endif
2681
+ }
2682
+
2683
+
2684
+ // --------------------------------------------------------------------------
2685
+ // Return socket ZMQ_HWM value
2686
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2687
+
2688
+ int
2689
+ zsock_hwm (void *self)
2690
+ {
2691
+ assert (self);
2692
+ # if defined (ZMQ_HWM)
2693
+ uint64_t hwm;
2694
+ size_t option_len = sizeof (uint64_t);
2695
+ zmq_getsockopt (zsock_resolve (self), ZMQ_HWM, &hwm, &option_len);
2696
+ return (int) hwm;
2697
+ # else
2698
+ return 0;
2699
+ # endif
2700
+ }
2701
+
2702
+ // --------------------------------------------------------------------------
2703
+ // Set socket ZMQ_SWAP value
2704
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2705
+
2706
+ void
2707
+ zsock_set_swap (void *self, int swap)
2708
+ {
2709
+ assert (self);
2710
+ # if defined (ZMQ_SWAP)
2711
+ int64_t value = swap;
2712
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SWAP, &value, sizeof (int64_t));
2713
+ assert (rc == 0 || zmq_errno () == ETERM);
2714
+ # endif
2715
+ }
2716
+
2717
+
2718
+ // --------------------------------------------------------------------------
2719
+ // Return socket ZMQ_SWAP value
2720
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2721
+
2722
+ int
2723
+ zsock_swap (void *self)
2724
+ {
2725
+ assert (self);
2726
+ # if defined (ZMQ_SWAP)
2727
+ int64_t swap;
2728
+ size_t option_len = sizeof (int64_t);
2729
+ zmq_getsockopt (zsock_resolve (self), ZMQ_SWAP, &swap, &option_len);
2730
+ return (int) swap;
2731
+ # else
2732
+ return 0;
2733
+ # endif
2734
+ }
2735
+
2736
+ // --------------------------------------------------------------------------
2737
+ // Set socket ZMQ_AFFINITY value
2738
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2739
+
2740
+ void
2741
+ zsock_set_affinity (void *self, int affinity)
2742
+ {
2743
+ assert (self);
2744
+ # if defined (ZMQ_AFFINITY)
2745
+ uint64_t value = affinity;
2746
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_AFFINITY, &value, sizeof (uint64_t));
2747
+ assert (rc == 0 || zmq_errno () == ETERM);
2748
+ # endif
2749
+ }
2750
+
2751
+
2752
+ // --------------------------------------------------------------------------
2753
+ // Return socket ZMQ_AFFINITY value
2754
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2755
+
2756
+ int
2757
+ zsock_affinity (void *self)
2758
+ {
2759
+ assert (self);
2760
+ # if defined (ZMQ_AFFINITY)
2761
+ uint64_t affinity;
2762
+ size_t option_len = sizeof (uint64_t);
2763
+ zmq_getsockopt (zsock_resolve (self), ZMQ_AFFINITY, &affinity, &option_len);
2764
+ return (int) affinity;
2765
+ # else
2766
+ return 0;
2767
+ # endif
2768
+ }
2769
+
2770
+ // --------------------------------------------------------------------------
2771
+ // Set socket ZMQ_IDENTITY value
2772
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2773
+
2774
+ void
2775
+ zsock_set_identity (void *self, const char * identity)
2776
+ {
2777
+ assert (self);
2778
+ # if defined (ZMQ_IDENTITY)
2779
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, strlen (identity));
2780
+ assert (rc == 0 || zmq_errno () == ETERM);
2781
+ # endif
2782
+ }
2783
+
2784
+
2785
+ // --------------------------------------------------------------------------
2786
+ // Return socket ZMQ_IDENTITY value
2787
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2788
+
2789
+ char *
2790
+ zsock_identity (void *self)
2791
+ {
2792
+ assert (self);
2793
+ # if defined (ZMQ_IDENTITY)
2794
+ size_t option_len = 255;
2795
+ char *identity = (char *) zmalloc (option_len);
2796
+ zmq_getsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, &option_len);
2797
+ return (char *) identity;
2798
+ # else
2799
+ return NULL;
2800
+ # endif
2801
+ }
2802
+
2803
+ // --------------------------------------------------------------------------
2804
+ // Set socket ZMQ_RATE value
2805
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2806
+
2807
+ void
2808
+ zsock_set_rate (void *self, int rate)
2809
+ {
2810
+ assert (self);
2811
+ # if defined (ZMQ_RATE)
2812
+ int64_t value = rate;
2813
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RATE, &value, sizeof (int64_t));
2814
+ assert (rc == 0 || zmq_errno () == ETERM);
2815
+ # endif
2816
+ }
2817
+
2818
+
2819
+ // --------------------------------------------------------------------------
2820
+ // Return socket ZMQ_RATE value
2821
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2822
+
2823
+ int
2824
+ zsock_rate (void *self)
2825
+ {
2826
+ assert (self);
2827
+ # if defined (ZMQ_RATE)
2828
+ int64_t rate;
2829
+ size_t option_len = sizeof (int64_t);
2830
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RATE, &rate, &option_len);
2831
+ return (int) rate;
2832
+ # else
2833
+ return 0;
2834
+ # endif
2835
+ }
2836
+
2837
+ // --------------------------------------------------------------------------
2838
+ // Set socket ZMQ_RECOVERY_IVL value
2839
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2840
+
2841
+ void
2842
+ zsock_set_recovery_ivl (void *self, int recovery_ivl)
2843
+ {
2844
+ assert (self);
2845
+ # if defined (ZMQ_RECOVERY_IVL)
2846
+ int64_t value = recovery_ivl;
2847
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &value, sizeof (int64_t));
2848
+ assert (rc == 0 || zmq_errno () == ETERM);
2849
+ # endif
2850
+ }
2851
+
2852
+
2853
+ // --------------------------------------------------------------------------
2854
+ // Return socket ZMQ_RECOVERY_IVL value
2855
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2856
+
2857
+ int
2858
+ zsock_recovery_ivl (void *self)
2859
+ {
2860
+ assert (self);
2861
+ # if defined (ZMQ_RECOVERY_IVL)
2862
+ int64_t recovery_ivl;
2863
+ size_t option_len = sizeof (int64_t);
2864
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
2865
+ return (int) recovery_ivl;
2866
+ # else
2867
+ return 0;
2868
+ # endif
2869
+ }
2870
+
2871
+ // --------------------------------------------------------------------------
2872
+ // Set socket ZMQ_RECOVERY_IVL_MSEC value
2873
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2874
+
2875
+ void
2876
+ zsock_set_recovery_ivl_msec (void *self, int recovery_ivl_msec)
2877
+ {
2878
+ assert (self);
2879
+ # if defined (ZMQ_RECOVERY_IVL_MSEC)
2880
+ int64_t value = recovery_ivl_msec;
2881
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL_MSEC, &value, sizeof (int64_t));
2882
+ assert (rc == 0 || zmq_errno () == ETERM);
2883
+ # endif
2884
+ }
2885
+
2886
+
2887
+ // --------------------------------------------------------------------------
2888
+ // Return socket ZMQ_RECOVERY_IVL_MSEC value
2889
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2890
+
2891
+ int
2892
+ zsock_recovery_ivl_msec (void *self)
2893
+ {
2894
+ assert (self);
2895
+ # if defined (ZMQ_RECOVERY_IVL_MSEC)
2896
+ int64_t recovery_ivl_msec;
2897
+ size_t option_len = sizeof (int64_t);
2898
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL_MSEC, &recovery_ivl_msec, &option_len);
2899
+ return (int) recovery_ivl_msec;
2900
+ # else
2901
+ return 0;
2902
+ # endif
2903
+ }
2904
+
2905
+ // --------------------------------------------------------------------------
2906
+ // Set socket ZMQ_MCAST_LOOP value
2907
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2908
+
2909
+ void
2910
+ zsock_set_mcast_loop (void *self, int mcast_loop)
2911
+ {
2912
+ assert (self);
2913
+ # if defined (ZMQ_MCAST_LOOP)
2914
+ int64_t value = mcast_loop;
2915
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MCAST_LOOP, &value, sizeof (int64_t));
2916
+ assert (rc == 0 || zmq_errno () == ETERM);
2917
+ # endif
2918
+ }
2919
+
2920
+
2921
+ // --------------------------------------------------------------------------
2922
+ // Return socket ZMQ_MCAST_LOOP value
2923
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2924
+
2925
+ int
2926
+ zsock_mcast_loop (void *self)
2927
+ {
2928
+ assert (self);
2929
+ # if defined (ZMQ_MCAST_LOOP)
2930
+ int64_t mcast_loop;
2931
+ size_t option_len = sizeof (int64_t);
2932
+ zmq_getsockopt (zsock_resolve (self), ZMQ_MCAST_LOOP, &mcast_loop, &option_len);
2933
+ return (int) mcast_loop;
2934
+ # else
2935
+ return 0;
2936
+ # endif
2937
+ }
2938
+
2939
+ # if (ZMQ_VERSION_MINOR == 2)
2940
+ // --------------------------------------------------------------------------
2941
+ // Set socket ZMQ_RCVTIMEO value
2942
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2943
+
2944
+ void
2945
+ zsock_set_rcvtimeo (void *self, int rcvtimeo)
2946
+ {
2947
+ assert (self);
2948
+ # if defined (ZMQ_RCVTIMEO)
2949
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
2950
+ assert (rc == 0 || zmq_errno () == ETERM);
2951
+ # endif
2952
+ }
2953
+
2954
+
2955
+ // --------------------------------------------------------------------------
2956
+ // Return socket ZMQ_RCVTIMEO value
2957
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2958
+
2959
+ int
2960
+ zsock_rcvtimeo (void *self)
2961
+ {
2962
+ assert (self);
2963
+ # if defined (ZMQ_RCVTIMEO)
2964
+ int rcvtimeo;
2965
+ size_t option_len = sizeof (int);
2966
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, &option_len);
2967
+ return rcvtimeo;
2968
+ # else
2969
+ return 0;
2970
+ # endif
2971
+ }
2972
+
2973
+ # endif
2974
+ # if (ZMQ_VERSION_MINOR == 2)
2975
+ // --------------------------------------------------------------------------
2976
+ // Set socket ZMQ_SNDTIMEO value
2977
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2978
+
2979
+ void
2980
+ zsock_set_sndtimeo (void *self, int sndtimeo)
2981
+ {
2982
+ assert (self);
2983
+ # if defined (ZMQ_SNDTIMEO)
2984
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
2985
+ assert (rc == 0 || zmq_errno () == ETERM);
2986
+ # endif
2987
+ }
2988
+
2989
+
2990
+ // --------------------------------------------------------------------------
2991
+ // Return socket ZMQ_SNDTIMEO value
2992
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2993
+
2994
+ int
2995
+ zsock_sndtimeo (void *self)
2996
+ {
2997
+ assert (self);
2998
+ # if defined (ZMQ_SNDTIMEO)
2999
+ int sndtimeo;
3000
+ size_t option_len = sizeof (int);
3001
+ zmq_getsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, &option_len);
3002
+ return sndtimeo;
3003
+ # else
3004
+ return 0;
3005
+ # endif
3006
+ }
3007
+
3008
+ # endif
3009
+ // --------------------------------------------------------------------------
3010
+ // Set socket ZMQ_SNDBUF value
3011
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3012
+
3013
+ void
3014
+ zsock_set_sndbuf (void *self, int sndbuf)
3015
+ {
3016
+ assert (self);
3017
+ # if defined (ZMQ_SNDBUF)
3018
+ uint64_t value = sndbuf;
3019
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDBUF, &value, sizeof (uint64_t));
3020
+ assert (rc == 0 || zmq_errno () == ETERM);
3021
+ # endif
3022
+ }
3023
+
3024
+
3025
+ // --------------------------------------------------------------------------
3026
+ // Return socket ZMQ_SNDBUF value
3027
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3028
+
3029
+ int
3030
+ zsock_sndbuf (void *self)
3031
+ {
3032
+ assert (self);
3033
+ # if defined (ZMQ_SNDBUF)
3034
+ uint64_t sndbuf;
3035
+ size_t option_len = sizeof (uint64_t);
3036
+ zmq_getsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, &option_len);
3037
+ return (int) sndbuf;
3038
+ # else
3039
+ return 0;
3040
+ # endif
3041
+ }
3042
+
3043
+ // --------------------------------------------------------------------------
3044
+ // Set socket ZMQ_RCVBUF value
3045
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3046
+
3047
+ void
3048
+ zsock_set_rcvbuf (void *self, int rcvbuf)
3049
+ {
3050
+ assert (self);
3051
+ # if defined (ZMQ_RCVBUF)
3052
+ uint64_t value = rcvbuf;
3053
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVBUF, &value, sizeof (uint64_t));
3054
+ assert (rc == 0 || zmq_errno () == ETERM);
3055
+ # endif
3056
+ }
3057
+
3058
+
3059
+ // --------------------------------------------------------------------------
3060
+ // Return socket ZMQ_RCVBUF value
3061
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3062
+
3063
+ int
3064
+ zsock_rcvbuf (void *self)
3065
+ {
3066
+ assert (self);
3067
+ # if defined (ZMQ_RCVBUF)
3068
+ uint64_t rcvbuf;
3069
+ size_t option_len = sizeof (uint64_t);
3070
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, &option_len);
3071
+ return (int) rcvbuf;
3072
+ # else
3073
+ return 0;
3074
+ # endif
3075
+ }
3076
+
3077
+ // --------------------------------------------------------------------------
3078
+ // Set socket ZMQ_LINGER value
3079
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3080
+
3081
+ void
3082
+ zsock_set_linger (void *self, int linger)
3083
+ {
3084
+ assert (self);
3085
+ # if defined (ZMQ_LINGER)
3086
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, sizeof (int));
3087
+ assert (rc == 0 || zmq_errno () == ETERM);
3088
+ # endif
3089
+ }
3090
+
3091
+
3092
+ // --------------------------------------------------------------------------
3093
+ // Return socket ZMQ_LINGER value
3094
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3095
+
3096
+ int
3097
+ zsock_linger (void *self)
3098
+ {
3099
+ assert (self);
3100
+ # if defined (ZMQ_LINGER)
3101
+ int linger;
3102
+ size_t option_len = sizeof (int);
3103
+ zmq_getsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, &option_len);
3104
+ return linger;
3105
+ # else
3106
+ return 0;
3107
+ # endif
3108
+ }
3109
+
3110
+ // --------------------------------------------------------------------------
3111
+ // Set socket ZMQ_RECONNECT_IVL value
3112
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3113
+
3114
+ void
3115
+ zsock_set_reconnect_ivl (void *self, int reconnect_ivl)
3116
+ {
3117
+ assert (self);
3118
+ # if defined (ZMQ_RECONNECT_IVL)
3119
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
3120
+ assert (rc == 0 || zmq_errno () == ETERM);
3121
+ # endif
3122
+ }
3123
+
3124
+
3125
+ // --------------------------------------------------------------------------
3126
+ // Return socket ZMQ_RECONNECT_IVL value
3127
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3128
+
3129
+ int
3130
+ zsock_reconnect_ivl (void *self)
3131
+ {
3132
+ assert (self);
3133
+ # if defined (ZMQ_RECONNECT_IVL)
3134
+ int reconnect_ivl;
3135
+ size_t option_len = sizeof (int);
3136
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, &option_len);
3137
+ return reconnect_ivl;
3138
+ # else
3139
+ return 0;
3140
+ # endif
3141
+ }
3142
+
3143
+ // --------------------------------------------------------------------------
3144
+ // Set socket ZMQ_RECONNECT_IVL_MAX value
3145
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3146
+
3147
+ void
3148
+ zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max)
3149
+ {
3150
+ assert (self);
3151
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
3152
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
3153
+ assert (rc == 0 || zmq_errno () == ETERM);
3154
+ # endif
3155
+ }
3156
+
3157
+
3158
+ // --------------------------------------------------------------------------
3159
+ // Return socket ZMQ_RECONNECT_IVL_MAX value
3160
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3161
+
3162
+ int
3163
+ zsock_reconnect_ivl_max (void *self)
3164
+ {
3165
+ assert (self);
3166
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
3167
+ int reconnect_ivl_max;
3168
+ size_t option_len = sizeof (int);
3169
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, &option_len);
3170
+ return reconnect_ivl_max;
3171
+ # else
3172
+ return 0;
3173
+ # endif
3174
+ }
3175
+
3176
+ // --------------------------------------------------------------------------
3177
+ // Set socket ZMQ_BACKLOG value
3178
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3179
+
3180
+ void
3181
+ zsock_set_backlog (void *self, int backlog)
3182
+ {
3183
+ assert (self);
3184
+ # if defined (ZMQ_BACKLOG)
3185
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, sizeof (int));
3186
+ assert (rc == 0 || zmq_errno () == ETERM);
3187
+ # endif
3188
+ }
3189
+
3190
+
3191
+ // --------------------------------------------------------------------------
3192
+ // Return socket ZMQ_BACKLOG value
3193
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3194
+
3195
+ int
3196
+ zsock_backlog (void *self)
3197
+ {
3198
+ assert (self);
3199
+ # if defined (ZMQ_BACKLOG)
3200
+ int backlog;
3201
+ size_t option_len = sizeof (int);
3202
+ zmq_getsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, &option_len);
3203
+ return backlog;
3204
+ # else
3205
+ return 0;
3206
+ # endif
3207
+ }
3208
+
3209
+ // --------------------------------------------------------------------------
3210
+ // Set socket ZMQ_SUBSCRIBE value
3211
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3212
+
3213
+ void
3214
+ zsock_set_subscribe (void *self, const char * subscribe)
3215
+ {
3216
+ assert (self);
3217
+ # if defined (ZMQ_SUBSCRIBE)
3218
+ if (zsock_type (self) != ZMQ_SUB) {
3219
+ printf ("ZMQ_SUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
3220
+ assert (false);
3221
+ }
3222
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SUBSCRIBE, subscribe, strlen (subscribe));
3223
+ assert (rc == 0 || zmq_errno () == ETERM);
3224
+ # endif
3225
+ }
3226
+
3227
+
3228
+ // --------------------------------------------------------------------------
3229
+ // Set socket ZMQ_UNSUBSCRIBE value
3230
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3231
+
3232
+ void
3233
+ zsock_set_unsubscribe (void *self, const char * unsubscribe)
3234
+ {
3235
+ assert (self);
3236
+ # if defined (ZMQ_UNSUBSCRIBE)
3237
+ if (zsock_type (self) != ZMQ_SUB) {
3238
+ printf ("ZMQ_UNSUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
3239
+ assert (false);
3240
+ }
3241
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_UNSUBSCRIBE, unsubscribe, strlen (unsubscribe));
3242
+ assert (rc == 0 || zmq_errno () == ETERM);
3243
+ # endif
3244
+ }
3245
+
3246
+
3247
+ // --------------------------------------------------------------------------
3248
+ // Return socket ZMQ_TYPE value
3249
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3250
+
3251
+ int
3252
+ zsock_type (void *self)
3253
+ {
3254
+ assert (self);
3255
+ # if defined (ZMQ_TYPE)
3256
+ int type;
3257
+ size_t option_len = sizeof (int);
3258
+ zmq_getsockopt (zsock_resolve (self), ZMQ_TYPE, &type, &option_len);
3259
+ return type;
3260
+ # else
3261
+ return 0;
3262
+ # endif
3263
+ }
3264
+
3265
+ // --------------------------------------------------------------------------
3266
+ // Return socket ZMQ_RCVMORE value
3267
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3268
+
3269
+ int
3270
+ zsock_rcvmore (void *self)
3271
+ {
3272
+ assert (self);
3273
+ # if defined (ZMQ_RCVMORE)
3274
+ int64_t rcvmore;
3275
+ size_t option_len = sizeof (int64_t);
3276
+ zmq_getsockopt (zsock_resolve (self), ZMQ_RCVMORE, &rcvmore, &option_len);
3277
+ return (int) rcvmore;
3278
+ # else
3279
+ return 0;
3280
+ # endif
3281
+ }
3282
+
3283
+ // --------------------------------------------------------------------------
3284
+ // Return socket ZMQ_FD value
3285
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3286
+
3287
+ SOCKET
3288
+ zsock_fd (void *self)
3289
+ {
3290
+ assert (self);
3291
+ # if defined (ZMQ_FD)
3292
+ SOCKET fd;
3293
+ size_t option_len = sizeof (SOCKET);
3294
+ zmq_getsockopt (zsock_resolve (self), ZMQ_FD, &fd, &option_len);
3295
+ return fd;
3296
+ # else
3297
+ return 0;
3298
+ # endif
3299
+ }
3300
+
3301
+ // --------------------------------------------------------------------------
3302
+ // Return socket ZMQ_EVENTS value
3303
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3304
+
3305
+ int
3306
+ zsock_events (void *self)
3307
+ {
3308
+ assert (self);
3309
+ # if defined (ZMQ_EVENTS)
3310
+ uint32_t events;
3311
+ size_t option_len = sizeof (uint32_t);
3312
+ zmq_getsockopt (zsock_resolve (self), ZMQ_EVENTS, &events, &option_len);
3313
+ return (int) events;
3314
+ # else
3315
+ return 0;
3316
+ # endif
3317
+ }
3318
+
3319
+ #endif
3320
+
3321
+ // --------------------------------------------------------------------------
3322
+ // Selftest
3323
+ // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3324
+
3325
+ void
3326
+ zsock_option_test (bool verbose)
3327
+ {
3328
+ printf (" * zsock_option: ");
3329
+
3330
+ // @selftest
3331
+ zsock_t *self;
3332
+ #if (ZMQ_VERSION_MAJOR == 4)
3333
+ # if defined (ZMQ_HEARTBEAT_IVL)
3334
+ self = zsock_new (ZMQ_DEALER);
3335
+ assert (self);
3336
+ zsock_set_heartbeat_ivl (self, 2000);
3337
+ assert (zsock_heartbeat_ivl (self) == 2000);
3338
+ zsock_heartbeat_ivl (self);
3339
+ zsock_destroy (&self);
3340
+ # endif
3341
+ # if defined (ZMQ_HEARTBEAT_TTL)
3342
+ self = zsock_new (ZMQ_DEALER);
3343
+ assert (self);
3344
+ zsock_set_heartbeat_ttl (self, 4000);
3345
+ assert (zsock_heartbeat_ttl (self) == 4000);
3346
+ zsock_heartbeat_ttl (self);
3347
+ zsock_destroy (&self);
3348
+ # endif
3349
+ # if defined (ZMQ_HEARTBEAT_TIMEOUT)
3350
+ self = zsock_new (ZMQ_DEALER);
3351
+ assert (self);
3352
+ zsock_set_heartbeat_timeout (self, 6000);
3353
+ assert (zsock_heartbeat_timeout (self) == 6000);
3354
+ zsock_heartbeat_timeout (self);
3355
+ zsock_destroy (&self);
3356
+ # endif
3357
+ # if defined (ZMQ_USE_FD)
3358
+ self = zsock_new (ZMQ_REQ);
3359
+ assert (self);
3360
+ zsock_set_use_fd (self, 3);
3361
+ assert (zsock_use_fd (self) == 3);
3362
+ zsock_use_fd (self);
3363
+ zsock_destroy (&self);
3364
+ # endif
3365
+ # if defined (ZMQ_TOS)
3366
+ self = zsock_new (ZMQ_DEALER);
3367
+ assert (self);
3368
+ zsock_set_tos (self, 1);
3369
+ assert (zsock_tos (self) == 1);
3370
+ zsock_tos (self);
3371
+ zsock_destroy (&self);
3372
+ # endif
3373
+ # if defined (ZMQ_ROUTER_HANDOVER)
3374
+ self = zsock_new (ZMQ_ROUTER);
3375
+ assert (self);
3376
+ zsock_set_router_handover (self, 1);
3377
+ zsock_destroy (&self);
3378
+ # endif
3379
+ # if defined (ZMQ_ROUTER_MANDATORY)
3380
+ self = zsock_new (ZMQ_ROUTER);
3381
+ assert (self);
3382
+ zsock_set_router_mandatory (self, 1);
3383
+ zsock_destroy (&self);
3384
+ # endif
3385
+ # if defined (ZMQ_PROBE_ROUTER)
3386
+ self = zsock_new (ZMQ_DEALER);
3387
+ assert (self);
3388
+ zsock_set_probe_router (self, 1);
3389
+ zsock_destroy (&self);
3390
+ # endif
3391
+ # if defined (ZMQ_REQ_RELAXED)
3392
+ self = zsock_new (ZMQ_REQ);
3393
+ assert (self);
3394
+ zsock_set_req_relaxed (self, 1);
3395
+ zsock_destroy (&self);
3396
+ # endif
3397
+ # if defined (ZMQ_REQ_CORRELATE)
3398
+ self = zsock_new (ZMQ_REQ);
3399
+ assert (self);
3400
+ zsock_set_req_correlate (self, 1);
3401
+ zsock_destroy (&self);
3402
+ # endif
3403
+ # if defined (ZMQ_CONFLATE)
3404
+ self = zsock_new (ZMQ_PUSH);
3405
+ assert (self);
3406
+ zsock_set_conflate (self, 1);
3407
+ zsock_destroy (&self);
3408
+ # endif
3409
+ # if defined (ZMQ_ZAP_DOMAIN)
3410
+ self = zsock_new (ZMQ_SUB);
3411
+ assert (self);
3412
+ zsock_set_zap_domain (self, "test");
3413
+ char *zap_domain = zsock_zap_domain (self);
3414
+ assert (zap_domain);
3415
+ free (zap_domain);
3416
+ zsock_destroy (&self);
3417
+ # endif
3418
+ # if defined (ZMQ_MECHANISM)
3419
+ self = zsock_new (ZMQ_SUB);
3420
+ assert (self);
3421
+ zsock_mechanism (self);
3422
+ zsock_destroy (&self);
3423
+ # endif
3424
+ # if defined (ZMQ_PLAIN_SERVER)
3425
+ self = zsock_new (ZMQ_PUB);
3426
+ assert (self);
3427
+ zsock_set_plain_server (self, 1);
3428
+ assert (zsock_plain_server (self) == 1);
3429
+ zsock_plain_server (self);
3430
+ zsock_destroy (&self);
3431
+ # endif
3432
+ # if defined (ZMQ_PLAIN_USERNAME)
3433
+ self = zsock_new (ZMQ_SUB);
3434
+ assert (self);
3435
+ zsock_set_plain_username (self, "test");
3436
+ char *plain_username = zsock_plain_username (self);
3437
+ assert (plain_username);
3438
+ free (plain_username);
3439
+ zsock_destroy (&self);
3440
+ # endif
3441
+ # if defined (ZMQ_PLAIN_PASSWORD)
3442
+ self = zsock_new (ZMQ_SUB);
3443
+ assert (self);
3444
+ zsock_set_plain_password (self, "test");
3445
+ char *plain_password = zsock_plain_password (self);
3446
+ assert (plain_password);
3447
+ free (plain_password);
3448
+ zsock_destroy (&self);
3449
+ # endif
3450
+ # if defined (ZMQ_IPV6)
3451
+ self = zsock_new (ZMQ_SUB);
3452
+ assert (self);
3453
+ zsock_set_ipv6 (self, 1);
3454
+ assert (zsock_ipv6 (self) == 1);
3455
+ zsock_ipv6 (self);
3456
+ zsock_destroy (&self);
3457
+ # endif
3458
+ # if defined (ZMQ_IMMEDIATE)
3459
+ self = zsock_new (ZMQ_DEALER);
3460
+ assert (self);
3461
+ zsock_set_immediate (self, 1);
3462
+ assert (zsock_immediate (self) == 1);
3463
+ zsock_immediate (self);
3464
+ zsock_destroy (&self);
3465
+ # endif
3466
+ # if defined (ZMQ_ROUTER_RAW)
3467
+ self = zsock_new (ZMQ_ROUTER);
3468
+ assert (self);
3469
+ zsock_set_router_raw (self, 1);
3470
+ zsock_destroy (&self);
3471
+ # endif
3472
+ # if defined (ZMQ_IPV4ONLY)
3473
+ self = zsock_new (ZMQ_SUB);
3474
+ assert (self);
3475
+ zsock_set_ipv4only (self, 1);
3476
+ assert (zsock_ipv4only (self) == 1);
3477
+ zsock_ipv4only (self);
3478
+ zsock_destroy (&self);
3479
+ # endif
3480
+ # if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
3481
+ self = zsock_new (ZMQ_PUB);
3482
+ assert (self);
3483
+ zsock_set_delay_attach_on_connect (self, 1);
3484
+ zsock_destroy (&self);
3485
+ # endif
3486
+ # if defined (ZMQ_TYPE)
3487
+ self = zsock_new (ZMQ_SUB);
3488
+ assert (self);
3489
+ zsock_type (self);
3490
+ zsock_destroy (&self);
3491
+ # endif
3492
+ # if defined (ZMQ_SNDHWM)
3493
+ self = zsock_new (ZMQ_PUB);
3494
+ assert (self);
3495
+ zsock_set_sndhwm (self, 1);
3496
+ assert (zsock_sndhwm (self) == 1);
3497
+ zsock_sndhwm (self);
3498
+ zsock_destroy (&self);
3499
+ # endif
3500
+ # if defined (ZMQ_RCVHWM)
3501
+ self = zsock_new (ZMQ_SUB);
3502
+ assert (self);
3503
+ zsock_set_rcvhwm (self, 1);
3504
+ assert (zsock_rcvhwm (self) == 1);
3505
+ zsock_rcvhwm (self);
3506
+ zsock_destroy (&self);
3507
+ # endif
3508
+ # if defined (ZMQ_AFFINITY)
3509
+ self = zsock_new (ZMQ_SUB);
3510
+ assert (self);
3511
+ zsock_set_affinity (self, 1);
3512
+ assert (zsock_affinity (self) == 1);
3513
+ zsock_affinity (self);
3514
+ zsock_destroy (&self);
3515
+ # endif
3516
+ # if defined (ZMQ_SUBSCRIBE)
3517
+ self = zsock_new (ZMQ_SUB);
3518
+ assert (self);
3519
+ zsock_set_subscribe (self, "test");
3520
+ zsock_destroy (&self);
3521
+ # endif
3522
+ # if defined (ZMQ_UNSUBSCRIBE)
3523
+ self = zsock_new (ZMQ_SUB);
3524
+ assert (self);
3525
+ zsock_set_unsubscribe (self, "test");
3526
+ zsock_destroy (&self);
3527
+ # endif
3528
+ # if defined (ZMQ_IDENTITY)
3529
+ self = zsock_new (ZMQ_DEALER);
3530
+ assert (self);
3531
+ zsock_set_identity (self, "test");
3532
+ char *identity = zsock_identity (self);
3533
+ assert (identity);
3534
+ free (identity);
3535
+ zsock_destroy (&self);
3536
+ # endif
3537
+ # if defined (ZMQ_RATE)
3538
+ self = zsock_new (ZMQ_SUB);
3539
+ assert (self);
3540
+ zsock_set_rate (self, 1);
3541
+ assert (zsock_rate (self) == 1);
3542
+ zsock_rate (self);
3543
+ zsock_destroy (&self);
3544
+ # endif
3545
+ # if defined (ZMQ_RECOVERY_IVL)
3546
+ self = zsock_new (ZMQ_SUB);
3547
+ assert (self);
3548
+ zsock_set_recovery_ivl (self, 1);
3549
+ assert (zsock_recovery_ivl (self) == 1);
3550
+ zsock_recovery_ivl (self);
3551
+ zsock_destroy (&self);
3552
+ # endif
3553
+ # if defined (ZMQ_SNDBUF)
3554
+ self = zsock_new (ZMQ_PUB);
3555
+ assert (self);
3556
+ zsock_set_sndbuf (self, 1);
3557
+ assert (zsock_sndbuf (self) == 1);
3558
+ zsock_sndbuf (self);
3559
+ zsock_destroy (&self);
3560
+ # endif
3561
+ # if defined (ZMQ_RCVBUF)
3562
+ self = zsock_new (ZMQ_SUB);
3563
+ assert (self);
3564
+ zsock_set_rcvbuf (self, 1);
3565
+ assert (zsock_rcvbuf (self) == 1);
3566
+ zsock_rcvbuf (self);
3567
+ zsock_destroy (&self);
3568
+ # endif
3569
+ # if defined (ZMQ_LINGER)
3570
+ self = zsock_new (ZMQ_SUB);
3571
+ assert (self);
3572
+ zsock_set_linger (self, 1);
3573
+ assert (zsock_linger (self) == 1);
3574
+ zsock_linger (self);
3575
+ zsock_destroy (&self);
3576
+ # endif
3577
+ # if defined (ZMQ_RECONNECT_IVL)
3578
+ self = zsock_new (ZMQ_SUB);
3579
+ assert (self);
3580
+ zsock_set_reconnect_ivl (self, 1);
3581
+ assert (zsock_reconnect_ivl (self) == 1);
3582
+ zsock_reconnect_ivl (self);
3583
+ zsock_destroy (&self);
3584
+ # endif
3585
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
3586
+ self = zsock_new (ZMQ_SUB);
3587
+ assert (self);
3588
+ zsock_set_reconnect_ivl_max (self, 1);
3589
+ assert (zsock_reconnect_ivl_max (self) == 1);
3590
+ zsock_reconnect_ivl_max (self);
3591
+ zsock_destroy (&self);
3592
+ # endif
3593
+ # if defined (ZMQ_BACKLOG)
3594
+ self = zsock_new (ZMQ_SUB);
3595
+ assert (self);
3596
+ zsock_set_backlog (self, 1);
3597
+ assert (zsock_backlog (self) == 1);
3598
+ zsock_backlog (self);
3599
+ zsock_destroy (&self);
3600
+ # endif
3601
+ # if defined (ZMQ_MAXMSGSIZE)
3602
+ self = zsock_new (ZMQ_SUB);
3603
+ assert (self);
3604
+ zsock_set_maxmsgsize (self, 1);
3605
+ assert (zsock_maxmsgsize (self) == 1);
3606
+ zsock_maxmsgsize (self);
3607
+ zsock_destroy (&self);
3608
+ # endif
3609
+ # if defined (ZMQ_MULTICAST_HOPS)
3610
+ self = zsock_new (ZMQ_SUB);
3611
+ assert (self);
3612
+ zsock_set_multicast_hops (self, 1);
3613
+ assert (zsock_multicast_hops (self) == 1);
3614
+ zsock_multicast_hops (self);
3615
+ zsock_destroy (&self);
3616
+ # endif
3617
+ # if defined (ZMQ_RCVTIMEO)
3618
+ self = zsock_new (ZMQ_SUB);
3619
+ assert (self);
3620
+ zsock_set_rcvtimeo (self, 1);
3621
+ assert (zsock_rcvtimeo (self) == 1);
3622
+ zsock_rcvtimeo (self);
3623
+ zsock_destroy (&self);
3624
+ # endif
3625
+ # if defined (ZMQ_SNDTIMEO)
3626
+ self = zsock_new (ZMQ_SUB);
3627
+ assert (self);
3628
+ zsock_set_sndtimeo (self, 1);
3629
+ assert (zsock_sndtimeo (self) == 1);
3630
+ zsock_sndtimeo (self);
3631
+ zsock_destroy (&self);
3632
+ # endif
3633
+ # if defined (ZMQ_XPUB_VERBOSE)
3634
+ self = zsock_new (ZMQ_XPUB);
3635
+ assert (self);
3636
+ zsock_set_xpub_verbose (self, 1);
3637
+ zsock_destroy (&self);
3638
+ # endif
3639
+ # if defined (ZMQ_TCP_KEEPALIVE)
3640
+ self = zsock_new (ZMQ_SUB);
3641
+ assert (self);
3642
+ zsock_set_tcp_keepalive (self, 1);
3643
+ assert (zsock_tcp_keepalive (self) == 1);
3644
+ zsock_tcp_keepalive (self);
3645
+ zsock_destroy (&self);
3646
+ # endif
3647
+ # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
3648
+ self = zsock_new (ZMQ_SUB);
3649
+ assert (self);
3650
+ zsock_set_tcp_keepalive_idle (self, 1);
3651
+ assert (zsock_tcp_keepalive_idle (self) == 1);
3652
+ zsock_tcp_keepalive_idle (self);
3653
+ zsock_destroy (&self);
3654
+ # endif
3655
+ # if defined (ZMQ_TCP_KEEPALIVE_CNT)
3656
+ self = zsock_new (ZMQ_SUB);
3657
+ assert (self);
3658
+ zsock_set_tcp_keepalive_cnt (self, 1);
3659
+ assert (zsock_tcp_keepalive_cnt (self) == 1);
3660
+ zsock_tcp_keepalive_cnt (self);
3661
+ zsock_destroy (&self);
3662
+ # endif
3663
+ # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
3664
+ self = zsock_new (ZMQ_SUB);
3665
+ assert (self);
3666
+ zsock_set_tcp_keepalive_intvl (self, 1);
3667
+ assert (zsock_tcp_keepalive_intvl (self) == 1);
3668
+ zsock_tcp_keepalive_intvl (self);
3669
+ zsock_destroy (&self);
3670
+ # endif
3671
+ # if defined (ZMQ_TCP_ACCEPT_FILTER)
3672
+ self = zsock_new (ZMQ_SUB);
3673
+ assert (self);
3674
+ zsock_set_tcp_accept_filter (self, "127.0.0.1");
3675
+ char *tcp_accept_filter = zsock_tcp_accept_filter (self);
3676
+ assert (tcp_accept_filter);
3677
+ free (tcp_accept_filter);
3678
+ zsock_destroy (&self);
3679
+ # endif
3680
+ # if defined (ZMQ_RCVMORE)
3681
+ self = zsock_new (ZMQ_SUB);
3682
+ assert (self);
3683
+ zsock_rcvmore (self);
3684
+ zsock_destroy (&self);
3685
+ # endif
3686
+ # if defined (ZMQ_FD)
3687
+ self = zsock_new (ZMQ_SUB);
3688
+ assert (self);
3689
+ zsock_fd (self);
3690
+ zsock_destroy (&self);
3691
+ # endif
3692
+ # if defined (ZMQ_EVENTS)
3693
+ self = zsock_new (ZMQ_SUB);
3694
+ assert (self);
3695
+ zsock_events (self);
3696
+ zsock_destroy (&self);
3697
+ # endif
3698
+ # if defined (ZMQ_LAST_ENDPOINT)
3699
+ self = zsock_new (ZMQ_SUB);
3700
+ assert (self);
3701
+ char *last_endpoint = zsock_last_endpoint (self);
3702
+ assert (last_endpoint);
3703
+ free (last_endpoint);
3704
+ zsock_destroy (&self);
3705
+ # endif
3706
+ #endif
3707
+
3708
+ #if (ZMQ_VERSION_MAJOR == 3)
3709
+ # if defined (ZMQ_ROUTER_RAW)
3710
+ self = zsock_new (ZMQ_ROUTER);
3711
+ assert (self);
3712
+ zsock_set_router_raw (self, 1);
3713
+ zsock_destroy (&self);
3714
+ # endif
3715
+ # if defined (ZMQ_IPV4ONLY)
3716
+ self = zsock_new (ZMQ_SUB);
3717
+ assert (self);
3718
+ zsock_set_ipv4only (self, 1);
3719
+ assert (zsock_ipv4only (self) == 1);
3720
+ zsock_ipv4only (self);
3721
+ zsock_destroy (&self);
3722
+ # endif
3723
+ # if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
3724
+ self = zsock_new (ZMQ_PUB);
3725
+ assert (self);
3726
+ zsock_set_delay_attach_on_connect (self, 1);
3727
+ zsock_destroy (&self);
3728
+ # endif
3729
+ # if defined (ZMQ_TYPE)
3730
+ self = zsock_new (ZMQ_SUB);
3731
+ assert (self);
3732
+ zsock_type (self);
3733
+ zsock_destroy (&self);
3734
+ # endif
3735
+ # if defined (ZMQ_SNDHWM)
3736
+ self = zsock_new (ZMQ_PUB);
3737
+ assert (self);
3738
+ zsock_set_sndhwm (self, 1);
3739
+ assert (zsock_sndhwm (self) == 1);
3740
+ zsock_sndhwm (self);
3741
+ zsock_destroy (&self);
3742
+ # endif
3743
+ # if defined (ZMQ_RCVHWM)
3744
+ self = zsock_new (ZMQ_SUB);
3745
+ assert (self);
3746
+ zsock_set_rcvhwm (self, 1);
3747
+ assert (zsock_rcvhwm (self) == 1);
3748
+ zsock_rcvhwm (self);
3749
+ zsock_destroy (&self);
3750
+ # endif
3751
+ # if defined (ZMQ_AFFINITY)
3752
+ self = zsock_new (ZMQ_SUB);
3753
+ assert (self);
3754
+ zsock_set_affinity (self, 1);
3755
+ assert (zsock_affinity (self) == 1);
3756
+ zsock_affinity (self);
3757
+ zsock_destroy (&self);
3758
+ # endif
3759
+ # if defined (ZMQ_SUBSCRIBE)
3760
+ self = zsock_new (ZMQ_SUB);
3761
+ assert (self);
3762
+ zsock_set_subscribe (self, "test");
3763
+ zsock_destroy (&self);
3764
+ # endif
3765
+ # if defined (ZMQ_UNSUBSCRIBE)
3766
+ self = zsock_new (ZMQ_SUB);
3767
+ assert (self);
3768
+ zsock_set_unsubscribe (self, "test");
3769
+ zsock_destroy (&self);
3770
+ # endif
3771
+ # if defined (ZMQ_IDENTITY)
3772
+ self = zsock_new (ZMQ_DEALER);
3773
+ assert (self);
3774
+ zsock_set_identity (self, "test");
3775
+ char *identity = zsock_identity (self);
3776
+ assert (identity);
3777
+ free (identity);
3778
+ zsock_destroy (&self);
3779
+ # endif
3780
+ # if defined (ZMQ_RATE)
3781
+ self = zsock_new (ZMQ_SUB);
3782
+ assert (self);
3783
+ zsock_set_rate (self, 1);
3784
+ assert (zsock_rate (self) == 1);
3785
+ zsock_rate (self);
3786
+ zsock_destroy (&self);
3787
+ # endif
3788
+ # if defined (ZMQ_RECOVERY_IVL)
3789
+ self = zsock_new (ZMQ_SUB);
3790
+ assert (self);
3791
+ zsock_set_recovery_ivl (self, 1);
3792
+ assert (zsock_recovery_ivl (self) == 1);
3793
+ zsock_recovery_ivl (self);
3794
+ zsock_destroy (&self);
3795
+ # endif
3796
+ # if defined (ZMQ_SNDBUF)
3797
+ self = zsock_new (ZMQ_PUB);
3798
+ assert (self);
3799
+ zsock_set_sndbuf (self, 1);
3800
+ assert (zsock_sndbuf (self) == 1);
3801
+ zsock_sndbuf (self);
3802
+ zsock_destroy (&self);
3803
+ # endif
3804
+ # if defined (ZMQ_RCVBUF)
3805
+ self = zsock_new (ZMQ_SUB);
3806
+ assert (self);
3807
+ zsock_set_rcvbuf (self, 1);
3808
+ assert (zsock_rcvbuf (self) == 1);
3809
+ zsock_rcvbuf (self);
3810
+ zsock_destroy (&self);
3811
+ # endif
3812
+ # if defined (ZMQ_LINGER)
3813
+ self = zsock_new (ZMQ_SUB);
3814
+ assert (self);
3815
+ zsock_set_linger (self, 1);
3816
+ assert (zsock_linger (self) == 1);
3817
+ zsock_linger (self);
3818
+ zsock_destroy (&self);
3819
+ # endif
3820
+ # if defined (ZMQ_RECONNECT_IVL)
3821
+ self = zsock_new (ZMQ_SUB);
3822
+ assert (self);
3823
+ zsock_set_reconnect_ivl (self, 1);
3824
+ assert (zsock_reconnect_ivl (self) == 1);
3825
+ zsock_reconnect_ivl (self);
3826
+ zsock_destroy (&self);
3827
+ # endif
3828
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
3829
+ self = zsock_new (ZMQ_SUB);
3830
+ assert (self);
3831
+ zsock_set_reconnect_ivl_max (self, 1);
3832
+ assert (zsock_reconnect_ivl_max (self) == 1);
3833
+ zsock_reconnect_ivl_max (self);
3834
+ zsock_destroy (&self);
3835
+ # endif
3836
+ # if defined (ZMQ_BACKLOG)
3837
+ self = zsock_new (ZMQ_SUB);
3838
+ assert (self);
3839
+ zsock_set_backlog (self, 1);
3840
+ assert (zsock_backlog (self) == 1);
3841
+ zsock_backlog (self);
3842
+ zsock_destroy (&self);
3843
+ # endif
3844
+ # if defined (ZMQ_MAXMSGSIZE)
3845
+ self = zsock_new (ZMQ_SUB);
3846
+ assert (self);
3847
+ zsock_set_maxmsgsize (self, 1);
3848
+ assert (zsock_maxmsgsize (self) == 1);
3849
+ zsock_maxmsgsize (self);
3850
+ zsock_destroy (&self);
3851
+ # endif
3852
+ # if defined (ZMQ_MULTICAST_HOPS)
3853
+ self = zsock_new (ZMQ_SUB);
3854
+ assert (self);
3855
+ zsock_set_multicast_hops (self, 1);
3856
+ assert (zsock_multicast_hops (self) == 1);
3857
+ zsock_multicast_hops (self);
3858
+ zsock_destroy (&self);
3859
+ # endif
3860
+ # if defined (ZMQ_RCVTIMEO)
3861
+ self = zsock_new (ZMQ_SUB);
3862
+ assert (self);
3863
+ zsock_set_rcvtimeo (self, 1);
3864
+ assert (zsock_rcvtimeo (self) == 1);
3865
+ zsock_rcvtimeo (self);
3866
+ zsock_destroy (&self);
3867
+ # endif
3868
+ # if defined (ZMQ_SNDTIMEO)
3869
+ self = zsock_new (ZMQ_SUB);
3870
+ assert (self);
3871
+ zsock_set_sndtimeo (self, 1);
3872
+ assert (zsock_sndtimeo (self) == 1);
3873
+ zsock_sndtimeo (self);
3874
+ zsock_destroy (&self);
3875
+ # endif
3876
+ # if defined (ZMQ_XPUB_VERBOSE)
3877
+ self = zsock_new (ZMQ_XPUB);
3878
+ assert (self);
3879
+ zsock_set_xpub_verbose (self, 1);
3880
+ zsock_destroy (&self);
3881
+ # endif
3882
+ # if defined (ZMQ_TCP_KEEPALIVE)
3883
+ self = zsock_new (ZMQ_SUB);
3884
+ assert (self);
3885
+ zsock_set_tcp_keepalive (self, 1);
3886
+ assert (zsock_tcp_keepalive (self) == 1);
3887
+ zsock_tcp_keepalive (self);
3888
+ zsock_destroy (&self);
3889
+ # endif
3890
+ # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
3891
+ self = zsock_new (ZMQ_SUB);
3892
+ assert (self);
3893
+ zsock_set_tcp_keepalive_idle (self, 1);
3894
+ assert (zsock_tcp_keepalive_idle (self) == 1);
3895
+ zsock_tcp_keepalive_idle (self);
3896
+ zsock_destroy (&self);
3897
+ # endif
3898
+ # if defined (ZMQ_TCP_KEEPALIVE_CNT)
3899
+ self = zsock_new (ZMQ_SUB);
3900
+ assert (self);
3901
+ zsock_set_tcp_keepalive_cnt (self, 1);
3902
+ assert (zsock_tcp_keepalive_cnt (self) == 1);
3903
+ zsock_tcp_keepalive_cnt (self);
3904
+ zsock_destroy (&self);
3905
+ # endif
3906
+ # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
3907
+ self = zsock_new (ZMQ_SUB);
3908
+ assert (self);
3909
+ zsock_set_tcp_keepalive_intvl (self, 1);
3910
+ assert (zsock_tcp_keepalive_intvl (self) == 1);
3911
+ zsock_tcp_keepalive_intvl (self);
3912
+ zsock_destroy (&self);
3913
+ # endif
3914
+ # if defined (ZMQ_TCP_ACCEPT_FILTER)
3915
+ self = zsock_new (ZMQ_SUB);
3916
+ assert (self);
3917
+ zsock_set_tcp_accept_filter (self, "127.0.0.1");
3918
+ char *tcp_accept_filter = zsock_tcp_accept_filter (self);
3919
+ assert (tcp_accept_filter);
3920
+ free (tcp_accept_filter);
3921
+ zsock_destroy (&self);
3922
+ # endif
3923
+ # if defined (ZMQ_RCVMORE)
3924
+ self = zsock_new (ZMQ_SUB);
3925
+ assert (self);
3926
+ zsock_rcvmore (self);
3927
+ zsock_destroy (&self);
3928
+ # endif
3929
+ # if defined (ZMQ_FD)
3930
+ self = zsock_new (ZMQ_SUB);
3931
+ assert (self);
3932
+ zsock_fd (self);
3933
+ zsock_destroy (&self);
3934
+ # endif
3935
+ # if defined (ZMQ_EVENTS)
3936
+ self = zsock_new (ZMQ_SUB);
3937
+ assert (self);
3938
+ zsock_events (self);
3939
+ zsock_destroy (&self);
3940
+ # endif
3941
+ # if defined (ZMQ_LAST_ENDPOINT)
3942
+ self = zsock_new (ZMQ_SUB);
3943
+ assert (self);
3944
+ char *last_endpoint = zsock_last_endpoint (self);
3945
+ assert (last_endpoint);
3946
+ free (last_endpoint);
3947
+ zsock_destroy (&self);
3948
+ # endif
3949
+ #endif
3950
+
3951
+ #if (ZMQ_VERSION_MAJOR == 2)
3952
+ # if defined (ZMQ_HWM)
3953
+ self = zsock_new (ZMQ_SUB);
3954
+ assert (self);
3955
+ zsock_set_hwm (self, 1);
3956
+ assert (zsock_hwm (self) == 1);
3957
+ zsock_hwm (self);
3958
+ zsock_destroy (&self);
3959
+ # endif
3960
+ # if defined (ZMQ_SWAP)
3961
+ self = zsock_new (ZMQ_SUB);
3962
+ assert (self);
3963
+ zsock_set_swap (self, 1);
3964
+ assert (zsock_swap (self) == 1);
3965
+ zsock_swap (self);
3966
+ zsock_destroy (&self);
3967
+ # endif
3968
+ # if defined (ZMQ_AFFINITY)
3969
+ self = zsock_new (ZMQ_SUB);
3970
+ assert (self);
3971
+ zsock_set_affinity (self, 1);
3972
+ assert (zsock_affinity (self) == 1);
3973
+ zsock_affinity (self);
3974
+ zsock_destroy (&self);
3975
+ # endif
3976
+ # if defined (ZMQ_IDENTITY)
3977
+ self = zsock_new (ZMQ_SUB);
3978
+ assert (self);
3979
+ zsock_set_identity (self, "test");
3980
+ char *identity = zsock_identity (self);
3981
+ assert (identity);
3982
+ free (identity);
3983
+ zsock_destroy (&self);
3984
+ # endif
3985
+ # if defined (ZMQ_RATE)
3986
+ self = zsock_new (ZMQ_SUB);
3987
+ assert (self);
3988
+ zsock_set_rate (self, 1);
3989
+ assert (zsock_rate (self) == 1);
3990
+ zsock_rate (self);
3991
+ zsock_destroy (&self);
3992
+ # endif
3993
+ # if defined (ZMQ_RECOVERY_IVL)
3994
+ self = zsock_new (ZMQ_SUB);
3995
+ assert (self);
3996
+ zsock_set_recovery_ivl (self, 1);
3997
+ assert (zsock_recovery_ivl (self) == 1);
3998
+ zsock_recovery_ivl (self);
3999
+ zsock_destroy (&self);
4000
+ # endif
4001
+ # if defined (ZMQ_RECOVERY_IVL_MSEC)
4002
+ self = zsock_new (ZMQ_SUB);
4003
+ assert (self);
4004
+ zsock_set_recovery_ivl_msec (self, 1);
4005
+ assert (zsock_recovery_ivl_msec (self) == 1);
4006
+ zsock_recovery_ivl_msec (self);
4007
+ zsock_destroy (&self);
4008
+ # endif
4009
+ # if defined (ZMQ_MCAST_LOOP)
4010
+ self = zsock_new (ZMQ_SUB);
4011
+ assert (self);
4012
+ zsock_set_mcast_loop (self, 1);
4013
+ assert (zsock_mcast_loop (self) == 1);
4014
+ zsock_mcast_loop (self);
4015
+ zsock_destroy (&self);
4016
+ # endif
4017
+ # if (ZMQ_VERSION_MINOR == 2)
4018
+ # if defined (ZMQ_RCVTIMEO)
4019
+ self = zsock_new (ZMQ_SUB);
4020
+ assert (self);
4021
+ zsock_set_rcvtimeo (self, 1);
4022
+ assert (zsock_rcvtimeo (self) == 1);
4023
+ zsock_rcvtimeo (self);
4024
+ zsock_destroy (&self);
4025
+ # endif
4026
+ # endif
4027
+ # if (ZMQ_VERSION_MINOR == 2)
4028
+ # if defined (ZMQ_SNDTIMEO)
4029
+ self = zsock_new (ZMQ_SUB);
4030
+ assert (self);
4031
+ zsock_set_sndtimeo (self, 1);
4032
+ assert (zsock_sndtimeo (self) == 1);
4033
+ zsock_sndtimeo (self);
4034
+ zsock_destroy (&self);
4035
+ # endif
4036
+ # endif
4037
+ # if defined (ZMQ_SNDBUF)
4038
+ self = zsock_new (ZMQ_SUB);
4039
+ assert (self);
4040
+ zsock_set_sndbuf (self, 1);
4041
+ assert (zsock_sndbuf (self) == 1);
4042
+ zsock_sndbuf (self);
4043
+ zsock_destroy (&self);
4044
+ # endif
4045
+ # if defined (ZMQ_RCVBUF)
4046
+ self = zsock_new (ZMQ_SUB);
4047
+ assert (self);
4048
+ zsock_set_rcvbuf (self, 1);
4049
+ assert (zsock_rcvbuf (self) == 1);
4050
+ zsock_rcvbuf (self);
4051
+ zsock_destroy (&self);
4052
+ # endif
4053
+ # if defined (ZMQ_LINGER)
4054
+ self = zsock_new (ZMQ_SUB);
4055
+ assert (self);
4056
+ zsock_set_linger (self, 1);
4057
+ assert (zsock_linger (self) == 1);
4058
+ zsock_linger (self);
4059
+ zsock_destroy (&self);
4060
+ # endif
4061
+ # if defined (ZMQ_RECONNECT_IVL)
4062
+ self = zsock_new (ZMQ_SUB);
4063
+ assert (self);
4064
+ zsock_set_reconnect_ivl (self, 1);
4065
+ assert (zsock_reconnect_ivl (self) == 1);
4066
+ zsock_reconnect_ivl (self);
4067
+ zsock_destroy (&self);
4068
+ # endif
4069
+ # if defined (ZMQ_RECONNECT_IVL_MAX)
4070
+ self = zsock_new (ZMQ_SUB);
4071
+ assert (self);
4072
+ zsock_set_reconnect_ivl_max (self, 1);
4073
+ assert (zsock_reconnect_ivl_max (self) == 1);
4074
+ zsock_reconnect_ivl_max (self);
4075
+ zsock_destroy (&self);
4076
+ # endif
4077
+ # if defined (ZMQ_BACKLOG)
4078
+ self = zsock_new (ZMQ_SUB);
4079
+ assert (self);
4080
+ zsock_set_backlog (self, 1);
4081
+ assert (zsock_backlog (self) == 1);
4082
+ zsock_backlog (self);
4083
+ zsock_destroy (&self);
4084
+ # endif
4085
+ # if defined (ZMQ_SUBSCRIBE)
4086
+ self = zsock_new (ZMQ_SUB);
4087
+ assert (self);
4088
+ zsock_set_subscribe (self, "test");
4089
+ zsock_destroy (&self);
4090
+ # endif
4091
+ # if defined (ZMQ_UNSUBSCRIBE)
4092
+ self = zsock_new (ZMQ_SUB);
4093
+ assert (self);
4094
+ zsock_set_unsubscribe (self, "test");
4095
+ zsock_destroy (&self);
4096
+ # endif
4097
+ # if defined (ZMQ_TYPE)
4098
+ self = zsock_new (ZMQ_SUB);
4099
+ assert (self);
4100
+ zsock_type (self);
4101
+ zsock_destroy (&self);
4102
+ # endif
4103
+ # if defined (ZMQ_RCVMORE)
4104
+ self = zsock_new (ZMQ_SUB);
4105
+ assert (self);
4106
+ zsock_rcvmore (self);
4107
+ zsock_destroy (&self);
4108
+ # endif
4109
+ # if defined (ZMQ_FD)
4110
+ self = zsock_new (ZMQ_SUB);
4111
+ assert (self);
4112
+ zsock_fd (self);
4113
+ zsock_destroy (&self);
4114
+ # endif
4115
+ # if defined (ZMQ_EVENTS)
4116
+ self = zsock_new (ZMQ_SUB);
4117
+ assert (self);
4118
+ zsock_events (self);
4119
+ zsock_destroy (&self);
4120
+ # endif
4121
+ #endif
4122
+
4123
+ // @end
4124
+
4125
+ printf ("OK\n");
4126
+ }