34 class TFTP :
public TObject {
53 TFTP(): fHost(), fUser(), fPort(0), fParallel(0), fWindowSize(0),
54 fProtocol(0), fLastBlock(0), fBlockSize(0), fMode(0),
55 fRestartAt(0), fCurrentFile(), fSocket(0), fBytesWrite(0),
56 fBytesRead(0), fDir(kFALSE) { }
58 void operator=(
const TFTP &);
59 void Init(
const char *url, Int_t parallel, Int_t wsize);
60 void PrintError(
const char *where, Int_t err)
const;
61 Int_t Recv(Int_t &status, EMessageTypes &kind)
const;
62 void SetMode(Int_t mode) { fMode = mode; }
64 static Long64_t fgBytesWrite;
65 static Long64_t fgBytesRead;
69 kDfltBlockSize = 0x80000,
70 kDfltWindowSize = 65535,
75 TFTP(
const char *url, Int_t parallel = 1, Int_t wsize = kDfltWindowSize,
79 void SetBlockSize(Int_t blockSize);
80 Int_t GetBlockSize()
const {
return fBlockSize; }
81 void SetRestartAt(Long64_t at) { fRestartAt = at; }
82 Long64_t GetRestartAt()
const {
return fRestartAt; }
83 Int_t GetMode()
const {
return fMode; }
85 Bool_t IsOpen()
const {
return fSocket ? kTRUE : kFALSE; }
86 void Print(Option_t *opt =
"")
const;
88 Long64_t PutFile(
const char *file,
const char *remoteName = 0);
89 Long64_t GetFile(
const char *file,
const char *localName = 0);
91 Bool_t AccessPathName(
const char *path, EAccessMode mode = kFileExists,
92 Bool_t print = kFALSE);
93 const char *GetDirEntry(Bool_t print = kFALSE);
94 Int_t GetPathInfo(
const char *path, FileStat_t &buf, Bool_t print = kFALSE);
95 Int_t ChangeDirectory(
const char *dir)
const;
96 Int_t MakeDirectory(
const char *dir, Bool_t print = kFALSE)
const;
97 Int_t DeleteDirectory(
const char *dir)
const;
98 Int_t ListDirectory(Option_t *cmd =
"")
const;
99 void FreeDirectory(Bool_t print = kFALSE);
100 Bool_t OpenDirectory(
const char *name, Bool_t print = kFALSE);
101 Int_t PrintDirectory()
const;
102 Int_t RenameFile(
const char *file1,
const char *file2)
const;
103 Int_t DeleteFile(
const char *file)
const;
104 Int_t ChangePermission(
const char *file, Int_t mode)
const;
106 void Binary() { SetMode(kBinary); }
107 void Ascii() { SetMode(kAscii); }
108 TSocket *GetSocket()
const {
return fSocket; }
111 void put(
const char *file,
const char *remoteName = 0) { PutFile(file, remoteName); }
112 void get(
const char *file,
const char *localName = 0) { GetFile(file, localName); }
113 void cd(
const char *dir)
const { ChangeDirectory(dir); }
114 void mkdir(
const char *dir)
const { MakeDirectory(dir); }
115 void rmdir(
const char *dir)
const { DeleteDirectory(dir); }
116 void ls(Option_t *cmd =
"")
const { ListDirectory(cmd); }
117 void pwd()
const { PrintDirectory(); }
118 void mv(
const char *file1,
const char *file2)
const { RenameFile(file1, file2); }
119 void rm(
const char *file)
const { DeleteFile(file); }
120 void chmod(
const char *file, Int_t mode)
const { ChangePermission(file, mode); }
121 void bye() { Close(); }
122 void bin() { Binary(); }
123 void ascii() { Ascii(); }