cryptomgmtlibs/cryptotokenfw/tsecdlg/Tsecdlg.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file 
       
    23  @internalTechnology
       
    24 */
       
    25  
       
    26 #ifndef __TSECDLG_H__
       
    27 #define __TSECDLG_H__
       
    28 
       
    29 #include <e32base.h>
       
    30 #include <secdlgimpldefs.h>
       
    31 
       
    32 const TUint KTSecDlgNotiferUid = 0x10204789;
       
    33 
       
    34 #ifdef _T_SECDLG_TEXTSHELL
       
    35 
       
    36 #include <twintnotifier.h>
       
    37 
       
    38 /** Method at ordinal 1 to get a list of notifiers from this dll. */
       
    39 IMPORT_C CArrayPtr<MNotifierBase2>* NotifierArray();
       
    40 
       
    41 #else
       
    42 
       
    43 #include <eiknotapi.h>
       
    44 #include <implementationproxy.h>
       
    45 #define MNotifierBase2 MEikSrvNotifierBase2
       
    46 
       
    47 IMPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount);
       
    48 CArrayPtr<MNotifierBase2>* NotifierArray();
       
    49 
       
    50 #endif
       
    51 
       
    52 class CInputSpec : public CBase
       
    53 	{
       
    54  public:
       
    55 	CInputSpec(TSecurityDialogOperation aOp, HBufC* aLabelSpec, HBufC* aResponse1, HBufC* aResponse2);
       
    56 	~CInputSpec();
       
    57 	TSecurityDialogNotification Operation() const { return iOp; }
       
    58 	const TDesC& LabelSpec() const { return *iLabelSpec; }
       
    59 	const TDesC& Response1() const { return *iResponse1; }
       
    60 	const TDesC& Response2() const { return *iResponse2; }
       
    61  private:
       
    62 	TSecurityDialogNotification iOp;
       
    63 	HBufC* iLabelSpec;
       
    64 	HBufC* iResponse1;
       
    65 	HBufC* iResponse2;
       
    66 	};
       
    67 
       
    68 /**
       
    69  * This is a dummy implementation of the security dialog notifier.  This version
       
    70  * responds to dialogs with data read from t_secdlg_in.dat present on system drive.  
       
    71  * This contains the expected sequence of dialogs, and the desired responses.  It keeps a
       
    72  * count of how many dialogs it has answered in t_secdlg_out.dat present on system drive.
       
    73  */
       
    74 class CTestSecDlgNotifier : public CBase, public MNotifierBase2
       
    75 	{
       
    76 public:
       
    77 	static CTestSecDlgNotifier* NewL();
       
    78 	CTestSecDlgNotifier();
       
    79 
       
    80 private:
       
    81 	void ConstructL();
       
    82 
       
    83 	/**
       
    84 	 * Get the index of the next response by reading how many dialogs we have
       
    85 	 * already answered.
       
    86 	 */
       
    87 	TInt GetInputIndexL();
       
    88 
       
    89 	/**
       
    90 	 * Write the number of dalogs answered to the output file.
       
    91 	 */
       
    92 	void WriteDialogCountL(TInt aCount);
       
    93 
       
    94 	/**
       
    95 	 * Read an input specification.
       
    96 	 */
       
    97 	CInputSpec* ReadInputSpecL(TInt aIndex);
       
    98 
       
    99 	void DoEnterPINL(const CInputSpec& aSpec, const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
       
   100 	void DoChangePINL(const CInputSpec& aSpec, const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
       
   101 	void DoStartL( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage );
       
   102 	void DoServerAuthenticationFailureL(const CInputSpec& aSpec, const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage );
       
   103  	void DoSecureConnectionL(const CInputSpec& aSpec, const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage );
       
   104 
       
   105 private:
       
   106 	void Release();
       
   107 	TNotifierInfo RegisterL();
       
   108 	TNotifierInfo Info() const;
       
   109 	
       
   110 	virtual void StartL( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage );
       
   111 	virtual TPtrC8 StartL( const TDesC8& aBuffer );
       
   112 	
       
   113 	void Cancel();
       
   114 	TPtrC8 UpdateL( const TDesC8& aBuffer );
       
   115 
       
   116 private:
       
   117 	RFs iFs;
       
   118 	TNotifierInfo iInfo;
       
   119 	};
       
   120 
       
   121 #endif