|
|
|
Location:
FTPSESS.h
Link against: ftpsess.lib
class CFTPSession : public CBase
Supported from 6.0
Abstracts the complexity of the full FTP protocol and exports only a few simplified APIs.
|
Defined in CFTPSession:
Cancel(), ChangeDirectory(), Close(), Connect(), Connect(), CreateDirectory(), DeleteDirectory(), DeleteFile(), EASCII, EActive, EBinary, EExpand, ENoOverwrite, EOverwrite, EStream, EUninitialised, Eblock, Epassive, GetCurrentDirectory(), GetVersion(), ListDirectory(), NewL(), RenameFile(), RepresentationType, Restart(), Retrieve(), Store(), TConnectionMode, TOpenMode, TransferMode, ~CFTPSession()
Inherited from CBase:
operator new()
static CFTPSession* NewL(MFtpSessionNotifier* aNotifier);
Allocates and constructs a new FTP session object.
|
|
virtual void Connect(const TSockAddr& aNetAddr, const TDesC8& aUserName, const TDesC8& aPassword, const TConnectionMode aConnectionMode=EActive)=0;
Connects to a remote FTP server, specifying the FTP server by a numeric IP address.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::ConnectionError(), or MFtpSessionNotifier::EUnknownError().
|
virtual void Connect(const THostName& aServerName, const TDesC8& aUserName, const TDesC8& aPassword, const TConnectionMode aConnectionMode=EActive, const TUint aPort=KDefaultServerPiPort)=0;
Connects to a remote FTP server, specifying the FTP server by a DNS name.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::ConnectionError(), or MFtpSessionNotifier::EUnknownError().
|
virtual void Close()=0;
Closes the current connection with the FTP server.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), or MFtpSessionNotifier::EUnknownError().
This cannot be called when an operation is in progress.
virtual void Cancel()=0;
Cancels the last operation.
Cancel is only implemented for lengthy operations, that is:
Connect(), Store(), Retrieve(), and ListDirectory().
For these operations, once cancel has been called, the MFtpSessionNotifier::Cancel() callback is called.
For other operations, calling cancel has no effect (it would take longer to wait for an acknowledgement to the Cancel, than waiting for the result of the current operation). However, a completion callback will be called, as well as MFtpSessionNotifier::Cancel().
virtual void Restart(const TUint aTFTPRestartOffset)=0;
After a connection is re-established, restarts the last aborted transfer operation (i.e. Store/Retrieve).
It is the responsibility of the client to remember and reset the state of the connection before attempting to resume the transfer: i.e. the client should re-establish the connection to the server and return to the relevant directory, then it should issue the Restart command with the offset it has saved, and then issue the Store or Retrieve command.
The Restart command should be avoided if the transfer was done in ASCII mode, as, because the server peforms a conversion on the bytestream format that it gets from the file before sending, the file size on the receiving end will be different than the size on the sending end. This means it is not possible to compute an offset for the sending end.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::OperationNotSupported(), or MFtpSessionNotifier::EUnknownError().
|
virtual void Store(const TDesC& aLocalFileName, const TDesC8& aNewRemoteFileName, const TBool aOverwrite=EFalse, const RepresentationType aRepresentationType=EBinary, const TransferMode aTransferMode=EStream)=0;
Transfers a file to the FTP server.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::ConnectionError(), MFtpSessionNotifier::LocalFileSystemError(), MFtpSessionNotifier::RemoteFileSystemError() or MFtpSessionNotifier::EUnknownError().
|
virtual void Retrieve(const TDesC8& aRemoteFileName, const TDesC& aNewLocalFileName, const TOpenMode aOpenMode=EOverwrite, const RepresentationType aRepresentationType=EBinary, const TransferMode aTransferMode=EStream)=0;
Transfers a file from the FTP server.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::LocalFileSystemError(), MFtpSessionNotifier::RemoteFileSystemError() or MFtpSessionNotifier::EUnknownError().
|
virtual void ChangeDirectory(const TDesC8& aDirectoryName)=0;
Sets the current directory on the remote file system.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() or MFtpSessionNotifier::EUnknownError().
|
virtual void CreateDirectory(const TDesC8& aDirectoryName)=0;
Creates a directory on the remote file system.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() or MFtpSessionNotifier::EUnknownError().
|
virtual void DeleteDirectory(const TDesC8& aDirectoryName)=0;
Deletes a directory on the remote file system.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() or MFtpSessionNotifier::EUnknownError().
|
virtual void GetCurrentDirectory()=0;
Gets the client's current directory on the remote file system.
The result is returned to the MFtpSessionNotifier::ServerMessage() callback. The directory name is defined by the RFC as being enclosed between double quotes: for example, an answer will look like:
257 "/developr/rfc" is current directory.
The client must implement a parser to find the text between quotes.
The result can be passed in two or more consecutive calls of ServerMessage().
For example:
First call of ServerMessage: 257 "/developr
Second call of ServerMessage: /rfc" is current directory.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() or MFtpSessionNotifier::EUnknownError().
virtual void ListDirectory(const TDesC8& aDirectoryName, TDes8& aFileList)=0;
Lists the files in a directory on the remote file system.
On successful completion, the aFileList buffer contains the list of files as transmitted by the server. It is the responsibility of the client to parse this buffer to extract relevant information.
aFileList is always appended to, so the client should set its current length to a meaningful value (i.e. 0, to fill the buffer from scratch).
If the list of files is larger than the aFileList buffer, MFtpSessionNotifier::MoreData() is called. At this point, the client must reissue the ListDirectory() request until the MFtpSessionNotifier::Complete() is called.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() or MFtpSessionNotifier::EUnknownError().
|
virtual void DeleteFile(const TDesC8& aFileName)=0;
Deletes a file on the remote file system.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() or MFtpSessionNotifier::EUnknownError().
|
virtual void RenameFile(const TDesC8& aRemoteFileName, const TDesC8& aNewRemoteFileName)=0;
Renames a file on the remote file system.
Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() or MFtpSessionNotifier::EUnknownError().
|
static TUint32 GetVersion(void);
Gets API version information.
The vesion information format is:
byte 3: ftpsess dll major version
byte 2: ftpsess dll minor version
byte 1: ftpprot dll major version
byte 0: ftpprot dll minor version
|
TConnectionMode
FTP connection mode (passive or active see RFC959).
|
RepresentationType
Representation type of a transferred file.
|
TOpenMode
FTP file open mode.
|