xrootd
XrdFrmCns.hh
Go to the documentation of this file.
1 #ifndef __XRDFRMCNS_HH__
2 #define __XRDFRMCNS_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d F r m C n s . h h */
6 /* */
7 /* (c) 2011 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 #include <sys/types.h>
14 #include <sys/uio.h>
15 
16 class XrdFrmCns
17 {
18 public:
19 
20 static void Add(const char *tID,const char *Path,long long Size,mode_t Mode);
21 
22 static
23 const int cnsAuto = -1; // Init Opts: Use cnsd if there, ignore o/w
24 static
25 const int cnsIgnore = 0; // Init Opts: Always ignore the cnsd
26 static
27 const int cnsRequire = 1; // Init Opts: Wait for cnsd if not present
28 
29 static int Init(const char *aPath, int Opts);
30 
31 static int Init(const char *myID, const char *aPath, const char *iName);
32 
33 static void Rm (const char *Path, int islfn=0)
34  {if (cnsMode) Del(Path, HdrRmf, islfn);}
35 
36 static void Rmd(const char *Path, int islfn=0)
37  {if (cnsMode) Del(Path, HdrRmd, islfn);}
38 
39  XrdFrmCns() {}
41 
42 private:
43 
44 static const int HdrRmd = 0;
45 static const int HdrRmf = 1;
46 
47 static void Del(const char *Path, int HdrType, int islfn=0);
48 static int Init();
49 static int Retry(int eNum, int &pMsg);
50 static int Send2Cnsd(struct iovec *iov, int iovn);
51 static int setPath(const char *aPath, const char *iName);
52 
53 static char *cnsPath;
54 static char *cnsHdr[2];
55 static int cnsHdrLen;
56 static int cnsInit;
57 static int cnsFD;
58 static int cnsMode;
59 };
60 #endif