Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7391 was 7391, checked in by rgrieder, 14 years ago

Compile ENet as C library.

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