authenticationservices/authenticationserver/test/reftestplugin/pinplugin/pinplugin.h
changeset 29 ece3df019add
equal deleted inserted replaced
19:cd501b96611d 29:ece3df019add
       
     1 /*
       
     2 * Copyright (c) 2006-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 * CPinPlugin is an CAuthPluginInterface implementation.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @internalAll
       
    23  @test
       
    24 */
       
    25 
       
    26 
       
    27 #ifndef PIN_PLUGIN_H
       
    28 #define PIN_PLUGIN_H
       
    29 
       
    30 #include <barsc.h>
       
    31 #include <authserver/authplugininterface.h>
       
    32 #include "pinpluginao.h"
       
    33 
       
    34 /**
       
    35  An implementation of the CAuthPluginInterface definition
       
    36  */
       
    37 class CPinPlugin : public AuthServer::CAuthPluginInterface
       
    38 	{
       
    39 public:
       
    40 	/** static methods to constuct the object of the CPinPlugin */
       
    41 	static CPinPlugin* NewL();
       
    42 	static CPinPlugin* NewLC();
       
    43 	/** Destructor */
       
    44 	~CPinPlugin();
       
    45 
       
    46 public:			//from CAuthPluginInterface
       
    47 	void Identify(AuthServer::TIdentityId& aId, const TDesC& aClientMessage,
       
    48 				  HBufC8*& aResult, TRequestStatus& aRequest);	
       
    49 	void Train(AuthServer::TIdentityId aId, HBufC8*& aResult, TRequestStatus& aRequest);		
       
    50 	TInt Forget(AuthServer::TIdentityId aId);
       
    51 	TInt DefaultData(AuthServer::TIdentityId aId, HBufC8*& aOutputBuf);
       
    52 	TInt Reset(AuthServer::TIdentityId aIdentityId, const TDesC& aRegistrationData, HBufC8*& aResult);
       
    53 	TBool IsActive() const;
       
    54 	void Cancel();
       
    55 	AuthServer::TPluginId Id() const;
       
    56 	const TPtrC& Name() const;
       
    57 	const TPtrC& Description() const;
       
    58 	AuthServer::TEntropy MinEntropy() const;
       
    59 	AuthServer::TPercentage FalsePositiveRate() const;
       
    60 	AuthServer::TPercentage FalseNegativeRate() const;
       
    61 	AuthServer::TAuthPluginType Type() const;
       
    62 private:
       
    63 	/** 
       
    64 	  Second Phase Constructor
       
    65 	  @panic EPinPanicInvalidConfigValues	if the resource file contains the invalid entries
       
    66 	  */
       
    67 	void ConstructL();
       
    68 	/** Constructor */
       
    69 	CPinPlugin();
       
    70 	/**
       
    71 	 Opens the Resource file and Read the values from it.
       
    72 	 
       
    73 	 @param aRetryCount		On return, it holds Retry Count value.
       
    74 	 @param aPinSize		On return, it holds Default Pin Size.
       
    75 	 @param aPinMinSize		On return, it holds Minimum Pin Size.
       
    76 	 @param aPinMaxSize		On return, it holds Maximum Pin Size.
       
    77 	 */
       
    78 	void ReadResourceL(TInt& aRetryCount, TInt& aPinSize, TInt& aPinMinSize,
       
    79 					TInt& aPinMaxSize);
       
    80 	/**
       
    81 	 Utility function to give a value for a particular resource Id.
       
    82 	 
       
    83 	 @param aResFile		The resource file to be read
       
    84 	 @param aResourceID		The resource Id to be read from the resource file
       
    85 	 @return				returns the value read from the resource file.
       
    86  	 */
       
    87 	TInt ResourceValueL(RResourceFile& aResFile, const TInt aResourceID);
       
    88 
       
    89 	void SetPluginStateL();
       
    90 	
       
    91 private:
       
    92 	/** CPinpluginAO object to process the operation in AO */
       
    93 	CPinPluginAO* iPinPluginAO;
       
    94 	/** The name of plugin read from the resource file */
       
    95 	HBufC* iPinName;
       
    96 	/** The Description for the plugin read from the resource file */
       
    97 	HBufC* iPinDescription;
       
    98 protected:
       
    99 	/// The name of the plugin. Derived classes should set this member.
       
   100 	TPtrC iName;
       
   101 	/// The plugin's description. Derived classes should set this member.
       
   102 	TPtrC iDescription;
       
   103 	/// The minumum entropy provided by the plugin. Derived classes should set
       
   104 	/// this member.
       
   105 	AuthServer::TEntropy iMinEntropy;
       
   106 	/// The false positive rate of the plugin. Derived classes should set this
       
   107 	/// member.
       
   108 	AuthServer::TPercentage iFalsePositiveRate;
       
   109 	/// The false negative rate of the plugin. Derived classes should set this
       
   110 	/// member.
       
   111 	AuthServer::TPercentage iFalseNegativeRate;
       
   112  	/// The type of the plugin. Derived classes should set this member.
       
   113 	AuthServer::TAuthPluginType iType;
       
   114 	/// the state of the plugin.
       
   115 	TBool iActive;
       
   116 	};
       
   117 
       
   118 #endif	/* PIN_PLUGIN_H */
       
   119