From: Amos Jeffries Date: Wed, 11 Sep 2013 01:02:54 +0000 (-0600) Subject: Windows: document the purpose and use of Squid namespace wrappers X-Git-Tag: SQUID_3_3_10~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f81dacd06e68cc3592d2a33b5ca1e873d58e028f;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/mswin.h b/compat/os/mswin.h index d61e3f2b5b..f89e617d6e 100644 --- a/compat/os/mswin.h +++ b/compat/os/mswin.h @@ -436,6 +436,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, size_t * l) { @@ -666,6 +678,7 @@ int 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 @@ -681,6 +694,7 @@ int WSADuplicateSocket(int s, DWORD n, LPWSAPROTOCOL_INFO l) } else return 0; } +#define WSADuplicateSocket(s,n,l) Squid::WSADuplicateSocket(s,n,l) #undef WSASocket inline @@ -698,6 +712,7 @@ int 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 */