TFTP


class description - source file - inheritance tree

class TFTP : public TObject

    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) protected:
public:
TFTP TFTP(const char* url, Int_t parallel = 1, Int_t wsize = kDfltWindowSize) virtual void ~TFTP() 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 get(const char* file, const char* localName = 0) Int_t GetBlockSize() const Seek_t GetFile(const char* file, const char* localName = 0) Int_t GetMode() const Seek_t GetRestartAt() 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) const void mkdir(const char* dir) const void mv(const char* file1, const char* file2) const virtual void Print(Option_t* opt) const Int_t PrintDirectory() const void put(const char* file, const char* remoteName = 0) Seek_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(Seek_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 Seek_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 static Double_t fgBytesWrite number of bytes sent by all TFTP objects static Double_t fgBytesRead number of bytes received by all TFTP objects protected:
public:
static const enum TObject:: kDfltBlockSize static const enum TObject:: kDfltWindowSize static const enum TObject:: kBinary static const enum TObject:: 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]://]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.

Seek_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 '-'.

Seek_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) 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.



Inline Functions


               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(Seek_t at)
             Seek_t GetRestartAt() const
              Int_t GetMode() const
             Bool_t IsOpen() const
               void Binary()
               void Ascii()
               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.9 2001/03/05 15:27:26 rdm Exp $
Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *


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.