3 @brief ENet public header file
5 #ifndef __ENET_ENET_H__
6 #define __ENET_ENET_H__
16 #include "enet/win32.h"
18 #include "enet/unix.h"
21 #include "enet/types.h"
22 #include "enet/protocol.h"
23 #include "enet/list.h"
24 #include "enet/callbacks.h"
26 #define ENET_VERSION_MAJOR 1
27 #define ENET_VERSION_MINOR 3
28 #define ENET_VERSION_PATCH 17
29 #define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch))
30 #define ENET_VERSION_GET_MAJOR(version) (((version)>>16)&0xFF)
31 #define ENET_VERSION_GET_MINOR(version) (((version)>>8)&0xFF)
32 #define ENET_VERSION_GET_PATCH(version) ((version)&0xFF)
33 #define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH)
35 typedef enet_uint32 ENetVersion
;
41 typedef enum _ENetSocketType
43 ENET_SOCKET_TYPE_STREAM
= 1,
44 ENET_SOCKET_TYPE_DATAGRAM
= 2
47 typedef enum _ENetSocketWait
49 ENET_SOCKET_WAIT_NONE
= 0,
50 ENET_SOCKET_WAIT_SEND
= (1 << 0),
51 ENET_SOCKET_WAIT_RECEIVE
= (1 << 1),
52 ENET_SOCKET_WAIT_INTERRUPT
= (1 << 2)
55 typedef enum _ENetSocketOption
57 ENET_SOCKOPT_NONBLOCK
= 1,
58 ENET_SOCKOPT_BROADCAST
= 2,
59 ENET_SOCKOPT_RCVBUF
= 3,
60 ENET_SOCKOPT_SNDBUF
= 4,
61 ENET_SOCKOPT_REUSEADDR
= 5,
62 ENET_SOCKOPT_RCVTIMEO
= 6,
63 ENET_SOCKOPT_SNDTIMEO
= 7,
64 ENET_SOCKOPT_ERROR
= 8,
65 ENET_SOCKOPT_NODELAY
= 9
68 typedef enum _ENetSocketShutdown
70 ENET_SOCKET_SHUTDOWN_READ
= 0,
71 ENET_SOCKET_SHUTDOWN_WRITE
= 1,
72 ENET_SOCKET_SHUTDOWN_READ_WRITE
= 2
75 #define ENET_HOST_ANY 0
76 #define ENET_HOST_BROADCAST 0xFFFFFFFFU
77 #define ENET_PORT_ANY 0
80 * Portable internet address structure.
82 * The host must be specified in network byte-order, and the port must be in host
83 * byte-order. The constant ENET_HOST_ANY may be used to specify the default
84 * server host. The constant ENET_HOST_BROADCAST may be used to specify the
85 * broadcast address (255.255.255.255). This makes sense for enet_host_connect,
86 * but not for enet_host_create. Once a server responds to a broadcast, the
87 * address is updated from ENET_HOST_BROADCAST to the server's actual IP address.
89 typedef struct _ENetAddress
96 * Packet flag bit constants.
98 * The host must be specified in network byte-order, and the port must be in
99 * host byte-order. The constant ENET_HOST_ANY may be used to specify the
100 * default server host.
104 typedef enum _ENetPacketFlag
106 /** packet must be received by the target peer and resend attempts should be
107 * made until the packet is delivered */
108 ENET_PACKET_FLAG_RELIABLE
= (1 << 0),
109 /** packet will not be sequenced with other packets
110 * not supported for reliable packets
112 ENET_PACKET_FLAG_UNSEQUENCED
= (1 << 1),
113 /** packet will not allocate data, and user must supply it instead */
114 ENET_PACKET_FLAG_NO_ALLOCATE
= (1 << 2),
115 /** packet will be fragmented using unreliable (instead of reliable) sends
116 * if it exceeds the MTU */
117 ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT
= (1 << 3),
119 /** whether the packet has been sent from all queues it has been entered into */
120 ENET_PACKET_FLAG_SENT
= (1<<8)
123 typedef void (ENET_CALLBACK
* ENetPacketFreeCallback
) (struct _ENetPacket
*);
126 * ENet packet structure.
128 * An ENet data packet that may be sent to or received from a peer. The shown
129 * fields should only be read and never modified. The data field contains the
130 * allocated data for the packet. The dataLength fields specifies the length
131 * of the allocated data. The flags field is either 0 (specifying no flags),
132 * or a bitwise-or of any combination of the following flags:
134 * ENET_PACKET_FLAG_RELIABLE - packet must be received by the target peer
135 * and resend attempts should be made until the packet is delivered
137 * ENET_PACKET_FLAG_UNSEQUENCED - packet will not be sequenced with other packets
138 * (not supported for reliable packets)
140 * ENET_PACKET_FLAG_NO_ALLOCATE - packet will not allocate data, and user must supply it instead
142 * ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT - packet will be fragmented using unreliable
143 * (instead of reliable) sends if it exceeds the MTU
145 * ENET_PACKET_FLAG_SENT - whether the packet has been sent from all queues it has been entered into
148 typedef struct _ENetPacket
150 size_t referenceCount
; /**< internal use only */
151 enet_uint32 flags
; /**< bitwise-or of ENetPacketFlag constants */
152 enet_uint8
* data
; /**< allocated data for packet */
153 size_t dataLength
; /**< length of data */
154 ENetPacketFreeCallback freeCallback
; /**< function to be called when the packet is no longer in use */
155 void * userData
; /**< application private data, may be freely modified */
158 typedef struct _ENetAcknowledgement
160 ENetListNode acknowledgementList
;
161 enet_uint32 sentTime
;
162 ENetProtocol command
;
163 } ENetAcknowledgement
;
165 typedef struct _ENetOutgoingCommand
167 ENetListNode outgoingCommandList
;
168 enet_uint16 reliableSequenceNumber
;
169 enet_uint16 unreliableSequenceNumber
;
170 enet_uint32 sentTime
;
171 enet_uint32 roundTripTimeout
;
172 enet_uint32 roundTripTimeoutLimit
;
173 enet_uint32 fragmentOffset
;
174 enet_uint16 fragmentLength
;
175 enet_uint16 sendAttempts
;
176 ENetProtocol command
;
178 } ENetOutgoingCommand
;
180 typedef struct _ENetIncomingCommand
182 ENetListNode incomingCommandList
;
183 enet_uint16 reliableSequenceNumber
;
184 enet_uint16 unreliableSequenceNumber
;
185 ENetProtocol command
;
186 enet_uint32 fragmentCount
;
187 enet_uint32 fragmentsRemaining
;
188 enet_uint32
* fragments
;
190 } ENetIncomingCommand
;
192 typedef enum _ENetPeerState
194 ENET_PEER_STATE_DISCONNECTED
= 0,
195 ENET_PEER_STATE_CONNECTING
= 1,
196 ENET_PEER_STATE_ACKNOWLEDGING_CONNECT
= 2,
197 ENET_PEER_STATE_CONNECTION_PENDING
= 3,
198 ENET_PEER_STATE_CONNECTION_SUCCEEDED
= 4,
199 ENET_PEER_STATE_CONNECTED
= 5,
200 ENET_PEER_STATE_DISCONNECT_LATER
= 6,
201 ENET_PEER_STATE_DISCONNECTING
= 7,
202 ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT
= 8,
203 ENET_PEER_STATE_ZOMBIE
= 9
206 #ifndef ENET_BUFFER_MAXIMUM
207 #define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS)
212 ENET_HOST_RECEIVE_BUFFER_SIZE
= 256 * 1024,
213 ENET_HOST_SEND_BUFFER_SIZE
= 256 * 1024,
214 ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL
= 1000,
215 ENET_HOST_DEFAULT_MTU
= 1400,
216 ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE
= 32 * 1024 * 1024,
217 ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA
= 32 * 1024 * 1024,
219 ENET_PEER_DEFAULT_ROUND_TRIP_TIME
= 500,
220 ENET_PEER_DEFAULT_PACKET_THROTTLE
= 32,
221 ENET_PEER_PACKET_THROTTLE_SCALE
= 32,
222 ENET_PEER_PACKET_THROTTLE_COUNTER
= 7,
223 ENET_PEER_PACKET_THROTTLE_ACCELERATION
= 2,
224 ENET_PEER_PACKET_THROTTLE_DECELERATION
= 2,
225 ENET_PEER_PACKET_THROTTLE_INTERVAL
= 5000,
226 ENET_PEER_PACKET_LOSS_SCALE
= (1 << 16),
227 ENET_PEER_PACKET_LOSS_INTERVAL
= 10000,
228 ENET_PEER_WINDOW_SIZE_SCALE
= 64 * 1024,
229 ENET_PEER_TIMEOUT_LIMIT
= 32,
230 ENET_PEER_TIMEOUT_MINIMUM
= 5000,
231 ENET_PEER_TIMEOUT_MAXIMUM
= 30000,
232 ENET_PEER_PING_INTERVAL
= 500,
233 ENET_PEER_UNSEQUENCED_WINDOWS
= 64,
234 ENET_PEER_UNSEQUENCED_WINDOW_SIZE
= 1024,
235 ENET_PEER_FREE_UNSEQUENCED_WINDOWS
= 32,
236 ENET_PEER_RELIABLE_WINDOWS
= 16,
237 ENET_PEER_RELIABLE_WINDOW_SIZE
= 0x1000,
238 ENET_PEER_FREE_RELIABLE_WINDOWS
= 8
241 typedef struct _ENetChannel
243 enet_uint16 outgoingReliableSequenceNumber
;
244 enet_uint16 outgoingUnreliableSequenceNumber
;
245 enet_uint16 usedReliableWindows
;
246 enet_uint16 reliableWindows
[ENET_PEER_RELIABLE_WINDOWS
];
247 enet_uint16 incomingReliableSequenceNumber
;
248 enet_uint16 incomingUnreliableSequenceNumber
;
249 ENetList incomingReliableCommands
;
250 ENetList incomingUnreliableCommands
;
253 typedef enum _ENetPeerFlag
255 ENET_PEER_FLAG_NEEDS_DISPATCH
= (1 << 0)
259 * An ENet peer which data packets may be sent or received from.
261 * No fields should be modified unless otherwise specified.
263 typedef struct _ENetPeer
265 ENetListNode dispatchList
;
266 struct _ENetHost
* host
;
267 enet_uint16 outgoingPeerID
;
268 enet_uint16 incomingPeerID
;
269 enet_uint32 connectID
;
270 enet_uint8 outgoingSessionID
;
271 enet_uint8 incomingSessionID
;
272 ENetAddress address
; /**< Internet address of the peer */
273 void * data
; /**< Application private data, may be freely modified */
275 ENetChannel
* channels
;
276 size_t channelCount
; /**< Number of channels allocated for communication with peer */
277 enet_uint32 incomingBandwidth
; /**< Downstream bandwidth of the client in bytes/second */
278 enet_uint32 outgoingBandwidth
; /**< Upstream bandwidth of the client in bytes/second */
279 enet_uint32 incomingBandwidthThrottleEpoch
;
280 enet_uint32 outgoingBandwidthThrottleEpoch
;
281 enet_uint32 incomingDataTotal
;
282 enet_uint32 outgoingDataTotal
;
283 enet_uint32 lastSendTime
;
284 enet_uint32 lastReceiveTime
;
285 enet_uint32 nextTimeout
;
286 enet_uint32 earliestTimeout
;
287 enet_uint32 packetLossEpoch
;
288 enet_uint32 packetsSent
;
289 enet_uint32 packetsLost
;
290 enet_uint32 packetLoss
; /**< mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SCALE */
291 enet_uint32 packetLossVariance
;
292 enet_uint32 packetThrottle
;
293 enet_uint32 packetThrottleLimit
;
294 enet_uint32 packetThrottleCounter
;
295 enet_uint32 packetThrottleEpoch
;
296 enet_uint32 packetThrottleAcceleration
;
297 enet_uint32 packetThrottleDeceleration
;
298 enet_uint32 packetThrottleInterval
;
299 enet_uint32 pingInterval
;
300 enet_uint32 timeoutLimit
;
301 enet_uint32 timeoutMinimum
;
302 enet_uint32 timeoutMaximum
;
303 enet_uint32 lastRoundTripTime
;
304 enet_uint32 lowestRoundTripTime
;
305 enet_uint32 lastRoundTripTimeVariance
;
306 enet_uint32 highestRoundTripTimeVariance
;
307 enet_uint32 roundTripTime
; /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */
308 enet_uint32 roundTripTimeVariance
;
310 enet_uint32 windowSize
;
311 enet_uint32 reliableDataInTransit
;
312 enet_uint16 outgoingReliableSequenceNumber
;
313 ENetList acknowledgements
;
314 ENetList sentReliableCommands
;
315 ENetList sentUnreliableCommands
;
316 ENetList outgoingCommands
;
317 ENetList dispatchedCommands
;
319 enet_uint16 reserved
;
320 enet_uint16 incomingUnsequencedGroup
;
321 enet_uint16 outgoingUnsequencedGroup
;
322 enet_uint32 unsequencedWindow
[ENET_PEER_UNSEQUENCED_WINDOW_SIZE
/ 32];
323 enet_uint32 eventData
;
324 size_t totalWaitingData
;
327 /** An ENet packet compressor for compressing UDP packets before socket sends or receives.
329 typedef struct _ENetCompressor
331 /** Context data for the compressor. Must be non-NULL. */
333 /** Compresses from inBuffers[0:inBufferCount-1], containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */
334 size_t (ENET_CALLBACK
* compress
) (void * context
, const ENetBuffer
* inBuffers
, size_t inBufferCount
, size_t inLimit
, enet_uint8
* outData
, size_t outLimit
);
335 /** Decompresses from inData, containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */
336 size_t (ENET_CALLBACK
* decompress
) (void * context
, const enet_uint8
* inData
, size_t inLimit
, enet_uint8
* outData
, size_t outLimit
);
337 /** Destroys the context when compression is disabled or the host is destroyed. May be NULL. */
338 void (ENET_CALLBACK
* destroy
) (void * context
);
341 /** Callback that computes the checksum of the data held in buffers[0:bufferCount-1] */
342 typedef enet_uint32 (ENET_CALLBACK
* ENetChecksumCallback
) (const ENetBuffer
* buffers
, size_t bufferCount
);
344 /** Callback for intercepting received raw UDP packets. Should return 1 to intercept, 0 to ignore, or -1 to propagate an error. */
345 typedef int (ENET_CALLBACK
* ENetInterceptCallback
) (struct _ENetHost
* host
, struct _ENetEvent
* event
);
347 /** An ENet host for communicating with peers.
349 * No fields should be modified unless otherwise stated.
351 @sa enet_host_create()
352 @sa enet_host_destroy()
353 @sa enet_host_connect()
354 @sa enet_host_service()
355 @sa enet_host_flush()
356 @sa enet_host_broadcast()
357 @sa enet_host_compress()
358 @sa enet_host_compress_with_range_coder()
359 @sa enet_host_channel_limit()
360 @sa enet_host_bandwidth_limit()
361 @sa enet_host_bandwidth_throttle()
363 typedef struct _ENetHost
366 ENetAddress address
; /**< Internet address of the host */
367 enet_uint32 incomingBandwidth
; /**< downstream bandwidth of the host */
368 enet_uint32 outgoingBandwidth
; /**< upstream bandwidth of the host */
369 enet_uint32 bandwidthThrottleEpoch
;
371 enet_uint32 randomSeed
;
372 int recalculateBandwidthLimits
;
373 ENetPeer
* peers
; /**< array of peers allocated for this host */
374 size_t peerCount
; /**< number of peers allocated for this host */
375 size_t channelLimit
; /**< maximum number of channels allowed for connected peers */
376 enet_uint32 serviceTime
;
377 ENetList dispatchQueue
;
380 enet_uint16 headerFlags
;
381 ENetProtocol commands
[ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS
];
383 ENetBuffer buffers
[ENET_BUFFER_MAXIMUM
];
385 ENetChecksumCallback checksum
; /**< callback the user can set to enable packet checksums for this host */
386 ENetCompressor compressor
;
387 enet_uint8 packetData
[2][ENET_PROTOCOL_MAXIMUM_MTU
];
388 ENetAddress receivedAddress
;
389 enet_uint8
* receivedData
;
390 size_t receivedDataLength
;
391 enet_uint32 totalSentData
; /**< total data sent, user should reset to 0 as needed to prevent overflow */
392 enet_uint32 totalSentPackets
; /**< total UDP packets sent, user should reset to 0 as needed to prevent overflow */
393 enet_uint32 totalReceivedData
; /**< total data received, user should reset to 0 as needed to prevent overflow */
394 enet_uint32 totalReceivedPackets
; /**< total UDP packets received, user should reset to 0 as needed to prevent overflow */
395 ENetInterceptCallback intercept
; /**< callback the user can set to intercept received raw UDP packets */
396 size_t connectedPeers
;
397 size_t bandwidthLimitedPeers
;
398 size_t duplicatePeers
; /**< optional number of allowed peers from duplicate IPs, defaults to ENET_PROTOCOL_MAXIMUM_PEER_ID */
399 size_t maximumPacketSize
; /**< the maximum allowable packet size that may be sent or received on a peer */
400 size_t maximumWaitingData
; /**< the maximum aggregate amount of buffer space a peer may use waiting for packets to be delivered */
404 * An ENet event type, as specified in @ref ENetEvent.
406 typedef enum _ENetEventType
408 /** no event occurred within the specified time limit */
409 ENET_EVENT_TYPE_NONE
= 0,
411 /** a connection request initiated by enet_host_connect has completed.
412 * The peer field contains the peer which successfully connected.
414 ENET_EVENT_TYPE_CONNECT
= 1,
416 /** a peer has disconnected. This event is generated on a successful
417 * completion of a disconnect initiated by enet_peer_disconnect, if
418 * a peer has timed out, or if a connection request intialized by
419 * enet_host_connect has timed out. The peer field contains the peer
420 * which disconnected. The data field contains user supplied data
421 * describing the disconnection, or 0, if none is available.
423 ENET_EVENT_TYPE_DISCONNECT
= 2,
425 /** a packet has been received from a peer. The peer field specifies the
426 * peer which sent the packet. The channelID field specifies the channel
427 * number upon which the packet was received. The packet field contains
428 * the packet that was received; this packet must be destroyed with
429 * enet_packet_destroy after use.
431 ENET_EVENT_TYPE_RECEIVE
= 3
435 * An ENet event as returned by enet_host_service().
437 @sa enet_host_service
439 typedef struct _ENetEvent
441 ENetEventType type
; /**< type of the event */
442 ENetPeer
* peer
; /**< peer that generated a connect, disconnect or receive event */
443 enet_uint8 channelID
; /**< channel on the peer that generated the event, if appropriate */
444 enet_uint32 data
; /**< data associated with the event, if appropriate */
445 ENetPacket
* packet
; /**< packet associated with the event, if appropriate */
448 /** @defgroup global ENet global functions
453 Initializes ENet globally. Must be called prior to using any functions in
455 @returns 0 on success, < 0 on failure
457 ENET_API
int enet_initialize (void);
460 Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. Make sure the ENetCallbacks structure is zeroed out so that any additional callbacks added in future versions will be properly ignored.
462 @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use
463 @param inits user-overridden callbacks where any NULL callbacks will use ENet's defaults
464 @returns 0 on success, < 0 on failure
466 ENET_API
int enet_initialize_with_callbacks (ENetVersion version
, const ENetCallbacks
* inits
);
469 Shuts down ENet globally. Should be called when a program that has
470 initialized ENet exits.
472 ENET_API
void enet_deinitialize (void);
475 Gives the linked version of the ENet library.
476 @returns the version number
478 ENET_API ENetVersion
enet_linked_version (void);
482 /** @defgroup private ENet private implementation functions */
485 Returns the wall-time in milliseconds. Its initial value is unspecified
486 unless otherwise set.
488 ENET_API enet_uint32
enet_time_get (void);
490 Sets the current wall-time in milliseconds.
492 ENET_API
void enet_time_set (enet_uint32
);
494 /** @defgroup socket ENet socket functions
497 ENET_API ENetSocket
enet_socket_create (ENetSocketType
);
498 ENET_API
int enet_socket_bind (ENetSocket
, const ENetAddress
*);
499 ENET_API
int enet_socket_get_address (ENetSocket
, ENetAddress
*);
500 ENET_API
int enet_socket_listen (ENetSocket
, int);
501 ENET_API ENetSocket
enet_socket_accept (ENetSocket
, ENetAddress
*);
502 ENET_API
int enet_socket_connect (ENetSocket
, const ENetAddress
*);
503 ENET_API
int enet_socket_send (ENetSocket
, const ENetAddress
*, const ENetBuffer
*, size_t);
504 ENET_API
int enet_socket_receive (ENetSocket
, ENetAddress
*, ENetBuffer
*, size_t);
505 ENET_API
int enet_socket_wait (ENetSocket
, enet_uint32
*, enet_uint32
);
506 ENET_API
int enet_socket_set_option (ENetSocket
, ENetSocketOption
, int);
507 ENET_API
int enet_socket_get_option (ENetSocket
, ENetSocketOption
, int *);
508 ENET_API
int enet_socket_shutdown (ENetSocket
, ENetSocketShutdown
);
509 ENET_API
void enet_socket_destroy (ENetSocket
);
510 ENET_API
int enet_socketset_select (ENetSocket
, ENetSocketSet
*, ENetSocketSet
*, enet_uint32
);
514 /** @defgroup Address ENet address functions
518 /** Attempts to parse the printable form of the IP address in the parameter hostName
519 and sets the host field in the address parameter if successful.
520 @param address destination to store the parsed IP address
521 @param hostName IP address to parse
523 @retval < 0 on failure
524 @returns the address of the given hostName in address on success
526 ENET_API
int enet_address_set_host_ip (ENetAddress
* address
, const char * hostName
);
528 /** Attempts to resolve the host named by the parameter hostName and sets
529 the host field in the address parameter if successful.
530 @param address destination to store resolved address
531 @param hostName host name to lookup
533 @retval < 0 on failure
534 @returns the address of the given hostName in address on success
536 ENET_API
int enet_address_set_host (ENetAddress
* address
, const char * hostName
);
538 /** Gives the printable form of the IP address specified in the address parameter.
539 @param address address printed
540 @param hostName destination for name, must not be NULL
541 @param nameLength maximum length of hostName.
542 @returns the null-terminated name of the host in hostName on success
544 @retval < 0 on failure
546 ENET_API
int enet_address_get_host_ip (const ENetAddress
* address
, char * hostName
, size_t nameLength
);
548 /** Attempts to do a reverse lookup of the host field in the address parameter.
549 @param address address used for reverse lookup
550 @param hostName destination for name, must not be NULL
551 @param nameLength maximum length of hostName.
552 @returns the null-terminated name of the host in hostName on success
554 @retval < 0 on failure
556 ENET_API
int enet_address_get_host (const ENetAddress
* address
, char * hostName
, size_t nameLength
);
560 ENET_API ENetPacket
* enet_packet_create (const void *, size_t, enet_uint32
);
561 ENET_API
void enet_packet_destroy (ENetPacket
*);
562 ENET_API
int enet_packet_resize (ENetPacket
*, size_t);
563 ENET_API enet_uint32
enet_crc32 (const ENetBuffer
*, size_t);
565 ENET_API ENetHost
* enet_host_create (const ENetAddress
*, size_t, size_t, enet_uint32
, enet_uint32
);
566 ENET_API
void enet_host_destroy (ENetHost
*);
567 ENET_API ENetPeer
* enet_host_connect (ENetHost
*, const ENetAddress
*, size_t, enet_uint32
);
568 ENET_API
int enet_host_check_events (ENetHost
*, ENetEvent
*);
569 ENET_API
int enet_host_service (ENetHost
*, ENetEvent
*, enet_uint32
);
570 ENET_API
void enet_host_flush (ENetHost
*);
571 ENET_API
void enet_host_broadcast (ENetHost
*, enet_uint8
, ENetPacket
*);
572 ENET_API
void enet_host_compress (ENetHost
*, const ENetCompressor
*);
573 ENET_API
int enet_host_compress_with_range_coder (ENetHost
* host
);
574 ENET_API
void enet_host_channel_limit (ENetHost
*, size_t);
575 ENET_API
void enet_host_bandwidth_limit (ENetHost
*, enet_uint32
, enet_uint32
);
576 extern void enet_host_bandwidth_throttle (ENetHost
*);
577 extern enet_uint32
enet_host_random_seed (void);
579 ENET_API
int enet_peer_send (ENetPeer
*, enet_uint8
, ENetPacket
*);
580 ENET_API ENetPacket
* enet_peer_receive (ENetPeer
*, enet_uint8
* channelID
);
581 ENET_API
void enet_peer_ping (ENetPeer
*);
582 ENET_API
void enet_peer_ping_interval (ENetPeer
*, enet_uint32
);
583 ENET_API
void enet_peer_timeout (ENetPeer
*, enet_uint32
, enet_uint32
, enet_uint32
);
584 ENET_API
void enet_peer_reset (ENetPeer
*);
585 ENET_API
void enet_peer_disconnect (ENetPeer
*, enet_uint32
);
586 ENET_API
void enet_peer_disconnect_now (ENetPeer
*, enet_uint32
);
587 ENET_API
void enet_peer_disconnect_later (ENetPeer
*, enet_uint32
);
588 ENET_API
void enet_peer_throttle_configure (ENetPeer
*, enet_uint32
, enet_uint32
, enet_uint32
);
589 extern int enet_peer_throttle (ENetPeer
*, enet_uint32
);
590 extern void enet_peer_reset_queues (ENetPeer
*);
591 extern void enet_peer_setup_outgoing_command (ENetPeer
*, ENetOutgoingCommand
*);
592 extern ENetOutgoingCommand
* enet_peer_queue_outgoing_command (ENetPeer
*, const ENetProtocol
*, ENetPacket
*, enet_uint32
, enet_uint16
);
593 extern ENetIncomingCommand
* enet_peer_queue_incoming_command (ENetPeer
*, const ENetProtocol
*, const void *, size_t, enet_uint32
, enet_uint32
);
594 extern ENetAcknowledgement
* enet_peer_queue_acknowledgement (ENetPeer
*, const ENetProtocol
*, enet_uint16
);
595 extern void enet_peer_dispatch_incoming_unreliable_commands (ENetPeer
*, ENetChannel
*, ENetIncomingCommand
*);
596 extern void enet_peer_dispatch_incoming_reliable_commands (ENetPeer
*, ENetChannel
*, ENetIncomingCommand
*);
597 extern void enet_peer_on_connect (ENetPeer
*);
598 extern void enet_peer_on_disconnect (ENetPeer
*);
600 ENET_API
void * enet_range_coder_create (void);
601 ENET_API
void enet_range_coder_destroy (void *);
602 ENET_API
size_t enet_range_coder_compress (void *, const ENetBuffer
*, size_t, size_t, enet_uint8
*, size_t);
603 ENET_API
size_t enet_range_coder_decompress (void *, const enet_uint8
*, size_t, enet_uint8
*, size_t);
605 extern size_t enet_protocol_command_size (enet_uint8
);
611 #endif /* __ENET_ENET_H__ */