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 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include <sys/types.h>
34 #include <sys/uio.h>
35 
36 class XrdFrmCns
37 {
38 public:
39 
40 static void Add(const char *tID,const char *Path,long long Size,mode_t Mode);
41 
42 static
43 const int cnsAuto = -1; // Init Opts: Use cnsd if there, ignore o/w
44 static
45 const int cnsIgnore = 0; // Init Opts: Always ignore the cnsd
46 static
47 const int cnsRequire = 1; // Init Opts: Wait for cnsd if not present
48 
49 static int Init(const char *aPath, int Opts);
50 
51 static int Init(const char *myID, const char *aPath, const char *iName);
52 
53 static void Rm (const char *Path, int islfn=0)
54  {if (cnsMode) Del(Path, HdrRmf, islfn);}
55 
56 static void Rmd(const char *Path, int islfn=0)
57  {if (cnsMode) Del(Path, HdrRmd, islfn);}
58 
59  XrdFrmCns() {}
61 
62 private:
63 
64 static const int HdrRmd = 0;
65 static const int HdrRmf = 1;
66 
67 static void Del(const char *Path, int HdrType, int islfn=0);
68 static int Init();
69 static int Retry(int eNum, int &pMsg);
70 static int Send2Cnsd(struct iovec *iov, int iovn);
71 static int setPath(const char *aPath, const char *iName);
72 
73 static char *cnsPath;
74 static char *cnsHdr[2];
75 static int cnsHdrLen;
76 static int cnsInit;
77 static int cnsFD;
78 static int cnsMode;
79 };
80 #endif
static int cnsInit
Definition: XrdFrmCns.hh:76
static void Add(const char *tID, const char *Path, long long Size, mode_t Mode)
Definition: XrdFrmCns.hh:36
static int Init()
static void Rm(const char *Path, int islfn=0)
Definition: XrdFrmCns.hh:53
static int Send2Cnsd(struct iovec *iov, int iovn)
static int cnsFD
Definition: XrdFrmCns.hh:77
static const int cnsAuto
Definition: XrdFrmCns.hh:43
Definition: XrdOucIOVec.hh:65
static int Retry(int eNum, int &pMsg)
static int cnsMode
Definition: XrdFrmCns.hh:78
static const int HdrRmf
Definition: XrdFrmCns.hh:65
static const int cnsRequire
Definition: XrdFrmCns.hh:47
static int cnsHdrLen
Definition: XrdFrmCns.hh:75
static int setPath(const char *aPath, const char *iName)
static char * cnsHdr[2]
Definition: XrdFrmCns.hh:74
static void Del(const char *Path, int HdrType, int islfn=0)
static const int cnsIgnore
Definition: XrdFrmCns.hh:45
XrdFrmCns()
Definition: XrdFrmCns.hh:59
static const int HdrRmd
Definition: XrdFrmCns.hh:64
~XrdFrmCns()
Definition: XrdFrmCns.hh:60
static void Rmd(const char *Path, int islfn=0)
Definition: XrdFrmCns.hh:56
static char * cnsPath
Definition: XrdFrmCns.hh:73