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