xrootd
XrdFrmCns.hh
Go to the documentation of this file.
00001 #ifndef __XRDFRMCNS_HH__
00002 #define __XRDFRMCNS_HH__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                          X r d F r m C n s . h h                           */
00006 /*                                                                            */
00007 /* (c) 2011 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 #include <sys/types.h>
00014 #include <sys/uio.h>
00015   
00016 class XrdFrmCns
00017 {
00018 public:
00019 
00020 static void  Add(const char *tID,const char *Path,long long Size,mode_t Mode);
00021 
00022 static
00023 const  int   cnsAuto    = -1;  // Init Opts: Use cnsd if there, ignore o/w
00024 static
00025 const  int   cnsIgnore  =  0;  // Init Opts: Always ignore the cnsd
00026 static
00027 const  int   cnsRequire =  1;  // Init Opts: Wait for cnsd if not present
00028 
00029 static int   Init(const char *aPath, int Opts);
00030 
00031 static int   Init(const char *myID, const char *aPath, const char *iName);
00032 
00033 static void  Rm (const char *Path, int islfn=0) 
00034                 {if (cnsMode) Del(Path, HdrRmf, islfn);}
00035 
00036 static void  Rmd(const char *Path, int islfn=0)
00037                 {if (cnsMode) Del(Path, HdrRmd, islfn);}
00038 
00039              XrdFrmCns() {}
00040             ~XrdFrmCns() {}
00041 
00042 private:
00043 
00044 static const int HdrRmd = 0;
00045 static const int HdrRmf = 1;
00046 
00047 static void  Del(const char *Path, int HdrType, int islfn=0);
00048 static int   Init();
00049 static int   Retry(int eNum, int &pMsg);
00050 static int   Send2Cnsd(struct iovec *iov, int iovn);
00051 static int   setPath(const char *aPath, const char *iName);
00052 
00053 static char       *cnsPath;
00054 static char       *cnsHdr[2];
00055 static int         cnsHdrLen;
00056 static int         cnsInit;
00057 static int         cnsFD;
00058 static int         cnsMode;
00059 };
00060 #endif