epoc32/include/ftpsess.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/**
williamr@2
     2
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
* EPOC32 FTP Engine header file
williamr@2
    16
* Author:	Philippe Gabriel
williamr@2
    17
* Exports set of APIs simplyfying access to the FTP protocol
williamr@2
    18
* 
williamr@2
    19
*
williamr@2
    20
*/
williamr@2
    21
williamr@2
    22
williamr@2
    23
williamr@2
    24
williamr@2
    25
williamr@2
    26
/**
williamr@2
    27
 @file FTPSESS.H
williamr@2
    28
 @internalComponent
williamr@2
    29
*/
williamr@2
    30
williamr@2
    31
#if !defined(__FTPSESS_H__)
williamr@2
    32
#define __FTPSESS_H__
williamr@2
    33
#include <e32base.h>
williamr@2
    34
#include <es_sock.h>
williamr@2
    35
#include <f32file.h>
williamr@2
    36
williamr@2
    37
/**
williamr@2
    38
The very first release
williamr@2
    39
*/
williamr@2
    40
williamr@2
    41
/** FTPSESS.DLL major version number. */
williamr@2
    42
#define FTPSESS_VERSION_MAJOR 0x01 // The very first release
williamr@2
    43
/** FTPSESS.DLL minor version number. */
williamr@2
    44
#define FTPSESS_VERSION_MINOR 0x03
williamr@2
    45
/** FTPSESS.DLL version number. */
williamr@2
    46
#define FTPSESS_VERSION_NUMBER (FTPSESS_VERSION_MAJOR<<8)|FTPSESS_VERSION_MINOR
williamr@2
    47
williamr@2
    48
// Following Def as per RFC 959
williamr@2
    49
/** Default server port.
williamr@2
    50
@internalComponent */
williamr@2
    51
const TUint KDefaultServerPiPort = 21;
williamr@2
    52
//
williamr@2
    53
// MInterface definition to provide callback functions to the client
williamr@2
    54
//
williamr@2
    55
williamr@2
    56
class MFtpSessionNotifier
williamr@2
    57
/** FTP session callback interface.
williamr@2
    58
*
williamr@2
    59
* An FTP session client implements this interface to receive status and results 
williamr@2
    60
* from asynchronous FTP operations.
williamr@2
    61
* 
williamr@2
    62
* Note that, as defined in RFC959, FTP does not allow concurrent execution of 
williamr@2
    63
* several requests. Hence, even though calling an FTP function and getting the 
williamr@2
    64
* result through this interface are asynchronous operations, these events happen 
williamr@2
    65
* in a sequential manner. Each notification that the client receives corresponds 
williamr@2
    66
* to only one currently outstanding operation.
williamr@2
    67
* @internalComponent
williamr@2
    68
*/
williamr@2
    69
	{
williamr@2
    70
public:
williamr@2
    71
//
williamr@2
    72
// Operation completion return codes.
williamr@2
    73
// 
williamr@2
    74
/** FTP engine/session operation completeness codes. */
williamr@2
    75
	enum TOpComp 
williamr@2
    76
		{
williamr@2
    77
	/** Operation completed normally. */
williamr@2
    78
		EOpComplete=0,	// No error
williamr@2
    79
	/** Operation cancelled. */
williamr@2
    80
		EOpCanceled,	// User canceled last operation
williamr@2
    81
williamr@2
    82
		//Connection errors
williamr@2
    83
	/** Connection error: Connect address invalid. */
williamr@2
    84
		EHostNotExist,	// Connect address invalid
williamr@2
    85
	/** Connection error: Sockets level error. */
williamr@2
    86
		ESocketError,	// Problem with socket operation
williamr@2
    87
	/** Connection error: Connection failed. */
williamr@2
    88
		EConnectionFailed,	// Can't connect to FTP port
williamr@2
    89
	/** Connection error: Password needed. */
williamr@2
    90
		EPasswordNeeded,
williamr@2
    91
	/** Connection error: Anonymous login not permitted. */
williamr@2
    92
		EAccountNeeded,	// i.e. anonymous login disallowed
williamr@2
    93
	/** Connection error: UserName, Password combination invalid. */
williamr@2
    94
		ELoginFailed,	// UserName,Password combination invalid
williamr@2
    95
	/** Connection error: Not connected to a server. */
williamr@2
    96
		ENotConnected,	// Not connected to a server
williamr@2
    97
	/** Connection error: Already connected to a server. */
williamr@2
    98
		EAlreadyConnected,	// Already connected to a server
williamr@2
    99
	/** Connection error: Operation timed out. */
williamr@2
   100
		ETimedOut,	// Inactive for too long
williamr@2
   101
williamr@2
   102
		//Local filesystem errors
williamr@2
   103
	/** Local filesystem error: General file system error. */
williamr@2
   104
		EFileSystemError, 
williamr@2
   105
	/** Local filesystem error: File opening failure. */
williamr@2
   106
		EFileOpenFailure, 
williamr@2
   107
	/** Local filesystem error: File reading failure. */
williamr@2
   108
		EFileReadError, 
williamr@2
   109
	/** Local filesystem error: File writing failure. */
williamr@2
   110
		EFileWriteError,
williamr@2
   111
	/** Local filesystem error: File already exists. */
williamr@2
   112
		EFileAlreadyExist,
williamr@2
   113
	/** Local filesystem error: File does not exist. */
williamr@2
   114
		EFileNotExist,
williamr@2
   115
	/** Local filesystem error: Directory already exists. */
williamr@2
   116
		EDirAlreadyExist,
williamr@2
   117
	/** Local filesystem error: Directory does not exist. */
williamr@2
   118
		EDirNotExist,
williamr@2
   119
williamr@2
   120
		// Permission error
williamr@2
   121
	/** Permission error: Permission denied. */
williamr@2
   122
		EPermissionDenied,
williamr@2
   123
williamr@2
   124
		//Remote filesystem errors
williamr@2
   125
	/** Remote filesystem error: General remote file system error. */
williamr@2
   126
		ERemoteFileSystemError, 
williamr@2
   127
	/** Remote filesystem error: Remote file opening failure. */
williamr@2
   128
		ERemoteFileOpenFailure, 
williamr@2
   129
	/** Remote filesystem error: Remote file reading failure. */
williamr@2
   130
		ERemoteFileReadError, 
williamr@2
   131
	/** Remote filesystem error: Remote file writing failure. */
williamr@2
   132
		ERemoteFileWriteError,
williamr@2
   133
	/** Remote filesystem error: Remote file already exists. */
williamr@2
   134
		ERemoteFileAlreadyExist,
williamr@2
   135
	/** Remote filesystem error: Remote file does not exist. */
williamr@2
   136
		ERemoteFileNotExist,
williamr@2
   137
	/** Remote filesystem error: Remote directory already exists. */
williamr@2
   138
		ERemoteDirAlreadyExist,
williamr@2
   139
	/** Remote filesystem error: Remote directory does not exist. */
williamr@2
   140
		ERemoteDirNotExist,
williamr@2
   141
	/** Remote filesystem error: Restart is not supported. */
williamr@2
   142
		ERestartNotSupported
williamr@2
   143
		};
williamr@2
   144
williamr@2
   145
	/** Normal operation completion. */
williamr@2
   146
	virtual void Complete(void)=0;
williamr@2
   147
williamr@2
   148
	// Operation completed, more data to follow
williamr@2
   149
	/** Operation partially completed, with more data to follow. */
williamr@2
   150
	virtual void MoreData(void)=0;
williamr@2
   151
williamr@2
   152
	/** Reports the amount of data already transferred in bytes.
williamr@2
   153
	* 
williamr@2
   154
	* @param aProgress	Amount of data already transferred */
williamr@2
   155
	virtual void TransferProgress(TUint aProgress)=0;
williamr@2
   156
williamr@2
   157
	/** User cancelled an on-going operation. */
williamr@2
   158
	virtual void Cancel(void)=0;
williamr@2
   159
williamr@2
   160
	/** Peer reset the connection. */
williamr@2
   161
	virtual void ConnReset(void)=0;
williamr@2
   162
williamr@2
   163
	/** Error in establishing the connection with the FTP server.
williamr@2
   164
	* 
williamr@2
   165
	* @param aTConnectionError	Operation completion code */
williamr@2
   166
	virtual void ConnectionError(TOpComp aTConnectionError)=0;
williamr@2
   167
williamr@2
   168
	// FTP server does not implement the operation requested
williamr@2
   169
	/** Restart operation not supported. */
williamr@2
   170
	virtual void OperationNotSupported(void)=0;
williamr@2
   171
williamr@2
   172
	// Local File system error
williamr@2
   173
	/** Error with the local file system.
williamr@2
   174
	* 
williamr@2
   175
	* @param aTLocalFileSystemError	Operation completion code */
williamr@2
   176
	virtual void LocalFileSystemError(TOpComp aTLocalFileSystemError)=0;
williamr@2
   177
williamr@2
   178
	// Remote File system error
williamr@2
   179
	/** Error with the remote file system.
williamr@2
   180
	* 
williamr@2
   181
	* @param aTRemoteFileSystemError	Operation completion code */
williamr@2
   182
	virtual void RemoteFileSystemError(TOpComp aTRemoteFileSystemError)=0;
williamr@2
   183
williamr@2
   184
	// Not specified yet
williamr@2
   185
	/** Unspecified error. */
williamr@2
   186
	virtual void EUnknownError()=0;
williamr@2
   187
williamr@2
   188
	// Message reported by server
williamr@2
   189
/** Message sent by the FTP server.
williamr@2
   190
* 
williamr@2
   191
* As specified by the RFC, the server answers all requests from the 
williamr@2
   192
* client with a plain text message beginning with a 3 digit code.
williamr@2
   193
* The error/completion notifications sent back by the FTP session API 
williamr@2
   194
* are derived from these codes. Additionally, this function can be 
williamr@2
   195
* used to get the full string reporting the result of the request. 
williamr@2
   196
* It is recommended that the user interface displays this string to 
williamr@2
   197
* the user, as this gives a more precise idea of the result of the 
williamr@2
   198
* requested operation, especially in case of error.
williamr@2
   199
* 
williamr@2
   200
* @param TDesC8	The message sent by the server */
williamr@2
   201
	virtual void ServerMessage(const TDesC8&)=0;
williamr@2
   202
    	};		
williamr@2
   203
//
williamr@2
   204
// The CFTPSession class
williamr@2
   205
//
williamr@2
   206
class CFTPSession : public CBase
williamr@2
   207
williamr@2
   208
/** Abstracts the complexity of the full FTP protocol and exports only 
williamr@2
   209
* a few simplified APIs.
williamr@2
   210
* @internalComponent */
williamr@2
   211
	{
williamr@2
   212
public:
williamr@2
   213
/** FTP connection mode (passive or active see RFC959). */
williamr@2
   214
	enum TConnectionMode 
williamr@2
   215
		{
williamr@2
   216
	/** Active mode. Server initiates DTP connection to client. */
williamr@2
   217
		EActive=0, //(see RFC959)
williamr@2
   218
	/** Passive mode. Client initiates DTP connection to server.*/
williamr@2
   219
		Epassive   //(see RFC959)
williamr@2
   220
		};
williamr@2
   221
/** Representation type of a transferred file. */
williamr@2
   222
	enum RepresentationType
williamr@2
   223
		{
williamr@2
   224
	/** Uninitialised. */
williamr@2
   225
		EUninitialised=0,						   
williamr@2
   226
	/** File transfered in Binary mode, no translation. */
williamr@2
   227
		EBinary,
williamr@2
   228
	/** File transfered in ASCII mode, translation. */
williamr@2
   229
		EASCII
williamr@2
   230
		};
williamr@2
   231
/** FTP file transfer mode. */
williamr@2
   232
	enum TransferMode
williamr@2
   233
		{
williamr@2
   234
	/** Stream mode; file transfered as a stream of bytes. */
williamr@2
   235
		EStream=0,
williamr@2
   236
	/** Block mode; file transfered as blocks, with header needed to restart aborted transfer. */
williamr@2
   237
		Eblock 
williamr@2
   238
		};
williamr@2
   239
/** FTP file open mode. */
williamr@2
   240
	enum TOpenMode
williamr@2
   241
		{
williamr@2
   242
	/** Overwrite existing file. */
williamr@2
   243
		EOverwrite,
williamr@2
   244
	/** Do not overwrite existing file. */
williamr@2
   245
		ENoOverwrite,
williamr@2
   246
	/** Expand existing file. */
williamr@2
   247
		EExpand
williamr@2
   248
		};
williamr@2
   249
williamr@2
   250
/** Construction */
williamr@2
   251
public:
williamr@2
   252
williamr@2
   253
//
williamr@2
   254
// Connection APIs
williamr@2
   255
//
williamr@2
   256
// Establish a connection with a server:
williamr@2
   257
	/** Connects to a remote FTP server, specifying the FTP server by a numeric IP 
williamr@2
   258
	* address.
williamr@2
   259
	* 
williamr@2
   260
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   261
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::ConnectionError(), 
williamr@2
   262
	* or MFtpSessionNotifier::EUnknownError().
williamr@2
   263
	* 
williamr@2
   264
	* @param aNetAddr			FTP server's IP address
williamr@2
   265
	* @param aUserName			User name to log on the FTP server
williamr@2
   266
	* @param aPassword			Password to identify to the FTP server
williamr@2
   267
	* @param aConnectionMode	Connection mode (passive or active, see RFC959). 
williamr@2
   268
	* 							You must use passive mode if the client is behind a firewall. */
williamr@2
   269
	virtual void Connect(	const TSockAddr& aNetAddr, //IP address
williamr@2
   270
							const TDesC8& aUserName, 
williamr@2
   271
							const TDesC8& aPassword,
williamr@2
   272
							const TConnectionMode aConnectionMode=EActive)=0;
williamr@2
   273
williamr@2
   274
williamr@2
   275
	/** Connects to a remote FTP server, specifying the FTP server by a DNS name.
williamr@2
   276
	* 
williamr@2
   277
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   278
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::ConnectionError(), 
williamr@2
   279
	* or MFtpSessionNotifier::EUnknownError().
williamr@2
   280
	* 
williamr@2
   281
	* @param aServerName		FTP server's DNS name
williamr@2
   282
	* @param aUserName			User name to log on the FTP server
williamr@2
   283
	* @param aPassword			Password to identify to the FTP server
williamr@2
   284
	* @param aConnectionMode	Connection mode (passive or active, see RFC959). You 
williamr@2
   285
	* 							must use passive mode if the client is behind a firewall.
williamr@2
   286
	* @param aPort				Port to connect to initiate the PI connection (see RFC959) */
williamr@2
   287
	virtual void Connect(	const THostName& aServerName, //DNS name
williamr@2
   288
							const TDesC8& aUserName, 
williamr@2
   289
							const TDesC8& aPassword,
williamr@2
   290
							const TConnectionMode aConnectionMode=EActive, 
williamr@2
   291
							const TUint aPort=KDefaultServerPiPort)=0;
williamr@2
   292
williamr@2
   293
williamr@2
   294
// Close connection with a server
williamr@2
   295
	/** Closes the current connection with the FTP server.
williamr@2
   296
	* 
williamr@2
   297
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   298
	* MFtpSessionNotifier::ConnReset(), or MFtpSessionNotifier::EUnknownError().
williamr@2
   299
	* 
williamr@2
   300
	* This cannot be called when an operation is in progress. */
williamr@2
   301
	virtual void Close()=0;
williamr@2
   302
williamr@2
   303
williamr@2
   304
// Cancel last FTP operation
williamr@2
   305
	/** Cancels the last FTP operation.
williamr@2
   306
	* 
williamr@2
   307
	* Cancel is only implemented for lengthy operations, that is: Connect(), Store(), 
williamr@2
   308
	* Retrieve(), and ListDirectory(). For these operations, once cancel has been 
williamr@2
   309
	* called, the MFtpSessionNotifier::Cancel() callback is called.
williamr@2
   310
	* 
williamr@2
   311
	* For other operations, calling Cancel() has no effect (it would take longer to 
williamr@2
   312
	* wait for an acknowledgement to the Cancel(), than waiting for the result of 
williamr@2
   313
	* the current operation). However, a completion callback will be called, as 
williamr@2
   314
	* well as MFtpSessionNotifier::Cancel(). */
williamr@2
   315
	virtual void Cancel()=0;
williamr@2
   316
williamr@2
   317
williamr@2
   318
// Restart an aborted transfer operation
williamr@2
   319
	/** After a connection is re-established, restarts the last aborted transfer operation 
williamr@2
   320
	* (i.e. Store/Retrieve).
williamr@2
   321
	* 
williamr@2
   322
	* It is the responsibility of the client to remember and reset the state of 
williamr@2
   323
	* the connection before attempting to resume the transfer: i.e. the client should 
williamr@2
   324
	* re-establish the connection to the server and return to the relevant directory, 
williamr@2
   325
	* then it should issue the Restart() command with the offset it has saved, and 
williamr@2
   326
	* then issue the Store() or Retrieve() command.
williamr@2
   327
	* 
williamr@2
   328
	* The Restart() command should be avoided if the transfer was done in ASCII mode, 
williamr@2
   329
	* as, because the server peforms a conversion on the bytestream format that 
williamr@2
   330
	* it gets from the file before sending, the file size on the receiving end will 
williamr@2
   331
	* be different than the size on the sending end. This means it is not possible 
williamr@2
   332
	* to compute an offset for the sending end. 
williamr@2
   333
	* 
williamr@2
   334
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   335
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::OperationNotSupported(), 
williamr@2
   336
	* or MFtpSessionNotifier::EUnknownError().
williamr@2
   337
	* 
williamr@2
   338
	* @param aTFTPRestartOffset	An offset in bytes in the file from where transfer 
williamr@2
   339
	* 							is to be resumed */
williamr@2
   340
	virtual void Restart(const TUint aTFTPRestartOffset)=0;
williamr@2
   341
williamr@2
   342
//
williamr@2
   343
// Transfer APIs
williamr@2
   344
//
williamr@2
   345
// Store a file on the server	
williamr@2
   346
	/** Transfers a file to the FTP server.
williamr@2
   347
	* 
williamr@2
   348
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   349
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::ConnectionError(), 
williamr@2
   350
	* MFtpSessionNotifier::LocalFileSystemError(), MFtpSessionNotifier::RemoteFileSystemError() 
williamr@2
   351
	* or MFtpSessionNotifier::EUnknownError().
williamr@2
   352
	* 
williamr@2
   353
	* @param aLocalFileName			Name of the local file to be transferred
williamr@2
   354
	* @param aNewRemoteFileName		Name of the remote file to be created
williamr@2
   355
	* @param aOverwrite				If ETrue, overwrite a remote file with the same name if it 
williamr@2
   356
	* 								exists; if EFalse, fail if a remote file with the same name exists
williamr@2
   357
	* @param aRepresentationType	The representation type of the transferred file, ASCII or Binary
williamr@2
   358
	* @param aTransferMode			The transfer mode, stream mode or block mode. This is 
williamr@2
   359
	* 								ignored and assumed to be stream, as block mode seems to be obsolete. */
williamr@2
   360
	virtual void Store(	const TDesC& aLocalFileName,
williamr@2
   361
						const TDesC8& aNewRemoteFileName,
williamr@2
   362
						const TBool	aOverwrite = EFalse,
williamr@2
   363
						const RepresentationType aRepresentationType = EBinary,
williamr@2
   364
						const TransferMode aTransferMode = EStream)=0;
williamr@2
   365
	
williamr@2
   366
williamr@2
   367
// Get a file from the server
williamr@2
   368
	/** Transfers a file from the FTP server.
williamr@2
   369
	* 
williamr@2
   370
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   371
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::LocalFileSystemError(), 
williamr@2
   372
	* MFtpSessionNotifier::RemoteFileSystemError() or MFtpSessionNotifier::EUnknownError().
williamr@2
   373
	* 
williamr@2
   374
	* @param aRemoteFileName		The remote file Name
williamr@2
   375
	* @param aNewLocalFileName		Name of the local file to be created
williamr@2
   376
	* @param aOpenMode				Specifies whether to overwrite a local file with the same 
williamr@2
   377
	* 								name if it already exists
williamr@2
   378
	* @param aRepresentationType	The representation type of the transferred file, 
williamr@2
   379
	* 								ASCII or Binary
williamr@2
   380
	* @param aTransferMode			The transfer mode, stream mode or block mode. This is 
williamr@2
   381
	* 								ignored and assumed to be stream, as block mode seems to be obsolete. */
williamr@2
   382
	virtual void Retrieve(	const TDesC8& aRemoteFileName,
williamr@2
   383
							const TDesC& aNewLocalFileName,
williamr@2
   384
							const TOpenMode	aOpenMode = EOverwrite,
williamr@2
   385
							const RepresentationType aRepresentationType = EBinary,
williamr@2
   386
							const TransferMode aTransferMode = EStream)=0;
williamr@2
   387
	
williamr@2
   388
williamr@2
   389
//
williamr@2
   390
// File system management functions
williamr@2
   391
//
williamr@2
   392
	/** Sets the current directory on the remote file system.
williamr@2
   393
	* 
williamr@2
   394
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   395
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() 
williamr@2
   396
	* or MFtpSessionNotifier::EUnknownError().
williamr@2
   397
	* 
williamr@2
   398
	* @param aDirectoryName	Directory name */
williamr@2
   399
	virtual void ChangeDirectory(const TDesC8& aDirectoryName)=0;
williamr@2
   400
williamr@2
   401
williamr@2
   402
	/** Creates a directory on the remote file system.
williamr@2
   403
	* 
williamr@2
   404
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   405
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() 
williamr@2
   406
	* or MFtpSessionNotifier::EUnknownError().
williamr@2
   407
	* 
williamr@2
   408
	* @param aDirectoryName	A directory name. This can be absolute or relative. */
williamr@2
   409
	virtual void CreateDirectory(const TDesC8& aDirectoryName)=0;
williamr@2
   410
williamr@2
   411
williamr@2
   412
	/** Deletes a directory on the remote file system.
williamr@2
   413
	* 
williamr@2
   414
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   415
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() 
williamr@2
   416
	* or MFtpSessionNotifier::EUnknownError().
williamr@2
   417
	* 
williamr@2
   418
	* @param aDirectoryName	A directory name. This can be absolute or relative. */
williamr@2
   419
	virtual void DeleteDirectory(const TDesC8& aDirectoryName)=0;
williamr@2
   420
williamr@2
   421
williamr@2
   422
	/** Gets the client's current directory on the remote file system.
williamr@2
   423
	* 
williamr@2
   424
	* The result is returned to the MFtpSessionNotifier::ServerMessage() callback. 
williamr@2
   425
	* The directory name is defined by the RFC as being enclosed between double 
williamr@2
   426
	* quotes: for example, an answer will look like:
williamr@2
   427
	* 
williamr@2
   428
	* @code
williamr@2
   429
	* 257 "/developr/rfc" is current directory.
williamr@2
   430
	* @endcode
williamr@2
   431
	* The client must implement a parser to find the text between quotes.
williamr@2
   432
	* 
williamr@2
   433
	* The result can be passed in two or more consecutive calls of MFtpSessionNotifier::ServerMessage(). 
williamr@2
   434
	* For example:
williamr@2
   435
	* 
williamr@2
   436
	* First call of MFtpSessionNotifier::ServerMessage(): @code 257 "/developr @endcode
williamr@2
   437
	* 
williamr@2
   438
	* Second call of MFtpSessionNotifier::ServerMessage(): @code /rfc" is current directory. @endcode
williamr@2
   439
	* 
williamr@2
   440
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   441
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() 
williamr@2
   442
	* or MFtpSessionNotifier::EUnknownError(). */
williamr@2
   443
	virtual void GetCurrentDirectory(void)=0;
williamr@2
   444
williamr@2
   445
williamr@2
   446
	/** Lists the files in a directory on the remote file system.
williamr@2
   447
	* 
williamr@2
   448
	* On successful completion, the aFileList buffer contains the list of files 
williamr@2
   449
	* as transmitted by the server. It is the responsibility of the client to parse 
williamr@2
   450
	* this buffer to extract relevant information. aFileList is always appended 
williamr@2
   451
	* to, so the client should set its current length to a meaningful value (i.e. 
williamr@2
   452
	* 0, to fill the buffer from scratch).
williamr@2
   453
	* 
williamr@2
   454
	* If the list of files is larger than the aFileList buffer, MFtpSessionNotifier::MoreData() 
williamr@2
   455
	* is called. At this point, the client must reissue the ListDirectory() request 
williamr@2
   456
	* until the MFtpSessionNotifier::Complete() is called.
williamr@2
   457
	* 
williamr@2
   458
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   459
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() 
williamr@2
   460
	* or MFtpSessionNotifier::EUnknownError().
williamr@2
   461
	* 
williamr@2
   462
	* @param aDirectoryName	A directory name. This can be absolute or relative.
williamr@2
   463
	* @param aFileList		On completion, the file list. The buffer is allocated by the client. */
williamr@2
   464
	virtual void ListDirectory(const	TDesC8& aDirectoryName,
williamr@2
   465
										TDes8& aFileList)=0;
williamr@2
   466
	
williamr@2
   467
williamr@2
   468
	/** Deletes a file on the remote file system.
williamr@2
   469
	* 
williamr@2
   470
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   471
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() 
williamr@2
   472
	* or MFtpSessionNotifier::EUnknownError().
williamr@2
   473
	* 
williamr@2
   474
	* @param aFileName	A file name */
williamr@2
   475
	virtual void DeleteFile(const TDesC8& aFileName)=0;
williamr@2
   476
	
williamr@2
   477
	/** Renames a file on the remote file system.
williamr@2
   478
	* 
williamr@2
   479
	* Completion is indicated by a callback to one of MFtpSessionNotifier::Complete(), 
williamr@2
   480
	* MFtpSessionNotifier::ConnReset(), MFtpSessionNotifier::RemoteFileSystemError() 
williamr@2
   481
	* or MFtpSessionNotifier::EUnknownError().
williamr@2
   482
	* 
williamr@2
   483
	* @param aRemoteFileName	An existing file name
williamr@2
   484
	* @param aNewRemoteFileName	A new file name */
williamr@2
   485
	virtual void RenameFile(const TDesC8& aRemoteFileName,
williamr@2
   486
							const TDesC8& aNewRemoteFileName)=0;
williamr@2
   487
williamr@2
   488
williamr@2
   489
	/**
williamr@2
   490
	Returns 32-bit, with 
williamr@2
   491
	ftpsess dll MAJOR_VERSION in msb of the msw
williamr@2
   492
	ftpsess dll MINOR_VERSION in lsb of the msw
williamr@2
   493
	ftpprot dll MAJOR_VERSION in msb of the lsw
williamr@2
   494
	ftpprot dll MINOR_VERSION in lsb of the lsw
williamr@2
   495
	*/
williamr@2
   496
	IMPORT_C static TUint32 GetVersion(void);
williamr@2
   497
williamr@2
   498
	/** Allocates and constructs a new FTP session object. 
williamr@2
   499
	* 
williamr@2
   500
	* @param aNotifier	Callback interface to notify the client of the completion of 
williamr@2
   501
	* 					operations or to report errors. For each FTP session, the FTP 
williamr@2
   502
	* 					client should instantiate an object of this type.
williamr@2
   503
	* @return			New FTP session object
williamr@2
   504
	*/
williamr@2
   505
	IMPORT_C static CFTPSession* NewL(MFtpSessionNotifier* aNotifier);
williamr@2
   506
williamr@2
   507
	/**Destructor.*/
williamr@2
   508
	virtual ~CFTPSession();
williamr@2
   509
};
williamr@2
   510
#endif