ROOT logo
// @(#)root/castor:$Id: TCastorFile.h 20882 2007-11-19 11:31:26Z rdm $
// Author: Fons Rademakers  17/09/2003 + Giulia Taurelli  29/06/2006

/*************************************************************************
 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TCastorFile
#define ROOT_TCastorFile

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TCastorFile                                                          //
//                                                                      //
// A TCastorFile is like a normal TNetFile except that it obtains the   //
// remote node (disk server) via the CASTOR API, once the disk server   //
// and the local file path are determined, the file will be accessed    //
// via the rootd daemon. File names have to be specified like:          //
//    castor:/castor/cern.ch/user/r/rdm/bla.root.                       //
//                                                                      //
// If Castor 2.1 is used the file names can also be specified           //
// in the following ways:                                               //
//                                                                      //
//  castor://stager_host:stager_port/?path=/castor/cern.ch/user/        //
//    r/rdm/bla.root&svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION   //
//                                                                      //
//  castor://stager_host/?path=/castor/cern.ch/user/                    //
//    r/rdm/bla.root&svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION   //
//                                                                      //
//  castor:///castor?path=/castor/cern.ch/user/                         //
//    r/rdm/bla.root&svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION   //
//                                                                      //
// path is mandatory as parameter but all the other ones are optional.  //
//                                                                      //
// Use "&rootAuth=<auth_prot_code>" in the option field to force the    //
// specified authentication protocol when contacting the server, e.g.   //
//                                                                      //
//  castor:///castor?path=/castor/cern.ch/user/r/rdm/bla.root           //
//    &svcClass=MYSVCLASS&castorVersion=MYCASTORVERSION&rootAuth=3      //
//                                                                      //
// will try first the globus/GSI protocol; available protocols are      //
//  0: passwd, 1: srp, 2: krb5, 3: globus, 4: ssh, 5 uidgid             //
// The defaul is taken from the env ROOTCASTORAUTH.                     //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TNetFile
#include "TNetFile.h"
#endif


class TCastorFile : public TNetFile {

private:
   TString   fDiskServer;    // CASTOR remote disk server
   TString   fInternalPath;  // CASTOR internal path
   Bool_t    fIsCastor;      // true if internal path is valid
   Bool_t    fWrittenTo;     // true if data has been written to file

   TString   fAuthProto;     // Used to specific the auth protocol

   void FindServerAndPath();
   void ConnectServer(Int_t *stat, EMessageTypes *kind, Int_t netopt,
                      Int_t tcpwindowsize, Bool_t forceOpen,
                      Bool_t forceRead);
   Int_t SysClose(Int_t fd);

public:
   TCastorFile(const char *url, Option_t *option = "", const char *ftitle = "",
               Int_t compress = 1, Int_t netopt = 0);
   TCastorFile() : TNetFile() { fIsCastor = fWrittenTo = kFALSE; }
   virtual ~TCastorFile() { }

   Bool_t WriteBuffer(const char *buf, Int_t len);

   ClassDef(TCastorFile,1) //TFile reading/writing via rootd to a CASTOR server
};

#endif
 TCastorFile.h:1
 TCastorFile.h:2
 TCastorFile.h:3
 TCastorFile.h:4
 TCastorFile.h:5
 TCastorFile.h:6
 TCastorFile.h:7
 TCastorFile.h:8
 TCastorFile.h:9
 TCastorFile.h:10
 TCastorFile.h:11
 TCastorFile.h:12
 TCastorFile.h:13
 TCastorFile.h:14
 TCastorFile.h:15
 TCastorFile.h:16
 TCastorFile.h:17
 TCastorFile.h:18
 TCastorFile.h:19
 TCastorFile.h:20
 TCastorFile.h:21
 TCastorFile.h:22
 TCastorFile.h:23
 TCastorFile.h:24
 TCastorFile.h:25
 TCastorFile.h:26
 TCastorFile.h:27
 TCastorFile.h:28
 TCastorFile.h:29
 TCastorFile.h:30
 TCastorFile.h:31
 TCastorFile.h:32
 TCastorFile.h:33
 TCastorFile.h:34
 TCastorFile.h:35
 TCastorFile.h:36
 TCastorFile.h:37
 TCastorFile.h:38
 TCastorFile.h:39
 TCastorFile.h:40
 TCastorFile.h:41
 TCastorFile.h:42
 TCastorFile.h:43
 TCastorFile.h:44
 TCastorFile.h:45
 TCastorFile.h:46
 TCastorFile.h:47
 TCastorFile.h:48
 TCastorFile.h:49
 TCastorFile.h:50
 TCastorFile.h:51
 TCastorFile.h:52
 TCastorFile.h:53
 TCastorFile.h:54
 TCastorFile.h:55
 TCastorFile.h:56
 TCastorFile.h:57
 TCastorFile.h:58
 TCastorFile.h:59
 TCastorFile.h:60
 TCastorFile.h:61
 TCastorFile.h:62
 TCastorFile.h:63
 TCastorFile.h:64
 TCastorFile.h:65
 TCastorFile.h:66
 TCastorFile.h:67
 TCastorFile.h:68
 TCastorFile.h:69
 TCastorFile.h:70
 TCastorFile.h:71
 TCastorFile.h:72
 TCastorFile.h:73
 TCastorFile.h:74
 TCastorFile.h:75
 TCastorFile.h:76
 TCastorFile.h:77
 TCastorFile.h:78
 TCastorFile.h:79
 TCastorFile.h:80
 TCastorFile.h:81
 TCastorFile.h:82
 TCastorFile.h:83