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 5 | #define ENET_VERSION_PATCH 6 | |||
#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 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 _ENetEvent; | ||||
struct _ENetPacket; | ||||
typedef enum _ENetSocketType | 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 _ENetSocketWait | 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), | |||
skipping to change at line 58 | skipping to change at line 62 | |||
{ | { | |||
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, | |||
ENET_SOCKOPT_RCVTIMEO = 6, | ENET_SOCKOPT_RCVTIMEO = 6, | |||
ENET_SOCKOPT_SNDTIMEO = 7 | ENET_SOCKOPT_SNDTIMEO = 7 | |||
} ENetSocketOption; | } ENetSocketOption; | |||
typedef enum _ENetSocketShutdown | ||||
{ | ||||
ENET_SOCKET_SHUTDOWN_READ = 0, | ||||
ENET_SOCKET_SHUTDOWN_WRITE = 1, | ||||
ENET_SOCKET_SHUTDOWN_READ_WRITE = 2 | ||||
} ENetSocketShutdown; | ||||
enum | enum | |||
{ | { | |||
ENET_HOST_ANY = 0, /**< specifies the default server ho st */ | ENET_HOST_ANY = 0, /**< specifies the default server ho st */ | |||
ENET_HOST_BROADCAST = 0xFFFFFFFF, /**< specifies a subnet-wide broadca st */ | ENET_HOST_BROADCAST = 0xFFFFFFFF, /**< specifies a subnet-wide broadca st */ | |||
ENET_PORT_ANY = 0 /**< specifies that a port should be automatically chosen */ | ENET_PORT_ANY = 0 /**< specifies that a port should be automatically chosen */ | |||
}; | }; | |||
/** | /** | |||
* Portable internet address structure. | * Portable internet address structure. | |||
skipping to change at line 107 | skipping to change at line 118 | |||
* 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), | |||
/** packet will be fragmented using unreliable (instead of reliable) sen ds | /** packet will be fragmented using unreliable (instead of reliable) sen ds | |||
* if it exceeds the MTU */ | * if it exceeds the MTU */ | |||
ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT = (1 << 3) | ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT = (1 << 3) | |||
} ENetPacketFlag; | } ENetPacketFlag; | |||
struct _ENetPacket; | ||||
typedef void (ENET_CALLBACK * ENetPacketFreeCallback) (struct _ENetPacket * ); | typedef void (ENET_CALLBACK * ENetPacketFreeCallback) (struct _ENetPacket * ); | |||
/** | /** | |||
* ENet packet structure. | * ENet packet structure. | |||
* | * | |||
* An ENet data packet that may be sent to or received from a peer. The sho wn | * An ENet data packet that may be sent to or received from a peer. The sho wn | |||
* fields should only be read and never modified. The data field contains t he | * fields should only be read and never modified. The data field contains t he | |||
* allocated data for the packet. The dataLength fields specifies the lengt h | * allocated data for the packet. The dataLength fields specifies the lengt h | |||
* of the allocated data. The flags field is either 0 (specifying no flags ), | * of the allocated data. The flags field is either 0 (specifying no flags ), | |||
* or a bitwise-or of any combination of the following flags: | * or a bitwise-or of any combination of the following flags: | |||
skipping to change at line 316 | skipping to change at line 326 | |||
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); | |||
/** Decompresses from inData, containing inLimit bytes, to outData, outp utting at most outLimit bytes. Should return 0 on failure. */ | /** Decompresses from inData, containing inLimit bytes, to outData, outp utting at most outLimit bytes. Should return 0 on failure. */ | |||
size_t (ENET_CALLBACK * decompress) (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit); | size_t (ENET_CALLBACK * decompress) (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit); | |||
/** Destroys the context when compression is disabled or the host is des troyed. May be NULL. */ | /** Destroys the context when compression is disabled or the host is des troyed. May be NULL. */ | |||
void (ENET_CALLBACK * destroy) (void * context); | void (ENET_CALLBACK * destroy) (void * context); | |||
} ENetCompressor; | } ENetCompressor; | |||
/** Callback that computes the checksum of the data held in buffers[0:buffe rCount-1] */ | /** Callback that computes the checksum of the data held in buffers[0:buffe rCount-1] */ | |||
typedef enet_uint32 (ENET_CALLBACK * ENetChecksumCallback) (const ENetBuffe r * buffers, size_t bufferCount); | typedef enet_uint32 (ENET_CALLBACK * ENetChecksumCallback) (const ENetBuffe r * buffers, size_t bufferCount); | |||
/** Callback for intercepting received raw UDP packets. Should return 1 to | ||||
intercept, 0 to ignore, or -1 to propagate an error. */ | ||||
typedef int (ENET_CALLBACK * ENetInterceptCallback) (struct _ENetHost * hos | ||||
t, struct _ENetEvent * event); | ||||
/** An ENet host for communicating with peers. | /** An ENet host for communicating with peers. | |||
* | * | |||
* No fields should be modified unless otherwise stated. | * No fields should be modified unless otherwise stated. | |||
@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() | |||
skipping to change at line 364 | skipping to change at line 377 | |||
ENetChecksumCallback checksum; /**< callback the user can set to enable packet checksums for this host */ | ENetChecksumCallback checksum; /**< callback the user can set to enable packet checksums for this host */ | |||
ENetCompressor compressor; | ENetCompressor compressor; | |||
enet_uint8 packetData [2][ENET_PROTOCOL_MAXIMUM_MTU]; | enet_uint8 packetData [2][ENET_PROTOCOL_MAXIMUM_MTU]; | |||
ENetAddress receivedAddress; | ENetAddress receivedAddress; | |||
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 */ | ||||
} 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 463 | skipping to change at line 477 | |||
*/ | */ | |||
ENET_API ENetSocket enet_socket_create (ENetSocketType); | ENET_API ENetSocket enet_socket_create (ENetSocketType); | |||
ENET_API int enet_socket_bind (ENetSocket, const ENetAddress *); | ENET_API int enet_socket_bind (ENetSocket, const ENetAddress *); | |||
ENET_API int enet_socket_listen (ENetSocket, int); | ENET_API int enet_socket_listen (ENetSocket, int); | |||
ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *); | ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *); | |||
ENET_API int enet_socket_connect (ENetSocket, const ENetAddress *); | ENET_API int enet_socket_connect (ENetSocket, const ENetAddress *); | |||
ENET_API int enet_socket_send (ENetSocket, const ENetAddress *, cons t ENetBuffer *, size_t); | ENET_API int enet_socket_send (ENetSocket, const ENetAddress *, cons t ENetBuffer *, size_t); | |||
ENET_API int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuf fer *, size_t); | ENET_API int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuf fer *, size_t); | |||
ENET_API int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint3 2); | ENET_API int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint3 2); | |||
ENET_API int enet_socket_set_option (ENetSocket, ENetSocketOption, i nt); | ENET_API int enet_socket_set_option (ENetSocket, ENetSocketOption, i nt); | |||
ENET_API int enet_socket_shutdown (ENetSocket, ENetSocketShutdown); | ||||
ENET_API void enet_socket_destroy (ENetSocket); | ENET_API void enet_socket_destroy (ENetSocket); | |||
ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENe tSocketSet *, enet_uint32); | ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENe tSocketSet *, enet_uint32); | |||
/** @} */ | /** @} */ | |||
/** @defgroup Address ENet address functions | /** @defgroup Address ENet address functions | |||
@{ | @{ | |||
*/ | */ | |||
/** 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. | |||
End of changes. 7 change blocks. | ||||
2 lines changed or deleted | 19 lines changed or added | |||