Commit | Line | Data |
---|---|---|
7f799388 M |
1 | /* |
2 | Copyright (c) 2006 by Dan Kennedy. | |
3 | Copyright (c) 2006 by Juliusz Chroboczek. | |
4 | ||
5 | Permission is hereby granted, free of charge, to any person obtaining a copy | |
6 | of this software and associated documentation files (the "Software"), to deal | |
7 | in the Software without restriction, including without limitation the rights | |
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
9 | copies of the Software, and to permit persons to whom the Software is | |
10 | furnished to do so, subject to the following conditions: | |
11 | ||
12 | The above copyright notice and this permission notice shall be included in | |
13 | all copies or substantial portions of the Software. | |
14 | ||
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
21 | THE SOFTWARE. | |
22 | */ | |
23 | /*Adaptions by memphiz@xbmc.org*/ | |
24 | ||
7f799388 M |
25 | #ifndef win32_COMPAT_H_ |
26 | #define win32_COMPAT_H_ | |
27 | #define NO_IPv6 1 | |
28 | ||
29 | #include <winsock2.h> | |
30 | #include <ws2tcpip.h> | |
20a96d42 | 31 | #include <Ws2ipdef.h> |
7f799388 M |
32 | #include <basetsd.h> |
33 | #include <io.h> | |
34 | #include <sys/stat.h> | |
21eeb9f5 | 35 | #include <time.h> |
7f799388 M |
36 | |
37 | typedef int uid_t; | |
38 | typedef int gid_t; | |
39 | typedef int socklen_t; | |
40 | ||
7f799388 M |
41 | #define S_IRUSR 0000400 |
42 | #define S_IWUSR 0000200 | |
43 | #define S_IXUSR 0000100 | |
44 | #define S_IRWXG 0000070 /* RWX mask for group */ | |
45 | #define S_IRGRP 0000040 | |
46 | #define S_IWGRP 0000020 | |
47 | #define S_IXGRP 0000010 | |
48 | #define S_IRWXO 0000007 /* RWX mask for other */ | |
49 | #define S_IROTH 0000004 | |
50 | #define S_IWOTH 0000002 | |
51 | #define S_IXOTH 0000001 | |
52 | ||
53 | #define F_GETFL 3 | |
54 | #define F_SETFL 4 | |
55 | ||
35bb34b4 | 56 | #ifndef S_IFIFO |
57 | #define S_IFIFO 0x1000 /* FIFO */ | |
58 | #endif | |
59 | ||
60 | #ifndef S_IFBLK | |
61 | #define S_IFBLK 0x3000 /* Block: Is this ever set under w32? */ | |
62 | #endif | |
63 | ||
64 | #ifndef S_IFSOCK | |
65 | #define S_IFSOCK 0x0 /* not defined in mingw either */ | |
66 | #endif | |
67 | ||
68 | #ifndef major | |
69 | #define major(a) 0 | |
70 | #endif | |
71 | ||
72 | #ifndef minor | |
73 | #define minor(a) 0 | |
74 | #endif | |
75 | ||
7f799388 M |
76 | #define O_NONBLOCK 0x40000000 |
77 | #define O_SYNC 0 | |
78 | ||
79 | #define MSG_DONTWAIT 0 | |
80 | #define ssize_t SSIZE_T | |
81 | ||
178e092a EG |
82 | #if(_WIN32_WINNT < 0x0600) |
83 | ||
7f799388 M |
84 | #define POLLIN 0x0001 /* There is data to read */ |
85 | #define POLLPRI 0x0002 /* There is urgent data to read */ | |
86 | #define POLLOUT 0x0004 /* Writing now will not block */ | |
87 | #define POLLERR 0x0008 /* Error condition */ | |
88 | #define POLLHUP 0x0010 /* Hung up */ | |
89 | #define POLLNVAL 0x0020 /* Invalid request: fd not open */ | |
90 | ||
91 | struct pollfd { | |
92 | SOCKET fd; /* file descriptor */ | |
93 | short events; /* requested events */ | |
94 | short revents; /* returned events */ | |
95 | }; | |
178e092a | 96 | #endif |
7f799388 | 97 | |
2142af5d RS |
98 | #define close closesocket |
99 | #define ioctl ioctlsocket | |
100 | ||
7f799388 M |
101 | /* Wrapper macros to call misc. functions win32 is missing */ |
102 | #define poll(x, y, z) win32_poll(x, y, z) | |
7f799388 | 103 | #define inet_pton(x,y,z) win32_inet_pton(x,y,z) |
7f799388 | 104 | int win32_inet_pton(int af, const char * src, void * dst); |
20a96d42 M |
105 | int win32_poll(struct pollfd *fds, unsigned int nfsd, int timeout); |
106 | int win32_gettimeofday(struct timeval *tv, struct timezone *tz); | |
7f799388 | 107 | |
2142af5d | 108 | #define DllExport |
2142af5d | 109 | |
7f799388 | 110 | #endif//win32_COMPAT_H_ |