czmq-ffi-gen 0.12.0-x64-mingw32 → 0.13.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,7 +19,8 @@
19
19
  =========================================================================
20
20
  */
21
21
 
22
- #if (ZMQ_VERSION_MAJOR == 4)
22
+ #if (ZMQ_VERSION_MAJOR >= 4)
23
+ # if (ZMQ_VERSION_MINOR >= 2)
23
24
  // --------------------------------------------------------------------------
24
25
  // Set socket ZMQ_HEARTBEAT_IVL value
25
26
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -29,6 +30,13 @@ zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl)
29
30
  {
30
31
  assert (self);
31
32
  # if defined (ZMQ_HEARTBEAT_IVL)
33
+ int major, minor, patch;
34
+ zmq_version (&major, &minor, &patch);
35
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
36
+ zsys_error ("zsock heartbeat_ivl option not supported by libzmq version %d.%d.%d, "
37
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
38
+ return;
39
+ }
32
40
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_IVL, &heartbeat_ivl, sizeof (int));
33
41
  assert (rc == 0 || zmq_errno () == ETERM);
34
42
  # endif
@@ -44,6 +52,13 @@ zsock_heartbeat_ivl (void *self)
44
52
  {
45
53
  assert (self);
46
54
  # if defined (ZMQ_HEARTBEAT_IVL)
55
+ int major, minor, patch;
56
+ zmq_version (&major, &minor, &patch);
57
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
58
+ zsys_error ("zsock heartbeat_ivl option not supported by libzmq version %d.%d.%d, "
59
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
60
+ return 0;
61
+ }
47
62
  int heartbeat_ivl;
48
63
  size_t option_len = sizeof (int);
49
64
  zmq_getsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_IVL, &heartbeat_ivl, &option_len);
@@ -62,6 +77,13 @@ zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl)
62
77
  {
63
78
  assert (self);
64
79
  # if defined (ZMQ_HEARTBEAT_TTL)
80
+ int major, minor, patch;
81
+ zmq_version (&major, &minor, &patch);
82
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
83
+ zsys_error ("zsock heartbeat_ttl option not supported by libzmq version %d.%d.%d, "
84
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
85
+ return;
86
+ }
65
87
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_TTL, &heartbeat_ttl, sizeof (int));
66
88
  assert (rc == 0 || zmq_errno () == ETERM);
67
89
  # endif
@@ -77,6 +99,13 @@ zsock_heartbeat_ttl (void *self)
77
99
  {
78
100
  assert (self);
79
101
  # if defined (ZMQ_HEARTBEAT_TTL)
102
+ int major, minor, patch;
103
+ zmq_version (&major, &minor, &patch);
104
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
105
+ zsys_error ("zsock heartbeat_ttl option not supported by libzmq version %d.%d.%d, "
106
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
107
+ return 0;
108
+ }
80
109
  int heartbeat_ttl;
81
110
  size_t option_len = sizeof (int);
82
111
  zmq_getsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_TTL, &heartbeat_ttl, &option_len);
@@ -95,6 +124,13 @@ zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout)
95
124
  {
96
125
  assert (self);
97
126
  # if defined (ZMQ_HEARTBEAT_TIMEOUT)
127
+ int major, minor, patch;
128
+ zmq_version (&major, &minor, &patch);
129
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
130
+ zsys_error ("zsock heartbeat_timeout option not supported by libzmq version %d.%d.%d, "
131
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
132
+ return;
133
+ }
98
134
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_TIMEOUT, &heartbeat_timeout, sizeof (int));
99
135
  assert (rc == 0 || zmq_errno () == ETERM);
100
136
  # endif
@@ -110,6 +146,13 @@ zsock_heartbeat_timeout (void *self)
110
146
  {
111
147
  assert (self);
112
148
  # if defined (ZMQ_HEARTBEAT_TIMEOUT)
149
+ int major, minor, patch;
150
+ zmq_version (&major, &minor, &patch);
151
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
152
+ zsys_error ("zsock heartbeat_timeout option not supported by libzmq version %d.%d.%d, "
153
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
154
+ return 0;
155
+ }
113
156
  int heartbeat_timeout;
114
157
  size_t option_len = sizeof (int);
115
158
  zmq_getsockopt (zsock_resolve (self), ZMQ_HEARTBEAT_TIMEOUT, &heartbeat_timeout, &option_len);
@@ -128,6 +171,13 @@ zsock_set_use_fd (void *self, int use_fd)
128
171
  {
129
172
  assert (self);
130
173
  # if defined (ZMQ_USE_FD)
174
+ int major, minor, patch;
175
+ zmq_version (&major, &minor, &patch);
176
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
177
+ zsys_error ("zsock use_fd option not supported by libzmq version %d.%d.%d, "
178
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
179
+ return;
180
+ }
131
181
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_USE_FD, &use_fd, sizeof (int));
132
182
  assert (rc == 0 || zmq_errno () == ETERM);
133
183
  # endif
@@ -143,6 +193,13 @@ zsock_use_fd (void *self)
143
193
  {
144
194
  assert (self);
145
195
  # if defined (ZMQ_USE_FD)
196
+ int major, minor, patch;
197
+ zmq_version (&major, &minor, &patch);
198
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
199
+ zsys_error ("zsock use_fd option not supported by libzmq version %d.%d.%d, "
200
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
201
+ return 0;
202
+ }
146
203
  int use_fd;
147
204
  size_t option_len = sizeof (int);
148
205
  zmq_getsockopt (zsock_resolve (self), ZMQ_USE_FD, &use_fd, &option_len);
@@ -161,6 +218,13 @@ zsock_set_xpub_manual (void *self, int xpub_manual)
161
218
  {
162
219
  assert (self);
163
220
  # if defined (ZMQ_XPUB_MANUAL)
221
+ int major, minor, patch;
222
+ zmq_version (&major, &minor, &patch);
223
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
224
+ zsys_error ("zsock xpub_manual option not supported by libzmq version %d.%d.%d, "
225
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
226
+ return;
227
+ }
164
228
  if (zsock_type (self) != ZMQ_XPUB) {
165
229
  printf ("ZMQ_XPUB_MANUAL is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
166
230
  assert (false);
@@ -180,6 +244,13 @@ zsock_set_xpub_welcome_msg (void *self, const char * xpub_welcome_msg)
180
244
  {
181
245
  assert (self);
182
246
  # if defined (ZMQ_XPUB_WELCOME_MSG)
247
+ int major, minor, patch;
248
+ zmq_version (&major, &minor, &patch);
249
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
250
+ zsys_error ("zsock xpub_welcome_msg option not supported by libzmq version %d.%d.%d, "
251
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
252
+ return;
253
+ }
183
254
  if (zsock_type (self) != ZMQ_XPUB) {
184
255
  printf ("ZMQ_XPUB_WELCOME_MSG is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
185
256
  assert (false);
@@ -199,6 +270,13 @@ zsock_set_stream_notify (void *self, int stream_notify)
199
270
  {
200
271
  assert (self);
201
272
  # if defined (ZMQ_STREAM_NOTIFY)
273
+ int major, minor, patch;
274
+ zmq_version (&major, &minor, &patch);
275
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
276
+ zsys_error ("zsock stream_notify option not supported by libzmq version %d.%d.%d, "
277
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
278
+ return;
279
+ }
202
280
  if (zsock_type (self) != ZMQ_STREAM) {
203
281
  printf ("ZMQ_STREAM_NOTIFY is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
204
282
  assert (false);
@@ -218,6 +296,13 @@ zsock_set_invert_matching (void *self, int invert_matching)
218
296
  {
219
297
  assert (self);
220
298
  # if defined (ZMQ_INVERT_MATCHING)
299
+ int major, minor, patch;
300
+ zmq_version (&major, &minor, &patch);
301
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
302
+ zsys_error ("zsock invert_matching option not supported by libzmq version %d.%d.%d, "
303
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
304
+ return;
305
+ }
221
306
  if (zsock_type (self) != ZMQ_XPUB
222
307
  && zsock_type (self) != ZMQ_PUB
223
308
  && zsock_type (self) != ZMQ_SUB) {
@@ -239,6 +324,13 @@ zsock_invert_matching (void *self)
239
324
  {
240
325
  assert (self);
241
326
  # if defined (ZMQ_INVERT_MATCHING)
327
+ int major, minor, patch;
328
+ zmq_version (&major, &minor, &patch);
329
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
330
+ zsys_error ("zsock invert_matching option not supported by libzmq version %d.%d.%d, "
331
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
332
+ return 0;
333
+ }
242
334
  int invert_matching;
243
335
  size_t option_len = sizeof (int);
244
336
  zmq_getsockopt (zsock_resolve (self), ZMQ_INVERT_MATCHING, &invert_matching, &option_len);
@@ -257,6 +349,13 @@ zsock_set_xpub_verboser (void *self, int xpub_verboser)
257
349
  {
258
350
  assert (self);
259
351
  # if defined (ZMQ_XPUB_VERBOSER)
352
+ int major, minor, patch;
353
+ zmq_version (&major, &minor, &patch);
354
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
355
+ zsys_error ("zsock xpub_verboser option not supported by libzmq version %d.%d.%d, "
356
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
357
+ return;
358
+ }
260
359
  if (zsock_type (self) != ZMQ_XPUB) {
261
360
  printf ("ZMQ_XPUB_VERBOSER is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
262
361
  assert (false);
@@ -276,6 +375,13 @@ zsock_set_connect_timeout (void *self, int connect_timeout)
276
375
  {
277
376
  assert (self);
278
377
  # if defined (ZMQ_CONNECT_TIMEOUT)
378
+ int major, minor, patch;
379
+ zmq_version (&major, &minor, &patch);
380
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
381
+ zsys_error ("zsock connect_timeout option not supported by libzmq version %d.%d.%d, "
382
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
383
+ return;
384
+ }
279
385
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CONNECT_TIMEOUT, &connect_timeout, sizeof (int));
280
386
  assert (rc == 0 || zmq_errno () == ETERM);
281
387
  # endif
@@ -291,6 +397,13 @@ zsock_connect_timeout (void *self)
291
397
  {
292
398
  assert (self);
293
399
  # if defined (ZMQ_CONNECT_TIMEOUT)
400
+ int major, minor, patch;
401
+ zmq_version (&major, &minor, &patch);
402
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
403
+ zsys_error ("zsock connect_timeout option not supported by libzmq version %d.%d.%d, "
404
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
405
+ return 0;
406
+ }
294
407
  int connect_timeout;
295
408
  size_t option_len = sizeof (int);
296
409
  zmq_getsockopt (zsock_resolve (self), ZMQ_CONNECT_TIMEOUT, &connect_timeout, &option_len);
@@ -309,6 +422,13 @@ zsock_set_tcp_maxrt (void *self, int tcp_maxrt)
309
422
  {
310
423
  assert (self);
311
424
  # if defined (ZMQ_TCP_MAXRT)
425
+ int major, minor, patch;
426
+ zmq_version (&major, &minor, &patch);
427
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
428
+ zsys_error ("zsock tcp_maxrt option not supported by libzmq version %d.%d.%d, "
429
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
430
+ return;
431
+ }
312
432
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_MAXRT, &tcp_maxrt, sizeof (int));
313
433
  assert (rc == 0 || zmq_errno () == ETERM);
314
434
  # endif
@@ -324,6 +444,13 @@ zsock_tcp_maxrt (void *self)
324
444
  {
325
445
  assert (self);
326
446
  # if defined (ZMQ_TCP_MAXRT)
447
+ int major, minor, patch;
448
+ zmq_version (&major, &minor, &patch);
449
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
450
+ zsys_error ("zsock tcp_maxrt option not supported by libzmq version %d.%d.%d, "
451
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
452
+ return 0;
453
+ }
327
454
  int tcp_maxrt;
328
455
  size_t option_len = sizeof (int);
329
456
  zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_MAXRT, &tcp_maxrt, &option_len);
@@ -342,6 +469,13 @@ zsock_thread_safe (void *self)
342
469
  {
343
470
  assert (self);
344
471
  # if defined (ZMQ_THREAD_SAFE)
472
+ int major, minor, patch;
473
+ zmq_version (&major, &minor, &patch);
474
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
475
+ zsys_error ("zsock thread_safe option not supported by libzmq version %d.%d.%d, "
476
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
477
+ return 0;
478
+ }
345
479
  int thread_safe;
346
480
  size_t option_len = sizeof (int);
347
481
  zmq_getsockopt (zsock_resolve (self), ZMQ_THREAD_SAFE, &thread_safe, &option_len);
@@ -360,6 +494,13 @@ zsock_set_multicast_maxtpdu (void *self, int multicast_maxtpdu)
360
494
  {
361
495
  assert (self);
362
496
  # if defined (ZMQ_MULTICAST_MAXTPDU)
497
+ int major, minor, patch;
498
+ zmq_version (&major, &minor, &patch);
499
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
500
+ zsys_error ("zsock multicast_maxtpdu option not supported by libzmq version %d.%d.%d, "
501
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
502
+ return;
503
+ }
363
504
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MULTICAST_MAXTPDU, &multicast_maxtpdu, sizeof (int));
364
505
  assert (rc == 0 || zmq_errno () == ETERM);
365
506
  # endif
@@ -375,6 +516,13 @@ zsock_multicast_maxtpdu (void *self)
375
516
  {
376
517
  assert (self);
377
518
  # if defined (ZMQ_MULTICAST_MAXTPDU)
519
+ int major, minor, patch;
520
+ zmq_version (&major, &minor, &patch);
521
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
522
+ zsys_error ("zsock multicast_maxtpdu option not supported by libzmq version %d.%d.%d, "
523
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
524
+ return 0;
525
+ }
378
526
  int multicast_maxtpdu;
379
527
  size_t option_len = sizeof (int);
380
528
  zmq_getsockopt (zsock_resolve (self), ZMQ_MULTICAST_MAXTPDU, &multicast_maxtpdu, &option_len);
@@ -393,6 +541,13 @@ zsock_set_vmci_buffer_size (void *self, int vmci_buffer_size)
393
541
  {
394
542
  assert (self);
395
543
  # if defined (ZMQ_VMCI_BUFFER_SIZE)
544
+ int major, minor, patch;
545
+ zmq_version (&major, &minor, &patch);
546
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
547
+ zsys_error ("zsock vmci_buffer_size option not supported by libzmq version %d.%d.%d, "
548
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
549
+ return;
550
+ }
396
551
  uint64_t value = vmci_buffer_size;
397
552
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_VMCI_BUFFER_SIZE, &value, sizeof (uint64_t));
398
553
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -409,6 +564,13 @@ zsock_vmci_buffer_size (void *self)
409
564
  {
410
565
  assert (self);
411
566
  # if defined (ZMQ_VMCI_BUFFER_SIZE)
567
+ int major, minor, patch;
568
+ zmq_version (&major, &minor, &patch);
569
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
570
+ zsys_error ("zsock vmci_buffer_size option not supported by libzmq version %d.%d.%d, "
571
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
572
+ return 0;
573
+ }
412
574
  uint64_t vmci_buffer_size;
413
575
  size_t option_len = sizeof (uint64_t);
414
576
  zmq_getsockopt (zsock_resolve (self), ZMQ_VMCI_BUFFER_SIZE, &vmci_buffer_size, &option_len);
@@ -427,6 +589,13 @@ zsock_set_vmci_buffer_min_size (void *self, int vmci_buffer_min_size)
427
589
  {
428
590
  assert (self);
429
591
  # if defined (ZMQ_VMCI_BUFFER_MIN_SIZE)
592
+ int major, minor, patch;
593
+ zmq_version (&major, &minor, &patch);
594
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
595
+ zsys_error ("zsock vmci_buffer_min_size option not supported by libzmq version %d.%d.%d, "
596
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
597
+ return;
598
+ }
430
599
  uint64_t value = vmci_buffer_min_size;
431
600
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_VMCI_BUFFER_MIN_SIZE, &value, sizeof (uint64_t));
432
601
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -443,6 +612,13 @@ zsock_vmci_buffer_min_size (void *self)
443
612
  {
444
613
  assert (self);
445
614
  # if defined (ZMQ_VMCI_BUFFER_MIN_SIZE)
615
+ int major, minor, patch;
616
+ zmq_version (&major, &minor, &patch);
617
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
618
+ zsys_error ("zsock vmci_buffer_min_size option not supported by libzmq version %d.%d.%d, "
619
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
620
+ return 0;
621
+ }
446
622
  uint64_t vmci_buffer_min_size;
447
623
  size_t option_len = sizeof (uint64_t);
448
624
  zmq_getsockopt (zsock_resolve (self), ZMQ_VMCI_BUFFER_MIN_SIZE, &vmci_buffer_min_size, &option_len);
@@ -461,6 +637,13 @@ zsock_set_vmci_buffer_max_size (void *self, int vmci_buffer_max_size)
461
637
  {
462
638
  assert (self);
463
639
  # if defined (ZMQ_VMCI_BUFFER_MAX_SIZE)
640
+ int major, minor, patch;
641
+ zmq_version (&major, &minor, &patch);
642
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
643
+ zsys_error ("zsock vmci_buffer_max_size option not supported by libzmq version %d.%d.%d, "
644
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
645
+ return;
646
+ }
464
647
  uint64_t value = vmci_buffer_max_size;
465
648
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_VMCI_BUFFER_MAX_SIZE, &value, sizeof (uint64_t));
466
649
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -477,6 +660,13 @@ zsock_vmci_buffer_max_size (void *self)
477
660
  {
478
661
  assert (self);
479
662
  # if defined (ZMQ_VMCI_BUFFER_MAX_SIZE)
663
+ int major, minor, patch;
664
+ zmq_version (&major, &minor, &patch);
665
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
666
+ zsys_error ("zsock vmci_buffer_max_size option not supported by libzmq version %d.%d.%d, "
667
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
668
+ return 0;
669
+ }
480
670
  uint64_t vmci_buffer_max_size;
481
671
  size_t option_len = sizeof (uint64_t);
482
672
  zmq_getsockopt (zsock_resolve (self), ZMQ_VMCI_BUFFER_MAX_SIZE, &vmci_buffer_max_size, &option_len);
@@ -495,6 +685,13 @@ zsock_set_vmci_connect_timeout (void *self, int vmci_connect_timeout)
495
685
  {
496
686
  assert (self);
497
687
  # if defined (ZMQ_VMCI_CONNECT_TIMEOUT)
688
+ int major, minor, patch;
689
+ zmq_version (&major, &minor, &patch);
690
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
691
+ zsys_error ("zsock vmci_connect_timeout option not supported by libzmq version %d.%d.%d, "
692
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
693
+ return;
694
+ }
498
695
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_VMCI_CONNECT_TIMEOUT, &vmci_connect_timeout, sizeof (int));
499
696
  assert (rc == 0 || zmq_errno () == ETERM);
500
697
  # endif
@@ -510,6 +707,13 @@ zsock_vmci_connect_timeout (void *self)
510
707
  {
511
708
  assert (self);
512
709
  # if defined (ZMQ_VMCI_CONNECT_TIMEOUT)
710
+ int major, minor, patch;
711
+ zmq_version (&major, &minor, &patch);
712
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 2, 0)) {
713
+ zsys_error ("zsock vmci_connect_timeout option not supported by libzmq version %d.%d.%d, "
714
+ "run with libzmq >= 4.2.0\n", major, minor, patch, NULL);
715
+ return 0;
716
+ }
513
717
  int vmci_connect_timeout;
514
718
  size_t option_len = sizeof (int);
515
719
  zmq_getsockopt (zsock_resolve (self), ZMQ_VMCI_CONNECT_TIMEOUT, &vmci_connect_timeout, &option_len);
@@ -519,6 +723,11 @@ zsock_vmci_connect_timeout (void *self)
519
723
  # endif
520
724
  }
521
725
 
726
+ # endif
727
+ #endif
728
+
729
+ #if (ZMQ_VERSION_MAJOR >= 4)
730
+ # if (ZMQ_VERSION_MINOR >= 1)
522
731
  // --------------------------------------------------------------------------
523
732
  // Set socket ZMQ_TOS value
524
733
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -528,6 +737,13 @@ zsock_set_tos (void *self, int tos)
528
737
  {
529
738
  assert (self);
530
739
  # if defined (ZMQ_TOS)
740
+ int major, minor, patch;
741
+ zmq_version (&major, &minor, &patch);
742
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 1, 0)) {
743
+ zsys_error ("zsock tos option not supported by libzmq version %d.%d.%d, "
744
+ "run with libzmq >= 4.1.0\n", major, minor, patch, NULL);
745
+ return;
746
+ }
531
747
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TOS, &tos, sizeof (int));
532
748
  assert (rc == 0 || zmq_errno () == ETERM);
533
749
  # endif
@@ -543,6 +759,13 @@ zsock_tos (void *self)
543
759
  {
544
760
  assert (self);
545
761
  # if defined (ZMQ_TOS)
762
+ int major, minor, patch;
763
+ zmq_version (&major, &minor, &patch);
764
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 1, 0)) {
765
+ zsys_error ("zsock tos option not supported by libzmq version %d.%d.%d, "
766
+ "run with libzmq >= 4.1.0\n", major, minor, patch, NULL);
767
+ return 0;
768
+ }
546
769
  int tos;
547
770
  size_t option_len = sizeof (int);
548
771
  zmq_getsockopt (zsock_resolve (self), ZMQ_TOS, &tos, &option_len);
@@ -561,6 +784,13 @@ zsock_set_router_handover (void *self, int router_handover)
561
784
  {
562
785
  assert (self);
563
786
  # if defined (ZMQ_ROUTER_HANDOVER)
787
+ int major, minor, patch;
788
+ zmq_version (&major, &minor, &patch);
789
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 1, 0)) {
790
+ zsys_error ("zsock router_handover option not supported by libzmq version %d.%d.%d, "
791
+ "run with libzmq >= 4.1.0\n", major, minor, patch, NULL);
792
+ return;
793
+ }
564
794
  if (zsock_type (self) != ZMQ_ROUTER) {
565
795
  printf ("ZMQ_ROUTER_HANDOVER is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
566
796
  assert (false);
@@ -580,6 +810,13 @@ zsock_set_connect_rid (void *self, const char * connect_rid)
580
810
  {
581
811
  assert (self);
582
812
  # if defined (ZMQ_CONNECT_RID)
813
+ int major, minor, patch;
814
+ zmq_version (&major, &minor, &patch);
815
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 1, 0)) {
816
+ zsys_error ("zsock connect_rid option not supported by libzmq version %d.%d.%d, "
817
+ "run with libzmq >= 4.1.0\n", major, minor, patch, NULL);
818
+ return;
819
+ }
583
820
  if (zsock_type (self) != ZMQ_ROUTER
584
821
  && zsock_type (self) != ZMQ_STREAM) {
585
822
  printf ("ZMQ_CONNECT_RID is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
@@ -599,6 +836,13 @@ void
599
836
  zsock_set_connect_rid_bin (void *self, const byte *connect_rid)
600
837
  {
601
838
  # if defined (ZMQ_CONNECT_RID)
839
+ int major, minor, patch;
840
+ zmq_version (&major, &minor, &patch);
841
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 1, 0)) {
842
+ zsys_error ("zsock connect_rid option not supported by libzmq version %d.%d.%d, "
843
+ "run with libzmq >= 4.1.0\n", major, minor, patch, NULL);
844
+ return;
845
+ }
602
846
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CONNECT_RID, connect_rid, 32);
603
847
  assert (rc == 0 || zmq_errno () == ETERM);
604
848
  # endif
@@ -614,6 +858,13 @@ zsock_set_handshake_ivl (void *self, int handshake_ivl)
614
858
  {
615
859
  assert (self);
616
860
  # if defined (ZMQ_HANDSHAKE_IVL)
861
+ int major, minor, patch;
862
+ zmq_version (&major, &minor, &patch);
863
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 1, 0)) {
864
+ zsys_error ("zsock handshake_ivl option not supported by libzmq version %d.%d.%d, "
865
+ "run with libzmq >= 4.1.0\n", major, minor, patch, NULL);
866
+ return;
867
+ }
617
868
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_HANDSHAKE_IVL, &handshake_ivl, sizeof (int));
618
869
  assert (rc == 0 || zmq_errno () == ETERM);
619
870
  # endif
@@ -629,6 +880,13 @@ zsock_handshake_ivl (void *self)
629
880
  {
630
881
  assert (self);
631
882
  # if defined (ZMQ_HANDSHAKE_IVL)
883
+ int major, minor, patch;
884
+ zmq_version (&major, &minor, &patch);
885
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 1, 0)) {
886
+ zsys_error ("zsock handshake_ivl option not supported by libzmq version %d.%d.%d, "
887
+ "run with libzmq >= 4.1.0\n", major, minor, patch, NULL);
888
+ return 0;
889
+ }
632
890
  int handshake_ivl;
633
891
  size_t option_len = sizeof (int);
634
892
  zmq_getsockopt (zsock_resolve (self), ZMQ_HANDSHAKE_IVL, &handshake_ivl, &option_len);
@@ -647,6 +905,13 @@ zsock_set_socks_proxy (void *self, const char * socks_proxy)
647
905
  {
648
906
  assert (self);
649
907
  # if defined (ZMQ_SOCKS_PROXY)
908
+ int major, minor, patch;
909
+ zmq_version (&major, &minor, &patch);
910
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 1, 0)) {
911
+ zsys_error ("zsock socks_proxy option not supported by libzmq version %d.%d.%d, "
912
+ "run with libzmq >= 4.1.0\n", major, minor, patch, NULL);
913
+ return;
914
+ }
650
915
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SOCKS_PROXY, socks_proxy, strlen (socks_proxy));
651
916
  assert (rc == 0 || zmq_errno () == ETERM);
652
917
  # endif
@@ -662,6 +927,13 @@ zsock_socks_proxy (void *self)
662
927
  {
663
928
  assert (self);
664
929
  # if defined (ZMQ_SOCKS_PROXY)
930
+ int major, minor, patch;
931
+ zmq_version (&major, &minor, &patch);
932
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 1, 0)) {
933
+ zsys_error ("zsock socks_proxy option not supported by libzmq version %d.%d.%d, "
934
+ "run with libzmq >= 4.1.0\n", major, minor, patch, NULL);
935
+ return 0;
936
+ }
665
937
  size_t option_len = 255;
666
938
  char *socks_proxy = (char *) zmalloc (option_len);
667
939
  zmq_getsockopt (zsock_resolve (self), ZMQ_SOCKS_PROXY, socks_proxy, &option_len);
@@ -680,6 +952,13 @@ zsock_set_xpub_nodrop (void *self, int xpub_nodrop)
680
952
  {
681
953
  assert (self);
682
954
  # if defined (ZMQ_XPUB_NODROP)
955
+ int major, minor, patch;
956
+ zmq_version (&major, &minor, &patch);
957
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 1, 0)) {
958
+ zsys_error ("zsock xpub_nodrop option not supported by libzmq version %d.%d.%d, "
959
+ "run with libzmq >= 4.1.0\n", major, minor, patch, NULL);
960
+ return;
961
+ }
683
962
  if (zsock_type (self) != ZMQ_XPUB
684
963
  && zsock_type (self) != ZMQ_PUB) {
685
964
  printf ("ZMQ_XPUB_NODROP is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
@@ -691,6 +970,10 @@ zsock_set_xpub_nodrop (void *self, int xpub_nodrop)
691
970
  }
692
971
 
693
972
 
973
+ # endif
974
+ #endif
975
+
976
+ #if (ZMQ_VERSION_MAJOR >= 4)
694
977
  // --------------------------------------------------------------------------
695
978
  // Set socket ZMQ_ROUTER_MANDATORY value
696
979
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -700,6 +983,13 @@ zsock_set_router_mandatory (void *self, int router_mandatory)
700
983
  {
701
984
  assert (self);
702
985
  # if defined (ZMQ_ROUTER_MANDATORY)
986
+ int major, minor, patch;
987
+ zmq_version (&major, &minor, &patch);
988
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
989
+ zsys_error ("zsock router_mandatory option not supported by libzmq version %d.%d.%d, "
990
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
991
+ return;
992
+ }
703
993
  if (zsock_type (self) != ZMQ_ROUTER) {
704
994
  printf ("ZMQ_ROUTER_MANDATORY is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
705
995
  assert (false);
@@ -719,6 +1009,13 @@ zsock_set_probe_router (void *self, int probe_router)
719
1009
  {
720
1010
  assert (self);
721
1011
  # if defined (ZMQ_PROBE_ROUTER)
1012
+ int major, minor, patch;
1013
+ zmq_version (&major, &minor, &patch);
1014
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1015
+ zsys_error ("zsock probe_router option not supported by libzmq version %d.%d.%d, "
1016
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1017
+ return;
1018
+ }
722
1019
  if (zsock_type (self) != ZMQ_ROUTER
723
1020
  && zsock_type (self) != ZMQ_DEALER
724
1021
  && zsock_type (self) != ZMQ_REQ) {
@@ -740,6 +1037,13 @@ zsock_set_req_relaxed (void *self, int req_relaxed)
740
1037
  {
741
1038
  assert (self);
742
1039
  # if defined (ZMQ_REQ_RELAXED)
1040
+ int major, minor, patch;
1041
+ zmq_version (&major, &minor, &patch);
1042
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1043
+ zsys_error ("zsock req_relaxed option not supported by libzmq version %d.%d.%d, "
1044
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1045
+ return;
1046
+ }
743
1047
  if (zsock_type (self) != ZMQ_REQ) {
744
1048
  printf ("ZMQ_REQ_RELAXED is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
745
1049
  assert (false);
@@ -759,6 +1063,13 @@ zsock_set_req_correlate (void *self, int req_correlate)
759
1063
  {
760
1064
  assert (self);
761
1065
  # if defined (ZMQ_REQ_CORRELATE)
1066
+ int major, minor, patch;
1067
+ zmq_version (&major, &minor, &patch);
1068
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1069
+ zsys_error ("zsock req_correlate option not supported by libzmq version %d.%d.%d, "
1070
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1071
+ return;
1072
+ }
762
1073
  if (zsock_type (self) != ZMQ_REQ) {
763
1074
  printf ("ZMQ_REQ_CORRELATE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
764
1075
  assert (false);
@@ -778,6 +1089,13 @@ zsock_set_conflate (void *self, int conflate)
778
1089
  {
779
1090
  assert (self);
780
1091
  # if defined (ZMQ_CONFLATE)
1092
+ int major, minor, patch;
1093
+ zmq_version (&major, &minor, &patch);
1094
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1095
+ zsys_error ("zsock conflate option not supported by libzmq version %d.%d.%d, "
1096
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1097
+ return;
1098
+ }
781
1099
  if (zsock_type (self) != ZMQ_PUSH
782
1100
  && zsock_type (self) != ZMQ_PULL
783
1101
  && zsock_type (self) != ZMQ_PUB
@@ -801,6 +1119,13 @@ zsock_set_zap_domain (void *self, const char * zap_domain)
801
1119
  {
802
1120
  assert (self);
803
1121
  # if defined (ZMQ_ZAP_DOMAIN)
1122
+ int major, minor, patch;
1123
+ zmq_version (&major, &minor, &patch);
1124
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1125
+ zsys_error ("zsock zap_domain option not supported by libzmq version %d.%d.%d, "
1126
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1127
+ return;
1128
+ }
804
1129
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_ZAP_DOMAIN, zap_domain, strlen (zap_domain));
805
1130
  assert (rc == 0 || zmq_errno () == ETERM);
806
1131
  # endif
@@ -816,6 +1141,13 @@ zsock_zap_domain (void *self)
816
1141
  {
817
1142
  assert (self);
818
1143
  # if defined (ZMQ_ZAP_DOMAIN)
1144
+ int major, minor, patch;
1145
+ zmq_version (&major, &minor, &patch);
1146
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1147
+ zsys_error ("zsock zap_domain option not supported by libzmq version %d.%d.%d, "
1148
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1149
+ return 0;
1150
+ }
819
1151
  size_t option_len = 255;
820
1152
  char *zap_domain = (char *) zmalloc (option_len);
821
1153
  zmq_getsockopt (zsock_resolve (self), ZMQ_ZAP_DOMAIN, zap_domain, &option_len);
@@ -834,6 +1166,13 @@ zsock_mechanism (void *self)
834
1166
  {
835
1167
  assert (self);
836
1168
  # if defined (ZMQ_MECHANISM)
1169
+ int major, minor, patch;
1170
+ zmq_version (&major, &minor, &patch);
1171
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1172
+ zsys_error ("zsock mechanism option not supported by libzmq version %d.%d.%d, "
1173
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1174
+ return 0;
1175
+ }
837
1176
  int mechanism;
838
1177
  size_t option_len = sizeof (int);
839
1178
  zmq_getsockopt (zsock_resolve (self), ZMQ_MECHANISM, &mechanism, &option_len);
@@ -852,6 +1191,13 @@ zsock_set_plain_server (void *self, int plain_server)
852
1191
  {
853
1192
  assert (self);
854
1193
  # if defined (ZMQ_PLAIN_SERVER)
1194
+ int major, minor, patch;
1195
+ zmq_version (&major, &minor, &patch);
1196
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1197
+ zsys_error ("zsock plain_server option not supported by libzmq version %d.%d.%d, "
1198
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1199
+ return;
1200
+ }
855
1201
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_PLAIN_SERVER, &plain_server, sizeof (int));
856
1202
  assert (rc == 0 || zmq_errno () == ETERM);
857
1203
  # endif
@@ -867,6 +1213,13 @@ zsock_plain_server (void *self)
867
1213
  {
868
1214
  assert (self);
869
1215
  # if defined (ZMQ_PLAIN_SERVER)
1216
+ int major, minor, patch;
1217
+ zmq_version (&major, &minor, &patch);
1218
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1219
+ zsys_error ("zsock plain_server option not supported by libzmq version %d.%d.%d, "
1220
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1221
+ return 0;
1222
+ }
870
1223
  int plain_server;
871
1224
  size_t option_len = sizeof (int);
872
1225
  zmq_getsockopt (zsock_resolve (self), ZMQ_PLAIN_SERVER, &plain_server, &option_len);
@@ -885,6 +1238,13 @@ zsock_set_plain_username (void *self, const char * plain_username)
885
1238
  {
886
1239
  assert (self);
887
1240
  # if defined (ZMQ_PLAIN_USERNAME)
1241
+ int major, minor, patch;
1242
+ zmq_version (&major, &minor, &patch);
1243
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1244
+ zsys_error ("zsock plain_username option not supported by libzmq version %d.%d.%d, "
1245
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1246
+ return;
1247
+ }
888
1248
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_PLAIN_USERNAME, plain_username, strlen (plain_username));
889
1249
  assert (rc == 0 || zmq_errno () == ETERM);
890
1250
  # endif
@@ -900,6 +1260,13 @@ zsock_plain_username (void *self)
900
1260
  {
901
1261
  assert (self);
902
1262
  # if defined (ZMQ_PLAIN_USERNAME)
1263
+ int major, minor, patch;
1264
+ zmq_version (&major, &minor, &patch);
1265
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1266
+ zsys_error ("zsock plain_username option not supported by libzmq version %d.%d.%d, "
1267
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1268
+ return 0;
1269
+ }
903
1270
  size_t option_len = 255;
904
1271
  char *plain_username = (char *) zmalloc (option_len);
905
1272
  zmq_getsockopt (zsock_resolve (self), ZMQ_PLAIN_USERNAME, plain_username, &option_len);
@@ -918,6 +1285,13 @@ zsock_set_plain_password (void *self, const char * plain_password)
918
1285
  {
919
1286
  assert (self);
920
1287
  # if defined (ZMQ_PLAIN_PASSWORD)
1288
+ int major, minor, patch;
1289
+ zmq_version (&major, &minor, &patch);
1290
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1291
+ zsys_error ("zsock plain_password option not supported by libzmq version %d.%d.%d, "
1292
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1293
+ return;
1294
+ }
921
1295
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_PLAIN_PASSWORD, plain_password, strlen (plain_password));
922
1296
  assert (rc == 0 || zmq_errno () == ETERM);
923
1297
  # endif
@@ -933,6 +1307,13 @@ zsock_plain_password (void *self)
933
1307
  {
934
1308
  assert (self);
935
1309
  # if defined (ZMQ_PLAIN_PASSWORD)
1310
+ int major, minor, patch;
1311
+ zmq_version (&major, &minor, &patch);
1312
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1313
+ zsys_error ("zsock plain_password option not supported by libzmq version %d.%d.%d, "
1314
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1315
+ return 0;
1316
+ }
936
1317
  size_t option_len = 255;
937
1318
  char *plain_password = (char *) zmalloc (option_len);
938
1319
  zmq_getsockopt (zsock_resolve (self), ZMQ_PLAIN_PASSWORD, plain_password, &option_len);
@@ -951,6 +1332,13 @@ zsock_set_curve_server (void *self, int curve_server)
951
1332
  {
952
1333
  assert (self);
953
1334
  # if defined (ZMQ_CURVE_SERVER)
1335
+ int major, minor, patch;
1336
+ zmq_version (&major, &minor, &patch);
1337
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1338
+ zsys_error ("zsock curve_server option not supported by libzmq version %d.%d.%d, "
1339
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1340
+ return;
1341
+ }
954
1342
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_SERVER, &curve_server, sizeof (int));
955
1343
  assert (rc == 0 || zmq_errno () == ETERM);
956
1344
  # endif
@@ -966,6 +1354,13 @@ zsock_curve_server (void *self)
966
1354
  {
967
1355
  assert (self);
968
1356
  # if defined (ZMQ_CURVE_SERVER)
1357
+ int major, minor, patch;
1358
+ zmq_version (&major, &minor, &patch);
1359
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1360
+ zsys_error ("zsock curve_server option not supported by libzmq version %d.%d.%d, "
1361
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1362
+ return 0;
1363
+ }
969
1364
  int curve_server;
970
1365
  size_t option_len = sizeof (int);
971
1366
  zmq_getsockopt (zsock_resolve (self), ZMQ_CURVE_SERVER, &curve_server, &option_len);
@@ -984,6 +1379,13 @@ zsock_set_curve_publickey (void *self, const char * curve_publickey)
984
1379
  {
985
1380
  assert (self);
986
1381
  # if defined (ZMQ_CURVE_PUBLICKEY)
1382
+ int major, minor, patch;
1383
+ zmq_version (&major, &minor, &patch);
1384
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1385
+ zsys_error ("zsock curve_publickey option not supported by libzmq version %d.%d.%d, "
1386
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1387
+ return;
1388
+ }
987
1389
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_PUBLICKEY, curve_publickey, strlen (curve_publickey));
988
1390
  assert (rc == 0 || zmq_errno () == ETERM);
989
1391
  # endif
@@ -998,6 +1400,13 @@ void
998
1400
  zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey)
999
1401
  {
1000
1402
  # if defined (ZMQ_CURVE_PUBLICKEY)
1403
+ int major, minor, patch;
1404
+ zmq_version (&major, &minor, &patch);
1405
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1406
+ zsys_error ("zsock curve_publickey option not supported by libzmq version %d.%d.%d, "
1407
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1408
+ return;
1409
+ }
1001
1410
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_PUBLICKEY, curve_publickey, 32);
1002
1411
  assert (rc == 0 || zmq_errno () == ETERM);
1003
1412
  # endif
@@ -1013,6 +1422,13 @@ zsock_curve_publickey (void *self)
1013
1422
  {
1014
1423
  assert (self);
1015
1424
  # if defined (ZMQ_CURVE_PUBLICKEY)
1425
+ int major, minor, patch;
1426
+ zmq_version (&major, &minor, &patch);
1427
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1428
+ zsys_error ("zsock curve_publickey option not supported by libzmq version %d.%d.%d, "
1429
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1430
+ return 0;
1431
+ }
1016
1432
  size_t option_len = 40 + 1; // Z85 key + terminator
1017
1433
  char *curve_publickey = (char *) zmalloc (option_len);
1018
1434
  zmq_getsockopt (zsock_resolve (self), ZMQ_CURVE_PUBLICKEY, curve_publickey, &option_len);
@@ -1031,6 +1447,13 @@ zsock_set_curve_secretkey (void *self, const char * curve_secretkey)
1031
1447
  {
1032
1448
  assert (self);
1033
1449
  # if defined (ZMQ_CURVE_SECRETKEY)
1450
+ int major, minor, patch;
1451
+ zmq_version (&major, &minor, &patch);
1452
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1453
+ zsys_error ("zsock curve_secretkey option not supported by libzmq version %d.%d.%d, "
1454
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1455
+ return;
1456
+ }
1034
1457
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_SECRETKEY, curve_secretkey, strlen (curve_secretkey));
1035
1458
  assert (rc == 0 || zmq_errno () == ETERM);
1036
1459
  # endif
@@ -1045,6 +1468,13 @@ void
1045
1468
  zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey)
1046
1469
  {
1047
1470
  # if defined (ZMQ_CURVE_SECRETKEY)
1471
+ int major, minor, patch;
1472
+ zmq_version (&major, &minor, &patch);
1473
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1474
+ zsys_error ("zsock curve_secretkey option not supported by libzmq version %d.%d.%d, "
1475
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1476
+ return;
1477
+ }
1048
1478
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_SECRETKEY, curve_secretkey, 32);
1049
1479
  assert (rc == 0 || zmq_errno () == ETERM);
1050
1480
  # endif
@@ -1060,6 +1490,13 @@ zsock_curve_secretkey (void *self)
1060
1490
  {
1061
1491
  assert (self);
1062
1492
  # if defined (ZMQ_CURVE_SECRETKEY)
1493
+ int major, minor, patch;
1494
+ zmq_version (&major, &minor, &patch);
1495
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1496
+ zsys_error ("zsock curve_secretkey option not supported by libzmq version %d.%d.%d, "
1497
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1498
+ return 0;
1499
+ }
1063
1500
  size_t option_len = 40 + 1; // Z85 key + terminator
1064
1501
  char *curve_secretkey = (char *) zmalloc (option_len);
1065
1502
  zmq_getsockopt (zsock_resolve (self), ZMQ_CURVE_SECRETKEY, curve_secretkey, &option_len);
@@ -1078,6 +1515,13 @@ zsock_set_curve_serverkey (void *self, const char * curve_serverkey)
1078
1515
  {
1079
1516
  assert (self);
1080
1517
  # if defined (ZMQ_CURVE_SERVERKEY)
1518
+ int major, minor, patch;
1519
+ zmq_version (&major, &minor, &patch);
1520
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1521
+ zsys_error ("zsock curve_serverkey option not supported by libzmq version %d.%d.%d, "
1522
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1523
+ return;
1524
+ }
1081
1525
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_SERVERKEY, curve_serverkey, strlen (curve_serverkey));
1082
1526
  assert (rc == 0 || zmq_errno () == ETERM);
1083
1527
  # endif
@@ -1092,6 +1536,13 @@ void
1092
1536
  zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey)
1093
1537
  {
1094
1538
  # if defined (ZMQ_CURVE_SERVERKEY)
1539
+ int major, minor, patch;
1540
+ zmq_version (&major, &minor, &patch);
1541
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1542
+ zsys_error ("zsock curve_serverkey option not supported by libzmq version %d.%d.%d, "
1543
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1544
+ return;
1545
+ }
1095
1546
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_CURVE_SERVERKEY, curve_serverkey, 32);
1096
1547
  assert (rc == 0 || zmq_errno () == ETERM);
1097
1548
  # endif
@@ -1107,6 +1558,13 @@ zsock_curve_serverkey (void *self)
1107
1558
  {
1108
1559
  assert (self);
1109
1560
  # if defined (ZMQ_CURVE_SERVERKEY)
1561
+ int major, minor, patch;
1562
+ zmq_version (&major, &minor, &patch);
1563
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1564
+ zsys_error ("zsock curve_serverkey option not supported by libzmq version %d.%d.%d, "
1565
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1566
+ return 0;
1567
+ }
1110
1568
  size_t option_len = 40 + 1; // Z85 key + terminator
1111
1569
  char *curve_serverkey = (char *) zmalloc (option_len);
1112
1570
  zmq_getsockopt (zsock_resolve (self), ZMQ_CURVE_SERVERKEY, curve_serverkey, &option_len);
@@ -1125,6 +1583,13 @@ zsock_set_gssapi_server (void *self, int gssapi_server)
1125
1583
  {
1126
1584
  assert (self);
1127
1585
  # if defined (ZMQ_GSSAPI_SERVER)
1586
+ int major, minor, patch;
1587
+ zmq_version (&major, &minor, &patch);
1588
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1589
+ zsys_error ("zsock gssapi_server option not supported by libzmq version %d.%d.%d, "
1590
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1591
+ return;
1592
+ }
1128
1593
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_GSSAPI_SERVER, &gssapi_server, sizeof (int));
1129
1594
  assert (rc == 0 || zmq_errno () == ETERM);
1130
1595
  # endif
@@ -1140,6 +1605,13 @@ zsock_gssapi_server (void *self)
1140
1605
  {
1141
1606
  assert (self);
1142
1607
  # if defined (ZMQ_GSSAPI_SERVER)
1608
+ int major, minor, patch;
1609
+ zmq_version (&major, &minor, &patch);
1610
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1611
+ zsys_error ("zsock gssapi_server option not supported by libzmq version %d.%d.%d, "
1612
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1613
+ return 0;
1614
+ }
1143
1615
  int gssapi_server;
1144
1616
  size_t option_len = sizeof (int);
1145
1617
  zmq_getsockopt (zsock_resolve (self), ZMQ_GSSAPI_SERVER, &gssapi_server, &option_len);
@@ -1158,6 +1630,13 @@ zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext)
1158
1630
  {
1159
1631
  assert (self);
1160
1632
  # if defined (ZMQ_GSSAPI_PLAINTEXT)
1633
+ int major, minor, patch;
1634
+ zmq_version (&major, &minor, &patch);
1635
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1636
+ zsys_error ("zsock gssapi_plaintext option not supported by libzmq version %d.%d.%d, "
1637
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1638
+ return;
1639
+ }
1161
1640
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_GSSAPI_PLAINTEXT, &gssapi_plaintext, sizeof (int));
1162
1641
  assert (rc == 0 || zmq_errno () == ETERM);
1163
1642
  # endif
@@ -1173,6 +1652,13 @@ zsock_gssapi_plaintext (void *self)
1173
1652
  {
1174
1653
  assert (self);
1175
1654
  # if defined (ZMQ_GSSAPI_PLAINTEXT)
1655
+ int major, minor, patch;
1656
+ zmq_version (&major, &minor, &patch);
1657
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1658
+ zsys_error ("zsock gssapi_plaintext option not supported by libzmq version %d.%d.%d, "
1659
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1660
+ return 0;
1661
+ }
1176
1662
  int gssapi_plaintext;
1177
1663
  size_t option_len = sizeof (int);
1178
1664
  zmq_getsockopt (zsock_resolve (self), ZMQ_GSSAPI_PLAINTEXT, &gssapi_plaintext, &option_len);
@@ -1191,6 +1677,13 @@ zsock_set_gssapi_principal (void *self, const char * gssapi_principal)
1191
1677
  {
1192
1678
  assert (self);
1193
1679
  # if defined (ZMQ_GSSAPI_PRINCIPAL)
1680
+ int major, minor, patch;
1681
+ zmq_version (&major, &minor, &patch);
1682
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1683
+ zsys_error ("zsock gssapi_principal option not supported by libzmq version %d.%d.%d, "
1684
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1685
+ return;
1686
+ }
1194
1687
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_GSSAPI_PRINCIPAL, gssapi_principal, strlen (gssapi_principal));
1195
1688
  assert (rc == 0 || zmq_errno () == ETERM);
1196
1689
  # endif
@@ -1206,6 +1699,13 @@ zsock_gssapi_principal (void *self)
1206
1699
  {
1207
1700
  assert (self);
1208
1701
  # if defined (ZMQ_GSSAPI_PRINCIPAL)
1702
+ int major, minor, patch;
1703
+ zmq_version (&major, &minor, &patch);
1704
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1705
+ zsys_error ("zsock gssapi_principal option not supported by libzmq version %d.%d.%d, "
1706
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1707
+ return 0;
1708
+ }
1209
1709
  size_t option_len = 255;
1210
1710
  char *gssapi_principal = (char *) zmalloc (option_len);
1211
1711
  zmq_getsockopt (zsock_resolve (self), ZMQ_GSSAPI_PRINCIPAL, gssapi_principal, &option_len);
@@ -1224,6 +1724,13 @@ zsock_set_gssapi_service_principal (void *self, const char * gssapi_service_prin
1224
1724
  {
1225
1725
  assert (self);
1226
1726
  # if defined (ZMQ_GSSAPI_SERVICE_PRINCIPAL)
1727
+ int major, minor, patch;
1728
+ zmq_version (&major, &minor, &patch);
1729
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1730
+ zsys_error ("zsock gssapi_service_principal option not supported by libzmq version %d.%d.%d, "
1731
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1732
+ return;
1733
+ }
1227
1734
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_GSSAPI_SERVICE_PRINCIPAL, gssapi_service_principal, strlen (gssapi_service_principal));
1228
1735
  assert (rc == 0 || zmq_errno () == ETERM);
1229
1736
  # endif
@@ -1239,6 +1746,13 @@ zsock_gssapi_service_principal (void *self)
1239
1746
  {
1240
1747
  assert (self);
1241
1748
  # if defined (ZMQ_GSSAPI_SERVICE_PRINCIPAL)
1749
+ int major, minor, patch;
1750
+ zmq_version (&major, &minor, &patch);
1751
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1752
+ zsys_error ("zsock gssapi_service_principal option not supported by libzmq version %d.%d.%d, "
1753
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1754
+ return 0;
1755
+ }
1242
1756
  size_t option_len = 255;
1243
1757
  char *gssapi_service_principal = (char *) zmalloc (option_len);
1244
1758
  zmq_getsockopt (zsock_resolve (self), ZMQ_GSSAPI_SERVICE_PRINCIPAL, gssapi_service_principal, &option_len);
@@ -1257,6 +1771,13 @@ zsock_set_ipv6 (void *self, int ipv6)
1257
1771
  {
1258
1772
  assert (self);
1259
1773
  # if defined (ZMQ_IPV6)
1774
+ int major, minor, patch;
1775
+ zmq_version (&major, &minor, &patch);
1776
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1777
+ zsys_error ("zsock ipv6 option not supported by libzmq version %d.%d.%d, "
1778
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1779
+ return;
1780
+ }
1260
1781
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IPV6, &ipv6, sizeof (int));
1261
1782
  assert (rc == 0 || zmq_errno () == ETERM);
1262
1783
  # endif
@@ -1272,6 +1793,13 @@ zsock_ipv6 (void *self)
1272
1793
  {
1273
1794
  assert (self);
1274
1795
  # if defined (ZMQ_IPV6)
1796
+ int major, minor, patch;
1797
+ zmq_version (&major, &minor, &patch);
1798
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1799
+ zsys_error ("zsock ipv6 option not supported by libzmq version %d.%d.%d, "
1800
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1801
+ return 0;
1802
+ }
1275
1803
  int ipv6;
1276
1804
  size_t option_len = sizeof (int);
1277
1805
  zmq_getsockopt (zsock_resolve (self), ZMQ_IPV6, &ipv6, &option_len);
@@ -1290,6 +1818,13 @@ zsock_set_immediate (void *self, int immediate)
1290
1818
  {
1291
1819
  assert (self);
1292
1820
  # if defined (ZMQ_IMMEDIATE)
1821
+ int major, minor, patch;
1822
+ zmq_version (&major, &minor, &patch);
1823
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1824
+ zsys_error ("zsock immediate option not supported by libzmq version %d.%d.%d, "
1825
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1826
+ return;
1827
+ }
1293
1828
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IMMEDIATE, &immediate, sizeof (int));
1294
1829
  assert (rc == 0 || zmq_errno () == ETERM);
1295
1830
  # endif
@@ -1305,6 +1840,13 @@ zsock_immediate (void *self)
1305
1840
  {
1306
1841
  assert (self);
1307
1842
  # if defined (ZMQ_IMMEDIATE)
1843
+ int major, minor, patch;
1844
+ zmq_version (&major, &minor, &patch);
1845
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (4, 0, 0)) {
1846
+ zsys_error ("zsock immediate option not supported by libzmq version %d.%d.%d, "
1847
+ "run with libzmq >= 4.0.0\n", major, minor, patch, NULL);
1848
+ return 0;
1849
+ }
1308
1850
  int immediate;
1309
1851
  size_t option_len = sizeof (int);
1310
1852
  zmq_getsockopt (zsock_resolve (self), ZMQ_IMMEDIATE, &immediate, &option_len);
@@ -1314,73 +1856,9 @@ zsock_immediate (void *self)
1314
1856
  # endif
1315
1857
  }
1316
1858
 
1317
- // --------------------------------------------------------------------------
1318
- // Set socket ZMQ_ROUTER_RAW value
1319
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1320
-
1321
- void
1322
- zsock_set_router_raw (void *self, int router_raw)
1323
- {
1324
- assert (self);
1325
- # if defined (ZMQ_ROUTER_RAW)
1326
- if (zsock_type (self) != ZMQ_ROUTER) {
1327
- printf ("ZMQ_ROUTER_RAW is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1328
- assert (false);
1329
- }
1330
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_ROUTER_RAW, &router_raw, sizeof (int));
1331
- assert (rc == 0 || zmq_errno () == ETERM);
1332
- # endif
1333
- }
1334
-
1335
-
1336
- // --------------------------------------------------------------------------
1337
- // Set socket ZMQ_IPV4ONLY value
1338
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1339
-
1340
- void
1341
- zsock_set_ipv4only (void *self, int ipv4only)
1342
- {
1343
- assert (self);
1344
- # if defined (ZMQ_IPV4ONLY)
1345
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IPV4ONLY, &ipv4only, sizeof (int));
1346
- assert (rc == 0 || zmq_errno () == ETERM);
1347
- # endif
1348
- }
1349
-
1350
-
1351
- // --------------------------------------------------------------------------
1352
- // Return socket ZMQ_IPV4ONLY value
1353
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1354
-
1355
- int
1356
- zsock_ipv4only (void *self)
1357
- {
1358
- assert (self);
1359
- # if defined (ZMQ_IPV4ONLY)
1360
- int ipv4only;
1361
- size_t option_len = sizeof (int);
1362
- zmq_getsockopt (zsock_resolve (self), ZMQ_IPV4ONLY, &ipv4only, &option_len);
1363
- return ipv4only;
1364
- # else
1365
- return 0;
1366
- # endif
1367
- }
1368
-
1369
- // --------------------------------------------------------------------------
1370
- // Set socket ZMQ_DELAY_ATTACH_ON_CONNECT value
1371
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
1372
-
1373
- void
1374
- zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect)
1375
- {
1376
- assert (self);
1377
- # if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
1378
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_DELAY_ATTACH_ON_CONNECT, &delay_attach_on_connect, sizeof (int));
1379
- assert (rc == 0 || zmq_errno () == ETERM);
1380
- # endif
1381
- }
1382
-
1859
+ #endif
1383
1860
 
1861
+ #if (ZMQ_VERSION_MAJOR >= 3)
1384
1862
  // --------------------------------------------------------------------------
1385
1863
  // Return socket ZMQ_TYPE value
1386
1864
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -1390,6 +1868,13 @@ zsock_type (void *self)
1390
1868
  {
1391
1869
  assert (self);
1392
1870
  # if defined (ZMQ_TYPE)
1871
+ int major, minor, patch;
1872
+ zmq_version (&major, &minor, &patch);
1873
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
1874
+ zsys_error ("zsock type option not supported by libzmq version %d.%d.%d, "
1875
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
1876
+ return 0;
1877
+ }
1393
1878
  int type;
1394
1879
  size_t option_len = sizeof (int);
1395
1880
  zmq_getsockopt (zsock_resolve (self), ZMQ_TYPE, &type, &option_len);
@@ -1408,6 +1893,13 @@ zsock_set_sndhwm (void *self, int sndhwm)
1408
1893
  {
1409
1894
  assert (self);
1410
1895
  # if defined (ZMQ_SNDHWM)
1896
+ int major, minor, patch;
1897
+ zmq_version (&major, &minor, &patch);
1898
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
1899
+ zsys_error ("zsock sndhwm option not supported by libzmq version %d.%d.%d, "
1900
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
1901
+ return;
1902
+ }
1411
1903
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDHWM, &sndhwm, sizeof (int));
1412
1904
  assert (rc == 0 || zmq_errno () == ETERM);
1413
1905
  # endif
@@ -1423,6 +1915,13 @@ zsock_sndhwm (void *self)
1423
1915
  {
1424
1916
  assert (self);
1425
1917
  # if defined (ZMQ_SNDHWM)
1918
+ int major, minor, patch;
1919
+ zmq_version (&major, &minor, &patch);
1920
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
1921
+ zsys_error ("zsock sndhwm option not supported by libzmq version %d.%d.%d, "
1922
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
1923
+ return 0;
1924
+ }
1426
1925
  int sndhwm;
1427
1926
  size_t option_len = sizeof (int);
1428
1927
  zmq_getsockopt (zsock_resolve (self), ZMQ_SNDHWM, &sndhwm, &option_len);
@@ -1441,6 +1940,13 @@ zsock_set_rcvhwm (void *self, int rcvhwm)
1441
1940
  {
1442
1941
  assert (self);
1443
1942
  # if defined (ZMQ_RCVHWM)
1943
+ int major, minor, patch;
1944
+ zmq_version (&major, &minor, &patch);
1945
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
1946
+ zsys_error ("zsock rcvhwm option not supported by libzmq version %d.%d.%d, "
1947
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
1948
+ return;
1949
+ }
1444
1950
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVHWM, &rcvhwm, sizeof (int));
1445
1951
  assert (rc == 0 || zmq_errno () == ETERM);
1446
1952
  # endif
@@ -1456,6 +1962,13 @@ zsock_rcvhwm (void *self)
1456
1962
  {
1457
1963
  assert (self);
1458
1964
  # if defined (ZMQ_RCVHWM)
1965
+ int major, minor, patch;
1966
+ zmq_version (&major, &minor, &patch);
1967
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
1968
+ zsys_error ("zsock rcvhwm option not supported by libzmq version %d.%d.%d, "
1969
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
1970
+ return 0;
1971
+ }
1459
1972
  int rcvhwm;
1460
1973
  size_t option_len = sizeof (int);
1461
1974
  zmq_getsockopt (zsock_resolve (self), ZMQ_RCVHWM, &rcvhwm, &option_len);
@@ -1474,6 +1987,13 @@ zsock_set_affinity (void *self, int affinity)
1474
1987
  {
1475
1988
  assert (self);
1476
1989
  # if defined (ZMQ_AFFINITY)
1990
+ int major, minor, patch;
1991
+ zmq_version (&major, &minor, &patch);
1992
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
1993
+ zsys_error ("zsock affinity option not supported by libzmq version %d.%d.%d, "
1994
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
1995
+ return;
1996
+ }
1477
1997
  uint64_t value = affinity;
1478
1998
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_AFFINITY, &value, sizeof (uint64_t));
1479
1999
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -1490,6 +2010,13 @@ zsock_affinity (void *self)
1490
2010
  {
1491
2011
  assert (self);
1492
2012
  # if defined (ZMQ_AFFINITY)
2013
+ int major, minor, patch;
2014
+ zmq_version (&major, &minor, &patch);
2015
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2016
+ zsys_error ("zsock affinity option not supported by libzmq version %d.%d.%d, "
2017
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2018
+ return 0;
2019
+ }
1493
2020
  uint64_t affinity;
1494
2021
  size_t option_len = sizeof (uint64_t);
1495
2022
  zmq_getsockopt (zsock_resolve (self), ZMQ_AFFINITY, &affinity, &option_len);
@@ -1508,6 +2035,13 @@ zsock_set_subscribe (void *self, const char * subscribe)
1508
2035
  {
1509
2036
  assert (self);
1510
2037
  # if defined (ZMQ_SUBSCRIBE)
2038
+ int major, minor, patch;
2039
+ zmq_version (&major, &minor, &patch);
2040
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2041
+ zsys_error ("zsock subscribe option not supported by libzmq version %d.%d.%d, "
2042
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2043
+ return;
2044
+ }
1511
2045
  if (zsock_type (self) != ZMQ_SUB) {
1512
2046
  printf ("ZMQ_SUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1513
2047
  assert (false);
@@ -1527,6 +2061,13 @@ zsock_set_unsubscribe (void *self, const char * unsubscribe)
1527
2061
  {
1528
2062
  assert (self);
1529
2063
  # if defined (ZMQ_UNSUBSCRIBE)
2064
+ int major, minor, patch;
2065
+ zmq_version (&major, &minor, &patch);
2066
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2067
+ zsys_error ("zsock unsubscribe option not supported by libzmq version %d.%d.%d, "
2068
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2069
+ return;
2070
+ }
1530
2071
  if (zsock_type (self) != ZMQ_SUB) {
1531
2072
  printf ("ZMQ_UNSUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1532
2073
  assert (false);
@@ -1546,6 +2087,13 @@ zsock_set_identity (void *self, const char * identity)
1546
2087
  {
1547
2088
  assert (self);
1548
2089
  # if defined (ZMQ_IDENTITY)
2090
+ int major, minor, patch;
2091
+ zmq_version (&major, &minor, &patch);
2092
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2093
+ zsys_error ("zsock identity option not supported by libzmq version %d.%d.%d, "
2094
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2095
+ return;
2096
+ }
1549
2097
  if (zsock_type (self) != ZMQ_REQ
1550
2098
  && zsock_type (self) != ZMQ_REP
1551
2099
  && zsock_type (self) != ZMQ_DEALER
@@ -1568,6 +2116,13 @@ zsock_identity (void *self)
1568
2116
  {
1569
2117
  assert (self);
1570
2118
  # if defined (ZMQ_IDENTITY)
2119
+ int major, minor, patch;
2120
+ zmq_version (&major, &minor, &patch);
2121
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2122
+ zsys_error ("zsock identity option not supported by libzmq version %d.%d.%d, "
2123
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2124
+ return 0;
2125
+ }
1571
2126
  size_t option_len = 255;
1572
2127
  char *identity = (char *) zmalloc (option_len);
1573
2128
  zmq_getsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, &option_len);
@@ -1586,6 +2141,13 @@ zsock_set_rate (void *self, int rate)
1586
2141
  {
1587
2142
  assert (self);
1588
2143
  # if defined (ZMQ_RATE)
2144
+ int major, minor, patch;
2145
+ zmq_version (&major, &minor, &patch);
2146
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2147
+ zsys_error ("zsock rate option not supported by libzmq version %d.%d.%d, "
2148
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2149
+ return;
2150
+ }
1589
2151
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RATE, &rate, sizeof (int));
1590
2152
  assert (rc == 0 || zmq_errno () == ETERM);
1591
2153
  # endif
@@ -1601,6 +2163,13 @@ zsock_rate (void *self)
1601
2163
  {
1602
2164
  assert (self);
1603
2165
  # if defined (ZMQ_RATE)
2166
+ int major, minor, patch;
2167
+ zmq_version (&major, &minor, &patch);
2168
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2169
+ zsys_error ("zsock rate option not supported by libzmq version %d.%d.%d, "
2170
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2171
+ return 0;
2172
+ }
1604
2173
  int rate;
1605
2174
  size_t option_len = sizeof (int);
1606
2175
  zmq_getsockopt (zsock_resolve (self), ZMQ_RATE, &rate, &option_len);
@@ -1619,6 +2188,13 @@ zsock_set_recovery_ivl (void *self, int recovery_ivl)
1619
2188
  {
1620
2189
  assert (self);
1621
2190
  # if defined (ZMQ_RECOVERY_IVL)
2191
+ int major, minor, patch;
2192
+ zmq_version (&major, &minor, &patch);
2193
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2194
+ zsys_error ("zsock recovery_ivl option not supported by libzmq version %d.%d.%d, "
2195
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2196
+ return;
2197
+ }
1622
2198
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, sizeof (int));
1623
2199
  assert (rc == 0 || zmq_errno () == ETERM);
1624
2200
  # endif
@@ -1634,6 +2210,13 @@ zsock_recovery_ivl (void *self)
1634
2210
  {
1635
2211
  assert (self);
1636
2212
  # if defined (ZMQ_RECOVERY_IVL)
2213
+ int major, minor, patch;
2214
+ zmq_version (&major, &minor, &patch);
2215
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2216
+ zsys_error ("zsock recovery_ivl option not supported by libzmq version %d.%d.%d, "
2217
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2218
+ return 0;
2219
+ }
1637
2220
  int recovery_ivl;
1638
2221
  size_t option_len = sizeof (int);
1639
2222
  zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
@@ -1652,6 +2235,13 @@ zsock_set_sndbuf (void *self, int sndbuf)
1652
2235
  {
1653
2236
  assert (self);
1654
2237
  # if defined (ZMQ_SNDBUF)
2238
+ int major, minor, patch;
2239
+ zmq_version (&major, &minor, &patch);
2240
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2241
+ zsys_error ("zsock sndbuf option not supported by libzmq version %d.%d.%d, "
2242
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2243
+ return;
2244
+ }
1655
2245
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, sizeof (int));
1656
2246
  assert (rc == 0 || zmq_errno () == ETERM);
1657
2247
  # endif
@@ -1667,6 +2257,13 @@ zsock_sndbuf (void *self)
1667
2257
  {
1668
2258
  assert (self);
1669
2259
  # if defined (ZMQ_SNDBUF)
2260
+ int major, minor, patch;
2261
+ zmq_version (&major, &minor, &patch);
2262
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2263
+ zsys_error ("zsock sndbuf option not supported by libzmq version %d.%d.%d, "
2264
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2265
+ return 0;
2266
+ }
1670
2267
  int sndbuf;
1671
2268
  size_t option_len = sizeof (int);
1672
2269
  zmq_getsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, &option_len);
@@ -1685,6 +2282,13 @@ zsock_set_rcvbuf (void *self, int rcvbuf)
1685
2282
  {
1686
2283
  assert (self);
1687
2284
  # if defined (ZMQ_RCVBUF)
2285
+ int major, minor, patch;
2286
+ zmq_version (&major, &minor, &patch);
2287
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2288
+ zsys_error ("zsock rcvbuf option not supported by libzmq version %d.%d.%d, "
2289
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2290
+ return;
2291
+ }
1688
2292
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, sizeof (int));
1689
2293
  assert (rc == 0 || zmq_errno () == ETERM);
1690
2294
  # endif
@@ -1700,6 +2304,13 @@ zsock_rcvbuf (void *self)
1700
2304
  {
1701
2305
  assert (self);
1702
2306
  # if defined (ZMQ_RCVBUF)
2307
+ int major, minor, patch;
2308
+ zmq_version (&major, &minor, &patch);
2309
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2310
+ zsys_error ("zsock rcvbuf option not supported by libzmq version %d.%d.%d, "
2311
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2312
+ return 0;
2313
+ }
1703
2314
  int rcvbuf;
1704
2315
  size_t option_len = sizeof (int);
1705
2316
  zmq_getsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, &option_len);
@@ -1718,6 +2329,13 @@ zsock_set_linger (void *self, int linger)
1718
2329
  {
1719
2330
  assert (self);
1720
2331
  # if defined (ZMQ_LINGER)
2332
+ int major, minor, patch;
2333
+ zmq_version (&major, &minor, &patch);
2334
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2335
+ zsys_error ("zsock linger option not supported by libzmq version %d.%d.%d, "
2336
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2337
+ return;
2338
+ }
1721
2339
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, sizeof (int));
1722
2340
  assert (rc == 0 || zmq_errno () == ETERM);
1723
2341
  # endif
@@ -1733,6 +2351,13 @@ zsock_linger (void *self)
1733
2351
  {
1734
2352
  assert (self);
1735
2353
  # if defined (ZMQ_LINGER)
2354
+ int major, minor, patch;
2355
+ zmq_version (&major, &minor, &patch);
2356
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2357
+ zsys_error ("zsock linger option not supported by libzmq version %d.%d.%d, "
2358
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2359
+ return 0;
2360
+ }
1736
2361
  int linger;
1737
2362
  size_t option_len = sizeof (int);
1738
2363
  zmq_getsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, &option_len);
@@ -1751,6 +2376,13 @@ zsock_set_reconnect_ivl (void *self, int reconnect_ivl)
1751
2376
  {
1752
2377
  assert (self);
1753
2378
  # if defined (ZMQ_RECONNECT_IVL)
2379
+ int major, minor, patch;
2380
+ zmq_version (&major, &minor, &patch);
2381
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2382
+ zsys_error ("zsock reconnect_ivl option not supported by libzmq version %d.%d.%d, "
2383
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2384
+ return;
2385
+ }
1754
2386
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
1755
2387
  assert (rc == 0 || zmq_errno () == ETERM);
1756
2388
  # endif
@@ -1766,6 +2398,13 @@ zsock_reconnect_ivl (void *self)
1766
2398
  {
1767
2399
  assert (self);
1768
2400
  # if defined (ZMQ_RECONNECT_IVL)
2401
+ int major, minor, patch;
2402
+ zmq_version (&major, &minor, &patch);
2403
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2404
+ zsys_error ("zsock reconnect_ivl option not supported by libzmq version %d.%d.%d, "
2405
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2406
+ return 0;
2407
+ }
1769
2408
  int reconnect_ivl;
1770
2409
  size_t option_len = sizeof (int);
1771
2410
  zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, &option_len);
@@ -1784,6 +2423,13 @@ zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max)
1784
2423
  {
1785
2424
  assert (self);
1786
2425
  # if defined (ZMQ_RECONNECT_IVL_MAX)
2426
+ int major, minor, patch;
2427
+ zmq_version (&major, &minor, &patch);
2428
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2429
+ zsys_error ("zsock reconnect_ivl_max option not supported by libzmq version %d.%d.%d, "
2430
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2431
+ return;
2432
+ }
1787
2433
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
1788
2434
  assert (rc == 0 || zmq_errno () == ETERM);
1789
2435
  # endif
@@ -1799,6 +2445,13 @@ zsock_reconnect_ivl_max (void *self)
1799
2445
  {
1800
2446
  assert (self);
1801
2447
  # if defined (ZMQ_RECONNECT_IVL_MAX)
2448
+ int major, minor, patch;
2449
+ zmq_version (&major, &minor, &patch);
2450
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2451
+ zsys_error ("zsock reconnect_ivl_max option not supported by libzmq version %d.%d.%d, "
2452
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2453
+ return 0;
2454
+ }
1802
2455
  int reconnect_ivl_max;
1803
2456
  size_t option_len = sizeof (int);
1804
2457
  zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, &option_len);
@@ -1817,6 +2470,13 @@ zsock_set_backlog (void *self, int backlog)
1817
2470
  {
1818
2471
  assert (self);
1819
2472
  # if defined (ZMQ_BACKLOG)
2473
+ int major, minor, patch;
2474
+ zmq_version (&major, &minor, &patch);
2475
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2476
+ zsys_error ("zsock backlog option not supported by libzmq version %d.%d.%d, "
2477
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2478
+ return;
2479
+ }
1820
2480
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, sizeof (int));
1821
2481
  assert (rc == 0 || zmq_errno () == ETERM);
1822
2482
  # endif
@@ -1832,6 +2492,13 @@ zsock_backlog (void *self)
1832
2492
  {
1833
2493
  assert (self);
1834
2494
  # if defined (ZMQ_BACKLOG)
2495
+ int major, minor, patch;
2496
+ zmq_version (&major, &minor, &patch);
2497
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2498
+ zsys_error ("zsock backlog option not supported by libzmq version %d.%d.%d, "
2499
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2500
+ return 0;
2501
+ }
1835
2502
  int backlog;
1836
2503
  size_t option_len = sizeof (int);
1837
2504
  zmq_getsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, &option_len);
@@ -1850,6 +2517,13 @@ zsock_set_maxmsgsize (void *self, int maxmsgsize)
1850
2517
  {
1851
2518
  assert (self);
1852
2519
  # if defined (ZMQ_MAXMSGSIZE)
2520
+ int major, minor, patch;
2521
+ zmq_version (&major, &minor, &patch);
2522
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2523
+ zsys_error ("zsock maxmsgsize option not supported by libzmq version %d.%d.%d, "
2524
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2525
+ return;
2526
+ }
1853
2527
  int64_t value = maxmsgsize;
1854
2528
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &value, sizeof (int64_t));
1855
2529
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -1866,6 +2540,13 @@ zsock_maxmsgsize (void *self)
1866
2540
  {
1867
2541
  assert (self);
1868
2542
  # if defined (ZMQ_MAXMSGSIZE)
2543
+ int major, minor, patch;
2544
+ zmq_version (&major, &minor, &patch);
2545
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2546
+ zsys_error ("zsock maxmsgsize option not supported by libzmq version %d.%d.%d, "
2547
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2548
+ return 0;
2549
+ }
1869
2550
  int64_t maxmsgsize;
1870
2551
  size_t option_len = sizeof (int64_t);
1871
2552
  zmq_getsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &maxmsgsize, &option_len);
@@ -1884,6 +2565,13 @@ zsock_set_multicast_hops (void *self, int multicast_hops)
1884
2565
  {
1885
2566
  assert (self);
1886
2567
  # if defined (ZMQ_MULTICAST_HOPS)
2568
+ int major, minor, patch;
2569
+ zmq_version (&major, &minor, &patch);
2570
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2571
+ zsys_error ("zsock multicast_hops option not supported by libzmq version %d.%d.%d, "
2572
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2573
+ return;
2574
+ }
1887
2575
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, sizeof (int));
1888
2576
  assert (rc == 0 || zmq_errno () == ETERM);
1889
2577
  # endif
@@ -1899,6 +2587,13 @@ zsock_multicast_hops (void *self)
1899
2587
  {
1900
2588
  assert (self);
1901
2589
  # if defined (ZMQ_MULTICAST_HOPS)
2590
+ int major, minor, patch;
2591
+ zmq_version (&major, &minor, &patch);
2592
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2593
+ zsys_error ("zsock multicast_hops option not supported by libzmq version %d.%d.%d, "
2594
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2595
+ return 0;
2596
+ }
1902
2597
  int multicast_hops;
1903
2598
  size_t option_len = sizeof (int);
1904
2599
  zmq_getsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, &option_len);
@@ -1917,6 +2612,13 @@ zsock_set_rcvtimeo (void *self, int rcvtimeo)
1917
2612
  {
1918
2613
  assert (self);
1919
2614
  # if defined (ZMQ_RCVTIMEO)
2615
+ int major, minor, patch;
2616
+ zmq_version (&major, &minor, &patch);
2617
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2618
+ zsys_error ("zsock rcvtimeo option not supported by libzmq version %d.%d.%d, "
2619
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2620
+ return;
2621
+ }
1920
2622
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
1921
2623
  assert (rc == 0 || zmq_errno () == ETERM);
1922
2624
  # endif
@@ -1932,6 +2634,13 @@ zsock_rcvtimeo (void *self)
1932
2634
  {
1933
2635
  assert (self);
1934
2636
  # if defined (ZMQ_RCVTIMEO)
2637
+ int major, minor, patch;
2638
+ zmq_version (&major, &minor, &patch);
2639
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2640
+ zsys_error ("zsock rcvtimeo option not supported by libzmq version %d.%d.%d, "
2641
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2642
+ return 0;
2643
+ }
1935
2644
  int rcvtimeo;
1936
2645
  size_t option_len = sizeof (int);
1937
2646
  zmq_getsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, &option_len);
@@ -1950,6 +2659,13 @@ zsock_set_sndtimeo (void *self, int sndtimeo)
1950
2659
  {
1951
2660
  assert (self);
1952
2661
  # if defined (ZMQ_SNDTIMEO)
2662
+ int major, minor, patch;
2663
+ zmq_version (&major, &minor, &patch);
2664
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2665
+ zsys_error ("zsock sndtimeo option not supported by libzmq version %d.%d.%d, "
2666
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2667
+ return;
2668
+ }
1953
2669
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
1954
2670
  assert (rc == 0 || zmq_errno () == ETERM);
1955
2671
  # endif
@@ -1965,6 +2681,13 @@ zsock_sndtimeo (void *self)
1965
2681
  {
1966
2682
  assert (self);
1967
2683
  # if defined (ZMQ_SNDTIMEO)
2684
+ int major, minor, patch;
2685
+ zmq_version (&major, &minor, &patch);
2686
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2687
+ zsys_error ("zsock sndtimeo option not supported by libzmq version %d.%d.%d, "
2688
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2689
+ return 0;
2690
+ }
1968
2691
  int sndtimeo;
1969
2692
  size_t option_len = sizeof (int);
1970
2693
  zmq_getsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, &option_len);
@@ -1983,6 +2706,13 @@ zsock_set_xpub_verbose (void *self, int xpub_verbose)
1983
2706
  {
1984
2707
  assert (self);
1985
2708
  # if defined (ZMQ_XPUB_VERBOSE)
2709
+ int major, minor, patch;
2710
+ zmq_version (&major, &minor, &patch);
2711
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2712
+ zsys_error ("zsock xpub_verbose option not supported by libzmq version %d.%d.%d, "
2713
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2714
+ return;
2715
+ }
1986
2716
  if (zsock_type (self) != ZMQ_XPUB) {
1987
2717
  printf ("ZMQ_XPUB_VERBOSE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
1988
2718
  assert (false);
@@ -2002,6 +2732,13 @@ zsock_set_tcp_keepalive (void *self, int tcp_keepalive)
2002
2732
  {
2003
2733
  assert (self);
2004
2734
  # if defined (ZMQ_TCP_KEEPALIVE)
2735
+ int major, minor, patch;
2736
+ zmq_version (&major, &minor, &patch);
2737
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2738
+ zsys_error ("zsock tcp_keepalive option not supported by libzmq version %d.%d.%d, "
2739
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2740
+ return;
2741
+ }
2005
2742
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, sizeof (int));
2006
2743
  assert (rc == 0 || zmq_errno () == ETERM);
2007
2744
  # endif
@@ -2017,6 +2754,13 @@ zsock_tcp_keepalive (void *self)
2017
2754
  {
2018
2755
  assert (self);
2019
2756
  # if defined (ZMQ_TCP_KEEPALIVE)
2757
+ int major, minor, patch;
2758
+ zmq_version (&major, &minor, &patch);
2759
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2760
+ zsys_error ("zsock tcp_keepalive option not supported by libzmq version %d.%d.%d, "
2761
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2762
+ return 0;
2763
+ }
2020
2764
  int tcp_keepalive;
2021
2765
  size_t option_len = sizeof (int);
2022
2766
  zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, &option_len);
@@ -2035,6 +2779,13 @@ zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle)
2035
2779
  {
2036
2780
  assert (self);
2037
2781
  # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
2782
+ int major, minor, patch;
2783
+ zmq_version (&major, &minor, &patch);
2784
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2785
+ zsys_error ("zsock tcp_keepalive_idle option not supported by libzmq version %d.%d.%d, "
2786
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2787
+ return;
2788
+ }
2038
2789
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, sizeof (int));
2039
2790
  assert (rc == 0 || zmq_errno () == ETERM);
2040
2791
  # endif
@@ -2050,6 +2801,13 @@ zsock_tcp_keepalive_idle (void *self)
2050
2801
  {
2051
2802
  assert (self);
2052
2803
  # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
2804
+ int major, minor, patch;
2805
+ zmq_version (&major, &minor, &patch);
2806
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2807
+ zsys_error ("zsock tcp_keepalive_idle option not supported by libzmq version %d.%d.%d, "
2808
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2809
+ return 0;
2810
+ }
2053
2811
  int tcp_keepalive_idle;
2054
2812
  size_t option_len = sizeof (int);
2055
2813
  zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, &option_len);
@@ -2068,6 +2826,13 @@ zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt)
2068
2826
  {
2069
2827
  assert (self);
2070
2828
  # if defined (ZMQ_TCP_KEEPALIVE_CNT)
2829
+ int major, minor, patch;
2830
+ zmq_version (&major, &minor, &patch);
2831
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2832
+ zsys_error ("zsock tcp_keepalive_cnt option not supported by libzmq version %d.%d.%d, "
2833
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2834
+ return;
2835
+ }
2071
2836
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, sizeof (int));
2072
2837
  assert (rc == 0 || zmq_errno () == ETERM);
2073
2838
  # endif
@@ -2083,6 +2848,13 @@ zsock_tcp_keepalive_cnt (void *self)
2083
2848
  {
2084
2849
  assert (self);
2085
2850
  # if defined (ZMQ_TCP_KEEPALIVE_CNT)
2851
+ int major, minor, patch;
2852
+ zmq_version (&major, &minor, &patch);
2853
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2854
+ zsys_error ("zsock tcp_keepalive_cnt option not supported by libzmq version %d.%d.%d, "
2855
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2856
+ return 0;
2857
+ }
2086
2858
  int tcp_keepalive_cnt;
2087
2859
  size_t option_len = sizeof (int);
2088
2860
  zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, &option_len);
@@ -2101,6 +2873,13 @@ zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl)
2101
2873
  {
2102
2874
  assert (self);
2103
2875
  # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
2876
+ int major, minor, patch;
2877
+ zmq_version (&major, &minor, &patch);
2878
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2879
+ zsys_error ("zsock tcp_keepalive_intvl option not supported by libzmq version %d.%d.%d, "
2880
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2881
+ return;
2882
+ }
2104
2883
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, sizeof (int));
2105
2884
  assert (rc == 0 || zmq_errno () == ETERM);
2106
2885
  # endif
@@ -2116,6 +2895,13 @@ zsock_tcp_keepalive_intvl (void *self)
2116
2895
  {
2117
2896
  assert (self);
2118
2897
  # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
2898
+ int major, minor, patch;
2899
+ zmq_version (&major, &minor, &patch);
2900
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2901
+ zsys_error ("zsock tcp_keepalive_intvl option not supported by libzmq version %d.%d.%d, "
2902
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2903
+ return 0;
2904
+ }
2119
2905
  int tcp_keepalive_intvl;
2120
2906
  size_t option_len = sizeof (int);
2121
2907
  zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, &option_len);
@@ -2134,6 +2920,13 @@ zsock_set_tcp_accept_filter (void *self, const char * tcp_accept_filter)
2134
2920
  {
2135
2921
  assert (self);
2136
2922
  # if defined (ZMQ_TCP_ACCEPT_FILTER)
2923
+ int major, minor, patch;
2924
+ zmq_version (&major, &minor, &patch);
2925
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2926
+ zsys_error ("zsock tcp_accept_filter option not supported by libzmq version %d.%d.%d, "
2927
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2928
+ return;
2929
+ }
2137
2930
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, strlen (tcp_accept_filter));
2138
2931
  assert (rc == 0 || zmq_errno () == ETERM);
2139
2932
  # endif
@@ -2149,6 +2942,13 @@ zsock_tcp_accept_filter (void *self)
2149
2942
  {
2150
2943
  assert (self);
2151
2944
  # if defined (ZMQ_TCP_ACCEPT_FILTER)
2945
+ int major, minor, patch;
2946
+ zmq_version (&major, &minor, &patch);
2947
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2948
+ zsys_error ("zsock tcp_accept_filter option not supported by libzmq version %d.%d.%d, "
2949
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2950
+ return 0;
2951
+ }
2152
2952
  size_t option_len = 255;
2153
2953
  char *tcp_accept_filter = (char *) zmalloc (option_len);
2154
2954
  zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, &option_len);
@@ -2167,6 +2967,13 @@ zsock_rcvmore (void *self)
2167
2967
  {
2168
2968
  assert (self);
2169
2969
  # if defined (ZMQ_RCVMORE)
2970
+ int major, minor, patch;
2971
+ zmq_version (&major, &minor, &patch);
2972
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2973
+ zsys_error ("zsock rcvmore option not supported by libzmq version %d.%d.%d, "
2974
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
2975
+ return 0;
2976
+ }
2170
2977
  int rcvmore;
2171
2978
  size_t option_len = sizeof (int);
2172
2979
  zmq_getsockopt (zsock_resolve (self), ZMQ_RCVMORE, &rcvmore, &option_len);
@@ -2185,6 +2992,13 @@ zsock_fd (void *self)
2185
2992
  {
2186
2993
  assert (self);
2187
2994
  # if defined (ZMQ_FD)
2995
+ int major, minor, patch;
2996
+ zmq_version (&major, &minor, &patch);
2997
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
2998
+ zsys_error ("zsock fd option not supported by libzmq version %d.%d.%d, "
2999
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
3000
+ return 0;
3001
+ }
2188
3002
  SOCKET fd;
2189
3003
  size_t option_len = sizeof (SOCKET);
2190
3004
  zmq_getsockopt (zsock_resolve (self), ZMQ_FD, &fd, &option_len);
@@ -2203,6 +3017,13 @@ zsock_events (void *self)
2203
3017
  {
2204
3018
  assert (self);
2205
3019
  # if defined (ZMQ_EVENTS)
3020
+ int major, minor, patch;
3021
+ zmq_version (&major, &minor, &patch);
3022
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
3023
+ zsys_error ("zsock events option not supported by libzmq version %d.%d.%d, "
3024
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
3025
+ return 0;
3026
+ }
2206
3027
  int events;
2207
3028
  size_t option_len = sizeof (int);
2208
3029
  zmq_getsockopt (zsock_resolve (self), ZMQ_EVENTS, &events, &option_len);
@@ -2221,6 +3042,13 @@ zsock_last_endpoint (void *self)
2221
3042
  {
2222
3043
  assert (self);
2223
3044
  # if defined (ZMQ_LAST_ENDPOINT)
3045
+ int major, minor, patch;
3046
+ zmq_version (&major, &minor, &patch);
3047
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
3048
+ zsys_error ("zsock last_endpoint option not supported by libzmq version %d.%d.%d, "
3049
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
3050
+ return 0;
3051
+ }
2224
3052
  size_t option_len = 255;
2225
3053
  char *last_endpoint = (char *) zmalloc (option_len);
2226
3054
  zmq_getsockopt (zsock_resolve (self), ZMQ_LAST_ENDPOINT, last_endpoint, &option_len);
@@ -2230,9 +3058,6 @@ zsock_last_endpoint (void *self)
2230
3058
  # endif
2231
3059
  }
2232
3060
 
2233
- #endif
2234
-
2235
- #if (ZMQ_VERSION_MAJOR == 3)
2236
3061
  // --------------------------------------------------------------------------
2237
3062
  // Set socket ZMQ_ROUTER_RAW value
2238
3063
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -2242,6 +3067,13 @@ zsock_set_router_raw (void *self, int router_raw)
2242
3067
  {
2243
3068
  assert (self);
2244
3069
  # if defined (ZMQ_ROUTER_RAW)
3070
+ int major, minor, patch;
3071
+ zmq_version (&major, &minor, &patch);
3072
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
3073
+ zsys_error ("zsock router_raw option not supported by libzmq version %d.%d.%d, "
3074
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
3075
+ return;
3076
+ }
2245
3077
  if (zsock_type (self) != ZMQ_ROUTER) {
2246
3078
  printf ("ZMQ_ROUTER_RAW is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2247
3079
  assert (false);
@@ -2261,6 +3093,13 @@ zsock_set_ipv4only (void *self, int ipv4only)
2261
3093
  {
2262
3094
  assert (self);
2263
3095
  # if defined (ZMQ_IPV4ONLY)
3096
+ int major, minor, patch;
3097
+ zmq_version (&major, &minor, &patch);
3098
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
3099
+ zsys_error ("zsock ipv4only option not supported by libzmq version %d.%d.%d, "
3100
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
3101
+ return;
3102
+ }
2264
3103
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IPV4ONLY, &ipv4only, sizeof (int));
2265
3104
  assert (rc == 0 || zmq_errno () == ETERM);
2266
3105
  # endif
@@ -2276,6 +3115,13 @@ zsock_ipv4only (void *self)
2276
3115
  {
2277
3116
  assert (self);
2278
3117
  # if defined (ZMQ_IPV4ONLY)
3118
+ int major, minor, patch;
3119
+ zmq_version (&major, &minor, &patch);
3120
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
3121
+ zsys_error ("zsock ipv4only option not supported by libzmq version %d.%d.%d, "
3122
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
3123
+ return 0;
3124
+ }
2279
3125
  int ipv4only;
2280
3126
  size_t option_len = sizeof (int);
2281
3127
  zmq_getsockopt (zsock_resolve (self), ZMQ_IPV4ONLY, &ipv4only, &option_len);
@@ -2294,907 +3140,89 @@ zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect)
2294
3140
  {
2295
3141
  assert (self);
2296
3142
  # if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
3143
+ int major, minor, patch;
3144
+ zmq_version (&major, &minor, &patch);
3145
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (3, 0, 0)) {
3146
+ zsys_error ("zsock delay_attach_on_connect option not supported by libzmq version %d.%d.%d, "
3147
+ "run with libzmq >= 3.0.0\n", major, minor, patch, NULL);
3148
+ return;
3149
+ }
2297
3150
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_DELAY_ATTACH_ON_CONNECT, &delay_attach_on_connect, sizeof (int));
2298
3151
  assert (rc == 0 || zmq_errno () == ETERM);
2299
3152
  # endif
2300
3153
  }
2301
3154
 
2302
3155
 
2303
- // --------------------------------------------------------------------------
2304
- // Return socket ZMQ_TYPE value
2305
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2306
-
2307
- int
2308
- zsock_type (void *self)
2309
- {
2310
- assert (self);
2311
- # if defined (ZMQ_TYPE)
2312
- int type;
2313
- size_t option_len = sizeof (int);
2314
- zmq_getsockopt (zsock_resolve (self), ZMQ_TYPE, &type, &option_len);
2315
- return type;
2316
- # else
2317
- return 0;
2318
- # endif
2319
- }
3156
+ #endif
2320
3157
 
3158
+ #if (ZMQ_VERSION_MAJOR >= 2) && (ZMQ_VERSION_MAJOR < 3)
2321
3159
  // --------------------------------------------------------------------------
2322
- // Set socket ZMQ_SNDHWM value
3160
+ // Set socket ZMQ_HWM value
2323
3161
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2324
3162
 
2325
3163
  void
2326
- zsock_set_sndhwm (void *self, int sndhwm)
3164
+ zsock_set_hwm (void *self, int hwm)
2327
3165
  {
2328
3166
  assert (self);
2329
- # if defined (ZMQ_SNDHWM)
2330
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDHWM, &sndhwm, sizeof (int));
3167
+ # if defined (ZMQ_HWM)
3168
+ int major, minor, patch;
3169
+ zmq_version (&major, &minor, &patch);
3170
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3171
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3172
+ zsys_error ("zsock hwm option not supported by libzmq version %d.%d.%d, "
3173
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3174
+ return;
3175
+ }
3176
+ uint64_t value = hwm;
3177
+ int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_HWM, &value, sizeof (uint64_t));
2331
3178
  assert (rc == 0 || zmq_errno () == ETERM);
2332
3179
  # endif
2333
3180
  }
2334
3181
 
2335
3182
 
2336
3183
  // --------------------------------------------------------------------------
2337
- // Return socket ZMQ_SNDHWM value
3184
+ // Return socket ZMQ_HWM value
2338
3185
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2339
3186
 
2340
3187
  int
2341
- zsock_sndhwm (void *self)
3188
+ zsock_hwm (void *self)
2342
3189
  {
2343
3190
  assert (self);
2344
- # if defined (ZMQ_SNDHWM)
2345
- int sndhwm;
2346
- size_t option_len = sizeof (int);
2347
- zmq_getsockopt (zsock_resolve (self), ZMQ_SNDHWM, &sndhwm, &option_len);
2348
- return sndhwm;
3191
+ # if defined (ZMQ_HWM)
3192
+ int major, minor, patch;
3193
+ zmq_version (&major, &minor, &patch);
3194
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3195
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3196
+ zsys_error ("zsock hwm option not supported by libzmq version %d.%d.%d, "
3197
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3198
+ return 0;
3199
+ }
3200
+ uint64_t hwm;
3201
+ size_t option_len = sizeof (uint64_t);
3202
+ zmq_getsockopt (zsock_resolve (self), ZMQ_HWM, &hwm, &option_len);
3203
+ return (int) hwm;
2349
3204
  # else
2350
3205
  return 0;
2351
3206
  # endif
2352
3207
  }
2353
3208
 
2354
3209
  // --------------------------------------------------------------------------
2355
- // Set socket ZMQ_RCVHWM value
3210
+ // Set socket ZMQ_SWAP value
2356
3211
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2357
3212
 
2358
3213
  void
2359
- zsock_set_rcvhwm (void *self, int rcvhwm)
2360
- {
2361
- assert (self);
2362
- # if defined (ZMQ_RCVHWM)
2363
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVHWM, &rcvhwm, sizeof (int));
2364
- assert (rc == 0 || zmq_errno () == ETERM);
2365
- # endif
2366
- }
2367
-
2368
-
2369
- // --------------------------------------------------------------------------
2370
- // Return socket ZMQ_RCVHWM value
2371
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2372
-
2373
- int
2374
- zsock_rcvhwm (void *self)
2375
- {
2376
- assert (self);
2377
- # if defined (ZMQ_RCVHWM)
2378
- int rcvhwm;
2379
- size_t option_len = sizeof (int);
2380
- zmq_getsockopt (zsock_resolve (self), ZMQ_RCVHWM, &rcvhwm, &option_len);
2381
- return rcvhwm;
2382
- # else
2383
- return 0;
2384
- # endif
2385
- }
2386
-
2387
- // --------------------------------------------------------------------------
2388
- // Set socket ZMQ_AFFINITY value
2389
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2390
-
2391
- void
2392
- zsock_set_affinity (void *self, int affinity)
2393
- {
2394
- assert (self);
2395
- # if defined (ZMQ_AFFINITY)
2396
- uint64_t value = affinity;
2397
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_AFFINITY, &value, sizeof (uint64_t));
2398
- assert (rc == 0 || zmq_errno () == ETERM);
2399
- # endif
2400
- }
2401
-
2402
-
2403
- // --------------------------------------------------------------------------
2404
- // Return socket ZMQ_AFFINITY value
2405
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2406
-
2407
- int
2408
- zsock_affinity (void *self)
2409
- {
2410
- assert (self);
2411
- # if defined (ZMQ_AFFINITY)
2412
- uint64_t affinity;
2413
- size_t option_len = sizeof (uint64_t);
2414
- zmq_getsockopt (zsock_resolve (self), ZMQ_AFFINITY, &affinity, &option_len);
2415
- return (int) affinity;
2416
- # else
2417
- return 0;
2418
- # endif
2419
- }
2420
-
2421
- // --------------------------------------------------------------------------
2422
- // Set socket ZMQ_SUBSCRIBE value
2423
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2424
-
2425
- void
2426
- zsock_set_subscribe (void *self, const char * subscribe)
2427
- {
2428
- assert (self);
2429
- # if defined (ZMQ_SUBSCRIBE)
2430
- if (zsock_type (self) != ZMQ_SUB) {
2431
- printf ("ZMQ_SUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2432
- assert (false);
2433
- }
2434
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SUBSCRIBE, subscribe, strlen (subscribe));
2435
- assert (rc == 0 || zmq_errno () == ETERM);
2436
- # endif
2437
- }
2438
-
2439
-
2440
- // --------------------------------------------------------------------------
2441
- // Set socket ZMQ_UNSUBSCRIBE value
2442
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2443
-
2444
- void
2445
- zsock_set_unsubscribe (void *self, const char * unsubscribe)
2446
- {
2447
- assert (self);
2448
- # if defined (ZMQ_UNSUBSCRIBE)
2449
- if (zsock_type (self) != ZMQ_SUB) {
2450
- printf ("ZMQ_UNSUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2451
- assert (false);
2452
- }
2453
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_UNSUBSCRIBE, unsubscribe, strlen (unsubscribe));
2454
- assert (rc == 0 || zmq_errno () == ETERM);
2455
- # endif
2456
- }
2457
-
2458
-
2459
- // --------------------------------------------------------------------------
2460
- // Set socket ZMQ_IDENTITY value
2461
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2462
-
2463
- void
2464
- zsock_set_identity (void *self, const char * identity)
2465
- {
2466
- assert (self);
2467
- # if defined (ZMQ_IDENTITY)
2468
- if (zsock_type (self) != ZMQ_REQ
2469
- && zsock_type (self) != ZMQ_REP
2470
- && zsock_type (self) != ZMQ_DEALER
2471
- && zsock_type (self) != ZMQ_ROUTER) {
2472
- printf ("ZMQ_IDENTITY is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2473
- assert (false);
2474
- }
2475
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, strlen (identity));
2476
- assert (rc == 0 || zmq_errno () == ETERM);
2477
- # endif
2478
- }
2479
-
2480
-
2481
- // --------------------------------------------------------------------------
2482
- // Return socket ZMQ_IDENTITY value
2483
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2484
-
2485
- char *
2486
- zsock_identity (void *self)
2487
- {
2488
- assert (self);
2489
- # if defined (ZMQ_IDENTITY)
2490
- size_t option_len = 255;
2491
- char *identity = (char *) zmalloc (option_len);
2492
- zmq_getsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, &option_len);
2493
- return (char *) identity;
2494
- # else
2495
- return NULL;
2496
- # endif
2497
- }
2498
-
2499
- // --------------------------------------------------------------------------
2500
- // Set socket ZMQ_RATE value
2501
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2502
-
2503
- void
2504
- zsock_set_rate (void *self, int rate)
2505
- {
2506
- assert (self);
2507
- # if defined (ZMQ_RATE)
2508
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RATE, &rate, sizeof (int));
2509
- assert (rc == 0 || zmq_errno () == ETERM);
2510
- # endif
2511
- }
2512
-
2513
-
2514
- // --------------------------------------------------------------------------
2515
- // Return socket ZMQ_RATE value
2516
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2517
-
2518
- int
2519
- zsock_rate (void *self)
2520
- {
2521
- assert (self);
2522
- # if defined (ZMQ_RATE)
2523
- int rate;
2524
- size_t option_len = sizeof (int);
2525
- zmq_getsockopt (zsock_resolve (self), ZMQ_RATE, &rate, &option_len);
2526
- return rate;
2527
- # else
2528
- return 0;
2529
- # endif
2530
- }
2531
-
2532
- // --------------------------------------------------------------------------
2533
- // Set socket ZMQ_RECOVERY_IVL value
2534
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2535
-
2536
- void
2537
- zsock_set_recovery_ivl (void *self, int recovery_ivl)
2538
- {
2539
- assert (self);
2540
- # if defined (ZMQ_RECOVERY_IVL)
2541
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, sizeof (int));
2542
- assert (rc == 0 || zmq_errno () == ETERM);
2543
- # endif
2544
- }
2545
-
2546
-
2547
- // --------------------------------------------------------------------------
2548
- // Return socket ZMQ_RECOVERY_IVL value
2549
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2550
-
2551
- int
2552
- zsock_recovery_ivl (void *self)
2553
- {
2554
- assert (self);
2555
- # if defined (ZMQ_RECOVERY_IVL)
2556
- int recovery_ivl;
2557
- size_t option_len = sizeof (int);
2558
- zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
2559
- return recovery_ivl;
2560
- # else
2561
- return 0;
2562
- # endif
2563
- }
2564
-
2565
- // --------------------------------------------------------------------------
2566
- // Set socket ZMQ_SNDBUF value
2567
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2568
-
2569
- void
2570
- zsock_set_sndbuf (void *self, int sndbuf)
2571
- {
2572
- assert (self);
2573
- # if defined (ZMQ_SNDBUF)
2574
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, sizeof (int));
2575
- assert (rc == 0 || zmq_errno () == ETERM);
2576
- # endif
2577
- }
2578
-
2579
-
2580
- // --------------------------------------------------------------------------
2581
- // Return socket ZMQ_SNDBUF value
2582
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2583
-
2584
- int
2585
- zsock_sndbuf (void *self)
2586
- {
2587
- assert (self);
2588
- # if defined (ZMQ_SNDBUF)
2589
- int sndbuf;
2590
- size_t option_len = sizeof (int);
2591
- zmq_getsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, &option_len);
2592
- return sndbuf;
2593
- # else
2594
- return 0;
2595
- # endif
2596
- }
2597
-
2598
- // --------------------------------------------------------------------------
2599
- // Set socket ZMQ_RCVBUF value
2600
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2601
-
2602
- void
2603
- zsock_set_rcvbuf (void *self, int rcvbuf)
2604
- {
2605
- assert (self);
2606
- # if defined (ZMQ_RCVBUF)
2607
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, sizeof (int));
2608
- assert (rc == 0 || zmq_errno () == ETERM);
2609
- # endif
2610
- }
2611
-
2612
-
2613
- // --------------------------------------------------------------------------
2614
- // Return socket ZMQ_RCVBUF value
2615
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2616
-
2617
- int
2618
- zsock_rcvbuf (void *self)
2619
- {
2620
- assert (self);
2621
- # if defined (ZMQ_RCVBUF)
2622
- int rcvbuf;
2623
- size_t option_len = sizeof (int);
2624
- zmq_getsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, &option_len);
2625
- return rcvbuf;
2626
- # else
2627
- return 0;
2628
- # endif
2629
- }
2630
-
2631
- // --------------------------------------------------------------------------
2632
- // Set socket ZMQ_LINGER value
2633
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2634
-
2635
- void
2636
- zsock_set_linger (void *self, int linger)
2637
- {
2638
- assert (self);
2639
- # if defined (ZMQ_LINGER)
2640
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, sizeof (int));
2641
- assert (rc == 0 || zmq_errno () == ETERM);
2642
- # endif
2643
- }
2644
-
2645
-
2646
- // --------------------------------------------------------------------------
2647
- // Return socket ZMQ_LINGER value
2648
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2649
-
2650
- int
2651
- zsock_linger (void *self)
2652
- {
2653
- assert (self);
2654
- # if defined (ZMQ_LINGER)
2655
- int linger;
2656
- size_t option_len = sizeof (int);
2657
- zmq_getsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, &option_len);
2658
- return linger;
2659
- # else
2660
- return 0;
2661
- # endif
2662
- }
2663
-
2664
- // --------------------------------------------------------------------------
2665
- // Set socket ZMQ_RECONNECT_IVL value
2666
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2667
-
2668
- void
2669
- zsock_set_reconnect_ivl (void *self, int reconnect_ivl)
2670
- {
2671
- assert (self);
2672
- # if defined (ZMQ_RECONNECT_IVL)
2673
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
2674
- assert (rc == 0 || zmq_errno () == ETERM);
2675
- # endif
2676
- }
2677
-
2678
-
2679
- // --------------------------------------------------------------------------
2680
- // Return socket ZMQ_RECONNECT_IVL value
2681
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2682
-
2683
- int
2684
- zsock_reconnect_ivl (void *self)
2685
- {
2686
- assert (self);
2687
- # if defined (ZMQ_RECONNECT_IVL)
2688
- int reconnect_ivl;
2689
- size_t option_len = sizeof (int);
2690
- zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, &option_len);
2691
- return reconnect_ivl;
2692
- # else
2693
- return 0;
2694
- # endif
2695
- }
2696
-
2697
- // --------------------------------------------------------------------------
2698
- // Set socket ZMQ_RECONNECT_IVL_MAX value
2699
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2700
-
2701
- void
2702
- zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max)
2703
- {
2704
- assert (self);
2705
- # if defined (ZMQ_RECONNECT_IVL_MAX)
2706
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
2707
- assert (rc == 0 || zmq_errno () == ETERM);
2708
- # endif
2709
- }
2710
-
2711
-
2712
- // --------------------------------------------------------------------------
2713
- // Return socket ZMQ_RECONNECT_IVL_MAX value
2714
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2715
-
2716
- int
2717
- zsock_reconnect_ivl_max (void *self)
2718
- {
2719
- assert (self);
2720
- # if defined (ZMQ_RECONNECT_IVL_MAX)
2721
- int reconnect_ivl_max;
2722
- size_t option_len = sizeof (int);
2723
- zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, &option_len);
2724
- return reconnect_ivl_max;
2725
- # else
2726
- return 0;
2727
- # endif
2728
- }
2729
-
2730
- // --------------------------------------------------------------------------
2731
- // Set socket ZMQ_BACKLOG value
2732
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2733
-
2734
- void
2735
- zsock_set_backlog (void *self, int backlog)
2736
- {
2737
- assert (self);
2738
- # if defined (ZMQ_BACKLOG)
2739
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, sizeof (int));
2740
- assert (rc == 0 || zmq_errno () == ETERM);
2741
- # endif
2742
- }
2743
-
2744
-
2745
- // --------------------------------------------------------------------------
2746
- // Return socket ZMQ_BACKLOG value
2747
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2748
-
2749
- int
2750
- zsock_backlog (void *self)
2751
- {
2752
- assert (self);
2753
- # if defined (ZMQ_BACKLOG)
2754
- int backlog;
2755
- size_t option_len = sizeof (int);
2756
- zmq_getsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, &option_len);
2757
- return backlog;
2758
- # else
2759
- return 0;
2760
- # endif
2761
- }
2762
-
2763
- // --------------------------------------------------------------------------
2764
- // Set socket ZMQ_MAXMSGSIZE value
2765
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2766
-
2767
- void
2768
- zsock_set_maxmsgsize (void *self, int maxmsgsize)
2769
- {
2770
- assert (self);
2771
- # if defined (ZMQ_MAXMSGSIZE)
2772
- int64_t value = maxmsgsize;
2773
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &value, sizeof (int64_t));
2774
- assert (rc == 0 || zmq_errno () == ETERM);
2775
- # endif
2776
- }
2777
-
2778
-
2779
- // --------------------------------------------------------------------------
2780
- // Return socket ZMQ_MAXMSGSIZE value
2781
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2782
-
2783
- int
2784
- zsock_maxmsgsize (void *self)
2785
- {
2786
- assert (self);
2787
- # if defined (ZMQ_MAXMSGSIZE)
2788
- int64_t maxmsgsize;
2789
- size_t option_len = sizeof (int64_t);
2790
- zmq_getsockopt (zsock_resolve (self), ZMQ_MAXMSGSIZE, &maxmsgsize, &option_len);
2791
- return (int) maxmsgsize;
2792
- # else
2793
- return 0;
2794
- # endif
2795
- }
2796
-
2797
- // --------------------------------------------------------------------------
2798
- // Set socket ZMQ_MULTICAST_HOPS value
2799
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2800
-
2801
- void
2802
- zsock_set_multicast_hops (void *self, int multicast_hops)
2803
- {
2804
- assert (self);
2805
- # if defined (ZMQ_MULTICAST_HOPS)
2806
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, sizeof (int));
2807
- assert (rc == 0 || zmq_errno () == ETERM);
2808
- # endif
2809
- }
2810
-
2811
-
2812
- // --------------------------------------------------------------------------
2813
- // Return socket ZMQ_MULTICAST_HOPS value
2814
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2815
-
2816
- int
2817
- zsock_multicast_hops (void *self)
2818
- {
2819
- assert (self);
2820
- # if defined (ZMQ_MULTICAST_HOPS)
2821
- int multicast_hops;
2822
- size_t option_len = sizeof (int);
2823
- zmq_getsockopt (zsock_resolve (self), ZMQ_MULTICAST_HOPS, &multicast_hops, &option_len);
2824
- return multicast_hops;
2825
- # else
2826
- return 0;
2827
- # endif
2828
- }
2829
-
2830
- // --------------------------------------------------------------------------
2831
- // Set socket ZMQ_RCVTIMEO value
2832
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2833
-
2834
- void
2835
- zsock_set_rcvtimeo (void *self, int rcvtimeo)
2836
- {
2837
- assert (self);
2838
- # if defined (ZMQ_RCVTIMEO)
2839
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
2840
- assert (rc == 0 || zmq_errno () == ETERM);
2841
- # endif
2842
- }
2843
-
2844
-
2845
- // --------------------------------------------------------------------------
2846
- // Return socket ZMQ_RCVTIMEO value
2847
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2848
-
2849
- int
2850
- zsock_rcvtimeo (void *self)
2851
- {
2852
- assert (self);
2853
- # if defined (ZMQ_RCVTIMEO)
2854
- int rcvtimeo;
2855
- size_t option_len = sizeof (int);
2856
- zmq_getsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, &option_len);
2857
- return rcvtimeo;
2858
- # else
2859
- return 0;
2860
- # endif
2861
- }
2862
-
2863
- // --------------------------------------------------------------------------
2864
- // Set socket ZMQ_SNDTIMEO value
2865
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2866
-
2867
- void
2868
- zsock_set_sndtimeo (void *self, int sndtimeo)
2869
- {
2870
- assert (self);
2871
- # if defined (ZMQ_SNDTIMEO)
2872
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
2873
- assert (rc == 0 || zmq_errno () == ETERM);
2874
- # endif
2875
- }
2876
-
2877
-
2878
- // --------------------------------------------------------------------------
2879
- // Return socket ZMQ_SNDTIMEO value
2880
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2881
-
2882
- int
2883
- zsock_sndtimeo (void *self)
2884
- {
2885
- assert (self);
2886
- # if defined (ZMQ_SNDTIMEO)
2887
- int sndtimeo;
2888
- size_t option_len = sizeof (int);
2889
- zmq_getsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, &option_len);
2890
- return sndtimeo;
2891
- # else
2892
- return 0;
2893
- # endif
2894
- }
2895
-
2896
- // --------------------------------------------------------------------------
2897
- // Set socket ZMQ_XPUB_VERBOSE value
2898
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2899
-
2900
- void
2901
- zsock_set_xpub_verbose (void *self, int xpub_verbose)
2902
- {
2903
- assert (self);
2904
- # if defined (ZMQ_XPUB_VERBOSE)
2905
- if (zsock_type (self) != ZMQ_XPUB) {
2906
- printf ("ZMQ_XPUB_VERBOSE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
2907
- assert (false);
2908
- }
2909
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_XPUB_VERBOSE, &xpub_verbose, sizeof (int));
2910
- assert (rc == 0 || zmq_errno () == ETERM);
2911
- # endif
2912
- }
2913
-
2914
-
2915
- // --------------------------------------------------------------------------
2916
- // Set socket ZMQ_TCP_KEEPALIVE value
2917
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2918
-
2919
- void
2920
- zsock_set_tcp_keepalive (void *self, int tcp_keepalive)
2921
- {
2922
- assert (self);
2923
- # if defined (ZMQ_TCP_KEEPALIVE)
2924
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, sizeof (int));
2925
- assert (rc == 0 || zmq_errno () == ETERM);
2926
- # endif
2927
- }
2928
-
2929
-
2930
- // --------------------------------------------------------------------------
2931
- // Return socket ZMQ_TCP_KEEPALIVE value
2932
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2933
-
2934
- int
2935
- zsock_tcp_keepalive (void *self)
2936
- {
2937
- assert (self);
2938
- # if defined (ZMQ_TCP_KEEPALIVE)
2939
- int tcp_keepalive;
2940
- size_t option_len = sizeof (int);
2941
- zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE, &tcp_keepalive, &option_len);
2942
- return tcp_keepalive;
2943
- # else
2944
- return 0;
2945
- # endif
2946
- }
2947
-
2948
- // --------------------------------------------------------------------------
2949
- // Set socket ZMQ_TCP_KEEPALIVE_IDLE value
2950
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2951
-
2952
- void
2953
- zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle)
2954
- {
2955
- assert (self);
2956
- # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
2957
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, sizeof (int));
2958
- assert (rc == 0 || zmq_errno () == ETERM);
2959
- # endif
2960
- }
2961
-
2962
-
2963
- // --------------------------------------------------------------------------
2964
- // Return socket ZMQ_TCP_KEEPALIVE_IDLE value
2965
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2966
-
2967
- int
2968
- zsock_tcp_keepalive_idle (void *self)
2969
- {
2970
- assert (self);
2971
- # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
2972
- int tcp_keepalive_idle;
2973
- size_t option_len = sizeof (int);
2974
- zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_IDLE, &tcp_keepalive_idle, &option_len);
2975
- return tcp_keepalive_idle;
2976
- # else
2977
- return 0;
2978
- # endif
2979
- }
2980
-
2981
- // --------------------------------------------------------------------------
2982
- // Set socket ZMQ_TCP_KEEPALIVE_CNT value
2983
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2984
-
2985
- void
2986
- zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt)
2987
- {
2988
- assert (self);
2989
- # if defined (ZMQ_TCP_KEEPALIVE_CNT)
2990
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, sizeof (int));
2991
- assert (rc == 0 || zmq_errno () == ETERM);
2992
- # endif
2993
- }
2994
-
2995
-
2996
- // --------------------------------------------------------------------------
2997
- // Return socket ZMQ_TCP_KEEPALIVE_CNT value
2998
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
2999
-
3000
- int
3001
- zsock_tcp_keepalive_cnt (void *self)
3002
- {
3003
- assert (self);
3004
- # if defined (ZMQ_TCP_KEEPALIVE_CNT)
3005
- int tcp_keepalive_cnt;
3006
- size_t option_len = sizeof (int);
3007
- zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_CNT, &tcp_keepalive_cnt, &option_len);
3008
- return tcp_keepalive_cnt;
3009
- # else
3010
- return 0;
3011
- # endif
3012
- }
3013
-
3014
- // --------------------------------------------------------------------------
3015
- // Set socket ZMQ_TCP_KEEPALIVE_INTVL value
3016
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3017
-
3018
- void
3019
- zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl)
3020
- {
3021
- assert (self);
3022
- # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
3023
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, sizeof (int));
3024
- assert (rc == 0 || zmq_errno () == ETERM);
3025
- # endif
3026
- }
3027
-
3028
-
3029
- // --------------------------------------------------------------------------
3030
- // Return socket ZMQ_TCP_KEEPALIVE_INTVL value
3031
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3032
-
3033
- int
3034
- zsock_tcp_keepalive_intvl (void *self)
3035
- {
3036
- assert (self);
3037
- # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
3038
- int tcp_keepalive_intvl;
3039
- size_t option_len = sizeof (int);
3040
- zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_KEEPALIVE_INTVL, &tcp_keepalive_intvl, &option_len);
3041
- return tcp_keepalive_intvl;
3042
- # else
3043
- return 0;
3044
- # endif
3045
- }
3046
-
3047
- // --------------------------------------------------------------------------
3048
- // Set socket ZMQ_TCP_ACCEPT_FILTER value
3049
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3050
-
3051
- void
3052
- zsock_set_tcp_accept_filter (void *self, const char * tcp_accept_filter)
3053
- {
3054
- assert (self);
3055
- # if defined (ZMQ_TCP_ACCEPT_FILTER)
3056
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, strlen (tcp_accept_filter));
3057
- assert (rc == 0 || zmq_errno () == ETERM);
3058
- # endif
3059
- }
3060
-
3061
-
3062
- // --------------------------------------------------------------------------
3063
- // Return socket ZMQ_TCP_ACCEPT_FILTER value
3064
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3065
-
3066
- char *
3067
- zsock_tcp_accept_filter (void *self)
3068
- {
3069
- assert (self);
3070
- # if defined (ZMQ_TCP_ACCEPT_FILTER)
3071
- size_t option_len = 255;
3072
- char *tcp_accept_filter = (char *) zmalloc (option_len);
3073
- zmq_getsockopt (zsock_resolve (self), ZMQ_TCP_ACCEPT_FILTER, tcp_accept_filter, &option_len);
3074
- return (char *) tcp_accept_filter;
3075
- # else
3076
- return NULL;
3077
- # endif
3078
- }
3079
-
3080
- // --------------------------------------------------------------------------
3081
- // Return socket ZMQ_RCVMORE value
3082
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3083
-
3084
- int
3085
- zsock_rcvmore (void *self)
3086
- {
3087
- assert (self);
3088
- # if defined (ZMQ_RCVMORE)
3089
- int rcvmore;
3090
- size_t option_len = sizeof (int);
3091
- zmq_getsockopt (zsock_resolve (self), ZMQ_RCVMORE, &rcvmore, &option_len);
3092
- return rcvmore;
3093
- # else
3094
- return 0;
3095
- # endif
3096
- }
3097
-
3098
- // --------------------------------------------------------------------------
3099
- // Return socket ZMQ_FD value
3100
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3101
-
3102
- SOCKET
3103
- zsock_fd (void *self)
3104
- {
3105
- assert (self);
3106
- # if defined (ZMQ_FD)
3107
- SOCKET fd;
3108
- size_t option_len = sizeof (SOCKET);
3109
- zmq_getsockopt (zsock_resolve (self), ZMQ_FD, &fd, &option_len);
3110
- return fd;
3111
- # else
3112
- return 0;
3113
- # endif
3114
- }
3115
-
3116
- // --------------------------------------------------------------------------
3117
- // Return socket ZMQ_EVENTS value
3118
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3119
-
3120
- int
3121
- zsock_events (void *self)
3122
- {
3123
- assert (self);
3124
- # if defined (ZMQ_EVENTS)
3125
- int events;
3126
- size_t option_len = sizeof (int);
3127
- zmq_getsockopt (zsock_resolve (self), ZMQ_EVENTS, &events, &option_len);
3128
- return events;
3129
- # else
3130
- return 0;
3131
- # endif
3132
- }
3133
-
3134
- // --------------------------------------------------------------------------
3135
- // Return socket ZMQ_LAST_ENDPOINT value
3136
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3137
-
3138
- char *
3139
- zsock_last_endpoint (void *self)
3140
- {
3141
- assert (self);
3142
- # if defined (ZMQ_LAST_ENDPOINT)
3143
- size_t option_len = 255;
3144
- char *last_endpoint = (char *) zmalloc (option_len);
3145
- zmq_getsockopt (zsock_resolve (self), ZMQ_LAST_ENDPOINT, last_endpoint, &option_len);
3146
- return (char *) last_endpoint;
3147
- # else
3148
- return NULL;
3149
- # endif
3150
- }
3151
-
3152
- #endif
3153
-
3154
- #if (ZMQ_VERSION_MAJOR == 2)
3155
- // --------------------------------------------------------------------------
3156
- // Set socket ZMQ_HWM value
3157
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3158
-
3159
- void
3160
- zsock_set_hwm (void *self, int hwm)
3161
- {
3162
- assert (self);
3163
- # if defined (ZMQ_HWM)
3164
- uint64_t value = hwm;
3165
- int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_HWM, &value, sizeof (uint64_t));
3166
- assert (rc == 0 || zmq_errno () == ETERM);
3167
- # endif
3168
- }
3169
-
3170
-
3171
- // --------------------------------------------------------------------------
3172
- // Return socket ZMQ_HWM value
3173
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3174
-
3175
- int
3176
- zsock_hwm (void *self)
3177
- {
3178
- assert (self);
3179
- # if defined (ZMQ_HWM)
3180
- uint64_t hwm;
3181
- size_t option_len = sizeof (uint64_t);
3182
- zmq_getsockopt (zsock_resolve (self), ZMQ_HWM, &hwm, &option_len);
3183
- return (int) hwm;
3184
- # else
3185
- return 0;
3186
- # endif
3187
- }
3188
-
3189
- // --------------------------------------------------------------------------
3190
- // Set socket ZMQ_SWAP value
3191
- // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
3192
-
3193
- void
3194
- zsock_set_swap (void *self, int swap)
3214
+ zsock_set_swap (void *self, int swap)
3195
3215
  {
3196
3216
  assert (self);
3197
3217
  # if defined (ZMQ_SWAP)
3218
+ int major, minor, patch;
3219
+ zmq_version (&major, &minor, &patch);
3220
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3221
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3222
+ zsys_error ("zsock swap option not supported by libzmq version %d.%d.%d, "
3223
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3224
+ return;
3225
+ }
3198
3226
  int64_t value = swap;
3199
3227
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SWAP, &value, sizeof (int64_t));
3200
3228
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -3211,6 +3239,14 @@ zsock_swap (void *self)
3211
3239
  {
3212
3240
  assert (self);
3213
3241
  # if defined (ZMQ_SWAP)
3242
+ int major, minor, patch;
3243
+ zmq_version (&major, &minor, &patch);
3244
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3245
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3246
+ zsys_error ("zsock swap option not supported by libzmq version %d.%d.%d, "
3247
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3248
+ return 0;
3249
+ }
3214
3250
  int64_t swap;
3215
3251
  size_t option_len = sizeof (int64_t);
3216
3252
  zmq_getsockopt (zsock_resolve (self), ZMQ_SWAP, &swap, &option_len);
@@ -3229,6 +3265,14 @@ zsock_set_affinity (void *self, int affinity)
3229
3265
  {
3230
3266
  assert (self);
3231
3267
  # if defined (ZMQ_AFFINITY)
3268
+ int major, minor, patch;
3269
+ zmq_version (&major, &minor, &patch);
3270
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3271
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3272
+ zsys_error ("zsock affinity option not supported by libzmq version %d.%d.%d, "
3273
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3274
+ return;
3275
+ }
3232
3276
  uint64_t value = affinity;
3233
3277
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_AFFINITY, &value, sizeof (uint64_t));
3234
3278
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -3245,6 +3289,14 @@ zsock_affinity (void *self)
3245
3289
  {
3246
3290
  assert (self);
3247
3291
  # if defined (ZMQ_AFFINITY)
3292
+ int major, minor, patch;
3293
+ zmq_version (&major, &minor, &patch);
3294
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3295
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3296
+ zsys_error ("zsock affinity option not supported by libzmq version %d.%d.%d, "
3297
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3298
+ return 0;
3299
+ }
3248
3300
  uint64_t affinity;
3249
3301
  size_t option_len = sizeof (uint64_t);
3250
3302
  zmq_getsockopt (zsock_resolve (self), ZMQ_AFFINITY, &affinity, &option_len);
@@ -3263,6 +3315,14 @@ zsock_set_identity (void *self, const char * identity)
3263
3315
  {
3264
3316
  assert (self);
3265
3317
  # if defined (ZMQ_IDENTITY)
3318
+ int major, minor, patch;
3319
+ zmq_version (&major, &minor, &patch);
3320
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3321
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3322
+ zsys_error ("zsock identity option not supported by libzmq version %d.%d.%d, "
3323
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3324
+ return;
3325
+ }
3266
3326
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, strlen (identity));
3267
3327
  assert (rc == 0 || zmq_errno () == ETERM);
3268
3328
  # endif
@@ -3278,6 +3338,14 @@ zsock_identity (void *self)
3278
3338
  {
3279
3339
  assert (self);
3280
3340
  # if defined (ZMQ_IDENTITY)
3341
+ int major, minor, patch;
3342
+ zmq_version (&major, &minor, &patch);
3343
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3344
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3345
+ zsys_error ("zsock identity option not supported by libzmq version %d.%d.%d, "
3346
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3347
+ return 0;
3348
+ }
3281
3349
  size_t option_len = 255;
3282
3350
  char *identity = (char *) zmalloc (option_len);
3283
3351
  zmq_getsockopt (zsock_resolve (self), ZMQ_IDENTITY, identity, &option_len);
@@ -3296,6 +3364,14 @@ zsock_set_rate (void *self, int rate)
3296
3364
  {
3297
3365
  assert (self);
3298
3366
  # if defined (ZMQ_RATE)
3367
+ int major, minor, patch;
3368
+ zmq_version (&major, &minor, &patch);
3369
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3370
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3371
+ zsys_error ("zsock rate option not supported by libzmq version %d.%d.%d, "
3372
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3373
+ return;
3374
+ }
3299
3375
  int64_t value = rate;
3300
3376
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RATE, &value, sizeof (int64_t));
3301
3377
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -3312,6 +3388,14 @@ zsock_rate (void *self)
3312
3388
  {
3313
3389
  assert (self);
3314
3390
  # if defined (ZMQ_RATE)
3391
+ int major, minor, patch;
3392
+ zmq_version (&major, &minor, &patch);
3393
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3394
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3395
+ zsys_error ("zsock rate option not supported by libzmq version %d.%d.%d, "
3396
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3397
+ return 0;
3398
+ }
3315
3399
  int64_t rate;
3316
3400
  size_t option_len = sizeof (int64_t);
3317
3401
  zmq_getsockopt (zsock_resolve (self), ZMQ_RATE, &rate, &option_len);
@@ -3330,6 +3414,14 @@ zsock_set_recovery_ivl (void *self, int recovery_ivl)
3330
3414
  {
3331
3415
  assert (self);
3332
3416
  # if defined (ZMQ_RECOVERY_IVL)
3417
+ int major, minor, patch;
3418
+ zmq_version (&major, &minor, &patch);
3419
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3420
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3421
+ zsys_error ("zsock recovery_ivl option not supported by libzmq version %d.%d.%d, "
3422
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3423
+ return;
3424
+ }
3333
3425
  int64_t value = recovery_ivl;
3334
3426
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &value, sizeof (int64_t));
3335
3427
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -3346,6 +3438,14 @@ zsock_recovery_ivl (void *self)
3346
3438
  {
3347
3439
  assert (self);
3348
3440
  # if defined (ZMQ_RECOVERY_IVL)
3441
+ int major, minor, patch;
3442
+ zmq_version (&major, &minor, &patch);
3443
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3444
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3445
+ zsys_error ("zsock recovery_ivl option not supported by libzmq version %d.%d.%d, "
3446
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3447
+ return 0;
3448
+ }
3349
3449
  int64_t recovery_ivl;
3350
3450
  size_t option_len = sizeof (int64_t);
3351
3451
  zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL, &recovery_ivl, &option_len);
@@ -3364,6 +3464,14 @@ zsock_set_recovery_ivl_msec (void *self, int recovery_ivl_msec)
3364
3464
  {
3365
3465
  assert (self);
3366
3466
  # if defined (ZMQ_RECOVERY_IVL_MSEC)
3467
+ int major, minor, patch;
3468
+ zmq_version (&major, &minor, &patch);
3469
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3470
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3471
+ zsys_error ("zsock recovery_ivl_msec option not supported by libzmq version %d.%d.%d, "
3472
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3473
+ return;
3474
+ }
3367
3475
  int64_t value = recovery_ivl_msec;
3368
3476
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL_MSEC, &value, sizeof (int64_t));
3369
3477
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -3380,6 +3488,14 @@ zsock_recovery_ivl_msec (void *self)
3380
3488
  {
3381
3489
  assert (self);
3382
3490
  # if defined (ZMQ_RECOVERY_IVL_MSEC)
3491
+ int major, minor, patch;
3492
+ zmq_version (&major, &minor, &patch);
3493
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3494
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3495
+ zsys_error ("zsock recovery_ivl_msec option not supported by libzmq version %d.%d.%d, "
3496
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3497
+ return 0;
3498
+ }
3383
3499
  int64_t recovery_ivl_msec;
3384
3500
  size_t option_len = sizeof (int64_t);
3385
3501
  zmq_getsockopt (zsock_resolve (self), ZMQ_RECOVERY_IVL_MSEC, &recovery_ivl_msec, &option_len);
@@ -3398,6 +3514,14 @@ zsock_set_mcast_loop (void *self, int mcast_loop)
3398
3514
  {
3399
3515
  assert (self);
3400
3516
  # if defined (ZMQ_MCAST_LOOP)
3517
+ int major, minor, patch;
3518
+ zmq_version (&major, &minor, &patch);
3519
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3520
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3521
+ zsys_error ("zsock mcast_loop option not supported by libzmq version %d.%d.%d, "
3522
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3523
+ return;
3524
+ }
3401
3525
  int64_t value = mcast_loop;
3402
3526
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_MCAST_LOOP, &value, sizeof (int64_t));
3403
3527
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -3414,6 +3538,14 @@ zsock_mcast_loop (void *self)
3414
3538
  {
3415
3539
  assert (self);
3416
3540
  # if defined (ZMQ_MCAST_LOOP)
3541
+ int major, minor, patch;
3542
+ zmq_version (&major, &minor, &patch);
3543
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3544
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3545
+ zsys_error ("zsock mcast_loop option not supported by libzmq version %d.%d.%d, "
3546
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3547
+ return 0;
3548
+ }
3417
3549
  int64_t mcast_loop;
3418
3550
  size_t option_len = sizeof (int64_t);
3419
3551
  zmq_getsockopt (zsock_resolve (self), ZMQ_MCAST_LOOP, &mcast_loop, &option_len);
@@ -3423,7 +3555,6 @@ zsock_mcast_loop (void *self)
3423
3555
  # endif
3424
3556
  }
3425
3557
 
3426
- # if (ZMQ_VERSION_MINOR == 2)
3427
3558
  // --------------------------------------------------------------------------
3428
3559
  // Set socket ZMQ_RCVTIMEO value
3429
3560
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -3433,6 +3564,14 @@ zsock_set_rcvtimeo (void *self, int rcvtimeo)
3433
3564
  {
3434
3565
  assert (self);
3435
3566
  # if defined (ZMQ_RCVTIMEO)
3567
+ int major, minor, patch;
3568
+ zmq_version (&major, &minor, &patch);
3569
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)
3570
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3571
+ zsys_error ("zsock rcvtimeo option not supported by libzmq version %d.%d.%d, "
3572
+ "run with libzmq >= 2.2.0 and < 3.0.0\n", major, minor, patch, NULL);
3573
+ return;
3574
+ }
3436
3575
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, sizeof (int));
3437
3576
  assert (rc == 0 || zmq_errno () == ETERM);
3438
3577
  # endif
@@ -3448,6 +3587,14 @@ zsock_rcvtimeo (void *self)
3448
3587
  {
3449
3588
  assert (self);
3450
3589
  # if defined (ZMQ_RCVTIMEO)
3590
+ int major, minor, patch;
3591
+ zmq_version (&major, &minor, &patch);
3592
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)
3593
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3594
+ zsys_error ("zsock rcvtimeo option not supported by libzmq version %d.%d.%d, "
3595
+ "run with libzmq >= 2.2.0 and < 3.0.0\n", major, minor, patch, NULL);
3596
+ return 0;
3597
+ }
3451
3598
  int rcvtimeo;
3452
3599
  size_t option_len = sizeof (int);
3453
3600
  zmq_getsockopt (zsock_resolve (self), ZMQ_RCVTIMEO, &rcvtimeo, &option_len);
@@ -3457,8 +3604,6 @@ zsock_rcvtimeo (void *self)
3457
3604
  # endif
3458
3605
  }
3459
3606
 
3460
- # endif
3461
- # if (ZMQ_VERSION_MINOR == 2)
3462
3607
  // --------------------------------------------------------------------------
3463
3608
  // Set socket ZMQ_SNDTIMEO value
3464
3609
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -3468,6 +3613,14 @@ zsock_set_sndtimeo (void *self, int sndtimeo)
3468
3613
  {
3469
3614
  assert (self);
3470
3615
  # if defined (ZMQ_SNDTIMEO)
3616
+ int major, minor, patch;
3617
+ zmq_version (&major, &minor, &patch);
3618
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)
3619
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3620
+ zsys_error ("zsock sndtimeo option not supported by libzmq version %d.%d.%d, "
3621
+ "run with libzmq >= 2.2.0 and < 3.0.0\n", major, minor, patch, NULL);
3622
+ return;
3623
+ }
3471
3624
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, sizeof (int));
3472
3625
  assert (rc == 0 || zmq_errno () == ETERM);
3473
3626
  # endif
@@ -3483,6 +3636,14 @@ zsock_sndtimeo (void *self)
3483
3636
  {
3484
3637
  assert (self);
3485
3638
  # if defined (ZMQ_SNDTIMEO)
3639
+ int major, minor, patch;
3640
+ zmq_version (&major, &minor, &patch);
3641
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 2, 0)
3642
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3643
+ zsys_error ("zsock sndtimeo option not supported by libzmq version %d.%d.%d, "
3644
+ "run with libzmq >= 2.2.0 and < 3.0.0\n", major, minor, patch, NULL);
3645
+ return 0;
3646
+ }
3486
3647
  int sndtimeo;
3487
3648
  size_t option_len = sizeof (int);
3488
3649
  zmq_getsockopt (zsock_resolve (self), ZMQ_SNDTIMEO, &sndtimeo, &option_len);
@@ -3492,7 +3653,6 @@ zsock_sndtimeo (void *self)
3492
3653
  # endif
3493
3654
  }
3494
3655
 
3495
- # endif
3496
3656
  // --------------------------------------------------------------------------
3497
3657
  // Set socket ZMQ_SNDBUF value
3498
3658
  // *** GENERATED SOURCE CODE, DO NOT EDIT, SEE INSTRUCTIONS AT START ***
@@ -3502,6 +3662,14 @@ zsock_set_sndbuf (void *self, int sndbuf)
3502
3662
  {
3503
3663
  assert (self);
3504
3664
  # if defined (ZMQ_SNDBUF)
3665
+ int major, minor, patch;
3666
+ zmq_version (&major, &minor, &patch);
3667
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3668
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3669
+ zsys_error ("zsock sndbuf option not supported by libzmq version %d.%d.%d, "
3670
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3671
+ return;
3672
+ }
3505
3673
  uint64_t value = sndbuf;
3506
3674
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_SNDBUF, &value, sizeof (uint64_t));
3507
3675
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -3518,6 +3686,14 @@ zsock_sndbuf (void *self)
3518
3686
  {
3519
3687
  assert (self);
3520
3688
  # if defined (ZMQ_SNDBUF)
3689
+ int major, minor, patch;
3690
+ zmq_version (&major, &minor, &patch);
3691
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3692
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3693
+ zsys_error ("zsock sndbuf option not supported by libzmq version %d.%d.%d, "
3694
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3695
+ return 0;
3696
+ }
3521
3697
  uint64_t sndbuf;
3522
3698
  size_t option_len = sizeof (uint64_t);
3523
3699
  zmq_getsockopt (zsock_resolve (self), ZMQ_SNDBUF, &sndbuf, &option_len);
@@ -3536,6 +3712,14 @@ zsock_set_rcvbuf (void *self, int rcvbuf)
3536
3712
  {
3537
3713
  assert (self);
3538
3714
  # if defined (ZMQ_RCVBUF)
3715
+ int major, minor, patch;
3716
+ zmq_version (&major, &minor, &patch);
3717
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3718
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3719
+ zsys_error ("zsock rcvbuf option not supported by libzmq version %d.%d.%d, "
3720
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3721
+ return;
3722
+ }
3539
3723
  uint64_t value = rcvbuf;
3540
3724
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RCVBUF, &value, sizeof (uint64_t));
3541
3725
  assert (rc == 0 || zmq_errno () == ETERM);
@@ -3552,6 +3736,14 @@ zsock_rcvbuf (void *self)
3552
3736
  {
3553
3737
  assert (self);
3554
3738
  # if defined (ZMQ_RCVBUF)
3739
+ int major, minor, patch;
3740
+ zmq_version (&major, &minor, &patch);
3741
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3742
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3743
+ zsys_error ("zsock rcvbuf option not supported by libzmq version %d.%d.%d, "
3744
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3745
+ return 0;
3746
+ }
3555
3747
  uint64_t rcvbuf;
3556
3748
  size_t option_len = sizeof (uint64_t);
3557
3749
  zmq_getsockopt (zsock_resolve (self), ZMQ_RCVBUF, &rcvbuf, &option_len);
@@ -3570,6 +3762,14 @@ zsock_set_linger (void *self, int linger)
3570
3762
  {
3571
3763
  assert (self);
3572
3764
  # if defined (ZMQ_LINGER)
3765
+ int major, minor, patch;
3766
+ zmq_version (&major, &minor, &patch);
3767
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3768
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3769
+ zsys_error ("zsock linger option not supported by libzmq version %d.%d.%d, "
3770
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3771
+ return;
3772
+ }
3573
3773
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, sizeof (int));
3574
3774
  assert (rc == 0 || zmq_errno () == ETERM);
3575
3775
  # endif
@@ -3585,6 +3785,14 @@ zsock_linger (void *self)
3585
3785
  {
3586
3786
  assert (self);
3587
3787
  # if defined (ZMQ_LINGER)
3788
+ int major, minor, patch;
3789
+ zmq_version (&major, &minor, &patch);
3790
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3791
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3792
+ zsys_error ("zsock linger option not supported by libzmq version %d.%d.%d, "
3793
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3794
+ return 0;
3795
+ }
3588
3796
  int linger;
3589
3797
  size_t option_len = sizeof (int);
3590
3798
  zmq_getsockopt (zsock_resolve (self), ZMQ_LINGER, &linger, &option_len);
@@ -3603,6 +3811,14 @@ zsock_set_reconnect_ivl (void *self, int reconnect_ivl)
3603
3811
  {
3604
3812
  assert (self);
3605
3813
  # if defined (ZMQ_RECONNECT_IVL)
3814
+ int major, minor, patch;
3815
+ zmq_version (&major, &minor, &patch);
3816
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3817
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3818
+ zsys_error ("zsock reconnect_ivl option not supported by libzmq version %d.%d.%d, "
3819
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3820
+ return;
3821
+ }
3606
3822
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, sizeof (int));
3607
3823
  assert (rc == 0 || zmq_errno () == ETERM);
3608
3824
  # endif
@@ -3618,6 +3834,14 @@ zsock_reconnect_ivl (void *self)
3618
3834
  {
3619
3835
  assert (self);
3620
3836
  # if defined (ZMQ_RECONNECT_IVL)
3837
+ int major, minor, patch;
3838
+ zmq_version (&major, &minor, &patch);
3839
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3840
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3841
+ zsys_error ("zsock reconnect_ivl option not supported by libzmq version %d.%d.%d, "
3842
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3843
+ return 0;
3844
+ }
3621
3845
  int reconnect_ivl;
3622
3846
  size_t option_len = sizeof (int);
3623
3847
  zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL, &reconnect_ivl, &option_len);
@@ -3636,6 +3860,14 @@ zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max)
3636
3860
  {
3637
3861
  assert (self);
3638
3862
  # if defined (ZMQ_RECONNECT_IVL_MAX)
3863
+ int major, minor, patch;
3864
+ zmq_version (&major, &minor, &patch);
3865
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3866
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3867
+ zsys_error ("zsock reconnect_ivl_max option not supported by libzmq version %d.%d.%d, "
3868
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3869
+ return;
3870
+ }
3639
3871
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, sizeof (int));
3640
3872
  assert (rc == 0 || zmq_errno () == ETERM);
3641
3873
  # endif
@@ -3651,6 +3883,14 @@ zsock_reconnect_ivl_max (void *self)
3651
3883
  {
3652
3884
  assert (self);
3653
3885
  # if defined (ZMQ_RECONNECT_IVL_MAX)
3886
+ int major, minor, patch;
3887
+ zmq_version (&major, &minor, &patch);
3888
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3889
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3890
+ zsys_error ("zsock reconnect_ivl_max option not supported by libzmq version %d.%d.%d, "
3891
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3892
+ return 0;
3893
+ }
3654
3894
  int reconnect_ivl_max;
3655
3895
  size_t option_len = sizeof (int);
3656
3896
  zmq_getsockopt (zsock_resolve (self), ZMQ_RECONNECT_IVL_MAX, &reconnect_ivl_max, &option_len);
@@ -3669,6 +3909,14 @@ zsock_set_backlog (void *self, int backlog)
3669
3909
  {
3670
3910
  assert (self);
3671
3911
  # if defined (ZMQ_BACKLOG)
3912
+ int major, minor, patch;
3913
+ zmq_version (&major, &minor, &patch);
3914
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3915
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3916
+ zsys_error ("zsock backlog option not supported by libzmq version %d.%d.%d, "
3917
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3918
+ return;
3919
+ }
3672
3920
  int rc = zmq_setsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, sizeof (int));
3673
3921
  assert (rc == 0 || zmq_errno () == ETERM);
3674
3922
  # endif
@@ -3684,6 +3932,14 @@ zsock_backlog (void *self)
3684
3932
  {
3685
3933
  assert (self);
3686
3934
  # if defined (ZMQ_BACKLOG)
3935
+ int major, minor, patch;
3936
+ zmq_version (&major, &minor, &patch);
3937
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3938
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3939
+ zsys_error ("zsock backlog option not supported by libzmq version %d.%d.%d, "
3940
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3941
+ return 0;
3942
+ }
3687
3943
  int backlog;
3688
3944
  size_t option_len = sizeof (int);
3689
3945
  zmq_getsockopt (zsock_resolve (self), ZMQ_BACKLOG, &backlog, &option_len);
@@ -3702,6 +3958,14 @@ zsock_set_subscribe (void *self, const char * subscribe)
3702
3958
  {
3703
3959
  assert (self);
3704
3960
  # if defined (ZMQ_SUBSCRIBE)
3961
+ int major, minor, patch;
3962
+ zmq_version (&major, &minor, &patch);
3963
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3964
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3965
+ zsys_error ("zsock subscribe option not supported by libzmq version %d.%d.%d, "
3966
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3967
+ return;
3968
+ }
3705
3969
  if (zsock_type (self) != ZMQ_SUB) {
3706
3970
  printf ("ZMQ_SUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
3707
3971
  assert (false);
@@ -3721,6 +3985,14 @@ zsock_set_unsubscribe (void *self, const char * unsubscribe)
3721
3985
  {
3722
3986
  assert (self);
3723
3987
  # if defined (ZMQ_UNSUBSCRIBE)
3988
+ int major, minor, patch;
3989
+ zmq_version (&major, &minor, &patch);
3990
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
3991
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
3992
+ zsys_error ("zsock unsubscribe option not supported by libzmq version %d.%d.%d, "
3993
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
3994
+ return;
3995
+ }
3724
3996
  if (zsock_type (self) != ZMQ_SUB) {
3725
3997
  printf ("ZMQ_UNSUBSCRIBE is not valid on %s sockets\n", zsys_sockname (zsock_type (self)));
3726
3998
  assert (false);
@@ -3740,6 +4012,14 @@ zsock_type (void *self)
3740
4012
  {
3741
4013
  assert (self);
3742
4014
  # if defined (ZMQ_TYPE)
4015
+ int major, minor, patch;
4016
+ zmq_version (&major, &minor, &patch);
4017
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
4018
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
4019
+ zsys_error ("zsock type option not supported by libzmq version %d.%d.%d, "
4020
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
4021
+ return 0;
4022
+ }
3743
4023
  int type;
3744
4024
  size_t option_len = sizeof (int);
3745
4025
  zmq_getsockopt (zsock_resolve (self), ZMQ_TYPE, &type, &option_len);
@@ -3758,6 +4038,14 @@ zsock_rcvmore (void *self)
3758
4038
  {
3759
4039
  assert (self);
3760
4040
  # if defined (ZMQ_RCVMORE)
4041
+ int major, minor, patch;
4042
+ zmq_version (&major, &minor, &patch);
4043
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
4044
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
4045
+ zsys_error ("zsock rcvmore option not supported by libzmq version %d.%d.%d, "
4046
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
4047
+ return 0;
4048
+ }
3761
4049
  int64_t rcvmore;
3762
4050
  size_t option_len = sizeof (int64_t);
3763
4051
  zmq_getsockopt (zsock_resolve (self), ZMQ_RCVMORE, &rcvmore, &option_len);
@@ -3776,6 +4064,14 @@ zsock_fd (void *self)
3776
4064
  {
3777
4065
  assert (self);
3778
4066
  # if defined (ZMQ_FD)
4067
+ int major, minor, patch;
4068
+ zmq_version (&major, &minor, &patch);
4069
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
4070
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
4071
+ zsys_error ("zsock fd option not supported by libzmq version %d.%d.%d, "
4072
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
4073
+ return 0;
4074
+ }
3779
4075
  SOCKET fd;
3780
4076
  size_t option_len = sizeof (SOCKET);
3781
4077
  zmq_getsockopt (zsock_resolve (self), ZMQ_FD, &fd, &option_len);
@@ -3794,6 +4090,14 @@ zsock_events (void *self)
3794
4090
  {
3795
4091
  assert (self);
3796
4092
  # if defined (ZMQ_EVENTS)
4093
+ int major, minor, patch;
4094
+ zmq_version (&major, &minor, &patch);
4095
+ if (ZMQ_MAKE_VERSION (major, minor, patch) < ZMQ_MAKE_VERSION (2, 0, 0)
4096
+ || ZMQ_MAKE_VERSION (major, minor, patch) >= ZMQ_MAKE_VERSION (3, 0, 0)) {
4097
+ zsys_error ("zsock events option not supported by libzmq version %d.%d.%d, "
4098
+ "run with libzmq >= 2.0.0 and < 3.0.0\n", major, minor, patch, NULL);
4099
+ return 0;
4100
+ }
3797
4101
  uint32_t events;
3798
4102
  size_t option_len = sizeof (uint32_t);
3799
4103
  zmq_getsockopt (zsock_resolve (self), ZMQ_EVENTS, &events, &option_len);
@@ -3816,7 +4120,8 @@ zsock_option_test (bool verbose)
3816
4120
 
3817
4121
  // @selftest
3818
4122
  zsock_t *self;
3819
- #if (ZMQ_VERSION_MAJOR == 4)
4123
+ #if (ZMQ_VERSION_MAJOR >= 4)
4124
+ # if (ZMQ_VERSION_MINOR >= 2)
3820
4125
  # if defined (ZMQ_HEARTBEAT_IVL)
3821
4126
  self = zsock_new (ZMQ_DEALER);
3822
4127
  assert (self);
@@ -3911,6 +4216,11 @@ zsock_option_test (bool verbose)
3911
4216
  zsock_multicast_maxtpdu (self);
3912
4217
  zsock_destroy (&self);
3913
4218
  # endif
4219
+ # endif
4220
+ #endif
4221
+
4222
+ #if (ZMQ_VERSION_MAJOR >= 4)
4223
+ # if (ZMQ_VERSION_MINOR >= 1)
3914
4224
  # if defined (ZMQ_TOS)
3915
4225
  self = zsock_new (ZMQ_DEALER);
3916
4226
  assert (self);
@@ -3954,6 +4264,10 @@ zsock_option_test (bool verbose)
3954
4264
  zsock_set_xpub_nodrop (self, 1);
3955
4265
  zsock_destroy (&self);
3956
4266
  # endif
4267
+ # endif
4268
+ #endif
4269
+
4270
+ #if (ZMQ_VERSION_MAJOR >= 4)
3957
4271
  # if defined (ZMQ_ROUTER_MANDATORY)
3958
4272
  self = zsock_new (ZMQ_ROUTER);
3959
4273
  assert (self);
@@ -4041,26 +4355,9 @@ zsock_option_test (bool verbose)
4041
4355
  zsock_immediate (self);
4042
4356
  zsock_destroy (&self);
4043
4357
  # endif
4044
- # if defined (ZMQ_ROUTER_RAW)
4045
- self = zsock_new (ZMQ_ROUTER);
4046
- assert (self);
4047
- zsock_set_router_raw (self, 1);
4048
- zsock_destroy (&self);
4049
- # endif
4050
- # if defined (ZMQ_IPV4ONLY)
4051
- self = zsock_new (ZMQ_SUB);
4052
- assert (self);
4053
- zsock_set_ipv4only (self, 1);
4054
- assert (zsock_ipv4only (self) == 1);
4055
- zsock_ipv4only (self);
4056
- zsock_destroy (&self);
4057
- # endif
4058
- # if defined (ZMQ_DELAY_ATTACH_ON_CONNECT)
4059
- self = zsock_new (ZMQ_PUB);
4060
- assert (self);
4061
- zsock_set_delay_attach_on_connect (self, 1);
4062
- zsock_destroy (&self);
4063
- # endif
4358
+ #endif
4359
+
4360
+ #if (ZMQ_VERSION_MAJOR >= 3)
4064
4361
  # if defined (ZMQ_TYPE)
4065
4362
  self = zsock_new (ZMQ_SUB);
4066
4363
  assert (self);
@@ -4281,9 +4578,6 @@ zsock_option_test (bool verbose)
4281
4578
  free (last_endpoint);
4282
4579
  zsock_destroy (&self);
4283
4580
  # endif
4284
- #endif
4285
-
4286
- #if (ZMQ_VERSION_MAJOR == 3)
4287
4581
  # if defined (ZMQ_ROUTER_RAW)
4288
4582
  self = zsock_new (ZMQ_ROUTER);
4289
4583
  assert (self);
@@ -4304,229 +4598,9 @@ zsock_option_test (bool verbose)
4304
4598
  zsock_set_delay_attach_on_connect (self, 1);
4305
4599
  zsock_destroy (&self);
4306
4600
  # endif
4307
- # if defined (ZMQ_TYPE)
4308
- self = zsock_new (ZMQ_SUB);
4309
- assert (self);
4310
- zsock_type (self);
4311
- zsock_destroy (&self);
4312
- # endif
4313
- # if defined (ZMQ_SNDHWM)
4314
- self = zsock_new (ZMQ_PUB);
4315
- assert (self);
4316
- zsock_set_sndhwm (self, 1);
4317
- assert (zsock_sndhwm (self) == 1);
4318
- zsock_sndhwm (self);
4319
- zsock_destroy (&self);
4320
- # endif
4321
- # if defined (ZMQ_RCVHWM)
4322
- self = zsock_new (ZMQ_SUB);
4323
- assert (self);
4324
- zsock_set_rcvhwm (self, 1);
4325
- assert (zsock_rcvhwm (self) == 1);
4326
- zsock_rcvhwm (self);
4327
- zsock_destroy (&self);
4328
- # endif
4329
- # if defined (ZMQ_AFFINITY)
4330
- self = zsock_new (ZMQ_SUB);
4331
- assert (self);
4332
- zsock_set_affinity (self, 1);
4333
- assert (zsock_affinity (self) == 1);
4334
- zsock_affinity (self);
4335
- zsock_destroy (&self);
4336
- # endif
4337
- # if defined (ZMQ_SUBSCRIBE)
4338
- self = zsock_new (ZMQ_SUB);
4339
- assert (self);
4340
- zsock_set_subscribe (self, "test");
4341
- zsock_destroy (&self);
4342
- # endif
4343
- # if defined (ZMQ_UNSUBSCRIBE)
4344
- self = zsock_new (ZMQ_SUB);
4345
- assert (self);
4346
- zsock_set_unsubscribe (self, "test");
4347
- zsock_destroy (&self);
4348
- # endif
4349
- # if defined (ZMQ_IDENTITY)
4350
- self = zsock_new (ZMQ_DEALER);
4351
- assert (self);
4352
- zsock_set_identity (self, "test");
4353
- char *identity = zsock_identity (self);
4354
- assert (identity);
4355
- free (identity);
4356
- zsock_destroy (&self);
4357
- # endif
4358
- # if defined (ZMQ_RATE)
4359
- self = zsock_new (ZMQ_SUB);
4360
- assert (self);
4361
- zsock_set_rate (self, 1);
4362
- assert (zsock_rate (self) == 1);
4363
- zsock_rate (self);
4364
- zsock_destroy (&self);
4365
- # endif
4366
- # if defined (ZMQ_RECOVERY_IVL)
4367
- self = zsock_new (ZMQ_SUB);
4368
- assert (self);
4369
- zsock_set_recovery_ivl (self, 1);
4370
- assert (zsock_recovery_ivl (self) == 1);
4371
- zsock_recovery_ivl (self);
4372
- zsock_destroy (&self);
4373
- # endif
4374
- # if defined (ZMQ_SNDBUF)
4375
- self = zsock_new (ZMQ_PUB);
4376
- assert (self);
4377
- zsock_set_sndbuf (self, 1);
4378
- assert (zsock_sndbuf (self) == 1);
4379
- zsock_sndbuf (self);
4380
- zsock_destroy (&self);
4381
- # endif
4382
- # if defined (ZMQ_RCVBUF)
4383
- self = zsock_new (ZMQ_SUB);
4384
- assert (self);
4385
- zsock_set_rcvbuf (self, 1);
4386
- assert (zsock_rcvbuf (self) == 1);
4387
- zsock_rcvbuf (self);
4388
- zsock_destroy (&self);
4389
- # endif
4390
- # if defined (ZMQ_LINGER)
4391
- self = zsock_new (ZMQ_SUB);
4392
- assert (self);
4393
- zsock_set_linger (self, 1);
4394
- assert (zsock_linger (self) == 1);
4395
- zsock_linger (self);
4396
- zsock_destroy (&self);
4397
- # endif
4398
- # if defined (ZMQ_RECONNECT_IVL)
4399
- self = zsock_new (ZMQ_SUB);
4400
- assert (self);
4401
- zsock_set_reconnect_ivl (self, 1);
4402
- assert (zsock_reconnect_ivl (self) == 1);
4403
- zsock_reconnect_ivl (self);
4404
- zsock_destroy (&self);
4405
- # endif
4406
- # if defined (ZMQ_RECONNECT_IVL_MAX)
4407
- self = zsock_new (ZMQ_SUB);
4408
- assert (self);
4409
- zsock_set_reconnect_ivl_max (self, 1);
4410
- assert (zsock_reconnect_ivl_max (self) == 1);
4411
- zsock_reconnect_ivl_max (self);
4412
- zsock_destroy (&self);
4413
- # endif
4414
- # if defined (ZMQ_BACKLOG)
4415
- self = zsock_new (ZMQ_SUB);
4416
- assert (self);
4417
- zsock_set_backlog (self, 1);
4418
- assert (zsock_backlog (self) == 1);
4419
- zsock_backlog (self);
4420
- zsock_destroy (&self);
4421
- # endif
4422
- # if defined (ZMQ_MAXMSGSIZE)
4423
- self = zsock_new (ZMQ_SUB);
4424
- assert (self);
4425
- zsock_set_maxmsgsize (self, 1);
4426
- assert (zsock_maxmsgsize (self) == 1);
4427
- zsock_maxmsgsize (self);
4428
- zsock_destroy (&self);
4429
- # endif
4430
- # if defined (ZMQ_MULTICAST_HOPS)
4431
- self = zsock_new (ZMQ_SUB);
4432
- assert (self);
4433
- zsock_set_multicast_hops (self, 1);
4434
- assert (zsock_multicast_hops (self) == 1);
4435
- zsock_multicast_hops (self);
4436
- zsock_destroy (&self);
4437
- # endif
4438
- # if defined (ZMQ_RCVTIMEO)
4439
- self = zsock_new (ZMQ_SUB);
4440
- assert (self);
4441
- zsock_set_rcvtimeo (self, 1);
4442
- assert (zsock_rcvtimeo (self) == 1);
4443
- zsock_rcvtimeo (self);
4444
- zsock_destroy (&self);
4445
- # endif
4446
- # if defined (ZMQ_SNDTIMEO)
4447
- self = zsock_new (ZMQ_SUB);
4448
- assert (self);
4449
- zsock_set_sndtimeo (self, 1);
4450
- assert (zsock_sndtimeo (self) == 1);
4451
- zsock_sndtimeo (self);
4452
- zsock_destroy (&self);
4453
- # endif
4454
- # if defined (ZMQ_XPUB_VERBOSE)
4455
- self = zsock_new (ZMQ_XPUB);
4456
- assert (self);
4457
- zsock_set_xpub_verbose (self, 1);
4458
- zsock_destroy (&self);
4459
- # endif
4460
- # if defined (ZMQ_TCP_KEEPALIVE)
4461
- self = zsock_new (ZMQ_SUB);
4462
- assert (self);
4463
- zsock_set_tcp_keepalive (self, 1);
4464
- assert (zsock_tcp_keepalive (self) == 1);
4465
- zsock_tcp_keepalive (self);
4466
- zsock_destroy (&self);
4467
- # endif
4468
- # if defined (ZMQ_TCP_KEEPALIVE_IDLE)
4469
- self = zsock_new (ZMQ_SUB);
4470
- assert (self);
4471
- zsock_set_tcp_keepalive_idle (self, 1);
4472
- assert (zsock_tcp_keepalive_idle (self) == 1);
4473
- zsock_tcp_keepalive_idle (self);
4474
- zsock_destroy (&self);
4475
- # endif
4476
- # if defined (ZMQ_TCP_KEEPALIVE_CNT)
4477
- self = zsock_new (ZMQ_SUB);
4478
- assert (self);
4479
- zsock_set_tcp_keepalive_cnt (self, 1);
4480
- assert (zsock_tcp_keepalive_cnt (self) == 1);
4481
- zsock_tcp_keepalive_cnt (self);
4482
- zsock_destroy (&self);
4483
- # endif
4484
- # if defined (ZMQ_TCP_KEEPALIVE_INTVL)
4485
- self = zsock_new (ZMQ_SUB);
4486
- assert (self);
4487
- zsock_set_tcp_keepalive_intvl (self, 1);
4488
- assert (zsock_tcp_keepalive_intvl (self) == 1);
4489
- zsock_tcp_keepalive_intvl (self);
4490
- zsock_destroy (&self);
4491
- # endif
4492
- # if defined (ZMQ_TCP_ACCEPT_FILTER)
4493
- self = zsock_new (ZMQ_SUB);
4494
- assert (self);
4495
- zsock_set_tcp_accept_filter (self, "127.0.0.1");
4496
- char *tcp_accept_filter = zsock_tcp_accept_filter (self);
4497
- assert (tcp_accept_filter);
4498
- free (tcp_accept_filter);
4499
- zsock_destroy (&self);
4500
- # endif
4501
- # if defined (ZMQ_RCVMORE)
4502
- self = zsock_new (ZMQ_SUB);
4503
- assert (self);
4504
- zsock_rcvmore (self);
4505
- zsock_destroy (&self);
4506
- # endif
4507
- # if defined (ZMQ_FD)
4508
- self = zsock_new (ZMQ_SUB);
4509
- assert (self);
4510
- zsock_fd (self);
4511
- zsock_destroy (&self);
4512
- # endif
4513
- # if defined (ZMQ_EVENTS)
4514
- self = zsock_new (ZMQ_SUB);
4515
- assert (self);
4516
- zsock_events (self);
4517
- zsock_destroy (&self);
4518
- # endif
4519
- # if defined (ZMQ_LAST_ENDPOINT)
4520
- self = zsock_new (ZMQ_SUB);
4521
- assert (self);
4522
- char *last_endpoint = zsock_last_endpoint (self);
4523
- assert (last_endpoint);
4524
- free (last_endpoint);
4525
- zsock_destroy (&self);
4526
- # endif
4527
4601
  #endif
4528
4602
 
4529
- #if (ZMQ_VERSION_MAJOR == 2)
4603
+ #if (ZMQ_VERSION_MAJOR >= 2) && (ZMQ_VERSION_MAJOR < 3)
4530
4604
  # if defined (ZMQ_HWM)
4531
4605
  self = zsock_new (ZMQ_SUB);
4532
4606
  assert (self);
@@ -4592,7 +4666,6 @@ zsock_option_test (bool verbose)
4592
4666
  zsock_mcast_loop (self);
4593
4667
  zsock_destroy (&self);
4594
4668
  # endif
4595
- # if (ZMQ_VERSION_MINOR == 2)
4596
4669
  # if defined (ZMQ_RCVTIMEO)
4597
4670
  self = zsock_new (ZMQ_SUB);
4598
4671
  assert (self);
@@ -4601,8 +4674,6 @@ zsock_option_test (bool verbose)
4601
4674
  zsock_rcvtimeo (self);
4602
4675
  zsock_destroy (&self);
4603
4676
  # endif
4604
- # endif
4605
- # if (ZMQ_VERSION_MINOR == 2)
4606
4677
  # if defined (ZMQ_SNDTIMEO)
4607
4678
  self = zsock_new (ZMQ_SUB);
4608
4679
  assert (self);
@@ -4611,7 +4682,6 @@ zsock_option_test (bool verbose)
4611
4682
  zsock_sndtimeo (self);
4612
4683
  zsock_destroy (&self);
4613
4684
  # endif
4614
- # endif
4615
4685
  # if defined (ZMQ_SNDBUF)
4616
4686
  self = zsock_new (ZMQ_SUB);
4617
4687
  assert (self);