/
F08_ZMQ.f90
executable file
·1372 lines (1250 loc) · 58.8 KB
/
F08_ZMQ.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module m_zmq
use, intrinsic :: iso_c_binding
implicit none
! /* Version macros for compile-time API version detection */
!#define ZMQ_VERSION_MAJOR 4
!#define ZMQ_VERSION_MINOR 3
!#define ZMQ_VERSION_PATCH 1
!
!#define ZMQ_MAKE_VERSION(major, minor, patch) \
! ((major) *10000 + (minor) *100 + (patch))
!#define ZMQ_VERSION \
! ZMQ_MAKE_VERSION (ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH)
integer(c_int), parameter :: ZMQ_VERSION_MAJOR = 4
integer(c_int), parameter :: ZMQ_VERSION_MINOR = 3
integer(c_int), parameter :: ZMQ_VERSION_PATCH = 1
! name duplication due to case insensitivity ZMQ_VERSION ==> ZMQ_VERSION_
integer(c_int), parameter :: ZMQ_VERSION_ = ZMQ_VERSION_MAJOR * 10000 + ZMQ_VERSION_MINOR * 100 + ZMQ_VERSION_PATCH
!/******************************************************************************/
!/* 0MQ errors. */
!/******************************************************************************/
!
!/* A number random enough not to collide with different errno ranges on */
!/* different OSes. The assumption is that error_t is at least 32-bit type. */
!#define ZMQ_HAUSNUMERO 156384712
integer(c_int), parameter :: ZMQ_HAUSNUMERO = 156384712
!
!/* On Windows platform some of the standard POSIX errnos are not defined. */
!#ifndef ENOTSUP
!#define ENOTSUP (ZMQ_HAUSNUMERO + 1)
!#endif
!#ifndef EPROTONOSUPPORT
!#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2)
!#endif
!#ifndef ENOBUFS
!#define ENOBUFS (ZMQ_HAUSNUMERO + 3)
!#endif
!#ifndef ENETDOWN
!#define ENETDOWN (ZMQ_HAUSNUMERO + 4)
!#endif
!#ifndef EADDRINUSE
!#define EADDRINUSE (ZMQ_HAUSNUMERO + 5)
!#endif
!#ifndef EADDRNOTAVAIL
!#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6)
!#endif
!#ifndef ECONNREFUSED
!#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7)
!#endif
!#ifndef EINPROGRESS
!#define EINPROGRESS (ZMQ_HAUSNUMERO + 8)
!#endif
!#ifndef ENOTSOCK
!#define ENOTSOCK (ZMQ_HAUSNUMERO + 9)
!#endif
!#ifndef EMSGSIZE
!#define EMSGSIZE (ZMQ_HAUSNUMERO + 10)
!#endif
!#ifndef EAFNOSUPPORT
!#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11)
!#endif
!#ifndef ENETUNREACH
!#define ENETUNREACH (ZMQ_HAUSNUMERO + 12)
!#endif
!#ifndef ECONNABORTED
!#define ECONNABORTED (ZMQ_HAUSNUMERO + 13)
!#endif
!#ifndef ECONNRESET
!#define ECONNRESET (ZMQ_HAUSNUMERO + 14)
!#endif
!#ifndef ENOTCONN
!#define ENOTCONN (ZMQ_HAUSNUMERO + 15)
!#endif
!#ifndef ETIMEDOUT
!#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16)
!#endif
!#ifndef EHOSTUNREACH
!#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17)
!#endif
!#ifndef ENETRESET
!#define ENETRESET (ZMQ_HAUSNUMERO + 18)
!#endif
integer(c_int), parameter :: ENOTSUP = (ZMQ_HAUSNUMERO + 1)
integer(c_int), parameter :: EPROTONOSUPPORT = (ZMQ_HAUSNUMERO + 2)
integer(c_int), parameter :: ENOBUFS = (ZMQ_HAUSNUMERO + 3)
integer(c_int), parameter :: ENETDOWN = (ZMQ_HAUSNUMERO + 4)
integer(c_int), parameter :: EADDRINUSE = (ZMQ_HAUSNUMERO + 5)
integer(c_int), parameter :: EADDRNOTAVAIL = (ZMQ_HAUSNUMERO + 6)
integer(c_int), parameter :: ECONNREFUSED = (ZMQ_HAUSNUMERO + 7)
integer(c_int), parameter :: EINPROGRESS = (ZMQ_HAUSNUMERO + 8)
integer(c_int), parameter :: ENOTSOCK = (ZMQ_HAUSNUMERO + 9)
integer(c_int), parameter :: EMSGSIZE = (ZMQ_HAUSNUMERO + 10)
integer(c_int), parameter :: EAFNOSUPPORT = (ZMQ_HAUSNUMERO + 11)
integer(c_int), parameter :: ENETUNREACH = (ZMQ_HAUSNUMERO + 12)
integer(c_int), parameter :: ECONNABORTED = (ZMQ_HAUSNUMERO + 13)
integer(c_int), parameter :: ECONNRESET = (ZMQ_HAUSNUMERO + 14)
integer(c_int), parameter :: ENOTCONN = (ZMQ_HAUSNUMERO + 15)
integer(c_int), parameter :: ETIMEDOUT = (ZMQ_HAUSNUMERO + 16)
integer(c_int), parameter :: EHOSTUNREACH = (ZMQ_HAUSNUMERO + 17)
integer(c_int), parameter :: ENETRESET = (ZMQ_HAUSNUMERO + 18)
!
!/* Native 0MQ error codes. */
!#define EFSM (ZMQ_HAUSNUMERO + 51)
!#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52)
!#define ETERM (ZMQ_HAUSNUMERO + 53)
!#define EMTHREAD (ZMQ_HAUSNUMERO + 54)
integer(c_int), parameter :: EFSM = (ZMQ_HAUSNUMERO + 51)
integer(c_int), parameter :: ENOCOMPATPROTO = (ZMQ_HAUSNUMERO + 52)
integer(c_int), parameter :: ETERM = (ZMQ_HAUSNUMERO + 53)
integer(c_int), parameter :: EMTHREAD = (ZMQ_HAUSNUMERO + 54)
!/* This function retrieves the errno as it is known to 0MQ library. The goal */
!/* of this function is to make the code 100% portable, including where 0MQ */
!/* compiled with certain CRT library (on Windows) is linked to an */
!/* application that uses different CRT library. */
!ZMQ_EXPORT int zmq_errno (void);
interface
integer(c_int) function zmq_errno() bind(c)
use, intrinsic :: iso_c_binding
end function zmq_errno
end interface
!
!/* Resolves system errors and 0MQ errors to human-readable string. */
!ZMQ_EXPORT const char *zmq_strerror (int errnum_);
interface
type(c_ptr) function zmq_strerror_c(errnum_) bind(c, name = 'zmq_strerror')
use, intrinsic :: iso_c_binding
integer(c_int), value :: errnum_
end function zmq_strerror_c
end interface
!
! contains->
!
!/* Run-time API version detection */
!ZMQ_EXPORT void zmq_version (int *major_, int *minor_, int *patch_);
interface
subroutine zmq_version(major_, minor_, patch_) bind(c)
use, intrinsic :: iso_c_binding
integer(c_int), intent(out) :: major_, minor_, patch_
end subroutine zmq_version
end interface
!/******************************************************************************/
!/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */
!/******************************************************************************/
!
!/* Context options */
!#define ZMQ_IO_THREADS 1
!#define ZMQ_MAX_SOCKETS 2
!#define ZMQ_SOCKET_LIMIT 3
!#define ZMQ_THREAD_PRIORITY 3
!#define ZMQ_THREAD_SCHED_POLICY 4
!#define ZMQ_MAX_MSGSZ 5
!#define ZMQ_MSG_T_SIZE 6
!#define ZMQ_THREAD_AFFINITY_CPU_ADD 7
!#define ZMQ_THREAD_AFFINITY_CPU_REMOVE 8
!#define ZMQ_THREAD_NAME_PREFIX 9
integer(c_int), parameter :: ZMQ_IO_THREADS = 1
integer(c_int), parameter :: ZMQ_MAX_SOCKETS = 2
integer(c_int), parameter :: ZMQ_SOCKET_LIMIT = 3
integer(c_int), parameter :: ZMQ_THREAD_PRIORITY = 3
integer(c_int), parameter :: ZMQ_THREAD_SCHED_POLICY = 4
integer(c_int), parameter :: ZMQ_MAX_MSGSZ = 5
integer(c_int), parameter :: ZMQ_MSG_T_SIZE = 6
integer(c_int), parameter :: ZMQ_THREAD_AFFINITY_CPU_ADD = 7
integer(c_int), parameter :: ZMQ_THREAD_AFFINITY_CPU_REMOVE = 8
integer(c_int), parameter :: ZMQ_THREAD_NAME_PREFIX = 9
!
!/* Default for new contexts */
!#define ZMQ_IO_THREADS_DFLT 1
!#define ZMQ_MAX_SOCKETS_DFLT 1023
!#define ZMQ_THREAD_PRIORITY_DFLT -1
!#define ZMQ_THREAD_SCHED_POLICY_DFLT -1
integer(c_int), parameter :: ZMQ_IO_THREADS_DFLT = 1
integer(c_int), parameter :: ZMQ_MAX_SOCKETS_DFLT = 1023
integer(c_int), parameter :: ZMQ_THREAD_PRIORITY_DFLT = -1
integer(c_int), parameter :: ZMQ_THREAD_SCHED_POLICY_DFLT = -1
!ZMQ_EXPORT void *zmq_ctx_new (void);
!ZMQ_EXPORT int zmq_ctx_term (void *context_);
!ZMQ_EXPORT int zmq_ctx_shutdown (void *context_);
!ZMQ_EXPORT int zmq_ctx_set (void *context_, int option_, int optval_);
!ZMQ_EXPORT int zmq_ctx_get (void *context_, int option_);
interface
! c.f. cray pointer integer(ictx, ctx)
!
! type(c_ptr) :: ctx <--address
! integer, pointer :: ictx
! call c_f_pointer(ctx, ictx) ! integer, intent(in) :: context; ictx => context_
!
type(c_ptr) function zmq_ctx_new() bind(c)
use, intrinsic :: iso_c_binding
end function zmq_ctx_new
integer(c_int) function zmq_ctx_term(context_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: context_
end function zmq_ctx_term
integer(c_int) function zmq_ctx_shutdown(context_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: context_
end function zmq_ctx_shutdown
integer(c_int) function zmq_ctx_set(context_, option_, optval_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: context_
integer(c_int), value :: option_, optval_
end function zmq_ctx_set
integer(c_int) function zmq_ctx_get(context_, option_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: context_
integer(c_int), value :: option_
end function zmq_ctx_get
end interface
!
!/* Old (legacy) API */
!ZMQ_EXPORT void *zmq_init (int io_threads_);
!ZMQ_EXPORT int zmq_term (void *context_);
!ZMQ_EXPORT int zmq_ctx_destroy (void *context_);
interface
type(c_ptr) function zmq_init(io_threads_) bind(c)
use, intrinsic :: iso_c_binding
integer(c_int), value :: io_threads_
end function zmq_init
integer(c_int) function zmq_term(context_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: context_
end function zmq_term
integer(c_int) function zmq_ctx_destroy(context_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: context_
end function zmq_ctx_destroy
end interface
!
!/******************************************************************************/
!/* 0MQ message definition. */
!/******************************************************************************/
!
!/* Some architectures, like sparc64 and some variants of aarch64, enforce pointer
! * alignment and raise sigbus on violations. Make sure applications allocate
! * zmq_msg_t on addresses aligned on a pointer-size boundary to avoid this issue.
! */
!typedef struct zmq_msg_t
!{
!#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
! __declspec(align (8)) unsigned char _[64];
!#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_ARM_ARMV7VE))
! __declspec(align (4)) unsigned char _[64];
!#elif defined(__GNUC__) || defined(__INTEL_COMPILER) \
! || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x590) \
! || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
! unsigned char _[64] __attribute__ ((aligned (sizeof (void *))));
!#else
! unsigned char _[64];
!#endif
!} zmq_msg_t;
type, bind(c) :: zmq_msg_t
character(c_char) :: text(64)
end type zmq_msg_t
!typedef void(zmq_free_fn) (void *data_, void *hint_);
!
!ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg_);
!ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg_, size_t size_);
!ZMQ_EXPORT int zmq_msg_init_data (
! zmq_msg_t *msg_, void *data_, size_t size_, zmq_free_fn *ffn_, void *hint_);
!ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg_, void *s_, int flags_);
!ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg_, void *s_, int flags_);
!ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg_);
!ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest_, zmq_msg_t *src_);
!ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest_, zmq_msg_t *src_);
!ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg_);
!ZMQ_EXPORT size_t zmq_msg_size (const zmq_msg_t *msg_);
!ZMQ_EXPORT int zmq_msg_more (const zmq_msg_t *msg_);
!ZMQ_EXPORT int zmq_msg_get (const zmq_msg_t *msg_, int property_);
!ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg_, int property_, int optval_);
!ZMQ_EXPORT const char *zmq_msg_gets (const zmq_msg_t *msg_,
! const char *property_);
!
! zmq_free_fn not used
!
abstract interface
subroutine zmq_free_fn(data_, hint_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(*) :: data_
type(c_ptr), value :: hint_
end subroutine zmq_free_fn
end interface
interface
integer(c_int) function zmq_msg_init(msg_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t) :: msg_
end function zmq_msg_init
integer(c_int) function zmq_msg_init_size(msg_, size_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t) :: msg_
integer(c_size_t), value :: size_
end function zmq_msg_init_size
! not working properly
integer(c_int) function zmq_msg_init_data(msg_, data_, size_, ffn_, hint_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t, zmq_free_fn
type(zmq_msg_t) :: msg_
! integer(8), allocatable :: data_(:) ! O
type(c_ptr), value :: data_ ! X
integer(c_size_t), value :: size_
type(c_funptr), value :: ffn_
! procedure(zmq_free_fn) :: ffn_
type(c_ptr), value :: hint_
end function zmq_msg_init_data
integer(c_int) function zmq_msg_send(msg_, s_, flags_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t) :: msg_
type(c_ptr), value :: s_
integer(c_int), value :: flags_
end function zmq_msg_send
integer(c_int) function zmq_msg_recv(msg_, s_, flags_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t) :: msg_
type(c_ptr), value :: s_
integer(c_int), value :: flags_
end function zmq_msg_recv
integer(c_int) function zmq_msg_close(msg_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t) :: msg_
end function zmq_msg_close
integer(c_int) function zmq_msg_move(dest_, src_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t) :: dest_, src_
end function zmq_msg_move
integer(c_int) function zmq_msg_copy(dest_, src_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t) :: dest_, src_
end function zmq_msg_copy
type(c_ptr) function zmq_msg_data(msg_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t) :: msg_
end function zmq_msg_data
integer(c_size_t) function zmq_msg_size(msg_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t), intent(in) :: msg_
end function zmq_msg_size
integer(c_int) function zmq_msg_more(msg_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t), intent(in) :: msg_
end function zmq_msg_more
integer(c_int) function zmq_msg_get(msg_, property_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t), intent(in) :: msg_
integer(c_int), value :: property_
end function zmq_msg_get
integer(c_int) function zmq_msg_set(msg_, property_, optval_) bind(c)
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t), intent(in) :: msg_
integer(c_int), value :: property_, optval_
end function zmq_msg_set
type(c_ptr) function zmq_msg_gets_c(msg_, property_) bind(c, name = 'zmq_msg_gets')
use, intrinsic :: iso_c_binding
import zmq_msg_t
type(zmq_msg_t), intent(in) :: msg_
type(c_ptr) , intent(in) :: property_
end function zmq_msg_gets_c
end interface
!/******************************************************************************/
!/* 0MQ socket definition. */
!/******************************************************************************/
!
!/* Socket types. */
integer(c_int), parameter :: ZMQ_PAIR = 0
integer(c_int), parameter :: ZMQ_PUB = 1
integer(c_int), parameter :: ZMQ_SUB = 2
integer(c_int), parameter :: ZMQ_REQ = 3
integer(c_int), parameter :: ZMQ_REP = 4
integer(c_int), parameter :: ZMQ_DEALER = 5
integer(c_int), parameter :: ZMQ_ROUTER = 6
integer(c_int), parameter :: ZMQ_PULL = 7
integer(c_int), parameter :: ZMQ_PUSH = 8
integer(c_int), parameter :: ZMQ_XPUB = 9
integer(c_int), parameter :: ZMQ_XSUB = 10
integer(c_int), parameter :: ZMQ_STREAM = 11
!/* Deprecated aliases */
integer(c_int), parameter :: ZMQ_XREQ = ZMQ_DEALER
integer(c_int), parameter :: ZMQ_XREP = ZMQ_ROUTER
!/* Socket options. */
integer(c_int), parameter :: ZMQ_AFFINITY = 4
integer(c_int), parameter :: ZMQ_ROUTING_ID = 5
integer(c_int), parameter :: ZMQ_SUBSCRIBE = 6
integer(c_int), parameter :: ZMQ_UNSUBSCRIBE = 7
integer(c_int), parameter :: ZMQ_RATE = 8
integer(c_int), parameter :: ZMQ_RECOVERY_IVL = 9
integer(c_int), parameter :: ZMQ_SNDBUF = 11
integer(c_int), parameter :: ZMQ_RCVBUF = 12
integer(c_int), parameter :: ZMQ_RCVMORE = 13
integer(c_int), parameter :: ZMQ_FD = 14
integer(c_int), parameter :: ZMQ_EVENTS = 15
integer(c_int), parameter :: ZMQ_TYPE = 16
integer(c_int), parameter :: ZMQ_LINGER = 17
integer(c_int), parameter :: ZMQ_RECONNECT_IVL = 18
integer(c_int), parameter :: ZMQ_BACKLOG = 19
integer(c_int), parameter :: ZMQ_RECONNECT_IVL_MAX = 21
integer(c_int), parameter :: ZMQ_MAXMSGSIZE = 22
integer(c_int), parameter :: ZMQ_SNDHWM = 23
integer(c_int), parameter :: ZMQ_RCVHWM = 24
integer(c_int), parameter :: ZMQ_MULTICAST_HOPS = 25
integer(c_int), parameter :: ZMQ_RCVTIMEO = 27
integer(c_int), parameter :: ZMQ_SNDTIMEO = 28
integer(c_int), parameter :: ZMQ_LAST_ENDPOINT = 32
integer(c_int), parameter :: ZMQ_ROUTER_MANDATORY = 33
integer(c_int), parameter :: ZMQ_TCP_KEEPALIVE = 34
integer(c_int), parameter :: ZMQ_TCP_KEEPALIVE_CNT = 35
integer(c_int), parameter :: ZMQ_TCP_KEEPALIVE_IDLE = 36
integer(c_int), parameter :: ZMQ_TCP_KEEPALIVE_INTVL = 37
integer(c_int), parameter :: ZMQ_IMMEDIATE = 39
integer(c_int), parameter :: ZMQ_XPUB_VERBOSE = 40
integer(c_int), parameter :: ZMQ_ROUTER_RAW = 41
integer(c_int), parameter :: ZMQ_IPV6 = 42
integer(c_int), parameter :: ZMQ_MECHANISM = 43
integer(c_int), parameter :: ZMQ_PLAIN_SERVER = 44
integer(c_int), parameter :: ZMQ_PLAIN_USERNAME = 45
integer(c_int), parameter :: ZMQ_PLAIN_PASSWORD = 46
integer(c_int), parameter :: ZMQ_CURVE_SERVER = 47
integer(c_int), parameter :: ZMQ_CURVE_PUBLICKEY = 48
integer(c_int), parameter :: ZMQ_CURVE_SECRETKEY = 49
integer(c_int), parameter :: ZMQ_CURVE_SERVERKEY = 50
integer(c_int), parameter :: ZMQ_PROBE_ROUTER = 51
integer(c_int), parameter :: ZMQ_REQ_CORRELATE = 52
integer(c_int), parameter :: ZMQ_REQ_RELAXED = 53
integer(c_int), parameter :: ZMQ_CONFLATE = 54
integer(c_int), parameter :: ZMQ_ZAP_DOMAIN = 55
integer(c_int), parameter :: ZMQ_ROUTER_HANDOVER = 56
integer(c_int), parameter :: ZMQ_TOS = 57
integer(c_int), parameter :: ZMQ_CONNECT_ROUTING_ID = 61
integer(c_int), parameter :: ZMQ_GSSAPI_SERVER = 62
integer(c_int), parameter :: ZMQ_GSSAPI_PRINCIPAL = 63
integer(c_int), parameter :: ZMQ_GSSAPI_SERVICE_PRINCIPAL = 64
integer(c_int), parameter :: ZMQ_GSSAPI_PLAINTEXT = 65
integer(c_int), parameter :: ZMQ_HANDSHAKE_IVL = 66
integer(c_int), parameter :: ZMQ_SOCKS_PROXY = 68
integer(c_int), parameter :: ZMQ_XPUB_NODROP = 69
integer(c_int), parameter :: ZMQ_BLOCKY = 70
integer(c_int), parameter :: ZMQ_XPUB_MANUAL = 71
integer(c_int), parameter :: ZMQ_XPUB_WELCOME_MSG = 72
integer(c_int), parameter :: ZMQ_STREAM_NOTIFY = 73
integer(c_int), parameter :: ZMQ_INVERT_MATCHING = 74
integer(c_int), parameter :: ZMQ_HEARTBEAT_IVL = 75
integer(c_int), parameter :: ZMQ_HEARTBEAT_TTL = 76
integer(c_int), parameter :: ZMQ_HEARTBEAT_TIMEOUT = 77
integer(c_int), parameter :: ZMQ_XPUB_VERBOSER = 78
integer(c_int), parameter :: ZMQ_CONNECT_TIMEOUT = 79
integer(c_int), parameter :: ZMQ_TCP_MAXRT = 80
integer(c_int), parameter :: ZMQ_THREAD_SAFE = 81
integer(c_int), parameter :: ZMQ_MULTICAST_MAXTPDU = 84
integer(c_int), parameter :: ZMQ_VMCI_BUFFER_SIZE = 85
integer(c_int), parameter :: ZMQ_VMCI_BUFFER_MIN_SIZE = 86
integer(c_int), parameter :: ZMQ_VMCI_BUFFER_MAX_SIZE = 87
integer(c_int), parameter :: ZMQ_VMCI_CONNECT_TIMEOUT = 88
integer(c_int), parameter :: ZMQ_USE_FD = 89
integer(c_int), parameter :: ZMQ_GSSAPI_PRINCIPAL_NAMETYPE = 90
integer(c_int), parameter :: ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE = 91
integer(c_int), parameter :: ZMQ_BINDTODEVICE = 92
!/* Message options */
integer(c_int), parameter :: ZMQ_MORE = 1
integer(c_int), parameter :: ZMQ_SHARED = 3
!/* Send/recv options. */
integer(c_int), parameter :: ZMQ_DONTWAIT = 1
integer(c_int), parameter :: ZMQ_SNDMORE = 2
!/* Security mechanisms */
integer(c_int), parameter :: ZMQ_NULL = 0
integer(c_int), parameter :: ZMQ_PLAIN = 1
integer(c_int), parameter :: ZMQ_CURVE = 2
integer(c_int), parameter :: ZMQ_GSSAPI = 3
!/* RADIO-DISH protocol */
integer(c_int), parameter :: ZMQ_GROUP_MAX_LENGTH = 15
!/* Deprecated options and aliases */
integer(c_int), parameter :: ZMQ_IDENTITY = ZMQ_ROUTING_ID
integer(c_int), parameter :: ZMQ_CONNECT_RID = ZMQ_CONNECT_ROUTING_ID
integer(c_int), parameter :: ZMQ_TCP_ACCEPT_FILTER = 38
integer(c_int), parameter :: ZMQ_IPC_FILTER_PID = 58
integer(c_int), parameter :: ZMQ_IPC_FILTER_UID = 59
integer(c_int), parameter :: ZMQ_IPC_FILTER_GID = 60
integer(c_int), parameter :: ZMQ_IPV4ONLY = 31
integer(c_int), parameter :: ZMQ_DELAY_ATTACH_ON_CONNECT = ZMQ_IMMEDIATE
integer(c_int), parameter :: ZMQ_NOBLOCK = ZMQ_DONTWAIT
integer(c_int), parameter :: ZMQ_FAIL_UNROUTABLE = ZMQ_ROUTER_MANDATORY
integer(c_int), parameter :: ZMQ_ROUTER_BEHAVIOR = ZMQ_ROUTER_MANDATORY
!/* Deprecated Message options */
integer(c_int), parameter :: ZMQ_SRCFD = 2
!/******************************************************************************/
!/* GSSAPI definitions */
!/******************************************************************************/
!/* GSSAPI principal name types */
integer(c_int), parameter :: ZMQ_GSSAPI_NT_HOSTBASED = 0
integer(c_int), parameter :: ZMQ_GSSAPI_NT_USER_NAME = 1
integer(c_int), parameter :: ZMQ_GSSAPI_NT_KRB5_PRINCIPAL = 2
!/******************************************************************************/
!/* 0MQ socket events and monitoring */
!/******************************************************************************/
!
!/* Socket transport events (TCP, IPC and TIPC only) */
integer(c_int), parameter :: ZMQ_EVENT_CONNECTED = Z'0001'
integer(c_int), parameter :: ZMQ_EVENT_CONNECT_DELAYED = Z'0002'
integer(c_int), parameter :: ZMQ_EVENT_CONNECT_RETRIED = Z'0004'
integer(c_int), parameter :: ZMQ_EVENT_LISTENING = Z'0008'
integer(c_int), parameter :: ZMQ_EVENT_BIND_FAILED = Z'0010'
integer(c_int), parameter :: ZMQ_EVENT_ACCEPTED = Z'0020'
integer(c_int), parameter :: ZMQ_EVENT_ACCEPT_FAILED = Z'0040'
integer(c_int), parameter :: ZMQ_EVENT_CLOSED = Z'0080'
integer(c_int), parameter :: ZMQ_EVENT_CLOSE_FAILED = Z'0100'
integer(c_int), parameter :: ZMQ_EVENT_DISCONNECTED = Z'0200'
integer(c_int), parameter :: ZMQ_EVENT_MONITOR_STOPPED = Z'0400'
integer(c_int), parameter :: ZMQ_EVENT_ALL = Z'FFFF'
!/* Unspecified system errors during handshake. Event value is an errno. */
integer(c_int), parameter :: ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL = Z'0800'
!/* Handshake complete successfully with successful authentication (if *
! * enabled). Event value is unused. */
integer(c_int), parameter :: ZMQ_EVENT_HANDSHAKE_SUCCEEDED = Z'1000'
!/* Protocol errors between ZMTP peers or between server and ZAP handler. *
! * Event value is one of ZMQ_PROTOCOL_ERROR_* */
integer(c_int), parameter :: ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL = Z'2000'
!/* Failed authentication requests. Event value is the numeric ZAP status *
! * code, i.e. 300, 400 or 500. */
integer(c_int), parameter :: ZMQ_EVENT_HANDSHAKE_FAILED_AUTH = Z'4000'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_UNSPECIFIED = Z'10000000'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_UNEXPECTED_COMMAND = Z'10000001'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_INVALID_SEQUENCE = Z'10000002'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_KEY_EXCHANGE = Z'10000003'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_UNSPECIFIED = Z'10000011'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_MESSAGE = Z'10000012'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO = Z'10000013'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_INITIATE = Z'10000014'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_ERROR = Z'10000015'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_READY = Z'10000016'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_WELCOME = Z'10000017'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_INVALID_METADATA = Z'10000018'
!// the following two may be due to erroneous configuration of a peer
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC = Z'11000001'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZMTP_MECHANISM_MISMATCH = Z'11000002'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZAP_UNSPECIFIED = Z'20000000'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZAP_MALFORMED_REPLY = Z'20000001'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZAP_BAD_REQUEST_ID = Z'20000002'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZAP_BAD_VERSION = Z'20000003'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZAP_INVALID_STATUS_CODE = Z'20000004'
integer(c_int), parameter :: ZMQ_PROTOCOL_ERROR_ZAP_INVALID_METADATA = Z'20000005'
!ZMQ_EXPORT void *zmq_socket (void *, int type_);
!ZMQ_EXPORT int zmq_close (void *s_);
!ZMQ_EXPORT int
!zmq_setsockopt (void *s_, int option_, const void *optval_, size_t optvallen_);
!ZMQ_EXPORT int
!zmq_getsockopt (void *s_, int option_, void *optval_, size_t *optvallen_);
!ZMQ_EXPORT int zmq_bind (void *s_, const char *addr_);
!ZMQ_EXPORT int zmq_connect (void *s_, const char *addr_);
!ZMQ_EXPORT int zmq_unbind (void *s_, const char *addr_);
!ZMQ_EXPORT int zmq_disconnect (void *s_, const char *addr_);
!ZMQ_EXPORT int zmq_send (void *s_, const void *buf_, size_t len_, int flags_);
!ZMQ_EXPORT int
!zmq_send_const (void *s_, const void *buf_, size_t len_, int flags_);
!ZMQ_EXPORT int zmq_recv (void *s_, void *buf_, size_t len_, int flags_);
!ZMQ_EXPORT int zmq_socket_monitor (void *s_, const char *addr_, int events_);
interface
type(c_ptr) function zmq_socket(context_, type_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: context_
integer(c_int), value :: type_
end function zmq_socket
integer(c_int) function zmq_close(s_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
end function zmq_close
integer(c_int) function zmq_setsockopt(s_, option_, optval_, optvallen_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
integer(c_int), value :: option_
type(c_ptr), value :: optval_
integer(c_size_t), value :: optvallen_
end function zmq_setsockopt
integer(c_int) function zmq_getsockopt(s_, option_, optval_, optvallen_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
integer(c_int), value :: option_
type(c_ptr), value :: optval_
integer(c_size_t), value :: optvallen_
end function zmq_getsockopt
integer(c_int) function zmq_bind(s_, addr_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: addr_
end function zmq_bind
integer(c_int) function zmq_connect(s_, addr_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: addr_
end function zmq_connect
integer(c_int) function zmq_unbind(s_, addr_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: addr_
end function zmq_unbind
integer(c_int) function zmq_disconnect(s_, addr_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: addr_
end function zmq_disconnect
integer(c_int) function zmq_send(s_, buf_, len_, flags_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: buf_
integer(c_size_t), value :: len_
integer(c_int), value :: flags_
end function zmq_send
integer(c_int) function zmq_recv(s_, buf_, len_, flags_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: buf_
integer(c_size_t), value :: len_
integer(c_int), value :: flags_
end function zmq_recv
integer(c_int) function zmq_socket_monitor(s_, addr_, events_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: addr_
integer(c_int), value :: events_
end function zmq_socket_monitor
end interface
!/******************************************************************************/
!/* Deprecated I/O multiplexing. Prefer using zmq_poller API */
!/******************************************************************************/
!
!#define ZMQ_POLLIN 1
!#define ZMQ_POLLOUT 2
!#define ZMQ_POLLERR 4
!#define ZMQ_POLLPRI 8
integer(c_int), parameter :: ZMQ_POLLIN = 1
integer(c_int), parameter :: ZMQ_POLLOUT = 2
integer(c_int), parameter :: ZMQ_POLLERR = 4
integer(c_int), parameter :: ZMQ_POLLPRI = 8
!typedef struct zmq_pollitem_t
!{
! void *socket;
!#if defined _WIN32
! SOCKET fd;
!#else
! int fd;
!#endif
! short events;
! short revents;
!} zmq_pollitem_t;
type, bind(c) :: zmq_pollitem_t
type(c_ptr) :: socket
integer(c_int) :: fd
integer(c_short) :: events
integer(c_short) :: revents
end type zmq_pollitem_t
!#define ZMQ_POLLITEMS_DFLT 16
integer(c_int), parameter :: ZMQ_POLLITEMS_DFLT = 16
!ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_);
!???
interface
integer(c_int) function zmq_poll(items_, nitems_, timeout_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: items_
integer(c_int) , value :: nitems_
integer(c_long), value :: timeout_
end function zmq_poll
end interface
!/******************************************************************************/
!/* Message proxying */
!/******************************************************************************/
!
!ZMQ_EXPORT int zmq_proxy (void *frontend_, void *backend_, void *capture_);
!ZMQ_EXPORT int zmq_proxy_steerable (void *frontend_,
! void *backend_,
! void *capture_,
! void *control_);
!??? nocheck
! TODO
interface
integer(c_int) function zmq_proxy(frontend_, backend_, capture_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: frontend_
type(c_ptr), value :: backend_
type(c_ptr), value :: capture_
end function zmq_proxy
integer(c_int) function zmq_proxy_steerable(frontend_, backend_, capture_, control_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: frontend_
type(c_ptr), value :: backend_
type(c_ptr), value :: capture_
type(c_ptr), value :: control_
end function zmq_proxy_steerable
end interface
!/******************************************************************************/
!/* Probe library capabilities */
!/******************************************************************************/
!
!#define ZMQ_HAS_CAPABILITIES 1
integer(c_int), parameter :: ZMQ_HAS_CAPABILITIES = 1
! TODO
! ????
!ZMQ_EXPORT int zmq_has(const char *capability_);
interface
integer(c_int) function zmq_has(capability_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: capability_
end function zmq_has
end interface
!/* Deprecated aliases */
!#define ZMQ_STREAMER 1
!#define ZMQ_FORWARDER 2
!#define ZMQ_QUEUE 3
integer(c_int), parameter :: ZMQ_STREAMER = 1
integer(c_int), parameter :: ZMQ_FORWARDER = 2
integer(c_int), parameter :: ZMQ_QUEUE = 3
!/* Deprecated methods */
! TODO
!ZMQ_EXPORT int zmq_device (int type_, void *frontend_, void *backend_);
!ZMQ_EXPORT int zmq_sendmsg (void *s_, zmq_msg_t *msg_, int flags_);
!ZMQ_EXPORT int zmq_recvmsg (void *s_, zmq_msg_t *msg_, int flags_);
interface
integer(c_int) function zmq_device(type_, frontend_, backend_) bind(c)
use, intrinsic :: iso_c_binding
integer(c_int), value :: type_
type(c_ptr), value :: frontend_
type(c_ptr), value :: backend_
end function zmq_device
integer(c_int) function zmq_sendmsg(s_, msg_, flags_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: msg_
integer(c_int), value :: flags_
end function zmq_sendmsg
integer(c_int) function zmq_recvmsg(s_, msg_, flags_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: msg_
integer(c_int), value :: flags_
end function zmq_recvmsg
end interface
!
! TODO
!struct iovec;
!ZMQ_EXPORT int
!zmq_sendiov (void *s_, struct iovec *iov_, size_t count_, int flags_);
!ZMQ_EXPORT int
!zmq_recviov (void *s_, struct iovec *iov_, size_t *count_, int flags_);
interface
integer function zmq_sendiov(s_, iov_, count_, flags_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: iov_
integer(c_size_t), value :: count_
integer(c_int) , value :: flags_
end function zmq_sendiov
integer function zmq_recviov(s_, iov_, count_, flags_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: s_
type(c_ptr), value :: iov_
integer(c_size_t) :: count_ ! intent(out)
integer(c_int) , value :: flags_
end function zmq_recviov
end interface
!/******************************************************************************/
!/* Encryption functions */
!/******************************************************************************/
!
!
!/* Encode data with Z85 encoding. Returns encoded data */
!ZMQ_EXPORT char *
!zmq_z85_encode (char *dest_, const uint8_t *data_, size_t size_);
!
!/* Decode data with Z85 encoding. Returns decoded data */
!ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest_, const char *string_);
!
!/* Generate z85-encoded public and private keypair with tweetnacl/libsodium. */
!/* Returns 0 on success. */
!ZMQ_EXPORT int zmq_curve_keypair (char *z85_public_key_, char *z85_secret_key_);
!
!/* Derive the z85-encoded public key from the z85-encoded secret key. */
!/* Returns 0 on success. */
!ZMQ_EXPORT int zmq_curve_public (char *z85_public_key_,
! const char *z85_secret_key_);
! TODO
! ???nocheck
interface
type(c_ptr) function zmq_z85_encode(dest_, data_, size_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: dest_
type(c_ptr) :: data_ ! intent(in)
integer(c_size_t), value :: size_
end function zmq_z85_encode
type(c_ptr) function zmq_z85_decode(dest_, string_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: dest_
type(c_ptr), value :: string_
end function zmq_z85_decode
integer(c_int) function zmq_curve_keypair(z85_public_key_, z85_secret_key_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: z85_public_key_
type(c_ptr), value :: z85_secret_key_
end function zmq_curve_keypair
integer(c_int) function zmq_curve_public(z85_public_key_, z85_secret_key_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: z85_public_key_
type(c_ptr), value :: z85_secret_key_
end function zmq_curve_public
end interface
!/******************************************************************************/
!/* Atomic utility methods */
!/******************************************************************************/
!
!ZMQ_EXPORT void *zmq_atomic_counter_new (void);
!ZMQ_EXPORT void zmq_atomic_counter_set (void *counter_, int value_);
!ZMQ_EXPORT int zmq_atomic_counter_inc (void *counter_);
!ZMQ_EXPORT int zmq_atomic_counter_dec (void *counter_);
!ZMQ_EXPORT int zmq_atomic_counter_value (void *counter_);
!ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p_);
!
! TODO
! ???nocheck
interface
type(c_ptr) function zmq_atomic_counter_new() bind(c)
use, intrinsic :: iso_c_binding
end function zmq_atomic_counter_new
subroutine zmq_atomic_counter_set(counter_, value_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: counter_
integer(c_int), value :: value_
end subroutine zmq_atomic_counter_set
integer(c_int) function zmq_atomic_counter_inc(counter_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: counter_
end function zmq_atomic_counter_inc
integer(c_int) function zmq_atomic_counter_dec(counter_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: counter_
end function zmq_atomic_counter_dec
integer(c_int) function zmq_atomic_counter_value(counter_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: counter_
end function zmq_atomic_counter_value
subroutine zmq_atomic_counter_destroy(counter_p_) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: counter_p_
end subroutine zmq_atomic_counter_destroy
end interface
!/******************************************************************************/
!/* Scheduling timers */
!/******************************************************************************/
!
! TODO
!
!#define ZMQ_HAVE_TIMERS
!
!typedef void(zmq_timer_fn) (int timer_id, void *arg);
abstract interface
subroutine zmq_timer_fn(timer_id, arg) bind(c)
use, intrinsic :: iso_c_binding
integer(c_int), value :: timer_id
type(c_ptr), value :: arg
end subroutine zmq_timer_fn
end interface
!
!ZMQ_EXPORT void *zmq_timers_new (void);
!ZMQ_EXPORT int zmq_timers_destroy (void **timers_p);
!ZMQ_EXPORT int
!zmq_timers_add (void *timers, size_t interval, zmq_timer_fn handler, void *arg);
!ZMQ_EXPORT int zmq_timers_cancel (void *timers, int timer_id);
!ZMQ_EXPORT int
!zmq_timers_set_interval (void *timers, int timer_id, size_t interval);
!ZMQ_EXPORT int zmq_timers_reset (void *timers, int timer_id);
!ZMQ_EXPORT long zmq_timers_timeout (void *timers);
!ZMQ_EXPORT int zmq_timers_execute (void *timers);
interface
type(c_ptr) function zmq_timers_new() bind(c)
use, intrinsic :: iso_c_binding
end function zmq_timers_new
integer(c_int) function zmq_timers_destroy(timers_p) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: timers_p
end function zmq_timers_destroy
integer(c_int) function zmq_timers_add(timers, interval, handler, arg) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: timers
integer(c_size_t), value :: interval
type(c_funptr), value :: handler ! procedure(zmq_timer_fn) pointer
type(c_ptr), value :: arg
end function zmq_timers_add
integer(c_int) function zmq_timers_cancel(timers, timer_id) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: timers
integer(c_int), value :: timer_id
end function zmq_timers_cancel
integer(c_int) function zmq_timers_set_interval(timers, timer_id, interval) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: timers
integer(c_int), value :: timer_id
integer(c_size_t), value :: interval
end function zmq_timers_set_interval
integer(c_int) function zmq_timers_reset(timers, timer_id) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: timers
integer(c_int), value :: timer_id
end function zmq_timers_reset
integer(c_long) function zmq_timers_timeout(timers) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: timers
end function zmq_timers_timeout
integer(c_int) function zmq_timers_execute(timers) bind(c)
use, intrinsic :: iso_c_binding
type(c_ptr), value :: timers
end function zmq_timers_execute
end interface
!
!/******************************************************************************/