OmniEvents
|
Singleton class that contains various methods for running a Windows service. More...
#include <daemon_windows.h>
Public Member Functions | |
Service () | |
~Service () | |
void | start (int &argc, char **&argv) |
void | tracefile (const char *val) |
Set _tracefile. More... | |
void | pidfile (const char *val) |
Set _pidfile. More... | |
void | foreground (bool val) |
Set _foreground. More... | |
void | daemonize () |
Redirects output streams to tracefile. More... | |
void | runningOk () |
Called to signal that all startup operations have completed OK. More... | |
void | shutdown () |
Exit handler set with ::on_exit() - shuts down the service. More... | |
Static Public Member Functions | |
static void | log (const char *message) |
Callback, used as a parameter to omniORB::setLogFunction(). More... | |
static void | ctrlHandler (DWORD controlCode) |
Handles control codes from the Service Control Manager. More... | |
Private Member Functions | |
void | Service::setArgcArgv (int &argc, char **&argv) |
void | install (int argc, char **argv) const |
void | uninstall () const |
void | readParameters () |
Populates _parameters from the Registry. More... | |
void | writeParameters (int argc, char **argv) const |
Writes args 2+ to the Registry. More... | |
bool | Service::setServiceStatus (DWORD currentState, DWORD win32ExitCode, DWORD serviceSpecificExitCode, DWORD checkPoint, DWORD waitHint) |
Private Attributes | |
char * | _tracefile |
The tracefile name (if any). More... | |
const char * | _regSubKey |
bool | _serviceRunning |
int | _callCount |
char * | _parameters |
Stores parameters read from the registry. More... | |
char ** | _argv |
Replacement argv array, read from registry. More... | |
std::ostream * | _logstream |
SERVICE_STATUS_HANDLE | _serviceStatusHandle |
Windows thing. More... | |
Singleton class that contains various methods for running a Windows service.
Definition at line 40 of file daemon_windows.h.
OmniEvents::Service::Service | ( | ) |
Definition at line 180 of file daemon_windows.cc.
OmniEvents::Service::~Service | ( | ) |
Definition at line 192 of file daemon_windows.cc.
References _argv, _logstream, _parameters, and _tracefile.
|
static |
Handles control codes from the Service Control Manager.
Definition at line 340 of file daemon_windows.cc.
References OmniEvents_Orb_bumpTraceLevel(), OmniEvents_Orb_shutdown(), and OmniEvents::service.
Referenced by start().
void OmniEvents::Service::daemonize | ( | ) |
Redirects output streams to tracefile.
Definition at line 292 of file daemon_windows.cc.
References _logstream, _tracefile, log(), omniORB::setLogFunction(), and OmniEvents::shutdown0().
void OmniEvents::Service::foreground | ( | bool | val | ) |
|
private |
Definition at line 383 of file daemon_windows.cc.
References _regSubKey, HERE, PACKAGE_NAME, OmniEvents::Win::perror(), OmniEvents::service, OmniEvents::RegistryKey::setValueStr(), and writeParameters().
Referenced by start().
|
static |
Callback, used as a parameter to omniORB::setLogFunction().
Definition at line 334 of file daemon_windows.cc.
References _logstream, and OmniEvents::service.
Referenced by daemonize(), foreground(), and pidfile().
void OmniEvents::Service::pidfile | ( | const char * | val | ) |
|
private |
Populates _parameters from the Registry.
Definition at line 485 of file daemon_windows.cc.
References _parameters, _regSubKey, HERE, OmniEvents::Win::perror(), and OmniEvents::RegistryKey::queryValueStr().
Referenced by start().
void OmniEvents::Service::runningOk | ( | ) |
Called to signal that all startup operations have completed OK.
Definition at line 309 of file daemon_windows.cc.
References _serviceRunning.
|
private |
References Service::setArgcArgv().
Referenced by Service::setArgcArgv().
|
private |
References Service::setServiceStatus().
Referenced by Service::setServiceStatus().
void OmniEvents::Service::shutdown | ( | ) |
Exit handler set with ::on_exit() - shuts down the service.
Definition at line 319 of file daemon_windows.cc.
References _logstream, and _serviceRunning.
void OmniEvents::Service::start | ( | int & | argc, |
char **& | argv | ||
) |
Definition at line 223 of file daemon_windows.cc.
References _callCount, _parameters, _serviceRunning, _serviceStatusHandle, ctrlHandler(), HERE, install(), main(), PACKAGE_NAME, OmniEvents::Win::perror(), readParameters(), uninstall(), and writeParameters().
void OmniEvents::Service::tracefile | ( | const char * | val | ) |
|
private |
Definition at line 448 of file daemon_windows.cc.
References HERE, PACKAGE_NAME, OmniEvents::Win::perror(), and OmniEvents::service.
Referenced by start().
|
private |
Writes args 2+ to the Registry.
Definition at line 502 of file daemon_windows.cc.
References _regSubKey, HERE, OmniEvents::Win::perror(), and OmniEvents::RegistryKey::setValueStr().
|
private |
Replacement argv array, read from registry.
Definition at line 75 of file daemon_windows.h.
Referenced by ~Service().
|
private |
Definition at line 73 of file daemon_windows.h.
Referenced by start().
|
private |
Definition at line 76 of file daemon_windows.h.
Referenced by daemonize(), log(), shutdown(), and ~Service().
|
private |
Stores parameters read from the registry.
Definition at line 74 of file daemon_windows.h.
Referenced by readParameters(), start(), and ~Service().
|
private |
Definition at line 71 of file daemon_windows.h.
Referenced by install(), readParameters(), and writeParameters().
|
private |
Definition at line 72 of file daemon_windows.h.
Referenced by runningOk(), shutdown(), and start().
|
private |
|
private |
The tracefile name (if any).
Definition at line 70 of file daemon_windows.h.
Referenced by daemonize(), tracefile(), and ~Service().