epoc32/include/imsk.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // 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
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // This file contains the API definition for the class CImTextServerSession.
    15 // This class creates sockets and is responsible for transmitting data between client and the server 
    16 // 
    17 //
    18 
    19 
    20 
    21 /**
    22  @file
    23 */
    24 
    25 
    26 #ifndef __IMSK_H__
    27 #define __IMSK_H__
    28 
    29 #include <e32base.h>
    30 #include <es_sock.h>
    31 #include <in_sock.h>
    32 #include <f32file.h>
    33 #include <mentact.h>
    34 #include <miutlog.h>
    35 #include <miut_err.h>
    36 #include <miuthdr.h>
    37 
    38 #ifdef _DEBUG
    39 #define __IMSK_SIMULATION
    40 #endif
    41 
    42 // Enable Scripting in Debug Builds only
    43 #ifdef _DEBUG
    44 #define __IMSK_SCRIPTING
    45 #endif
    46 
    47 const TInt EActivePriorityHigh = 1;
    48 const TInt KCarriageLineFeedLength=2;
    49 /** Max numeric IP address len = "0:0:0:0:0:0:194.217.242.23" = 45 chars */
    50 const TInt KImskIPAddressLen=45;				// Max numeric IP address len = "255.255.255.255" = 15 chars
    51 
    52 /** Maximum buffer size of the received data 
    53 @internalTechnology
    54 @released
    55 */
    56 typedef TBuf8<KImMailMaxBufferSize> TImMailBuffer;
    57 
    58 /** received buffer data line type
    59 @internalTechnology
    60 @released
    61 */
    62 enum TImLineType
    63 	{ 
    64 	ECRLFTerminated, 
    65 	EBufferTooSmall, 
    66 	EReceiveBufferFull,
    67 	EReceiveBufferEmpty
    68 	};
    69 
    70 
    71 class CImLog;
    72 class CImTextServerScript;
    73 class CImIAPPreferences;
    74 class CImConnect;
    75 class CSecureSocket;
    76 class CImSocketIdleTimer;
    77 
    78 /**
    79 Creates/opens socket and sends and receives data.
    80 
    81 @publishedAll
    82 @released	
    83 */
    84 class CImTextServerSession : public CMsgActive
    85 	{
    86 public:
    87 	enum TImOperationMode{
    88 		EImServerMode,
    89 		EImClientMode
    90 		};
    91 
    92 /**
    93 	//cat				Construction
    94 	@fn				NewL()
    95 	Intended Usage	:	Static factory constructor. Uses two phase construction and 
    96 						leaves nothing on the CleanupStack.
    97 	@since			6.0
    98 	@leave			KErrNoMemory.
    99 	@return			A pointer to the newly created CImTextServerSession object. 
   100 	@pre 			None
   101 	@post			A fully constructed and initialised CImTextServerSession object.
   102 	
   103  */
   104 	IMPORT_C static CImTextServerSession *NewL();
   105 
   106 	/**
   107 	@internalTechnology
   108 	@released
   109 	*/
   110 	IMPORT_C static CImTextServerSession* NewL(RSocketServ& aSocketServ, CImConnect& aConnect);
   111 
   112 /**
   113 	//cat				Construction
   114 	@fn				NewL(TInt aSendIdleTime, TInt aReceiveIdleTime)
   115 	Intended Usage	:	Static factory constructor. Uses two phase construction and 
   116 						leaves nothing on the CleanupStack.
   117 	@since			7.0s
   118 	@param			aSendIdleTime is the time for which the idle timer runs (for a send)
   119 	@param			aReceiveIdleTime is the time for which the idle timer runs (for a recieve)
   120 	@leave			KErrNoMemory.
   121 	@return			A pointer to the newly created CImTextServerSession object. 
   122 	@pre 				None
   123 	@post				A fully constructed and initialised CImTextServerSession object.
   124  */
   125 	IMPORT_C static CImTextServerSession* NewL(TInt aSendIdleTime, TInt aReceiveIdleTime);
   126 
   127 	/**
   128 	@internalTechnology
   129 	@released
   130 	*/
   131 	IMPORT_C static CImTextServerSession* NewL(TInt aSendIdleTime, TInt aReceiveIdleTime, RSocketServ& aSocketServ, CImConnect& aConnect);
   132 
   133 /**
   134 	//cat				Destruction
   135 	@fn				~CImTextServerSession()
   136 	Intended Usage	:	Destructor.
   137 	@since			6.0	
   138  */
   139 	~CImTextServerSession();
   140 
   141 /**
   142 	@fn				QueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TBool aEnableTimeout = ETrue)
   143 	Intended Usage	:	Queue a connect assuming the socket is successfully opened.
   144 	Error Condition	:	KErrNoMemory
   145 	@since			6.0
   146 	@param			aStatus	Asynchronous completion status
   147 	@param			anAddressDesc is the IP address		
   148 	@param			aIAPPreferences is the IAP connection preference to be used		
   149 	@param			aPortNum is the port number eg. 143, 25, 110.
   150 	@param			aEnableTimeout Not used		
   151 	@pre 			None
   152 	@post			connection is ready to send and receive data.
   153  */
   154 	IMPORT_C void QueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TBool aEnableTimeout = ETrue);
   155 
   156 	IMPORT_C void QueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, const TDesC8& aSSLDomainName);
   157 
   158 /**
   159 	@fn				SSLQueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TBool aEnableTimeout = ETrue)
   160 	Intended Usage	:	Queue a wrapped SSL connect on an socket assuming the socket is successfully opened.
   161 	Error Condition	:	KErrNoMemory, EImskSocketOpen
   162 	@since			7.0s
   163 	@param			aStatus	Asynchronous completion status
   164 	@param			anAddressDesc is the IP address		
   165 	@param			aIAPPreferences is the IAP connection preference to be used		
   166 	@param			aPortNum is the port number eg. 993, 465, 995.
   167 	@param			aEnableTimeout Not used		
   168 	@pre 			None
   169 	@post			connection is ready to send and receive data.
   170  */
   171 	IMPORT_C void SSLQueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TBool aEnableTimeout = ETrue);
   172 
   173 	IMPORT_C void SSLQueueConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, const TDesC8& aSSLDomainName);
   174 
   175 /**
   176 	@fn				Disconnect()
   177 	Intended Usage	:	To disconnect and close socket connection.
   178 	Error Condition	:	None
   179 	@since			6.0
   180 	@pre 			None
   181 	@post			connection is closed.
   182   */
   183 	IMPORT_C void Disconnect();
   184 	IMPORT_C void Disconnect(TRequestStatus &aStatus);
   185 	void TimeOut();
   186 
   187 
   188 	IMPORT_C const TDesC& LocalName();
   189 /**
   190 	This method should be called before Send/SendQueueReceive() 
   191 	TLS command is sent.
   192 	@fn				SetSSLTLSResponseL(const TDesC8& aDesc)
   193 	Intended Usage	:	To use for secure connection.
   194 	Error Condition	:	KErrNoMemory
   195 	@since			6.2
   196 	@param			aDesc is the positive response the MTM expects from the connected
   197 					server for TLS command. e.g.  OK, +OK, 220 etc..		
   198 	@pre 			aDesc cannot be zero length
   199 	@leave			EImskNoTLSResponseString
   200 	@post			iTLSResponse is filled with aDesc contents
   201 
   202   */
   203 	IMPORT_C void SetSSLTLSResponseL(const TDesC8& aDesc);
   204 
   205 /**
   206 	@fn				Send(TRequestStatus &aStatus, const TDesC8& aDesc)
   207 	Intended Usage	:	To send data.
   208 	Error Condition	:	None
   209 	@since			6.0
   210 	@param			aStatus	Asynchronous completion status
   211 	@param			aDesc is the aData to be sent
   212 	@post			None
   213 
   214   */
   215 
   216 	//sends
   217 	IMPORT_C void Send(TRequestStatus &aStatus, const TDesC8& aDesc);
   218 	IMPORT_C void SendWithTimeout(TRequestStatus& aStatus, TInt aIdleTime, const TDesC8& aDesc); 
   219 	IMPORT_C void SendQueueReceiveWithTimeout(TRequestStatus& aStatus, TInt aIdleTime, const TDesC8& aDesc); 
   220 	IMPORT_C void Send(TRequestStatus &aStatus, TRefByValue<const TDesC8> aFmt,...);
   221 /**
   222 	@fn				SendQueueReceive(TRequestStatus &aStatus, const TDesC8& aDesc)
   223 	Intended Usage	:	To send data and queue a receive.
   224 	Error Condition	:	None
   225 	@since			6.0
   226 	@param			aStatus	Asynchronous completion status	
   227 	@param			aDesc is the aData to be sent
   228 	@post			Sends the data and queues a receive.
   229 	GetCurrentTextLine should be called after this method to read received data
   230 	*/
   231 	IMPORT_C void SendQueueReceive(TRequestStatus &aStatus, const TDesC8& aDesc);
   232 	IMPORT_C void SendQueueReceive(TRequestStatus &aStatus, TRefByValue<const TDesC8> aFmt,...);
   233 
   234     //receives
   235 /**
   236 	Returns first full line of data received from socket to user
   237 	@fn				GetCurrentTextLine(TDes8& aDesc)
   238 	Intended Usage	:	To return received data.
   239 	Error Condition	:	None
   240 	@since			6.0
   241 	@param			aDesc will be filled with received buffer
   242 	@post			returns the received buffer in the form of aDesc
   243 	@return			EReceiveBufferEmpty when received data is empty
   244 					EBufferTooSmall when aDesc length is smaller than received data
   245 					ECRLFTerminated when received data is complete (full line)
   246 					EReceiveBufferFull when received data length is more than aDesc length
   247 	GetCurrentTextLine should be called after Send methods
   248 	*/
   249 	IMPORT_C TImLineType GetCurrentTextLine(TDes8& aDesc);
   250 /**
   251 	User queues a new request from the socket (unless there's a full line of data in buffer
   252 	then signal user and there's no need to make a receive request)
   253 	@fn				QueueReceiveNextTextLine(TRequestStatus &aStatus)
   254 	Intended Usage	:	User queues a new request from the socket.
   255 	Error Condition	:	None
   256 	@since			6.0
   257 	@param			aStatus for asynchronous request
   258 	
   259 	*/
   260 	IMPORT_C void QueueReceiveNextTextLine(TRequestStatus &aStatus);
   261 /**
   262 	@fn				ReceiveBinaryData(TRequestStatus &aStatus, TDes8& aDes,TInt aLen)
   263 	Intended Usage	:	Users queue a request for received data
   264 	Error Condition	:	None
   265 	@since			6.0
   266 	@param			aStatus	Asynchronous completion status	
   267 	@param			aDes is the aData to be received
   268 	@param			aLen is the length of the data the user wants to read
   269 	@post			aDes will be filled with received data of aLen.
   270 	ReceiveBinaryData should be called after Send.
   271 	*/
   272 	IMPORT_C void ReceiveBinaryData(TRequestStatus &aStatus, TDes8& aDes,TInt aLen);
   273 
   274 	IMPORT_C void LogText(const TDesC8& aString);						// write string into log file
   275 	IMPORT_C void LogError(const TDesC8& aString,const TInt aError);		// write string and integer into log file
   276 
   277 /**
   278 	@fn				GetIAPValue(TUint32 &aIAP)
   279 	Intended Usage	:	Returns the IAP we are connecting/connected with in aIAP or returns an error code
   280 	@since			6.0
   281 	@param			aIAP will be the current IAP 
   282 	@post			aIAP will be filled with current IAP connected.
   283 	@return			will return genconn errors if any
   284 	*/
   285 
   286 	IMPORT_C TInt GetIAPValue(TUint32 &aIAP);
   287 /**
   288 	@fn				GetRConnectionName(TName &aName)
   289 	Intended Usage	:	Returns the name of the RConnection.
   290 	@since			9.1
   291 	@param			aName Buffer in which the name is returned. 
   292 	@post			aName will be filled with current name of the RConnection.
   293 	@return			KErrNone if successful, or another of the system-wide error codes.
   294 	*/
   295 
   296 	IMPORT_C TInt GetRConnectionName(TName &aName);
   297 
   298 /** Returns the bearer type we are connected to with in aBearer or returns an error code */
   299 	IMPORT_C TInt GetIAPBearer(TUint32 &aBearer);
   300 
   301 /**
   302 	@internalTechnology
   303 
   304 	@fn				GetLastSocketActivityTimeout(TUint32& aTimeout)
   305 	Intended Usage	:	Returns the last socket activity timeout value
   306 	@since			9.1
   307 	@param			aTimeout is a return argument containing the timeout if it was found
   308 	@post				aTimeout will be filled with the timeout value
   309 	@return			Returns KErrNone, KErrNotFound or KErrBadHandle
   310 	*/
   311 	IMPORT_C TInt GetLastSocketActivityTimeout(TUint32& aTimeout);
   312 
   313 /**
   314 	@fn				GetSocketServ()
   315 	Intended Usage	:	Returns the Socket Server
   316 	@since			8.0
   317 	@return			Socket Server
   318 	*/
   319 	RSocketServ& GetSocketServ();
   320 
   321 /**
   322 	@fn				GetConnectionStage()
   323 	Intended Usage	:	Gets the stage of the connection process obtained from RConnection
   324 	@since			7.0s
   325 	@return			The current connection stage from RConnection or a system-wide error code.
   326 
   327 	*/
   328 	IMPORT_C TInt GetConnectionStage();
   329 
   330 /**
   331 	@fn				SocketIdle()
   332 	Intended Usage	:	disconnects the socket and notifies the observer when the socket has been idle
   333 						for some time
   334 	@since			7.0s
   335  */
   336 	void SocketIdle();
   337 
   338 /**
   339 	@fn				SetPrimaryTextServerSession(CImTextServerSession& aPrimaryTextServerSession)
   340 	Intended Usage	:	Users set only on the secondary session 
   341 	@since			9.2
   342 	@param			aPrimaryTextServerSession is PrimarySession's TextServerSession
   343 	@pre 			None
   344 	@post			Going to be use on the secondary session
   345 */
   346 	IMPORT_C void SetPrimaryTextServerSession(CImTextServerSession* aPrimaryTextServerSession);
   347 
   348 /**
   349 	@fn				GetCImConnect()
   350 	Intended Usage	:	Returns the CImConnect object
   351 	@since			9.2
   352 	@return			CImConnect 
   353 	@post			Going to be use on the secondary session
   354     */
   355 	CImConnect* GetCImConnect();
   356 	
   357 // Depreciated functions - do not use.
   358 	IMPORT_C void QueueConnect(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, TBool aEnableTimeout = ETrue);
   359 	IMPORT_C void QueueConnect(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TInt aType, TBool aEnableTimeout = ETrue);
   360 	IMPORT_C void QueueConnect(TRequestStatus& aStatus,const TDesC& anAddressDesc, TInt aPortNum, TCallBack aDisconnectFunction,const TUint32 aIntraddress,TInt aType, TBool aEnableTimeout = ETrue);
   361 	IMPORT_C void QueueConnect(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum,const TUint32 aIAPaddress, TInt aType, TBool aEnableTimeout = ETrue);
   362 	IMPORT_C void QueueConnect(TRequestStatus& aStatus,const TDesC& anAddressDesc, TInt aPortNum, TCallBack aDisconnectFunction, TBool aEnableTimeout = ETrue);
   363 	IMPORT_C void QueueConnect(TRequestStatus& aStatus,const TDesC& anAddressDesc, TInt aPortNum, TCallBack aDisconnectFunction, const CImIAPPreferences& aIAPPreferences,TInt aType, TBool aEnableTimeout = ETrue);
   364 	IMPORT_C TInt Send(const TDesC8& aDesc);
   365 	IMPORT_C TInt Send(TRefByValue<const TDesC8> aFmt,...);
   366 	IMPORT_C TInt SendReceive(const TDesC8& aDesc);
   367 	IMPORT_C TInt Receive(TDes8& rDes);
   368 	IMPORT_C void Receive(TRequestStatus &aStatus, TDes8& rDes);
   369 	IMPORT_C static CImTextServerSession *NewLC (TImOperationMode aMode, RSocketServ &aServerServ);
   370 	IMPORT_C static CImTextServerSession *NewL(RSocketServ &aServerServ);
   371 	//Do not call SetSecurity.  Call SetSSLTLSResponseL
   372 	IMPORT_C TInt SetSecurity(TBool aSecurityOn, TBool aUnattendedMode = FALSE);
   373 	IMPORT_C void PerformLogging(TBool aLogging);
   374 
   375 private:
   376 /**
   377 	//cat			Construction and Destruction
   378 	@fn				CImTextServerSession()
   379 	Intended Usage	:	Constructor. First phase of two-phase construction method. Does 
   380 						non-allocating construction.
   381 	@since			6.0
   382 	
   383  */
   384 	CImTextServerSession();
   385 
   386 	CImTextServerSession(RSocketServ& aSocketServ, CImConnect& aConnect);
   387 /**
   388 	//cat				Construction
   389 	@fn				CImTextServerSession(TInt aSendIdleTime, TInt aReceiveIdleTime)
   390 	Intended Usage	:	Constructor. First phase of two-phase construction method. Does 
   391 						non-allocating construction.
   392 	@since			7.0s
   393 	@param			aSendIdleTime is the time for which the idle timer runs (for a send)
   394 	@param			aReceiveIdleTime  is the time for which the idle timer runs (for a receive)
   395  */
   396 	CImTextServerSession(TInt aSendIdleTime, TInt aReceiveIdleTime);
   397 
   398 	CImTextServerSession(TInt aSendIdleTime, TInt aReceiveIdleTime, RSocketServ& aSocketServ, CImConnect& aConnect);
   399 
   400 /**
   401 	//cat			Construction and Destruction.
   402 	@fn				ConstructL()
   403 	Intended Usage	:	Second phase of two-phase construction method. Does any 
   404 						allocations required to fully construct the object.
   405 	@since			6.0
   406 	@leave			KErrNoMemory.
   407 	@pre 			First phase of construction is complete
   408 	@post			The object is fully constructed and initialised.	
   409  */
   410 	void ConstructL();
   411 
   412 	TInt Open();
   413 	void Close();
   414 
   415 	void CreateLogFile(TInt aPortNum);
   416 	void OpenScriptFile(TInt aPortNum);
   417 
   418 	void DoRunL();
   419 	void DoComplete(TInt& aStatusValue);						// Cleanup code
   420 	void DoCancel();
   421 
   422 	// these called from DoRunL;
   423 	void SocketConnect();
   424 	void DoConnectedToSocketL();
   425 	void DoQueueConnect();
   426 
   427 	void RealReceive(TDes8& aDesc);
   428 	void RealSend(const TDesC8& aDesc);
   429 /** 
   430 	@fn				ParseSSLTLSResponseL()
   431 	Intended Usage	:	session will compare the response(for TLS command)
   432 						with the MTMs response 						
   433 	@since			6.2
   434 	@leave			KImskSSLTLSNegotiateFailed if the response doesn't match 
   435 	@post			CSecureSocket object is created
   436 	*/
   437 	void ParseSSLTLSResponseL();
   438 
   439 /** 
   440 	@fn				CreateSecureSocketL()
   441 	Intended Usage	:	to use secure socket connection 						
   442 	@since			6.2
   443 	@leave			None 
   444 	@post			CSecureSocket object is created and iSecurityState is set to EImSecurityStateOn;
   445 	*/
   446 	void CreateSecureSocketL();
   447 
   448 /**
   449 	@fn				QueueGenericConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, TBool aEnableTimeout = ETrue)
   450 	Intended Usage	:	Queue a standard or wrapped SSL connect on an socket assuming the socket is successfully opened.  Called by SSLQueueConnectL and QueueConnectL
   451 	Error Condition	:	KErrNoMemory, EImskSocketOpen
   452 	@since			7.0s
   453 	@param			aStatus	Asynchronous completion status	
   454 	@param			anAddressDesc is the IP address		
   455 	@param			aIAPPreferences is the IAP connection preference to be used		
   456 	@param			aPortNum is the port number eg. 143, 993
   457 	@param			aSSLDomainName SSL domain name to use for secure sockets
   458 	@pre 			None
   459 	@post			connection is ready to send and receive data.
   460  */
   461 	void QueueGenericConnectL(TRequestStatus &aStatus,const TDesC& anAddressDesc, TInt aPortNum, const CImIAPPreferences& aIAPPreferences, const TDesC8& aSSLDomainName);
   462 
   463 #if defined(__IMSK_SIMULATION)
   464 	void ReadNextPeriod();
   465 	TUint32 GetTokenValue(TInt aTokenLen, const TPtrC8& aBuffer);
   466 	TBool IsSuspended();	
   467 	TBool SuspendPeriodSet();
   468 	void ResetSuspendPeriod();
   469 	void SetAfterTimer();
   470 	TInt ReadConfigNum(const TDesC& aName);
   471 #endif
   472 
   473 	enum TImSocketState
   474 		{
   475 		EImClosed, 
   476 		EImResolve, 
   477 		EImConnect,   
   478 		EImSendReceive,
   479 		EImDialUsingOverride,
   480 		EImTLSHandShakeStarted,
   481 		EImSendReceiveTimedOut
   482 		};
   483 
   484 	enum TImSendReceiveState
   485 		{ 
   486 		EImInactive, 
   487 		EImSending,
   488 		EImReceiving, 
   489 		EImReceivingBinaryData,
   490 		EImSendingQueueReceive,
   491 		EImSuspended,          //used when we are in a simulated GPRS suspend.
   492 		};
   493 
   494 	enum TImSecurityState
   495 		{
   496 		EImSecurityStateOff,
   497 		EImSecurityStateOn,
   498 		EImSecurityStateFailed
   499 		};
   500 private:
   501 	/** handle to the socket */
   502 	RSocket							iSocket;
   503 	/** handle to RSocketServ */
   504 	RSocketServ						iServ;
   505 	/** handle to Hostresolver */
   506 	RHostResolver					iHostResolver;
   507 	/** handle to secure socket for SSL/TLS connection */
   508 	CSecureSocket*					iSecureSocket;
   509 
   510 	TUint32 iCurrentIAPcache;
   511 	/** Used to find if IAP is cached */
   512 	TBool							iIAPCached;  // true if the above value can be used.
   513 	/** result of the host resolver */
   514 	TNameEntry						iHostent;
   515 	/** port number e.g. 25 for SMTP, 143 for IMAP and 110 for POP */
   516 	TInt							iPortNum;
   517 	/**  server address */
   518 	TPtrC							iAddressDesc;
   519 	/** data returned by the socket */
   520 	TImMailBuffer					iReceive;
   521 	TSockXfrLength					iLen;
   522 	TImSocketState					iState;
   523 	TImSendReceiveState				iSendReceive;
   524 
   525 	HBufC8*							iBuffer;
   526 	TImLineType						iCurrentLineType;
   527 
   528 	/** to log connection data  */
   529 	CImLog*							iLog;
   530 	/** IP address name */
   531 	TBuf<KImskIPAddressLen>			iLocalName;
   532 	/** secure state i.e to use Secure socket */
   533 
   534 	TImSecurityState				iSecurityState;
   535 	const CImIAPPreferences*		iIAPPreferences;
   536 
   537 	CImConnect*						iConnect;
   538 
   539 	TDes8*							iReceiveData; // buffer we just recieved data into
   540 
   541 
   542 	HBufC8*							iSentData;
   543 	/** response for different mail protocols like 220,+OK, OK, BAD */
   544 	HBufC8*							iTLSResponse; //response for different mail protocols like 220,+OK, OK, BAD
   545 	/** internal flag to read tls response */
   546 	TBool							iReadTLSResponse;
   547 	TBool							iPerformLogging;
   548 	TBool							iWrappedSocket;
   549 
   550 	CImSocketIdleTimer*				iSocketIdleTimer;
   551 	TTimeIntervalMicroSeconds32		iSendIdleTime;
   552 	TTimeIntervalMicroSeconds32		iReceiveIdleTime;
   553 
   554 	/** A shorter idle timeout, used when a fast response is expected */
   555 	TTimeIntervalMicroSeconds32		iSendShortIdleTime;
   556 	TTimeIntervalMicroSeconds32		iReceiveShortIdleTime;
   557 
   558 
   559 #ifdef __IMSK_SCRIPTING
   560 	CImTextServerScript*			iScript;
   561 #endif
   562 
   563 #if defined(__IMSK_SIMULATION)
   564 
   565 	RFs								iFs;
   566 
   567 
   568 	TUint32							iScriptedIAP; // value to return for iap when scripting
   569 	TUint32							iBearerIAP; // value to return for bearer when scripting
   570 
   571 
   572 	TImSendReceiveState             iSuspendedState;
   573 	
   574 	RTimer							iSuspendTimer;
   575 
   576 	RFile							iGprsFile;
   577 
   578 	TBool							iGprsConfigExists;
   579 
   580 	TInt							iCfgFilePos;	
   581 
   582 	TTime							iLastSuspend;	// time last suspension took place
   583 													// in universal time
   584 
   585 	TTimeIntervalSeconds 			iStart;		// number of seconds since last delay
   586 												// before the following delay occurs.
   587 												// if 0 no suspend is required.
   588 	TTimeIntervalSeconds 			iDuration;	// how long to delay. If 0 no suspend is
   589 												// required
   590 	TBool							iRepeat;	// repeat the above delay for an 
   591 												// infinite period
   592 
   593 	HBufC8*							iSendData; // suspended data 
   594 #endif // __IMSK_SIMULATION
   595 	
   596 	CImTextServerSession*			iPrimaryTextServerSession; //Only going to be set on the secondary session
   597 	
   598 	TBool iClientOwnsConnection;
   599 
   600 	/** SSL domain name for secure sockets */
   601 	HBufC8* iSSLDomainName;
   602 	TBool							iSocketIdleTimeSet;          // iSocketIdleTimeSet=ETrue, if smtp server did not responds within 10 seconds after sending "."
   603 	};
   604 
   605 #endif