czmq-ffi-gen 0.9.1-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +1 -0
  3. data/CHANGES.md +88 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE +14 -0
  6. data/README.md +112 -0
  7. data/lib/czmq-ffi-gen.rb +7 -0
  8. data/lib/czmq-ffi-gen/czmq/ffi.rb +1210 -0
  9. data/lib/czmq-ffi-gen/czmq/ffi/version.rb +15 -0
  10. data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +186 -0
  11. data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +286 -0
  12. data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +307 -0
  13. data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +222 -0
  14. data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +388 -0
  15. data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +140 -0
  16. data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +442 -0
  17. data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +156 -0
  18. data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +283 -0
  19. data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +194 -0
  20. data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +353 -0
  21. data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +359 -0
  22. data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +416 -0
  23. data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +659 -0
  24. data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +189 -0
  25. data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +365 -0
  26. data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +478 -0
  27. data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +396 -0
  28. data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +515 -0
  29. data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +194 -0
  30. data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +294 -0
  31. data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +3479 -0
  32. data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +203 -0
  33. data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +203 -0
  34. data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +221 -0
  35. data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +227 -0
  36. data/lib/czmq-ffi-gen/errors.rb +12 -0
  37. data/lib/czmq-ffi-gen/gem_version.rb +5 -0
  38. data/lib/czmq-ffi-gen/legacy.rb +16 -0
  39. data/lib/czmq-ffi-gen/libzmq.rb +18 -0
  40. data/lib/czmq-ffi-gen/signals.rb +27 -0
  41. data/lib/czmq-ffi-gen/vendor.rb +5 -0
  42. data/lib/czmq-ffi-gen/versions.rb +19 -0
  43. data/vendor/local/bin/inproc_lat.exe +0 -0
  44. data/vendor/local/bin/inproc_thr.exe +0 -0
  45. data/vendor/local/bin/libczmq.dll +0 -0
  46. data/vendor/local/bin/libgcc_s_sjlj-1.dll +0 -0
  47. data/vendor/local/bin/libstdc++-6.dll +0 -0
  48. data/vendor/local/bin/libzmq.dll +0 -0
  49. data/vendor/local/bin/local_lat.exe +0 -0
  50. data/vendor/local/bin/local_thr.exe +0 -0
  51. data/vendor/local/bin/remote_lat.exe +0 -0
  52. data/vendor/local/bin/remote_thr.exe +0 -0
  53. data/vendor/local/include/czmq.h +31 -0
  54. data/vendor/local/include/czmq_library.h +199 -0
  55. data/vendor/local/include/czmq_prelude.h +641 -0
  56. data/vendor/local/include/readme.txt +83 -0
  57. data/vendor/local/include/sha1.h +76 -0
  58. data/vendor/local/include/sha1.inc_c +335 -0
  59. data/vendor/local/include/slre.h +92 -0
  60. data/vendor/local/include/slre.inc_c +660 -0
  61. data/vendor/local/include/zactor.h +76 -0
  62. data/vendor/local/include/zarmour.h +114 -0
  63. data/vendor/local/include/zauth.h +100 -0
  64. data/vendor/local/include/zauth_v2.h +88 -0
  65. data/vendor/local/include/zbeacon.h +86 -0
  66. data/vendor/local/include/zbeacon_v2.h +75 -0
  67. data/vendor/local/include/zcert.h +136 -0
  68. data/vendor/local/include/zcertstore.h +100 -0
  69. data/vendor/local/include/zchunk.h +163 -0
  70. data/vendor/local/include/zclock.h +73 -0
  71. data/vendor/local/include/zconfig.h +185 -0
  72. data/vendor/local/include/zctx.h +107 -0
  73. data/vendor/local/include/zdigest.h +65 -0
  74. data/vendor/local/include/zdir.h +149 -0
  75. data/vendor/local/include/zdir_patch.h +82 -0
  76. data/vendor/local/include/zfile.h +177 -0
  77. data/vendor/local/include/zframe.h +176 -0
  78. data/vendor/local/include/zgossip.h +95 -0
  79. data/vendor/local/include/zgossip_engine.inc +927 -0
  80. data/vendor/local/include/zgossip_msg.h +129 -0
  81. data/vendor/local/include/zhash.h +195 -0
  82. data/vendor/local/include/zhash_primes.inc +329 -0
  83. data/vendor/local/include/zhashx.h +298 -0
  84. data/vendor/local/include/ziflist.h +77 -0
  85. data/vendor/local/include/zlist.h +158 -0
  86. data/vendor/local/include/zlistx.h +205 -0
  87. data/vendor/local/include/zloop.h +168 -0
  88. data/vendor/local/include/zmonitor.h +73 -0
  89. data/vendor/local/include/zmonitor_v2.h +56 -0
  90. data/vendor/local/include/zmq.h +617 -0
  91. data/vendor/local/include/zmq_utils.h +48 -0
  92. data/vendor/local/include/zmsg.h +280 -0
  93. data/vendor/local/include/zmutex.h +55 -0
  94. data/vendor/local/include/zpoller.h +92 -0
  95. data/vendor/local/include/zproc.h +168 -0
  96. data/vendor/local/include/zproxy.h +111 -0
  97. data/vendor/local/include/zproxy_v2.h +62 -0
  98. data/vendor/local/include/zrex.h +82 -0
  99. data/vendor/local/include/zsock.h +912 -0
  100. data/vendor/local/include/zsock_option.inc +4126 -0
  101. data/vendor/local/include/zsocket.h +110 -0
  102. data/vendor/local/include/zsockopt.h +256 -0
  103. data/vendor/local/include/zstr.h +110 -0
  104. data/vendor/local/include/zsys.h +386 -0
  105. data/vendor/local/include/zthread.h +50 -0
  106. data/vendor/local/include/ztimerset.h +90 -0
  107. data/vendor/local/include/ztrie.h +106 -0
  108. data/vendor/local/include/zuuid.h +96 -0
  109. data/vendor/local/lib/libczmq.dll.a +0 -0
  110. data/vendor/local/lib/liblibzmq.dll.a +0 -0
  111. data/vendor/local/lib/libzmq-static.a +0 -0
  112. data/vendor/local/lib/pkgconfig/libczmq.pc +23 -0
  113. data/vendor/local/lib/pkgconfig/libzmq.pc +11 -0
  114. data/vendor/local/share/zmq/AUTHORS.txt +147 -0
  115. data/vendor/local/share/zmq/COPYING.LESSER.txt +181 -0
  116. data/vendor/local/share/zmq/COPYING.txt +674 -0
  117. data/vendor/local/share/zmq/NEWS.txt +978 -0
  118. metadata +230 -0
@@ -0,0 +1,168 @@
1
+ /* =========================================================================
2
+ zproc - process configuration and status
3
+
4
+ Copyright (c) the Contributors as noted in the AUTHORS file.
5
+ This file is part of CZMQ, the high-level C binding for 0MQ:
6
+ http://czmq.zeromq.org.
7
+
8
+ This Source Code Form is subject to the terms of the Mozilla Public
9
+ License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ =========================================================================
12
+ */
13
+
14
+ #ifndef ZPROC_H_INCLUDED
15
+ #define ZPROC_H_INCLUDED
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+
22
+ // @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
23
+ // @warning Please edit the model at "api/zproc.api" to make changes.
24
+ // @interface
25
+ // This is a draft class, and may change without notice. It is disabled in
26
+ // stable builds by default. If you use this in applications, please ask
27
+ // for it to be pushed to stable state. Use --enable-drafts to enable.
28
+ #ifdef CZMQ_BUILD_DRAFT_API
29
+ // *** Draft method, for development use, may change without warning ***
30
+ // Returns CZMQ version as a single 6-digit integer encoding the major
31
+ // version (x 10000), the minor version (x 100) and the patch.
32
+ CZMQ_EXPORT int
33
+ zproc_czmq_version (void);
34
+
35
+ // *** Draft method, for development use, may change without warning ***
36
+ // Returns true if the process received a SIGINT or SIGTERM signal.
37
+ // It is good practice to use this method to exit any infinite loop
38
+ // processing messages.
39
+ CZMQ_EXPORT bool
40
+ zproc_interrupted (void);
41
+
42
+ // *** Draft method, for development use, may change without warning ***
43
+ // Returns true if the underlying libzmq supports CURVE security.
44
+ CZMQ_EXPORT bool
45
+ zproc_has_curve (void);
46
+
47
+ // *** Draft method, for development use, may change without warning ***
48
+ // Return current host name, for use in public tcp:// endpoints.
49
+ // If the host name is not resolvable, returns NULL.
50
+ // Caller owns return value and must destroy it when done.
51
+ CZMQ_EXPORT char *
52
+ zproc_hostname (void);
53
+
54
+ // *** Draft method, for development use, may change without warning ***
55
+ // Move the current process into the background. The precise effect
56
+ // depends on the operating system. On POSIX boxes, moves to a specified
57
+ // working directory (if specified), closes all file handles, reopens
58
+ // stdin, stdout, and stderr to the null device, and sets the process to
59
+ // ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there
60
+ // was an error.
61
+ CZMQ_EXPORT void
62
+ zproc_daemonize (const char *workdir);
63
+
64
+ // *** Draft method, for development use, may change without warning ***
65
+ // Drop the process ID into the lockfile, with exclusive lock, and
66
+ // switch the process to the specified group and/or user. Any of the
67
+ // arguments may be null, indicating a no-op. Returns 0 on success,
68
+ // -1 on failure. Note if you combine this with zsys_daemonize, run
69
+ // after, not before that method, or the lockfile will hold the wrong
70
+ // process ID.
71
+ CZMQ_EXPORT void
72
+ zproc_run_as (const char *lockfile, const char *group, const char *user);
73
+
74
+ // *** Draft method, for development use, may change without warning ***
75
+ // Configure the number of I/O threads that ZeroMQ will use. A good
76
+ // rule of thumb is one thread per gigabit of traffic in or out. The
77
+ // default is 1, sufficient for most applications. If the environment
78
+ // variable ZSYS_IO_THREADS is defined, that provides the default.
79
+ // Note that this method is valid only before any socket is created.
80
+ CZMQ_EXPORT void
81
+ zproc_set_io_threads (size_t io_threads);
82
+
83
+ // *** Draft method, for development use, may change without warning ***
84
+ // Configure the number of sockets that ZeroMQ will allow. The default
85
+ // is 1024. The actual limit depends on the system, and you can query it
86
+ // by using zsys_socket_limit (). A value of zero means "maximum".
87
+ // Note that this method is valid only before any socket is created.
88
+ CZMQ_EXPORT void
89
+ zproc_set_max_sockets (size_t max_sockets);
90
+
91
+ // *** Draft method, for development use, may change without warning ***
92
+ // Set network interface name to use for broadcasts, particularly zbeacon.
93
+ // This lets the interface be configured for test environments where required.
94
+ // For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is
95
+ // the default when there is no specified interface. If the environment
96
+ // variable ZSYS_INTERFACE is set, use that as the default interface name.
97
+ // Setting the interface to "*" means "use all available interfaces".
98
+ CZMQ_EXPORT void
99
+ zproc_set_biface (const char *value);
100
+
101
+ // *** Draft method, for development use, may change without warning ***
102
+ // Return network interface to use for broadcasts, or "" if none was set.
103
+ CZMQ_EXPORT const char *
104
+ zproc_biface (void);
105
+
106
+ // *** Draft method, for development use, may change without warning ***
107
+ // Set log identity, which is a string that prefixes all log messages sent
108
+ // by this process. The log identity defaults to the environment variable
109
+ // ZSYS_LOGIDENT, if that is set.
110
+ CZMQ_EXPORT void
111
+ zproc_set_log_ident (const char *value);
112
+
113
+ // *** Draft method, for development use, may change without warning ***
114
+ // Sends log output to a PUB socket bound to the specified endpoint. To
115
+ // collect such log output, create a SUB socket, subscribe to the traffic
116
+ // you care about, and connect to the endpoint. Log traffic is sent as a
117
+ // single string frame, in the same format as when sent to stdout. The
118
+ // log system supports a single sender; multiple calls to this method will
119
+ // bind the same sender to multiple endpoints. To disable the sender, call
120
+ // this method with a null argument.
121
+ CZMQ_EXPORT void
122
+ zproc_set_log_sender (const char *endpoint);
123
+
124
+ // *** Draft method, for development use, may change without warning ***
125
+ // Enable or disable logging to the system facility (syslog on POSIX boxes,
126
+ // event log on Windows). By default this is disabled.
127
+ CZMQ_EXPORT void
128
+ zproc_set_log_system (bool logsystem);
129
+
130
+ // *** Draft method, for development use, may change without warning ***
131
+ // Log error condition - highest priority
132
+ CZMQ_EXPORT void
133
+ zproc_log_error (const char *format, ...) CHECK_PRINTF (1);
134
+
135
+ // *** Draft method, for development use, may change without warning ***
136
+ // Log warning condition - high priority
137
+ CZMQ_EXPORT void
138
+ zproc_log_warning (const char *format, ...) CHECK_PRINTF (1);
139
+
140
+ // *** Draft method, for development use, may change without warning ***
141
+ // Log normal, but significant, condition - normal priority
142
+ CZMQ_EXPORT void
143
+ zproc_log_notice (const char *format, ...) CHECK_PRINTF (1);
144
+
145
+ // *** Draft method, for development use, may change without warning ***
146
+ // Log informational message - low priority
147
+ CZMQ_EXPORT void
148
+ zproc_log_info (const char *format, ...) CHECK_PRINTF (1);
149
+
150
+ // *** Draft method, for development use, may change without warning ***
151
+ // Log debug-level message - lowest priority
152
+ CZMQ_EXPORT void
153
+ zproc_log_debug (const char *format, ...) CHECK_PRINTF (1);
154
+
155
+ // *** Draft method, for development use, may change without warning ***
156
+ // Self test of this class.
157
+ CZMQ_EXPORT void
158
+ zproc_test (bool verbose);
159
+
160
+ #endif // CZMQ_BUILD_DRAFT_API
161
+ // @end
162
+
163
+
164
+ #ifdef __cplusplus
165
+ }
166
+ #endif
167
+
168
+ #endif
@@ -0,0 +1,111 @@
1
+ /* =========================================================================
2
+ zproxy - run a steerable proxy in the background
3
+
4
+ Copyright (c) the Contributors as noted in the AUTHORS file.
5
+ This file is part of CZMQ, the high-level C binding for 0MQ:
6
+ http://czmq.zeromq.org.
7
+
8
+ This Source Code Form is subject to the terms of the Mozilla Public
9
+ License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ =========================================================================
12
+ */
13
+
14
+ #ifndef __ZPROXY_H_INCLUDED__
15
+ #define __ZPROXY_H_INCLUDED__
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ // @interface
22
+ // Create new zproxy actor instance. The proxy switches messages between
23
+ // a frontend socket and a backend socket; use the FRONTEND and BACKEND
24
+ // commands to configure these:
25
+ //
26
+ // zactor_t *proxy = zactor_new (zproxy, NULL);
27
+ //
28
+ // Destroy zproxy instance. This destroys the two sockets and stops any
29
+ // message flow between them:
30
+ //
31
+ // zactor_destroy (&proxy);
32
+ //
33
+ // Note that all zproxy commands are synchronous, so your application always
34
+ // waits for a signal from the actor after each command.
35
+ //
36
+ // Enable verbose logging of commands and activity:
37
+ //
38
+ // zstr_send (proxy, "VERBOSE");
39
+ // zsock_wait (proxy);
40
+ //
41
+ // Specify frontend socket type -- see zsock_type_str () -- and attach to
42
+ // endpoints, see zsock_attach (). Note that a proxy socket is always
43
+ // serverish:
44
+ //
45
+ // zstr_sendx (proxy, "FRONTEND", "XSUB", endpoints, NULL);
46
+ // zsock_wait (proxy);
47
+ //
48
+ // Specify backend socket type -- see zsock_type_str () -- and attach to
49
+ // endpoints, see zsock_attach (). Note that a proxy socket is always
50
+ // serverish:
51
+ //
52
+ // zstr_sendx (proxy, "BACKEND", "XPUB", endpoints, NULL);
53
+ // zsock_wait (proxy);
54
+ //
55
+ // Capture all proxied messages; these are delivered to the application
56
+ // via an inproc PULL socket that you have already bound to the specified
57
+ // endpoint:
58
+ //
59
+ // zstr_sendx (proxy, "CAPTURE", endpoint, NULL);
60
+ // zsock_wait (proxy);
61
+ //
62
+ // Pause the proxy. A paused proxy will cease processing messages, causing
63
+ // them to be queued up and potentially hit the high-water mark on the
64
+ // frontend or backend socket, causing messages to be dropped, or writing
65
+ // applications to block:
66
+ //
67
+ // zstr_sendx (proxy, "PAUSE", NULL);
68
+ // zsock_wait (proxy);
69
+ //
70
+ // Resume the proxy. Note that the proxy starts automatically as soon as it
71
+ // has a properly attached frontend and backend socket:
72
+ //
73
+ // zstr_sendx (proxy, "RESUME", NULL);
74
+ // zsock_wait (proxy);
75
+ //
76
+ // Configure an authentication domain for the "FRONTEND" or "BACKEND" proxy
77
+ // socket -- see zsock_set_zap_domain (). Call before binding socket:
78
+ //
79
+ // zstr_sendx (proxy, "DOMAIN", "FRONTEND", "global", NULL);
80
+ // zsock_wait (proxy);
81
+ //
82
+ // Configure PLAIN authentication for the "FRONTEND" or "BACKEND" proxy
83
+ // socket -- see zsock_set_plain_server (). Call before binding socket:
84
+ //
85
+ // zstr_sendx (proxy, "PLAIN", "BACKEND", NULL);
86
+ // zsock_wait (proxy);
87
+ //
88
+ // Configure CURVE authentication for the "FRONTEND" or "BACKEND" proxy
89
+ // socket -- see zsock_set_curve_server () -- specifying both the public and
90
+ // secret keys of a certificate as Z85 armored strings -- see
91
+ // zcert_public_txt () and zcert_secret_txt (). Call before binding socket:
92
+ //
93
+ // zstr_sendx (proxy, "CURVE", "FRONTEND", public_txt, secret_txt, NULL);
94
+ // zsock_wait (proxy);
95
+ //
96
+ // This is the zproxy constructor as a zactor_fn; the argument is a
97
+ // character string specifying frontend and backend socket types as two
98
+ // uppercase strings separated by a hyphen:
99
+ CZMQ_EXPORT void
100
+ zproxy (zsock_t *pipe, void *unused);
101
+
102
+ // Selftest
103
+ CZMQ_EXPORT void
104
+ zproxy_test (bool verbose);
105
+ // @end
106
+
107
+ #ifdef __cplusplus
108
+ }
109
+ #endif
110
+
111
+ #endif
@@ -0,0 +1,62 @@
1
+ /* =========================================================================
2
+ zproxy_v2 - run a steerable proxy in the background (deprecated)
3
+
4
+ Copyright (c) the Contributors as noted in the AUTHORS file.
5
+ This file is part of CZMQ, the high-level C binding for 0MQ:
6
+ http://czmq.zeromq.org.
7
+
8
+ This Source Code Form is subject to the terms of the Mozilla Public
9
+ License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ =========================================================================
12
+ */
13
+
14
+ #ifndef __ZPROXY_V2_H_INCLUDED__
15
+ #define __ZPROXY_V2_H_INCLUDED__
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ // @interface
22
+
23
+ // Constructor
24
+ // Create a new zproxy object. You must create the frontend and backend
25
+ // sockets, configure them, and connect or bind them, before you pass them
26
+ // to the constructor. Do NOT use the sockets again, after passing them to
27
+ // this method.
28
+ CZMQ_EXPORT zproxy_t *
29
+ zproxy_new (zctx_t *ctx, void *frontend, void *backend);
30
+
31
+ // Destructor
32
+ // Destroy a zproxy object; note this first stops the proxy.
33
+ CZMQ_EXPORT void
34
+ zproxy_destroy (zproxy_t **self_p);
35
+
36
+ // Copy all proxied messages to specified endpoint; if this is NULL, any
37
+ // in-progress capturing will be stopped. You must already have bound the
38
+ // endpoint to a PULL socket.
39
+ CZMQ_EXPORT void
40
+ zproxy_capture (zproxy_t *self, const char *endpoint);
41
+
42
+ // Pauses a zproxy object; a paused proxy will cease processing messages,
43
+ // causing them to be queued up and potentially hit the high-water mark on
44
+ // the frontend socket, causing messages to be dropped, or writing
45
+ // applications to block.
46
+ CZMQ_EXPORT void
47
+ zproxy_pause (zproxy_t *self);
48
+
49
+ // Resume a zproxy object
50
+ CZMQ_EXPORT void
51
+ zproxy_resume (zproxy_t *self);
52
+
53
+ // Self test of this class
54
+ CZMQ_EXPORT void
55
+ zproxy_v2_test (bool verbose);
56
+ // @end
57
+
58
+ #ifdef __cplusplus
59
+ }
60
+ #endif
61
+
62
+ #endif
@@ -0,0 +1,82 @@
1
+ /* =========================================================================
2
+ zrex - work with regular expressions
3
+
4
+ Copyright (c) the Contributors as noted in the AUTHORS file.
5
+ This file is part of CZMQ, the high-level C binding for 0MQ:
6
+ http://czmq.zeromq.org.
7
+
8
+ This Source Code Form is subject to the terms of the Mozilla Public
9
+ License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ =========================================================================
12
+ */
13
+
14
+ #ifndef __ZREX_H_INCLUDED__
15
+ #define __ZREX_H_INCLUDED__
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ // @interface
22
+ // Constructor. Optionally, sets an expression against which we can match
23
+ // text and capture hits. If there is an error in the expression, reports
24
+ // zrex_valid() as false and provides the error in zrex_strerror(). If you
25
+ // set a pattern, you can call zrex_matches() to test it against text.
26
+ CZMQ_EXPORT zrex_t *
27
+ zrex_new (const char *expression);
28
+
29
+ // Destructor
30
+ CZMQ_EXPORT void
31
+ zrex_destroy (zrex_t **self_p);
32
+
33
+ // Return true if the expression was valid and compiled without errors.
34
+ CZMQ_EXPORT bool
35
+ zrex_valid (zrex_t *self);
36
+
37
+ // Return the error message generated during compilation of the expression.
38
+ CZMQ_EXPORT const char *
39
+ zrex_strerror (zrex_t *self);
40
+
41
+ // Returns true if the text matches the previously compiled expression.
42
+ // Use this method to compare one expression against many strings.
43
+ CZMQ_EXPORT bool
44
+ zrex_matches (zrex_t *self, const char *text);
45
+
46
+ // Returns true if the text matches the supplied expression. Use this
47
+ // method to compare one string against several expressions.
48
+ CZMQ_EXPORT bool
49
+ zrex_eq (zrex_t *self, const char *text, const char *expression);
50
+
51
+ // Returns number of hits from last zrex_matches or zrex_eq. If the text
52
+ // matched, returns 1 plus the number of capture groups. If the text did
53
+ // not match, returns zero. To retrieve individual capture groups, call
54
+ // zrex_hit ().
55
+ CZMQ_EXPORT int
56
+ zrex_hits (zrex_t *self);
57
+
58
+ // Returns the Nth capture group from the last expression match, where
59
+ // N is 0 to the value returned by zrex_hits(). Capture group 0 is the
60
+ // whole matching string. Sequence 1 is the first capture group, if any,
61
+ // and so on.
62
+ CZMQ_EXPORT const char *
63
+ zrex_hit (zrex_t *self, uint index);
64
+
65
+ // Fetches hits into string variables provided by caller; this makes for
66
+ // nicer code than accessing hits by index. Caller should not modify nor
67
+ // free the returned values. Returns number of strings returned. This
68
+ // method starts at hit 1, i.e. first capture group, as hit 0 is always
69
+ // the original matched string.
70
+ CZMQ_EXPORT int
71
+ zrex_fetch (zrex_t *self, const char **string_p, ...);
72
+
73
+ // Self test of this class
74
+ CZMQ_EXPORT void
75
+ zrex_test (bool verbose);
76
+ // @end
77
+
78
+ #ifdef __cplusplus
79
+ }
80
+ #endif
81
+
82
+ #endif
@@ -0,0 +1,912 @@
1
+ /* =========================================================================
2
+ zsock - high-level socket API that hides libzmq contexts and sockets
3
+
4
+ Copyright (c) the Contributors as noted in the AUTHORS file.
5
+ This file is part of CZMQ, the high-level C binding for 0MQ:
6
+ http://czmq.zeromq.org.
7
+
8
+ This Source Code Form is subject to the terms of the Mozilla Public
9
+ License, v. 2.0. If a copy of the MPL was not distributed with this
10
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+ =========================================================================
12
+ */
13
+
14
+ #ifndef __ZSOCK_H_INCLUDED__
15
+ #define __ZSOCK_H_INCLUDED__
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ // This interface includes some smart constructors, which create sockets with
22
+ // additional set-up. In all of these, the endpoint is NULL, or starts with
23
+ // '@' (bind) or '>' (connect). Multiple endpoints are allowed, separated by
24
+ // commas. If endpoint does not start with '@' or '>', default action depends
25
+ // on socket type.
26
+
27
+ // @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
28
+ // @warning Please edit the model at "api/zsock.api" to make changes.
29
+ // @interface
30
+ // This is a stable class, and may not change except for emergencies. It
31
+ // is provided in stable builds.
32
+ // This class has draft methods, which may change over time. They are not
33
+ // in stable releases, by default. Use --enable-drafts to enable.
34
+ // Create a new socket. Returns the new socket, or NULL if the new socket
35
+ // could not be created. Note that the symbol zsock_new (and other
36
+ // constructors/destructors for zsock) are redirected to the *_checked
37
+ // variant, enabling intelligent socket leak detection. This can have
38
+ // performance implications if you use a LOT of sockets. To turn off this
39
+ // redirection behaviour, define ZSOCK_NOCHECK.
40
+ CZMQ_EXPORT zsock_t *
41
+ zsock_new (int type);
42
+
43
+ // Create a PUB socket. Default action is bind.
44
+ CZMQ_EXPORT zsock_t *
45
+ zsock_new_pub (const char *endpoint);
46
+
47
+ // Create a SUB socket, and optionally subscribe to some prefix string. Default
48
+ // action is connect.
49
+ CZMQ_EXPORT zsock_t *
50
+ zsock_new_sub (const char *endpoint, const char *subscribe);
51
+
52
+ // Create a REQ socket. Default action is connect.
53
+ CZMQ_EXPORT zsock_t *
54
+ zsock_new_req (const char *endpoint);
55
+
56
+ // Create a REP socket. Default action is bind.
57
+ CZMQ_EXPORT zsock_t *
58
+ zsock_new_rep (const char *endpoint);
59
+
60
+ // Create a DEALER socket. Default action is connect.
61
+ CZMQ_EXPORT zsock_t *
62
+ zsock_new_dealer (const char *endpoint);
63
+
64
+ // Create a ROUTER socket. Default action is bind.
65
+ CZMQ_EXPORT zsock_t *
66
+ zsock_new_router (const char *endpoint);
67
+
68
+ // Create a PUSH socket. Default action is connect.
69
+ CZMQ_EXPORT zsock_t *
70
+ zsock_new_push (const char *endpoint);
71
+
72
+ // Create a PULL socket. Default action is bind.
73
+ CZMQ_EXPORT zsock_t *
74
+ zsock_new_pull (const char *endpoint);
75
+
76
+ // Create an XPUB socket. Default action is bind.
77
+ CZMQ_EXPORT zsock_t *
78
+ zsock_new_xpub (const char *endpoint);
79
+
80
+ // Create an XSUB socket. Default action is connect.
81
+ CZMQ_EXPORT zsock_t *
82
+ zsock_new_xsub (const char *endpoint);
83
+
84
+ // Create a PAIR socket. Default action is connect.
85
+ CZMQ_EXPORT zsock_t *
86
+ zsock_new_pair (const char *endpoint);
87
+
88
+ // Create a STREAM socket. Default action is connect.
89
+ CZMQ_EXPORT zsock_t *
90
+ zsock_new_stream (const char *endpoint);
91
+
92
+ // Destroy the socket. You must use this for any socket created via the
93
+ // zsock_new method.
94
+ CZMQ_EXPORT void
95
+ zsock_destroy (zsock_t **self_p);
96
+
97
+ // Bind a socket to a formatted endpoint. For tcp:// endpoints, supports
98
+ // ephemeral ports, if you specify the port number as "*". By default
99
+ // zsock uses the IANA designated range from C000 (49152) to FFFF (65535).
100
+ // To override this range, follow the "*" with "[first-last]". Either or
101
+ // both first and last may be empty. To bind to a random port within the
102
+ // range, use "!" in place of "*".
103
+ //
104
+ // Examples:
105
+ // tcp://127.0.0.1:* bind to first free port from C000 up
106
+ // tcp://127.0.0.1:! bind to random port from C000 to FFFF
107
+ // tcp://127.0.0.1:*[60000-] bind to first free port from 60000 up
108
+ // tcp://127.0.0.1:![-60000] bind to random port from C000 to 60000
109
+ // tcp://127.0.0.1:![55000-55999]
110
+ // bind to random port from 55000 to 55999
111
+ //
112
+ // On success, returns the actual port number used, for tcp:// endpoints,
113
+ // and 0 for other transports. On failure, returns -1. Note that when using
114
+ // ephemeral ports, a port may be reused by different services without
115
+ // clients being aware. Protocols that run on ephemeral ports should take
116
+ // this into account.
117
+ CZMQ_EXPORT int
118
+ zsock_bind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2);
119
+
120
+ // Returns last bound endpoint, if any.
121
+ CZMQ_EXPORT const char *
122
+ zsock_endpoint (zsock_t *self);
123
+
124
+ // Unbind a socket from a formatted endpoint.
125
+ // Returns 0 if OK, -1 if the endpoint was invalid or the function
126
+ // isn't supported.
127
+ CZMQ_EXPORT int
128
+ zsock_unbind (zsock_t *self, const char *format, ...) CHECK_PRINTF (2);
129
+
130
+ // Connect a socket to a formatted endpoint
131
+ // Returns 0 if OK, -1 if the endpoint was invalid.
132
+ CZMQ_EXPORT int
133
+ zsock_connect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2);
134
+
135
+ // Disconnect a socket from a formatted endpoint
136
+ // Returns 0 if OK, -1 if the endpoint was invalid or the function
137
+ // isn't supported.
138
+ CZMQ_EXPORT int
139
+ zsock_disconnect (zsock_t *self, const char *format, ...) CHECK_PRINTF (2);
140
+
141
+ // Attach a socket to zero or more endpoints. If endpoints is not null,
142
+ // parses as list of ZeroMQ endpoints, separated by commas, and prefixed by
143
+ // '@' (to bind the socket) or '>' (to connect the socket). Returns 0 if all
144
+ // endpoints were valid, or -1 if there was a syntax error. If the endpoint
145
+ // does not start with '@' or '>', the serverish argument defines whether
146
+ // it is used to bind (serverish = true) or connect (serverish = false).
147
+ CZMQ_EXPORT int
148
+ zsock_attach (zsock_t *self, const char *endpoints, bool serverish);
149
+
150
+ // Returns socket type as printable constant string.
151
+ CZMQ_EXPORT const char *
152
+ zsock_type_str (zsock_t *self);
153
+
154
+ // Send a 'picture' message to the socket (or actor). The picture is a
155
+ // string that defines the type of each frame. This makes it easy to send
156
+ // a complex multiframe message in one call. The picture can contain any
157
+ // of these characters, each corresponding to one or two arguments:
158
+ //
159
+ // i = int (signed)
160
+ // 1 = uint8_t
161
+ // 2 = uint16_t
162
+ // 4 = uint32_t
163
+ // 8 = uint64_t
164
+ // s = char *
165
+ // b = byte *, size_t (2 arguments)
166
+ // c = zchunk_t *
167
+ // f = zframe_t *
168
+ // h = zhashx_t *
169
+ // U = zuuid_t *
170
+ // p = void * (sends the pointer value, only meaningful over inproc)
171
+ // m = zmsg_t * (sends all frames in the zmsg)
172
+ // z = sends zero-sized frame (0 arguments)
173
+ // u = uint (deprecated)
174
+ //
175
+ // Note that s, b, c, and f are encoded the same way and the choice is
176
+ // offered as a convenience to the sender, which may or may not already
177
+ // have data in a zchunk or zframe. Does not change or take ownership of
178
+ // any arguments. Returns 0 if successful, -1 if sending failed for any
179
+ // reason.
180
+ CZMQ_EXPORT int
181
+ zsock_send (void *self, const char *picture, ...);
182
+
183
+ // Send a 'picture' message to the socket (or actor). This is a va_list
184
+ // version of zsock_send (), so please consult its documentation for the
185
+ // details.
186
+ CZMQ_EXPORT int
187
+ zsock_vsend (void *self, const char *picture, va_list argptr);
188
+
189
+ // Receive a 'picture' message to the socket (or actor). See zsock_send for
190
+ // the format and meaning of the picture. Returns the picture elements into
191
+ // a series of pointers as provided by the caller:
192
+ //
193
+ // i = int * (stores signed integer)
194
+ // 4 = uint32_t * (stores 32-bit unsigned integer)
195
+ // 8 = uint64_t * (stores 64-bit unsigned integer)
196
+ // s = char ** (allocates new string)
197
+ // b = byte **, size_t * (2 arguments) (allocates memory)
198
+ // c = zchunk_t ** (creates zchunk)
199
+ // f = zframe_t ** (creates zframe)
200
+ // U = zuuid_t * (creates a zuuid with the data)
201
+ // h = zhashx_t ** (creates zhashx)
202
+ // p = void ** (stores pointer)
203
+ // m = zmsg_t ** (creates a zmsg with the remaing frames)
204
+ // z = null, asserts empty frame (0 arguments)
205
+ // u = uint * (stores unsigned integer, deprecated)
206
+ //
207
+ // Note that zsock_recv creates the returned objects, and the caller must
208
+ // destroy them when finished with them. The supplied pointers do not need
209
+ // to be initialized. Returns 0 if successful, or -1 if it failed to recv
210
+ // a message, in which case the pointers are not modified. When message
211
+ // frames are truncated (a short message), sets return values to zero/null.
212
+ // If an argument pointer is NULL, does not store any value (skips it).
213
+ // An 'n' picture matches an empty frame; if the message does not match,
214
+ // the method will return -1.
215
+ CZMQ_EXPORT int
216
+ zsock_recv (void *self, const char *picture, ...);
217
+
218
+ // Receive a 'picture' message from the socket (or actor). This is a
219
+ // va_list version of zsock_recv (), so please consult its documentation
220
+ // for the details.
221
+ CZMQ_EXPORT int
222
+ zsock_vrecv (void *self, const char *picture, va_list argptr);
223
+
224
+ // Send a binary encoded 'picture' message to the socket (or actor). This
225
+ // method is similar to zsock_send, except the arguments are encoded in a
226
+ // binary format that is compatible with zproto, and is designed to reduce
227
+ // memory allocations. The pattern argument is a string that defines the
228
+ // type of each argument. Supports these argument types:
229
+ //
230
+ // pattern C type zproto type:
231
+ // 1 uint8_t type = "number" size = "1"
232
+ // 2 uint16_t type = "number" size = "2"
233
+ // 4 uint32_t type = "number" size = "3"
234
+ // 8 uint64_t type = "number" size = "4"
235
+ // s char *, 0-255 chars type = "string"
236
+ // S char *, 0-2^32-1 chars type = "longstr"
237
+ // c zchunk_t * type = "chunk"
238
+ // f zframe_t * type = "frame"
239
+ // u zuuid_t * type = "uuid"
240
+ // m zmsg_t * type = "msg"
241
+ // p void *, sends pointer value, only over inproc
242
+ //
243
+ // Does not change or take ownership of any arguments. Returns 0 if
244
+ // successful, -1 if sending failed for any reason.
245
+ CZMQ_EXPORT int
246
+ zsock_bsend (void *self, const char *picture, ...);
247
+
248
+ // Receive a binary encoded 'picture' message from the socket (or actor).
249
+ // This method is similar to zsock_recv, except the arguments are encoded
250
+ // in a binary format that is compatible with zproto, and is designed to
251
+ // reduce memory allocations. The pattern argument is a string that defines
252
+ // the type of each argument. See zsock_bsend for the supported argument
253
+ // types. All arguments must be pointers; this call sets them to point to
254
+ // values held on a per-socket basis.
255
+ // Note that zsock_brecv creates the returned objects, and the caller must
256
+ // destroy them when finished with them. The supplied pointers do not need
257
+ // to be initialized. Returns 0 if successful, or -1 if it failed to read
258
+ // a message.
259
+ CZMQ_EXPORT int
260
+ zsock_brecv (void *self, const char *picture, ...);
261
+
262
+ // Set socket to use unbounded pipes (HWM=0); use this in cases when you are
263
+ // totally certain the message volume can fit in memory. This method works
264
+ // across all versions of ZeroMQ. Takes a polymorphic socket reference.
265
+ CZMQ_EXPORT void
266
+ zsock_set_unbounded (void *self);
267
+
268
+ // Send a signal over a socket. A signal is a short message carrying a
269
+ // success/failure code (by convention, 0 means OK). Signals are encoded
270
+ // to be distinguishable from "normal" messages. Accepts a zsock_t or a
271
+ // zactor_t argument, and returns 0 if successful, -1 if the signal could
272
+ // not be sent. Takes a polymorphic socket reference.
273
+ CZMQ_EXPORT int
274
+ zsock_signal (void *self, byte status);
275
+
276
+ // Wait on a signal. Use this to coordinate between threads, over pipe
277
+ // pairs. Blocks until the signal is received. Returns -1 on error, 0 or
278
+ // greater on success. Accepts a zsock_t or a zactor_t as argument.
279
+ // Takes a polymorphic socket reference.
280
+ CZMQ_EXPORT int
281
+ zsock_wait (void *self);
282
+
283
+ // If there is a partial message still waiting on the socket, remove and
284
+ // discard it. This is useful when reading partial messages, to get specific
285
+ // message types.
286
+ CZMQ_EXPORT void
287
+ zsock_flush (void *self);
288
+
289
+ // Probe the supplied object, and report if it looks like a zsock_t.
290
+ // Takes a polymorphic socket reference.
291
+ CZMQ_EXPORT bool
292
+ zsock_is (void *self);
293
+
294
+ // Probe the supplied reference. If it looks like a zsock_t instance, return
295
+ // the underlying libzmq socket handle; else if it looks like a file
296
+ // descriptor, return NULL; else if it looks like a libzmq socket handle,
297
+ // return the supplied value. Takes a polymorphic socket reference.
298
+ CZMQ_EXPORT void *
299
+ zsock_resolve (void *self);
300
+
301
+ // Get socket option `tos`.
302
+ // Caller owns return value and must destroy it when done.
303
+ CZMQ_EXPORT int
304
+ zsock_tos (void *self);
305
+
306
+ // Set socket option `tos`.
307
+ CZMQ_EXPORT void
308
+ zsock_set_tos (void *self, int tos);
309
+
310
+ // Set socket option `router_handover`.
311
+ CZMQ_EXPORT void
312
+ zsock_set_router_handover (void *self, int router_handover);
313
+
314
+ // Set socket option `router_mandatory`.
315
+ CZMQ_EXPORT void
316
+ zsock_set_router_mandatory (void *self, int router_mandatory);
317
+
318
+ // Set socket option `probe_router`.
319
+ CZMQ_EXPORT void
320
+ zsock_set_probe_router (void *self, int probe_router);
321
+
322
+ // Set socket option `req_relaxed`.
323
+ CZMQ_EXPORT void
324
+ zsock_set_req_relaxed (void *self, int req_relaxed);
325
+
326
+ // Set socket option `req_correlate`.
327
+ CZMQ_EXPORT void
328
+ zsock_set_req_correlate (void *self, int req_correlate);
329
+
330
+ // Set socket option `conflate`.
331
+ CZMQ_EXPORT void
332
+ zsock_set_conflate (void *self, int conflate);
333
+
334
+ // Get socket option `zap_domain`.
335
+ // Caller owns return value and must destroy it when done.
336
+ CZMQ_EXPORT char *
337
+ zsock_zap_domain (void *self);
338
+
339
+ // Set socket option `zap_domain`.
340
+ CZMQ_EXPORT void
341
+ zsock_set_zap_domain (void *self, const char *zap_domain);
342
+
343
+ // Get socket option `mechanism`.
344
+ // Caller owns return value and must destroy it when done.
345
+ CZMQ_EXPORT int
346
+ zsock_mechanism (void *self);
347
+
348
+ // Get socket option `plain_server`.
349
+ // Caller owns return value and must destroy it when done.
350
+ CZMQ_EXPORT int
351
+ zsock_plain_server (void *self);
352
+
353
+ // Set socket option `plain_server`.
354
+ CZMQ_EXPORT void
355
+ zsock_set_plain_server (void *self, int plain_server);
356
+
357
+ // Get socket option `plain_username`.
358
+ // Caller owns return value and must destroy it when done.
359
+ CZMQ_EXPORT char *
360
+ zsock_plain_username (void *self);
361
+
362
+ // Set socket option `plain_username`.
363
+ CZMQ_EXPORT void
364
+ zsock_set_plain_username (void *self, const char *plain_username);
365
+
366
+ // Get socket option `plain_password`.
367
+ // Caller owns return value and must destroy it when done.
368
+ CZMQ_EXPORT char *
369
+ zsock_plain_password (void *self);
370
+
371
+ // Set socket option `plain_password`.
372
+ CZMQ_EXPORT void
373
+ zsock_set_plain_password (void *self, const char *plain_password);
374
+
375
+ // Get socket option `curve_server`.
376
+ // Caller owns return value and must destroy it when done.
377
+ CZMQ_EXPORT int
378
+ zsock_curve_server (void *self);
379
+
380
+ // Set socket option `curve_server`.
381
+ CZMQ_EXPORT void
382
+ zsock_set_curve_server (void *self, int curve_server);
383
+
384
+ // Get socket option `curve_publickey`.
385
+ // Caller owns return value and must destroy it when done.
386
+ CZMQ_EXPORT char *
387
+ zsock_curve_publickey (void *self);
388
+
389
+ // Set socket option `curve_publickey`.
390
+ CZMQ_EXPORT void
391
+ zsock_set_curve_publickey (void *self, const char *curve_publickey);
392
+
393
+ // Set socket option `curve_publickey` from 32-octet binary
394
+ CZMQ_EXPORT void
395
+ zsock_set_curve_publickey_bin (void *self, const byte *curve_publickey);
396
+
397
+ // Get socket option `curve_secretkey`.
398
+ // Caller owns return value and must destroy it when done.
399
+ CZMQ_EXPORT char *
400
+ zsock_curve_secretkey (void *self);
401
+
402
+ // Set socket option `curve_secretkey`.
403
+ CZMQ_EXPORT void
404
+ zsock_set_curve_secretkey (void *self, const char *curve_secretkey);
405
+
406
+ // Set socket option `curve_secretkey` from 32-octet binary
407
+ CZMQ_EXPORT void
408
+ zsock_set_curve_secretkey_bin (void *self, const byte *curve_secretkey);
409
+
410
+ // Get socket option `curve_serverkey`.
411
+ // Caller owns return value and must destroy it when done.
412
+ CZMQ_EXPORT char *
413
+ zsock_curve_serverkey (void *self);
414
+
415
+ // Set socket option `curve_serverkey`.
416
+ CZMQ_EXPORT void
417
+ zsock_set_curve_serverkey (void *self, const char *curve_serverkey);
418
+
419
+ // Set socket option `curve_serverkey` from 32-octet binary
420
+ CZMQ_EXPORT void
421
+ zsock_set_curve_serverkey_bin (void *self, const byte *curve_serverkey);
422
+
423
+ // Get socket option `gssapi_server`.
424
+ // Caller owns return value and must destroy it when done.
425
+ CZMQ_EXPORT int
426
+ zsock_gssapi_server (void *self);
427
+
428
+ // Set socket option `gssapi_server`.
429
+ CZMQ_EXPORT void
430
+ zsock_set_gssapi_server (void *self, int gssapi_server);
431
+
432
+ // Get socket option `gssapi_plaintext`.
433
+ // Caller owns return value and must destroy it when done.
434
+ CZMQ_EXPORT int
435
+ zsock_gssapi_plaintext (void *self);
436
+
437
+ // Set socket option `gssapi_plaintext`.
438
+ CZMQ_EXPORT void
439
+ zsock_set_gssapi_plaintext (void *self, int gssapi_plaintext);
440
+
441
+ // Get socket option `gssapi_principal`.
442
+ // Caller owns return value and must destroy it when done.
443
+ CZMQ_EXPORT char *
444
+ zsock_gssapi_principal (void *self);
445
+
446
+ // Set socket option `gssapi_principal`.
447
+ CZMQ_EXPORT void
448
+ zsock_set_gssapi_principal (void *self, const char *gssapi_principal);
449
+
450
+ // Get socket option `gssapi_service_principal`.
451
+ // Caller owns return value and must destroy it when done.
452
+ CZMQ_EXPORT char *
453
+ zsock_gssapi_service_principal (void *self);
454
+
455
+ // Set socket option `gssapi_service_principal`.
456
+ CZMQ_EXPORT void
457
+ zsock_set_gssapi_service_principal (void *self, const char *gssapi_service_principal);
458
+
459
+ // Get socket option `ipv6`.
460
+ // Caller owns return value and must destroy it when done.
461
+ CZMQ_EXPORT int
462
+ zsock_ipv6 (void *self);
463
+
464
+ // Set socket option `ipv6`.
465
+ CZMQ_EXPORT void
466
+ zsock_set_ipv6 (void *self, int ipv6);
467
+
468
+ // Get socket option `immediate`.
469
+ // Caller owns return value and must destroy it when done.
470
+ CZMQ_EXPORT int
471
+ zsock_immediate (void *self);
472
+
473
+ // Set socket option `immediate`.
474
+ CZMQ_EXPORT void
475
+ zsock_set_immediate (void *self, int immediate);
476
+
477
+ // Set socket option `router_raw`.
478
+ CZMQ_EXPORT void
479
+ zsock_set_router_raw (void *self, int router_raw);
480
+
481
+ // Get socket option `ipv4only`.
482
+ // Caller owns return value and must destroy it when done.
483
+ CZMQ_EXPORT int
484
+ zsock_ipv4only (void *self);
485
+
486
+ // Set socket option `ipv4only`.
487
+ CZMQ_EXPORT void
488
+ zsock_set_ipv4only (void *self, int ipv4only);
489
+
490
+ // Set socket option `delay_attach_on_connect`.
491
+ CZMQ_EXPORT void
492
+ zsock_set_delay_attach_on_connect (void *self, int delay_attach_on_connect);
493
+
494
+ // Get socket option `type`.
495
+ // Caller owns return value and must destroy it when done.
496
+ CZMQ_EXPORT int
497
+ zsock_type (void *self);
498
+
499
+ // Get socket option `sndhwm`.
500
+ // Caller owns return value and must destroy it when done.
501
+ CZMQ_EXPORT int
502
+ zsock_sndhwm (void *self);
503
+
504
+ // Set socket option `sndhwm`.
505
+ CZMQ_EXPORT void
506
+ zsock_set_sndhwm (void *self, int sndhwm);
507
+
508
+ // Get socket option `rcvhwm`.
509
+ // Caller owns return value and must destroy it when done.
510
+ CZMQ_EXPORT int
511
+ zsock_rcvhwm (void *self);
512
+
513
+ // Set socket option `rcvhwm`.
514
+ CZMQ_EXPORT void
515
+ zsock_set_rcvhwm (void *self, int rcvhwm);
516
+
517
+ // Get socket option `affinity`.
518
+ // Caller owns return value and must destroy it when done.
519
+ CZMQ_EXPORT int
520
+ zsock_affinity (void *self);
521
+
522
+ // Set socket option `affinity`.
523
+ CZMQ_EXPORT void
524
+ zsock_set_affinity (void *self, int affinity);
525
+
526
+ // Set socket option `subscribe`.
527
+ CZMQ_EXPORT void
528
+ zsock_set_subscribe (void *self, const char *subscribe);
529
+
530
+ // Set socket option `unsubscribe`.
531
+ CZMQ_EXPORT void
532
+ zsock_set_unsubscribe (void *self, const char *unsubscribe);
533
+
534
+ // Get socket option `identity`.
535
+ // Caller owns return value and must destroy it when done.
536
+ CZMQ_EXPORT char *
537
+ zsock_identity (void *self);
538
+
539
+ // Set socket option `identity`.
540
+ CZMQ_EXPORT void
541
+ zsock_set_identity (void *self, const char *identity);
542
+
543
+ // Get socket option `rate`.
544
+ // Caller owns return value and must destroy it when done.
545
+ CZMQ_EXPORT int
546
+ zsock_rate (void *self);
547
+
548
+ // Set socket option `rate`.
549
+ CZMQ_EXPORT void
550
+ zsock_set_rate (void *self, int rate);
551
+
552
+ // Get socket option `recovery_ivl`.
553
+ // Caller owns return value and must destroy it when done.
554
+ CZMQ_EXPORT int
555
+ zsock_recovery_ivl (void *self);
556
+
557
+ // Set socket option `recovery_ivl`.
558
+ CZMQ_EXPORT void
559
+ zsock_set_recovery_ivl (void *self, int recovery_ivl);
560
+
561
+ // Get socket option `sndbuf`.
562
+ // Caller owns return value and must destroy it when done.
563
+ CZMQ_EXPORT int
564
+ zsock_sndbuf (void *self);
565
+
566
+ // Set socket option `sndbuf`.
567
+ CZMQ_EXPORT void
568
+ zsock_set_sndbuf (void *self, int sndbuf);
569
+
570
+ // Get socket option `rcvbuf`.
571
+ // Caller owns return value and must destroy it when done.
572
+ CZMQ_EXPORT int
573
+ zsock_rcvbuf (void *self);
574
+
575
+ // Set socket option `rcvbuf`.
576
+ CZMQ_EXPORT void
577
+ zsock_set_rcvbuf (void *self, int rcvbuf);
578
+
579
+ // Get socket option `linger`.
580
+ // Caller owns return value and must destroy it when done.
581
+ CZMQ_EXPORT int
582
+ zsock_linger (void *self);
583
+
584
+ // Set socket option `linger`.
585
+ CZMQ_EXPORT void
586
+ zsock_set_linger (void *self, int linger);
587
+
588
+ // Get socket option `reconnect_ivl`.
589
+ // Caller owns return value and must destroy it when done.
590
+ CZMQ_EXPORT int
591
+ zsock_reconnect_ivl (void *self);
592
+
593
+ // Set socket option `reconnect_ivl`.
594
+ CZMQ_EXPORT void
595
+ zsock_set_reconnect_ivl (void *self, int reconnect_ivl);
596
+
597
+ // Get socket option `reconnect_ivl_max`.
598
+ // Caller owns return value and must destroy it when done.
599
+ CZMQ_EXPORT int
600
+ zsock_reconnect_ivl_max (void *self);
601
+
602
+ // Set socket option `reconnect_ivl_max`.
603
+ CZMQ_EXPORT void
604
+ zsock_set_reconnect_ivl_max (void *self, int reconnect_ivl_max);
605
+
606
+ // Get socket option `backlog`.
607
+ // Caller owns return value and must destroy it when done.
608
+ CZMQ_EXPORT int
609
+ zsock_backlog (void *self);
610
+
611
+ // Set socket option `backlog`.
612
+ CZMQ_EXPORT void
613
+ zsock_set_backlog (void *self, int backlog);
614
+
615
+ // Get socket option `maxmsgsize`.
616
+ // Caller owns return value and must destroy it when done.
617
+ CZMQ_EXPORT int
618
+ zsock_maxmsgsize (void *self);
619
+
620
+ // Set socket option `maxmsgsize`.
621
+ CZMQ_EXPORT void
622
+ zsock_set_maxmsgsize (void *self, int maxmsgsize);
623
+
624
+ // Get socket option `multicast_hops`.
625
+ // Caller owns return value and must destroy it when done.
626
+ CZMQ_EXPORT int
627
+ zsock_multicast_hops (void *self);
628
+
629
+ // Set socket option `multicast_hops`.
630
+ CZMQ_EXPORT void
631
+ zsock_set_multicast_hops (void *self, int multicast_hops);
632
+
633
+ // Get socket option `rcvtimeo`.
634
+ // Caller owns return value and must destroy it when done.
635
+ CZMQ_EXPORT int
636
+ zsock_rcvtimeo (void *self);
637
+
638
+ // Set socket option `rcvtimeo`.
639
+ CZMQ_EXPORT void
640
+ zsock_set_rcvtimeo (void *self, int rcvtimeo);
641
+
642
+ // Get socket option `sndtimeo`.
643
+ // Caller owns return value and must destroy it when done.
644
+ CZMQ_EXPORT int
645
+ zsock_sndtimeo (void *self);
646
+
647
+ // Set socket option `sndtimeo`.
648
+ CZMQ_EXPORT void
649
+ zsock_set_sndtimeo (void *self, int sndtimeo);
650
+
651
+ // Set socket option `xpub_verbose`.
652
+ CZMQ_EXPORT void
653
+ zsock_set_xpub_verbose (void *self, int xpub_verbose);
654
+
655
+ // Get socket option `tcp_keepalive`.
656
+ // Caller owns return value and must destroy it when done.
657
+ CZMQ_EXPORT int
658
+ zsock_tcp_keepalive (void *self);
659
+
660
+ // Set socket option `tcp_keepalive`.
661
+ CZMQ_EXPORT void
662
+ zsock_set_tcp_keepalive (void *self, int tcp_keepalive);
663
+
664
+ // Get socket option `tcp_keepalive_idle`.
665
+ // Caller owns return value and must destroy it when done.
666
+ CZMQ_EXPORT int
667
+ zsock_tcp_keepalive_idle (void *self);
668
+
669
+ // Set socket option `tcp_keepalive_idle`.
670
+ CZMQ_EXPORT void
671
+ zsock_set_tcp_keepalive_idle (void *self, int tcp_keepalive_idle);
672
+
673
+ // Get socket option `tcp_keepalive_cnt`.
674
+ // Caller owns return value and must destroy it when done.
675
+ CZMQ_EXPORT int
676
+ zsock_tcp_keepalive_cnt (void *self);
677
+
678
+ // Set socket option `tcp_keepalive_cnt`.
679
+ CZMQ_EXPORT void
680
+ zsock_set_tcp_keepalive_cnt (void *self, int tcp_keepalive_cnt);
681
+
682
+ // Get socket option `tcp_keepalive_intvl`.
683
+ // Caller owns return value and must destroy it when done.
684
+ CZMQ_EXPORT int
685
+ zsock_tcp_keepalive_intvl (void *self);
686
+
687
+ // Set socket option `tcp_keepalive_intvl`.
688
+ CZMQ_EXPORT void
689
+ zsock_set_tcp_keepalive_intvl (void *self, int tcp_keepalive_intvl);
690
+
691
+ // Get socket option `tcp_accept_filter`.
692
+ // Caller owns return value and must destroy it when done.
693
+ CZMQ_EXPORT char *
694
+ zsock_tcp_accept_filter (void *self);
695
+
696
+ // Set socket option `tcp_accept_filter`.
697
+ CZMQ_EXPORT void
698
+ zsock_set_tcp_accept_filter (void *self, const char *tcp_accept_filter);
699
+
700
+ // Get socket option `rcvmore`.
701
+ // Caller owns return value and must destroy it when done.
702
+ CZMQ_EXPORT int
703
+ zsock_rcvmore (void *self);
704
+
705
+ // Get socket option `fd`.
706
+ // Caller owns return value and must destroy it when done.
707
+ CZMQ_EXPORT SOCKET
708
+ zsock_fd (void *self);
709
+
710
+ // Get socket option `events`.
711
+ // Caller owns return value and must destroy it when done.
712
+ CZMQ_EXPORT int
713
+ zsock_events (void *self);
714
+
715
+ // Get socket option `last_endpoint`.
716
+ // Caller owns return value and must destroy it when done.
717
+ CZMQ_EXPORT char *
718
+ zsock_last_endpoint (void *self);
719
+
720
+ // Self test of this class.
721
+ CZMQ_EXPORT void
722
+ zsock_test (bool verbose);
723
+
724
+ #ifdef CZMQ_BUILD_DRAFT_API
725
+ // *** Draft method, for development use, may change without warning ***
726
+ // Create a SERVER socket. Default action is bind.
727
+ CZMQ_EXPORT zsock_t *
728
+ zsock_new_server (const char *endpoint);
729
+
730
+ // *** Draft method, for development use, may change without warning ***
731
+ // Create a CLIENT socket. Default action is connect.
732
+ CZMQ_EXPORT zsock_t *
733
+ zsock_new_client (const char *endpoint);
734
+
735
+ // *** Draft method, for development use, may change without warning ***
736
+ // Create a RADIO socket. Default action is bind.
737
+ CZMQ_EXPORT zsock_t *
738
+ zsock_new_radio (const char *endpoint);
739
+
740
+ // *** Draft method, for development use, may change without warning ***
741
+ // Create a DISH socket. Default action is connect.
742
+ CZMQ_EXPORT zsock_t *
743
+ zsock_new_dish (const char *endpoint);
744
+
745
+ // *** Draft method, for development use, may change without warning ***
746
+ // Create a GATHER socket. Default action is bind.
747
+ CZMQ_EXPORT zsock_t *
748
+ zsock_new_gather (const char *endpoint);
749
+
750
+ // *** Draft method, for development use, may change without warning ***
751
+ // Create a SCATTER socket. Default action is connect.
752
+ CZMQ_EXPORT zsock_t *
753
+ zsock_new_scatter (const char *endpoint);
754
+
755
+ // *** Draft method, for development use, may change without warning ***
756
+ // Return socket routing ID if any. This returns 0 if the socket is not
757
+ // of type ZMQ_SERVER or if no request was already received on it.
758
+ CZMQ_EXPORT uint32_t
759
+ zsock_routing_id (zsock_t *self);
760
+
761
+ // *** Draft method, for development use, may change without warning ***
762
+ // Set routing ID on socket. The socket MUST be of type ZMQ_SERVER.
763
+ // This will be used when sending messages on the socket via the zsock API.
764
+ CZMQ_EXPORT void
765
+ zsock_set_routing_id (zsock_t *self, uint32_t routing_id);
766
+
767
+ // *** Draft method, for development use, may change without warning ***
768
+ // Join a group for the RADIO-DISH pattern. Call only on ZMQ_DISH.
769
+ // Returns 0 if OK, -1 if failed.
770
+ CZMQ_EXPORT int
771
+ zsock_join (void *self, const char *group);
772
+
773
+ // *** Draft method, for development use, may change without warning ***
774
+ // Leave a group for the RADIO-DISH pattern. Call only on ZMQ_DISH.
775
+ // Returns 0 if OK, -1 if failed.
776
+ CZMQ_EXPORT int
777
+ zsock_leave (void *self, const char *group);
778
+
779
+ // *** Draft method, for development use, may change without warning ***
780
+ // Get socket option `heartbeat_ivl`.
781
+ // Caller owns return value and must destroy it when done.
782
+ CZMQ_EXPORT int
783
+ zsock_heartbeat_ivl (void *self);
784
+
785
+ // *** Draft method, for development use, may change without warning ***
786
+ // Set socket option `heartbeat_ivl`.
787
+ CZMQ_EXPORT void
788
+ zsock_set_heartbeat_ivl (void *self, int heartbeat_ivl);
789
+
790
+ // *** Draft method, for development use, may change without warning ***
791
+ // Get socket option `heartbeat_ttl`.
792
+ // Caller owns return value and must destroy it when done.
793
+ CZMQ_EXPORT int
794
+ zsock_heartbeat_ttl (void *self);
795
+
796
+ // *** Draft method, for development use, may change without warning ***
797
+ // Set socket option `heartbeat_ttl`.
798
+ CZMQ_EXPORT void
799
+ zsock_set_heartbeat_ttl (void *self, int heartbeat_ttl);
800
+
801
+ // *** Draft method, for development use, may change without warning ***
802
+ // Get socket option `heartbeat_timeout`.
803
+ // Caller owns return value and must destroy it when done.
804
+ CZMQ_EXPORT int
805
+ zsock_heartbeat_timeout (void *self);
806
+
807
+ // *** Draft method, for development use, may change without warning ***
808
+ // Set socket option `heartbeat_timeout`.
809
+ CZMQ_EXPORT void
810
+ zsock_set_heartbeat_timeout (void *self, int heartbeat_timeout);
811
+
812
+ // *** Draft method, for development use, may change without warning ***
813
+ // Get socket option `use_fd`.
814
+ // Caller owns return value and must destroy it when done.
815
+ CZMQ_EXPORT int
816
+ zsock_use_fd (void *self);
817
+
818
+ // *** Draft method, for development use, may change without warning ***
819
+ // Set socket option `use_fd`.
820
+ CZMQ_EXPORT void
821
+ zsock_set_use_fd (void *self, int use_fd);
822
+
823
+ #endif // CZMQ_BUILD_DRAFT_API
824
+ // @end
825
+
826
+
827
+ // zsock leak detection - not a part of the official interface to zsock. This
828
+ // enables CZMQ to report socket leaks intelligently.
829
+ #if defined ZSOCK_NOCHECK
830
+ // no checking active - use the above interface methods directly.
831
+ #else
832
+ # define zsock_new(t) zsock_new_checked((t), __FILE__, __LINE__)
833
+ # define zsock_new_pub(e) zsock_new_pub_checked((e), __FILE__, __LINE__)
834
+ # define zsock_new_sub(e,s) zsock_new_sub_checked((e), (s), __FILE__, __LINE__)
835
+ # define zsock_new_req(e) zsock_new_req_checked((e), __FILE__, __LINE__)
836
+ # define zsock_new_rep(e) zsock_new_rep_checked((e), __FILE__, __LINE__)
837
+ # define zsock_new_dealer(e) zsock_new_dealer_checked((e), __FILE__, __LINE__)
838
+ # define zsock_new_router(e) zsock_new_router_checked((e), __FILE__, __LINE__)
839
+ # define zsock_new_pull(e) zsock_new_pull_checked((e), __FILE__, __LINE__)
840
+ # define zsock_new_push(e) zsock_new_push_checked((e), __FILE__, __LINE__)
841
+ # define zsock_new_xpub(e) zsock_new_xpub_checked((e), __FILE__, __LINE__)
842
+ # define zsock_new_xsub(e) zsock_new_xsub_checked((e), __FILE__, __LINE__)
843
+ # define zsock_new_pair(e) zsock_new_pair_checked((e), __FILE__, __LINE__)
844
+ # define zsock_new_stream(e) zsock_new_stream_checked((e), __FILE__, __LINE__)
845
+ # define zsock_destroy(t) zsock_destroy_checked((t), __FILE__, __LINE__)
846
+ #endif
847
+
848
+ CZMQ_EXPORT zsock_t *
849
+ zsock_new_checked (int type, const char *filename, size_t line_nbr);
850
+
851
+ CZMQ_EXPORT void
852
+ zsock_destroy_checked (zsock_t **self_p, const char *filename, size_t line_nbr);
853
+
854
+ CZMQ_EXPORT zsock_t *
855
+ zsock_new_pub_checked (const char *endpoint, const char *filename, size_t line_nbr);
856
+
857
+ CZMQ_EXPORT zsock_t *
858
+ zsock_new_sub_checked (const char *endpoint, const char *subscribe, const char *filename, size_t line_nbr);
859
+
860
+ CZMQ_EXPORT zsock_t *
861
+ zsock_new_req_checked (const char *endpoint, const char *filename, size_t line_nbr);
862
+
863
+ CZMQ_EXPORT zsock_t *
864
+ zsock_new_rep_checked (const char *endpoint, const char *filename, size_t line_nbr);
865
+
866
+ CZMQ_EXPORT zsock_t *
867
+ zsock_new_dealer_checked (const char *endpoint, const char *filename, size_t line_nbr);
868
+
869
+ CZMQ_EXPORT zsock_t *
870
+ zsock_new_router_checked (const char *endpoint, const char *filename, size_t line_nbr);
871
+
872
+ CZMQ_EXPORT zsock_t *
873
+ zsock_new_push_checked (const char *endpoint, const char *filename, size_t line_nbr);
874
+
875
+ CZMQ_EXPORT zsock_t *
876
+ zsock_new_pull_checked (const char *endpoint, const char *filename, size_t line_nbr);
877
+
878
+ CZMQ_EXPORT zsock_t *
879
+ zsock_new_xpub_checked (const char *endpoint, const char *filename, size_t line_nbr);
880
+
881
+ CZMQ_EXPORT zsock_t *
882
+ zsock_new_xsub_checked (const char *endpoint, const char *filename, size_t line_nbr);
883
+
884
+ CZMQ_EXPORT zsock_t *
885
+ zsock_new_pair_checked (const char *endpoint, const char *filename, size_t line_nbr);
886
+
887
+ CZMQ_EXPORT zsock_t *
888
+ zsock_new_stream_checked (const char *endpoint, const char *filename, size_t line_nbr);
889
+
890
+ CZMQ_EXPORT zsock_t *
891
+ zsock_new_server_checked (const char *endpoint, const char *filename, size_t line_nbr);
892
+
893
+ CZMQ_EXPORT zsock_t *
894
+ zsock_new_client_checked (const char *endpoint, const char *filename, size_t line_nbr);
895
+
896
+ CZMQ_EXPORT zsock_t *
897
+ zsock_new_radio_checked (const char *endpoint, const char *filename, size_t line_nbr);
898
+
899
+ CZMQ_EXPORT zsock_t *
900
+ zsock_new_dish_checked (const char *endpoint, const char *filename, size_t line_nbr);
901
+
902
+ CZMQ_EXPORT zsock_t *
903
+ zsock_new_gather_checked (const char *endpoint, const char *filename, size_t line_nbr);
904
+
905
+ CZMQ_EXPORT zsock_t *
906
+ zsock_new_scatter_checked (const char *endpoint, const char *filename, size_t line_nbr);
907
+
908
+ #ifdef __cplusplus
909
+ }
910
+ #endif
911
+
912
+ #endif