--------------------- PatchSet 720 Date: 2003/05/01 21:45:43 Author: serassio Branch: nt Tag: (none) Log: Various Win32 specific fixes, temporary workaround for namespace problems on socket related functions Members: port/win32/include/squid-mswin.h:1.3.18.2->1.3.18.3 Index: squid3/port/win32/include/squid-mswin.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/port/win32/include/Attic/squid-mswin.h,v retrieving revision 1.3.18.2 retrieving revision 1.3.18.3 diff -u -r1.3.18.2 -r1.3.18.3 --- squid3/port/win32/include/squid-mswin.h 13 Mar 2003 21:02:08 -0000 1.3.18.2 +++ squid3/port/win32/include/squid-mswin.h 1 May 2003 21:45:43 -0000 1.3.18.3 @@ -1,5 +1,5 @@ /* - * $Id: squid-mswin.h,v 1.3.18.2 2003/03/13 21:02:08 serassio Exp $ + * $Id: squid-mswin.h,v 1.3.18.3 2003/05/01 21:45:43 serassio Exp $ * * AUTHOR: Guido Serassio & Andrey Shorin * @@ -329,6 +329,12 @@ return _write(fd, buf, siz); } +inline +char *index(const char *s, int c) +{ + return strchr(s,c); +} + namespace Squid { inline @@ -343,6 +349,7 @@ else return _open_osfhandle(result, 0); } +#define accept(s,a,l) Squid::accept(s,a,l) inline int bind(int s, struct sockaddr * n, int l) @@ -354,6 +361,7 @@ else return 0; } +#define bind(s,n,l) Squid::bind(s,n,l) inline int connect(int s, const struct sockaddr * n, int l) @@ -375,6 +383,7 @@ errno = WSAGetLastError(); return result; } +#define gethostbyname(n) Squid::gethostbyname(n) inline SERVENT FAR* getservbyname (const char * n, const char * p) @@ -384,6 +393,7 @@ errno = WSAGetLastError(); return result; } +#define getservbyname(n,p) Squid::getservbyname(n,p) inline HOSTENT FAR * gethostbyaddr(const char * a, int l, int t) @@ -393,6 +403,7 @@ errno = WSAGetLastError(); return result; } +#define gethostbyaddr(a,l,t) Squid::gethostbyaddr(a,l,t) inline int getsockname(int s, struct sockaddr * n, int * l) @@ -415,6 +426,7 @@ else return 0; } +#define gethostname(n,l) Squid::gethostname(n,l) inline int getsockopt(int s, int l, int o, void * v, int * n) @@ -462,6 +474,7 @@ else return 0; } +#define listen(s,b) Squid::listen(s,b) inline int recv(int s, void * b, size_t l, int f) @@ -474,6 +487,7 @@ else return result; } +#define recv(s,b,l,f) Squid::recv(s,b,l,f) inline int recvfrom(int s, void * b, size_t l, int f, struct sockaddr * fr, int FAR * fl) @@ -486,6 +500,7 @@ else return result; } +#define recvfrom(s,b,l,f,fr,fl) Squid::recvfrom(s,b,l,f,fr,fl) inline int select(int n, fd_set * r, fd_set * w, fd_set * e, struct timeval * t) @@ -498,6 +513,7 @@ else return result; } +#define select(n,r,w,e,t) Squid::select(n,r,w,e,t) inline int send(int s, const void * b, size_t l, int f) @@ -510,6 +526,7 @@ else return result; } +#define send(s,b,l,f) Squid::send(s,b,l,f) inline int sendto(int s, const void * b, size_t l, int f, const struct sockaddr * t, int tl) @@ -522,9 +539,10 @@ else return result; } +#define sendto(s,b,l,f,t,tl) Squid::sendto(s,b,l,f,t,tl) inline -int setsockopt(int s, int l, int o, const void * v, int n) +int setsockopt(SOCKET s, int l, int o, const void * v, int n) { if (::setsockopt(_get_osfhandle(s), l, o, (const char *)v, n) == SOCKET_ERROR) { errno = WSAGetLastError(); @@ -544,6 +562,7 @@ else return 0; } +#define shutdown(s,h) Squid::shutdown(s,h) inline int socket(int f, int t, int p) @@ -557,6 +576,7 @@ else return _open_osfhandle(result, 0); } +#define socket(f,t,p) Squid::socket(f,t,p) inline int WSAAsyncSelect(int s, HWND h, unsigned int w, long e) @@ -569,10 +589,15 @@ return 0; } +#undef WSADuplicateSocket inline int WSADuplicateSocket(int s, DWORD n, LPWSAPROTOCOL_INFO l) { - if (::WSADuplicateSocket(_get_osfhandle(s), n, l) == SOCKET_ERROR) { +#ifdef UNICODE + if (::WSADuplicateSocketW(_get_osfhandle(s), n, l) == SOCKET_ERROR) { +#else + if (::WSADuplicateSocketA(_get_osfhandle(s), n, l) == SOCKET_ERROR) { +#endif errno = WSAGetLastError(); return -1; } @@ -580,11 +605,16 @@ return 0; } +#undef WSASocket inline int WSASocket(int a, int t, int p, LPWSAPROTOCOL_INFO i, GROUP g, DWORD f) { SOCKET result; - if ((result = ::WSASocket(a, t, p, i, g, f)) == INVALID_SOCKET) { +#ifdef UNICODE + if ((result = ::WSASocketW(a, t, p, i, g, f)) == INVALID_SOCKET) { +#else + if ((result = ::WSASocketA(a, t, p, i, g, f)) == INVALID_SOCKET) { +#endif if (WSAEMFILE == (errno = WSAGetLastError())) errno = EMFILE; return -1;