xorp

ProcessWatch Class Reference

Keeps track of which XORP processes of interest are alive. More...

#include <process_watch.hh>

Inheritance diagram for ProcessWatch:
ProcessWatchBase

List of all members.

Classes

class  Process
class  PWException
 Exception thrown on error, such as Xrl failure. More...

Public Types

typedef XorpCallback0< void >
::RefPtr 
TerminateCallback

Public Member Functions

 ProcessWatch (XrlStdRouter *xrl_router, EventLoop &eventloop, const char *bgp_mib_name, TerminateCallback cb)
void birth (const string &target_class, const string &target_instance)
 Method to call when the birth of a process has been detected.
void death (const string &target_class, const string &target_instance)
 Method to call when the death of a process has been detected.
void finder_death (const char *file, const int lineno)
 Method to call if the finder dies.
void start_kill_timer ()
 Start a timer to kill this process if for some reason we get hung up.
bool ready () const
bool target_exists (const string &target) const
 ProcessWatch (XrlStdRouter &rtr, ProtocolMap &pmap)
void register_cb (const XrlError &err)
 Callback for all Xrl calls.
void add_interest (const string &proc)
 Add an interest in a protocol.
void birth (const string &proto)
 Announce birth of a protocol [process].
void death (const string &proto)
 Announce death of a protocol.
bool alive (const string &proto)
 An exception is thrown if the process watch is not watching the requested protocol.
void set_notifier (PWNotifier &notifier)
 Set an object which will receive birth/death notifications.

Protected Member Functions

void interest_callback (const XrlError &error)
void add_target (const string &target_class, const string &target_instance)
void remove_target (const string &target_class, const string &target_instance)

Private Attributes

EventLoop_eventloop
TerminateCallback _shutdown
bool _fea
bool _rib
string _fea_instance
string _rib_instance
XorpTimer _shutdown_timer
list< Process_processes
ProtocolMap_pmap
set< string > _watching
set< string > _alive
XrlFinderEventNotifierV0p1Client _finder
string _instance_name
PWNotifier_notifier
string _finder_name

Detailed Description

Keeps track of which XORP processes of interest are alive.

The VarMap will register interest in protocols for known protocols with the ProcessWatch. The ProcessWatch will then register this interest with the finder.

Very similar / identical to BGP's process watch.


Constructor & Destructor Documentation

ProcessWatch::ProcessWatch ( XrlStdRouter rtr,
ProtocolMap pmap 
)
Parameters:
rtrXrl router to use.
pmapprotocol map.

Member Function Documentation

void ProcessWatch::add_interest ( const string &  proc) [virtual]

Add an interest in a protocol.

Parameters:
procprocess of the protocol to add interest for.

Implements ProcessWatchBase.

bool ProcessWatch::alive ( const string &  proto)

An exception is thrown if the process watch is not watching the requested protocol.

Returns:
true if protocol is alive, false otherwise.
Parameters:
protoprotocol for which status is requested.
void ProcessWatch::birth ( const string &  proto)

Announce birth of a protocol [process].

Parameters:
protoprotocol that came to life.
void ProcessWatch::death ( const string &  proto)

Announce death of a protocol.

Parameters:
protoprotocol that died.
bool ProcessWatch::ready ( ) const
Returns:
Return true when all the processes that BGP requires for correct operation are running.
void ProcessWatch::register_cb ( const XrlError err)

Callback for all Xrl calls.

Parameters:
errpossible Xrl error.
void ProcessWatch::set_notifier ( PWNotifier notifier)

Set an object which will receive birth/death notifications.

If a previous object was "registered", it will be removed. Only one object may receive notifications.

Parameters:
notifierobject where notifications should be sent.
bool ProcessWatch::target_exists ( const string &  target) const
Returns:
true if the target process exists.

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