Logo Search packages:      
Sourcecode: condor version File versions  Download package

Daemon Class Reference

#include <daemon.h>

Inheritance diagram for Daemon:

DCCollector DCLeaseManager DCMaster DCSchedd DCShadow DCStartd DCStarter DCTransferD

List of all members.


Detailed Description

Class used to pass around and store information about a given daemon. You instantiate one of these objects and pass in the type of daemon you care about, and optionally, the name of the daemon and pool that it reports to. The pool and name arguments both default to NULL, which means the local pool (the pool that the machine where the Daemon object was instantiated reports to) and the local daemon, respectively.

Once you have the object, you call the locate() method to have it actually try to find all the information about the daemon it can provide. If you call member functions for info before you call locate(), the object will call locate() for you, though that can obscure errors, so it's generally discouraged.

If there are any errors, the error() method will stop returning NULL and start returning a string that describes the error, which can then be used for dprintf(), etc.

"The local daemon" means different things, depending on the type of daemon. For central manager daemons (negotiator, collector, view_collector), it means the CM this machine is configured to use (which would normally be a remote host, unless you were instantiating the Daemon object on the CM itself). For all other daemons (master, startd, schedd), it means the daemon running on the local host.

Information provided by the Daemon class includes the daemon's name (which could be a "condor" name such as "slot1@raven.cs.wisc.edu", or a full hostname), hostname, fully qualified hostname, address (sinful string), port, the type of the daemon (daemon_t enum), the pool it reports to (if it's a remote pool) and a bool that describes if the daemon is "local" (as described above).

We use this class to localize all the logic for finding daemons in one place, and all the rest of Condor now uses this class. This way, when we add support for a new way of finding daemons (like address files, multiple network interface config parameters, etc), we can add the code to support it in one place, instead of peppered throughout the entire source tree.

Definition at line 85 of file daemon.h.


Public Member Functions

char * addr (void)
 Daemon (const Daemon &copy)
 Copy constructor (implemented via deepCopy()).
 Daemon (const ClassAd *ad, daemon_t type, const char *pool)
 Daemon (daemon_t type, const char *name=NULL, const char *pool=NULL)
ClassAddaemonAd ()
void decRefCount ()
void display (FILE *fp)
void display (int debugflag)
char * error (void)
CAResult errorCode (void)
char * fullHostname (void)
bool getTimeOffset (long &offset)
bool getTimeOffsetRange (long &min_range, long &max_range)
char * hostname (void)
const char * idStr (void)
void incRefCount ()
bool isLocal (void)
virtual bool locate (void)
char * name (void)
 Methods for getting information about the daemon.
Daemonoperator= (const Daemon &)
 Overloaded assignment operator (implemented via deepCopy()).
char * platform (void)
char * pool (void)
int port (void)
ReliSock * reliSock (int sec=0, CondorError *errstack=0, bool non_blocking=false, bool ignore_timeout_multiplier=false)
 Methods for communicating with the daemon.
SafeSocksafeSock (int sec=0, CondorError *errstack=0, bool non_blocking=false)
void sendBlockingMsg (classy_counted_ptr< DCMsg > msg)
bool sendCommand (int cmd, Sock *sock, int sec=0, CondorError *errstack=NULL, char const *cmd_description=NULL)
bool sendCommand (int cmd, Stream::stream_type st=Stream::reli_sock, int sec=0, CondorError *errstack=NULL, char const *cmd_description=NULL)
void sendMsg (classy_counted_ptr< DCMsg > msg)
bool startCommand (int cmd, Sock *sock, int sec=0, CondorError *errstack=NULL, char const *cmd_description=NULL, bool raw_protocol=false, char const *sec_session_id=NULL)
SockstartCommand (int cmd, Stream::stream_type st=Stream::reli_sock, int sec=0, CondorError *errstack=NULL, char const *cmd_description=NULL, bool raw_protocol=false, char const *sec_session_id=NULL)
StartCommandResult startCommand_nonblocking (int cmd, Sock *sock, int timeout, CondorError *errstack, StartCommandCallbackType *callback_fn, void *misc_data, char const *cmd_description=NULL, bool raw_protocol=false, char const *sec_session_id=NULL)
StartCommandResult startCommand_nonblocking (int cmd, Stream::stream_type st, int timeout, CondorError *errstack, StartCommandCallbackType *callback_fn, void *misc_data, char const *cmd_description=NULL, bool raw_protocol=false, char const *sec_session_id=NULL)
daemon_t type (void)
char * version (void)
virtual ~Daemon ()
 Destructor.

Protected Member Functions

bool checkAddr (void)
void common_init ()
 Helper methods.
void deepCopy (const Daemon &copy)
bool forceAuthentication (ReliSock *rsock, CondorError *errstack)
bool getCmInfo (const char *subsys)
bool getDaemonInfo (const char *subsys, AdTypes adtype, bool query_collector=true)
int getDefaultPort (void)
bool getInfoFromAd (counted_ptr< class ClassAd > &ad)
bool getInfoFromAd (const ClassAd *ad)
bool initHostname (void)
bool initHostnameFromFull (void)
bool initStringFromAd (counted_ptr< class ClassAd > &ad, const char *attrname, char **value_str)
bool initStringFromAd (const ClassAd *ad, const char *attrname, char **value_str)
bool initVersion (void)
char * localName (void)
char * New_addr (char *)
char * New_full_hostname (char *)
char * New_hostname (char *)
char * New_name (char *)
char * New_platform (char *)
char * New_pool (char *)
char * New_version (char *)
void newError (CAResult, const char *)
bool readAddressFile (const char *subsys)
bool readLocalClassAd (const char *subsys)
bool sendCACmd (ClassAd *req, ClassAd *reply, ReliSock *sock, bool force_auth, int timeout=-1, char const *sec_session_id=NULL)
bool sendCACmd (ClassAd *req, ClassAd *reply, bool force_auth, int timeout=-1, char const *sec_session_id=NULL)
void setCmdStr (const char *cmd)
StartCommandResult startCommand (int cmd, Stream::stream_type st, Sock **sock, int timeout, CondorError *errstack, StartCommandCallbackType *callback_fn, void *misc_data, bool nonblocking, char const *cmd_description=NULL, bool raw_protocol=false, char const *sec_session_id=NULL)

Static Protected Member Functions

static StartCommandResult startCommand (int cmd, Sock *sock, int timeout, CondorError *errstack, StartCommandCallbackType *callback_fn, void *misc_data, bool nonblocking, char const *cmd_description, char *version, SecMan *sec_man, bool raw_protocol, char const *sec_session_id)

Protected Attributes

char * _addr
char * _cmd_str
char * _error
CAResult _error_code
char * _full_hostname
char * _hostname
char * _id_str
bool _is_configured
bool _is_local
char * _name
char * _platform
char * _pool
int _port
SecMan _sec_man
char * _subsys
bool _tried_init_hostname
bool _tried_init_version
bool _tried_locate
daemon_t _type
char * _version
ClassAdm_daemon_ad_ptr

Friends

class DCMessenger
struct StartCommandConnectCallback

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index