Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

fix some stuff

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