library: libCore #include "TFTP.h" |
TFTP
class description - header file - source file - inheritance tree (.pdf)
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, TSocket* sock = 0)
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)
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)
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
Long64_t fBytesWrite number of bytes sent
Long64_t fBytesRead number of bytes received
Bool_t fDir Indicates if a remote directory is open
static Long64_t fgBytesWrite number of bytes sent by all TFTP objects
static Long64_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
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.
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 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.
const char * GetDirEntry(Bool_t print)
Get directory entry via rootd.
Returns 0 in case no more entries or in case of error.
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!!
void put(const char *file, const char *remoteName = 0)
standard ftp equivalents...
void get(const char *file, const char *localName = 0)
void mkdir(const char *dir)
void rmdir(const char *dir)
void mv(const char *file1, const char *file2)
void rm(const char *file)
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.