#include "TFTP.h"

TFTP


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

class TFTP : public TObject

Inheritance Chart:
TObject
<-
TFTP
    private:
TFTP() TFTP(const TFTP&) void Init(const char* url, Int_t parallel, Int_t wsize) void operator=(const TFTP&) void PrintError(const char* where, Int_t err) const Int_t Recv(Int_t& status, EMessageTypes& kind) const void SetMode(Int_t mode) public:
TFTP(const char* url, Int_t parallel = 1, Int_t wsize = kDfltWindowSize) virtual ~TFTP() Bool_t AccessPathName(const char* path, EAccessMode mode = kFileExists, Bool_t print = kFALSE) void Ascii() void ascii() void bin() void Binary() void bye() void cd(const char* dir) const Int_t ChangeDirectory(const char* dir) const Int_t ChangePermission(const char* file, Int_t mode) const void chmod(const char* file, Int_t mode) const static TClass* Class() Int_t Close() Int_t DeleteDirectory(const char* dir) const Int_t DeleteFile(const char* file) const void FreeDirectory(Bool_t print = kFALSE) void get(const char* file, const char* localName = "0") Int_t GetBlockSize() const const char* GetDirEntry(Bool_t print = kFALSE) const Long64_t GetFile(const char* file, const char* localName = "0") Int_t GetMode() const Int_t GetPathInfo(const char* path, FileStat_t& buf, Bool_t print = kFALSE) Long64_t GetRestartAt() const TSocket* GetSocket() const virtual TClass* IsA() const Bool_t IsOpen() const Int_t ListDirectory(Option_t* cmd) const virtual void ls(Option_t* cmd) const Int_t MakeDirectory(const char* dir, Bool_t print = kFALSE) const void mkdir(const char* dir) const void mv(const char* file1, const char* file2) const Bool_t OpenDirectory(const char* name, Bool_t print = kFALSE) virtual void Print(Option_t* opt) const Int_t PrintDirectory() const void put(const char* file, const char* remoteName = "0") Long64_t PutFile(const char* file, const char* remoteName = "0") void pwd() const Int_t RenameFile(const char* file1, const char* file2) const void rm(const char* file) const void rmdir(const char* dir) const void SetBlockSize(Int_t blockSize) void SetRestartAt(Long64_t at) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members

    private:
TString fHost FQDN of remote host TString fUser remote user Int_t fPort port to which to connect Int_t fParallel number of parallel sockets Int_t fWindowSize tcp window size used Int_t fProtocol rootd protocol level Int_t fLastBlock last block successfully transfered Int_t fBlockSize size of data buffer used to transfer Int_t fMode binary or ascii file transfer mode Long64_t fRestartAt restart transmission at specified offset TString fCurrentFile file currently being get or put TSocket* fSocket ! connection to rootd Double_t fBytesWrite number of bytes sent Double_t fBytesRead number of bytes received Bool_t fDir Indicates if a remote directory is open static Double_t fgBytesWrite number of bytes sent by all TFTP objects static Double_t fgBytesRead number of bytes received by all TFTP objects public:
static const enum TFTP:: kDfltBlockSize static const enum TFTP:: kDfltWindowSize static const enum TFTP:: kBinary static const enum TFTP:: kAscii

Class Description

                                                                      
 TFTP                                                                 
                                                                      
 This class provides all infrastructure for a performant file         
 transfer protocol. It works in conjuction with the rootd daemon      
 and can use parallel sockets to improve performance over fat pipes.  
                                                                      


TFTP(const char *url, Int_t par, Int_t wsize)
 Open connection to host specified by the url using par parallel sockets.
 The url has the form: [root[s,k]://]host[:port].
 If port is not specified the default rootd port (1094) will be used.
 Using wsize one can specify the tcp window size. Normally this is not
 needed when using parallel sockets.

void Init(const char *surl, Int_t par, Int_t wsize)
 Set up the actual connection.

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

void Print(Option_t *) const
 Print some info about the FTP connection.

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

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

void SetBlockSize(Int_t blockSize)
 Make sure the block size is a power of two, with a minimum of 32768.

Long64_t PutFile(const char *file, const char *remoteName)
 Transfer file to remote host. Returns number of bytes
 sent or < 0 in case of error. Error -1 connection is still
 open, error -2 connection has been closed. In case of failure
 fRestartAt is set to the number of bytes correclty transfered.
 Calling PutFile() immediately afterwards will restart at fRestartAt.
 If this is not desired call SetRestartAt(0) before calling PutFile().
 If rootd reports that the file is locked, and you are sure this is not
 the case (e.g. due to a crash), you can force unlock it by prepending
 the remoteName with a '-'.

Long64_t GetFile(const char *file, const char *localName)
 Transfer file from remote host. Returns number of bytes
 received or < 0 in case of error. Error -1 connection is still
 open, error -2 connection has been closed. In case of failure
 fRestartAt is set to the number of bytes correclty transfered.
 Calling GetFile() immediately afterwards will restart at fRestartAt.
 If this is not desired call SetRestartAt(0) before calling GetFile().
 If rootd reports that the file is locked, and you are sure this is not
 the case (e.g. due to a crash), you can force unlock it by prepending
 the file name with a '-'.

Int_t ChangeDirectory(const char *dir) const
 Change the remote directory. If the remote directory contains a .message
 file and it is < 1024 characters then the contents is echoed back.
 Returns 0 in case of success and -1 in case of failure.

Int_t MakeDirectory(const char *dir, Bool_t print) const
 Make a remote directory. Anonymous users may not create directories.
 Returns 0 in case of success and -1 in case of failure.

Int_t DeleteDirectory(const char *dir) const
 Delete a remote directory. Anonymous users may not delete directories.
 Returns 0 in case of success and -1 in case of failure.

Int_t ListDirectory(Option_t *cmd) const
 List remote directory. With cmd you specify the options and directory
 to be listed to ls. Returns 0 in case of success and -1 in case of
 failure.

Int_t PrintDirectory() const
 Print path of remote working directory. Returns 0 in case of succes and
 -1 in cse of failure.

Int_t RenameFile(const char *file1, const char *file2) const
 Rename a remote file. Anonymous users may not rename files.
 Returns 0 in case of success and -1 in case of failure.

Int_t DeleteFile(const char *file) const
 Delete a remote file. Anonymous users may not delete files.
 Returns 0 in case of success and -1 in case of failure.

Int_t ChangePermission(const char *file, Int_t mode) const
 Change permissions of a remote file. Anonymous users may not
 chnage permissions. Returns 0 in case of success and -1 in case
 of failure.

Int_t Close()
 Close ftp connection. Returns 0 in case of success and -1 in case of
 failure.

Bool_t OpenDirectory(const char *dir, Bool_t print)
 Open a directory via rootd.
 Returns kTRUE in case of success.
 Returns kFALSE in case of error.

void FreeDirectory(Bool_t print)
 Free a remotely open directory via rootd.

const char* GetDirEntry(Bool_t print)
 Get directory entry via rootd.
 Returns 0 in case no more entries or in case of error.

Int_t GetPathInfo(const char *path, FileStat_t &buf, Bool_t print)
 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, Bool_t print)
 Returns kFALSE 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!!



Inline Functions


               TFTP TFTP(const TFTP&)
               void operator=(const TFTP&)
               void SetMode(Int_t mode)
               TFTP TFTP(const char* url, Int_t parallel = 1, Int_t wsize = kDfltWindowSize)
              Int_t GetBlockSize() const
               void SetRestartAt(Long64_t at)
           Long64_t GetRestartAt() const
              Int_t GetMode() const
             Bool_t IsOpen() const
               void Binary()
               void Ascii()
           TSocket* GetSocket() const
               void put(const char* file, const char* remoteName = "0")
               void get(const char* file, const char* localName = "0")
               void cd(const char* dir) const
               void mkdir(const char* dir) const
               void rmdir(const char* dir) const
               void ls(Option_t* cmd) const
               void pwd() const
               void mv(const char* file1, const char* file2) const
               void rm(const char* file) const
               void chmod(const char* file, Int_t mode) const
               void bye()
               void bin()
               void ascii()
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)


Author: Fons Rademakers 13/02/2001
Last update: root/net:$Name: $:$Id: TFTP.cxx,v 1.28 2005/02/07 18:02:37 rdm Exp $
Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Class Hierarchy - 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.