Last change
on this file since 69 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.4 KB
|
Rev | Line | |
---|
[65] | 1 | /** |
---|
| 2 | @file win32.h |
---|
| 3 | @brief ENet Win32 header |
---|
| 4 | */ |
---|
| 5 | #ifndef __ENET_WIN32_H__ |
---|
| 6 | #define __ENET_WIN32_H__ |
---|
| 7 | |
---|
| 8 | #ifdef ENET_BUILDING_LIB |
---|
| 9 | #pragma warning (disable: 4996) // 'strncpy' was declared deprecated |
---|
| 10 | #pragma warning (disable: 4267) // size_t to int conversion |
---|
| 11 | #pragma warning (disable: 4244) // 64bit to 32bit int |
---|
| 12 | #pragma warning (disable: 4018) // signed/unsigned mismatch |
---|
| 13 | #endif |
---|
| 14 | |
---|
| 15 | #include <stdlib.h> |
---|
| 16 | #include <winsock2.h> |
---|
| 17 | |
---|
| 18 | typedef SOCKET ENetSocket; |
---|
| 19 | |
---|
| 20 | enum |
---|
| 21 | { |
---|
| 22 | ENET_SOCKET_NULL = INVALID_SOCKET |
---|
| 23 | }; |
---|
| 24 | |
---|
| 25 | #define ENET_HOST_TO_NET_16(value) (htons (value)) |
---|
| 26 | #define ENET_HOST_TO_NET_32(value) (htonl (value)) |
---|
| 27 | |
---|
| 28 | #define ENET_NET_TO_HOST_16(value) (ntohs (value)) |
---|
| 29 | #define ENET_NET_TO_HOST_32(value) (ntohl (value)) |
---|
| 30 | |
---|
| 31 | typedef struct |
---|
| 32 | { |
---|
| 33 | size_t dataLength; |
---|
| 34 | void * data; |
---|
| 35 | } ENetBuffer; |
---|
| 36 | |
---|
| 37 | #define ENET_CALLBACK __cdecl |
---|
| 38 | |
---|
| 39 | #if defined ENET_DLL |
---|
| 40 | #if defined ENET_BUILDING_LIB |
---|
| 41 | #define ENET_API __declspec( dllexport ) |
---|
| 42 | #else |
---|
| 43 | #define ENET_API __declspec( dllimport ) |
---|
| 44 | #endif /* ENET_BUILDING_LIB */ |
---|
| 45 | #else /* !ENET_DLL */ |
---|
| 46 | #define ENET_API extern |
---|
| 47 | #endif /* ENET_DLL */ |
---|
| 48 | |
---|
| 49 | typedef fd_set ENetSocketSet; |
---|
| 50 | |
---|
| 51 | #define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset)) |
---|
| 52 | #define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset)) |
---|
| 53 | #define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLEAR (socket, & (sockset)) |
---|
| 54 | #define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) |
---|
| 55 | |
---|
| 56 | #endif /* __ENET_WIN32_H__ */ |
---|
| 57 | |
---|
| 58 | |
---|
Note: See
TracBrowser
for help on using the repository browser.