Last change
on this file since 122 was
65,
checked in by Torben Dannhauer, 14 years ago
|
new cluster implementation added: ENet
ENet is a reliable UDP implementation with quite simple usage and high performance for transmission with small or medium size packet.
|
File size:
1.2 KB
|
Rev | Line | |
---|
[65] | 1 | /** |
---|
| 2 | @file unix.h |
---|
| 3 | @brief ENet Unix header |
---|
| 4 | */ |
---|
| 5 | #ifndef __ENET_UNIX_H__ |
---|
| 6 | #define __ENET_UNIX_H__ |
---|
| 7 | |
---|
| 8 | #include <stdlib.h> |
---|
| 9 | #include <sys/time.h> |
---|
| 10 | #include <sys/types.h> |
---|
| 11 | #include <netinet/in.h> |
---|
| 12 | #include <unistd.h> |
---|
| 13 | |
---|
| 14 | typedef int ENetSocket; |
---|
| 15 | |
---|
| 16 | enum |
---|
| 17 | { |
---|
| 18 | ENET_SOCKET_NULL = -1 |
---|
| 19 | }; |
---|
| 20 | |
---|
| 21 | #define ENET_HOST_TO_NET_16(value) (htons (value)) /**< macro that converts host to net byte-order of a 16-bit value */ |
---|
| 22 | #define ENET_HOST_TO_NET_32(value) (htonl (value)) /**< macro that converts host to net byte-order of a 32-bit value */ |
---|
| 23 | |
---|
| 24 | #define ENET_NET_TO_HOST_16(value) (ntohs (value)) /**< macro that converts net to host byte-order of a 16-bit value */ |
---|
| 25 | #define ENET_NET_TO_HOST_32(value) (ntohl (value)) /**< macro that converts net to host byte-order of a 32-bit value */ |
---|
| 26 | |
---|
| 27 | typedef struct |
---|
| 28 | { |
---|
| 29 | void * data; |
---|
| 30 | size_t dataLength; |
---|
| 31 | } ENetBuffer; |
---|
| 32 | |
---|
| 33 | #define ENET_CALLBACK |
---|
| 34 | |
---|
| 35 | #define ENET_API extern |
---|
| 36 | |
---|
| 37 | typedef fd_set ENetSocketSet; |
---|
| 38 | |
---|
| 39 | #define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset)) |
---|
| 40 | #define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset)) |
---|
| 41 | #define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLEAR (socket, & (sockset)) |
---|
| 42 | #define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) |
---|
| 43 | |
---|
| 44 | #endif /* __ENET_UNIX_H__ */ |
---|
| 45 | |
---|
Note: See
TracBrowser
for help on using the repository browser.