WinSvc.cc File Reference
#include "squid.h"
#include "Debug.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 IN LPOVERLAPPED
 

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)
 
typedef DWORD (WINAPI *PFNotifyAddrChange)(OUT PHANDLE
 
typedef BOOL (WINAPI *PFChangeServiceConfig2)(SC_HANDLE
 
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
 
typedef DWORD
 
typedef LPVOID
 
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, NULL, NULL, 1, Squid_SCAction }
 
static char REGKEY [256] = SOFTWARE "\\" VENDOR "\\" SOFTWARENAME "\\"
 
static char * keys []
 
static int Squid_Aborting = 0
 

Macro Definition Documentation

#define CHANGESERVICECONFIG2   "ChangeServiceConfig2A"

Definition at line 77 of file WinSvc.cc.

Referenced by WIN32_InstallService().

#define COMMANDLINE   "CommandLine"

Definition at line 70 of file WinSvc.cc.

Referenced by WIN32_SetServiceCommandLine(), and WIN32_Subsystem_Init().

#define CONFIGFILE   "ConfigFile"

Definition at line 71 of file WinSvc.cc.

Referenced by WIN32_InstallService(), and WIN32_Subsystem_Init().

#define NOTIFYADDRCHANGE   "NotifyAddrChange"

Definition at line 55 of file WinSvc.cc.

Referenced by WIN32_IpAddrChangeMonitor().

#define SOFTWARE   "SOFTWARE"

Definition at line 68 of file WinSvc.cc.

#define SOFTWARENAME   PACKAGE_NAME

Definition at line 66 of file WinSvc.cc.

#define VENDOR   "squid-cache.org"

Definition at line 64 of file WinSvc.cc.

Typedef Documentation

typedef IN LPOVERLAPPED

Definition at line 54 of file WinSvc.cc.

Function Documentation

typedef BOOL ( WINAPI *  PFChangeServiceConfig2)
typedef DWORD ( WINAPI *  PFNotifyAddrChange)
static unsigned int GetOSVersion ( )
static

Definition at line 285 of file WinSvc.cc.

References BOOL(), safe_free, and xstrdup.

Referenced by WIN32_Subsystem_Init().

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

void WINAPI SquidWinSvcMain ( DWORD  ,
char **   
)

Referenced by WIN32_StartService().

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

static void WIN32_build_argv ( char *  cmd)
static

Definition at line 238 of file WinSvc.cc.

References NULL, WIN32_argc, WIN32_argv, WIN32_module_name, xisspace, xmalloc, xrealloc(), and xstrdup.

Referenced by WIN32_Subsystem_Init().

static int WIN32_create_key ( void  )
static

Definition at line 101 of file WinSvc.cc.

References keys, and NULL.

Referenced by WIN32_StoreKey().

void WIN32_ExceptionHandlerCleanup ( void  )

Referenced by WIN32_Exit().

void WIN32_Exit ( void  )
static
static DWORD WINAPI WIN32_IpAddrChangeMonitor ( LPVOID  lpParam)
static

Definition at line 418 of file WinSvc.cc.

References DBG_IMPORTANT, debugs, DWORD, NOTIFYADDRCHANGE, NULL, and reconfigure().

Referenced by WIN32_IpAddrChangeMonitorInit().

void WIN32_IpAddrChangeMonitorExit ( )

Definition at line 385 of file WinSvc.cc.

References DWORD, and NotifyAddrChange_thread.

Referenced by WIN32_Exit().

void WIN32_RemoveService ( void  )
void WIN32_sendSignal ( int  WIN32_signal)

Definition at line 799 of file WinSvc.cc.

References APP_SHORTNAME, SBuf::c_str(), DWORD, SBuf::isEmpty(), NULL, service_name, SQUIDSBUFPH, and SQUIDSBUFPRINT.

Referenced by sendSignal().

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

int WIN32_StartService ( int  argc,
char **  argv 
)

Definition at line 894 of file WinSvc.cc.

References SBuf::c_str(), keys, NULL, O_TEXT, REGKEY, service_name, and SquidWinSvcMain().

Referenced by main().

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 DWORD, REGKEY, and WIN32_create_key().

Referenced by WIN32_InstallService(), and WIN32_SetServiceCommandLine().

void WINAPI WIN32_svcHandler ( DWORD  Opcode)
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().

static void Win32SockCleanup ( void  )
static

Definition at line 981 of file WinSvc.cc.

References s_iInitCount.

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

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

SQUIDCEXTERN LPCRITICAL_SECTION dbg_mutex

Definition at line 48 of file WinSvc.cc.

Referenced by _db_print(), and WIN32_Exit().

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

Definition at line 84 of file WinSvc.cc.

Referenced by Security::ServerOptions::createSigningContexts(), Ssl::InitClientContext(), Ssl::InitServerContext(), WIN32_create_key(), WIN32_InstallService(), WIN32_RemoveService(), WIN32_SetServiceCommandLine(), and WIN32_StartService().

typedef LPVOID

Definition at line 73 of file WinSvc.cc.

Referenced by GetDomainName(), and Valid_Global_Groups().

HANDLE NotifyAddrChange_thread = INVALID_HANDLE_VALUE
static

Definition at line 51 of file WinSvc.cc.

Referenced by WIN32_IpAddrChangeMonitorExit(), and WIN32_IpAddrChangeMonitorInit().

int s_iInitCount = 0
static

Definition at line 50 of file WinSvc.cc.

Referenced by Win32SockCleanup(), and Win32SockInit().

char SOFTWARENAMEString[] = SOFTWARENAME
static

Definition at line 67 of file WinSvc.cc.

char SOFTWAREString[] = SOFTWARE
static

Definition at line 69 of file WinSvc.cc.

int Squid_Aborting = 0
static

Definition at line 92 of file WinSvc.cc.

Referenced by WIN32_Abort(), and WIN32_Exit().

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

Definition at line 79 of file WinSvc.cc.

SERVICE_DESCRIPTION Squid_ServiceDescription = { Squid_ServiceDescriptionString }
static

Definition at line 81 of file WinSvc.cc.

Referenced by WIN32_InstallService().

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

Definition at line 80 of file WinSvc.cc.

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

Definition at line 82 of file WinSvc.cc.

Referenced by WIN32_InstallService().

SERVICE_STATUS_HANDLE svcHandle
static
SERVICE_STATUS svcStatus
static
char VENDORString[] = VENDOR
static

Definition at line 65 of file WinSvc.cc.

int WIN32_argc
static

Definition at line 60 of file WinSvc.cc.

Referenced by WIN32_build_argv(), and WIN32_Subsystem_Init().

char** WIN32_argv
static

Definition at line 61 of file WinSvc.cc.

Referenced by WIN32_build_argv(), and WIN32_Subsystem_Init().

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