epoc32/include/imsk.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/imsk.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/imsk.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,605 @@
     1.4 -imsk.h
     1.5 +// Copyright (c) 1998-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 +// This file contains the API definition for the class CImTextServerSession.
    1.19 +// This class creates sockets and is responsible for transmitting data between client and the server 
    1.20 +// 
    1.21 +//
    1.22 +
    1.23 +
    1.24 +
    1.25 +/**
    1.26 + @file
    1.27 +*/
    1.28 +
    1.29 +
    1.30 +#ifndef __IMSK_H__
    1.31 +#define __IMSK_H__
    1.32 +
    1.33 +#include <e32base.h>
    1.34 +#include <es_sock.h>
    1.35 +#include <in_sock.h>
    1.36 +#include <f32file.h>
    1.37 +#include <mentact.h>
    1.38 +#include <miutlog.h>
    1.39 +#include <miut_err.h>
    1.40 +#include <miuthdr.h>
    1.41 +
    1.42 +#ifdef _DEBUG
    1.43 +#define __IMSK_SIMULATION
    1.44 +#endif
    1.45 +
    1.46 +// Enable Scripting in Debug Builds only
    1.47 +#ifdef _DEBUG
    1.48 +#define __IMSK_SCRIPTING
    1.49 +#endif
    1.50 +
    1.51 +const TInt EActivePriorityHigh = 1;
    1.52 +const TInt KCarriageLineFeedLength=2;
    1.53 +/** Max numeric IP address len = "0:0:0:0:0:0:194.217.242.23" = 45 chars */
    1.54 +const TInt KImskIPAddressLen=45;				// Max numeric IP address len = "255.255.255.255" = 15 chars
    1.55 +
    1.56 +/** Maximum buffer size of the received data 
    1.57 +@internalTechnology
    1.58 +@released
    1.59 +*/
    1.60 +typedef TBuf8<KImMailMaxBufferSize> TImMailBuffer;
    1.61 +
    1.62 +/** received buffer data line type
    1.63 +@internalTechnology
    1.64 +@released
    1.65 +*/
    1.66 +enum TImLineType
    1.67 +	{ 
    1.68 +	ECRLFTerminated, 
    1.69 +	EBufferTooSmall, 
    1.70 +	EReceiveBufferFull,
    1.71 +	EReceiveBufferEmpty
    1.72 +	};
    1.73 +
    1.74 +
    1.75 +class CImLog;
    1.76 +class CImTextServerScript;
    1.77 +class CImIAPPreferences;
    1.78 +class CImConnect;
    1.79 +class CSecureSocket;
    1.80 +class CImSocketIdleTimer;
    1.81 +
    1.82 +/**
    1.83 +Creates/opens socket and sends and receives data.
    1.84 +
    1.85 +@publishedAll
    1.86 +@released	
    1.87 +*/
    1.88 +class CImTextServerSession : public CMsgActive
    1.89 +	{
    1.90 +public:
    1.91 +	enum TImOperationMode{
    1.92 +		EImServerMode,
    1.93 +		EImClientMode
    1.94 +		};
    1.95 +
    1.96 +/**
    1.97 +	//cat				Construction
    1.98 +	@fn				NewL()
    1.99 +	Intended Usage	:	Static factory constructor. Uses two phase construction and 
   1.100 +						leaves nothing on the CleanupStack.
   1.101 +	@since			6.0
   1.102 +	@leave			KErrNoMemory.
   1.103 +	@return			A pointer to the newly created CImTextServerSession object. 
   1.104 +	@pre 			None
   1.105 +	@post			A fully constructed and initialised CImTextServerSession object.
   1.106 +	
   1.107 + */
   1.108 +	IMPORT_C static CImTextServerSession *NewL();
   1.109 +
   1.110 +	/**
   1.111 +	@internalTechnology
   1.112 +	@released
   1.113 +	*/
   1.114 +	IMPORT_C static CImTextServerSession* NewL(RSocketServ& aSocketServ, CImConnect& aConnect);
   1.115 +
   1.116 +/**
   1.117 +	//cat				Construction
   1.118 +	@fn				NewL(TInt aSendIdleTime, TInt aReceiveIdleTime)
   1.119 +	Intended Usage	:	Static factory constructor. Uses two phase construction and 
   1.120 +						leaves nothing on the CleanupStack.
   1.121 +	@since			7.0s
   1.122 +	@param			aSendIdleTime is the time for which the idle timer runs (for a send)
   1.123 +	@param			aReceiveIdleTime is the time for which the idle timer runs (for a recieve)
   1.124 +	@leave			KErrNoMemory.
   1.125 +	@return			A pointer to the newly created CImTextServerSession object. 
   1.126 +	@pre 				None
   1.127 +	@post				A fully constructed and initialised CImTextServerSession object.
   1.128 + */
   1.129 +	IMPORT_C static CImTextServerSession* NewL(TInt aSendIdleTime, TInt aReceiveIdleTime);
   1.130 +
   1.131 +	/**
   1.132 +	@internalTechnology
   1.133 +	@released
   1.134 +	*/
   1.135 +	IMPORT_C static CImTextServerSession* NewL(TInt aSendIdleTime, TInt aReceiveIdleTime, RSocketServ& aSocketServ, CImConnect& aConnect);
   1.136 +
   1.137 +/**
   1.138 +	//cat				Destruction
   1.139 +	@fn				~CImTextServerSession()
   1.140 +	Intended Usage	:	Destructor.
   1.141 +	@since			6.0	
   1.142 + */
   1.143 +	~CImTextServerSession();
   1.144 +
   1.145 +/**
   1.146 +	@fn				QueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TBool aEnableTimeout = ETrue)
   1.147 +	Intended Usage	:	Queue a connect assuming the socket is successfully opened.
   1.148 +	Error Condition	:	KErrNoMemory
   1.149 +	@since			6.0
   1.150 +	@param			aStatus	Asynchronous completion status
   1.151 +	@param			anAddressDesc is the IP address		
   1.152 +	@param			aIAPPreferences is the IAP connection preference to be used		
   1.153 +	@param			aPortNum is the port number eg. 143, 25, 110.
   1.154 +	@param			aEnableTimeout Not used		
   1.155 +	@pre 			None
   1.156 +	@post			connection is ready to send and receive data.
   1.157 + */
   1.158 +	IMPORT_C void QueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TBool aEnableTimeout = ETrue);
   1.159 +
   1.160 +	IMPORT_C void QueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, const TDesC8& aSSLDomainName);
   1.161 +
   1.162 +/**
   1.163 +	@fn				SSLQueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TBool aEnableTimeout = ETrue)
   1.164 +	Intended Usage	:	Queue a wrapped SSL connect on an socket assuming the socket is successfully opened.
   1.165 +	Error Condition	:	KErrNoMemory, EImskSocketOpen
   1.166 +	@since			7.0s
   1.167 +	@param			aStatus	Asynchronous completion status
   1.168 +	@param			anAddressDesc is the IP address		
   1.169 +	@param			aIAPPreferences is the IAP connection preference to be used		
   1.170 +	@param			aPortNum is the port number eg. 993, 465, 995.
   1.171 +	@param			aEnableTimeout Not used		
   1.172 +	@pre 			None
   1.173 +	@post			connection is ready to send and receive data.
   1.174 + */
   1.175 +	IMPORT_C void SSLQueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TBool aEnableTimeout = ETrue);
   1.176 +
   1.177 +	IMPORT_C void SSLQueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, const TDesC8& aSSLDomainName);
   1.178 +
   1.179 +/**
   1.180 +	@fn				Disconnect()
   1.181 +	Intended Usage	:	To disconnect and close socket connection.
   1.182 +	Error Condition	:	None
   1.183 +	@since			6.0
   1.184 +	@pre 			None
   1.185 +	@post			connection is closed.
   1.186 +  */
   1.187 +	IMPORT_C void Disconnect();
   1.188 +	IMPORT_C void Disconnect(TRequestStatus &aStatus);
   1.189 +	void TimeOut();
   1.190 +
   1.191 +
   1.192 +	IMPORT_C const TDesC& LocalName();
   1.193 +/**
   1.194 +	This method should be called before Send/SendQueueReceive() 
   1.195 +	TLS command is sent.
   1.196 +	@fn				SetSSLTLSResponseL(const TDesC8& aDesc)
   1.197 +	Intended Usage	:	To use for secure connection.
   1.198 +	Error Condition	:	KErrNoMemory
   1.199 +	@since			6.2
   1.200 +	@param			aDesc is the positive response the MTM expects from the connected
   1.201 +					server for TLS command. e.g.  OK, +OK, 220 etc..		
   1.202 +	@pre 			aDesc cannot be zero length
   1.203 +	@leave			EImskNoTLSResponseString
   1.204 +	@post			iTLSResponse is filled with aDesc contents
   1.205 +
   1.206 +  */
   1.207 +	IMPORT_C void SetSSLTLSResponseL(const TDesC8& aDesc);
   1.208 +
   1.209 +/**
   1.210 +	@fn				Send(TRequestStatus &aStatus, const TDesC8& aDesc)
   1.211 +	Intended Usage	:	To send data.
   1.212 +	Error Condition	:	None
   1.213 +	@since			6.0
   1.214 +	@param			aStatus	Asynchronous completion status
   1.215 +	@param			aDesc is the aData to be sent
   1.216 +	@post			None
   1.217 +
   1.218 +  */
   1.219 +
   1.220 +	//sends
   1.221 +	IMPORT_C void Send(TRequestStatus &aStatus, const TDesC8& aDesc);
   1.222 +	IMPORT_C void SendWithTimeout(TRequestStatus& aStatus, TInt aIdleTime, const TDesC8& aDesc); 
   1.223 +	IMPORT_C void SendQueueReceiveWithTimeout(TRequestStatus& aStatus, TInt aIdleTime, const TDesC8& aDesc); 
   1.224 +	IMPORT_C void Send(TRequestStatus &aStatus, TRefByValue<const TDesC8> aFmt,...);
   1.225 +/**
   1.226 +	@fn				SendQueueReceive(TRequestStatus &aStatus, const TDesC8& aDesc)
   1.227 +	Intended Usage	:	To send data and queue a receive.
   1.228 +	Error Condition	:	None
   1.229 +	@since			6.0
   1.230 +	@param			aStatus	Asynchronous completion status	
   1.231 +	@param			aDesc is the aData to be sent
   1.232 +	@post			Sends the data and queues a receive.
   1.233 +	GetCurrentTextLine should be called after this method to read received data
   1.234 +	*/
   1.235 +	IMPORT_C void SendQueueReceive(TRequestStatus &aStatus, const TDesC8& aDesc);
   1.236 +	IMPORT_C void SendQueueReceive(TRequestStatus &aStatus, TRefByValue<const TDesC8> aFmt,...);
   1.237 +
   1.238 +    //receives
   1.239 +/**
   1.240 +	Returns first full line of data received from socket to user
   1.241 +	@fn				GetCurrentTextLine(TDes8& aDesc)
   1.242 +	Intended Usage	:	To return received data.
   1.243 +	Error Condition	:	None
   1.244 +	@since			6.0
   1.245 +	@param			aDesc will be filled with received buffer
   1.246 +	@post			returns the received buffer in the form of aDesc
   1.247 +	@return			EReceiveBufferEmpty when received data is empty
   1.248 +					EBufferTooSmall when aDesc length is smaller than received data
   1.249 +					ECRLFTerminated when received data is complete (full line)
   1.250 +					EReceiveBufferFull when received data length is more than aDesc length
   1.251 +	GetCurrentTextLine should be called after Send methods
   1.252 +	*/
   1.253 +	IMPORT_C TImLineType GetCurrentTextLine(TDes8& aDesc);
   1.254 +/**
   1.255 +	User queues a new request from the socket (unless there's a full line of data in buffer
   1.256 +	then signal user and there's no need to make a receive request)
   1.257 +	@fn				QueueReceiveNextTextLine(TRequestStatus &aStatus)
   1.258 +	Intended Usage	:	User queues a new request from the socket.
   1.259 +	Error Condition	:	None
   1.260 +	@since			6.0
   1.261 +	@param			aStatus for asynchronous request
   1.262 +	
   1.263 +	*/
   1.264 +	IMPORT_C void QueueReceiveNextTextLine(TRequestStatus &aStatus);
   1.265 +/**
   1.266 +	@fn				ReceiveBinaryData(TRequestStatus &aStatus, TDes8& aDes,TInt aLen)
   1.267 +	Intended Usage	:	Users queue a request for received data
   1.268 +	Error Condition	:	None
   1.269 +	@since			6.0
   1.270 +	@param			aStatus	Asynchronous completion status	
   1.271 +	@param			aDes is the aData to be received
   1.272 +	@param			aLen is the length of the data the user wants to read
   1.273 +	@post			aDes will be filled with received data of aLen.
   1.274 +	ReceiveBinaryData should be called after Send.
   1.275 +	*/
   1.276 +	IMPORT_C void ReceiveBinaryData(TRequestStatus &aStatus, TDes8& aDes,TInt aLen);
   1.277 +
   1.278 +	IMPORT_C void LogText(const TDesC8& aString);						// write string into log file
   1.279 +	IMPORT_C void LogError(const TDesC8& aString,const TInt aError);		// write string and integer into log file
   1.280 +
   1.281 +/**
   1.282 +	@fn				GetIAPValue(TUint32 &aIAP)
   1.283 +	Intended Usage	:	Returns the IAP we are connecting/connected with in aIAP or returns an error code
   1.284 +	@since			6.0
   1.285 +	@param			aIAP will be the current IAP 
   1.286 +	@post			aIAP will be filled with current IAP connected.
   1.287 +	@return			will return genconn errors if any
   1.288 +	*/
   1.289 +
   1.290 +	IMPORT_C TInt GetIAPValue(TUint32 &aIAP);
   1.291 +/**
   1.292 +	@fn				GetRConnectionName(TName &aName)
   1.293 +	Intended Usage	:	Returns the name of the RConnection.
   1.294 +	@since			9.1
   1.295 +	@param			aName Buffer in which the name is returned. 
   1.296 +	@post			aName will be filled with current name of the RConnection.
   1.297 +	@return			KErrNone if successful, or another of the system-wide error codes.
   1.298 +	*/
   1.299 +
   1.300 +	IMPORT_C TInt GetRConnectionName(TName &aName);
   1.301 +
   1.302 +/** Returns the bearer type we are connected to with in aBearer or returns an error code */
   1.303 +	IMPORT_C TInt GetIAPBearer(TUint32 &aBearer);
   1.304 +
   1.305 +/**
   1.306 +	@internalTechnology
   1.307 +
   1.308 +	@fn				GetLastSocketActivityTimeout(TUint32& aTimeout)
   1.309 +	Intended Usage	:	Returns the last socket activity timeout value
   1.310 +	@since			9.1
   1.311 +	@param			aTimeout is a return argument containing the timeout if it was found
   1.312 +	@post				aTimeout will be filled with the timeout value
   1.313 +	@return			Returns KErrNone, KErrNotFound or KErrBadHandle
   1.314 +	*/
   1.315 +	IMPORT_C TInt GetLastSocketActivityTimeout(TUint32& aTimeout);
   1.316 +
   1.317 +/**
   1.318 +	@fn				GetSocketServ()
   1.319 +	Intended Usage	:	Returns the Socket Server
   1.320 +	@since			8.0
   1.321 +	@return			Socket Server
   1.322 +	*/
   1.323 +	RSocketServ& GetSocketServ();
   1.324 +
   1.325 +/**
   1.326 +	@fn				GetConnectionStage()
   1.327 +	Intended Usage	:	Gets the stage of the connection process obtained from RConnection
   1.328 +	@since			7.0s
   1.329 +	@return			The current connection stage from RConnection or a system-wide error code.
   1.330 +
   1.331 +	*/
   1.332 +	IMPORT_C TInt GetConnectionStage();
   1.333 +
   1.334 +/**
   1.335 +	@fn				SocketIdle()
   1.336 +	Intended Usage	:	disconnects the socket and notifies the observer when the socket has been idle
   1.337 +						for some time
   1.338 +	@since			7.0s
   1.339 + */
   1.340 +	void SocketIdle();
   1.341 +
   1.342 +/**
   1.343 +	@fn				SetPrimaryTextServerSession(CImTextServerSession& aPrimaryTextServerSession)
   1.344 +	Intended Usage	:	Users set only on the secondary session 
   1.345 +	@since			9.2
   1.346 +	@param			aPrimaryTextServerSession is PrimarySession's TextServerSession
   1.347 +	@pre 			None
   1.348 +	@post			Going to be use on the secondary session
   1.349 +*/
   1.350 +	IMPORT_C void SetPrimaryTextServerSession(CImTextServerSession* aPrimaryTextServerSession);
   1.351 +
   1.352 +/**
   1.353 +	@fn				GetCImConnect()
   1.354 +	Intended Usage	:	Returns the CImConnect object
   1.355 +	@since			9.2
   1.356 +	@return			CImConnect 
   1.357 +	@post			Going to be use on the secondary session
   1.358 +    */
   1.359 +	CImConnect* GetCImConnect();
   1.360 +	
   1.361 +// Depreciated functions - do not use.
   1.362 +	IMPORT_C void QueueConnect(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, TBool aEnableTimeout = ETrue);
   1.363 +	IMPORT_C void QueueConnect(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TInt aType, TBool aEnableTimeout = ETrue);
   1.364 +	IMPORT_C void QueueConnect(TRequestStatus& aStatus,const TDesC& anAddressDesc, TInt aPortNum, TCallBack aDisconnectFunction,const TUint32 aIntraddress,TInt aType, TBool aEnableTimeout = ETrue);
   1.365 +	IMPORT_C void QueueConnect(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum,const TUint32 aIAPaddress, TInt aType, TBool aEnableTimeout = ETrue);
   1.366 +	IMPORT_C void QueueConnect(TRequestStatus& aStatus,const TDesC& anAddressDesc, TInt aPortNum, TCallBack aDisconnectFunction, TBool aEnableTimeout = ETrue);
   1.367 +	IMPORT_C void QueueConnect(TRequestStatus& aStatus,const TDesC& anAddressDesc, TInt aPortNum, TCallBack aDisconnectFunction, const CImIAPPreferences& aIAPPreferences,TInt aType, TBool aEnableTimeout = ETrue);
   1.368 +	IMPORT_C TInt Send(const TDesC8& aDesc);
   1.369 +	IMPORT_C TInt Send(TRefByValue<const TDesC8> aFmt,...);
   1.370 +	IMPORT_C TInt SendReceive(const TDesC8& aDesc);
   1.371 +	IMPORT_C TInt Receive(TDes8& rDes);
   1.372 +	IMPORT_C void Receive(TRequestStatus &aStatus, TDes8& rDes);
   1.373 +	IMPORT_C static CImTextServerSession *NewLC (TImOperationMode aMode, RSocketServ &aServerServ);
   1.374 +	IMPORT_C static CImTextServerSession *NewL(RSocketServ &aServerServ);
   1.375 +	//Do not call SetSecurity.  Call SetSSLTLSResponseL
   1.376 +	IMPORT_C TInt SetSecurity(TBool aSecurityOn, TBool aUnattendedMode = FALSE);
   1.377 +	IMPORT_C void PerformLogging(TBool aLogging);
   1.378 +
   1.379 +private:
   1.380 +/**
   1.381 +	//cat			Construction and Destruction
   1.382 +	@fn				CImTextServerSession()
   1.383 +	Intended Usage	:	Constructor. First phase of two-phase construction method. Does 
   1.384 +						non-allocating construction.
   1.385 +	@since			6.0
   1.386 +	
   1.387 + */
   1.388 +	CImTextServerSession();
   1.389 +
   1.390 +	CImTextServerSession(RSocketServ& aSocketServ, CImConnect& aConnect);
   1.391 +/**
   1.392 +	//cat				Construction
   1.393 +	@fn				CImTextServerSession(TInt aSendIdleTime, TInt aReceiveIdleTime)
   1.394 +	Intended Usage	:	Constructor. First phase of two-phase construction method. Does 
   1.395 +						non-allocating construction.
   1.396 +	@since			7.0s
   1.397 +	@param			aSendIdleTime is the time for which the idle timer runs (for a send)
   1.398 +	@param			aReceiveIdleTime  is the time for which the idle timer runs (for a receive)
   1.399 + */
   1.400 +	CImTextServerSession(TInt aSendIdleTime, TInt aReceiveIdleTime);
   1.401 +
   1.402 +	CImTextServerSession(TInt aSendIdleTime, TInt aReceiveIdleTime, RSocketServ& aSocketServ, CImConnect& aConnect);
   1.403 +
   1.404 +/**
   1.405 +	//cat			Construction and Destruction.
   1.406 +	@fn				ConstructL()
   1.407 +	Intended Usage	:	Second phase of two-phase construction method. Does any 
   1.408 +						allocations required to fully construct the object.
   1.409 +	@since			6.0
   1.410 +	@leave			KErrNoMemory.
   1.411 +	@pre 			First phase of construction is complete
   1.412 +	@post			The object is fully constructed and initialised.	
   1.413 + */
   1.414 +	void ConstructL();
   1.415 +
   1.416 +	TInt Open();
   1.417 +	void Close();
   1.418 +
   1.419 +	void CreateLogFile(TInt aPortNum);
   1.420 +	void OpenScriptFile(TInt aPortNum);
   1.421 +
   1.422 +	void DoRunL();
   1.423 +	void DoComplete(TInt& aStatusValue);						// Cleanup code
   1.424 +	void DoCancel();
   1.425 +
   1.426 +	// these called from DoRunL;
   1.427 +	void SocketConnect();
   1.428 +	void DoConnectedToSocketL();
   1.429 +	void DoQueueConnect();
   1.430 +
   1.431 +	void RealReceive(TDes8& aDesc);
   1.432 +	void RealSend(const TDesC8& aDesc);
   1.433 +/** 
   1.434 +	@fn				ParseSSLTLSResponseL()
   1.435 +	Intended Usage	:	session will compare the response(for TLS command)
   1.436 +						with the MTMs response 						
   1.437 +	@since			6.2
   1.438 +	@leave			KImskSSLTLSNegotiateFailed if the response doesn't match 
   1.439 +	@post			CSecureSocket object is created
   1.440 +	*/
   1.441 +	void ParseSSLTLSResponseL();
   1.442 +
   1.443 +/** 
   1.444 +	@fn				CreateSecureSocketL()
   1.445 +	Intended Usage	:	to use secure socket connection 						
   1.446 +	@since			6.2
   1.447 +	@leave			None 
   1.448 +	@post			CSecureSocket object is created and iSecurityState is set to EImSecurityStateOn;
   1.449 +	*/
   1.450 +	void CreateSecureSocketL();
   1.451 +
   1.452 +/**
   1.453 +	@fn				QueueGenericConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TBool aEnableTimeout = ETrue)
   1.454 +	Intended Usage	:	Queue a standard or wrapped SSL connect on an socket assuming the socket is successfully opened.  Called by SSLQueueConnectL and QueueConnectL
   1.455 +	Error Condition	:	KErrNoMemory, EImskSocketOpen
   1.456 +	@since			7.0s
   1.457 +	@param			aStatus	Asynchronous completion status	
   1.458 +	@param			anAddressDesc is the IP address		
   1.459 +	@param			aIAPPreferences is the IAP connection preference to be used		
   1.460 +	@param			aPortNum is the port number eg. 143, 993
   1.461 +	@param			aSSLDomainName SSL domain name to use for secure sockets
   1.462 +	@pre 			None
   1.463 +	@post			connection is ready to send and receive data.
   1.464 + */
   1.465 +	void QueueGenericConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, const TDesC8& aSSLDomainName);
   1.466 +
   1.467 +#if defined(__IMSK_SIMULATION)
   1.468 +	void ReadNextPeriod();
   1.469 +	TUint32 GetTokenValue(TInt aTokenLen, const TPtrC8& aBuffer);
   1.470 +	TBool IsSuspended();	
   1.471 +	TBool SuspendPeriodSet();
   1.472 +	void ResetSuspendPeriod();
   1.473 +	void SetAfterTimer();
   1.474 +	TInt ReadConfigNum(const TDesC& aName);
   1.475 +#endif
   1.476 +
   1.477 +	enum TImSocketState
   1.478 +		{
   1.479 +		EImClosed, 
   1.480 +		EImResolve, 
   1.481 +		EImConnect,   
   1.482 +		EImSendReceive,
   1.483 +		EImDialUsingOverride,
   1.484 +		EImTLSHandShakeStarted,
   1.485 +		EImSendReceiveTimedOut
   1.486 +		};
   1.487 +
   1.488 +	enum TImSendReceiveState
   1.489 +		{ 
   1.490 +		EImInactive, 
   1.491 +		EImSending,
   1.492 +		EImReceiving, 
   1.493 +		EImReceivingBinaryData,
   1.494 +		EImSendingQueueReceive,
   1.495 +		EImSuspended,          //used when we are in a simulated GPRS suspend.
   1.496 +		};
   1.497 +
   1.498 +	enum TImSecurityState
   1.499 +		{
   1.500 +		EImSecurityStateOff,
   1.501 +		EImSecurityStateOn,
   1.502 +		EImSecurityStateFailed
   1.503 +		};
   1.504 +private:
   1.505 +	/** handle to the socket */
   1.506 +	RSocket							iSocket;
   1.507 +	/** handle to RSocketServ */
   1.508 +	RSocketServ						iServ;
   1.509 +	/** handle to Hostresolver */
   1.510 +	RHostResolver					iHostResolver;
   1.511 +	/** handle to secure socket for SSL/TLS connection */
   1.512 +	CSecureSocket*					iSecureSocket;
   1.513 +
   1.514 +	TUint32 iCurrentIAPcache;
   1.515 +	/** Used to find if IAP is cached */
   1.516 +	TBool							iIAPCached;  // true if the above value can be used.
   1.517 +	/** result of the host resolver */
   1.518 +	TNameEntry						iHostent;
   1.519 +	/** port number e.g. 25 for SMTP, 143 for IMAP and 110 for POP */
   1.520 +	TInt							iPortNum;
   1.521 +	/**  server address */
   1.522 +	TPtrC							iAddressDesc;
   1.523 +	/** data returned by the socket */
   1.524 +	TImMailBuffer					iReceive;
   1.525 +	TSockXfrLength					iLen;
   1.526 +	TImSocketState					iState;
   1.527 +	TImSendReceiveState				iSendReceive;
   1.528 +
   1.529 +	HBufC8*							iBuffer;
   1.530 +	TImLineType						iCurrentLineType;
   1.531 +
   1.532 +	/** to log connection data  */
   1.533 +	CImLog*							iLog;
   1.534 +	/** IP address name */
   1.535 +	TBuf<KImskIPAddressLen>			iLocalName;
   1.536 +	/** secure state i.e to use Secure socket */
   1.537 +
   1.538 +	TImSecurityState				iSecurityState;
   1.539 +	const CImIAPPreferences*		iIAPPreferences;
   1.540 +
   1.541 +	CImConnect*						iConnect;
   1.542 +
   1.543 +	TDes8*							iReceiveData; // buffer we just recieved data into
   1.544 +
   1.545 +
   1.546 +	HBufC8*							iSentData;
   1.547 +	/** response for different mail protocols like 220,+OK, OK, BAD */
   1.548 +	HBufC8*							iTLSResponse; //response for different mail protocols like 220,+OK, OK, BAD
   1.549 +	/** internal flag to read tls response */
   1.550 +	TBool							iReadTLSResponse;
   1.551 +	TBool							iPerformLogging;
   1.552 +	TBool							iWrappedSocket;
   1.553 +
   1.554 +	CImSocketIdleTimer*				iSocketIdleTimer;
   1.555 +	TTimeIntervalMicroSeconds32		iSendIdleTime;
   1.556 +	TTimeIntervalMicroSeconds32		iReceiveIdleTime;
   1.557 +
   1.558 +	/** A shorter idle timeout, used when a fast response is expected */
   1.559 +	TTimeIntervalMicroSeconds32		iSendShortIdleTime;
   1.560 +	TTimeIntervalMicroSeconds32		iReceiveShortIdleTime;
   1.561 +
   1.562 +
   1.563 +#ifdef __IMSK_SCRIPTING
   1.564 +	CImTextServerScript*			iScript;
   1.565 +#endif
   1.566 +
   1.567 +#if defined(__IMSK_SIMULATION)
   1.568 +
   1.569 +	RFs								iFs;
   1.570 +
   1.571 +
   1.572 +	TUint32							iScriptedIAP; // value to return for iap when scripting
   1.573 +	TUint32							iBearerIAP; // value to return for bearer when scripting
   1.574 +
   1.575 +
   1.576 +	TImSendReceiveState             iSuspendedState;
   1.577 +	
   1.578 +	RTimer							iSuspendTimer;
   1.579 +
   1.580 +	RFile							iGprsFile;
   1.581 +
   1.582 +	TBool							iGprsConfigExists;
   1.583 +
   1.584 +	TInt							iCfgFilePos;	
   1.585 +
   1.586 +	TTime							iLastSuspend;	// time last suspension took place
   1.587 +													// in universal time
   1.588 +
   1.589 +	TTimeIntervalSeconds 			iStart;		// number of seconds since last delay
   1.590 +												// before the following delay occurs.
   1.591 +												// if 0 no suspend is required.
   1.592 +	TTimeIntervalSeconds 			iDuration;	// how long to delay. If 0 no suspend is
   1.593 +												// required
   1.594 +	TBool							iRepeat;	// repeat the above delay for an 
   1.595 +												// infinite period
   1.596 +
   1.597 +	HBufC8*							iSendData; // suspended data 
   1.598 +#endif // __IMSK_SIMULATION
   1.599 +	
   1.600 +	CImTextServerSession*			iPrimaryTextServerSession; //Only going to be set on the secondary session
   1.601 +	
   1.602 +	TBool iClientOwnsConnection;
   1.603 +
   1.604 +	/** SSL domain name for secure sockets */
   1.605 +	HBufC8* iSSLDomainName;
   1.606 +	TBool							iSocketIdleTimeSet;          // iSocketIdleTimeSet=ETrue, if smtp server did not responds within 10 seconds after sending "."
   1.607 +	};
   1.608 +
   1.609 +#endif