library: libCore
#include "TFTP.h"

TFTP


class description - header file - source file
viewCVS header - viewCVS source

class TFTP: public TObject

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
public:
TFTP(const char* url, Int_t parallel = 1, Int_t wsize = kDfltWindowSize, TSocket* sock = 0)
virtual~TFTP()
voidTObject::AbstractMethod(const char* method) const
Bool_tAccessPathName(const char* path, EAccessMode mode = kFileExists, Bool_t print = kFALSE)
virtual voidTObject::AppendPad(Option_t* option = "")
voidAscii()
voidascii()
voidbin()
voidBinary()
virtual voidTObject::Browse(TBrowser* b)
voidbye()
voidcd(const char* dir) const
Int_tChangeDirectory(const char* dir) const
Int_tChangePermission(const char* file, Int_t mode) const
voidchmod(const char* file, Int_t mode) const
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
Int_tClose()
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")
Int_tDeleteDirectory(const char* dir) const
Int_tDeleteFile(const char* file) const
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTObject::Dump() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
voidFreeDirectory(Bool_t print = kFALSE)
voidget(const char* file, const char* localName = "0")
Int_tGetBlockSize() const
const char*GetDirEntry(Bool_t print = kFALSE)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
Long64_tGetFile(const char* file, const char* localName = "0")
virtual const char*TObject::GetIconName() const
Int_tGetMode() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Int_tGetPathInfo(const char* path, FileStat_t& buf, Bool_t print = kFALSE)
Long64_tGetRestartAt() const
TSocket*GetSocket() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tIsOpen() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
Int_tListDirectory(Option_t* cmd = "") const
virtual voidls(Option_t* cmd = "") const
Int_tMakeDirectory(const char* dir, Bool_t print = kFALSE) const
voidTObject::MayNotUse(const char* method) const
voidmkdir(const char* dir) const
voidmv(const char* file1, const char* file2) const
virtual Bool_tTObject::Notify()
Bool_tOpenDirectory(const char* name, Bool_t print = kFALSE)
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* opt = "") const
Int_tPrintDirectory() const
voidput(const char* file, const char* remoteName = "0")
Long64_tPutFile(const char* file, const char* remoteName = "0")
voidpwd() const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
Int_tRenameFile(const char* file1, const char* file2) const
voidTObject::ResetBit(UInt_t f)
voidrm(const char* file) const
voidrmdir(const char* dir) const
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetBlockSize(Int_t blockSize)
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetRestartAt(Long64_t at)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
TFTP()
TFTP(const TFTP&)
voidInit(const char* url, Int_t parallel, Int_t wsize)
voidoperator=(const TFTP&)
voidPrintError(const char* where, Int_t err) const
Int_tRecv(Int_t& status, EMessageTypes& kind) const
voidSetMode(Int_t mode)

Data Members

public:
enum { kDfltBlockSize
kDfltWindowSize
kBinary
kAscii
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
private:
TStringfHostFQDN of remote host
TStringfUserremote user
Int_tfPortport to which to connect
Int_tfParallelnumber of parallel sockets
Int_tfWindowSizetcp window size used
Int_tfProtocolrootd protocol level
Int_tfLastBlocklast block successfully transfered
Int_tfBlockSizesize of data buffer used to transfer
Int_tfModebinary or ascii file transfer mode
Long64_tfRestartAtrestart transmission at specified offset
TStringfCurrentFilefile currently being get or put
TSocket*fSocket! connection to rootd
Long64_tfBytesWritenumber of bytes sent
Long64_tfBytesReadnumber of bytes received
Bool_tfDirIndicates if a remote directory is open
static Long64_tfgBytesWritenumber of bytes sent by all TFTP objects
static Long64_tfgBytesReadnumber of bytes received by all TFTP objects

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, TSocket *sock)
 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.
 An existing connection (TSocket *sock) can also be used to establish
 the FTP session. 
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 *)
 Print some info about the FTP connection.
void PrintError(const char *where, Int_t err)
 Print error string depending on error code.
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 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)
 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)
 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)
 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)
 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()
 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)
 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)
 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)
 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!!
TFTP()
{ }
TFTP(const TFTP &)
void operator=(const TFTP &)
void SetMode(Int_t mode)
{ fMode = mode; }
Int_t GetBlockSize()
{ return fBlockSize; }
void SetRestartAt(Long64_t at)
{ fRestartAt = at; }
Long64_t GetRestartAt()
{ return fRestartAt; }
Int_t GetMode()
{ return fMode; }
Bool_t IsOpen()
{ return fSocket ? kTRUE : kFALSE; }
void Binary()
{ SetMode(kBinary); }
void Ascii()
{ SetMode(kAscii); }
TSocket * GetSocket()
{ return fSocket; }
void put(const char *file, const char *remoteName = 0)
 standard ftp equivalents...
{ PutFile(file, remoteName); }
void get(const char *file, const char *localName = 0)
{ GetFile(file, localName); }
void cd(const char *dir)
{ ChangeDirectory(dir); }
void mkdir(const char *dir)
{ MakeDirectory(dir); }
void rmdir(const char *dir)
{ DeleteDirectory(dir); }
void ls(Option_t *cmd = "")
{ ListDirectory(cmd); }
void pwd()
{ PrintDirectory(); }
void mv(const char *file1, const char *file2)
{ RenameFile(file1, file2); }
void rm(const char *file)
{ DeleteFile(file); }
void chmod(const char *file, Int_t mode)
{ ChangePermission(file, mode); }
void bye()
{ Close(); }
void bin()
{ Binary(); }
void ascii()
{ Ascii(); }

Author: Fons Rademakers 13/02/2001
Last update: root/net:$Name: $:$Id: TFTP.cxx,v 1.34 2005/10/27 16:36:38 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.