enet: win32.h Source File

enet

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

win32.h
Go to the documentation of this file.
1
5 #ifndef __ENET_WIN32_H__
6 #define __ENET_WIN32_H__
7
8 #ifdef _MSC_VER
9 #ifdef ENET_BUILDING_LIB
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 #pragma warning (disable: 4146) // unary minus operator applied to unsigned type
14 #endif
15 #endif
16
17 #include <stdlib.h>
18 #include <winsock2.h>
19
20 typedef SOCKET ENetSocket;
21
22 #define ENET_SOCKET_NULL INVALID_SOCKET
23
24 #define ENET_HOST_TO_NET_16(value) (htons (value))
25 #define ENET_HOST_TO_NET_32(value) (htonl (value))
26
27 #define ENET_NET_TO_HOST_16(value) (ntohs (value))
28 #define ENET_NET_TO_HOST_32(value) (ntohl (value))
29
30 typedef struct
31 {
32 size_t dataLength;
33 void * data;
34 } ENetBuffer;
35
36 #define ENET_CALLBACK __cdecl
37
38 #ifdef ENET_DLL
39 #ifdef ENET_BUILDING_LIB
40 #define ENET_API __declspec( dllexport )
41 #else
42 #define ENET_API __declspec( dllimport )
43 #endif /* ENET_BUILDING_LIB */
44 #else /* !ENET_DLL */
45 #define ENET_API extern
46 #endif /* ENET_DLL */
47
48 typedef fd_set ENetSocketSet;
49
50 #define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset))
51 #define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset))
52 #define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLR (socket, & (sockset))
53 #define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset))
54
55 #endif /* __ENET_WIN32_H__ */
56
57
ENetBuffer
Definition: unix.h:29