From: Amos Jeffries Date: Sun, 8 Sep 2013 03:17:25 +0000 (-0600) Subject: Windows: document the purpose and use of Squid namespace wrappers X-Git-Tag: SQUID_3_5_0_1~647 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6538a478ccb220319e9a55b8b2923730d3410e23;p=thirdparty%2Fsquid.git Windows: document the purpose and use of Squid namespace wrappers Also, add some missing #define's This is an iCelero project --- diff --git a/compat/os/mswindows.h b/compat/os/mswindows.h index a31c36af0d..95edff63e5 100644 --- a/compat/os/mswindows.h +++ b/compat/os/mswindows.h @@ -474,6 +474,18 @@ namespace Squid { /** \endcond */ +/* + * Each of these functions is defined in the Squid namespace so as not to + * clash with the winsock.h and winsock2.h definitions. + * It is then paired with a #define to cause these wrappers to be used by + * the main code instead of those system definitions. + * + * We do this wrapper in order to: + * - cast the parameter types in only one place, and + * - record errors in POSIX errno variable, and + * - map the FD value used by Squid to the socket handes used by Windows. + */ + inline int accept(int s, struct sockaddr * a, socklen_t * l) { @@ -725,6 +737,7 @@ WSAAsyncSelect(int s, HWND h, unsigned int w, long e) } else return 0; } +#define WSAAsyncSelect(s,h,w,e) Squid::WSAAsyncSelect(s,h,w,e) #undef WSADuplicateSocket inline int @@ -740,6 +753,7 @@ WSADuplicateSocket(int s, DWORD n, LPWSAPROTOCOL_INFO l) } else return 0; } +#define WSADuplicateSocket(s,n,l) Squid::WSADuplicateSocket(s,n,l) #undef WSASocket inline int @@ -757,6 +771,7 @@ WSASocket(int a, int t, int p, LPWSAPROTOCOL_INFO i, GROUP g, DWORD f) } else return _open_osfhandle(result, 0); } +#define WSASocket(a,t,p,i,g,f) Squid::WSASocket(a,t,p,i,g,f) } /* namespace Squid */