email/pop3andsmtpmtm/smtpservermtm/inc/csmtpsessionmanager.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 2007-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 //
       
    15 
       
    16 #ifndef __CSMTPSESSIONMANAGER_H__
       
    17 #define __CSMTPSESSIONMANAGER_H__
       
    18 
       
    19 #include <mentact.h>
       
    20 #include <msvstd.h>
       
    21 #include <es_sock.h>
       
    22 
       
    23 class CMsvServerEntry;
       
    24 class CSmtpSettings;
       
    25 class CImSmtpSession;
       
    26 class TRequestStatus;
       
    27 class TImSmtpProgress;
       
    28 class CImConnect;
       
    29 class CImMobilityManager;
       
    30 
       
    31 /**
       
    32 Provides a mechanism for creating logged in SMTP sessions and for
       
    33 disconnecting them.
       
    34 
       
    35 @internalTechnology
       
    36 @released
       
    37 */
       
    38 NONSHARABLE_CLASS(CSmtpSessionManager) : public CMsgActive
       
    39 	{
       
    40 public:
       
    41 	static CSmtpSessionManager* NewL(CImMobilityManager* aMobilityManager, TMsvId aServiceId);
       
    42 	~CSmtpSessionManager();
       
    43 
       
    44 	void GetSessionL(CMsvServerEntry& aServerEntry, CSmtpSettings& aSettings,
       
    45                    CImSmtpSession*& aSession, TRequestStatus& aClientStatus);
       
    46 	void DeleteSession(CImSmtpSession& aSession, TRequestStatus& aClientStatus);
       
    47 	void ConnectionProgress(TImSmtpProgress& aProgress);
       
    48 	TBool IsSessionConnected();
       
    49 	TBool IsConnectionStarted();
       
    50 	TInt GetAccessPointIdForConnection(TUint32& aAccessPointId) const;
       
    51 
       
    52 private:
       
    53 	enum TState
       
    54 		{
       
    55 		EStateIdle,
       
    56 		EStateCreatingConnection,
       
    57 		EStateCreatingSession,
       
    58 		EStateStoringSession,
       
    59 		EStateQuittingSession
       
    60 		};
       
    61 
       
    62 private:
       
    63 	// Construction routines
       
    64 	CSmtpSessionManager(CImMobilityManager* aMobilityManager, TMsvId aServiceId);
       
    65 	void ConstructL();
       
    66 
       
    67 	virtual void DoRunL();
       
    68 	virtual void DoCancel();
       
    69 	virtual void DoComplete(TInt& aStatus);
       
    70 
       
    71 	void CreateConnectionL();
       
    72 	void RegisterConnectionL();
       
    73 	void CreateSessionL();
       
    74 	void StoreSessionL();
       
    75 	void QuitSessionL();
       
    76 
       
    77 private:
       
    78 	// Mobility manager. Not owned by this class.
       
    79 	// Will be null if bearer mobility not supported
       
    80 	CImMobilityManager* iMobilityManager;
       
    81 
       
    82 	// SMTP service ID
       
    83 	TMsvId iServiceId;
       
    84 
       
    85 	// SMTP service entry. Not owned by this class
       
    86 	CMsvServerEntry* iServerEntry;
       
    87 
       
    88 	// SMTP settings. Not owned by this class
       
    89 	CSmtpSettings* iSettings;
       
    90 
       
    91 	// Session we are operating on
       
    92 	CImSmtpSession* iSession;
       
    93 
       
    94 	// Stores the created session for passing back to caller
       
    95 	CImSmtpSession** iStoreSession;
       
    96 
       
    97 	// Network connection
       
    98 	CImConnect* iConnect;
       
    99 
       
   100 	// Socket server
       
   101 	RSocketServ iServ;
       
   102 
       
   103 	// State machine state
       
   104 	TState iState;
       
   105 	};
       
   106 
       
   107 #endif // __CSMTPSESSIONMANAGER_H__