epoc32/include/ftpprot.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/ftpprot.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,379 +0,0 @@
     1.4 -/**
     1.5 -* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 -* All rights reserved.
     1.7 -* This component and the accompanying materials are made available
     1.8 -* 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
     1.9 -* which accompanies this distribution, and is available
    1.10 -* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 -*
    1.12 -* Initial Contributors:
    1.13 -* Nokia Corporation - initial contribution.
    1.14 -*
    1.15 -* Contributors:
    1.16 -*
    1.17 -* Description:
    1.18 -* FTP Protocol header file
    1.19 -* Author:	Philippe Gabriel
    1.20 -* 
    1.21 -*
    1.22 -*/
    1.23 -
    1.24 -
    1.25 -
    1.26 -
    1.27 -
    1.28 -/**
    1.29 - @file ftprot.h
    1.30 - @internalComponent
    1.31 -*/
    1.32 -
    1.33 -#if !defined(__FTPPROT_H__)
    1.34 -#define __FTPPROT_H__
    1.35 -
    1.36 -#include <e32base.h>
    1.37 -#include <es_sock.h>
    1.38 -
    1.39 -/** FTPPROT.DLL major version number.
    1.40 -@internalComponent */
    1.41 -#define FTPPROTDLL_VERSION_MAJOR 0x01 // The very first release
    1.42 -/** FTPPROT.DLL minor version number. */
    1.43 -#define FTPPROTDLL_VERSION_MINOR 0x03
    1.44 -/** FTPPROT.DLL version number. */
    1.45 -#define FTPPROTDLL_VERSION_NUMBER (FTPPROTDLL_VERSION_MAJOR<<8)|FTPPROTDLL_VERSION_MINOR
    1.46 -
    1.47 -class MFtpProtocolNotifier
    1.48 -/** FTP engine callback interface.
    1.49 -*
    1.50 -* An FTP engine client implements this interface to receive status and results 
    1.51 -* from asynchronous FTP commands.
    1.52 -* @internalComponent */
    1.53 -	{
    1.54 -// Operation completion return codes.
    1.55 -	
    1.56 -public:
    1.57 -/** FTP engine/session operation completeness codes. */
    1.58 -	enum TOpComp 
    1.59 -	{
    1.60 -	/** Operation completed normally. */
    1.61 -	EOpComplete=0,
    1.62 -	/** Operation cancelled. */
    1.63 -	EOpCanceled,	// User canceled last operation
    1.64 -	/** Operation failed. */
    1.65 -	EOpFailed, 
    1.66 -	/** Sockets level error. */
    1.67 -	ESocketError, 
    1.68 -
    1.69 -	// Connection errors
    1.70 -	/** Connection error: Connection reset. */
    1.71 -	EOpConnectionReset,
    1.72 -	/** Connection error: Connection failed. */
    1.73 -	EOpConnectionFailed,	
    1.74 -	/** Connection error: Server not found. */
    1.75 -	EHostNotFound,
    1.76 -
    1.77 -	// Transfer error 
    1.78 -	/** Transfer error: Transfer was reset. */
    1.79 -	EXferReset,
    1.80 -	/** Transfer error: Transfer is not initialised. */	
    1.81 -	EXferNotInitialised,
    1.82 -
    1.83 -	//Transfer notification
    1.84 -	/** Transfer notification: Data packet was received. */
    1.85 -	EPacketReceived,
    1.86 -	/** Transfer notification: Data packet was sent. */	
    1.87 -	EPacketSent
    1.88 -	};
    1.89 -public:
    1.90 -	/** Destructor. */
    1.91 -	virtual ~MFtpProtocolNotifier(){};
    1.92 -
    1.93 -	/** Positive reply received from server.
    1.94 -	*
    1.95 -	* @param aStatus	Operation completion code */
    1.96 -	virtual void ServerPositiveAnswerNotification(const TOpComp aStatus)=0;
    1.97 -
    1.98 -
    1.99 -	/** Message sent by the FTP server.
   1.100 -	*
   1.101 -	* This returns the full server reply in plain text format.
   1.102 -	* 
   1.103 -	* @param aMessage	The message sent by the server */
   1.104 -	virtual void ServerMessage(const TDesC8& aMessage)=0;
   1.105 -
   1.106 -	/** Data transfer notification received from the server.
   1.107 -	*
   1.108 -	* @param aStatus	Operation completion code */
   1.109 -	virtual void ServerXFerNotification(const TOpComp aStatus)=0;
   1.110 -
   1.111 -	/** Negative reply received from server.
   1.112 -	* 
   1.113 -	* @param aStatus	Operation completion code */
   1.114 -	virtual void ServerNegativeAnswerNotification(const TOpComp aStatus)=0;
   1.115 -
   1.116 -	/** Error condition notification.
   1.117 -	* 
   1.118 -	* @param aStatus	Operation completion code */
   1.119 -	virtual void ErrorNotification(const TOpComp aStatus)=0;
   1.120 -	};
   1.121 -
   1.122 -
   1.123 -class CFtpProtocol : public CBase
   1.124 -/** Implements an FTP engine, and allows the client to access the individual FTP 
   1.125 -* commands as defined in RFC959.
   1.126 -* 
   1.127 -* Note that before commands that cause data to transit on the DTP channel (e.g. NLST, 
   1.128 -* LIST, RETR, STOR) a data buffer must be provided using SendBuffer()/RecvBuffer(). 
   1.129 -* Also, when the client is notified of a MoreData() event, it must re-issue RecvBuffer() 
   1.130 -* to get the rest of the data.
   1.131 -* @internalComponent
   1.132 -*/
   1.133 -	{
   1.134 -public:
   1.135 -
   1.136 -// Establish a connection:
   1.137 -	/** Connect to an FTP server, specifying an IP address.	
   1.138 -	* 
   1.139 -	* @param aNetAddr	FTP server's IP address */
   1.140 -	virtual void Connect(TSockAddr& aNetAddr)=0;	// IP address
   1.141 -
   1.142 -	/** Connect to an FTP server, specifying a DNS name.
   1.143 -	* 
   1.144 -	* @param aServerName	FTP server's DNS name */
   1.145 -	virtual void Connect(const THostName& aServerName)=0;  // URL name
   1.146 -
   1.147 -	/** Connect to an FTP server, specifying a DNS name and port number.
   1.148 -	* 
   1.149 -	* @param aServerName	FTP server's DNS name
   1.150 -	* @param aPort			FTP server's port */
   1.151 -	virtual void Connect(const THostName& aServerName, const TUint aPort)=0; // URL name + port
   1.152 -
   1.153 -// FTP commands, presented in the same order as RFC959:
   1.154 -	/** Issues the USER command.
   1.155 -	* 
   1.156 -	* @param aParam	Telnet string identifying the user */
   1.157 -	virtual void User(const TDesC8& aParam)=0;
   1.158 -
   1.159 -	/** Issues the PASS command.
   1.160 -	* 
   1.161 -	* @param aParam	Telnet string specifying the user's password */
   1.162 -	virtual void Pass(const TDesC8& aParam)=0;
   1.163 -
   1.164 -	/** Issues the ACCT command.
   1.165 -	* 
   1.166 -	* @param aParam	Telnet string identifying the user's account */
   1.167 -	virtual void Acct(const TDesC8& aParam)=0;
   1.168 -
   1.169 -	/** Issues the CWD command.
   1.170 -	* 
   1.171 -	* @param aParam	Directory or other system dependent file group designator */
   1.172 -	virtual void Cwd(const TDesC8& aParam)=0;
   1.173 -
   1.174 -	/** Issues the CDUP command. */
   1.175 -	virtual void Cdup(void)=0;
   1.176 -
   1.177 -	/** Issues the SMNT command.
   1.178 -	* 
   1.179 -	* @param aParam	Pathname specifying a directory or other system dependent file 
   1.180 -	* 				group designator */
   1.181 -	virtual void Smnt(const TDesC8& aParam)=0;
   1.182 -
   1.183 -	/** Issues the QUIT command. */
   1.184 -	virtual void Quit(void)=0;
   1.185 -
   1.186 -	/** Issues the REIN command. */
   1.187 -	virtual void Rein(void)=0;
   1.188 -
   1.189 -	/** Issues the PORT command, setting the Data Transfer Process port to a value 
   1.190 -	* allocated by the Sockets Server. */
   1.191 -	virtual void Port(void)=0;			// Sets the DTP port to one allocated by ESOCK
   1.192 -
   1.193 -	/** Issues the PORT command, specifying a port number.
   1.194 -	* 
   1.195 -	* @param aPort	Port number */
   1.196 -	virtual void Port(TUint aPort)=0;	// Sets the DTP port to a specific one
   1.197 -
   1.198 -	/** Issues the PASV command. */
   1.199 -	virtual void Pasv(void)=0;
   1.200 -
   1.201 -	/** Issues the TYPE command (single parameter).
   1.202 -	* 
   1.203 -	* @param aParam	First representation type parameter */
   1.204 -	virtual void Type(const TDesC8& aParam)=0;
   1.205 -
   1.206 -	/** Issues the TYPE command (two parameters).
   1.207 -	* 
   1.208 -	* @param aParam1	First representation type parameter
   1.209 -	* @param aParam2	Second representation type parameter */
   1.210 -	virtual void Type(const TDesC8& aParam1, const TDesC8& aParam2)=0;
   1.211 -
   1.212 -	/** Issues the STRU command.
   1.213 -	* 
   1.214 -	* @param aParam	Telnet character code specifying the file structure */
   1.215 -	virtual void Stru(const TDesC8& aParam)=0;
   1.216 -
   1.217 -	/** Issues the MODE command.
   1.218 -	* 
   1.219 -	* @param aParam	Telnet character code specifying the data transfer mode */
   1.220 -	virtual void Mode(const TDesC8& aParam)=0;
   1.221 -
   1.222 -	/** Issues the RETR command.
   1.223 -	* 
   1.224 -	* @param aFileName	File name */
   1.225 -	virtual void Retr(const TDesC8& aFileName)=0;
   1.226 -
   1.227 -	/** Issues the STOR command.
   1.228 -	* 
   1.229 -	* @param aFileName	File name */
   1.230 -	virtual void Stor(const TDesC8& aFileName)=0;
   1.231 -
   1.232 -	/** Issues the STOU command. */
   1.233 -	virtual void Stou(void)=0;
   1.234 -
   1.235 -	/** Issues the APPE command.
   1.236 -	* 
   1.237 -	* @param aFileName	File name */
   1.238 -	virtual void Appe(const TDesC8& aFileName)=0;
   1.239 -
   1.240 -	/** Issues the ALLO command (single parameter).
   1.241 -	* 
   1.242 -	* @param aParam	Number of bytes (using the logical byte size) of storage to 
   1.243 -	* 				be reserved for the file */
   1.244 -	virtual void Allo(const TDesC8& aParam)=0;
   1.245 -
   1.246 -	/** Issues the ALLO command (two parameters).
   1.247 -	* 
   1.248 -	* @param aParam1	Number of bytes (using the logical byte size) of storage to 
   1.249 -	* 					be reserved for the file
   1.250 -	* @param aParam2	Maximum record or page size (in logical bytes) */
   1.251 -	virtual void Allo(const TDesC8& aParam1, const TDesC8& aParam2)=0;
   1.252 -
   1.253 -	/** Issues the REST command.
   1.254 -	* 
   1.255 -	* @param aParam	The server marker at which file transfer is to be restarted */
   1.256 -	virtual void Rest(const TDesC8& aParam)=0;
   1.257 -
   1.258 -	/** Issues the RNFR command.
   1.259 -	* 
   1.260 -	* @param aFileName	File name */
   1.261 -	virtual void Rnfr(const TDesC8& aFileName)=0;
   1.262 -
   1.263 -	/** Issues the RNTO command.
   1.264 -	* 
   1.265 -	* @param aFileName	File name */
   1.266 -	virtual void Rnto(const TDesC8& aFileName)=0;
   1.267 -
   1.268 -	/** Issues the ABOR command. */
   1.269 -	virtual void Abor(void)=0;
   1.270 -
   1.271 -	/** Issues the DELE command.
   1.272 -	* 
   1.273 -	* @param aFileName	File name */
   1.274 -	virtual void Dele(const TDesC8& aFileName)=0;
   1.275 -
   1.276 -	/** Issues the RMD command.
   1.277 -	* 
   1.278 -	* @param aParam	Directory name */
   1.279 -	virtual void Rmd(const TDesC8& aParam)=0;
   1.280 -
   1.281 -	/** Issues the MKD command.
   1.282 -	* 
   1.283 -	* @param aParam	Directory name */
   1.284 -	virtual void Mkd(const TDesC8& aParam)=0;
   1.285 -
   1.286 -	/** Issues the PWD command. */
   1.287 -	virtual void Pwd(void)=0;
   1.288 -
   1.289 -	/** Issues the LIST command, giving a null argument. */
   1.290 -	virtual void List(void)=0;
   1.291 -
   1.292 -	/** Issues the LIST command, specifying a file/directory name.
   1.293 -	* 
   1.294 -	* @param aParam	File/directory name */
   1.295 -	virtual void List(const TDesC8& aParam)=0;
   1.296 -
   1.297 -	/** Issues the NLST command, giving a null argument. */
   1.298 -	virtual void Nlst(void)=0;
   1.299 -
   1.300 -	/** Issues the NLST command, specifying a directory name.
   1.301 -	* 
   1.302 -	* @param aParam	Directory name */
   1.303 -	virtual void Nlst(const TDesC8& aParam)=0;
   1.304 -
   1.305 -	/** Issues the SITE command.
   1.306 -	* 
   1.307 -	* @param aParam	SITE command argument */
   1.308 -	virtual void Site(const TDesC8& aParam)=0;
   1.309 -
   1.310 -	/** Issues the SYST command. */
   1.311 -	virtual void Syst(void)=0;
   1.312 -
   1.313 -	/** Issues the STAT command, specifying an argument.
   1.314 -	* 
   1.315 -	* @param aParam	STAT command argument */
   1.316 -	virtual void Stat(const TDesC8& aParam)=0;
   1.317 -
   1.318 -	/** Issues the STAT command (no argument). */
   1.319 -	virtual void Stat(void)=0;
   1.320 -
   1.321 -	/** Issues the HELP command.
   1.322 -	* 
   1.323 -	* @param aParam	HELP command argument */
   1.324 -	virtual void Help(const TDesC8& aParam)=0;
   1.325 -
   1.326 -	/** Issues the HELP command (no argument). */
   1.327 -	virtual void Help(void)=0;
   1.328 -
   1.329 -	/** Issues the NOOP command. */
   1.330 -	virtual void Noop(void)=0;
   1.331 -
   1.332 -// Buffer management for transfer
   1.333 -	// Following functions pass a pointer to a buffer
   1.334 -	// to transfer data to/from the Dtp channel
   1.335 -	// Before an operation which cause data to transit on the 
   1.336 -	// DTP channel to occur (Nlst, List, Retr, Stor)
   1.337 -	// a Buffer must be provided with the following api
   1.338 -	// Also when the client is notified of a MoreData event
   1.339 -	// It must reissue the following operation to get the rest of
   1.340 -	// the data
   1.341 -	/** Specifies a buffer to transfer data to the DTP channel.	
   1.342 -	* 
   1.343 -	* @param aBuffer	Send receive */
   1.344 -	virtual void SendBuffer(TDes8* aBuffer)=0;
   1.345 -
   1.346 -	/** Specifies a buffer to receive data from the DTP channel.
   1.347 -	* 
   1.348 -	* @param aBuffer	Receive buffer */
   1.349 -	virtual void RecvBuffer(TDes8* aBuffer)=0;
   1.350 -
   1.351 -	/** Finishes the transfer initiated by a STOR command. */
   1.352 -	virtual void SendEOF(void)=0; //Finishes the transfer initiated by a stor command
   1.353 -
   1.354 -	/** Cancels current operation. */
   1.355 -	virtual void UserCancel(void)=0;
   1.356 -
   1.357 -// Copies the 3 digits answer received from the FTP server
   1.358 -	/** Gets the 3 digits answer received from the FTP server.
   1.359 -	* 
   1.360 -	* @param aServerAnswer	3 digit answer */
   1.361 -	virtual void FTPServerAnswer(TDes& aServerAnswer)=0;
   1.362 -
   1.363 -	/**
   1.364 -	Returns 32-bit, with MAJOR_VERSION in the highest byte
   1.365 -	MINOR_VERSION in the next byte
   1.366 -	i.e. MAJOR 2, MINOR 0x34, BUILD 0x278 would be "ver 2.52
   1.367 -	*/
   1.368 -	IMPORT_C static TUint32 GetVersion(void);
   1.369 -
   1.370 -	/** Allocates and constructs a new FTP engine object.
   1.371 -	* 
   1.372 -	* @return	New FTP engine object
   1.373 -	*/
   1.374 -	// @param aNotifier Client callback interface. 
   1.375 -	// The FTP engine calls this interface to pass 
   1.376 -	//server responses and status messages to the client.
   1.377 -	IMPORT_C static CFtpProtocol *NewL(MFtpProtocolNotifier*);
   1.378 -
   1.379 -	/**Destructor.*/
   1.380 -	virtual ~CFtpProtocol();
   1.381 -	};
   1.382 -#endif //__FTPPROT_H__