static void _db_print_stderr(const char *format, va_list args);
static void _db_print_file(const char *format, va_list args);
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
SQUIDCEXTERN LPCRITICAL_SECTION dbg_mutex;
typedef BOOL (WINAPI * PFInitializeCriticalSectionAndSpinCount) (LPCRITICAL_SECTION, DWORD);
#endif
va_list args2;
va_list args3;
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
/* Multiple WIN32 threads may call this simultaneously */
if (!dbg_mutex) {
_db_print_syslog(format, args3);
#endif
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
LeaveCriticalSection(dbg_mutex);
#endif
i--;
snprintf(from, MAXPATHLEN, "%s.%d", debug_log_file, i - 1);
snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, i);
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
remove
(to);
#endif
* You can't rename open files on Microsoft "operating systems"
* so we close before renaming.
*/
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
if (debug_log != stderr)
fclose(debug_log);
#endif
/* Rotate the current log to .0 */
if (Debug::rotateNumber > 0) {
snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, 0);
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
remove
(to);
#endif
/*
* Max number of ICP messages to receive per call to icpHandleUdp
*/
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
#define INCOMING_ICP_MAX 1
#else
#define INCOMING_ICP_MAX 15
/*
* Max number of DNS messages to receive per call to DNS read handler
*/
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
#define INCOMING_DNS_MAX 1
#else
#define INCOMING_DNS_MAX 15
* Max number of HTTP connections to accept per call to httpAccept
* and PER HTTP PORT
*/
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
#define INCOMING_HTTP_MAX 1
#else
#define INCOMING_HTTP_MAX 10
static void idnsFreeNameservers(void);
static void idnsFreeSearchpath(void);
static void idnsParseNameservers(void);
-#if !_SQUID_MSWIN_
+#if !_SQUID_WINDOWS_
static void idnsParseResolvConf(void);
#endif
#if _SQUID_WINDOWS_
}
}
-#if !_SQUID_MSWIN_
+#if !_SQUID_WINDOWS_
static void
idnsParseResolvConf(void)
{
assert(0 == nns);
idnsParseNameservers();
-#if !_SQUID_MSWIN_
+#if !_SQUID_WINDOWS_
if (0 == nns)
idnsParseResolvConf();
}
}
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
{
WSADATA wsaData;
memset(request, '\0', REQ_SZ);
if (fgets(request, REQ_SZ, stdin) == NULL) {
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
WSACleanup();
#endif
exit(1);
extern int64_t store_maxobjsize; /* -1 */
extern hash_table *proxy_auth_username_cache; /* NULL */
extern int incoming_sockets_accepted;
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
extern unsigned int WIN32_Socks_initialized; /* 0 */
#endif
#if _SQUID_WINDOWS_
#include "fde.h"
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
#if HAVE_WINSOCK2_H
#include <winsock2.h>
uint32_t timestamp; /* not part of ICMP, but we need it */
} icmphdr;
-#endif /* _SQUID_MSWIN_ */
+#endif /* _SQUID_WINDOWS_ */
#ifndef ICMP_ECHO
#define ICMP_ECHO 8
Close();
}
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
void
Win32SockCleanup(void)
{
int
IcmpPinger::Open(void)
{
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
WSADATA wsaData;
WSAPROTOCOL_INFO wpi;
return icmp_sock;
-#else /* !_SQUID_MSWIN_ */
+#else /* !_SQUID_WINDOWS_ */
/* non-windows apps use stdin/out pipes as the squid channel(s) */
socket_from_squid = 0; // use STDIN macro ??
void
IcmpPinger::Close(void)
{
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
shutdown(icmp_sock, SD_BOTH);
close(icmp_sock);
if (localhost.SetIPv4())
SendEcho(localhost, S_ICMP_ECHO, "localhost");
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
debugs(37, 4, HERE << "Pinger handle: 0x" << std::hex << hIpc << std::dec << ", PID: " << pid);
-#endif /* _SQUID_MSWIN_ */
+#endif /* _SQUID_WINDOWS_ */
return icmp_sock;
#else /* USE_ICMP */
return -1;
debugs(37, 1, HERE << "Closing Pinger socket on FD " << icmp_sock);
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
send(icmp_sock, (const void *) "$shutdown\n", 10, 0);
comm_close(icmp_sock);
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
if (hIpc) {
if (WaitForSingleObject(hIpc, 12000) != WAIT_OBJECT_0) {
#include "Icmp6.h"
#include "IcmpPinger.h"
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
#if HAVE_WINSOCK2_H
#include <winsock2.h>
/* non-windows use STDOUT for feedback to squid */
#define LINK_TO_SQUID 1
-#endif /* _SQUID_MSWIN_ */
+#endif /* _SQUID_WINDOWS_ */
// ICMP Engines are declared global here so they can call each other easily.
IcmpPinger control;
SQUIDCEXTERN void WIN32_RemoveService(void);
SQUIDCEXTERN int SquidMain(int, char **);
#endif /* _SQUID_WINDOWS_ */
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
SQUIDCEXTERN int WIN32_pipe(int[2]);
#include "squid.h"
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
/** \cond AUTODOCS-IGNORE */
using namespace Squid;
/** \endcond */
Ssl::Lock::Lock(std::string const &aFilename) :
filename(aFilename),
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
hFile(INVALID_HANDLE_VALUE)
#else
fd(-1)
bool Ssl::Lock::locked() const
{
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
return hFile != INVALID_HANDLE_VALUE;
#else
return fd != -1;
void Ssl::Lock::lock()
{
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
hFile = CreateFile(TEXT(filename.c_str()), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
#else
throw std::runtime_error("Failed to open file " + filename);
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
if (!LockFile(hFile, 0, 0, 1, 0))
#else
if (flock(fd, LOCK_EX) != 0)
void Ssl::Lock::unlock()
{
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
if (hFile != INVALID_HANDLE_VALUE) {
UnlockFile(hFile, 0, 0, 1, 0);
CloseHandle(hFile);
const char *name() const { return filename.c_str(); }
private:
std::string filename;
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
HANDLE hFile; ///< Windows file handle.
#else
int fd; ///< Linux file descriptor.