callbacks.h   callbacks.h 
/** /**
@file callbacks.h @file callbacks.h
@brief ENet callbacks @brief ENet callbacks
*/ */
#ifndef __ENET_CALLBACKS_H__ #ifndef __ENET_CALLBACKS_H__
#define __ENET_CALLBACKS_H__ #define __ENET_CALLBACKS_H__
#include <stdlib.h> #include <stdlib.h>
typedef struct typedef struct _ENetCallbacks
{ {
void * (ENET_CALLBACK * malloc) (size_t size); void * (ENET_CALLBACK * malloc) (size_t size);
void (ENET_CALLBACK * free) (void * memory); void (ENET_CALLBACK * free) (void * memory);
int (ENET_CALLBACK * rand) (void); int (ENET_CALLBACK * rand) (void);
void (ENET_CALLBACK * no_memory) (void);
} ENetCallbacks; } ENetCallbacks;
/** @defgroup callbacks ENet internal callbacks /** @defgroup callbacks ENet internal callbacks
@{ @{
@ingroup private @ingroup private
*/ */
extern void * enet_malloc (size_t); extern void * enet_malloc (size_t);
extern void enet_free (void *); extern void enet_free (void *);
extern int enet_rand (void); extern int enet_rand (void);
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 enet.h   enet.h 
skipping to change at line 26 skipping to change at line 26
#include "enet/win32.h" #include "enet/win32.h"
#else #else
#include "enet/unix.h" #include "enet/unix.h"
#endif #endif
#include "enet/types.h" #include "enet/types.h"
#include "enet/protocol.h" #include "enet/protocol.h"
#include "enet/list.h" #include "enet/list.h"
#include "enet/callbacks.h" #include "enet/callbacks.h"
typedef enum #define ENET_VERSION_MAJOR 1
{ #define ENET_VERSION_MINOR 2
ENET_VERSION = 1 #define ENET_VERSION_PATCH 2
} ENetVersion; #define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<
<8) | (patch))
#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_M
INOR, ENET_VERSION_PATCH)
typedef enet_uint32 ENetVersion;
typedef enum typedef enum _ENetSocketType
{ {
ENET_SOCKET_TYPE_STREAM = 1, ENET_SOCKET_TYPE_STREAM = 1,
ENET_SOCKET_TYPE_DATAGRAM = 2 ENET_SOCKET_TYPE_DATAGRAM = 2
} ENetSocketType; } ENetSocketType;
typedef enum typedef enum _ENetSocketWait
{ {
ENET_SOCKET_WAIT_NONE = 0, ENET_SOCKET_WAIT_NONE = 0,
ENET_SOCKET_WAIT_SEND = (1 << 0), ENET_SOCKET_WAIT_SEND = (1 << 0),
ENET_SOCKET_WAIT_RECEIVE = (1 << 1) ENET_SOCKET_WAIT_RECEIVE = (1 << 1)
} ENetSocketWait; } ENetSocketWait;
typedef enum typedef enum _ENetSocketOption
{ {
ENET_SOCKOPT_NONBLOCK = 1, ENET_SOCKOPT_NONBLOCK = 1,
ENET_SOCKOPT_BROADCAST = 2, ENET_SOCKOPT_BROADCAST = 2,
ENET_SOCKOPT_RCVBUF = 3, ENET_SOCKOPT_RCVBUF = 3,
ENET_SOCKOPT_SNDBUF = 4, ENET_SOCKOPT_SNDBUF = 4,
ENET_SOCKOPT_REUSEADDR = 5 ENET_SOCKOPT_REUSEADDR = 5
} ENetSocketOption; } ENetSocketOption;
enum enum
{ {
skipping to change at line 86 skipping to change at line 89
/** /**
* Packet flag bit constants. * Packet flag bit constants.
* *
* The host must be specified in network byte-order, and the port must be i n * The host must be specified in network byte-order, and the port must be i n
* host byte-order. The constant ENET_HOST_ANY may be used to specify the * host byte-order. The constant ENET_HOST_ANY may be used to specify the
* default server host. * default server host.
@sa ENetPacket @sa ENetPacket
*/ */
typedef enum typedef enum _ENetPacketFlag
{ {
/** packet must be received by the target peer and resend attempts shoul d be /** packet must be received by the target peer and resend attempts shoul d be
* made until the packet is delivered */ * made until the packet is delivered */
ENET_PACKET_FLAG_RELIABLE = (1 << 0), ENET_PACKET_FLAG_RELIABLE = (1 << 0),
/** packet will not be sequenced with other packets /** packet will not be sequenced with other packets
* not supported for reliable packets * not supported for reliable packets
*/ */
ENET_PACKET_FLAG_UNSEQUENCED = (1 << 1), ENET_PACKET_FLAG_UNSEQUENCED = (1 << 1),
/** packet will not allocate data, and user must supply it instead */ /** packet will not allocate data, and user must supply it instead */
ENET_PACKET_FLAG_NO_ALLOCATE = (1 << 2) ENET_PACKET_FLAG_NO_ALLOCATE = (1 << 2)
skipping to change at line 164 skipping to change at line 167
ENetListNode incomingCommandList; ENetListNode incomingCommandList;
enet_uint16 reliableSequenceNumber; enet_uint16 reliableSequenceNumber;
enet_uint16 unreliableSequenceNumber; enet_uint16 unreliableSequenceNumber;
ENetProtocol command; ENetProtocol command;
enet_uint32 fragmentCount; enet_uint32 fragmentCount;
enet_uint32 fragmentsRemaining; enet_uint32 fragmentsRemaining;
enet_uint32 * fragments; enet_uint32 * fragments;
ENetPacket * packet; ENetPacket * packet;
} ENetIncomingCommand; } ENetIncomingCommand;
typedef enum typedef enum _ENetPeerState
{ {
ENET_PEER_STATE_DISCONNECTED = 0, ENET_PEER_STATE_DISCONNECTED = 0,
ENET_PEER_STATE_CONNECTING = 1, ENET_PEER_STATE_CONNECTING = 1,
ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2, ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2,
ENET_PEER_STATE_CONNECTION_PENDING = 3, ENET_PEER_STATE_CONNECTION_PENDING = 3,
ENET_PEER_STATE_CONNECTION_SUCCEEDED = 4, ENET_PEER_STATE_CONNECTION_SUCCEEDED = 4,
ENET_PEER_STATE_CONNECTED = 5, ENET_PEER_STATE_CONNECTED = 5,
ENET_PEER_STATE_DISCONNECT_LATER = 6, ENET_PEER_STATE_DISCONNECT_LATER = 6,
ENET_PEER_STATE_DISCONNECTING = 7, ENET_PEER_STATE_DISCONNECTING = 7,
ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 8, ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 8,
skipping to change at line 229 skipping to change at line 232
ENetList incomingUnreliableCommands; ENetList incomingUnreliableCommands;
} ENetChannel; } ENetChannel;
/** /**
* An ENet peer which data packets may be sent or received from. * An ENet peer which data packets may be sent or received from.
* *
* No fields should be modified unless otherwise specified. * No fields should be modified unless otherwise specified.
*/ */
typedef struct _ENetPeer typedef struct _ENetPeer
{ {
ENetListNode dispatchList;
struct _ENetHost * host; struct _ENetHost * host;
enet_uint16 outgoingPeerID; enet_uint16 outgoingPeerID;
enet_uint16 incomingPeerID; enet_uint16 incomingPeerID;
enet_uint32 sessionID; enet_uint32 sessionID;
ENetAddress address; /**< Internet address of the peer */ ENetAddress address; /**< Internet address of the peer */
void * data; /**< Application private data, may be freely modified */ void * data; /**< Application private data, may be freely modified */
ENetPeerState state; ENetPeerState state;
ENetChannel * channels; ENetChannel * channels;
size_t channelCount; /**< Number of channels allocated for communication with peer */ size_t channelCount; /**< Number of channels allocated for communication with peer */
enet_uint32 incomingBandwidth; /**< Downstream bandwidth of the clien t in bytes/second */ enet_uint32 incomingBandwidth; /**< Downstream bandwidth of the clien t in bytes/second */
skipping to change at line 275 skipping to change at line 279
enet_uint32 roundTripTimeVariance; enet_uint32 roundTripTimeVariance;
enet_uint16 mtu; enet_uint16 mtu;
enet_uint32 windowSize; enet_uint32 windowSize;
enet_uint32 reliableDataInTransit; enet_uint32 reliableDataInTransit;
enet_uint16 outgoingReliableSequenceNumber; enet_uint16 outgoingReliableSequenceNumber;
ENetList acknowledgements; ENetList acknowledgements;
ENetList sentReliableCommands; ENetList sentReliableCommands;
ENetList sentUnreliableCommands; ENetList sentUnreliableCommands;
ENetList outgoingReliableCommands; ENetList outgoingReliableCommands;
ENetList outgoingUnreliableCommands; ENetList outgoingUnreliableCommands;
ENetList dispatchedCommands;
int needsDispatch;
enet_uint16 incomingUnsequencedGroup; enet_uint16 incomingUnsequencedGroup;
enet_uint16 outgoingUnsequencedGroup; enet_uint16 outgoingUnsequencedGroup;
enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32] ; enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32] ;
enet_uint32 disconnectData; enet_uint32 disconnectData;
} ENetPeer; } ENetPeer;
/** Callback that computes the checksum of the data held in buffers [0..buf
ferCount-1] */
typedef enet_uint32 (ENET_CALLBACK * ENetChecksumCallback) (const ENetBuffe
r * buffers, size_t bufferCount);
/** An ENet host for communicating with peers. /** An ENet host for communicating with peers.
* *
* No fields should be modified. * No fields should be modified.
@sa enet_host_create() @sa enet_host_create()
@sa enet_host_destroy() @sa enet_host_destroy()
@sa enet_host_connect() @sa enet_host_connect()
@sa enet_host_service() @sa enet_host_service()
@sa enet_host_flush() @sa enet_host_flush()
@sa enet_host_broadcast() @sa enet_host_broadcast()
@sa enet_host_checksum()
@sa enet_host_channel_limit()
@sa enet_host_bandwidth_limit() @sa enet_host_bandwidth_limit()
@sa enet_host_bandwidth_throttle() @sa enet_host_bandwidth_throttle()
*/ */
typedef struct _ENetHost typedef struct _ENetHost
{ {
ENetSocket socket; ENetSocket socket;
ENetAddress address; /**< Internet address of ENetAddress address; /**< Internet address
the host */ of the host */
enet_uint32 incomingBandwidth; /**< downstream bandwidt enet_uint32 incomingBandwidth; /**< downstream bandwi
h of the host */ dth of the host */
enet_uint32 outgoingBandwidth; /**< upstream bandwidth enet_uint32 outgoingBandwidth; /**< upstream bandwidt
of the host */ h of the host */
enet_uint32 bandwidthThrottleEpoch; enet_uint32 bandwidthThrottleEpoch;
enet_uint32 mtu; enet_uint32 mtu;
int recalculateBandwidthLimits; int recalculateBandwidthLimits;
ENetPeer * peers; /**< array of peers allo ENetPeer * peers; /**< array of peers al
cated for this host */ located for this host */
size_t peerCount; /**< number of peers all size_t peerCount; /**< number of peers a
ocated for this host */ llocated for this host */
enet_uint32 serviceTime; size_t channelLimit; /**< maximum number of
ENetPeer * lastServicedPeer; channels allowed for connected peers */
int continueSending; enet_uint32 serviceTime;
size_t packetSize; ENetList dispatchQueue;
enet_uint16 headerFlags; int continueSending;
ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS]; size_t packetSize;
size_t commandCount; enet_uint16 headerFlags;
ENetBuffer buffers [ENET_BUFFER_MAXIMUM]; ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS];
size_t bufferCount; size_t commandCount;
ENetAddress receivedAddress; ENetBuffer buffers [ENET_BUFFER_MAXIMUM];
enet_uint8 receivedData [ENET_PROTOCOL_MAXIMUM_MTU]; size_t bufferCount;
size_t receivedDataLength; ENetChecksumCallback checksum;
ENetAddress receivedAddress;
enet_uint8 receivedData [ENET_PROTOCOL_MAXIMUM_MTU];
size_t receivedDataLength;
enet_uint32 totalSentData; /**< total data sent,
user should reset to 0 as needed to prevent overflow */
enet_uint32 totalSentPackets; /**< total UDP packets
sent, user should reset to 0 as needed to prevent overflow */
enet_uint32 totalReceivedData; /**< total data receiv
ed, user should reset to 0 as needed to prevent overflow */
enet_uint32 totalReceivedPackets; /**< total UDP packets
received, user should reset to 0 as needed to prevent overflow */
} ENetHost; } ENetHost;
/** /**
* An ENet event type, as specified in @ref ENetEvent. * An ENet event type, as specified in @ref ENetEvent.
*/ */
typedef enum typedef enum _ENetEventType
{ {
/** no event occurred within the specified time limit */ /** no event occurred within the specified time limit */
ENET_EVENT_TYPE_NONE = 0, ENET_EVENT_TYPE_NONE = 0,
/** a connection request initiated by enet_host_connect has completed. /** a connection request initiated by enet_host_connect has completed.
* The peer field contains the peer which successfully connected. * The peer field contains the peer which successfully connected.
*/ */
ENET_EVENT_TYPE_CONNECT = 1, ENET_EVENT_TYPE_CONNECT = 1,
/** a peer has disconnected. This event is generated on a successful /** a peer has disconnected. This event is generated on a successful
skipping to change at line 376 skipping to change at line 393
*/ */
/** /**
Initializes ENet globally. Must be called prior to using any functions i n Initializes ENet globally. Must be called prior to using any functions i n
ENet. ENet.
@returns 0 on success, < 0 on failure @returns 0 on success, < 0 on failure
*/ */
ENET_API int enet_initialize (void); ENET_API int enet_initialize (void);
/** /**
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. 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 ou t so that any additional callbacks added in future versions will be properl y ignored.
@param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use
@param inits user-overriden callbacks where any NULL callbacks will use E Net's defaults @param inits user-overriden callbacks where any NULL callbacks will use E Net's defaults
@returns 0 on success, < 0 on failure @returns 0 on success, < 0 on failure
*/ */
ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENe tCallbacks * inits); ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENe tCallbacks * inits);
/** /**
Shuts down ENet globally. Should be called when a program that has Shuts down ENet globally. Should be called when a program that has
initialized ENet exits. initialized ENet exits.
skipping to change at line 468 skipping to change at line 485
ENET_API int enet_packet_resize (ENetPacket *, size_t); ENET_API int enet_packet_resize (ENetPacket *, size_t);
extern enet_uint32 enet_crc32 (const ENetBuffer *, size_t); extern enet_uint32 enet_crc32 (const ENetBuffer *, size_t);
ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, enet_uin t32, enet_uint32); ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, enet_uin t32, enet_uint32);
ENET_API void enet_host_destroy (ENetHost *); ENET_API void enet_host_destroy (ENetHost *);
ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, siz e_t); ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, siz e_t);
ENET_API int enet_host_check_events (ENetHost *, ENetEvent *); ENET_API int enet_host_check_events (ENetHost *, ENetEvent *);
ENET_API int enet_host_service (ENetHost *, ENetEvent *, enet_uint32 ); ENET_API int enet_host_service (ENetHost *, ENetEvent *, enet_uint32 );
ENET_API void enet_host_flush (ENetHost *); ENET_API void enet_host_flush (ENetHost *);
ENET_API void enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *); ENET_API void enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *);
ENET_API void enet_host_channel_limit (ENetHost *, size_t);
ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, ene t_uint32); ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, ene t_uint32);
extern void enet_host_bandwidth_throttle (ENetHost *); extern void enet_host_bandwidth_throttle (ENetHost *);
ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPa cket *); ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPa cket *);
ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8); ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8 * ch annelID);
ENET_API void enet_peer_ping (ENetPeer *); ENET_API void enet_peer_ping (ENetPeer *);
ENET_API void enet_peer_reset (ENetPeer *); ENET_API void enet_peer_reset (ENetPeer *);
ENET_API void enet_peer_disconnect (ENetPeer *, enet_uint32) ; ENET_API void enet_peer_disconnect (ENetPeer *, enet_uint32) ;
ENET_API void enet_peer_disconnect_now (ENetPeer *, enet_uin t32); ENET_API void enet_peer_disconnect_now (ENetPeer *, enet_uin t32);
ENET_API void enet_peer_disconnect_later (ENetPeer *, enet_u int32); ENET_API void enet_peer_disconnect_later (ENetPeer *, enet_u int32);
ENET_API void enet_peer_throttle_configure (ENetPeer *, enet _uint32, enet_uint32, enet_uint32); ENET_API void enet_peer_throttle_configure (ENetPeer *, enet _uint32, enet_uint32, enet_uint32);
extern int enet_peer_throttle (ENetPeer *, enet_uint32); extern int enet_peer_throttle (ENetPeer *, enet_uint32);
extern void enet_peer_reset_queues (ENetPeer *); extern void enet_peer_reset_queues (ENetPeer *);
extern void enet_peer_setup_outgoing_command (ENetPeer *, ENetOutgoingCommand *);
extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16); extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16);
extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32); extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32);
extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, c onst ENetProtocol *, enet_uint16); extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, c onst ENetProtocol *, enet_uint16);
extern void enet_peer_dispatch_incoming_unreliable_command
s (ENetPeer *, ENetChannel *);
extern void enet_peer_dispatch_incoming_reliable_commands
(ENetPeer *, ENetChannel *);
extern size_t enet_protocol_command_size (enet_uint8); extern size_t enet_protocol_command_size (enet_uint8);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __ENET_ENET_H__ */ #endif /* __ENET_ENET_H__ */
 End of changes. 17 change blocks. 
38 lines changed or deleted 70 lines changed or added


 list.h   list.h 
skipping to change at line 27 skipping to change at line 27
typedef struct _ENetList typedef struct _ENetList
{ {
ENetListNode sentinel; ENetListNode sentinel;
} ENetList; } ENetList;
extern void enet_list_clear (ENetList *); extern void enet_list_clear (ENetList *);
extern ENetListIterator enet_list_insert (ENetListIterator, void *); extern ENetListIterator enet_list_insert (ENetListIterator, void *);
extern void * enet_list_remove (ENetListIterator); extern void * enet_list_remove (ENetListIterator);
extern ENetListIterator enet_list_move (ENetListIterator, void *, void *);
extern size_t enet_list_size (ENetList *); extern size_t enet_list_size (ENetList *);
#define enet_list_begin(list) ((list) -> sentinel.next) #define enet_list_begin(list) ((list) -> sentinel.next)
#define enet_list_end(list) (& (list) -> sentinel) #define enet_list_end(list) (& (list) -> sentinel)
#define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (lis t)) #define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (lis t))
#define enet_list_next(iterator) ((iterator) -> next) #define enet_list_next(iterator) ((iterator) -> next)
#define enet_list_previous(iterator) ((iterator) -> previous) #define enet_list_previous(iterator) ((iterator) -> previous)
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 protocol.h   protocol.h 
skipping to change at line 22 skipping to change at line 22
ENET_PROTOCOL_MINIMUM_MTU = 576, ENET_PROTOCOL_MINIMUM_MTU = 576,
ENET_PROTOCOL_MAXIMUM_MTU = 4096, ENET_PROTOCOL_MAXIMUM_MTU = 4096,
ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32, ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32,
ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096, ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096,
ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 32768, ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 32768,
ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1, ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1,
ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255, ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255,
ENET_PROTOCOL_MAXIMUM_PEER_ID = 0x7FFF ENET_PROTOCOL_MAXIMUM_PEER_ID = 0x7FFF
}; };
typedef enum typedef enum _ENetProtocolCommand
{ {
ENET_PROTOCOL_COMMAND_NONE = 0, ENET_PROTOCOL_COMMAND_NONE = 0,
ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1, ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1,
ENET_PROTOCOL_COMMAND_CONNECT = 2, ENET_PROTOCOL_COMMAND_CONNECT = 2,
ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3, ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3,
ENET_PROTOCOL_COMMAND_DISCONNECT = 4, ENET_PROTOCOL_COMMAND_DISCONNECT = 4,
ENET_PROTOCOL_COMMAND_PING = 5, ENET_PROTOCOL_COMMAND_PING = 5,
ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6, ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6,
ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7, ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7,
ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8, ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8,
ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 9, ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 9,
ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 10, ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 10,
ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11, ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11,
ENET_PROTOCOL_COMMAND_COUNT = 12, ENET_PROTOCOL_COMMAND_COUNT = 12,
ENET_PROTOCOL_COMMAND_MASK = 0x0F ENET_PROTOCOL_COMMAND_MASK = 0x0F
} ENetProtocolCommand; } ENetProtocolCommand;
typedef enum typedef enum _ENetProtocolFlag
{ {
ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7), ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7),
ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6), ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6),
ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15), ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15),
ENET_PROTOCOL_HEADER_FLAG_MASK = 0x8000 ENET_PROTOCOL_HEADER_FLAG_MASK = 0x8000
} ENetProtocolFlag; } ENetProtocolFlag;
typedef struct #ifdef _MSC_VER_
#pragma pack(push, 1)
#define ENET_PACKED
#elif defined(__GNUC__)
#define ENET_PACKED __attribute__ ((packed))
#else
#define ENET_PACKED
#endif
typedef struct _ENetProtocolHeader
{ {
enet_uint32 checksum; enet_uint32 checksum;
enet_uint16 peerID; enet_uint16 peerID;
enet_uint16 sentTime; enet_uint16 sentTime;
} ENetProtocolHeader; } ENET_PACKED ENetProtocolHeader;
typedef struct typedef struct _ENetProtocolCommandHeader
{ {
enet_uint8 command; enet_uint8 command;
enet_uint8 channelID; enet_uint8 channelID;
enet_uint16 reliableSequenceNumber; enet_uint16 reliableSequenceNumber;
} ENetProtocolCommandHeader; } ENET_PACKED ENetProtocolCommandHeader;
typedef struct typedef struct _ENetProtocolAcknowledge
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
enet_uint16 receivedReliableSequenceNumber; enet_uint16 receivedReliableSequenceNumber;
enet_uint16 receivedSentTime; enet_uint16 receivedSentTime;
} ENetProtocolAcknowledge; } ENET_PACKED ENetProtocolAcknowledge;
typedef struct typedef struct _ENetProtocolConnect
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
enet_uint16 outgoingPeerID; enet_uint16 outgoingPeerID;
enet_uint16 mtu; enet_uint16 mtu;
enet_uint32 windowSize; enet_uint32 windowSize;
enet_uint32 channelCount; enet_uint32 channelCount;
enet_uint32 incomingBandwidth; enet_uint32 incomingBandwidth;
enet_uint32 outgoingBandwidth; enet_uint32 outgoingBandwidth;
enet_uint32 packetThrottleInterval; enet_uint32 packetThrottleInterval;
enet_uint32 packetThrottleAcceleration; enet_uint32 packetThrottleAcceleration;
enet_uint32 packetThrottleDeceleration; enet_uint32 packetThrottleDeceleration;
enet_uint32 sessionID; enet_uint32 sessionID;
} ENetProtocolConnect; } ENET_PACKED ENetProtocolConnect;
typedef struct typedef struct _ENetProtocolVerifyConnect
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
enet_uint16 outgoingPeerID; enet_uint16 outgoingPeerID;
enet_uint16 mtu; enet_uint16 mtu;
enet_uint32 windowSize; enet_uint32 windowSize;
enet_uint32 channelCount; enet_uint32 channelCount;
enet_uint32 incomingBandwidth; enet_uint32 incomingBandwidth;
enet_uint32 outgoingBandwidth; enet_uint32 outgoingBandwidth;
enet_uint32 packetThrottleInterval; enet_uint32 packetThrottleInterval;
enet_uint32 packetThrottleAcceleration; enet_uint32 packetThrottleAcceleration;
enet_uint32 packetThrottleDeceleration; enet_uint32 packetThrottleDeceleration;
} ENetProtocolVerifyConnect; } ENET_PACKED ENetProtocolVerifyConnect;
typedef struct typedef struct _ENetProtocolBandwidthLimit
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
enet_uint32 incomingBandwidth; enet_uint32 incomingBandwidth;
enet_uint32 outgoingBandwidth; enet_uint32 outgoingBandwidth;
} ENetProtocolBandwidthLimit; } ENET_PACKED ENetProtocolBandwidthLimit;
typedef struct typedef struct _ENetProtocolThrottleConfigure
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
enet_uint32 packetThrottleInterval; enet_uint32 packetThrottleInterval;
enet_uint32 packetThrottleAcceleration; enet_uint32 packetThrottleAcceleration;
enet_uint32 packetThrottleDeceleration; enet_uint32 packetThrottleDeceleration;
} ENetProtocolThrottleConfigure; } ENET_PACKED ENetProtocolThrottleConfigure;
typedef struct typedef struct _ENetProtocolDisconnect
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
enet_uint32 data; enet_uint32 data;
} ENetProtocolDisconnect; } ENET_PACKED ENetProtocolDisconnect;
typedef struct typedef struct _ENetProtocolPing
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
} ENetProtocolPing; } ENET_PACKED ENetProtocolPing;
typedef struct typedef struct _ENetProtocolSendReliable
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
enet_uint16 dataLength; enet_uint16 dataLength;
} ENetProtocolSendReliable; } ENET_PACKED ENetProtocolSendReliable;
typedef struct typedef struct _ENetProtocolSendUnreliable
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
enet_uint16 unreliableSequenceNumber; enet_uint16 unreliableSequenceNumber;
enet_uint16 dataLength; enet_uint16 dataLength;
} ENetProtocolSendUnreliable; } ENET_PACKED ENetProtocolSendUnreliable;
typedef struct typedef struct _ENetProtocolSendUnsequenced
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
enet_uint16 unsequencedGroup; enet_uint16 unsequencedGroup;
enet_uint16 dataLength; enet_uint16 dataLength;
} ENetProtocolSendUnsequenced; } ENET_PACKED ENetProtocolSendUnsequenced;
typedef struct typedef struct _ENetProtocolSendFragment
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
enet_uint16 startSequenceNumber; enet_uint16 startSequenceNumber;
enet_uint16 dataLength; enet_uint16 dataLength;
enet_uint32 fragmentCount; enet_uint32 fragmentCount;
enet_uint32 fragmentNumber; enet_uint32 fragmentNumber;
enet_uint32 totalLength; enet_uint32 totalLength;
enet_uint32 fragmentOffset; enet_uint32 fragmentOffset;
} ENetProtocolSendFragment; } ENET_PACKED ENetProtocolSendFragment;
typedef union typedef union _ENetProtocol
{ {
ENetProtocolCommandHeader header; ENetProtocolCommandHeader header;
ENetProtocolAcknowledge acknowledge; ENetProtocolAcknowledge acknowledge;
ENetProtocolConnect connect; ENetProtocolConnect connect;
ENetProtocolVerifyConnect verifyConnect; ENetProtocolVerifyConnect verifyConnect;
ENetProtocolDisconnect disconnect; ENetProtocolDisconnect disconnect;
ENetProtocolPing ping; ENetProtocolPing ping;
ENetProtocolSendReliable sendReliable; ENetProtocolSendReliable sendReliable;
ENetProtocolSendUnreliable sendUnreliable; ENetProtocolSendUnreliable sendUnreliable;
ENetProtocolSendUnsequenced sendUnsequenced; ENetProtocolSendUnsequenced sendUnsequenced;
ENetProtocolSendFragment sendFragment; ENetProtocolSendFragment sendFragment;
ENetProtocolBandwidthLimit bandwidthLimit; ENetProtocolBandwidthLimit bandwidthLimit;
ENetProtocolThrottleConfigure throttleConfigure; ENetProtocolThrottleConfigure throttleConfigure;
} ENetProtocol; } ENET_PACKED ENetProtocol;
#ifdef _MSC_VER_
#pragma pack(pop)
#endif
#endif /* __ENET_PROTOCOL_H__ */ #endif /* __ENET_PROTOCOL_H__ */
 End of changes. 30 change blocks. 
30 lines changed or deleted 43 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/