WinSvc.cc File Reference
#include "squid.h"
#include "debug/Stream.h"
#include "globals.h"
#include "protos.h"
#include "SquidConfig.h"
#include "tools.h"
#include "WinSvc.h"
Include dependency graph for WinSvc.cc:

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

#define CHANGESERVICECONFIG2   "ChangeServiceConfig2A"

Definition at line 77 of file WinSvc.cc.

◆ COMMANDLINE

#define COMMANDLINE   "CommandLine"

Definition at line 70 of file WinSvc.cc.

◆ CONFIGFILE

#define CONFIGFILE   "ConfigFile"

Definition at line 71 of file WinSvc.cc.

◆ NOTIFYADDRCHANGE

#define NOTIFYADDRCHANGE   "NotifyAddrChange"

Definition at line 55 of file WinSvc.cc.

◆ SOFTWARE

#define SOFTWARE   "SOFTWARE"

Definition at line 68 of file WinSvc.cc.

◆ SOFTWARENAME

#define SOFTWARENAME   PACKAGE_NAME

Definition at line 66 of file WinSvc.cc.

◆ VENDOR

#define VENDOR   "squid-cache.org"

Definition at line 64 of file WinSvc.cc.

Typedef Documentation

◆ PFChangeServiceConfig2

typedef BOOL(WINAPI * PFChangeServiceConfig2) (SC_HANDLE, DWORD, LPVOID)

Definition at line 73 of file WinSvc.cc.

◆ PFNotifyAddrChange

typedef DWORD(WINAPI * PFNotifyAddrChange) (OUT PHANDLE, IN LPOVERLAPPED)

Definition at line 54 of file WinSvc.cc.

Function Documentation

◆ GetOSVersion()

static unsigned int GetOSVersion ( )
static

Definition at line 285 of file WinSvc.cc.

References BOOL, safe_free, and xstrdup.

Referenced by WIN32_Subsystem_Init().

◆ 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()

void WIN32_Abort ( int  sig)
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 void WIN32_build_argv ( char *  cmd)
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 int WIN32_create_key ( void  )
static

Definition at line 101 of file WinSvc.cc.

References keys, and NULL.

Referenced by WIN32_StoreKey().

◆ WIN32_ExceptionHandlerCleanup()

void WIN32_ExceptionHandlerCleanup ( void  )

Referenced by WIN32_Exit().

◆ WIN32_Exit()

void WIN32_Exit ( void  )
static

◆ WIN32_InstallService()

◆ WIN32_IpAddrChangeMonitor()

static DWORD WINAPI WIN32_IpAddrChangeMonitor ( LPVOID  lpParam)
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 ( )

◆ WIN32_RemoveService()

void WIN32_RemoveService ( void  )

◆ 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()

int WIN32_StartService ( int  argc,
char **  argv 
)

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 int WIN32_StoreKey ( const char *  key,
DWORD  type,
unsigned char *  value,
int  value_size 
)
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()

◆ WIN32_svcHandler()

void WINAPI WIN32_svcHandler ( DWORD  Opcode)

◆ 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 void Win32SockCleanup ( void  )
static

Definition at line 981 of file WinSvc.cc.

References s_iInitCount.

Referenced by main(), IcmpPinger::Open(), and WIN32_Exit().

◆ Win32SockInit()

static int Win32SockInit ( void  )
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

char* keys[]
static
Initial value:
= {
nullptr,
}
static char VENDORString[]
Definition: WinSvc.cc:65
static char SOFTWARENAMEString[]
Definition: WinSvc.cc:67
static char SOFTWAREString[]
Definition: WinSvc.cc:69
#define NULL
Definition: types.h:145

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

HANDLE NotifyAddrChange_thread = INVALID_HANDLE_VALUE
static

Definition at line 51 of file WinSvc.cc.

Referenced by WIN32_IpAddrChangeMonitorExit(), and WIN32_IpAddrChangeMonitorInit().

◆ REGKEY

◆ s_iInitCount

int s_iInitCount = 0
static

Definition at line 50 of file WinSvc.cc.

Referenced by Win32SockCleanup(), and Win32SockInit().

◆ SOFTWARENAMEString

char SOFTWARENAMEString[] = SOFTWARENAME
static

Definition at line 67 of file WinSvc.cc.

◆ SOFTWAREString

char SOFTWAREString[] = SOFTWARE
static

Definition at line 69 of file WinSvc.cc.

◆ Squid_Aborting

int Squid_Aborting = 0
static

Definition at line 92 of file WinSvc.cc.

Referenced by WIN32_Abort(), and WIN32_Exit().

◆ Squid_SCAction

SC_ACTION Squid_SCAction[] = { { SC_ACTION_RESTART, 60000 } }
static

Definition at line 79 of file WinSvc.cc.

◆ Squid_ServiceDescription

SERVICE_DESCRIPTION Squid_ServiceDescription = { Squid_ServiceDescriptionString }
static

Definition at line 81 of file WinSvc.cc.

Referenced by WIN32_InstallService().

◆ Squid_ServiceDescriptionString

char Squid_ServiceDescriptionString[] = SOFTWARENAME " " VERSION " WWW Proxy Server"
static

Definition at line 80 of file WinSvc.cc.

◆ Squid_ServiceFailureActions

SERVICE_FAILURE_ACTIONS Squid_ServiceFailureActions = { INFINITE, nullptr, nullptr, 1, Squid_SCAction }
static

Definition at line 82 of file WinSvc.cc.

Referenced by WIN32_InstallService().

◆ svcHandle

SERVICE_STATUS_HANDLE svcHandle
static

◆ svcStatus

SERVICE_STATUS svcStatus
static

◆ VENDORString

char VENDORString[] = VENDOR
static

Definition at line 65 of file WinSvc.cc.

◆ WIN32_argc

int WIN32_argc
static

Definition at line 60 of file WinSvc.cc.

Referenced by WIN32_build_argv(), and WIN32_Subsystem_Init().

◆ WIN32_argv

char** WIN32_argv
static

Definition at line 61 of file WinSvc.cc.

Referenced by WIN32_build_argv(), and WIN32_Subsystem_Init().

◆ WIN32_module_name

char* WIN32_module_name
static

Definition at line 62 of file WinSvc.cc.

Referenced by WIN32_build_argv(), and WIN32_Subsystem_Init().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors