]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Windows: document the purpose and use of Squid namespace wrappers
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 8 Sep 2013 03:17:25 +0000 (21:17 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 8 Sep 2013 03:17:25 +0000 (21:17 -0600)
Also, add some missing #define's

  This is an iCelero project

compat/os/mswindows.h

index a31c36af0d2467150cad0002732eb1a6a0a6651b..95edff63e5a2ea5203ea66323f14ec34839538a4 100644 (file)
@@ -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 */