ROOT  6.06/09
Reference Guide
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
TFTP Class Reference

Definition at line 42 of file TFTP.h.

Public Types

enum  { kDfltBlockSize = 0x80000, kDfltWindowSize = 65535, kBinary = 0, kAscii = 1 }
 
- Public Types inherited from TObject
enum  EStatusBits {
  kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4),
  kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13)
}
 
enum  { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff }
 
enum  { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) }
 

Public Member Functions

 TFTP (const char *url, Int_t parallel=1, Int_t wsize=kDfltWindowSize, TSocket *sock=0)
 
virtual ~TFTP ()
 TFTP dtor. Send close message and close socket. More...
 
void SetBlockSize (Int_t blockSize)
 Make sure the block size is a power of two, with a minimum of 32768. More...
 
Int_t GetBlockSize () const
 
void SetRestartAt (Long64_t at)
 
Long64_t GetRestartAt () const
 
Int_t GetMode () const
 
Bool_t IsOpen () const
 
void Print (Option_t *opt="") const
 Print some info about the FTP connection. More...
 
Long64_t PutFile (const char *file, const char *remoteName=0)
 Transfer file to remote host. More...
 
Long64_t GetFile (const char *file, const char *localName=0)
 Transfer file from remote host. More...
 
Bool_t AccessPathName (const char *path, EAccessMode mode=kFileExists, Bool_t print=kFALSE)
 Returns kFALSE if one can access a file using the specified access mode. More...
 
const char * GetDirEntry (Bool_t print=kFALSE)
 Get directory entry via rootd. More...
 
Int_t GetPathInfo (const char *path, FileStat_t &buf, Bool_t print=kFALSE)
 Get info about a file. More...
 
Int_t ChangeDirectory (const char *dir) const
 Change the remote directory. More...
 
Int_t MakeDirectory (const char *dir, Bool_t print=kFALSE) const
 Make a remote directory. More...
 
Int_t DeleteDirectory (const char *dir) const
 Delete a remote directory. More...
 
Int_t ListDirectory (Option_t *cmd="") const
 List remote directory. More...
 
void FreeDirectory (Bool_t print=kFALSE)
 Free a remotely open directory via rootd. More...
 
Bool_t OpenDirectory (const char *name, Bool_t print=kFALSE)
 Open a directory via rootd. More...
 
Int_t PrintDirectory () const
 Print path of remote working directory. More...
 
Int_t RenameFile (const char *file1, const char *file2) const
 Rename a remote file. More...
 
Int_t DeleteFile (const char *file) const
 Delete a remote file. More...
 
Int_t ChangePermission (const char *file, Int_t mode) const
 Change permissions of a remote file. More...
 
Int_t Close ()
 Close ftp connection. More...
 
void Binary ()
 
void Ascii ()
 
TSocketGetSocket () 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
 The ls function lists the contents of a class on stdout. More...
 
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 ()
 
- Public Member Functions inherited from TObject
 TObject ()
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual ~TObject ()
 TObject destructor. More...
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad. More...
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action. More...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare abstract method. More...
 
virtual void Copy (TObject &object) const
 Copy this to obj. More...
 
virtual void Delete (Option_t *option="")
 Delete this object. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object. More...
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects. More...
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs. More...
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current pad. More...
 
virtual void Dump () const
 Dump contents of object on stdout. More...
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 Execute method on this object with the given parameter string, e.g. More...
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 Execute method on this object with parameters stored in the TObjArray. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py). More...
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual Option_tGetOption () const
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname". More...
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl. More...
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas. More...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory). More...
 
virtual Bool_t IsSortable () const
 
Bool_t IsOnHeap () const
 
Bool_t IsZombie () const
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself. More...
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list. More...
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list. More...
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out". More...
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object. More...
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id. More...
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory. More...
 
voidoperator new (size_t sz)
 
voidoperator new[] (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz, void *vp)
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. More...
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f. More...
 
void SetBit (UInt_t f)
 
void ResetBit (UInt_t f)
 
Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
void InvertBit (UInt_t f)
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. More...
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. More...
 

Private Member Functions

 TFTP ()
 
 TFTP (const TFTP &)
 
void operator= (const TFTP &)
 
void Init (const char *url, Int_t parallel, Int_t wsize)
 Set up the actual connection. More...
 
void PrintError (const char *where, Int_t err) const
 Print error string depending on error code. More...
 
Int_t Recv (Int_t &status, EMessageTypes &kind) const
 Return status from rootd server and message kind. More...
 
void SetMode (Int_t mode)
 

Private Attributes

TString fHost
 
TString fUser
 
Int_t fPort
 
Int_t fParallel
 
Int_t fWindowSize
 
Int_t fProtocol
 
Int_t fLastBlock
 
Int_t fBlockSize
 
Int_t fMode
 
Long64_t fRestartAt
 
TString fCurrentFile
 
TSocketfSocket
 
Long64_t fBytesWrite
 connection to rootd More...
 
Long64_t fBytesRead
 
Bool_t fDir
 

Static Private Attributes

static Long64_t fgBytesWrite = 0
 
static Long64_t fgBytesRead = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat flag. More...
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable. More...
 
- Protected Member Functions inherited from TObject
void MakeZombie ()
 
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected). More...
 

#include <TFTP.h>

+ Inheritance diagram for TFTP:
+ Collaboration diagram for TFTP:

Member Enumeration Documentation

anonymous enum
Enumerator
kDfltBlockSize 
kDfltWindowSize 
kBinary 
kAscii 

Definition at line 76 of file TFTP.h.

Constructor & Destructor Documentation

TFTP::TFTP ( )
inlineprivate

Definition at line 61 of file TFTP.h.

TFTP::TFTP ( const TFTP )
private
TFTP::TFTP ( const char *  url,
Int_t  parallel = 1,
Int_t  wsize = kDfltWindowSize,
TSocket sock = 0 
)
TFTP::~TFTP ( )
virtual

TFTP dtor. Send close message and close socket.

Definition at line 149 of file TFTP.cxx.

Member Function Documentation

Bool_t TFTP::AccessPathName ( const char *  path,
EAccessMode  mode = kFileExists,
Bool_t  print = kFALSE 
)

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!!

Definition at line 1111 of file TFTP.cxx.

Referenced by TNetSystem::AccessPathName().

void TFTP::Ascii ( )
inline

Definition at line 115 of file TFTP.h.

Referenced by ascii().

void TFTP::ascii ( )
inline

Definition at line 131 of file TFTP.h.

void TFTP::bin ( )
inline

Definition at line 130 of file TFTP.h.

void TFTP::Binary ( )
inline

Definition at line 114 of file TFTP.h.

Referenced by bin().

void TFTP::bye ( )
inline

Definition at line 129 of file TFTP.h.

void TFTP::cd ( const char *  dir) const
inline

Definition at line 121 of file TFTP.h.

Int_t TFTP::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.

Definition at line 628 of file TFTP.cxx.

Referenced by cd().

Int_t TFTP::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.

Definition at line 853 of file TFTP.cxx.

Referenced by chmod().

void TFTP::chmod ( const char *  file,
Int_t  mode 
) const
inline

Definition at line 128 of file TFTP.h.

Int_t TFTP::Close ( )

Close ftp connection.

Returns 0 in case of success and -1 in case of failure.

Definition at line 884 of file TFTP.cxx.

Referenced by bye(), TNetSystem::Create(), ~TFTP(), and TNetSystem::~TNetSystem().

Int_t TFTP::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.

Definition at line 702 of file TFTP.cxx.

Referenced by rmdir().

Int_t TFTP::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.

Definition at line 821 of file TFTP.cxx.

Referenced by rm().

void TFTP::FreeDirectory ( Bool_t  print = kFALSE)

Free a remotely open directory via rootd.

Definition at line 956 of file TFTP.cxx.

Referenced by TNetSystem::FreeDirectory(), TNetSystem::OpenDirectory(), and TNetSystem::~TNetSystem().

void TFTP::get ( const char *  file,
const char *  localName = 0 
)
inline

Definition at line 120 of file TFTP.h.

Int_t TFTP::GetBlockSize ( ) const
inline

Definition at line 88 of file TFTP.h.

const char * TFTP::GetDirEntry ( Bool_t  print = kFALSE)

Get directory entry via rootd.

Returns 0 in case no more entries or in case of error.

Definition at line 988 of file TFTP.cxx.

Referenced by TNetSystem::GetDirEntry().

Long64_t TFTP::GetFile ( const char *  file,
const char *  localName = 0 
)

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

Definition at line 406 of file TFTP.cxx.

Referenced by get().

Int_t TFTP::GetMode ( ) const
inline

Definition at line 91 of file TFTP.h.

Int_t TFTP::GetPathInfo ( const char *  path,
FileStat_t buf,
Bool_t  print = kFALSE 
)

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.

Definition at line 1029 of file TFTP.cxx.

Referenced by TNetSystem::GetPathInfo().

Long64_t TFTP::GetRestartAt ( ) const
inline

Definition at line 90 of file TFTP.h.

TSocket* TFTP::GetSocket ( ) const
inline

Definition at line 116 of file TFTP.h.

Referenced by TNetSystem::Create().

void TFTP::Init ( const char *  url,
Int_t  parallel,
Int_t  wsize 
)
private

Set up the actual connection.

Definition at line 95 of file TFTP.cxx.

Bool_t TFTP::IsOpen ( ) const
inline
Int_t TFTP::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.

Definition at line 734 of file TFTP.cxx.

Referenced by ls().

void TFTP::ls ( Option_t option = "") const
inlinevirtual

The ls function lists the contents of a class on stdout.

Ls output is typically much less verbose then Dump().

Reimplemented from TObject.

Definition at line 124 of file TFTP.h.

Int_t TFTP::MakeDirectory ( const char *  dir,
Bool_t  print = kFALSE 
) const

Make a remote directory.

Anonymous users may not create directories. Returns 0 in case of success and -1 in case of failure.

Definition at line 667 of file TFTP.cxx.

Referenced by TNetSystem::MakeDirectory(), and mkdir().

void TFTP::mkdir ( const char *  dir) const
inline

Definition at line 122 of file TFTP.h.

void TFTP::mv ( const char *  file1,
const char *  file2 
) const
inline

Definition at line 126 of file TFTP.h.

Bool_t TFTP::OpenDirectory ( const char *  dir,
Bool_t  print = kFALSE 
)

Open a directory via rootd.

Returns kTRUE in case of success. Returns kFALSE in case of error.

Definition at line 914 of file TFTP.cxx.

Referenced by TNetSystem::OpenDirectory().

void TFTP::operator= ( const TFTP )
private
void TFTP::Print ( Option_t opt = "") const
virtual

Print some info about the FTP connection.

Reimplemented from TObject.

Definition at line 157 of file TFTP.cxx.

Int_t TFTP::PrintDirectory ( ) const

Print path of remote working directory.

Returns 0 in case of succes and -1 in cse of failure.

Definition at line 764 of file TFTP.cxx.

Referenced by pwd().

void TFTP::PrintError ( const char *  where,
Int_t  err 
) const
private

Print error string depending on error code.

Definition at line 182 of file TFTP.cxx.

Referenced by GetFile(), and PutFile().

void TFTP::put ( const char *  file,
const char *  remoteName = 0 
)
inline

Definition at line 119 of file TFTP.h.

Long64_t TFTP::PutFile ( const char *  file,
const char *  remoteName = 0 
)

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

Definition at line 233 of file TFTP.cxx.

Referenced by put().

void TFTP::pwd ( ) const
inline

Definition at line 125 of file TFTP.h.

Int_t TFTP::Recv ( Int_t status,
EMessageTypes kind 
) const
private

Return status from rootd server and message kind.

Returns -1 in case of error otherwise 8 (sizeof 2 words, status and kind).

Definition at line 191 of file TFTP.cxx.

Referenced by GetFile(), and PutFile().

Int_t TFTP::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.

Definition at line 790 of file TFTP.cxx.

Referenced by mv().

void TFTP::rm ( const char *  file) const
inline

Definition at line 127 of file TFTP.h.

void TFTP::rmdir ( const char *  dir) const
inline

Definition at line 123 of file TFTP.h.

void TFTP::SetBlockSize ( Int_t  blockSize)

Make sure the block size is a power of two, with a minimum of 32768.

Definition at line 207 of file TFTP.cxx.

void TFTP::SetMode ( Int_t  mode)
inlineprivate

Definition at line 70 of file TFTP.h.

Referenced by Ascii(), and Binary().

void TFTP::SetRestartAt ( Long64_t  at)
inline

Definition at line 89 of file TFTP.h.

Member Data Documentation

Int_t TFTP::fBlockSize
private

Definition at line 52 of file TFTP.h.

Referenced by GetBlockSize(), GetFile(), Init(), Print(), PutFile(), and SetBlockSize().

Long64_t TFTP::fBytesRead
private

Definition at line 58 of file TFTP.h.

Referenced by GetFile(), Init(), and Print().

Long64_t TFTP::fBytesWrite
private

connection to rootd

Definition at line 57 of file TFTP.h.

Referenced by Init(), Print(), and PutFile().

TString TFTP::fCurrentFile
private

Definition at line 55 of file TFTP.h.

Bool_t TFTP::fDir
private

Definition at line 59 of file TFTP.h.

Referenced by FreeDirectory(), GetDirEntry(), and OpenDirectory().

Long64_t TFTP::fgBytesRead = 0
staticprivate

Definition at line 73 of file TFTP.h.

Referenced by GetFile().

Long64_t TFTP::fgBytesWrite = 0
staticprivate

Definition at line 72 of file TFTP.h.

Referenced by PutFile().

TString TFTP::fHost
private

Definition at line 45 of file TFTP.h.

Referenced by Init(), and Print().

Int_t TFTP::fLastBlock
private

Definition at line 51 of file TFTP.h.

Referenced by Init().

Int_t TFTP::fMode
private

Definition at line 53 of file TFTP.h.

Referenced by GetFile(), GetMode(), Init(), Print(), and PutFile().

Int_t TFTP::fParallel
private

Definition at line 48 of file TFTP.h.

Referenced by Init(), and Print().

Int_t TFTP::fPort
private

Definition at line 47 of file TFTP.h.

Referenced by Init(), and Print().

Int_t TFTP::fProtocol
private
Long64_t TFTP::fRestartAt
private

Definition at line 54 of file TFTP.h.

Referenced by GetFile(), GetRestartAt(), Init(), and PutFile().

TSocket* TFTP::fSocket
private
TString TFTP::fUser
private

Definition at line 46 of file TFTP.h.

Referenced by Init(), and Print().

Int_t TFTP::fWindowSize
private

Definition at line 49 of file TFTP.h.

Referenced by Init(), and Print().


The documentation for this class was generated from the following files: