xorp

Module Class Reference

A class for managing router manager modules. More...

#include <module_manager.hh>

Inheritance diagram for Module:
GenericModule

List of all members.

Public Member Functions

 Module (ModuleManager &mmgr, const string &name, const string &path, const string &expath, bool verbose)
 Constructor.
virtual ~Module ()
 The default destructor.
void new_status (ModuleStatus new_status)
 Set new status for the module.
string str () const
 Convert the module information to a string.
ModuleManagermodule_manager () const
 Get a reference to the module manager (ModuleManager).
const string & expath () const
 Get the expanded absolute path to the executable program.
int execute (bool do_exec, bool is_verification, XorpCallback1< void, bool >::RefPtr cb)
 Execute the module.
int restart ()
 Restart the module.
void terminate (XorpCallback0< void >::RefPtr cb)
 Terminate the module.
void terminate_with_prejudice (XorpCallback0< void >::RefPtr cb)
 Terminate the module with prejudice.
void module_exited (bool success, bool is_signal_terminated, int term_signal, bool is_coredumped)
 A method called when the corresponding process has exited.
void module_stopped (int stop_signal)
 A method called when the corresponding process has been stopped.

Private Member Functions

void module_restart_cb (bool success)

Private Attributes

ModuleManager_mmgr
string _path
string _expath
bool _do_exec
bool _verbose
XorpTimer _shutdown_timer
XorpCallback0< void >::RefPtr _terminate_cb

Static Private Attributes

static const TimeVal SHUTDOWN_TIMEOUT_TIMEVAL = TimeVal(2, 0)

Detailed Description

A class for managing router manager modules.


Constructor & Destructor Documentation

Module::Module ( ModuleManager mmgr,
const string &  name,
const string &  path,
const string &  expath,
bool  verbose 
)

Constructor.

Parameters:
mmgrthe module manager (ModuleManager) to use.
namethe module name.
paththe path to the executable program for this module.
expaththe expanded absolute path to the executable program for this module.
verboseif true, then output trace messages.

Member Function Documentation

int Module::execute ( bool  do_exec,
bool  is_verification,
XorpCallback1< void, bool >::RefPtr  cb 
)

Execute the module.

Parameters:
do_execif true then indeed execute the executable program, otherwise just process the execution machinery.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
const string& Module::expath ( ) const [inline]

Get the expanded absolute path to the executable program.

Returns:
the expanded absolute path to the executable program.
void Module::module_exited ( bool  success,
bool  is_signal_terminated,
int  term_signal,
bool  is_coredumped 
)

A method called when the corresponding process has exited.

Parameters:
successif true, the exit status of the process indicates success, otherwise failure.
is_signal_terminatedif true the process has been terminated by a signal.
term_signalif is_signal_terminated is true, this contains the terminating signal.
is_coredumpedif true the process has generated a coredump.
ModuleManager& Module::module_manager ( ) const [inline]

Get a reference to the module manager (ModuleManager).

Returns:
a reference to the module manager.
void Module::module_stopped ( int  stop_signal)

A method called when the corresponding process has been stopped.

Parameters:
stop_signalthe signal that has stopped the process.
void Module::new_status ( ModuleStatus  new_status) [virtual]

Set new status for the module.

Parameters:
new_statusthe new status for the module.

Reimplemented from GenericModule.

int Module::restart ( )

Restart the module.

Returns:
XORP_OK on success, otherwise XORP_ERROR.
string Module::str ( ) const [virtual]

Convert the module information to a string.

Returns:
a string with the module information.

Reimplemented from GenericModule.

void Module::terminate ( XorpCallback0< void >::RefPtr  cb)

Terminate the module.

Parameters:
cbthe callback to execute after the module is terminated.
void Module::terminate_with_prejudice ( XorpCallback0< void >::RefPtr  cb)

Terminate the module with prejudice.

Parameters:
cbthe callback to execute after the module is terminated.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations