29# include <sys/resource.h>
107 virtual int fini (
void) {
return 0; }
368 std::ostringstream
v;
378 <<
"Written by " <<
m_author <<
"\n" << std::endl;
A collection of assert function wrappers.
Class to handle processing command-line options.
A simple wrapper around fork() library function call.
A collection of various most popular signal handlers.
A utility class for creating and managing process PID lock file.
An implementation of Reactor pattern.
SigHandlers is a signal handlers manager.
A wrapper class to provide AutoPtr with reference semantics.
string m_log_server
Log server, assa-logd, address (port@host)
Reactor * get_reactor()
Obtain reference to the Reactor.
virtual int fini(void)
This is an iterface function corresponding to the object moving back into IDLE state.
void stop_service()
Inform server that it has to stop data processing, clean up and exit.
int get_exit_value() const
Retrieve exit value of the process.
string m_author
Author's name.
static bool become_daemon()
Become a daemon process.
string get_default_config_file()
Get default configuration file name: $HOME/.
string m_cmdline_name
process name as appeared on command line
string get_cmdline_name()
Get command-line process name.
string m_version
Software version.
virtual int suspend(void)
Temporarily suspend the execution of a service.
int m_instance
Process instance.
bool service_is_active()
Normally called by the main loop to find out whether 'graceful quit' flag had been raised,...
string m_log_file
Full pathname of debug file.
virtual ~GenServer()
Destructor.
PidFileLock m_pidfile_lock
PID File lock.
virtual int resume(void)
Resume execution of a service.
bool m_graceful_quit
Flag that indicates wheather server outgh to stop and exit.
string m_config_file
alternative configuration file name
void init_internals()
Initialize internals.
string m_ommit_pidfile
If 'yes', skip PID file locking creation/locking step.
string m_pidfile
PID File lock path name.
int m_revision
Software revision (patch) level.
virtual void display_help()
List options and invocation syntax to stdout.
string m_with_log_server
If 'yes', send log messages to the log server.
bool m_version_flag
Version option flag.
u_int m_log_size
Max size of the log file.
void set_flags(LogFlag logf_)
New debug information is added to the old log file.
long m_mask
Debug file mask to filter debug/error messages.
string m_log_stdout
If 'yes', redirects all logging messages to std::cerr.
Reactor m_reactor
GenServer object has its very own personal Reactor object.
string get_config_file()
Get alternative configuration file name.
string m_default_config_file
standard configuration file name
SIGPOLLHandler m_sig_poll
Function that swallows SIGPOLL calls.
@ KEEPLOG
By default, append new log records to the existing log file.
@ RMLOG
Remove existing log file and start afresh.
string get_port()
Return assumed name of the listening port.
void set_proc_name(string proc_name_)
Change process name.
virtual void init_service()=0
Interface function provided for derived classes as a place to initialize specifics of derived server.
string m_port
listening port name
LogFlag m_log_flag
Log file initialization flag. If RM_LOG, remove old log file.
int m_exit_value
Exit value of the process.
virtual void fatal_signal_hook()
Hook for derived class to do addition clean-up when terminating signal is delivered by OS.
void set_version(const string &release_, int revision_)
Set Version and Revision number.
const char * m_help_msg
Help information.
string get_proc_name()
Get name of process+instance_number.
virtual void init(int *argc, char *argv[], const char *help_info)
Provide an entry point into the service and perfom initialization of the service.
string m_proc_name
process name (considering instance_number)
int m_log_level
Logging level - an integer number that incrementally increases verbosity of the looing messages.
virtual void process_events()=0
Interface function provided for derived classes as the main entry for data processing.
int handle_signal(int signum_)
Handle fatal signals.
GenServer(const GenServer &)
No cloning.
SigHandlers & get_sig_manager()
Obtain reference to the Signal Manager, class SigHandls.
void set_exit_value(int v_)
Set exit value of the process. This value is returned to the shell.
SigHandlers m_sig_dispatcher
Signal handlers dispatcher.
GenServer & operator=(const GenServer &)
void set_author(const string &author_)
Set author's name.
string get_version()
Obtain version information.
bool m_help_flag
Help option flag.
void set_port(string port_)
Set listening port name.
string m_daemon
Daemon option flag. If 'yes', become a UNIX daemon process.
void deactivate(void)
Deactivate Reactor.
Class SIGPOLLHandler handles SIGPOLL signal.