#include "squid.h"
#include "debug/Stream.h"
#include "globals.h"
#include "protos.h"
#include "SquidConfig.h"
#include "tools.h"
#include "WinSvc.h"
Go to the source code of this file.
Macros | |
#define | NOTIFYADDRCHANGE "NotifyAddrChange" |
#define | VENDOR "squid-cache.org" |
#define | SOFTWARENAME PACKAGE_NAME |
#define | SOFTWARE "SOFTWARE" |
#define | COMMANDLINE "CommandLine" |
#define | CONFIGFILE "ConfigFile" |
#define | CHANGESERVICECONFIG2 "ChangeServiceConfig2A" |
Typedefs | |
typedef DWORD(WINAPI * | PFNotifyAddrChange) (OUT PHANDLE, IN LPOVERLAPPED) |
typedef BOOL(WINAPI * | PFChangeServiceConfig2) (SC_HANDLE, DWORD, LPVOID) |
Functions | |
static void | WIN32_Exit (void) |
static unsigned int | GetOSVersion () |
void | WIN32_svcstatusupdate (DWORD, DWORD) |
void WINAPI | WIN32_svcHandler (DWORD) |
void WINAPI | SquidWinSvcMain (DWORD, char **) |
static void | WIN32_Abort (int) |
static int | WIN32_StoreKey (const char *, DWORD, unsigned char *, int) |
static int | WIN32_create_key (void) |
static void | WIN32_build_argv (char *) |
static int | Win32SockInit (void) |
static void | Win32SockCleanup (void) |
void | WIN32_ExceptionHandlerCleanup (void) |
void | WIN32_IpAddrChangeMonitorExit () |
static DWORD WINAPI | WIN32_IpAddrChangeMonitor (LPVOID lpParam) |
DWORD | WIN32_IpAddrChangeMonitorInit () |
int | WIN32_Subsystem_Init (int *argc, char ***argv) |
void | WIN32_RemoveService () |
void | WIN32_SetServiceCommandLine () |
void | WIN32_InstallService () |
void | WIN32_sendSignal (int WIN32_signal) |
int | WIN32_StartService (int argc, char **argv) |
void | Squid_Win32InvalidParameterHandler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t pReserved) |
Variables | |
SQUIDCEXTERN LPCRITICAL_SECTION | dbg_mutex |
static int | s_iInitCount = 0 |
static HANDLE | NotifyAddrChange_thread = INVALID_HANDLE_VALUE |
static SERVICE_STATUS | svcStatus |
static SERVICE_STATUS_HANDLE | svcHandle |
static int | WIN32_argc |
static char ** | WIN32_argv |
static char * | WIN32_module_name |
static char | VENDORString [] = VENDOR |
static char | SOFTWARENAMEString [] = SOFTWARENAME |
static char | SOFTWAREString [] = SOFTWARE |
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 } |
static SERVICE_FAILURE_ACTIONS | Squid_ServiceFailureActions = { INFINITE, nullptr, nullptr, 1, Squid_SCAction } |
static char | REGKEY [256] = SOFTWARE "\\" VENDOR "\\" SOFTWARENAME "\\" |
static char * | keys [] |
static int | Squid_Aborting = 0 |
Macro Definition Documentation
◆ CHANGESERVICECONFIG2
◆ COMMANDLINE
◆ CONFIGFILE
◆ NOTIFYADDRCHANGE
◆ SOFTWARE
◆ SOFTWARENAME
◆ VENDOR
Typedef Documentation
◆ PFChangeServiceConfig2
typedef BOOL(WINAPI * PFChangeServiceConfig2) (SC_HANDLE, DWORD, LPVOID) |
◆ PFNotifyAddrChange
typedef DWORD(WINAPI * PFNotifyAddrChange) (OUT PHANDLE, IN LPOVERLAPPED) |
Function Documentation
◆ GetOSVersion()
|
static |
◆ Squid_Win32InvalidParameterHandler()
void Squid_Win32InvalidParameterHandler | ( | const wchar_t * | expression, |
const wchar_t * | function, | ||
const wchar_t * | file, | ||
unsigned int | line, | ||
uintptr_t | pReserved | ||
) |
Definition at line 989 of file WinSvc.cc.
Referenced by WIN32_Subsystem_Init().
◆ SquidWinSvcMain()
void WINAPI SquidWinSvcMain | ( | DWORD | , |
char ** | |||
) |
Referenced by WIN32_StartService().
◆ WIN32_Abort()
|
static |
Definition at line 375 of file WinSvc.cc.
References Squid_Aborting, svcStatus, and WIN32_Exit().
Referenced by WIN32_Subsystem_Init().
◆ WIN32_build_argv()
|
static |
Definition at line 238 of file WinSvc.cc.
References WIN32_argc, WIN32_argv, WIN32_module_name, xisspace, xmalloc, xrealloc(), and xstrdup.
Referenced by WIN32_Subsystem_Init().
◆ WIN32_create_key()
|
static |
Definition at line 101 of file WinSvc.cc.
Referenced by WIN32_StoreKey().
◆ WIN32_ExceptionHandlerCleanup()
void WIN32_ExceptionHandlerCleanup | ( | void | ) |
Referenced by WIN32_Exit().
◆ WIN32_Exit()
|
static |
Definition at line 396 of file WinSvc.cc.
References dbg_mutex, Squid_Aborting, svcHandle, svcStatus, WIN32_ExceptionHandlerCleanup(), WIN32_IpAddrChangeMonitorExit(), and Win32SockCleanup().
Referenced by WIN32_Abort(), and WIN32_Subsystem_Init().
◆ WIN32_InstallService()
void WIN32_InstallService | ( | void | ) |
Definition at line 719 of file WinSvc.cc.
References APP_SHORTNAME, SBuf::c_str(), CHANGESERVICECONFIG2, ConfigFile, CONFIGFILE, SBuf::isEmpty(), keys, REGKEY, service_name, Squid_ServiceDescription, Squid_ServiceFailureActions, SQUIDSBUFPH, SQUIDSBUFPRINT, version_string, WIN32_StoreKey(), and xstrdup.
Referenced by SquidMain().
◆ WIN32_IpAddrChangeMonitor()
|
static |
Definition at line 418 of file WinSvc.cc.
References DBG_IMPORTANT, debugs, NOTIFYADDRCHANGE, NULL, and reconfigure().
Referenced by WIN32_IpAddrChangeMonitorInit().
◆ WIN32_IpAddrChangeMonitorExit()
void WIN32_IpAddrChangeMonitorExit | ( | ) |
Definition at line 385 of file WinSvc.cc.
References NotifyAddrChange_thread.
Referenced by WIN32_Exit().
◆ WIN32_IpAddrChangeMonitorInit()
DWORD WIN32_IpAddrChangeMonitorInit | ( | ) |
Definition at line 441 of file WinSvc.cc.
References Config, DBG_IMPORTANT, debugs, NotifyAddrChange_thread, NULL, SquidConfig::onoff, SquidConfig::WIN32_IpAddrChangeMonitor, and WIN32_IpAddrChangeMonitor().
Referenced by mainInitialize().
◆ WIN32_RemoveService()
void WIN32_RemoveService | ( | void | ) |
Definition at line 648 of file WinSvc.cc.
References APP_SHORTNAME, SBuf::c_str(), SBuf::isEmpty(), keys, NULL, REGKEY, service_name, SQUIDSBUFPH, SQUIDSBUFPRINT, and svcStatus.
Referenced by SquidMain().
◆ WIN32_sendSignal()
void WIN32_sendSignal | ( | int | WIN32_signal | ) |
Definition at line 799 of file WinSvc.cc.
References APP_SHORTNAME, SBuf::c_str(), SBuf::isEmpty(), NULL, service_name, SQUIDSBUFPH, and SQUIDSBUFPRINT.
Referenced by sendSignal().
◆ WIN32_SetServiceCommandLine()
void WIN32_SetServiceCommandLine | ( | void | ) |
Definition at line 704 of file WinSvc.cc.
References APP_SHORTNAME, SBuf::c_str(), COMMANDLINE, SBuf::isEmpty(), keys, REGKEY, service_name, and WIN32_StoreKey().
Referenced by SquidMain().
◆ WIN32_StartService()
Definition at line 894 of file WinSvc.cc.
References SBuf::c_str(), keys, O_TEXT, REGKEY, service_name, and SquidWinSvcMain().
Referenced by main().
◆ WIN32_StoreKey()
|
static |
Definition at line 167 of file WinSvc.cc.
References REGKEY, and WIN32_create_key().
Referenced by WIN32_InstallService(), and WIN32_SetServiceCommandLine().
◆ WIN32_Subsystem_Init()
Definition at line 459 of file WinSvc.cc.
References SBuf::c_str(), COMMANDLINE, ConfigFile, CONFIGFILE, GetOSVersion(), REGKEY, safe_free, service_name, Squid_MaxFD, Squid_Win32InvalidParameterHandler(), svcHandle, svcStatus, WIN32_Abort(), WIN32_argc, WIN32_argv, WIN32_build_argv(), WIN32_Exit(), WIN32_module_name, WIN32_svcHandler(), Win32SockInit(), xmalloc, and xstrdup.
Referenced by SquidMain().
◆ WIN32_svcHandler()
void WINAPI WIN32_svcHandler | ( | DWORD | Opcode | ) |
Definition at line 578 of file WinSvc.cc.
References DBG_IMPORTANT, debugs, reconfigure(), rotate_logs(), shut_down(), sigusr2_handle(), svcHandle, and svcStatus.
Referenced by WIN32_Subsystem_Init().
◆ WIN32_svcstatusupdate()
void WIN32_svcstatusupdate | ( | DWORD | svcstate, |
DWORD | WaitHint | ||
) |
Definition at line 567 of file WinSvc.cc.
References svcHandle, and svcStatus.
Referenced by SignalEngine::doShutdown(), SquidMain(), and SquidShutdown().
◆ Win32SockCleanup()
|
static |
Definition at line 981 of file WinSvc.cc.
References s_iInitCount.
Referenced by main(), IcmpPinger::Open(), and WIN32_Exit().
◆ Win32SockInit()
|
static |
Definition at line 930 of file WinSvc.cc.
References s_iInitCount.
Referenced by main(), and WIN32_Subsystem_Init().
Variable Documentation
◆ dbg_mutex
SQUIDCEXTERN LPCRITICAL_SECTION dbg_mutex |
Definition at line 48 of file WinSvc.cc.
Referenced by Debug::LogMessage(), and WIN32_Exit().
◆ keys
|
static |
Definition at line 84 of file WinSvc.cc.
Referenced by Security::ServerOptions::createStaticServerContext(), Ssl::InitClientContext(), Notes::ReservedKeys(), WIN32_create_key(), WIN32_InstallService(), WIN32_RemoveService(), WIN32_SetServiceCommandLine(), and WIN32_StartService().
◆ NotifyAddrChange_thread
|
static |
Definition at line 51 of file WinSvc.cc.
Referenced by WIN32_IpAddrChangeMonitorExit(), and WIN32_IpAddrChangeMonitorInit().
◆ REGKEY
|
static |
Definition at line 83 of file WinSvc.cc.
Referenced by WIN32_InstallService(), WIN32_RemoveService(), WIN32_SetServiceCommandLine(), WIN32_StartService(), WIN32_StoreKey(), and WIN32_Subsystem_Init().
◆ s_iInitCount
|
static |
Definition at line 50 of file WinSvc.cc.
Referenced by Win32SockCleanup(), and Win32SockInit().
◆ SOFTWARENAMEString
|
static |
◆ SOFTWAREString
◆ Squid_Aborting
|
static |
Definition at line 92 of file WinSvc.cc.
Referenced by WIN32_Abort(), and WIN32_Exit().
◆ Squid_SCAction
|
static |
◆ Squid_ServiceDescription
|
static |
Definition at line 81 of file WinSvc.cc.
Referenced by WIN32_InstallService().
◆ Squid_ServiceDescriptionString
|
static |
◆ Squid_ServiceFailureActions
|
static |
Definition at line 82 of file WinSvc.cc.
Referenced by WIN32_InstallService().
◆ svcHandle
|
static |
Definition at line 59 of file WinSvc.cc.
Referenced by WIN32_Exit(), WIN32_Subsystem_Init(), WIN32_svcHandler(), and WIN32_svcstatusupdate().
◆ svcStatus
|
static |
Definition at line 58 of file WinSvc.cc.
Referenced by WIN32_Abort(), WIN32_Exit(), WIN32_RemoveService(), WIN32_Subsystem_Init(), WIN32_svcHandler(), and WIN32_svcstatusupdate().
◆ VENDORString
◆ WIN32_argc
|
static |
Definition at line 60 of file WinSvc.cc.
Referenced by WIN32_build_argv(), and WIN32_Subsystem_Init().
◆ WIN32_argv
|
static |
Definition at line 61 of file WinSvc.cc.
Referenced by WIN32_build_argv(), and WIN32_Subsystem_Init().
◆ WIN32_module_name
|
static |
Definition at line 62 of file WinSvc.cc.
Referenced by WIN32_build_argv(), and WIN32_Subsystem_Init().