insd::ServerMain abstract class
this abstract class is implemented by the user to provide the code to execute
in the initialisation and main functions to be executed by the server process.
Abstract methods
virtual int init()
Implement this function to provide instructions which should be carried out
after the server process is created but before the server process is detached
from the terminal. This provides the last opportunity to send output messages to the
terminal, so is a useful place to perform initialisation tasks which might fail.
The function must be implemented to return zero on success. Otherwise
insd will terminate the server process with the returned value as an error code.
Implementing this function is optional. If you do not implement this function,
a 'default' stub handler is used instead, which always returns 0 (success) without
doing any initialisation tasks.
virtual int operator()()
Implement this function to provide instructions which shall be executed by the
server process after it is detached from the terminal and placed into a background
running state.
The server process exits when this function returns. It exits with the error
code returned by this function. Return 0 to indicate normal termination
or a nonzero value to indicate abnormal termination.
Unlike init(), this function is mandatory. It represents the equivalent
of a program's main() function as executed by the server. It does not
accept parameters; instead you simply implement a ServerMain function that provides the
attributes you want to pass to the server process.