-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathenet.nelua
538 lines (538 loc) · 24.1 KB
/
enet.nelua
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
##[[
if not ENET_NO_IMPL then
cdefine 'ENET_IMPLEMENTATION'
end
cinclude 'enet.h'
if ccinfo.is_windows then
linklib 'ws2_32'
linklib 'winmm'
end
]]
global in6_addr: type <cimport,nodecl,ctypedef> = @record{
__in6_u: union{
__u6_addr8: [16]uint8,
__u6_addr16: [8]uint16,
__u6_addr32: [4]uint32
}
}
global ENetBuffer: type <cimport,nodecl> = @record{
data: pointer,
dataLength: csize
}
global ENetSocketSet: type <cimport,nodecl> = @record{
__fds_bits: [16]clong
}
global enet_v4_anyaddr: in6_addr <cimport,nodecl>
global enet_v4_noaddr: in6_addr <cimport,nodecl>
global enet_v4_localhost: in6_addr <cimport,nodecl>
global enet_v6_anyaddr: in6_addr <cimport,nodecl>
global enet_v6_noaddr: in6_addr <cimport,nodecl>
global enet_v6_localhost: in6_addr <cimport,nodecl>
global ENetPacket: type <cimport,nodecl,forwarddecl> = @record{}
global ENetCallbacks: type <cimport,nodecl> = @record{
malloc: function(csize): pointer,
free: function(pointer): void,
no_memory: function(): void,
packet_create: function(pointer, csize, uint32): *ENetPacket,
packet_destroy: function(*ENetPacket): void
}
global function enet_malloc(a1: csize): pointer <cimport,nodecl> end
global function enet_free(a1: pointer): void <cimport,nodecl> end
global function enet_packet_create(a1: pointer, a2: csize, a3: uint32): *ENetPacket <cimport,nodecl> end
global function enet_packet_copy(a1: *ENetPacket): *ENetPacket <cimport,nodecl> end
global function enet_packet_destroy(a1: *ENetPacket): void <cimport,nodecl> end
global ENetListNode: type <cimport,nodecl> = @record{
next: *ENetListNode,
previous: *ENetListNode
}
global ENetListIterator: type = @*ENetListNode
global ENetList: type <cimport,nodecl> = @record{
sentinel: ENetListNode
}
global function enet_list_insert(a1: ENetListIterator, a2: pointer): ENetListIterator <cimport,nodecl> end
global function enet_list_move(a1: ENetListIterator, a2: pointer, a3: pointer): ENetListIterator <cimport,nodecl> end
global function enet_list_remove(a1: ENetListIterator): pointer <cimport,nodecl> end
global function enet_list_clear(a1: *ENetList): void <cimport,nodecl> end
global function enet_list_size(a1: *ENetList): csize <cimport,nodecl> end
global ENET_PROTOCOL_MINIMUM_MTU: cint <comptime> = 576
global ENET_PROTOCOL_MAXIMUM_MTU: cint <comptime> = 4096
global ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS: cint <comptime> = 32
global ENET_PROTOCOL_MINIMUM_WINDOW_SIZE: cint <comptime> = 4096
global ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE: cint <comptime> = 65536
global ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT: cint <comptime> = 1
global ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT: cint <comptime> = 255
global ENET_PROTOCOL_MAXIMUM_PEER_ID: cint <comptime> = 4095
global ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT: cint <comptime> = 1048576
global ENetProtocolCommand: type <cimport,nodecl,using> = @enum(cint){
ENET_PROTOCOL_COMMAND_NONE = 0,
ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1,
ENET_PROTOCOL_COMMAND_CONNECT = 2,
ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3,
ENET_PROTOCOL_COMMAND_DISCONNECT = 4,
ENET_PROTOCOL_COMMAND_PING = 5,
ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6,
ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7,
ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8,
ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 9,
ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 10,
ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11,
ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT = 12,
ENET_PROTOCOL_COMMAND_COUNT = 13,
ENET_PROTOCOL_COMMAND_MASK = 15
}
global ENetProtocolFlag: type <cimport,nodecl,using> = @enum(cint){
ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = 128,
ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = 64,
ENET_PROTOCOL_HEADER_FLAG_COMPRESSED = 16384,
ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = 32768,
ENET_PROTOCOL_HEADER_FLAG_MASK = 49152,
ENET_PROTOCOL_HEADER_SESSION_MASK = 12288,
ENET_PROTOCOL_HEADER_SESSION_SHIFT = 12
}
global ENetProtocolHeader: type <cimport,nodecl,packed> = @record{
peerID: uint16,
sentTime: uint16
}
global ENetProtocolCommandHeader: type <cimport,nodecl,packed> = @record{
command: uint8,
channelID: uint8,
reliableSequenceNumber: uint16
}
global ENetProtocolAcknowledge: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader,
receivedReliableSequenceNumber: uint16,
receivedSentTime: uint16
}
global ENetProtocolConnect: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader,
outgoingPeerID: uint16,
incomingSessionID: uint8,
outgoingSessionID: uint8,
mtu: uint32,
windowSize: uint32,
channelCount: uint32,
incomingBandwidth: uint32,
outgoingBandwidth: uint32,
packetThrottleInterval: uint32,
packetThrottleAcceleration: uint32,
packetThrottleDeceleration: uint32,
connectID: uint32,
data: uint32
}
global ENetProtocolVerifyConnect: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader,
outgoingPeerID: uint16,
incomingSessionID: uint8,
outgoingSessionID: uint8,
mtu: uint32,
windowSize: uint32,
channelCount: uint32,
incomingBandwidth: uint32,
outgoingBandwidth: uint32,
packetThrottleInterval: uint32,
packetThrottleAcceleration: uint32,
packetThrottleDeceleration: uint32,
connectID: uint32
}
global ENetProtocolBandwidthLimit: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader,
incomingBandwidth: uint32,
outgoingBandwidth: uint32
}
global ENetProtocolThrottleConfigure: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader,
packetThrottleInterval: uint32,
packetThrottleAcceleration: uint32,
packetThrottleDeceleration: uint32
}
global ENetProtocolDisconnect: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader,
data: uint32
}
global ENetProtocolPing: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader
}
global ENetProtocolSendReliable: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader,
dataLength: uint16
}
global ENetProtocolSendUnreliable: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader,
unreliableSequenceNumber: uint16,
dataLength: uint16
}
global ENetProtocolSendUnsequenced: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader,
unsequencedGroup: uint16,
dataLength: uint16
}
global ENetProtocolSendFragment: type <cimport,nodecl,packed> = @record{
header: ENetProtocolCommandHeader,
startSequenceNumber: uint16,
dataLength: uint16,
fragmentCount: uint32,
fragmentNumber: uint32,
totalLength: uint32,
fragmentOffset: uint32
}
global ENetProtocol: type <cimport,nodecl,packed> = @union{
header: ENetProtocolCommandHeader,
acknowledge: ENetProtocolAcknowledge,
connect: ENetProtocolConnect,
verifyConnect: ENetProtocolVerifyConnect,
disconnect: ENetProtocolDisconnect,
ping: ENetProtocolPing,
sendReliable: ENetProtocolSendReliable,
sendUnreliable: ENetProtocolSendUnreliable,
sendUnsequenced: ENetProtocolSendUnsequenced,
sendFragment: ENetProtocolSendFragment,
bandwidthLimit: ENetProtocolBandwidthLimit,
throttleConfigure: ENetProtocolThrottleConfigure
}
global ENetSocketType: type <cimport,nodecl,using> = @enum(cint){
ENET_SOCKET_TYPE_STREAM = 1,
ENET_SOCKET_TYPE_DATAGRAM = 2
}
global ENetSocketWait: type <cimport,nodecl,using> = @enum(cint){
ENET_SOCKET_WAIT_NONE = 0,
ENET_SOCKET_WAIT_SEND = 1,
ENET_SOCKET_WAIT_RECEIVE = 2,
ENET_SOCKET_WAIT_INTERRUPT = 4
}
global ENetSocketOption: type <cimport,nodecl,using> = @enum(cint){
ENET_SOCKOPT_NONBLOCK = 1,
ENET_SOCKOPT_BROADCAST = 2,
ENET_SOCKOPT_RCVBUF = 3,
ENET_SOCKOPT_SNDBUF = 4,
ENET_SOCKOPT_REUSEADDR = 5,
ENET_SOCKOPT_RCVTIMEO = 6,
ENET_SOCKOPT_SNDTIMEO = 7,
ENET_SOCKOPT_ERROR = 8,
ENET_SOCKOPT_NODELAY = 9,
ENET_SOCKOPT_IPV6_V6ONLY = 10
}
global ENetSocketShutdown: type <cimport,nodecl,using> = @enum(cint){
ENET_SOCKET_SHUTDOWN_READ = 0,
ENET_SOCKET_SHUTDOWN_WRITE = 1,
ENET_SOCKET_SHUTDOWN_READ_WRITE = 2
}
global ENetAddress: type <cimport,nodecl> = @record{
host: in6_addr,
port: uint16,
sin6_scope_id: uint16
}
global ENetPacketFlag: type <cimport,nodecl,using> = @enum(cint){
ENET_PACKET_FLAG_RELIABLE = 1,
ENET_PACKET_FLAG_UNSEQUENCED = 2,
ENET_PACKET_FLAG_NO_ALLOCATE = 4,
ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT = 8,
ENET_PACKET_FLAG_SENT = 256
}
global ENetPacketFreeCallback: type <cimport,nodecl> = @function(pointer): void
ENetPacket = @record{
referenceCount: csize,
flags: uint32,
data: *uint8,
dataLength: csize,
freeCallback: ENetPacketFreeCallback,
userData: pointer
}
global ENetAcknowledgement: type <cimport,nodecl> = @record{
acknowledgementList: ENetListNode,
sentTime: uint32,
command: ENetProtocol
}
global ENetOutgoingCommand: type <cimport,nodecl> = @record{
outgoingCommandList: ENetListNode,
reliableSequenceNumber: uint16,
unreliableSequenceNumber: uint16,
sentTime: uint32,
roundTripTimeout: uint32,
roundTripTimeoutLimit: uint32,
fragmentOffset: uint32,
fragmentLength: uint16,
sendAttempts: uint16,
command: ENetProtocol,
packet: *ENetPacket
}
global ENetIncomingCommand: type <cimport,nodecl> = @record{
incomingCommandList: ENetListNode,
reliableSequenceNumber: uint16,
unreliableSequenceNumber: uint16,
command: ENetProtocol,
fragmentCount: uint32,
fragmentsRemaining: uint32,
fragments: *uint32,
packet: *ENetPacket
}
global ENetPeerState: type <cimport,nodecl,using> = @enum(cint){
ENET_PEER_STATE_DISCONNECTED = 0,
ENET_PEER_STATE_CONNECTING = 1,
ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2,
ENET_PEER_STATE_CONNECTION_PENDING = 3,
ENET_PEER_STATE_CONNECTION_SUCCEEDED = 4,
ENET_PEER_STATE_CONNECTED = 5,
ENET_PEER_STATE_DISCONNECT_LATER = 6,
ENET_PEER_STATE_DISCONNECTING = 7,
ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 8,
ENET_PEER_STATE_ZOMBIE = 9
}
global ENET_HOST_RECEIVE_BUFFER_SIZE: cint <comptime> = 262144
global ENET_HOST_SEND_BUFFER_SIZE: cint <comptime> = 262144
global ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL: cint <comptime> = 1000
global ENET_HOST_DEFAULT_MTU: cint <comptime> = 1400
global ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE: cint <comptime> = 33554432
global ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA: cint <comptime> = 33554432
global ENET_PEER_DEFAULT_ROUND_TRIP_TIME: cint <comptime> = 500
global ENET_PEER_DEFAULT_PACKET_THROTTLE: cint <comptime> = 32
global ENET_PEER_PACKET_THROTTLE_SCALE: cint <comptime> = 32
global ENET_PEER_PACKET_THROTTLE_COUNTER: cint <comptime> = 7
global ENET_PEER_PACKET_THROTTLE_ACCELERATION: cint <comptime> = 2
global ENET_PEER_PACKET_THROTTLE_DECELERATION: cint <comptime> = 2
global ENET_PEER_PACKET_THROTTLE_INTERVAL: cint <comptime> = 5000
global ENET_PEER_PACKET_LOSS_SCALE: cint <comptime> = 65536
global ENET_PEER_PACKET_LOSS_INTERVAL: cint <comptime> = 10000
global ENET_PEER_WINDOW_SIZE_SCALE: cint <comptime> = 65536
global ENET_PEER_TIMEOUT_LIMIT: cint <comptime> = 32
global ENET_PEER_TIMEOUT_MINIMUM: cint <comptime> = 5000
global ENET_PEER_TIMEOUT_MAXIMUM: cint <comptime> = 30000
global ENET_PEER_PING_INTERVAL: cint <comptime> = 500
global ENET_PEER_UNSEQUENCED_WINDOWS: cint <comptime> = 64
global ENET_PEER_UNSEQUENCED_WINDOW_SIZE: cint <comptime> = 1024
global ENET_PEER_FREE_UNSEQUENCED_WINDOWS: cint <comptime> = 32
global ENET_PEER_RELIABLE_WINDOWS: cint <comptime> = 16
global ENET_PEER_RELIABLE_WINDOW_SIZE: cint <comptime> = 4096
global ENET_PEER_FREE_RELIABLE_WINDOWS: cint <comptime> = 8
global ENetChannel: type <cimport,nodecl> = @record{
outgoingReliableSequenceNumber: uint16,
outgoingUnreliableSequenceNumber: uint16,
usedReliableWindows: uint16,
reliableWindows: [16]uint16,
incomingReliableSequenceNumber: uint16,
incomingUnreliableSequenceNumber: uint16,
incomingReliableCommands: ENetList,
incomingUnreliableCommands: ENetList
}
global _ENetHost: type <cimport,nodecl,forwarddecl,ctypedef> = @record{}
global ENetPeer: type <cimport,nodecl> = @record{
dispatchList: ENetListNode,
host: *_ENetHost,
outgoingPeerID: uint16,
incomingPeerID: uint16,
connectID: uint32,
outgoingSessionID: uint8,
incomingSessionID: uint8,
address: ENetAddress,
data: pointer,
state: ENetPeerState,
channels: *ENetChannel,
channelCount: csize,
incomingBandwidth: uint32,
outgoingBandwidth: uint32,
incomingBandwidthThrottleEpoch: uint32,
outgoingBandwidthThrottleEpoch: uint32,
incomingDataTotal: uint32,
totalDataReceived: uint64,
outgoingDataTotal: uint32,
totalDataSent: uint64,
lastSendTime: uint32,
lastReceiveTime: uint32,
nextTimeout: uint32,
earliestTimeout: uint32,
packetLossEpoch: uint32,
packetsSent: uint32,
totalPacketsSent: uint64,
packetsLost: uint32,
totalPacketsLost: uint32,
packetLoss: uint32,
packetLossVariance: uint32,
packetThrottle: uint32,
packetThrottleLimit: uint32,
packetThrottleCounter: uint32,
packetThrottleEpoch: uint32,
packetThrottleAcceleration: uint32,
packetThrottleDeceleration: uint32,
packetThrottleInterval: uint32,
pingInterval: uint32,
timeoutLimit: uint32,
timeoutMinimum: uint32,
timeoutMaximum: uint32,
lastRoundTripTime: uint32,
lowestRoundTripTime: uint32,
lastRoundTripTimeVariance: uint32,
highestRoundTripTimeVariance: uint32,
roundTripTime: uint32,
roundTripTimeVariance: uint32,
mtu: uint32,
windowSize: uint32,
reliableDataInTransit: uint32,
outgoingReliableSequenceNumber: uint16,
acknowledgements: ENetList,
sentReliableCommands: ENetList,
sentUnreliableCommands: ENetList,
outgoingReliableCommands: ENetList,
outgoingUnreliableCommands: ENetList,
dispatchedCommands: ENetList,
needsDispatch: cint,
incomingUnsequencedGroup: uint16,
outgoingUnsequencedGroup: uint16,
unsequencedWindow: [32]uint32,
eventData: uint32,
totalWaitingData: csize
}
global ENetCompressor: type <cimport,nodecl> = @record{
context: pointer,
compress: function(pointer, *ENetBuffer, csize, csize, *uint8, csize): csize,
decompress: function(pointer, *uint8, csize, *uint8, csize): csize,
destroy: function(pointer): void
}
global ENetChecksumCallback: type <cimport,nodecl> = @function(*ENetBuffer, csize): uint32
global ENetInterceptCallback: type <cimport,nodecl> = @function(*_ENetHost, pointer): cint
_ENetHost = @record{
socket: cint,
address: ENetAddress,
incomingBandwidth: uint32,
outgoingBandwidth: uint32,
bandwidthThrottleEpoch: uint32,
mtu: uint32,
randomSeed: uint32,
recalculateBandwidthLimits: cint,
peers: *ENetPeer,
peerCount: csize,
channelLimit: csize,
serviceTime: uint32,
dispatchQueue: ENetList,
continueSending: cint,
packetSize: csize,
headerFlags: uint16,
commands: [32]ENetProtocol,
commandCount: csize,
buffers: [65]ENetBuffer,
bufferCount: csize,
checksum: ENetChecksumCallback,
compressor: ENetCompressor,
packetData: [2][4096]uint8,
receivedAddress: ENetAddress,
receivedData: *uint8,
receivedDataLength: csize,
totalSentData: uint32,
totalSentPackets: uint32,
totalReceivedData: uint32,
totalReceivedPackets: uint32,
intercept: ENetInterceptCallback,
connectedPeers: csize,
bandwidthLimitedPeers: csize,
duplicatePeers: csize,
maximumPacketSize: csize,
maximumWaitingData: csize
}
global ENetHost: type = @_ENetHost
global ENetEventType: type <cimport,nodecl,using> = @enum(cint){
ENET_EVENT_TYPE_NONE = 0,
ENET_EVENT_TYPE_CONNECT = 1,
ENET_EVENT_TYPE_DISCONNECT = 2,
ENET_EVENT_TYPE_RECEIVE = 3,
ENET_EVENT_TYPE_DISCONNECT_TIMEOUT = 4
}
global ENetEvent: type <cimport,nodecl> = @record{
type: ENetEventType,
peer: *ENetPeer,
channelID: uint8,
data: uint32,
packet: *ENetPacket
}
global function enet_initialize(): cint <cimport,nodecl> end
global function enet_initialize_with_callbacks(version: cuint, inits: *ENetCallbacks): cint <cimport,nodecl> end
global function enet_deinitialize(): void <cimport,nodecl> end
global function enet_linked_version(): cuint <cimport,nodecl> end
global function enet_time_get(): uint32 <cimport,nodecl> end
global function enet_socket_create(a1: ENetSocketType): cint <cimport,nodecl> end
global function enet_socket_bind(a1: cint, a2: *ENetAddress): cint <cimport,nodecl> end
global function enet_socket_get_address(a1: cint, a2: *ENetAddress): cint <cimport,nodecl> end
global function enet_socket_listen(a1: cint, a2: cint): cint <cimport,nodecl> end
global function enet_socket_accept(a1: cint, a2: *ENetAddress): cint <cimport,nodecl> end
global function enet_socket_connect(a1: cint, a2: *ENetAddress): cint <cimport,nodecl> end
global function enet_socket_send(a1: cint, a2: *ENetAddress, a3: *ENetBuffer, a4: csize): cint <cimport,nodecl> end
global function enet_socket_receive(a1: cint, a2: *ENetAddress, a3: *ENetBuffer, a4: csize): cint <cimport,nodecl> end
global function enet_socket_wait(a1: cint, a2: *uint32, a3: uint64): cint <cimport,nodecl> end
global function enet_socket_set_option(a1: cint, a2: ENetSocketOption, a3: cint): cint <cimport,nodecl> end
global function enet_socket_get_option(a1: cint, a2: ENetSocketOption, a3: *cint): cint <cimport,nodecl> end
global function enet_socket_shutdown(a1: cint, a2: ENetSocketShutdown): cint <cimport,nodecl> end
global function enet_socket_destroy(a1: cint): void <cimport,nodecl> end
global function enet_socketset_select(a1: cint, a2: *ENetSocketSet, a3: *ENetSocketSet, a4: uint32): cint <cimport,nodecl> end
global function enet_address_set_host_ip_old(address: *ENetAddress, hostName: cstring): cint <cimport,nodecl> end
global function enet_address_set_host_old(address: *ENetAddress, hostName: cstring): cint <cimport,nodecl> end
global function enet_address_get_host_ip_old(address: *ENetAddress, hostName: cstring, nameLength: csize): cint <cimport,nodecl> end
global function enet_address_get_host_old(address: *ENetAddress, hostName: cstring, nameLength: csize): cint <cimport,nodecl> end
global function enet_address_set_host_ip_new(address: *ENetAddress, hostName: cstring): cint <cimport,nodecl> end
global function enet_address_set_host_new(address: *ENetAddress, hostName: cstring): cint <cimport,nodecl> end
global function enet_address_get_host_ip_new(address: *ENetAddress, hostName: cstring, nameLength: csize): cint <cimport,nodecl> end
global function enet_address_get_host_new(address: *ENetAddress, hostName: cstring, nameLength: csize): cint <cimport,nodecl> end
global function enet_host_get_peers_count(a1: *ENetHost): uint32 <cimport,nodecl> end
global function enet_host_get_packets_sent(a1: *ENetHost): uint32 <cimport,nodecl> end
global function enet_host_get_packets_received(a1: *ENetHost): uint32 <cimport,nodecl> end
global function enet_host_get_bytes_sent(a1: *ENetHost): uint32 <cimport,nodecl> end
global function enet_host_get_bytes_received(a1: *ENetHost): uint32 <cimport,nodecl> end
global function enet_host_get_received_data(a1: *ENetHost, data: **uint8): uint32 <cimport,nodecl> end
global function enet_host_get_mtu(a1: *ENetHost): uint32 <cimport,nodecl> end
global function enet_peer_get_id(a1: *ENetPeer): uint32 <cimport,nodecl> end
global function enet_peer_get_ip(a1: *ENetPeer, ip: cstring, ipLength: csize): uint32 <cimport,nodecl> end
global function enet_peer_get_port(a1: *ENetPeer): uint16 <cimport,nodecl> end
global function enet_peer_get_rtt(a1: *ENetPeer): uint32 <cimport,nodecl> end
global function enet_peer_get_packets_sent(a1: *ENetPeer): uint64 <cimport,nodecl> end
global function enet_peer_get_packets_lost(a1: *ENetPeer): uint32 <cimport,nodecl> end
global function enet_peer_get_bytes_sent(a1: *ENetPeer): uint64 <cimport,nodecl> end
global function enet_peer_get_bytes_received(a1: *ENetPeer): uint64 <cimport,nodecl> end
global function enet_peer_get_state(a1: *ENetPeer): ENetPeerState <cimport,nodecl> end
global function enet_peer_get_data(a1: *ENetPeer): pointer <cimport,nodecl> end
global function enet_peer_set_data(a1: *ENetPeer, a2: pointer): void <cimport,nodecl> end
global function enet_packet_get_data(a1: *ENetPacket): pointer <cimport,nodecl> end
global function enet_packet_get_length(a1: *ENetPacket): uint32 <cimport,nodecl> end
global function enet_packet_set_free_callback(a1: *ENetPacket, a2: pointer): void <cimport,nodecl> end
global function enet_packet_create_offset(a1: pointer, a2: csize, a3: csize, a4: uint32): *ENetPacket <cimport,nodecl> end
global function enet_crc32(a1: *ENetBuffer, a2: csize): uint32 <cimport,nodecl> end
global function enet_host_create(a1: *ENetAddress, a2: csize, a3: csize, a4: uint32, a5: uint32): *ENetHost <cimport,nodecl> end
global function enet_host_destroy(a1: *ENetHost): void <cimport,nodecl> end
global function enet_host_connect(a1: *ENetHost, a2: *ENetAddress, a3: csize, a4: uint32): *ENetPeer <cimport,nodecl> end
global function enet_host_check_events(a1: *ENetHost, a2: *ENetEvent): cint <cimport,nodecl> end
global function enet_host_service(a1: *ENetHost, a2: *ENetEvent, a3: uint32): cint <cimport,nodecl> end
global function enet_host_send_raw(a1: *ENetHost, a2: *ENetAddress, a3: *uint8, a4: csize): cint <cimport,nodecl> end
global function enet_host_send_raw_ex(host: *ENetHost, address: *ENetAddress, data: *uint8, skipBytes: csize, bytesToSend: csize): cint <cimport,nodecl> end
global function enet_host_set_intercept(a1: *ENetHost, a2: ENetInterceptCallback): void <cimport,nodecl> end
global function enet_host_flush(a1: *ENetHost): void <cimport,nodecl> end
global function enet_host_broadcast(a1: *ENetHost, a2: uint8, a3: *ENetPacket): void <cimport,nodecl> end
global function enet_host_compress(a1: *ENetHost, a2: *ENetCompressor): void <cimport,nodecl> end
global function enet_host_channel_limit(a1: *ENetHost, a2: csize): void <cimport,nodecl> end
global function enet_host_bandwidth_limit(a1: *ENetHost, a2: uint32, a3: uint32): void <cimport,nodecl> end
global function enet_host_bandwidth_throttle(a1: *ENetHost): void <cimport,nodecl> end
global function enet_host_random_seed(): uint64 <cimport,nodecl> end
global function enet_peer_send(a1: *ENetPeer, a2: uint8, a3: *ENetPacket): cint <cimport,nodecl> end
global function enet_peer_receive(a1: *ENetPeer, channelID: *uint8): *ENetPacket <cimport,nodecl> end
global function enet_peer_ping(a1: *ENetPeer): void <cimport,nodecl> end
global function enet_peer_ping_interval(a1: *ENetPeer, a2: uint32): void <cimport,nodecl> end
global function enet_peer_timeout(a1: *ENetPeer, a2: uint32, a3: uint32, a4: uint32): void <cimport,nodecl> end
global function enet_peer_reset(a1: *ENetPeer): void <cimport,nodecl> end
global function enet_peer_disconnect(a1: *ENetPeer, a2: uint32): void <cimport,nodecl> end
global function enet_peer_disconnect_now(a1: *ENetPeer, a2: uint32): void <cimport,nodecl> end
global function enet_peer_disconnect_later(a1: *ENetPeer, a2: uint32): void <cimport,nodecl> end
global function enet_peer_throttle_configure(a1: *ENetPeer, a2: uint32, a3: uint32, a4: uint32): void <cimport,nodecl> end
global function enet_peer_throttle(a1: *ENetPeer, a2: uint32): cint <cimport,nodecl> end
global function enet_peer_reset_queues(a1: *ENetPeer): void <cimport,nodecl> end
global function enet_peer_setup_outgoing_command(a1: *ENetPeer, a2: *ENetOutgoingCommand): void <cimport,nodecl> end
global function enet_peer_queue_outgoing_command(a1: *ENetPeer, a2: *ENetProtocol, a3: *ENetPacket, a4: uint32, a5: uint16): *ENetOutgoingCommand <cimport,nodecl> end
global function enet_peer_queue_incoming_command(a1: *ENetPeer, a2: *ENetProtocol, a3: pointer, a4: csize, a5: uint32, a6: uint32): *ENetIncomingCommand <cimport,nodecl> end
global function enet_peer_queue_acknowledgement(a1: *ENetPeer, a2: *ENetProtocol, a3: uint16): *ENetAcknowledgement <cimport,nodecl> end
global function enet_peer_dispatch_incoming_unreliable_commands(a1: *ENetPeer, a2: *ENetChannel): void <cimport,nodecl> end
global function enet_peer_dispatch_incoming_reliable_commands(a1: *ENetPeer, a2: *ENetChannel): void <cimport,nodecl> end
global function enet_peer_on_connect(a1: *ENetPeer): void <cimport,nodecl> end
global function enet_peer_on_disconnect(a1: *ENetPeer): void <cimport,nodecl> end
global function enet_protocol_command_size(a1: uint8): csize <cimport,nodecl> end
global ENET_HOST_ANY: in6_addr <cimport,nodecl,const>
global ENET_HOST_BROADCAST: uint32 <comptime> = 0xffffffff
global ENET_PORT_ANY: uint16 <comptime> = 0
global enet_v4_anyaddr: in6_addr <cimport, nodecl, const>
global enet_v4_noaddr: in6_addr <cimport, nodecl, const>
global enet_v4_localhost: in6_addr <cimport, nodecl, const>
global enet_v6_anyaddr: in6_addr <cimport, nodecl, const>
global enet_v6_noaddr: in6_addr <cimport, nodecl, const>
global enet_v6_localhost: in6_addr <cimport, nodecl, const>