library: libCore #include "TNetFile.h"

# TNetSystem

class description - source file - inheritance tree (.pdf)

## class TNetSystem : public TSystem

| Inheritance Chart:

`TObject`

<-

`TNamed`

<-

`TSystem`

<-

`TNetSystem`

        private:

          virtual void* GetDirPtr() const

        public:

                              TNetSystem()
                              TNetSystem(const char* url)
                              TNetSystem(const TNetSystem&)
                      virtual ~TNetSystem()
               virtual Bool_t AccessPathName(const char* path, EAccessMode mode)
               static TClass* Class()
               virtual Bool_t ConsistentWith(const char* path, void* dirptr)
                 virtual void FreeDirectory(void* dirp = 0)
          virtual const char* GetDirEntry(void* dirp = 0) const
                virtual Int_t GetPathInfo(const char* path, FileStat_t& buf)
              virtual TClass* IsA() const
                virtual Int_t MakeDirectory(const char* name)
                virtual void* OpenDirectory(const char* name)
                  TNetSystem& operator=(const TNetSystem&)
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)

### Data Members

        private:

           Bool_t fDir   true if a directory is open remotely
            void* fDirp  directory handler
            TFTP* fFTP   Connection to rootd
          TString fHost  Remote host
          TString fUser  Remote user

## Class Description

     TNetFile

     A TNetFile is like a normal TFile except that it reads and writes
     its data via a rootd server (for more on the rootd daemon see the
     source files root/rootd/src/*.cxx). TNetFile file names are in
     standard URL format with protocol "root" or "roots". The following
     are valid TNetFile URL's:

        roots://hpsalo/files/aap.root
        root://hpbrun.cern.ch/root/hsimple.root
        root://pcna49a:5151/~na49/data/run821.root
        root://pcna49d.cern.ch:5050//v1/data/run810.root

     The only difference with the well known httpd URL's is that the root
     of the remote file tree is the user's home directory. Therefore an
     absolute pathname requires a // after the host or port specifier
     (see last example). Further the expansion of the standard shell
     characters, like ~, $, .., are handled as expected.
     TNetFile (actually TUrl) uses 1094 as default port for rootd.

     Connecting to a rootd requires the remote user id and password.
     TNetFile allows three ways for you to provide your login:
       1) Setting it globally via the static functions:
             TAuthenticate::SetGlobalUser() and
             TAuthenticate::SetGlobalPasswd()
       2) Getting it from the ~/.netrc file (same file as used by ftp)
       3) Command line prompt
     The different methods will be tried in the order given above.
     On machines with AFS rootd will authenticate using AFS (if it was
     compiled with AFS support).

     If the protocol is specified as "roots" a secure authetication
     method will be used. The secure method uses the SRP, Secure Remote
     Passwords, package. SRP uses a so called "asymmetric key exchange
     protocol" in which no passwords are ever send over the wire. This
     protocol is safe against all known security attacks. For more see:

NetFile

     If the protocol is specified as "rootk" kerberos5 will be used for
     authentication.

     The rootd daemon lives in the directory $ROOTSYS/bin. It can be
     started either via inetd or by hand from the command line (no need
     to be super user). For more info about rootd see the web page:

NetFile

TNetSystem() : TSystem("-root", "Net file Helper System")

     Create helper class that allows directory access via rootd.

TNetSystem(const char *url) : TSystem("-root", "Net file Helper System")

     Create helper class that allows directory access via rootd.

~TNetSystem()

     Dtor

Int_t MakeDirectory(const char *dir)

     Make a directory via rootd.

void* OpenDirectory(const char *dir)

     Open a directory via rfiod. Returns an opaque pointer to a dir
     structure. Returns 0 in case of error.

void FreeDirectory(void *dirp)

     Free directory via rootd.

const char* GetDirEntry(void *dirp)

     Get directory entry via rootd. Returns 0 in case no more entries.

Int_t GetPathInfo(const char *path, FileStat_t &buf)

     Get info about a file. Info is returned in the form of a FileStat_t
     structure (see TSystem.h).
     The function returns 0 in case of success and 1 if the file could
     not be stat'ed.

Bool_t AccessPathName(const char *path, EAccessMode mode)

     Returns FALSE if one can access a file using the specified access mode.
     Mode is the same as for the Unix access(2) function.
     Attention, bizarre convention of return value!!

Bool_t ConsistentWith(const char *path, void *dirptr)

     Check consistency of this helper with the one required
     by 'path' or 'dirptr'.

### Inline Functions

                  void* GetDirPtr() const
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
             TNetSystem TNetSystem(const TNetSystem&)
            TNetSystem& operator=(const TNetSystem&)

Author: Fons Rademakers 14/08/97
Last update: root/net:$Name: $:$Id: TNetFile.cxx,v 1.61 2005/05/31 13:29:12 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *