00001 #ifndef __CMS_CLIENTMAN__ 00002 #define __CMS_CLIENTMAN__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C m s C l i e n t M a n . h h */ 00006 /* */ 00007 /* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id: XrdCmsClientMan.hh,v 1.4 2008/06/26 02:32:54 abh Exp $ 00014 00015 // Based on: XrdOdcManager.hh,v 1.6 2006/09/26 07:49:14 abh 00016 00017 #include <stdio.h> 00018 #include <sys/uio.h> 00019 00020 #include "XProtocol/YProtocol.hh" 00021 00022 #include "XrdCms/XrdCmsResp.hh" 00023 #include "XrdNet/XrdNetBuffer.hh" 00024 #include "XrdOuc/XrdOucErrInfo.hh" 00025 #include "XrdSys/XrdSysPthread.hh" 00026 00027 class XrdLink; 00028 class XrdNetBuffer; 00029 class XrdOdcFinder; 00030 00031 class XrdCmsClientMan 00032 { 00033 public: 00034 00035 static char doDebug; 00036 static char v1Mode; 00037 static XrdOdcFinder *oldFinder; 00038 00039 int delayResp(XrdOucErrInfo &Resp); 00040 00041 inline int isActive() {return Active;} 00042 00043 XrdCmsClientMan *nextManager() {return Next;} 00044 00045 char *Name() {return Host;} 00046 char *NPfx() {return HPfx;} 00047 00048 int Send(char *msg, int mlen=0); 00049 int Send(const struct iovec *iov, int iovcnt, int iotot=0); 00050 00051 void *Start(); 00052 00053 inline int Suspended() {if (Suspend) chkStatus(); return Suspend;} 00054 00055 void setNext(XrdCmsClientMan *np) {Next = np;} 00056 00057 static void setConfig(char *cfn) {ConfigFN = cfn;} 00058 00059 int whatsUp(const char *user, const char *path); 00060 00061 inline int waitTime() {return repWait;} 00062 00063 XrdCmsClientMan(char *host,int port,int cw,int nr,int rw,int rd); 00064 ~XrdCmsClientMan(); 00065 00066 private: 00067 int Hookup(); 00068 int Receive(); 00069 void relayResp(); 00070 void chkStatus(); 00071 void setStatus(); 00072 00073 static XrdSysMutex manMutex; 00074 static XrdNetBufferQ BuffQ; 00075 static char *ConfigFN; 00076 static const int chkVal = 256; 00077 00078 XrdSysSemaphore syncResp; 00079 XrdCmsRespQ RespQ; 00080 00081 XrdCmsClientMan *Next; 00082 XrdSysMutex myData; 00083 XrdLink *Link; 00084 char *Host; 00085 char *HPfx; 00086 int Port; 00087 int manMask; 00088 int dally; 00089 int Active; 00090 int Silent; 00091 int Suspend; 00092 int RecvCnt; 00093 int SendCnt; 00094 int nrMax; 00095 int maxMsgID; 00096 int repWait; 00097 int repWMax; 00098 int minDelay; 00099 int maxDelay; 00100 int qTime; 00101 int chkCount; 00102 time_t lastUpdt; 00103 time_t lastTOut; 00104 XrdCms::CmsRRHdr Response; 00105 XrdNetBuffer *NetBuff; 00106 }; 00107 #endif
1.7.1