Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TFTP Class Reference

Definition at line 34 of file TFTP.h.

Public Types

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

Public Member Functions

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

Private Member Functions

 TFTP ()
 
 TFTP (const TFTP &)
 
void Init (const char *url, Int_t parallel, Int_t wsize)
 Set up the actual connection.
 
void operator= (const TFTP &)
 
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.
 
void SetMode (Int_t mode)
 

Private Attributes

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

Static Private Attributes

static Long64_t fgBytesRead = 0
 
static Long64_t fgBytesWrite = 0
 

Additional Inherited Members

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

#include <TFTP.h>

Inheritance diagram for TFTP:
[legend]

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kDfltBlockSize 
kDfltWindowSize 
kBinary 
kAscii 

Definition at line 68 of file TFTP.h.

Constructor & Destructor Documentation

◆ TFTP() [1/3]

TFTP::TFTP ( )
inlineprivate

Definition at line 53 of file TFTP.h.

◆ TFTP() [2/3]

TFTP::TFTP ( const TFTP )
private

◆ TFTP() [3/3]

TFTP::TFTP ( const char *  url,
Int_t  par = 1,
Int_t  wsize = kDfltWindowSize,
TSocket sock = 0 
)

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.

Definition at line 74 of file TFTP.cxx.

◆ ~TFTP()

TFTP::~TFTP ( )
virtual

TFTP dtor. Send close message and close socket.

Definition at line 149 of file TFTP.cxx.

Member Function Documentation

◆ AccessPathName()

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.

◆ Ascii()

void TFTP::Ascii ( )
inline

Definition at line 107 of file TFTP.h.

◆ ascii()

void TFTP::ascii ( )
inline

Definition at line 123 of file TFTP.h.

◆ bin()

void TFTP::bin ( )
inline

Definition at line 122 of file TFTP.h.

◆ Binary()

void TFTP::Binary ( )
inline

Definition at line 106 of file TFTP.h.

◆ bye()

void TFTP::bye ( )
inline

Definition at line 121 of file TFTP.h.

◆ cd()

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

Definition at line 113 of file TFTP.h.

◆ ChangeDirectory()

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.

◆ ChangePermission()

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.

◆ chmod()

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

Definition at line 120 of file TFTP.h.

◆ Close()

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.

◆ DeleteDirectory()

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.

◆ DeleteFile()

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.

◆ FreeDirectory()

void TFTP::FreeDirectory ( Bool_t  print = kFALSE)

Free a remotely open directory via rootd.

Definition at line 956 of file TFTP.cxx.

◆ get()

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

Definition at line 112 of file TFTP.h.

◆ GetBlockSize()

Int_t TFTP::GetBlockSize ( ) const
inline

Definition at line 80 of file TFTP.h.

◆ GetDirEntry()

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.

◆ GetFile()

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.

◆ GetMode()

Int_t TFTP::GetMode ( ) const
inline

Definition at line 83 of file TFTP.h.

◆ GetPathInfo()

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.

◆ GetRestartAt()

Long64_t TFTP::GetRestartAt ( ) const
inline

Definition at line 82 of file TFTP.h.

◆ GetSocket()

TSocket * TFTP::GetSocket ( ) const
inline

Definition at line 108 of file TFTP.h.

◆ Init()

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.

◆ IsOpen()

Bool_t TFTP::IsOpen ( ) const
inline

Definition at line 85 of file TFTP.h.

◆ ListDirectory()

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.

◆ 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 116 of file TFTP.h.

◆ MakeDirectory()

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.

◆ mkdir()

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

Definition at line 114 of file TFTP.h.

◆ mv()

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

Definition at line 118 of file TFTP.h.

◆ OpenDirectory()

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.

◆ operator=()

void TFTP::operator= ( const TFTP )
private

◆ Print()

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.

◆ PrintDirectory()

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.

◆ PrintError()

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.

◆ put()

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

Definition at line 111 of file TFTP.h.

◆ PutFile()

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.

◆ pwd()

void TFTP::pwd ( ) const
inline

Definition at line 117 of file TFTP.h.

◆ Recv()

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.

◆ RenameFile()

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.

◆ rm()

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

Definition at line 119 of file TFTP.h.

◆ rmdir()

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

Definition at line 115 of file TFTP.h.

◆ SetBlockSize()

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.

◆ SetMode()

void TFTP::SetMode ( Int_t  mode)
inlineprivate

Definition at line 62 of file TFTP.h.

◆ SetRestartAt()

void TFTP::SetRestartAt ( Long64_t  at)
inline

Definition at line 81 of file TFTP.h.

Member Data Documentation

◆ fBlockSize

Int_t TFTP::fBlockSize
private

Definition at line 44 of file TFTP.h.

◆ fBytesRead

Long64_t TFTP::fBytesRead
private

Definition at line 50 of file TFTP.h.

◆ fBytesWrite

Long64_t TFTP::fBytesWrite
private

connection to rootd

Definition at line 49 of file TFTP.h.

◆ fCurrentFile

TString TFTP::fCurrentFile
private

Definition at line 47 of file TFTP.h.

◆ fDir

Bool_t TFTP::fDir
private

Definition at line 51 of file TFTP.h.

◆ fgBytesRead

Long64_t TFTP::fgBytesRead = 0
staticprivate

Definition at line 65 of file TFTP.h.

◆ fgBytesWrite

Long64_t TFTP::fgBytesWrite = 0
staticprivate

Definition at line 64 of file TFTP.h.

◆ fHost

TString TFTP::fHost
private

Definition at line 37 of file TFTP.h.

◆ fLastBlock

Int_t TFTP::fLastBlock
private

Definition at line 43 of file TFTP.h.

◆ fMode

Int_t TFTP::fMode
private

Definition at line 45 of file TFTP.h.

◆ fParallel

Int_t TFTP::fParallel
private

Definition at line 40 of file TFTP.h.

◆ fPort

Int_t TFTP::fPort
private

Definition at line 39 of file TFTP.h.

◆ fProtocol

Int_t TFTP::fProtocol
private

Definition at line 42 of file TFTP.h.

◆ fRestartAt

Long64_t TFTP::fRestartAt
private

Definition at line 46 of file TFTP.h.

◆ fSocket

TSocket* TFTP::fSocket
private

Definition at line 48 of file TFTP.h.

◆ fUser

TString TFTP::fUser
private

Definition at line 38 of file TFTP.h.

◆ fWindowSize

Int_t TFTP::fWindowSize
private

Definition at line 41 of file TFTP.h.

Libraries for TFTP:

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