#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.am,v 1.69 2003/03/15 04:26:07 robertc Exp $
+# $Id: Makefile.am,v 1.70 2003/04/22 15:06:09 hno Exp $
#
# Uncomment and customize the following to suit your needs:
#
Store.cci \
String.cci \
SquidString.h \
- ufscommon.cci
+ ufscommon.cci \
+ squid_windows.h
nodist_squid_SOURCES = \
repl_modules.cc \
/*
- * $Id: dns_internal.cc,v 1.57 2003/03/09 12:29:41 robertc Exp $
+ * $Id: dns_internal.cc,v 1.58 2003/04/22 15:06:09 hno Exp $
*
* DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c
* AUTHOR: Duane Wessels
*/
#ifndef USE_DNSSERVERS
#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
-#include <windows.h>
+#include "squid_windows.h"
#endif
#ifndef _PATH_RESOLV_CONF
#define _PATH_RESOLV_CONF "/etc/resolv.conf"
/*
- * $Id: globals.h,v 1.122 2003/04/20 05:28:58 robertc Exp $
+ * $Id: globals.h,v 1.123 2003/04/22 15:06:09 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
extern int ssl_ex_index_server; /* -1 */
extern int ssl_ctx_ex_index_dont_verify_domain; /* -1 */
+extern int opt_no_daemon; /* 0 */
#endif /* SQUID_GLOBALS_H */
/*
- * $Id: main.cc,v 1.371 2003/04/21 12:52:40 hno Exp $
+ * $Id: main.cc,v 1.372 2003/04/22 15:06:10 hno Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
#include "ACLASN.h"
#include "ACL.h"
+#if USE_WIN32_SERVICE
+
+#include "squid_windows.h"
+#include <process.h>
+
+static int opt_install_service = FALSE;
+static int opt_remove_service = FALSE;
+static int opt_signal_service = FALSE;
+static int opt_command_line = FALSE;
+extern void WIN32_svcstatusupdate(DWORD, DWORD);
+void WINAPI WIN32_svcHandler(DWORD);
+
+#endif
+
/* for error reporting from xmalloc and friends */
SQUIDCEXTERN void (*failure_notify) (const char *);
static int opt_send_signal = -1;
-static int opt_no_daemon = 0;
static int opt_parse_cfg_only = 0;
static int icpPortNumOverride = 1; /* Want to detect "-u 0" */
static int configured_once = 0;
case 'v':
printf("Squid Cache: Version %s\nconfigure options: %s\n", version_string, SQUID_CONFIGURE_OPTIONS);
+#if USE_WIN32_SERVICE
+
+ printf("Compiled as Windows System Service.\n");
+
+#endif
+
exit(0);
/* NOTREACHED */
#endif
storeDirSync(); /* Flush log close */
+ storeFsDone();
#if PURIFY || XMALLOC_TRACE
- storeFsDone();
configFreeMemory();
storeFreeMemory();
/*stmemFreeMemory(); */
/*
- * $Id: stat.cc,v 1.372 2003/03/15 04:17:41 robertc Exp $
+ * $Id: stat.cc,v 1.373 2003/04/22 15:06:10 hno Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
storeAppendPrintf(sentry, "Squid Object Cache: Version %s\n",
version_string);
+#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
+
+ if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) {
+ storeAppendPrintf(sentry,"\nRunning as %s Windows System Service on %s\n",
+ WIN32_Service_name, WIN32_OS_string);
+ storeAppendPrintf(sentry,"Service command line is: %s\n", WIN32_Service_Command_Line);
+ } else
+ storeAppendPrintf(sentry,"Running on %s\n",WIN32_OS_string);
+
+#endif
+
storeAppendPrintf(sentry, "Start Time:\t%s\n",
mkrfc1123(squid_start.tv_sec));
statMemoryAccounted() >> 10);
#endif
-
{
MemPoolGlobalStats mp_stats;
memPoolGetGlobalStats(&mp_stats);
/*
- * $Id: win32.cc,v 1.8 2003/04/21 12:54:10 hno Exp $
+ * $Id: win32.cc,v 1.9 2003/04/22 15:06:11 hno Exp $
*
* * * * * * * * Legal stuff * * * * * * *
*
#include "squid.h"
-/* This code compiles only on Cygwin & Windows NT Port */
-#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
#include "squid_windows.h"
static unsigned int GetOSVersion();
void WIN32_svcstatusupdate(DWORD, DWORD);
void WINAPI WIN32_svcHandler(DWORD);
-#ifdef USE_WIN32_SERVICE
+#if USE_WIN32_SERVICE
static int WIN32_StoreKey(const char *, DWORD, unsigned char *, int);
static int WIN32_create_key(void);
static void WIN32_build_argv (char *);
#endif
extern "C" void WINAPI SquidMain(DWORD, char **);
-#ifdef USE_WIN32_SERVICE
+#if USE_WIN32_SERVICE
static SERVICE_STATUS svcStatus;
static SERVICE_STATUS_HANDLE svcHandle;
static int WIN32_argc;
#else
#define CHANGESERVICECONFIG2 "ChangeServiceConfig2A"
#endif
-#ifdef USE_WIN32_SERVICE
+#if USE_WIN32_SERVICE
static SC_ACTION Squid_SCAction[] = { { SC_ACTION_RESTART, 60000 } };
static char Squid_ServiceDescriptionString[] = SOFTWARENAME " " VERSION " WWW Proxy Server";
static SERVICE_DESCRIPTION Squid_ServiceDescription = { Squid_ServiceDescriptionString };
/* LOCAL FUNCTIONS */
/* ====================================================================== */
-#ifdef USE_WIN32_SERVICE
+#if USE_WIN32_SERVICE
static int
WIN32_create_key(void)
{
return _WIN_OS_UNKNOWN;
}
-#ifdef USE_WIN32_SERVICE
+#if USE_WIN32_SERVICE
/* Build argv, argc from string passed from Windows. */
static void WIN32_build_argv(char *cmd)
{
void
WIN32_Abort(int sig)
{
-#ifdef USE_WIN32_SERVICE
+#if USE_WIN32_SERVICE
svcStatus.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR;
svcStatus.dwServiceSpecificExitCode = 1;
#endif
void
WIN32_Exit()
{
-#ifdef USE_WIN32_SERVICE
+#if USE_WIN32_SERVICE
if (!Squid_Aborting) {
svcStatus.dwCurrentState = SERVICE_STOPPED;
_exit(0);
}
-#ifdef USE_WIN32_SERVICE
+#if USE_WIN32_SERVICE
int WIN32_Subsystem_Init(int * argc, char *** argv)
#else
int
if (atexit(WIN32_Exit) != 0)
return 1;
-#ifdef USE_WIN32_SERVICE
+#if USE_WIN32_SERVICE
if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE)
{
return 0;
}
-#ifdef USE_WIN32_SERVICE
+#if USE_WIN32_SERVICE
void
WIN32_svcstatusupdate(DWORD svcstate, DWORD WaitHint)
{
if ((argc == 2) && strstr(argv[1], _WIN_SQUID_SERVICE_OPTION)) {
WIN32_run_mode = _WIN_SQUID_RUN_MODE_SERVICE;
+ opt_no_daemon = 1;
if (!(c=strchr(argv[1],':'))) {
fprintf(stderr, "Bad Service Parameter: %s\n", argv[1]);
#endif /* USE_WIN32_SERVICE */
-#endif /* defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) */
-
#endif /* WIN32_C */