#include <svcproc.h>
Inheritance diagram for PServiceProcess:
Miscellaneous functions | |
void | SetLogLevel (PSystemLog::Level level) |
Set the level at which errors are logged. | |
PSystemLog::Level | GetLogLevel () const |
Get the current level for logging. | |
static PServiceProcess & | Current () |
Get the current service process object. | |
Public Member Functions | |
virtual int | InternalMain (void *arg=NULL) |
Main function for process, called from real main after initialisation. | |
~PServiceProcess () | |
virtual void | Terminate () |
Terminate the process. | |
Construction | |
PServiceProcess (const char *manuf, const char *name, WORD majorVersion, WORD minorVersion, CodeStatus status, WORD buildNumber) | |
Create a new service process. | |
Callback functions | |
virtual PBoolean | OnStart ()=0 |
Called when the service is started. | |
virtual void | OnStop () |
Called by the system when the service is stopped. | |
virtual PBoolean | OnPause () |
Called by the system when the service is to be paused. | |
virtual void | OnContinue () |
Resume after the service was paused. | |
virtual void | OnControl ()=0 |
The Control menu option was used in the SysTray menu. | |
Protected Member Functions | |
int | InitialiseService () |
void | _PXShowSystemWarning (PINDEX num, const PString &str) |
void | PXOnSignal (int) |
void | PXOnAsyncSignal (int) |
Protected Attributes | |
PBoolean | debugMode |
Flag to indicate service is run in simulation mode. | |
PString | pidFileToRemove |
PBoolean | isTerminating |
This may be a service under the Windows NT operating system, or a "daemon" under Unix, or a hidden application under Windows.
PServiceProcess::PServiceProcess | ( | const char * | manuf, | |
const char * | name, | |||
WORD | majorVersion, | |||
WORD | minorVersion, | |||
CodeStatus | status, | |||
WORD | buildNumber | |||
) |
Create a new service process.
manuf | Name of manufacturer |
name | Name of product |
majorVersion | Major version number of the product |
minorVersion | Minor version number of the product |
status | Development status of the product |
buildNumber | Build number of the product |
PServiceProcess::~PServiceProcess | ( | ) |
void PServiceProcess::_PXShowSystemWarning | ( | PINDEX | num, | |
const PString & | str | |||
) | [protected, virtual] |
Reimplemented from PProcess.
static PServiceProcess& PServiceProcess::Current | ( | ) | [static] |
Get the current service process object.
Reimplemented from PProcess.
Reimplemented in PHTTPServiceProcess.
PSystemLog::Level PServiceProcess::GetLogLevel | ( | ) | const [inline] |
Get the current level for logging.
int PServiceProcess::InitialiseService | ( | ) | [protected] |
virtual int PServiceProcess::InternalMain | ( | void * | arg = NULL |
) | [virtual] |
virtual void PServiceProcess::OnContinue | ( | ) | [virtual] |
virtual void PServiceProcess::OnControl | ( | ) | [pure virtual] |
The Control menu option was used in the SysTray menu.
virtual PBoolean PServiceProcess::OnPause | ( | ) | [virtual] |
Called by the system when the service is to be paused.
This will suspend any actions that the service may be executing. Usually this is less expensive in resource allocation etc than stopping and starting the service.
Reimplemented in PHTTPServiceProcess.
virtual PBoolean PServiceProcess::OnStart | ( | ) | [pure virtual] |
Called when the service is started.
This typically initialises the service and returns true if the service is ready to run. The Main()
function is then executed.
Implemented in PHTTPServiceProcess.
virtual void PServiceProcess::OnStop | ( | ) | [virtual] |
Called by the system when the service is stopped.
One return from this function there is no guarentee that any more user code will be executed. Any cleaning up or closing of resource must be done in here.
Reimplemented in PHTTPServiceProcess.
void PServiceProcess::PXOnAsyncSignal | ( | int | ) | [protected, virtual] |
Reimplemented from PProcess.
void PServiceProcess::PXOnSignal | ( | int | ) | [protected, virtual] |
Reimplemented from PProcess.
void PServiceProcess::SetLogLevel | ( | PSystemLog::Level | level | ) | [inline] |
Set the level at which errors are logged.
Only messages higher than or equal to the specified level will be logged.
The default is PSystemLog::Error allowing fatal errors and ordinary\ errors to be logged and warning and information to be ignored.
If in debug mode then the default is PSystemLog::Info allowing all messages to be displayed.
level | New log level |
virtual void PServiceProcess::Terminate | ( | ) | [virtual] |
PBoolean PServiceProcess::debugMode [protected] |
Flag to indicate service is run in simulation mode.
PBoolean PServiceProcess::isTerminating [protected] |
PString PServiceProcess::pidFileToRemove [protected] |