TNetFile


class description - source file - inheritance tree

class TNetFile : public TFile

    private:
TNetFile TNetFile() Bool_t Authenticate() Bool_t CheckNetrc(char*& user, char*& passwd) char* GetPasswd() char* GetUser() void Init(Bool_t create) virtual void Print(Option_t* option) void PrintError(const char* where, Int_t err) Int_t Recv(Int_t& status, EMessageTypes& kind) public:
TNetFile TNetFile(const char* url, Option_t* option, const Text_t* ftitle, Int_t compress = 1) virtual void ~TNetFile() TClass* Class() virtual void Close(Option_t* option) virtual void Flush() virtual TClass* IsA() const virtual Bool_t IsOpen() const virtual Bool_t ReadBuffer(char* buf, int len) virtual void Seek(Seek_t offset, TFile::ERelativeTo pos = kBeg) void SetPasswd(const char* passwd) void SetUser(const char* user) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) virtual Bool_t WriteBuffer(const char* buf, int len)

Data Members

private:
TUrl fUrl URL of file TString fUser remote user name Seek_t fOffset seek offset TSocket* fSocket connection to rootd server static char* fgUser static char* fgPasswd

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 ROOTD_*.cxx). TNetFile file names are in standard URL   
 format with protocol "root". The following are valid TNetFile URL's: 
                                                                      
    root://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 432 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:                   
          TNetFile::SetUser() and TNetFile::SetPasswd()               
   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.              
                                                                      
 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:       
 http://root.cern.ch/root/NetFile.html.                               
                                                                      


TNetFile(const char *url, Option_t *option, const Text_t *ftitle, Int_t compress) : TFile(url, "NET", ftitle, compress), fUrl(url)
 Create a NetFile object. A net file is the same as a TFile
 except that it is being accessed via a rootd server. The url
 argument must be of the form: root://host.dom.ain/file.root.
 If the file specified in the URL does not exist, is not accessable
 or can not be created the kZombie bit will be set in the TNetFile
 object. Use IsZombie() to see if the file is accessable.
 If the remote daemon thinks the file is still connected, while you are
 sure this is not the case you can force open the file by preceding the
 option argument with an "f" or "F" , e.g.: "frecreate". Do this only
 in cases when you are very sure nobody else is using the file.

~TNetFile()
 TNetFile dtor. Send close message and close socket.

Bool_t Authenticate()
 Authenticate to remote rootd server. Return kTRUE if authentication
 succeeded.

Bool_t CheckNetrc(char *&user, char *&passwd)
 Try to get user name and passwd from the ~/.netrc file.
 This file will only be used when its access mask is 0600.
 Returns kTRUE if user and passwd were found for the machine
 specified in the URL. User and passwd must be deleted by
 the caller. If kFALSE, user and passwd are 0.

void Close(Option_t *opt)
 Close remote file.

void Flush()
 Flush file to disk.

char* GetUser()
 Get user name to be used for authentication to rootd.
 User is asked to type user name.
 Returns user name (which must be deleted by caller) or 0.

char* GetPasswd()
 Get passwd to be used for authentication to rootd.
 Uses non-echoing command line to get passwd.
 Returns passwd (which must de deleted by caller) or 0.

void Init(Bool_t create)
 Initialize a TNetFile object.

Bool_t IsOpen() const
 Retruns kTRUE if file is open, kFALSE otherwise.

void Print(Option_t *)
 Print some info about the net file.

void PrintError(const char *where, Int_t err)
 Print error string depending on error code.

Bool_t ReadBuffer(char *buf, int len)
 Read specified byte range from remote file via rootd daemon.
 Returns kTRUE in case of error.

Bool_t WriteBuffer(const char *buf, int len)
 Write specified byte range to remote file via rootd daemon.
 Returns kTRUE in case of error.

Int_t Recv(Int_t &status, EMessageTypes &kind)
 Return status from rootd server and message kind. Returns -1 in
 case of error otherwise 8 (sizeof 2 words, status and kind).

void Seek(Seek_t offset, ERelativeTo pos)
 Set position from where to start reading.

void SetUser(const char *user)
 Set user name to be used for authentication to rootd.

void SetPasswd(const char *passwd)
 Set passwd to be used for authentication to rootd.



Inline Functions


           TNetFile TNetFile(const char* url, Option_t* option, const Text_t* ftitle, Int_t compress = 1)
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)


Author: Fons Rademakers 14/08/97
Last update: 2.22/05 04/06/99 18.59.13 by Rene Brun
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.