1// +build windows 2 3package zmq4 4 5/* 6 7#include <errno.h> 8#include <zmq.h> 9 10#if ZMQ_VERSION_MINOR < 2 11// Version < 4.2.x 12#include <zmq_utils.h> 13int zmq_curve_public (char *z85_public_key, const char *z85_secret_key); 14#endif // Version < 4.2.x 15 16#if ZMQ_VERSION_MINOR < 1 17const char *zmq_msg_gets (zmq_msg_t *msg, const char *property); 18#if ZMQ_VERSION_PATCH < 5 19// Version < 4.0.5 20int zmq_proxy_steerable (const void *frontend, const void *backend, const void *capture, const void *control); 21#endif // Version < 4.0.5 22#endif // Version == 4.0.x 23 24int zmq4_bind (void *socket, const char *endpoint) 25{ 26 int i; 27 i = zmq_bind(socket, endpoint); 28 if (i < 0) 29 errno = zmq_errno(); 30 return i; 31} 32 33int zmq4_close (void *socket) 34{ 35 int i; 36 i = zmq_close(socket); 37 if (i < 0) 38 errno = zmq_errno(); 39 return i; 40} 41 42int zmq4_connect (void *socket, const char *endpoint) 43{ 44 int i; 45 i = zmq_connect(socket, endpoint); 46 if (i < 0) 47 errno = zmq_errno(); 48 return i; 49} 50 51int zmq4_ctx_get (void *context, int option_name) 52{ 53 int i; 54 i = zmq_ctx_get(context, option_name); 55 if (i < 0) 56 errno = zmq_errno(); 57 return i; 58} 59 60void *zmq4_ctx_new () 61{ 62 void *v; 63 v = zmq_ctx_new(); 64 if (v == NULL) 65 errno = zmq_errno(); 66 return v; 67} 68 69int zmq4_ctx_set (void *context, int option_name, int option_value) 70{ 71 int i; 72 i = zmq_ctx_set(context, option_name, option_value); 73 if (i < 0) 74 errno = zmq_errno(); 75 return i; 76} 77 78int zmq4_ctx_term (void *context) 79{ 80 int i; 81 i = zmq_ctx_term(context); 82 if (i < 0) 83 errno = zmq_errno(); 84 return i; 85} 86 87int zmq4_curve_keypair (char *z85_public_key, char *z85_secret_key) 88{ 89 int i; 90 i = zmq_curve_keypair(z85_public_key, z85_secret_key); 91 if (i < 0) 92 errno = zmq_errno(); 93 return i; 94} 95 96int zmq4_curve_public (char *z85_public_key, char *z85_secret_key) 97{ 98 int i; 99 i = zmq_curve_public(z85_public_key, z85_secret_key); 100 if (i < 0) 101 errno = zmq_errno(); 102 return i; 103} 104 105int zmq4_disconnect (void *socket, const char *endpoint) 106{ 107 int i; 108 i = zmq_disconnect(socket, endpoint); 109 if (i < 0) 110 errno = zmq_errno(); 111 return i; 112} 113 114int zmq4_getsockopt (void *socket, int option_name, void *option_value, size_t *option_len) 115{ 116 int i; 117 i = zmq_getsockopt(socket, option_name, option_value, option_len); 118 if (i < 0) 119 errno = zmq_errno(); 120 return i; 121} 122 123const char *zmq4_msg_gets (zmq_msg_t *message, const char *property) 124{ 125 const char *s; 126 s = zmq_msg_gets(message, property); 127 if (s == NULL) 128 errno = zmq_errno(); 129 return s; 130} 131 132int zmq4_msg_recv (zmq_msg_t *msg, void *socket, int flags) 133{ 134 int i; 135 i = zmq_msg_recv(msg, socket, flags); 136 if (i < 0) 137 errno = zmq_errno(); 138 return i; 139} 140 141int zmq4_poll (zmq_pollitem_t *items, int nitems, long timeout) 142{ 143 int i; 144 i = zmq_poll(items, nitems, timeout); 145 if (i < 0) 146 errno = zmq_errno(); 147 return i; 148} 149 150int zmq4_proxy (void *frontend, void *backend, void *capture) 151{ 152 int i; 153 i = zmq_proxy(frontend, backend, capture); 154 errno = zmq_errno(); 155 return i; 156} 157 158int zmq4_proxy_steerable (void *frontend, void *backend, void *capture, void *control) 159{ 160 int i; 161 i = zmq_proxy_steerable(frontend, backend, capture, control); 162 if (i < 0) 163 errno = zmq_errno(); 164 return i; 165} 166 167int zmq4_send (void *socket, void *buf, size_t len, int flags) 168{ 169 int i; 170 i = zmq_send(socket, buf, len, flags); 171 if (i < 0) 172 errno = zmq_errno(); 173 return i; 174} 175 176int zmq4_setsockopt (void *socket, int option_name, const void *option_value, size_t option_len) 177{ 178 int i; 179 i = zmq_setsockopt(socket, option_name, option_value, option_len); 180 if (i < 0) 181 errno = zmq_errno(); 182 return i; 183} 184 185void *zmq4_socket (void *context, int type) 186{ 187 void *v; 188 v = zmq_socket(context, type); 189 if (v == NULL) 190 errno = zmq_errno(); 191 return v; 192} 193 194int zmq4_socket_monitor (void *socket, char *endpoint, int events) 195{ 196 int i; 197 i = zmq_socket_monitor(socket, endpoint, events); 198 if (i < 0) 199 errno = zmq_errno(); 200 return i; 201} 202 203int zmq4_unbind (void *socket, const char *endpoint) 204{ 205 int i; 206 i = zmq_unbind(socket, endpoint); 207 if (i < 0) 208 errno = zmq_errno(); 209 return i; 210} 211 212// DRAFT 213 214int zmq4_msg_init_size (zmq_msg_t *msg, size_t size) 215{ 216 int i; 217 i = zmq_msg_init_size(msg, size); 218 if (i < 0) 219 errno = zmq_errno(); 220 return i; 221} 222 223int zmq4_msg_send (zmq_msg_t *msg, void *socket, int flags) 224{ 225 int i; 226 i = zmq_msg_send(msg, socket, flags); 227 if (i < 0) 228 errno = zmq_errno(); 229 return i; 230} 231 232// not documented, so just assuming about return value... 233int zmq4_msg_set_group (zmq_msg_t *msg, const char *group) 234{ 235 int i; 236 i = zmq_msg_set_group(msg, group); 237 if (i < 0) 238 errno = zmq_errno(); 239 return i; 240} 241 242 243int zmq4_msg_set_routing_id (zmq_msg_t *message, uint32_t routing_id) 244{ 245 int i; 246 i = zmq_msg_set_routing_id(message, routing_id); 247 if (i < 0) 248 errno = zmq_errno(); 249 return i; 250} 251 252// not documented, so just assuming about return value... 253int zmq4_join (void *s, const char *group) 254{ 255 int i; 256 i = zmq_join(s, group); 257 if (i < 0) 258 errno = zmq_errno(); 259 return i; 260} 261 262// not documented, so just assuming about return value... 263int zmq4_leave (void *s, const char *group) 264{ 265 int i; 266 i = zmq_leave(s, group); 267 if (i < 0) 268 errno = zmq_errno(); 269 return i; 270} 271 272*/ 273import "C" 274