Skip to content
This repository
Browse code

win: move winsock intialization out of tcp.c

  • Loading branch information...
commit d1a63c40031b3b17f4b58db863181dc8a3696e2a 1 parent 48a8f19
Bert Belder piscisaureus authored
2  src/win/core.c
@@ -68,7 +68,7 @@ static void uv_loop_init() {
68 68
69 69 void uv_init() {
70 70 /* Initialize winsock */
71   - uv_winsock_startup();
  71 + uv_winsock_init();
72 72
73 73 /* Fetch winapi function pointers */
74 74 uv_winapi_init();
4 src/win/internal.h
@@ -27,6 +27,7 @@
27 27
28 28 #include "tree.h"
29 29 #include "winapi.h"
  30 +#include "winsock.h"
30 31
31 32
32 33 /*
@@ -162,8 +163,6 @@ size_t uv_count_bufs(uv_buf_t bufs[], int count);
162 163 /*
163 164 * TCP
164 165 */
165   -void uv_winsock_startup();
166   -
167 166 void uv_tcp_endgame(uv_tcp_t* handle);
168 167
169 168 int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb);
@@ -258,6 +257,7 @@ void uv_set_error(uv_err_code code, int sys_errno);
258 257 * Initialization for the windows and winsock api
259 258 */
260 259 void uv_winapi_init();
  260 +void uv_winsock_init();
261 261
262 262
263 263 #endif /* UV_WIN_INTERNAL_H_ */
212 src/win/tcp.c
@@ -25,232 +25,22 @@
25 25 #include "../uv-common.h"
26 26 #include "internal.h"
27 27
28   -/*
29   - * Guids and typedefs for winsock extension functions
30   - * Mingw32 doesn't have these :-(
31   - */
32   -#ifndef WSAID_ACCEPTEX
33   -# define WSAID_ACCEPTEX \
34   - {0xb5367df1, 0xcbac, 0x11cf, \
35   - {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
36   -
37   -# define WSAID_CONNECTEX \
38   - {0x25a207b9, 0xddf3, 0x4660, \
39   - {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}}
40   -
41   -# define WSAID_GETACCEPTEXSOCKADDRS \
42   - {0xb5367df2, 0xcbac, 0x11cf, \
43   - {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
44   -
45   -# define WSAID_DISCONNECTEX \
46   - {0x7fda2e11, 0x8630, 0x436f, \
47   - {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
48   -
49   -# define WSAID_TRANSMITFILE \
50   - {0xb5367df0, 0xcbac, 0x11cf, \
51   - {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
52   -
53   - typedef BOOL PASCAL (*LPFN_ACCEPTEX)
54   - (SOCKET sListenSocket,
55   - SOCKET sAcceptSocket,
56   - PVOID lpOutputBuffer,
57   - DWORD dwReceiveDataLength,
58   - DWORD dwLocalAddressLength,
59   - DWORD dwRemoteAddressLength,
60   - LPDWORD lpdwBytesReceived,
61   - LPOVERLAPPED lpOverlapped);
62   -
63   - typedef BOOL PASCAL (*LPFN_CONNECTEX)
64   - (SOCKET s,
65   - const struct sockaddr* name,
66   - int namelen,
67   - PVOID lpSendBuffer,
68   - DWORD dwSendDataLength,
69   - LPDWORD lpdwBytesSent,
70   - LPOVERLAPPED lpOverlapped);
71   -
72   - typedef void PASCAL (*LPFN_GETACCEPTEXSOCKADDRS)
73   - (PVOID lpOutputBuffer,
74   - DWORD dwReceiveDataLength,
75   - DWORD dwLocalAddressLength,
76   - DWORD dwRemoteAddressLength,
77   - LPSOCKADDR* LocalSockaddr,
78   - LPINT LocalSockaddrLength,
79   - LPSOCKADDR* RemoteSockaddr,
80   - LPINT RemoteSockaddrLength);
81   -
82   - typedef BOOL PASCAL (*LPFN_DISCONNECTEX)
83   - (SOCKET hSocket,
84   - LPOVERLAPPED lpOverlapped,
85   - DWORD dwFlags,
86   - DWORD reserved);
87   -
88   - typedef BOOL PASCAL (*LPFN_TRANSMITFILE)
89   - (SOCKET hSocket,
90   - HANDLE hFile,
91   - DWORD nNumberOfBytesToWrite,
92   - DWORD nNumberOfBytesPerSend,
93   - LPOVERLAPPED lpOverlapped,
94   - LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
95   - DWORD dwFlags);
96   -#endif
97 28
98 29 /*
99   - * MinGW is missing this too
100   - */
101   -#ifndef SO_UPDATE_CONNECT_CONTEXT
102   -# define SO_UPDATE_CONNECT_CONTEXT 0x7010
103   -#endif
104   -
105   -
106   -/*
107 30 * Threshold of active tcp streams for which to preallocate tcp read buffers.
108 31 */
109 32 const unsigned int uv_active_tcp_streams_threshold = 50;
110 33
111   -
112 34 /*
113 35 * Number of simultaneous pending AcceptEx calls.
114 36 */
115 37 const unsigned int uv_simultaneous_server_accepts = 32;
116 38
117   -
118   -/* Pointers to winsock extension functions to be retrieved dynamically */
119   -static LPFN_CONNECTEX pConnectEx;
120   -static LPFN_ACCEPTEX pAcceptEx;
121   -static LPFN_GETACCEPTEXSOCKADDRS pGetAcceptExSockAddrs;
122   -static LPFN_DISCONNECTEX pDisconnectEx;
123   -static LPFN_TRANSMITFILE pTransmitFile;
124   -
125   -/* IPv6 version of these extension functions */
126   -static LPFN_CONNECTEX pConnectEx6;
127   -static LPFN_ACCEPTEX pAcceptEx6;
128   -static LPFN_GETACCEPTEXSOCKADDRS pGetAcceptExSockAddrs6;
129   -static LPFN_DISCONNECTEX pDisconnectEx6;
130   -static LPFN_TRANSMITFILE pTransmitFile6;
131   -
132   -/* Ip address used to bind to any port at any interface */
133   -static struct sockaddr_in uv_addr_ip4_any_;
134   -static struct sockaddr_in6 uv_addr_ip6_any_;
135   -
136 39 /* A zero-size buffer for use by uv_tcp_read */
137 40 static char uv_zero_[] = "";
138 41
139   -/* mark if IPv6 sockets are supported */
140   -static BOOL uv_allow_ipv6 = FALSE;
141   -
142 42 /* Counter to keep track of active tcp streams */
143   -static uint64_t active_tcp_streams;
144   -
145   -
146   -/*
147   - * Retrieves the pointer to a winsock extension function.
148   - */
149   -static BOOL uv_get_extension_function(SOCKET socket, GUID guid,
150   - void **target) {
151   - DWORD result, bytes;
152   -
153   - result = WSAIoctl(socket,
154   - SIO_GET_EXTENSION_FUNCTION_POINTER,
155   - &guid,
156   - sizeof(guid),
157   - (void*)target,
158   - sizeof(*target),
159   - &bytes,
160   - NULL,
161   - NULL);
162   -
163   - if (result == SOCKET_ERROR) {
164   - *target = NULL;
165   - return FALSE;
166   - } else {
167   - return TRUE;
168   - }
169   -}
170   -
171   -
172   -/*
173   - * Setup tcp subsystem
174   - */
175   -void uv_winsock_startup() {
176   - const GUID wsaid_connectex = WSAID_CONNECTEX;
177   - const GUID wsaid_acceptex = WSAID_ACCEPTEX;
178   - const GUID wsaid_getacceptexsockaddrs = WSAID_GETACCEPTEXSOCKADDRS;
179   - const GUID wsaid_disconnectex = WSAID_DISCONNECTEX;
180   - const GUID wsaid_transmitfile = WSAID_TRANSMITFILE;
181   -
182   - WSADATA wsa_data;
183   - int errorno;
184   - SOCKET dummy;
185   - SOCKET dummy6;
186   -
187   - /* Initialize winsock */
188   - errorno = WSAStartup(MAKEWORD(2, 2), &wsa_data);
189   - if (errorno != 0) {
190   - uv_fatal_error(errorno, "WSAStartup");
191   - }
192   -
193   - /* Set implicit binding address used by connectEx */
194   - uv_addr_ip4_any_ = uv_ip4_addr("0.0.0.0", 0);
195   - uv_addr_ip6_any_ = uv_ip6_addr("::", 0);
196   -
197   - /* Retrieve the needed winsock extension function pointers. */
198   - dummy = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
199   - if (dummy == INVALID_SOCKET) {
200   - uv_fatal_error(WSAGetLastError(), "socket");
201   - }
202   -
203   - if (!uv_get_extension_function(dummy,
204   - wsaid_connectex,
205   - (void**)&pConnectEx) ||
206   - !uv_get_extension_function(dummy,
207   - wsaid_acceptex,
208   - (void**)&pAcceptEx) ||
209   - !uv_get_extension_function(dummy,
210   - wsaid_getacceptexsockaddrs,
211   - (void**)&pGetAcceptExSockAddrs) ||
212   - !uv_get_extension_function(dummy,
213   - wsaid_disconnectex,
214   - (void**)&pDisconnectEx) ||
215   - !uv_get_extension_function(dummy,
216   - wsaid_transmitfile,
217   - (void**)&pTransmitFile)) {
218   - uv_fatal_error(WSAGetLastError(),
219   - "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER)");
220   - }
221   -
222   - if (closesocket(dummy) == SOCKET_ERROR) {
223   - uv_fatal_error(WSAGetLastError(), "closesocket");
224   - }
225   -
226   - /* optional IPv6 versions of winsock extension functions */
227   - dummy6 = socket(AF_INET6, SOCK_STREAM, IPPROTO_IP);
228   - if (dummy6 != INVALID_SOCKET) {
229   - uv_allow_ipv6 = TRUE;
230   -
231   - if (!uv_get_extension_function(dummy6,
232   - wsaid_connectex,
233   - (void**)&pConnectEx6) ||
234   - !uv_get_extension_function(dummy6,
235   - wsaid_acceptex,
236   - (void**)&pAcceptEx6) ||
237   - !uv_get_extension_function(dummy6,
238   - wsaid_getacceptexsockaddrs,
239   - (void**)&pGetAcceptExSockAddrs6) ||
240   - !uv_get_extension_function(dummy6,
241   - wsaid_disconnectex,
242   - (void**)&pDisconnectEx6) ||
243   - !uv_get_extension_function(dummy6,
244   - wsaid_transmitfile,
245   - (void**)&pTransmitFile6)) {
246   - uv_allow_ipv6 = FALSE;
247   - }
248   -
249   - if (closesocket(dummy6) == SOCKET_ERROR) {
250   - uv_fatal_error(WSAGetLastError(), "closesocket");
251   - }
252   - }
253   -}
  43 +static unsigned int active_tcp_streams = 0;
254 44
255 45
256 46 static int uv_tcp_set_socket(uv_tcp_t* handle, SOCKET socket) {
155 src/win/winsock.c
... ... @@ -0,0 +1,155 @@
  1 +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
  2 + *
  3 + * Permission is hereby granted, free of charge, to any person obtaining a copy
  4 + * of this software and associated documentation files (the "Software"), to
  5 + * deal in the Software without restriction, including without limitation the
  6 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  7 + * sell copies of the Software, and to permit persons to whom the Software is
  8 + * furnished to do so, subject to the following conditions:
  9 + *
  10 + * The above copyright notice and this permission notice shall be included in
  11 + * all copies or substantial portions of the Software.
  12 + *
  13 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  18 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  19 + * IN THE SOFTWARE.
  20 + */
  21 +
  22 +#include <assert.h>
  23 +
  24 +#include "uv.h"
  25 +#include "../uv-common.h"
  26 +#include "internal.h"
  27 +
  28 +
  29 +/* Winsock extension functions (ipv4) */
  30 +LPFN_CONNECTEX pConnectEx;
  31 +LPFN_ACCEPTEX pAcceptEx;
  32 +LPFN_GETACCEPTEXSOCKADDRS pGetAcceptExSockAddrs;
  33 +LPFN_DISCONNECTEX pDisconnectEx;
  34 +LPFN_TRANSMITFILE pTransmitFile;
  35 +
  36 +/* Winsock extension functions (ipv6) */
  37 +LPFN_CONNECTEX pConnectEx6;
  38 +LPFN_ACCEPTEX pAcceptEx6;
  39 +LPFN_GETACCEPTEXSOCKADDRS pGetAcceptExSockAddrs6;
  40 +LPFN_DISCONNECTEX pDisconnectEx6;
  41 +LPFN_TRANSMITFILE pTransmitFile6;
  42 +
  43 +/* Whether ipv6 is supported */
  44 +int uv_allow_ipv6;
  45 +
  46 +/* Ip address used to bind to any port at any interface */
  47 +struct sockaddr_in uv_addr_ip4_any_;
  48 +struct sockaddr_in6 uv_addr_ip6_any_;
  49 +
  50 +
  51 +/*
  52 + * Retrieves the pointer to a winsock extension function.
  53 + */
  54 +static BOOL uv_get_extension_function(SOCKET socket, GUID guid,
  55 + void **target) {
  56 + DWORD result, bytes;
  57 +
  58 + result = WSAIoctl(socket,
  59 + SIO_GET_EXTENSION_FUNCTION_POINTER,
  60 + &guid,
  61 + sizeof(guid),
  62 + (void*)target,
  63 + sizeof(*target),
  64 + &bytes,
  65 + NULL,
  66 + NULL);
  67 +
  68 + if (result == SOCKET_ERROR) {
  69 + *target = NULL;
  70 + return FALSE;
  71 + } else {
  72 + return TRUE;
  73 + }
  74 +}
  75 +
  76 +
  77 +void uv_winsock_init() {
  78 + const GUID wsaid_connectex = WSAID_CONNECTEX;
  79 + const GUID wsaid_acceptex = WSAID_ACCEPTEX;
  80 + const GUID wsaid_getacceptexsockaddrs = WSAID_GETACCEPTEXSOCKADDRS;
  81 + const GUID wsaid_disconnectex = WSAID_DISCONNECTEX;
  82 + const GUID wsaid_transmitfile = WSAID_TRANSMITFILE;
  83 +
  84 + WSADATA wsa_data;
  85 + int errorno;
  86 + SOCKET dummy;
  87 + SOCKET dummy6;
  88 +
  89 + /* Initialize winsock */
  90 + errorno = WSAStartup(MAKEWORD(2, 2), &wsa_data);
  91 + if (errorno != 0) {
  92 + uv_fatal_error(errorno, "WSAStartup");
  93 + }
  94 +
  95 + /* Set implicit binding address used by connectEx */
  96 + uv_addr_ip4_any_ = uv_ip4_addr("0.0.0.0", 0);
  97 + uv_addr_ip6_any_ = uv_ip6_addr("::", 0);
  98 +
  99 + /* Retrieve the needed winsock extension function pointers. */
  100 + dummy = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
  101 + if (dummy == INVALID_SOCKET) {
  102 + uv_fatal_error(WSAGetLastError(), "socket");
  103 + }
  104 +
  105 + if (!uv_get_extension_function(dummy,
  106 + wsaid_connectex,
  107 + (void**)&pConnectEx) ||
  108 + !uv_get_extension_function(dummy,
  109 + wsaid_acceptex,
  110 + (void**)&pAcceptEx) ||
  111 + !uv_get_extension_function(dummy,
  112 + wsaid_getacceptexsockaddrs,
  113 + (void**)&pGetAcceptExSockAddrs) ||
  114 + !uv_get_extension_function(dummy,
  115 + wsaid_disconnectex,
  116 + (void**)&pDisconnectEx) ||
  117 + !uv_get_extension_function(dummy,
  118 + wsaid_transmitfile,
  119 + (void**)&pTransmitFile)) {
  120 + uv_fatal_error(WSAGetLastError(),
  121 + "WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER)");
  122 + }
  123 +
  124 + if (closesocket(dummy) == SOCKET_ERROR) {
  125 + uv_fatal_error(WSAGetLastError(), "closesocket");
  126 + }
  127 +
  128 + /* optional IPv6 versions of winsock extension functions */
  129 + dummy6 = socket(AF_INET6, SOCK_STREAM, IPPROTO_IP);
  130 + if (dummy6 != INVALID_SOCKET) {
  131 + uv_allow_ipv6 = TRUE;
  132 +
  133 + if (!uv_get_extension_function(dummy6,
  134 + wsaid_connectex,
  135 + (void**)&pConnectEx6) ||
  136 + !uv_get_extension_function(dummy6,
  137 + wsaid_acceptex,
  138 + (void**)&pAcceptEx6) ||
  139 + !uv_get_extension_function(dummy6,
  140 + wsaid_getacceptexsockaddrs,
  141 + (void**)&pGetAcceptExSockAddrs6) ||
  142 + !uv_get_extension_function(dummy6,
  143 + wsaid_disconnectex,
  144 + (void**)&pDisconnectEx6) ||
  145 + !uv_get_extension_function(dummy6,
  146 + wsaid_transmitfile,
  147 + (void**)&pTransmitFile6)) {
  148 + uv_allow_ipv6 = FALSE;
  149 + }
  150 +
  151 + if (closesocket(dummy6) == SOCKET_ERROR) {
  152 + uv_fatal_error(WSAGetLastError(), "closesocket");
  153 + }
  154 + }
  155 +}
130 src/win/winsock.h
... ... @@ -0,0 +1,130 @@
  1 +/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
  2 + *
  3 + * Permission is hereby granted, free of charge, to any person obtaining a copy
  4 + * of this software and associated documentation files (the "Software"), to
  5 + * deal in the Software without restriction, including without limitation the
  6 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  7 + * sell copies of the Software, and to permit persons to whom the Software is
  8 + * furnished to do so, subject to the following conditions:
  9 + *
  10 + * The above copyright notice and this permission notice shall be included in
  11 + * all copies or substantial portions of the Software.
  12 + *
  13 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  18 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  19 + * IN THE SOFTWARE.
  20 + */
  21 +
  22 +#ifndef UV_WIN_WINSOCK_H_
  23 +#define UV_WIN_WINSOCK_H_
  24 +
  25 +#include <winsock2.h>
  26 +#include <mswsock.h>
  27 +#include <ws2tcpip.h>
  28 +#include <windows.h>
  29 +
  30 +
  31 +/*
  32 + * Guids and typedefs for winsock extension functions
  33 + * Mingw32 doesn't have these :-(
  34 + */
  35 +#ifndef WSAID_ACCEPTEX
  36 +# define WSAID_ACCEPTEX \
  37 + {0xb5367df1, 0xcbac, 0x11cf, \
  38 + {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
  39 +
  40 +# define WSAID_CONNECTEX \
  41 + {0x25a207b9, 0xddf3, 0x4660, \
  42 + {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}}
  43 +
  44 +# define WSAID_GETACCEPTEXSOCKADDRS \
  45 + {0xb5367df2, 0xcbac, 0x11cf, \
  46 + {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
  47 +
  48 +# define WSAID_DISCONNECTEX \
  49 + {0x7fda2e11, 0x8630, 0x436f, \
  50 + {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
  51 +
  52 +# define WSAID_TRANSMITFILE \
  53 + {0xb5367df0, 0xcbac, 0x11cf, \
  54 + {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
  55 +
  56 + typedef BOOL PASCAL (*LPFN_ACCEPTEX)
  57 + (SOCKET sListenSocket,
  58 + SOCKET sAcceptSocket,
  59 + PVOID lpOutputBuffer,
  60 + DWORD dwReceiveDataLength,
  61 + DWORD dwLocalAddressLength,
  62 + DWORD dwRemoteAddressLength,
  63 + LPDWORD lpdwBytesReceived,
  64 + LPOVERLAPPED lpOverlapped);
  65 +
  66 + typedef BOOL PASCAL (*LPFN_CONNECTEX)
  67 + (SOCKET s,
  68 + const struct sockaddr* name,
  69 + int namelen,
  70 + PVOID lpSendBuffer,
  71 + DWORD dwSendDataLength,
  72 + LPDWORD lpdwBytesSent,
  73 + LPOVERLAPPED lpOverlapped);
  74 +
  75 + typedef void PASCAL (*LPFN_GETACCEPTEXSOCKADDRS)
  76 + (PVOID lpOutputBuffer,
  77 + DWORD dwReceiveDataLength,
  78 + DWORD dwLocalAddressLength,
  79 + DWORD dwRemoteAddressLength,
  80 + LPSOCKADDR* LocalSockaddr,
  81 + LPINT LocalSockaddrLength,
  82 + LPSOCKADDR* RemoteSockaddr,
  83 + LPINT RemoteSockaddrLength);
  84 +
  85 + typedef BOOL PASCAL (*LPFN_DISCONNECTEX)
  86 + (SOCKET hSocket,
  87 + LPOVERLAPPED lpOverlapped,
  88 + DWORD dwFlags,
  89 + DWORD reserved);
  90 +
  91 + typedef BOOL PASCAL (*LPFN_TRANSMITFILE)
  92 + (SOCKET hSocket,
  93 + HANDLE hFile,
  94 + DWORD nNumberOfBytesToWrite,
  95 + DWORD nNumberOfBytesPerSend,
  96 + LPOVERLAPPED lpOverlapped,
  97 + LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
  98 + DWORD dwFlags);
  99 +#endif
  100 +
  101 +/*
  102 + * MinGW is missing this too
  103 + */
  104 +#ifndef SO_UPDATE_CONNECT_CONTEXT
  105 +# define SO_UPDATE_CONNECT_CONTEXT 0x7010
  106 +#endif
  107 +
  108 +
  109 +/* Winsock extension functions (ipv4) */
  110 +extern LPFN_CONNECTEX pConnectEx;
  111 +extern LPFN_ACCEPTEX pAcceptEx;
  112 +extern LPFN_GETACCEPTEXSOCKADDRS pGetAcceptExSockAddrs;
  113 +extern LPFN_DISCONNECTEX pDisconnectEx;
  114 +extern LPFN_TRANSMITFILE pTransmitFile;
  115 +
  116 +/* Winsock extension functions (ipv6) */
  117 +extern LPFN_CONNECTEX pConnectEx6;
  118 +extern LPFN_ACCEPTEX pAcceptEx6;
  119 +extern LPFN_GETACCEPTEXSOCKADDRS pGetAcceptExSockAddrs6;
  120 +extern LPFN_DISCONNECTEX pDisconnectEx6;
  121 +extern LPFN_TRANSMITFILE pTransmitFile6;
  122 +
  123 +/* Whether ipv6 is supported */
  124 +extern int uv_allow_ipv6;
  125 +
  126 +/* Ip address used to bind to any port at any interface */
  127 +extern struct sockaddr_in uv_addr_ip4_any_;
  128 +extern struct sockaddr_in6 uv_addr_ip6_any_;
  129 +
  130 +#endif /* UV_WIN_WINSOCK_H_ */
2  uv.gyp
@@ -112,6 +112,8 @@
112 112 'src/win/util.c',
113 113 'src/win/winapi.c',
114 114 'src/win/winapi.h',
  115 + 'src/win/winsock.c',
  116 + 'src/win/winsock.h',
115 117 ],
116 118 'link_settings': {
117 119 'libraries': [

0 comments on commit d1a63c4

Please sign in to comment.
Something went wrong with that request. Please try again.