5 #ifndef __ENET_ENET_H__     6 #define __ENET_ENET_H__    26 #define ENET_VERSION_MAJOR 1    27 #define ENET_VERSION_MINOR 3    28 #define ENET_VERSION_PATCH 1    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)    61 #define ENET_HOST_ANY_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }                             62 static const ENetHostAddress ENET_HOST_ANY = ENET_HOST_ANY_INIT;                               63 #define ENET_IPV4MAPPED_PREFIX_INIT { { 0,0,0,0,0,0,0,0,0,0,0xff,0xff,0,0,0,0 } }              64 static const ENetHostAddress ENET_IPV4MAPPED_PREFIX = ENET_IPV4MAPPED_PREFIX_INIT;             65 #define ENET_HOST_BROADCAST_INIT { { 0,0,0,0,0,0,0,0,0,0,0xff,0xff,0xff,0xff,0xff,0xff } }     66 static const ENetHostAddress ENET_HOST_BROADCAST = ENET_HOST_BROADCAST_INIT;                  204 #ifndef ENET_BUFFER_MAXIMUM   205 #define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS) ENET_API void enet_host_flush(ENetHost *)
Sends any queued packets on the host specified to its designated peers. 
Definition: protocol.c:1575
 
enet_uint32 windowSize
Definition: enet.h:296
 
Portable internet address structure. 
Definition: enet.h:82
 
enet_uint32 lastSendTime
Definition: enet.h:273
 
ENetList sentReliableCommands
Definition: enet.h:300
 
type definitions for ENet 
 
ENET_API void enet_socket_destroy(ENetSocket)
Definition: unix.c:299
 
int enet_peer_throttle(ENetPeer *, enet_uint32)
Definition: peer.c:62
 
Definition: callbacks.h:10
 
_ENetSocketType
Definition: enet.h:34
 
ENetList outgoingReliableCommands
Definition: enet.h:302
 
_ENetSocketWait
Definition: enet.h:40
 
ENetPeer * peers
array of peers allocated for this host 
Definition: enet.h:356
 
ENET_API int enet_socket_bind(ENetSocket, const ENetAddress *, ENetAddressFamily)
Definition: unix.c:192
 
enet_uint16 reliableSequenceNumber
Definition: enet.h:166
 
enet_uint32 packetLossVariance
Definition: enet.h:281
 
ENET_API int enet_socket_set_option(ENetSocket, ENetSocketOption, int)
Definition: unix.c:232
 
static void version(void)
Definition: tolua.c:58
 
size_t peerCount
number of peers allocated for this host 
Definition: enet.h:357
 
enet_uint32 totalSentData
total data sent, user should reset to 0 as needed to prevent overflow 
Definition: enet.h:374
 
enet_uint32 outgoingBandwidth
upstream bandwidth of the host 
Definition: enet.h:351
 
ENET_API enet_uint32 enet_time_get(void)
Returns the wall-time in milliseconds. 
Definition: unix.c:55
 
enet_uint32 lowestRoundTripTime
Definition: enet.h:290
 
ENetCompressor compressor
Definition: enet.h:369
 
enet_uint16 port
Definition: enet.h:90
 
ENET_API int enet_host_check_events(ENetHost *, ENetEvent *)
Checks for any queued events on the host and dispatches one if available. 
Definition: protocol.c:1592
 
size_t referenceCount
internal use only 
Definition: enet.h:149
 
ENetList dispatchedCommands
Definition: enet.h:304
 
ENET_API int enet_host_compress_with_range_coder(ENetHost *host)
Sets the packet compressor the host should use to the default range coder. 
Definition: compress.c:638
 
ENetHostAddress host
Definition: enet.h:84
 
enet_uint32 packetThrottleLimit
Definition: enet.h:283
 
size_t enet_protocol_command_size(enet_uint8)
Definition: protocol.c:45
 
ENET_API int enet_socket_send(ENetSocket, const ENetAddress *, const ENetBuffer *, size_t, ENetAddressFamily)
Definition: unix.c:305
 
ENET_API size_t enet_range_coder_compress(void *, const ENetBuffer *, size_t, size_t, enet_uint8 *, size_t)
Definition: compress.c:247
 
ENetListNode acknowledgementList
Definition: enet.h:158
 
ENetSocket socket6
Definition: enet.h:348
 
ENetPacket * packet
Definition: enet.h:175
 
enet_uint16 reliableSequenceNumber
Definition: enet.h:181
 
enet_uint16 outgoingReliableSequenceNumber
Definition: enet.h:298
 
packet must be received by the target peer and resend attempts should be made until the packet is del...
Definition: enet.h:116
 
enet_uint32 totalReceivedPackets
total UDP packets received, user should reset to 0 as needed to prevent overflow 
Definition: enet.h:377
 
size_t packetSize
Definition: enet.h:362
 
enet_uint8 outgoingSessionID
Definition: enet.h:260
 
ENetList outgoingUnreliableCommands
Definition: enet.h:303
 
enet_uint32 connectID
Definition: enet.h:259
 
ENetIncomingCommand * enet_peer_queue_incoming_command(ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32)
Definition: peer.c:656
 
_ENetSocketOption
Definition: enet.h:47
 
enum _ENetSocketOption ENetSocketOption
 
_ENetPeerState
Definition: enet.h:190
 
enet_uint32 packetThrottle
Definition: enet.h:282
 
ENET_API void enet_peer_disconnect_later(ENetPeer *, enet_uint32)
Request a disconnection from a peer, but only after all queued outgoing packets are sent...
Definition: peer.c:474
 
specifies the length of the IPv4-mapped IPv6 prefix 
Definition: enet.h:68
 
unsigned int enet_uint32
unsigned 32-bit type 
Definition: types.h:10
 
enet_uint32 roundTripTimeout
Definition: enet.h:169
 
ENET_API ENetPeer * enet_host_connect(ENetHost *, const ENetAddress *, size_t, enet_uint32)
Initiates a connection to a foreign host. 
Definition: host.c:191
 
enet_uint32 packetLoss
mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SC...
Definition: enet.h:280
 
specifies that a port should be automatically chosen 
Definition: enet.h:69
 
packet will not be sequenced with other packets not supported for reliable packets ...
Definition: enet.h:120
 
enet_uint32 reliableDataInTransit
Definition: enet.h:297
 
enet_uint32 roundTripTimeoutLimit
Definition: enet.h:170
 
a packet has been received from a peer. 
Definition: enet.h:408
 
#define ENET_API
Definition: unix.h:35
 
ENET_API void enet_peer_ping(ENetPeer *)
Sends a ping request to a peer. 
Definition: peer.c:383
 
ENET_API void enet_host_destroy(ENetHost *)
Destroys the host and all resources associated with it. 
Definition: host.c:158
 
enum _ENetSocketType ENetSocketType
 
Definition: protocol.h:13
 
enet_uint32 incomingDataTotal
Definition: enet.h:271
 
enet_uint32 totalSentPackets
total UDP packets sent, user should reset to 0 as needed to prevent overflow 
Definition: enet.h:375
 
struct _ENetPacket ENetPacket
ENet packet structure. 
 
enet_uint32 roundTripTimeVariance
Definition: enet.h:294
 
An ENet host for communicating with peers. 
Definition: enet.h:345
 
ENetAddress address
Internet address of the peer. 
Definition: enet.h:262
 
enet_uint16 fragmentLength
Definition: enet.h:172
 
ENetAcknowledgement * enet_peer_queue_acknowledgement(ENetPeer *, const ENetProtocol *, enet_uint16)
Definition: peer.c:489
 
enet_uint16 incomingReliableSequenceNumber
Definition: enet.h:243
 
ENetPeer * peer
peer that generated a connect, disconnect or receive event 
Definition: enet.h:419
 
ENetAddress receivedAddress
Definition: enet.h:371
 
enet_uint8 channelID
channel on the peer that generated the event, if appropriate 
Definition: enet.h:420
 
ENetListNode dispatchList
Definition: enet.h:255
 
struct _ENetChannel ENetChannel
 
ENET_API int enet_host_service(ENetHost *, ENetEvent *, enet_uint32)
Waits for events on the host specified and shuttles packets between the host and its peers...
Definition: protocol.c:1617
 
enet_uint32 serviceTime
Definition: enet.h:359
 
struct _ENetIncomingCommand ENetIncomingCommand
 
ENET_API ENetSocket enet_socket_accept(ENetSocket, ENetAddress *, ENetAddressFamily)
Definition: unix.c:277
 
enet_uint32 mtu
Definition: enet.h:353
 
enet_uint32 sentTime
Definition: enet.h:159
 
int ENetSocket
Definition: unix.h:14
 
enet_uint32 fragmentsRemaining
Definition: enet.h:185
 
typedef void(ENET_CALLBACK *ENetPacketFreeCallback)(struct _ENetPacket *)
 
enum _ENetPeerState ENetPeerState
 
struct _ENetHost * host
Definition: enet.h:256
 
ENetPacket * packet
packet associated with the event, if appropriate 
Definition: enet.h:422
 
ENET_API ENetPacket * enet_peer_receive(ENetPeer *, enet_uint8 *channelID)
Attempts to dequeue any incoming queued packet. 
Definition: peer.c:213
 
void * context
Context data for the compressor. 
Definition: enet.h:317
 
ENET_API int enet_socket_receive(ENetSocket, ENetAddress *, ENetBuffer *, size_t, ENetAddressFamily)
Definition: unix.c:341
 
ENET_API void enet_packet_destroy(ENetPacket *)
Destroys the packet and deallocates its data. 
Definition: packet.c:53
 
enet_uint32 packetThrottleCounter
Definition: enet.h:284
 
packet will not allocate data, and user must supply it instead 
Definition: enet.h:122
 
ENetProtocol command
Definition: enet.h:174
 
ENetOutgoingCommand * enet_peer_queue_outgoing_command(ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16)
Definition: peer.c:572
 
void enet_peer_dispatch_incoming_reliable_commands(ENetPeer *, ENetChannel *)
Definition: peer.c:620
 
ENET_API void enet_host_broadcast(ENetHost *, enet_uint8, ENetPacket *)
Queues a packet to be sent to all peers associated with the host. 
Definition: host.c:277
 
ENetList acknowledgements
Definition: enet.h:299
 
enum _ENetEventType ENetEventType
An ENet event type, as specified in ENetEvent. 
 
ENET_API void enet_peer_disconnect(ENetPeer *, enet_uint32)
Request a disconnection from a peer. 
Definition: peer.c:435
 
enet_uint32 lastRoundTripTime
Definition: enet.h:289
 
ENET_API int enet_address_set_host(ENetAddress *address, const char *hostName)
Attempts to resolve the host named by the parameter hostName and sets the host field in the address p...
Definition: unix.c:140
 
enum _ENetAddressFamily ENetAddressFamily
The address family type. 
 
An ENet event as returned by enet_host_service(). 
Definition: enet.h:416
 
enet_uint32 outgoingBandwidth
Upstream bandwidth of the client in bytes/second. 
Definition: enet.h:268
 
int needsDispatch
Definition: enet.h:305
 
enet_uint32 fragmentOffset
Definition: enet.h:171
 
enet_uint16 outgoingPeerID
Definition: enet.h:257
 
uint32_t scopeID
Definition: enet.h:88
 
enet_uint32 earliestTimeout
Definition: enet.h:276
 
enet_uint32 eventData
Definition: enet.h:309
 
An ENet peer which data packets may be sent or received from. 
Definition: enet.h:253
 
ENET_API int enet_socket_connect(ENetSocket, const ENetAddress *, ENetAddressFamily)
Definition: unix.c:268
 
enet_uint32 flags
bitwise-or of ENetPacketFlag constants 
Definition: enet.h:150
 
ENET_API int enet_initialize_with_callbacks(ENetVersion version, const ENetCallbacks *inits)
Initializes ENet globally and supplies user-overridden callbacks. 
Definition: callbacks.c:11
 
enet_uint16 headerFlags
Definition: enet.h:363
 
enet_uint16 outgoingUnreliableSequenceNumber
Definition: enet.h:240
 
enet_uint32 packetThrottleDeceleration
Definition: enet.h:287
 
enet_uint32 packetThrottleInterval
Definition: enet.h:288
 
enet_uint32 packetThrottleEpoch
Definition: enet.h:285
 
struct _ENetCompressor ENetCompressor
An ENet packet compressor for compressing UDP packets before socket sends or receives. 
 
size_t commandCount
Definition: enet.h:365
 
size_t dataLength
length of data 
Definition: enet.h:152
 
ENET_API int enet_socketset_select(ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32)
Definition: unix.c:386
 
#define ENET_CALLBACK
Definition: unix.h:33
 
struct _ENetPeer ENetPeer
An ENet peer which data packets may be sent or received from. 
 
const enet_uint8 size_t enet_uint8 size_t outLimit
Definition: enet.h:321
 
enum _ENetPacketFlag ENetPacketFlag
Packet flag bit constants. 
 
unsigned short enet_uint16
unsigned 16-bit type 
Definition: types.h:9
 
ENetList dispatchQueue
Definition: enet.h:360
 
const ENetBuffer size_t size_t enet_uint8 size_t outLimit
Definition: enet.h:319
 
enet_uint16 sendAttempts
Definition: enet.h:173
 
enet_uint32 ENetVersion
Definition: enet.h:32
 
ENetListNode outgoingCommandList
Definition: enet.h:165
 
ENET_API int enet_address_get_host(const ENetAddress *address, char *hostName, size_t nameLength)
Attempts to do a reverse lookup of the host field in the address parameter. 
Definition: unix.c:186
 
enet_uint32 packetsLost
Definition: enet.h:279
 
enet_uint16 outgoingUnsequencedGroup
Definition: enet.h:307
 
ENET_API void enet_host_bandwidth_limit(ENetHost *, enet_uint32, enet_uint32)
Adjusts the bandwidth limits of a host. 
Definition: host.c:336
 
unsigned char enet_uint8
unsigned 8-bit type 
Definition: types.h:8
 
#define ENET_BUFFER_MAXIMUM
Definition: enet.h:205
 
ENET_API ENetHost * enet_host_create(const ENetAddress *, size_t, size_t, enet_uint32, enet_uint32)
Creates a host for communicating to peers. 
Definition: host.c:54
 
enet_uint32 packetThrottleAcceleration
Definition: enet.h:286
 
ENetProtocol command
Definition: enet.h:160
 
enet_uint8 addr[16]
Definition: enet.h:58
 
ENET_API void enet_deinitialize(void)
Shuts down ENet globally. 
Definition: unix.c:50
 
ENetList sentUnreliableCommands
Definition: enet.h:301
 
enum _ENetSocketWait ENetSocketWait
 
struct _ENetAddress ENetAddress
Portable internet address structure. 
 
enet_uint32 incomingBandwidthThrottleEpoch
Definition: enet.h:269
 
ENET_API int enet_address_get_host_ip(const ENetAddress *address, char *hostName, size_t nameLength)
Gives the printable form of the ip address specified in the address parameter. 
Definition: unix.c:180
 
enet_uint32 totalReceivedData
total data received, user should reset to 0 as needed to prevent overflow 
Definition: enet.h:376
 
enet_uint16 unreliableSequenceNumber
Definition: enet.h:182
 
enet_uint32 sentTime
Definition: enet.h:168
 
ENET_API void enet_range_coder_destroy(void *)
Definition: compress.c:59
 
enet_uint32 highestRoundTripTimeVariance
Definition: enet.h:292
 
ENetEventType type
type of the event 
Definition: enet.h:418
 
void * data
Application private data, may be freely modified. 
Definition: enet.h:263
 
enet_uint32 roundTripTime
mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its ackn...
Definition: enet.h:293
 
Definition: protocol.h:175
 
enet_uint8 incomingSessionID
Definition: enet.h:261
 
struct _ENetHost ENetHost
An ENet host for communicating with peers. 
 
ENetList incomingUnreliableCommands
Definition: enet.h:245
 
ENET_API void enet_host_channel_limit(ENetHost *, size_t)
Limits the maximum allowed channels of future incoming connections. 
Definition: host.c:316
 
struct _ENetAcknowledgement ENetAcknowledgement
 
enet_uint32 incomingBandwidth
downstream bandwidth of the host 
Definition: enet.h:350
 
size_t bufferCount
Definition: enet.h:367
 
enet_uint32 data
data associated with the event, if appropriate 
Definition: enet.h:421
 
ENET_API int enet_packet_resize(ENetPacket *, size_t)
Attempts to resize the data in the packet to length specified in the dataLength parameter. 
Definition: packet.c:69
 
ENET_API ENetSocket enet_socket_create(ENetSocketType, ENetAddressFamily)
Definition: unix.c:216
 
size_t channelLimit
maximum number of channels allowed for connected peers 
Definition: enet.h:358
 
ENET_API ENetPacket * enet_packet_create(const void *, size_t, enet_uint32)
Creates a packet that may be sent to a peer. 
Definition: packet.c:20
 
struct _ENetEvent ENetEvent
An ENet event as returned by enet_host_service(). 
 
ENET_API void enet_time_set(enet_uint32)
Sets the current wall-time in milliseconds. 
Definition: unix.c:65
 
fd_set ENetSocketSet
Definition: unix.h:37
 
ENET_API void enet_host_compress(ENetHost *, const ENetCompressor *)
Sets the packet compressor the host should use to compress and decompress packets. 
Definition: host.c:300
 
size_t receivedDataLength
Definition: enet.h:373
 
enet_uint32 incomingBandwidth
Downstream bandwidth of the client in bytes/second. 
Definition: enet.h:267
 
enet_uint8 * data
allocated data for packet 
Definition: enet.h:151
 
ENetPacketFreeCallback freeCallback
function to be called when the packet is no longer in use 
Definition: enet.h:153
 
enet_uint32 lastReceiveTime
Definition: enet.h:274
 
ENET_API size_t enet_range_coder_decompress(void *, const enet_uint8 *, size_t, enet_uint8 *, size_t)
Definition: compress.c:499
 
_ENetAddressFamily
The address family type. 
Definition: enet.h:96
 
enet_uint32 outgoingDataTotal
Definition: enet.h:272
 
enet_uint16 incomingPeerID
Definition: enet.h:258
 
enet_uint32 lastRoundTripTimeVariance
Definition: enet.h:291
 
An ENet packet compressor for compressing UDP packets before socket sends or receives. 
Definition: enet.h:314
 
ENetAddress address
Internet address of the host. 
Definition: enet.h:349
 
ENetChecksumCallback checksum
callback the user can set to enable packet checksums for this host 
Definition: enet.h:368
 
enet_uint32 fragmentCount
Definition: enet.h:184
 
struct _ENetHostAddress ENetHostAddress
 
enet_uint16 incomingUnsequencedGroup
Definition: enet.h:306
 
enet_uint16 usedReliableWindows
Definition: enet.h:241
 
struct _ENetOutgoingCommand ENetOutgoingCommand
 
ENET_API int enet_peer_send(ENetPeer *, enet_uint8, ENetPacket *)
Queues a packet to be sent. 
Definition: peer.c:100
 
void enet_peer_reset_queues(ENetPeer *)
Definition: peer.c:284
 
enet_uint16 unreliableSequenceNumber
Definition: enet.h:167
 
int recalculateBandwidthLimits
Definition: enet.h:355
 
enet_uint32 enet_crc32(const ENetBuffer *, size_t)
Definition: packet.c:135
 
ENET_API int enet_socket_wait(ENetSocket, ENetSocket, enet_uint32 *, enet_uint32)
Definition: unix.c:397
 
void enet_peer_dispatch_incoming_unreliable_commands(ENetPeer *, ENetChannel *)
Definition: peer.c:591
 
ENET_API void enet_peer_throttle_configure(ENetPeer *, enet_uint32, enet_uint32, enet_uint32)
Configures throttle parameter for a peer. 
Definition: peer.c:43
 
enet_uint32 packetLossEpoch
Definition: enet.h:277
 
enet_uint32 randomSeed
Definition: enet.h:354
 
enet_uint32 nextTimeout
Definition: enet.h:275
 
enet_uint16 outgoingReliableSequenceNumber
Definition: enet.h:239
 
ENetPacket * packet
Definition: enet.h:187
 
ENET_API void enet_peer_disconnect_now(ENetPeer *, enet_uint32)
Force an immediate disconnection from a peer. 
Definition: peer.c:404
 
enet_uint8 * receivedData
Definition: enet.h:372
 
enet_uint32 mtu
Definition: enet.h:295
 
a peer has disconnected. 
Definition: enet.h:400
 
typedef enet_uint32(ENET_CALLBACK *ENetChecksumCallback)(const ENetBuffer *buffers
Callback that computes the checksum of the data held in buffers[0:bufferCount-1]. ...
 
a connection request initiated by enet_host_connect has completed. 
Definition: enet.h:391
 
enet_uint32 bandwidthThrottleEpoch
Definition: enet.h:352
 
ENET_API void * enet_range_coder_create(void)
Definition: compress.c:49
 
enet_uint32 outgoingBandwidthThrottleEpoch
Definition: enet.h:270
 
ENET_API ENetHostAddress enet_address_map4(enet_uint32 address)
Maps an IPv4 Address to an IPv6 address. 
Definition: protocol.c:29
 
ENetList incomingReliableCommands
Definition: enet.h:244
 
ENET_API int enet_initialize(void)
Initializes ENet globally. 
Definition: unix.c:44
 
ENetChannel * channels
Definition: enet.h:265
 
ENetListNode incomingCommandList
Definition: enet.h:180
 
ENET_API void enet_peer_reset(ENetPeer *)
Forcefully disconnects a peer. 
Definition: peer.c:327
 
no event occurred within the specified time limit 
Definition: enet.h:386
 
_ENetEventType
An ENet event type, as specified in ENetEvent. 
Definition: enet.h:383
 
_ENetPacketFlag
Packet flag bit constants. 
Definition: enet.h:112
 
Definition: protocol.h:14
 
enet_uint32 * fragments
Definition: enet.h:186
 
ENetSocket socket4
Definition: enet.h:347
 
int continueSending
Definition: enet.h:361
 
ENetPeerState state
Definition: enet.h:264
 
void enet_host_bandwidth_throttle(ENetHost *)
Definition: host.c:344
 
void enet_peer_setup_outgoing_command(ENetPeer *, ENetOutgoingCommand *)
Definition: peer.c:521
 
ENET_API ENetAddressFamily enet_get_address_family(const ENetAddress *address)
Returns the Address family of an (IPv4-mapped) IPv6 address. 
Definition: protocol.c:37
 
enet_uint32 packetsSent
Definition: enet.h:278
 
size_t channelCount
Number of channels allocated for communication with peer. 
Definition: enet.h:266
 
size_t bufferCount
Definition: enet.h:327
 
ENET_API int enet_socket_listen(ENetSocket, int)
Definition: unix.c:210
 
ENet packet structure. 
Definition: enet.h:147
 
ENetProtocol command
Definition: enet.h:183