| enet.h | | enet.h | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| #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" | |
| | | | |
| #define ENET_VERSION_MAJOR 1 | | #define ENET_VERSION_MAJOR 1 | |
| #define ENET_VERSION_MINOR 3 | | #define ENET_VERSION_MINOR 3 | |
|
| #define ENET_VERSION_PATCH 11 | | #define ENET_VERSION_PATCH 12 | |
| #define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<
<8) | (patch)) | | #define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<
<8) | (patch)) | |
| #define ENET_VERSION_GET_MAJOR(version) (((version)>>16)&0xFF) | | #define ENET_VERSION_GET_MAJOR(version) (((version)>>16)&0xFF) | |
| #define ENET_VERSION_GET_MINOR(version) (((version)>>8)&0xFF) | | #define ENET_VERSION_GET_MINOR(version) (((version)>>8)&0xFF) | |
| #define ENET_VERSION_GET_PATCH(version) ((version)&0xFF) | | #define ENET_VERSION_GET_PATCH(version) ((version)&0xFF) | |
| #define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_M
INOR, ENET_VERSION_PATCH) | | #define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_M
INOR, ENET_VERSION_PATCH) | |
| | | | |
| typedef enet_uint32 ENetVersion; | | typedef enet_uint32 ENetVersion; | |
| | | | |
| struct _ENetHost; | | struct _ENetHost; | |
| struct _ENetEvent; | | struct _ENetEvent; | |
| | | | |
| skipping to change at line 212 | | skipping to change at line 212 | |
| #ifndef ENET_BUFFER_MAXIMUM | | #ifndef ENET_BUFFER_MAXIMUM | |
| #define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS) | | #define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS) | |
| #endif | | #endif | |
| | | | |
| enum | | enum | |
| { | | { | |
| ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024, | | ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024, | |
| ENET_HOST_SEND_BUFFER_SIZE = 256 * 1024, | | ENET_HOST_SEND_BUFFER_SIZE = 256 * 1024, | |
| ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000, | | ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000, | |
| ENET_HOST_DEFAULT_MTU = 1400, | | ENET_HOST_DEFAULT_MTU = 1400, | |
|
| | | ENET_HOST_DEFAULT_MAXIMUM_PACKET_SIZE = 32 * 1024 * 1024, | |
| | | ENET_HOST_DEFAULT_MAXIMUM_WAITING_DATA = 32 * 1024 * 1024, | |
| | | | |
| ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 500, | | ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 500, | |
| ENET_PEER_DEFAULT_PACKET_THROTTLE = 32, | | ENET_PEER_DEFAULT_PACKET_THROTTLE = 32, | |
| ENET_PEER_PACKET_THROTTLE_SCALE = 32, | | ENET_PEER_PACKET_THROTTLE_SCALE = 32, | |
| ENET_PEER_PACKET_THROTTLE_COUNTER = 7, | | ENET_PEER_PACKET_THROTTLE_COUNTER = 7, | |
| ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2, | | ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2, | |
| ENET_PEER_PACKET_THROTTLE_DECELERATION = 2, | | ENET_PEER_PACKET_THROTTLE_DECELERATION = 2, | |
| ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000, | | ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000, | |
| ENET_PEER_PACKET_LOSS_SCALE = (1 << 16), | | ENET_PEER_PACKET_LOSS_SCALE = (1 << 16), | |
| ENET_PEER_PACKET_LOSS_INTERVAL = 10000, | | ENET_PEER_PACKET_LOSS_INTERVAL = 10000, | |
| | | | |
| skipping to change at line 313 | | skipping to change at line 315 | |
| ENetList sentReliableCommands; | | ENetList sentReliableCommands; | |
| ENetList sentUnreliableCommands; | | ENetList sentUnreliableCommands; | |
| ENetList outgoingReliableCommands; | | ENetList outgoingReliableCommands; | |
| ENetList outgoingUnreliableCommands; | | ENetList outgoingUnreliableCommands; | |
| ENetList dispatchedCommands; | | ENetList dispatchedCommands; | |
| int needsDispatch; | | 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 eventData; | | enet_uint32 eventData; | |
|
| | | size_t totalWaitingData; | |
| } ENetPeer; | | } ENetPeer; | |
| | | | |
| /** An ENet packet compressor for compressing UDP packets before socket sen
ds or receives. | | /** An ENet packet compressor for compressing UDP packets before socket sen
ds or receives. | |
| */ | | */ | |
| typedef struct _ENetCompressor | | typedef struct _ENetCompressor | |
| { | | { | |
| /** Context data for the compressor. Must be non-NULL. */ | | /** Context data for the compressor. Must be non-NULL. */ | |
| void * context; | | void * context; | |
| /** Compresses from inBuffers[0:inBufferCount-1], containing inLimit byt
es, to outData, outputting at most outLimit bytes. Should return 0 on failu
re. */ | | /** Compresses from inBuffers[0:inBufferCount-1], containing inLimit byt
es, to outData, outputting at most outLimit bytes. Should return 0 on failu
re. */ | |
| size_t (ENET_CALLBACK * compress) (void * context, const ENetBuffer * in
Buffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t
outLimit); | | size_t (ENET_CALLBACK * compress) (void * context, const ENetBuffer * in
Buffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t
outLimit); | |
| | | | |
| skipping to change at line 387 | | skipping to change at line 390 | |
| enet_uint8 * receivedData; | | enet_uint8 * receivedData; | |
| size_t receivedDataLength; | | size_t receivedDataLength; | |
| enet_uint32 totalSentData; /**< total data sent,
user should reset to 0 as needed to prevent overflow */ | | 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 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 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 */ | | enet_uint32 totalReceivedPackets; /**< total UDP packets
received, user should reset to 0 as needed to prevent overflow */ | |
| ENetInterceptCallback intercept; /**< callback the user
can set to intercept received raw UDP packets */ | | ENetInterceptCallback intercept; /**< callback the user
can set to intercept received raw UDP packets */ | |
| size_t connectedPeers; | | size_t connectedPeers; | |
| size_t bandwidthLimitedPeers; | | size_t bandwidthLimitedPeers; | |
| size_t duplicatePeers; /**< optional number o
f allowed peers from duplicate IPs, defaults to ENET_PROTOCOL_MAXIMUM_PEER_
ID */ | | size_t duplicatePeers; /**< optional number o
f allowed peers from duplicate IPs, defaults to ENET_PROTOCOL_MAXIMUM_PEER_
ID */ | |
|
| | | size_t maximumPacketSize; /**< the maximum allow | |
| | | able packet size that may be sent or received on a peer */ | |
| | | size_t maximumWaitingData; /**< the maximum aggre | |
| | | gate amount of buffer space a peer may use waiting for packets to be delive | |
| | | red */ | |
| } ENetHost; | | } ENetHost; | |
| | | | |
| /** | | /** | |
| * An ENet event type, as specified in @ref ENetEvent. | | * An ENet event type, as specified in @ref ENetEvent. | |
| */ | | */ | |
| typedef enum _ENetEventType | | 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, | |
| | | | |
| | | | |
| skipping to change at line 449 | | skipping to change at line 454 | |
| 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. Make sure the ENetCallbacks structure is zeroed ou
t so that any additional callbacks added in future versions will be properl
y ignored. | | 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-overridden callbacks where any NULL callbacks will use
ENet'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. | |
| */ | | */ | |
| ENET_API void enet_deinitialize (void); | | ENET_API void enet_deinitialize (void); | |
| | | | |
| | | | |
| skipping to change at line 513 | | skipping to change at line 518 | |
| /** Attempts to resolve the host named by the parameter hostName and sets | | /** Attempts to resolve the host named by the parameter hostName and sets | |
| the host field in the address parameter if successful. | | the host field in the address parameter if successful. | |
| @param address destination to store resolved address | | @param address destination to store resolved address | |
| @param hostName host name to lookup | | @param hostName host name to lookup | |
| @retval 0 on success | | @retval 0 on success | |
| @retval < 0 on failure | | @retval < 0 on failure | |
| @returns the address of the given hostName in address on success | | @returns the address of the given hostName in address on success | |
| */ | | */ | |
| ENET_API int enet_address_set_host (ENetAddress * address, const char * hos
tName); | | ENET_API int enet_address_set_host (ENetAddress * address, const char * hos
tName); | |
| | | | |
|
| /** Gives the printable form of the ip address specified in the address par
ameter. | | /** Gives the printable form of the IP address specified in the address par
ameter. | |
| @param address address printed | | @param address address printed | |
| @param hostName destination for name, must not be NULL | | @param hostName destination for name, must not be NULL | |
| @param nameLength maximum length of hostName. | | @param nameLength maximum length of hostName. | |
| @returns the null-terminated name of the host in hostName on success | | @returns the null-terminated name of the host in hostName on success | |
| @retval 0 on success | | @retval 0 on success | |
| @retval < 0 on failure | | @retval < 0 on failure | |
| */ | | */ | |
| ENET_API int enet_address_get_host_ip (const ENetAddress * address, char *
hostName, size_t nameLength); | | ENET_API int enet_address_get_host_ip (const ENetAddress * address, char *
hostName, size_t nameLength); | |
| | | | |
| /** Attempts to do a reverse lookup of the host field in the address parame
ter. | | /** Attempts to do a reverse lookup of the host field in the address parame
ter. | |
| | | | |
| skipping to change at line 568 | | skipping to change at line 573 | |
| ENET_API void enet_peer_timeout (ENetPeer *, enet_uint32, en
et_uint32, enet_uint32); | | ENET_API void enet_peer_timeout (ENetPeer *, enet_uint32, en
et_uint32, enet_uint32); | |
| 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 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 *, const void *, size_t, enet_uint32, 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_unreliable_command
s (ENetPeer *, ENetChannel *); | |
| extern void enet_peer_dispatch_incoming_reliable_commands
(ENetPeer *, ENetChannel *); | | extern void enet_peer_dispatch_incoming_reliable_commands
(ENetPeer *, ENetChannel *); | |
| extern void enet_peer_on_connect (ENetPeer *); | | extern void enet_peer_on_connect (ENetPeer *); | |
| extern void enet_peer_on_disconnect (ENetPeer *); | | extern void enet_peer_on_disconnect (ENetPeer *); | |
| | | | |
| ENET_API void * enet_range_coder_create (void); | | ENET_API void * enet_range_coder_create (void); | |
| ENET_API void enet_range_coder_destroy (void *); | | ENET_API void enet_range_coder_destroy (void *); | |
| ENET_API size_t enet_range_coder_compress (void *, const ENetBuffer *, size
_t, size_t, enet_uint8 *, size_t); | | ENET_API size_t enet_range_coder_compress (void *, const ENetBuffer *, size
_t, size_t, enet_uint8 *, size_t); | |
| ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, si
ze_t, enet_uint8 *, size_t); | | ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, si
ze_t, enet_uint8 *, size_t); | |
| | | | |
End of changes. 7 change blocks. |
| 4 lines changed or deleted | | 12 lines changed or added | |
|