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 35287 2010-09-14 21:19:35Z ganis $ 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 00030 class XrdCmsClientMan 00031 { 00032 public: 00033 00034 static char doDebug; 00035 00036 int delayResp(XrdOucErrInfo &Resp); 00037 00038 inline int isActive() {return Active;} 00039 00040 XrdCmsClientMan *nextManager() {return Next;} 00041 00042 char *Name() {return Host;} 00043 char *NPfx() {return HPfx;} 00044 00045 int Send(char *msg, int mlen=0); 00046 int Send(const struct iovec *iov, int iovcnt, int iotot=0); 00047 00048 void *Start(); 00049 00050 inline int Suspended() {if (Suspend) chkStatus(); return Suspend;} 00051 00052 void setNext(XrdCmsClientMan *np) {Next = np;} 00053 00054 static void setConfig(char *cfn) {ConfigFN = cfn;} 00055 00056 int whatsUp(const char *user, const char *path); 00057 00058 inline int waitTime() {return repWait;} 00059 00060 XrdCmsClientMan(char *host,int port,int cw,int nr,int rw,int rd); 00061 ~XrdCmsClientMan(); 00062 00063 private: 00064 int Hookup(); 00065 int Receive(); 00066 void relayResp(); 00067 void chkStatus(); 00068 void setStatus(); 00069 00070 static XrdSysMutex manMutex; 00071 static XrdNetBufferQ BuffQ; 00072 static char *ConfigFN; 00073 static const int chkVal = 256; 00074 00075 XrdSysSemaphore syncResp; 00076 XrdCmsRespQ RespQ; 00077 00078 XrdCmsClientMan *Next; 00079 XrdSysMutex myData; 00080 XrdLink *Link; 00081 char *Host; 00082 char *HPfx; 00083 int Port; 00084 int manMask; 00085 int dally; 00086 int Active; 00087 int Silent; 00088 int Suspend; 00089 int RecvCnt; 00090 int SendCnt; 00091 int nrMax; 00092 int maxMsgID; 00093 int repWait; 00094 int repWMax; 00095 int minDelay; 00096 int maxDelay; 00097 int qTime; 00098 int chkCount; 00099 time_t lastUpdt; 00100 time_t lastTOut; 00101 XrdCms::CmsRRHdr Response; 00102 XrdNetBuffer *NetBuff; 00103 }; 00104 #endif