forked from pebbe/zmq4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wrappers_windows.go
213 lines (186 loc) · 4.24 KB
/
wrappers_windows.go
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
// +build windows
package zmq4
/*
#include <errno.h>
#include <zmq.h>
#if ZMQ_VERSION_MINOR < 2
// Version < 4.2.x
#include <zmq_utils.h>
int zmq_curve_public (char *z85_public_key, const char *z85_secret_key);
#endif // Version < 4.2.x
#if ZMQ_VERSION_MINOR < 1
const char *zmq_msg_gets (zmq_msg_t *msg, const char *property);
#if ZMQ_VERSION_PATCH < 5
// Version < 4.0.5
int zmq_proxy_steerable (const void *frontend, const void *backend, const void *capture, const void *control);
#endif // Version < 4.0.5
#endif // Version == 4.0.x
int zmq4_bind (void *socket, const char *endpoint)
{
int i;
i = zmq_bind(socket, endpoint);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_close (void *socket)
{
int i;
i = zmq_close(socket);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_connect (void *socket, const char *endpoint)
{
int i;
i = zmq_connect(socket, endpoint);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_ctx_get (void *context, int option_name)
{
int i;
i = zmq_ctx_get(context, option_name);
if (i < 0)
errno = zmq_errno();
return i;
}
void *zmq4_ctx_new ()
{
void *v;
v = zmq_ctx_new();
if (v == NULL)
errno = zmq_errno();
return v;
}
int zmq4_ctx_set (void *context, int option_name, int option_value)
{
int i;
i = zmq_ctx_set(context, option_name, option_value);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_ctx_term (void *context)
{
int i;
i = zmq_ctx_term(context);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_curve_keypair (char *z85_public_key, char *z85_secret_key)
{
int i;
i = zmq_curve_keypair(z85_public_key, z85_secret_key);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_curve_public (char *z85_public_key, char *z85_secret_key)
{
int i;
i = zmq_curve_public(z85_public_key, z85_secret_key);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_disconnect (void *socket, const char *endpoint)
{
int i;
i = zmq_disconnect(socket, endpoint);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_getsockopt (void *socket, int option_name, void *option_value, size_t *option_len)
{
int i;
i = zmq_getsockopt(socket, option_name, option_value, option_len);
if (i < 0)
errno = zmq_errno();
return i;
}
const char *zmq4_msg_gets (zmq_msg_t *message, const char *property)
{
const char *s;
s = zmq_msg_gets(message, property);
if (s == NULL)
errno = zmq_errno();
return s;
}
int zmq4_msg_recv (zmq_msg_t *msg, void *socket, int flags)
{
int i;
i = zmq_msg_recv(msg, socket, flags);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_poll (zmq_pollitem_t *items, int nitems, long timeout)
{
int i;
i = zmq_poll(items, nitems, timeout);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_proxy (void *frontend, void *backend, void *capture)
{
int i;
i = zmq_proxy(frontend, backend, capture);
errno = zmq_errno();
return i;
}
int zmq4_proxy_steerable (void *frontend, void *backend, void *capture, void *control)
{
int i;
i = zmq_proxy_steerable(frontend, backend, capture, control);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_send (void *socket, void *buf, size_t len, int flags)
{
int i;
i = zmq_send(socket, buf, len, flags);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_setsockopt (void *socket, int option_name, const void *option_value, size_t option_len)
{
int i;
i = zmq_setsockopt(socket, option_name, option_value, option_len);
if (i < 0)
errno = zmq_errno();
return i;
}
void *zmq4_socket (void *context, int type)
{
void *v;
v = zmq_socket(context, type);
if (v == NULL)
errno = zmq_errno();
return v;
}
int zmq4_socket_monitor (void *socket, char *endpoint, int events)
{
int i;
i = zmq_socket_monitor(socket, endpoint, events);
if (i < 0)
errno = zmq_errno();
return i;
}
int zmq4_unbind (void *socket, const char *endpoint)
{
int i;
i = zmq_unbind(socket, endpoint);
if (i < 0)
errno = zmq_errno();
return i;
}
*/
import "C"