forked from alecthomas/gozmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zmqgen_2_2.go
306 lines (266 loc) · 7.85 KB
/
zmqgen_2_2.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
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
// +build !zmq_2_1,!zmq_3_x,!zmq_4_x
//
package gozmq
import (
"time"
)
// This file was generated automatically. Changes made here will be lost.
// Socket Option Getters
// ZMQ_TYPE: Retrieve socket type.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc3
//
func (s *Socket) Type() (SocketType, error) {
value, err := s.GetSockOptUInt64(TYPE)
return SocketType(value), err
}
// ZMQ_RCVMORE: More message parts to follow.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc4
//
func (s *Socket) RcvMore() (bool, error) {
value, err := s.GetSockOptUInt64(RCVMORE)
return value != 0, err
}
// ZMQ_HWM: Retrieve high water mark.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc5
//
func (s *Socket) HWM() (uint64, error) {
return s.GetSockOptUInt64(HWM)
}
// ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc6
//
func (s *Socket) RcvTimeout() (time.Duration, error) {
ms, err := s.GetSockOptInt(RCVTIMEO)
return time.Duration(ms) * time.Millisecond, err
}
// ZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc7
//
func (s *Socket) SndTimeout() (time.Duration, error) {
ms, err := s.GetSockOptInt(SNDTIMEO)
return time.Duration(ms) * time.Millisecond, err
}
// ZMQ_SWAP: Retrieve disk offload size.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc8
//
func (s *Socket) Swap() (int64, error) {
return s.GetSockOptInt64(SWAP)
}
// ZMQ_AFFINITY: Retrieve I/O thread affinity.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc9
//
func (s *Socket) Affinity() (uint64, error) {
return s.GetSockOptUInt64(AFFINITY)
}
// ZMQ_IDENTITY: Retrieve socket identity.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc10
//
func (s *Socket) Identity() (string, error) {
return s.GetSockOptString(IDENTITY)
}
// ZMQ_RATE: Retrieve multicast data rate.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc11
//
func (s *Socket) Rate() (int64, error) {
return s.GetSockOptInt64(RATE)
}
// ZMQ_RECOVERY_IVL_MSEC: Get multicast recovery interval in milliseconds.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc13
//
func (s *Socket) RecoveryIvl() (time.Duration, error) {
ms, err := s.GetSockOptInt64(RECOVERY_IVL_MSEC)
return time.Duration(ms) * time.Millisecond, err
}
// ZMQ_MCAST_LOOP: Control multicast loop-back.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc14
//
func (s *Socket) McastLoop() (bool, error) {
value, err := s.GetSockOptInt64(MCAST_LOOP)
return value != 0, err
}
// ZMQ_SNDBUF: Retrieve kernel transmit buffer size.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc15
//
func (s *Socket) SndBuf() (uint64, error) {
return s.GetSockOptUInt64(SNDBUF)
}
// ZMQ_RCVBUF: Retrieve kernel receive buffer size.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc16
//
func (s *Socket) RcvBuf() (uint64, error) {
return s.GetSockOptUInt64(RCVBUF)
}
// ZMQ_LINGER: Retrieve linger period for socket shutdown.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc17
//
func (s *Socket) Linger() (time.Duration, error) {
ms, err := s.GetSockOptInt(LINGER)
return time.Duration(ms) * time.Millisecond, err
}
// ZMQ_RECONNECT_IVL: Retrieve reconnection interval.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc18
//
func (s *Socket) ReconnectIvl() (time.Duration, error) {
ms, err := s.GetSockOptInt(RECONNECT_IVL)
return time.Duration(ms) * time.Millisecond, err
}
// ZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc19
//
func (s *Socket) ReconnectIvlMax() (time.Duration, error) {
ms, err := s.GetSockOptInt(RECONNECT_IVL_MAX)
return time.Duration(ms) * time.Millisecond, err
}
// ZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc20
//
func (s *Socket) Backlog() (int, error) {
return s.GetSockOptInt(BACKLOG)
}
// ZMQ_EVENTS: Retrieve socket event state.
//
// See: http://api.zeromq.org/2.2:zmq-getsockopt#toc22
//
func (s *Socket) Events() (uint64, error) {
return s.GetSockOptUInt64(EVENTS)
}
// Socket Option Setters
// ZMQ_HWM: Set high water mark.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc3
//
func (s *Socket) SetHWM(value uint64) error {
return s.SetSockOptUInt64(HWM, value)
}
// ZMQ_SWAP: Set disk offload size.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc4
//
func (s *Socket) SetSwap(value int64) error {
return s.SetSockOptInt64(SWAP, value)
}
// ZMQ_AFFINITY: Set I/O thread affinity.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc5
//
func (s *Socket) SetAffinity(value uint64) error {
return s.SetSockOptUInt64(AFFINITY, value)
}
// ZMQ_IDENTITY: Set socket identity.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc6
//
func (s *Socket) SetIdentity(value string) error {
return s.SetSockOptString(IDENTITY, value)
}
// ZMQ_SUBSCRIBE: Establish message filter.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc7
//
func (s *Socket) SetSubscribe(value string) error {
return s.SetSockOptString(SUBSCRIBE, value)
}
// ZMQ_UNSUBSCRIBE: Remove message filter.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc8
//
func (s *Socket) SetUnsubscribe(value string) error {
return s.SetSockOptString(UNSUBSCRIBE, value)
}
// ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc9
//
func (s *Socket) SetRcvTimeout(value time.Duration) error {
return s.SetSockOptInt(RCVTIMEO, int(value/time.Millisecond))
}
// ZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc10
//
func (s *Socket) SetSndTimeout(value time.Duration) error {
return s.SetSockOptInt(SNDTIMEO, int(value/time.Millisecond))
}
// ZMQ_RATE: Set multicast data rate.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc11
//
func (s *Socket) SetRate(value int64) error {
return s.SetSockOptInt64(RATE, value)
}
// ZMQ_RECOVERY_IVL_MSEC: Set multicast recovery interval in milliseconds.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc13
//
func (s *Socket) SetRecoveryIvl(value time.Duration) error {
return s.SetSockOptInt64(RECOVERY_IVL_MSEC, int64(value/time.Millisecond))
}
// ZMQ_MCAST_LOOP: Control multicast loop-back.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc14
//
func (s *Socket) SetMcastLoop(value bool) error {
if value {
return s.SetSockOptInt64(MCAST_LOOP, 1)
}
return s.SetSockOptInt64(MCAST_LOOP, 0)
}
// ZMQ_SNDBUF: Set kernel transmit buffer size.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc15
//
func (s *Socket) SetSndBuf(value uint64) error {
return s.SetSockOptUInt64(SNDBUF, value)
}
// ZMQ_RCVBUF: Set kernel receive buffer size.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc16
//
func (s *Socket) SetRcvBuf(value uint64) error {
return s.SetSockOptUInt64(RCVBUF, value)
}
// ZMQ_LINGER: Set linger period for socket shutdown.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc17
//
func (s *Socket) SetLinger(value time.Duration) error {
return s.SetSockOptInt(LINGER, int(value/time.Millisecond))
}
// ZMQ_RECONNECT_IVL: Set reconnection interval.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc18
//
func (s *Socket) SetReconnectIvl(value time.Duration) error {
return s.SetSockOptInt(RECONNECT_IVL, int(value/time.Millisecond))
}
// ZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc19
//
func (s *Socket) SetReconnectIvlMax(value time.Duration) error {
return s.SetSockOptInt(RECONNECT_IVL_MAX, int(value/time.Millisecond))
}
// ZMQ_BACKLOG: Set maximum length of the queue of outstanding connections.
//
// See: http://api.zeromq.org/2.2:zmq-setsockopt#toc20
//
func (s *Socket) SetBacklog(value int) error {
return s.SetSockOptInt(BACKLOG, value)
}