source: osgVisual/trunk/include/cluster/enet/enet.h @ 350

Last change on this file since 350 was 65, checked in by Torben Dannhauer, 14 years ago

new cluster implementation added: ENet
ENet is a reliable UDP implementation with quite simple usage and high performance for transmission with small or medium size packet.

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