xrootd
XrdCmsClientMsg.hh
Go to the documentation of this file.
1 #ifndef __CMS_CLIENTMSG__
2 #define __CMS_CLIENTMSG__
3 /******************************************************************************/
4 /* */
5 /* X r d C m s C l i e n t M s g . h h */
6 /* */
7 /* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 // $Id$
14 
15 #include "XProtocol/YProtocol.hh"
16 
17 #include "XrdSys/XrdSysPthread.hh"
18 
19 class XrdOucErrInfo;
20 class XrdNetBuffer;
21 
23 {
24 public:
25 
26 static XrdCmsClientMsg *Alloc(XrdOucErrInfo *erp);
27 
28 inline int getResult() {return Result;}
29 
30 inline int ID() {return id;}
31 
32 static int Init();
33 
34 static int inQ() {return numinQ;}
35 
36  void Lock() {Hold.Lock();}
37 
38  void Recycle();
39 
40 static int Reply(const char *Man,XrdCms::CmsRRHdr &hdr,XrdNetBuffer *buff);
41 
42  void UnLock() {Hold.UnLock();}
43 
44  int Wait4Reply(int wtime) {return Hold.Wait(wtime);}
45 
46  XrdCmsClientMsg() : Hold(0) {next = 0; inwaitq = 0; Resp = 0; Result = 0;}
48 
49 private:
50 static const int MidMask = 1023;
51 static const int MaxMsgs = 1024;
52 static const int MidIncr = 1024;
53 static const int IncMask = 0x3ffffc00;
54 static XrdCmsClientMsg *RemFromWaitQ(int msgid);
55 
56 static int nextid;
57 static int numinQ;
58 
62 
65 int inwaitq;
66 int id;
68 int Result;
69 };
70 #endif