aboutsummaryrefslogtreecommitdiff
path: root/src/compat/win32.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/compat/win32.h')
-rw-r--r--src/compat/win32.h104
1 files changed, 52 insertions, 52 deletions
diff --git a/src/compat/win32.h b/src/compat/win32.h
index 7e44c13..0cc42b6 100644
--- a/src/compat/win32.h
+++ b/src/compat/win32.h
@@ -32,9 +32,9 @@ extern "C"
32#endif 32#endif
33 33
34#define decltype( ret, name, ... ) \ 34#define decltype( ret, name, ... ) \
35 typedef ret (__cdecl *FNDEF_DYN_ ##name)( __VA_ARGS__ ); \ 35 typedef ret (__cdecl *FNDEF_DYN_ ##name)( __VA_ARGS__ ); \
36 static FNDEF_DYN_ ##name _fnptr_ ##name; \ 36 static FNDEF_DYN_ ##name _fnptr_ ##name; \
37 static ret name( __VA_ARGS__ ) 37 static ret name( __VA_ARGS__ )
38 38
39__extension__ typedef int socklen_t; 39__extension__ typedef int socklen_t;
40 40
@@ -44,54 +44,54 @@ __extension__ typedef int socklen_t;
44 44
45namespace Bu 45namespace Bu
46{ 46{
47 class Winsock2 : public Bu::Singleton<Winsock2> 47 class Winsock2 : public Bu::Singleton<Winsock2>
48 { 48 {
49 friend class Bu::Singleton<Winsock2>; 49 friend class Bu::Singleton<Winsock2>;
50 private: 50 private:
51 Winsock2(); 51 Winsock2();
52 virtual ~Winsock2(); 52 virtual ~Winsock2();
53 53
54 WSADATA wsaData; 54 WSADATA wsaData;
55 HINSTANCE Ws2_32; 55 HINSTANCE Ws2_32;
56 56
57 public: 57 public:
58 // decltype( return type, function name<, optional parameters> ) 58 // decltype( return type, function name<, optional parameters> )
59 decltype( int, WSAStartup, WORD, LPWSADATA ); 59 decltype( int, WSAStartup, WORD, LPWSADATA );
60 decltype( int, WSACleanup ); 60 decltype( int, WSACleanup );
61 decltype( int, WSAGetLastError ); 61 decltype( int, WSAGetLastError );
62 decltype( char *, inet_ntoa, struct in_addr ); 62 decltype( char *, inet_ntoa, struct in_addr );
63 decltype( unsigned long, inet_addr, const char *s_in ); 63 decltype( unsigned long, inet_addr, const char *s_in );
64 decltype( int, select, int nfds, fd_set *readfds, fd_set *writefds, 64 decltype( int, select, int nfds, fd_set *readfds, fd_set *writefds,
65 fd_set *exceptfds, const struct timeval *timeout ); 65 fd_set *exceptfds, const struct timeval *timeout );
66 decltype( SOCKET, socket, int domain, int type, int protocol ); 66 decltype( SOCKET, socket, int domain, int type, int protocol );
67 decltype( int, shutdown, SOCKET s, int how ); 67 decltype( int, shutdown, SOCKET s, int how );
68 decltype( int, ioctlsocket, SOCKET s, long cmd, u_long *argp ); 68 decltype( int, ioctlsocket, SOCKET s, long cmd, u_long *argp );
69 decltype( u_short, htons, u_short in ); 69 decltype( u_short, htons, u_short in );
70 decltype( u_long, htonl, u_long in ); 70 decltype( u_long, htonl, u_long in );
71 decltype( struct hostent *, gethostbyname, const char *name ); 71 decltype( struct hostent *, gethostbyname, const char *name );
72 decltype( void, freeaddrinfo, struct addrinfo *ai ); 72 decltype( void, freeaddrinfo, struct addrinfo *ai );
73 decltype( int, getaddrinfo, const char *nodename, const char *servname, 73 decltype( int, getaddrinfo, const char *nodename, const char *servname,
74 const struct addrinfo *hints, struct addrinfo **res ); 74 const struct addrinfo *hints, struct addrinfo **res );
75 decltype( int, connect, SOCKET s, const struct sockaddr *serv_addr, 75 decltype( int, connect, SOCKET s, const struct sockaddr *serv_addr,
76 int addrlen ); 76 int addrlen );
77 decltype( int, getpeername, SOCKET s, struct sockaddr *name, 77 decltype( int, getpeername, SOCKET s, struct sockaddr *name,
78 int *namelen ); 78 int *namelen );
79 decltype( int, setsockopt, SOCKET s, int level, int optname, 79 decltype( int, setsockopt, SOCKET s, int level, int optname,
80 const char *optval, int optlen ); 80 const char *optval, int optlen );
81 decltype( int, bind, SOCKET s, const struct sockaddr *my_addr, 81 decltype( int, bind, SOCKET s, const struct sockaddr *my_addr,
82 int addrlen ); 82 int addrlen );
83 decltype( int, listen, SOCKET s, int backlog ); 83 decltype( int, listen, SOCKET s, int backlog );
84 decltype( SOCKET, accept, SOCKET s, struct sockaddr *addr, 84 decltype( SOCKET, accept, SOCKET s, struct sockaddr *addr,
85 int *addrlen); 85 int *addrlen);
86 decltype( int, recv, SOCKET s, char *buf, int len, int flags ); 86 decltype( int, recv, SOCKET s, char *buf, int len, int flags );
87 decltype( int, send, SOCKET s, const char *buf, int len, int flags ); 87 decltype( int, send, SOCKET s, const char *buf, int len, int flags );
88 decltype( int, __WSAFDIsSet, SOCKET s, fd_set *set ); 88 decltype( int, __WSAFDIsSet, SOCKET s, fd_set *set );
89 89
90 static char scode[32]; 90 static char scode[32];
91 static char *gai_strerror( int iCode ); 91 static char *gai_strerror( int iCode );
92 }; 92 };
93 93
94 Bu::String getLastWinError(); 94 Bu::String getLastWinError();
95}; 95};
96 96
97#ifdef FD_ISSET 97#ifdef FD_ISSET
@@ -117,7 +117,7 @@ namespace Bu
117#define bu_setsockopt (*Bu::Winsock2::setsockopt) 117#define bu_setsockopt (*Bu::Winsock2::setsockopt)
118#define bu_bind (*Bu::Winsock2::bind) 118#define bu_bind (*Bu::Winsock2::bind)
119#define bu_listen (*Bu::Winsock2::listen) 119#define bu_listen (*Bu::Winsock2::listen)
120#define bu_accept (*Bu::Winsock2::accept) 120#define bu_accept (*Bu::Winsock2::accept)
121#define bu_recv (*Bu::Winsock2::recv) 121#define bu_recv (*Bu::Winsock2::recv)
122#define bu_send (*Bu::Winsock2::send) 122#define bu_send (*Bu::Winsock2::send)
123#define bu___WSAFDIsSet (*Bu::Winsock2::__WSAFDIsSet) 123#define bu___WSAFDIsSet (*Bu::Winsock2::__WSAFDIsSet)