00001 // @(#)root/castor:$Id: TCastorFile.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Fons Rademakers 17/09/2003 + Giulia Taurelli 29/06/2006 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TCastorFile 00013 #define ROOT_TCastorFile 00014 00015 ////////////////////////////////////////////////////////////////////////// 00016 // // 00017 // TCastorFile // 00018 // // 00019 // A TCastorFile is like a normal TNetFile except that it obtains the // 00020 // remote node (disk server) via the CASTOR API, once the disk server // 00021 // and the local file path are determined, the file will be accessed // 00022 // via the rootd daemon. File names have to be specified like: // 00023 // castor:/castor/cern.ch/user/r/rdm/bla.root. // 00024 // // 00025 // If Castor 2.1 is used the file names can also be specified // 00026 // in the following ways: // 00027 // // 00028 // castor://stager_host:stager_port/?path=/castor/cern.ch/user/ // 00029 // r/rdm/bla.root&svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION // 00030 // // 00031 // castor://stager_host/?path=/castor/cern.ch/user/ // 00032 // r/rdm/bla.root&svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION // 00033 // // 00034 // castor:///castor?path=/castor/cern.ch/user/ // 00035 // r/rdm/bla.root&svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION // 00036 // // 00037 // path is mandatory as parameter but all the other ones are optional. // 00038 // // 00039 // Use "&rootAuth=<auth_prot_code>" in the option field to force the // 00040 // specified authentication protocol when contacting the server, e.g. // 00041 // // 00042 // castor:///castor?path=/castor/cern.ch/user/r/rdm/bla.root // 00043 // &svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION&rootAuth=3 // 00044 // // 00045 // will try first the globus/GSI protocol; available protocols are // 00046 // 0: passwd, 1: srp, 2: krb5, 3: globus, 4: ssh, 5 uidgid // 00047 // The defaul is taken from the env ROOTCASTORAUTH. // 00048 // // 00049 ////////////////////////////////////////////////////////////////////////// 00050 00051 #ifndef ROOT_TNetFile 00052 #include "TNetFile.h" 00053 #endif 00054 00055 00056 class TCastorFile : public TNetFile { 00057 00058 private: 00059 TString fDiskServer; // CASTOR remote disk server 00060 TString fInternalPath; // CASTOR internal path 00061 Bool_t fIsCastor; // true if internal path is valid 00062 Bool_t fWrittenTo; // true if data has been written to file 00063 00064 TString fAuthProto; // Used to specific the auth protocol 00065 00066 void FindServerAndPath(); 00067 void ConnectServer(Int_t *stat, EMessageTypes *kind, Int_t netopt, 00068 Int_t tcpwindowsize, Bool_t forceOpen, 00069 Bool_t forceRead); 00070 Int_t SysClose(Int_t fd); 00071 00072 public: 00073 TCastorFile(const char *url, Option_t *option = "", const char *ftitle = "", 00074 Int_t compress = 1, Int_t netopt = 0); 00075 TCastorFile() : TNetFile() { fIsCastor = fWrittenTo = kFALSE; } 00076 virtual ~TCastorFile() { } 00077 00078 Bool_t WriteBuffer(const char *buf, Int_t len); 00079 00080 ClassDef(TCastorFile,1) //TFile reading/writing via rootd to a CASTOR server 00081 }; 00082 00083 #endif