Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ipv6/src/external/enet/include/enet/enet.h @ 7330

Last change on this file since 7330 was 7330, checked in by adrfried, 14 years ago

patch libenet to support ipv6

This is only done for Linux so far.

File size: 22.5 KB
Line 
1/**
2 @file  enet.h
3 @brief ENet public header file
4*/
5#ifndef __ENET_ENET_H__
6#define __ENET_ENET_H__
7
8#ifdef __cplusplus
9extern "C"
10{
11#endif
12
13#include <stdlib.h>
14
15#ifdef WIN32
16#include "enet/win32.h"
17#else
18#include "enet/unix.h"
19#endif
20
21#include "enet/types.h"
22#include "enet/protocol.h"
23#include "enet/list.h"
24#include "enet/callbacks.h"
25
26#define ENET_VERSION_MAJOR 1
27#define ENET_VERSION_MINOR 3
28#define ENET_VERSION_PATCH 0
29#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch))
30#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH)
31
32typedef enet_uint32 ENetVersion;
33
34typedef enum _ENetSocketType
35{
36   ENET_SOCKET_TYPE_STREAM   = 1,
37   ENET_SOCKET_TYPE_DATAGRAM = 2
38} ENetSocketType;
39
40typedef enum _ENetSocketWait
41{
42   ENET_SOCKET_WAIT_NONE    = 0,
43   ENET_SOCKET_WAIT_SEND    = (1 << 0),
44   ENET_SOCKET_WAIT_RECEIVE = (1 << 1)
45} ENetSocketWait;
46
47typedef enum _ENetSocketOption
48{
49   ENET_SOCKOPT_NONBLOCK  = 1,
50   ENET_SOCKOPT_BROADCAST = 2,
51   ENET_SOCKOPT_RCVBUF    = 3,
52   ENET_SOCKOPT_SNDBUF    = 4,
53   ENET_SOCKOPT_REUSEADDR = 5,
54   ENET_SOCKOPT_V6ONLY = 6
55} ENetSocketOption;
56
57typedef struct _ENetHostAddress
58{
59   enet_uint8 addr[16];
60} ENetHostAddress;
61
62extern const ENetHostAddress ENET_HOST_ANY;       /**< specifies the default server host */
63extern const ENetHostAddress ENET_HOST_BROADCAST; /**< specifies a IPv4 subnet-wide broadcast */
64#define ENET_PORT_ANY 0                           /**< specifies that a port should be automatically chosen */
65
66/**
67 * Portable internet address structure.
68 *
69 * The host must be specified in network byte-order, and the port must be in host
70 * byte-order. The constant ENET_HOST_ANY may be used to specify the default
71 * server host. The constant ENET_HOST_BROADCAST may be used to specify the
72 * broadcast address (255.255.255.255).  This makes sense for enet_host_connect,
73 * but not for enet_host_create.  Once a server responds to a broadcast, the
74 * address is updated from ENET_HOST_BROADCAST to the server's actual IP address.
75 */
76typedef struct _ENetAddress
77{
78   ENetHostAddress host;
79   enet_uint32 scopeID; //FIXME: this is of different size on Windows
80   enet_uint16 port;
81} ENetAddress;
82
83/**
84 * Packet flag bit constants.
85 *
86 * The host must be specified in network byte-order, and the port must be in
87 * host byte-order. The constant ENET_HOST_ANY may be used to specify the
88 * default server host.
89 
90   @sa ENetPacket
91*/
92typedef enum _ENetPacketFlag
93{
94   /** packet must be received by the target peer and resend attempts should be
95     * made until the packet is delivered */
96   ENET_PACKET_FLAG_RELIABLE    = (1 << 0),
97   /** packet will not be sequenced with other packets
98     * not supported for reliable packets
99     */
100   ENET_PACKET_FLAG_UNSEQUENCED = (1 << 1),
101   /** packet will not allocate data, and user must supply it instead */
102   ENET_PACKET_FLAG_NO_ALLOCATE = (1 << 2)
103} ENetPacketFlag;
104
105struct _ENetPacket;
106typedef void (ENET_CALLBACK * ENetPacketFreeCallback) (struct _ENetPacket *);
107
108/**
109 * ENet packet structure.
110 *
111 * An ENet data packet that may be sent to or received from a peer. The shown
112 * fields should only be read and never modified. The data field contains the
113 * allocated data for the packet. The dataLength fields specifies the length
114 * of the allocated data.  The flags field is either 0 (specifying no flags),
115 * or a bitwise-or of any combination of the following flags:
116 *
117 *    ENET_PACKET_FLAG_RELIABLE - packet must be received by the target peer
118 *    and resend attempts should be made until the packet is delivered
119 *
120 *    ENET_PACKET_FLAG_UNSEQUENCED - packet will not be sequenced with other packets
121 *    (not supported for reliable packets)
122 *
123 *    ENET_PACKET_FLAG_NO_ALLOCATE - packet will not allocate data, and user must supply it instead
124 
125   @sa ENetPacketFlag
126 */
127typedef struct _ENetPacket
128{
129   size_t                   referenceCount;  /**< internal use only */
130   enet_uint32              flags;           /**< bitwise-or of ENetPacketFlag constants */
131   enet_uint8 *             data;            /**< allocated data for packet */
132   size_t                   dataLength;      /**< length of data */
133   ENetPacketFreeCallback   freeCallback;    /**< function to be called when the packet is no longer in use */
134} ENetPacket;
135
136typedef struct _ENetAcknowledgement
137{
138   ENetListNode acknowledgementList;
139   enet_uint32  sentTime;
140   ENetProtocol command;
141} ENetAcknowledgement;
142
143typedef struct _ENetOutgoingCommand
144{
145   ENetListNode outgoingCommandList;
146   enet_uint16  reliableSequenceNumber;
147   enet_uint16  unreliableSequenceNumber;
148   enet_uint32  sentTime;
149   enet_uint32  roundTripTimeout;
150   enet_uint32  roundTripTimeoutLimit;
151   enet_uint32  fragmentOffset;
152   enet_uint16  fragmentLength;
153   enet_uint16  sendAttempts;
154   ENetProtocol command;
155   ENetPacket * packet;
156} ENetOutgoingCommand;
157
158typedef struct _ENetIncomingCommand
159{ 
160   ENetListNode     incomingCommandList;
161   enet_uint16      reliableSequenceNumber;
162   enet_uint16      unreliableSequenceNumber;
163   ENetProtocol     command;
164   enet_uint32      fragmentCount;
165   enet_uint32      fragmentsRemaining;
166   enet_uint32 *    fragments;
167   ENetPacket *     packet;
168} ENetIncomingCommand;
169
170typedef enum _ENetPeerState
171{
172   ENET_PEER_STATE_DISCONNECTED                = 0,
173   ENET_PEER_STATE_CONNECTING                  = 1,
174   ENET_PEER_STATE_ACKNOWLEDGING_CONNECT       = 2,
175   ENET_PEER_STATE_CONNECTION_PENDING          = 3,
176   ENET_PEER_STATE_CONNECTION_SUCCEEDED        = 4,
177   ENET_PEER_STATE_CONNECTED                   = 5,
178   ENET_PEER_STATE_DISCONNECT_LATER            = 6,
179   ENET_PEER_STATE_DISCONNECTING               = 7,
180   ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT    = 8,
181   ENET_PEER_STATE_ZOMBIE                      = 9 
182} ENetPeerState;
183
184#ifndef ENET_BUFFER_MAXIMUM
185#define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS)
186#endif
187
188enum
189{
190   ENET_HOST_RECEIVE_BUFFER_SIZE          = 256 * 1024,
191   ENET_HOST_SEND_BUFFER_SIZE             = 256 * 1024,
192   ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL  = 1000,
193   ENET_HOST_DEFAULT_MTU                  = 1400,
194
195   ENET_PEER_DEFAULT_ROUND_TRIP_TIME      = 500,
196   ENET_PEER_DEFAULT_PACKET_THROTTLE      = 32,
197   ENET_PEER_PACKET_THROTTLE_SCALE        = 32,
198   ENET_PEER_PACKET_THROTTLE_COUNTER      = 7, 
199   ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2,
200   ENET_PEER_PACKET_THROTTLE_DECELERATION = 2,
201   ENET_PEER_PACKET_THROTTLE_INTERVAL     = 5000,
202   ENET_PEER_PACKET_LOSS_SCALE            = (1 << 16),
203   ENET_PEER_PACKET_LOSS_INTERVAL         = 10000,
204   ENET_PEER_WINDOW_SIZE_SCALE            = 64 * 1024,
205   ENET_PEER_TIMEOUT_LIMIT                = 32,
206   ENET_PEER_TIMEOUT_MINIMUM              = 5000,
207   ENET_PEER_TIMEOUT_MAXIMUM              = 30000,
208   ENET_PEER_PING_INTERVAL                = 500,
209   ENET_PEER_UNSEQUENCED_WINDOWS          = 64,
210   ENET_PEER_UNSEQUENCED_WINDOW_SIZE      = 1024,
211   ENET_PEER_FREE_UNSEQUENCED_WINDOWS     = 32,
212   ENET_PEER_RELIABLE_WINDOWS             = 16,
213   ENET_PEER_RELIABLE_WINDOW_SIZE         = 0x1000,
214   ENET_PEER_FREE_RELIABLE_WINDOWS        = 8
215};
216
217typedef struct _ENetChannel
218{
219   enet_uint16  outgoingReliableSequenceNumber;
220   enet_uint16  outgoingUnreliableSequenceNumber;
221   enet_uint16  usedReliableWindows;
222   enet_uint16  reliableWindows [ENET_PEER_RELIABLE_WINDOWS];
223   enet_uint16  incomingReliableSequenceNumber;
224   ENetList     incomingReliableCommands;
225   ENetList     incomingUnreliableCommands;
226} ENetChannel;
227
228/**
229 * An ENet peer which data packets may be sent or received from.
230 *
231 * No fields should be modified unless otherwise specified.
232 */
233typedef struct _ENetPeer
234{ 
235   ENetListNode  dispatchList;
236   struct _ENetHost * host;
237   enet_uint16   outgoingPeerID;
238   enet_uint16   incomingPeerID;
239   enet_uint32   connectID;
240   enet_uint8    outgoingSessionID;
241   enet_uint8    incomingSessionID;
242   ENetAddress   address;            /**< Internet address of the peer */
243   void *        data;               /**< Application private data, may be freely modified */
244   ENetPeerState state;
245   ENetChannel * channels;
246   size_t        channelCount;       /**< Number of channels allocated for communication with peer */
247   enet_uint32   incomingBandwidth;  /**< Downstream bandwidth of the client in bytes/second */
248   enet_uint32   outgoingBandwidth;  /**< Upstream bandwidth of the client in bytes/second */
249   enet_uint32   incomingBandwidthThrottleEpoch;
250   enet_uint32   outgoingBandwidthThrottleEpoch;
251   enet_uint32   incomingDataTotal;
252   enet_uint32   outgoingDataTotal;
253   enet_uint32   lastSendTime;
254   enet_uint32   lastReceiveTime;
255   enet_uint32   nextTimeout;
256   enet_uint32   earliestTimeout;
257   enet_uint32   packetLossEpoch;
258   enet_uint32   packetsSent;
259   enet_uint32   packetsLost;
260   enet_uint32   packetLoss;          /**< mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SCALE */
261   enet_uint32   packetLossVariance;
262   enet_uint32   packetThrottle;
263   enet_uint32   packetThrottleLimit;
264   enet_uint32   packetThrottleCounter;
265   enet_uint32   packetThrottleEpoch;
266   enet_uint32   packetThrottleAcceleration;
267   enet_uint32   packetThrottleDeceleration;
268   enet_uint32   packetThrottleInterval;
269   enet_uint32   lastRoundTripTime;
270   enet_uint32   lowestRoundTripTime;
271   enet_uint32   lastRoundTripTimeVariance;
272   enet_uint32   highestRoundTripTimeVariance;
273   enet_uint32   roundTripTime;            /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */
274   enet_uint32   roundTripTimeVariance;
275   enet_uint32   mtu;
276   enet_uint32   windowSize;
277   enet_uint32   reliableDataInTransit;
278   enet_uint16   outgoingReliableSequenceNumber;
279   ENetList      acknowledgements;
280   ENetList      sentReliableCommands;
281   ENetList      sentUnreliableCommands;
282   ENetList      outgoingReliableCommands;
283   ENetList      outgoingUnreliableCommands;
284   ENetList      dispatchedCommands;
285   int           needsDispatch;
286   enet_uint16   incomingUnsequencedGroup;
287   enet_uint16   outgoingUnsequencedGroup;
288   enet_uint32   unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32]; 
289   enet_uint32   eventData;
290} ENetPeer;
291
292/** An ENet packet compressor for compressing UDP packets before socket sends or receives.
293 */
294typedef struct _ENetCompressor
295{
296   /** Context data for the compressor. Must be non-NULL. */
297   void * context;
298   /** Compresses from inBuffers[0:inBufferCount-1], containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */
299   size_t (ENET_CALLBACK * compress) (void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit);
300   /** Decompresses from inData, containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */
301   size_t (ENET_CALLBACK * decompress) (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit);
302   /** Destroys the context when compression is disabled or the host is destroyed. May be NULL. */
303   void (ENET_CALLBACK * destroy) (void * context);
304} ENetCompressor;
305
306/** Callback that computes the checksum of the data held in buffers[0:bufferCount-1] */
307typedef enet_uint32 (ENET_CALLBACK * ENetChecksumCallback) (const ENetBuffer * buffers, size_t bufferCount);
308 
309/** An ENet host for communicating with peers.
310  *
311  * No fields should be modified unless otherwise stated.
312
313    @sa enet_host_create()
314    @sa enet_host_destroy()
315    @sa enet_host_connect()
316    @sa enet_host_service()
317    @sa enet_host_flush()
318    @sa enet_host_broadcast()
319    @sa enet_host_compress()
320    @sa enet_host_compress_with_range_coder()
321    @sa enet_host_channel_limit()
322    @sa enet_host_bandwidth_limit()
323    @sa enet_host_bandwidth_throttle()
324  */
325typedef struct _ENetHost
326{
327   ENetSocket           socket;
328   ENetAddress          address;                     /**< Internet address of the host */
329   enet_uint32          incomingBandwidth;           /**< downstream bandwidth of the host */
330   enet_uint32          outgoingBandwidth;           /**< upstream bandwidth of the host */
331   enet_uint32          bandwidthThrottleEpoch;
332   enet_uint32          mtu;
333   enet_uint32          randomSeed;
334   int                  recalculateBandwidthLimits;
335   ENetPeer *           peers;                       /**< array of peers allocated for this host */
336   size_t               peerCount;                   /**< number of peers allocated for this host */
337   size_t               channelLimit;                /**< maximum number of channels allowed for connected peers */
338   enet_uint32          serviceTime;
339   ENetList             dispatchQueue;
340   int                  continueSending;
341   size_t               packetSize;
342   enet_uint16          headerFlags;
343   ENetProtocol         commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS];
344   size_t               commandCount;
345   ENetBuffer           buffers [ENET_BUFFER_MAXIMUM];
346   size_t               bufferCount;
347   ENetChecksumCallback checksum;                    /**< callback the user can set to enable packet checksums for this host */
348   ENetCompressor       compressor;
349   enet_uint8           packetData [2][ENET_PROTOCOL_MAXIMUM_MTU];
350   ENetAddress          receivedAddress;
351   enet_uint8 *         receivedData;
352   size_t               receivedDataLength;
353   enet_uint32          totalSentData;               /**< total data sent, user should reset to 0 as needed to prevent overflow */
354   enet_uint32          totalSentPackets;            /**< total UDP packets sent, user should reset to 0 as needed to prevent overflow */
355   enet_uint32          totalReceivedData;           /**< total data received, user should reset to 0 as needed to prevent overflow */
356   enet_uint32          totalReceivedPackets;        /**< total UDP packets received, user should reset to 0 as needed to prevent overflow */
357} ENetHost;
358
359/**
360 * An ENet event type, as specified in @ref ENetEvent.
361 */
362typedef enum _ENetEventType
363{
364   /** no event occurred within the specified time limit */
365   ENET_EVENT_TYPE_NONE       = 0, 
366
367   /** a connection request initiated by enet_host_connect has completed. 
368     * The peer field contains the peer which successfully connected.
369     */
370   ENET_EVENT_TYPE_CONNECT    = 1, 
371
372   /** a peer has disconnected.  This event is generated on a successful
373     * completion of a disconnect initiated by enet_pper_disconnect, if
374     * a peer has timed out, or if a connection request intialized by
375     * enet_host_connect has timed out.  The peer field contains the peer
376     * which disconnected. The data field contains user supplied data
377     * describing the disconnection, or 0, if none is available.
378     */
379   ENET_EVENT_TYPE_DISCONNECT = 2, 
380
381   /** a packet has been received from a peer.  The peer field specifies the
382     * peer which sent the packet.  The channelID field specifies the channel
383     * number upon which the packet was received.  The packet field contains
384     * the packet that was received; this packet must be destroyed with
385     * enet_packet_destroy after use.
386     */
387   ENET_EVENT_TYPE_RECEIVE    = 3
388} ENetEventType;
389
390/**
391 * An ENet event as returned by enet_host_service().
392   
393   @sa enet_host_service
394 */
395typedef struct _ENetEvent
396{
397   ENetEventType        type;      /**< type of the event */
398   ENetPeer *           peer;      /**< peer that generated a connect, disconnect or receive event */
399   enet_uint8           channelID; /**< channel on the peer that generated the event, if appropriate */
400   enet_uint32          data;      /**< data associated with the event, if appropriate */
401   ENetPacket *         packet;    /**< packet associated with the event, if appropriate */
402} ENetEvent;
403
404/** @defgroup global ENet global functions
405    @{
406*/
407
408/**
409  Initializes ENet globally.  Must be called prior to using any functions in
410  ENet.
411  @returns 0 on success, < 0 on failure
412*/
413ENET_API int enet_initialize (void);
414
415/**
416  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.
417
418  @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use
419  @param inits user-overriden callbacks where any NULL callbacks will use ENet's defaults
420  @returns 0 on success, < 0 on failure
421*/
422ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits);
423
424/**
425  Shuts down ENet globally.  Should be called when a program that has
426  initialized ENet exits.
427*/
428ENET_API void enet_deinitialize (void);
429
430/** @} */
431
432/** @defgroup private ENet private implementation functions */
433
434/**
435  Returns the wall-time in milliseconds.  Its initial value is unspecified
436  unless otherwise set.
437  */
438ENET_API enet_uint32 enet_time_get (void);
439/**
440  Sets the current wall-time in milliseconds.
441  */
442ENET_API void enet_time_set (enet_uint32);
443
444/** @defgroup socket ENet socket functions
445    @{
446*/
447ENET_API ENetSocket enet_socket_create (ENetSocketType);
448ENET_API int        enet_socket_bind (ENetSocket, const ENetAddress *);
449ENET_API int        enet_socket_listen (ENetSocket, int);
450ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *);
451ENET_API int        enet_socket_connect (ENetSocket, const ENetAddress *);
452ENET_API int        enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t);
453ENET_API int        enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t);
454ENET_API int        enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32);
455ENET_API int        enet_socket_set_option (ENetSocket, ENetSocketOption, int);
456ENET_API void       enet_socket_destroy (ENetSocket);
457ENET_API int        enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32);
458
459/** @} */
460
461/** @defgroup Address ENet address functions
462    @{
463*/
464/** Attempts to resolve the host named by the parameter hostName and sets
465    the host field in the address parameter if successful.
466    @param address destination to store resolved address
467    @param hostName host name to lookup
468    @retval 0 on success
469    @retval < 0 on failure
470    @returns the address of the given hostName in address on success
471*/
472ENET_API int enet_address_set_host (ENetAddress * address, const char * hostName);
473
474/** Gives the printable form of the ip address specified in the address parameter.
475    @param address    address printed
476    @param hostName   destination for name, must not be NULL
477    @param nameLength maximum length of hostName.
478    @returns the null-terminated name of the host in hostName on success
479    @retval 0 on success
480    @retval < 0 on failure
481*/
482ENET_API int enet_address_get_host_ip (const ENetAddress * address, char * hostName, size_t nameLength);
483
484/** Attempts to do a reverse lookup of the host field in the address parameter.
485    @param address    address used for reverse lookup
486    @param hostName   destination for name, must not be NULL
487    @param nameLength maximum length of hostName.
488    @returns the null-terminated name of the host in hostName on success
489    @retval 0 on success
490    @retval < 0 on failure
491*/
492ENET_API int enet_address_get_host (const ENetAddress * address, char * hostName, size_t nameLength);
493
494/** Maps an IPv4 Address to an IPv6 address.
495    @param address IPv4 address in network byte order
496    @returns the IPv4-mapped IPv6 address in network byte order
497*/
498static inline ENetHostAddress enet_address_map4 (enet_uint32 address)
499{
500   ENetHostAddress addr = ENET_HOST_ANY;
501   ((enet_uint16 *)addr.addr)[5] = 0xffff;
502   ((enet_uint32 *)addr.addr)[3] = address;
503   return addr;
504}
505
506/** @} */
507
508ENET_API ENetPacket * enet_packet_create (const void *, size_t, enet_uint32);
509ENET_API void         enet_packet_destroy (ENetPacket *);
510ENET_API int          enet_packet_resize  (ENetPacket *, size_t);
511extern enet_uint32    enet_crc32 (const ENetBuffer *, size_t);
512               
513ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, size_t, enet_uint32, enet_uint32);
514ENET_API void       enet_host_destroy (ENetHost *);
515ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t, enet_uint32);
516ENET_API int        enet_host_check_events (ENetHost *, ENetEvent *);
517ENET_API int        enet_host_service (ENetHost *, ENetEvent *, enet_uint32);
518ENET_API void       enet_host_flush (ENetHost *);
519ENET_API void       enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *);
520ENET_API void       enet_host_compress (ENetHost *, const ENetCompressor *);
521ENET_API int        enet_host_compress_with_range_coder (ENetHost * host);
522ENET_API void       enet_host_channel_limit (ENetHost *, size_t);
523ENET_API void       enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32);
524extern   void       enet_host_bandwidth_throttle (ENetHost *);
525
526ENET_API int                 enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *);
527ENET_API ENetPacket *        enet_peer_receive (ENetPeer *, enet_uint8 * channelID);
528ENET_API void                enet_peer_ping (ENetPeer *);
529ENET_API void                enet_peer_reset (ENetPeer *);
530ENET_API void                enet_peer_disconnect (ENetPeer *, enet_uint32);
531ENET_API void                enet_peer_disconnect_now (ENetPeer *, enet_uint32);
532ENET_API void                enet_peer_disconnect_later (ENetPeer *, enet_uint32);
533ENET_API void                enet_peer_throttle_configure (ENetPeer *, enet_uint32, enet_uint32, enet_uint32);
534extern int                   enet_peer_throttle (ENetPeer *, enet_uint32);
535extern void                  enet_peer_reset_queues (ENetPeer *);
536extern void                  enet_peer_setup_outgoing_command (ENetPeer *, ENetOutgoingCommand *);
537extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16);
538extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32);
539extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint16);
540extern void                  enet_peer_dispatch_incoming_unreliable_commands (ENetPeer *, ENetChannel *);
541extern void                  enet_peer_dispatch_incoming_reliable_commands (ENetPeer *, ENetChannel *);
542
543ENET_API void * enet_range_coder_create (void);
544ENET_API void   enet_range_coder_destroy (void *);
545ENET_API size_t enet_range_coder_compress (void *, const ENetBuffer *, size_t, size_t, enet_uint8 *, size_t);
546ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t, enet_uint8 *, size_t);
547   
548extern size_t enet_protocol_command_size (enet_uint8);
549
550#ifdef __cplusplus
551}
552#endif
553
554#endif /* __ENET_ENET_H__ */
555
Note: See TracBrowser for help on using the repository browser.