adaptationlayer/tsy/nokiatsy_dll/inc/cmmsecuritymesshandler.h
changeset 0 63b37f68c1ce
child 5 8ccc39f9d787
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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 #ifndef CMMSECURITYMESSHANDLER_H
       
    20 #define CMMSECURITYMESSHANDLER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>  // Symbian base types
       
    24 #include <etelmm.h> //Symbian Etel related types
       
    25 
       
    26 #include "mmmmesshandlerbase.h"
       
    27 #include "cmmphonetreceiver.h"
       
    28 #include "nokiatsy_internal_variation.h"
       
    29 #include "cmmuiccmesshandler.h"
       
    30 
       
    31 // CONSTANTS
       
    32     //none
       
    33 
       
    34 // MACROS
       
    35     //none
       
    36 
       
    37 // DATA TYPES
       
    38     //none
       
    39 
       
    40 // FUNCTION PROTOTYPES
       
    41     //none
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 class CMmNetMessHandler;
       
    45 class CMmCallMessHandler;
       
    46 class CMmPhoNetSender;
       
    47 class CMmDataPackage;
       
    48 class TIsiReceiveC;
       
    49 class CMmMessageRouter;
       
    50 class CMmUiccMessHandler;
       
    51 // CLASS DECLARATION
       
    52 
       
    53 // DESCRIPTION
       
    54 /**
       
    55 * Used for creating and sending SECURITY server's ISI messages to
       
    56 * PhoNet via PhoNetSender. It also receives SECURITY server's
       
    57 * ISI messages from PhoNetReceiver.
       
    58 *
       
    59 *  @lib (unknown)
       
    60 *  @since 2.6
       
    61 */
       
    62 class CMmSecurityMessHandler
       
    63         : public CBase, 
       
    64           public MMmMessHandlerBase, 
       
    65           public MMmMessageReceiver, 
       
    66           public MUiccOperationBase
       
    67     {
       
    68 
       
    69     public:
       
    70         struct CNosBootState
       
    71             {
       
    72             TBool iSIMReady;
       
    73             TBool iSecReady;
       
    74             TBool iSecCodeRequired;
       
    75             TBool iPinRequired;
       
    76             TBool iPinVerified;
       
    77             TBool iSmsPReady;
       
    78             TBool iCachingActive;
       
    79 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
    80             TUint8 iMtcCurrentState;
       
    81 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
    82             TUint8 iMceCurrentState;
       
    83 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
    84             };
       
    85         // This enumeration is needed because different phonebook specific
       
    86         // requests can be made using the same SIM_PB_REQ/RESP messages.
       
    87         // Used as a transaction ID. Storage classes use traId values 0-10.
       
    88         enum TFDNListRequestType
       
    89             {
       
    90             EGetCurrentFDNListStatus = 11,
       
    91             ESetCurrentFDNListStatusToEnabled = 12,
       
    92             ESetCurrentFDNListStatusToDisabled = 13
       
    93             };
       
    94 
       
    95     public:  // Constructors and destructor
       
    96 
       
    97         /**
       
    98         * Two-phased constructor.
       
    99         * @param aPhoNetSender Pointer to the Phonet sender
       
   100         * @param aPhoNetReceiver Pointer to the Phonet receiver
       
   101         * @param aNetMessHandler pointer to the net mess handler
       
   102         * @param aCallMessHandler pointer to the call mess handler
       
   103         * @param aMessageRouter Pointer to the message router
       
   104         * @return created message handler object
       
   105         */
       
   106         static CMmSecurityMessHandler* NewL(
       
   107             CMmPhoNetSender* aPhoNetSender,
       
   108             CMmPhoNetReceiver* aPhoNetReceiver,
       
   109             CMmNetMessHandler* aNetMessHandler,
       
   110             CMmCallMessHandler* aCallMessHandler,
       
   111             CMmMessageRouter* aMessageRouter,
       
   112             CMmUiccMessHandler* aUiccMessHandler );
       
   113 
       
   114         /**
       
   115         * Destructor.
       
   116         */
       
   117         ~CMmSecurityMessHandler();
       
   118 
       
   119         /**
       
   120         * Entry point for request from the message manager
       
   121         * @param aIpc
       
   122         * @param CMmDataPackage
       
   123         */
       
   124         TInt ExtFuncL(
       
   125             TInt aIpc,
       
   126             const CMmDataPackage* aDataPackage );
       
   127 
       
   128         /**
       
   129         * Handles a received message by calling the specific
       
   130         * message handling method.
       
   131         * @param TIsiReceiveC, reference to the received message.
       
   132         * @return TInt: True if message been handled in this message handler
       
   133         */
       
   134         void ReceiveMessageL( const TIsiReceiveC& aIsiMessage );
       
   135 
       
   136         /**
       
   137         * Returns GetPukCodeRequired
       
   138         * @param None
       
   139         * @return TInt
       
   140         */
       
   141         TInt GetPukCodeReq();
       
   142 
       
   143 
       
   144     private:
       
   145 
       
   146         /**
       
   147         * 2nd phase constructor
       
   148         */
       
   149         void ConstructL();
       
   150 
       
   151         /**
       
   152         * Handles requests to verify a security code
       
   153         * @param RMobilePhone::TMobilePhoneSecurityCode*: type of sec code
       
   154         * @param const RMobilePhone::TCodeAndUnblockCode* aCodes
       
   155         * return TInt, success/failure value
       
   156         */
       
   157         TInt VerifySecurityCode(
       
   158             RMobilePhone::TMobilePhoneSecurityCode* aType,
       
   159             RMobilePhone::TCodeAndUnblockCode* aCodes );
       
   160 
       
   161 
       
   162         /**
       
   163         * Handles requsests to change a security code
       
   164         * @param TUint8 aTransactionId: Transactionid
       
   165         * @param RMobilePhone::TMobilePhoneSecurityCode*: type of sec code
       
   166         * @param const RMobilePhone::TMobilePhonePasswordChangeV1* aChange
       
   167         * return TInt, success/failure value
       
   168         */
       
   169         TInt SecCodeChangeReq( TUint8 aTransactionId,
       
   170             RMobilePhone::TMobilePhoneSecurityCode* aType,
       
   171             RMobilePhone::TMobilePhonePasswordChangeV1* aChange );
       
   172 
       
   173 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
   174         /**
       
   175         * Forms a MTC_RF_STATUS_QUERY_REQ ISI-message.
       
   176         * @param TUint8 aTransactionId: Transaction id
       
   177         * @return TInt, success/failure value
       
   178         */
       
   179         TInt MtcRfStatusQueryReq( TUint8 aTransactionId ) const;
       
   180 
       
   181         /**
       
   182         * Breaks a MTC_RF_STATUS_QUERY_RESP ISI-message.
       
   183         * @param const TIsiReceiveC& aIsiMessage: Received ISI message
       
   184         * @return None
       
   185         */
       
   186         void MtcRfStatusQueryResp( const TIsiReceiveC& aIsiMessage ) const;
       
   187 
       
   188         /**
       
   189         * Forms a MTC_STATE_QUERY_REQ ISI-message.
       
   190         * @param TUint8 aTransactionId: Transaction id
       
   191         * @return TInt, success/failure value
       
   192         */
       
   193         TInt MtcStateQueryReq( TUint8 aTransactionId ) const;
       
   194 
       
   195         /**
       
   196         * Breaks a MTC_STATE_QUERY_RESP ISI-message.
       
   197         * @param const TIsiReceiveC& aIsiMessage: Received ISI message
       
   198         * @return None
       
   199         */
       
   200         void MtcStateQueryRespL( const TIsiReceiveC& aIsiMessage );
       
   201 
       
   202         /**
       
   203         * MTC state info indication.
       
   204         * @param const TIsiReceiveC& aIsiMessage: Received ISI message
       
   205         * @return void : None
       
   206         */
       
   207         void MtcStateInfoIndL( const TIsiReceiveC& aIsiMessage );
       
   208 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
   209         /**
       
   210         * Forms a MCE_RF_STATE_QUERY_REQ ISI-message.
       
   211         * @return Error code
       
   212         */
       
   213         TInt MceRfStateQueryReq() const;
       
   214 
       
   215         /**
       
   216         * Breaks a MCE_RF_STATE_QUERY_RESP ISI-message.
       
   217         * @param aIsiMessage: Received ISI message
       
   218         * @return None
       
   219         */
       
   220         void MceRfStateQueryResp( const TIsiReceiveC& aIsiMessage ) const;
       
   221 
       
   222         /**
       
   223         * Forms a MCE_MODEM_STATE_QUERY_REQ ISI-message.
       
   224         * @return Error code
       
   225         */
       
   226         TInt MceModemStateQueryReq() const;
       
   227 
       
   228         /**
       
   229         * Breaks a MCE_MODEM_STATE_QUERY_RESP ISI-message.
       
   230         * @param aIsiMessage Received ISI message
       
   231         * @return None
       
   232         */
       
   233         void MceModemStateQueryResp( const TIsiReceiveC& aIsiMessage );
       
   234 
       
   235         /**
       
   236         * MCE state indication.
       
   237         * @param aIsiMessage Received ISI message
       
   238         * @return None
       
   239         */
       
   240         void MceModemStateInd( const TIsiReceiveC& aIsiMessage );
       
   241 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
   242 
       
   243         /**
       
   244         * Forms UICC_REQ ISI message
       
   245         * return Error code
       
   246         */
       
   247         TInt UiccReq() const;
       
   248 
       
   249         /**
       
   250         * Response to UICC_REQ
       
   251         * @param aIsiMessage Received ISI message
       
   252         * @return void
       
   253         */
       
   254         void UiccResp( const TIsiReceiveC& aIsiMessage );
       
   255 
       
   256         /**
       
   257         * Handles UICC_IND
       
   258         * @param aIsiMessage Received ISI message
       
   259         * @return void
       
   260         */
       
   261         void UiccInd( const TIsiReceiveC& aIsiMessage );
       
   262 
       
   263         /**
       
   264         * Handles UICC_CARD_IND
       
   265         * @param aIsiMessage Received ISI message
       
   266         * @return void
       
   267         */
       
   268         void UiccCardInd( const TIsiReceiveC& aIsiMessage );
       
   269 
       
   270         /**
       
   271         * Handles UICC_PIN_IND
       
   272         * @param aIsiMessage Received ISI message
       
   273         * @return void
       
   274         */
       
   275         void UiccPinInd( const TIsiReceiveC& aIsiMessage );
       
   276 
       
   277         /**
       
   278         * Creates and sends UICC_PIN_REQ ISI message
       
   279         * @param aServiceType Service type
       
   280         * @param aCode Code
       
   281         * @param aUnblockCode Unblocking code
       
   282         * @return Error code
       
   283         */
       
   284         TInt UiccPinReqVerify(
       
   285             const TUint8 aServiceType,
       
   286             const RMobilePhone::TMobilePassword& aCode,
       
   287             const RMobilePhone::TMobilePassword& aUnblockCode);
       
   288 
       
   289         /**
       
   290         * Handles UICC_PIN_RESP
       
   291         * @param aIsiMessage Received ISI message
       
   292         * @return void
       
   293         */
       
   294         void UiccPinResp( const TIsiReceiveC& aIsiMessage );
       
   295 
       
   296         /**
       
   297         * Creates and sends UICC_PIN_REQ ISI message
       
   298         * @param aLock Lock to be queried
       
   299         * @return Error code
       
   300         */
       
   301         TInt UiccPinReqStateQuery(
       
   302             const RMobilePhone::TMobilePhoneLock aLock );
       
   303 
       
   304         /**
       
   305         * Creates and sends UICC_PIN_REQ ISI message
       
   306         * @param aType Code type
       
   307         * @param aOldCode Current PIN code
       
   308         * @param aNewCode New PIN code
       
   309         * @return Error code
       
   310         */
       
   311         TInt UiccPinReqChange(
       
   312             RMobilePhone::TMobilePhoneSecurityCode& aType,
       
   313             const RMobilePhone::TMobilePassword& aOldCode,
       
   314             const RMobilePhone::TMobilePassword& aNewCode );
       
   315 
       
   316         /**
       
   317         * Creates and sends UICC_PIN_REQ ISI message
       
   318         * @param aLock Lock type
       
   319         * @param aSetting New setting to be changed
       
   320         * @param aCode PIN code
       
   321         * @return Error code
       
   322         */
       
   323         TInt UiccPinReqChangeState(
       
   324             const RMobilePhone::TMobilePhoneLock aLock,
       
   325             const RMobilePhone::TMobilePhoneLockSetting& aSetting,
       
   326             const RMobilePhone::TMobilePassword& aCode );
       
   327 
       
   328         /**
       
   329         * Handles PIN code verify response
       
   330         * @param aStatus Status
       
   331         * @param aIsiMessage ISI message
       
   332         * @return void
       
   333         */
       
   334         void HandleUiccPinVerifyResp(
       
   335             const TUint8 aStatus,
       
   336             const TIsiReceiveC& aIsiMessage );
       
   337 
       
   338         /**
       
   339         * Handles PIN code state query response
       
   340         * @param aStatus Status
       
   341         * @param aIsiMessage ISI message
       
   342         * @return void
       
   343         */
       
   344         void HandleUiccPinInfoResp(
       
   345             const TUint8 aStatus,
       
   346             const TIsiReceiveC& aIsiMessage );
       
   347 
       
   348         /**
       
   349         * Handles PIN code changing response
       
   350         * @param aStatus Status
       
   351         * @param aIsiMessage ISI message
       
   352         * @return void
       
   353         */
       
   354         void HandleUiccPinChangeResp(
       
   355             const TUint8 aStatus,
       
   356             const TIsiReceiveC& aIsiMessage );
       
   357 
       
   358         /**
       
   359         * Handles PIN code disabling/enabling response
       
   360         * @param aStatus Status
       
   361         * @param aIsiMessage ISI message
       
   362         * @return void
       
   363         */
       
   364         void HandleUiccPinStateChangeResp(
       
   365             const TUint8 aStatus,
       
   366             const TIsiReceiveC& aIsiMessage );
       
   367 
       
   368         /**
       
   369         * Creates and sends SEC_CODE_VERIFY_REQ ISI message
       
   370         * @param aCode Code to be verified
       
   371         * @return Error code
       
   372         */
       
   373         TInt SecCodeVerifyReq( const RMobilePhone::TMobilePassword& aCode );
       
   374 
       
   375         /**
       
   376         * Reads ICC type from UICC message handler and completes it
       
   377         * @return void
       
   378         */
       
   379         void GetIccType();
       
   380 
       
   381         /**
       
   382         * Reads active PIN from UICC message handler and completes it
       
   383         * @return void
       
   384         */
       
   385         void GetActivePin();
       
   386 
       
   387         /**
       
   388         * Reads AID of active USIM application from UICC message handler
       
   389         * and completes it
       
   390         * @return void
       
   391         */
       
   392         void GetActiveUsimApplication();
       
   393 
       
   394         /**
       
   395         * Reads elementary file EFest in case of UICC card
       
   396         * @param aTraId transaction id used in read req
       
   397         * @return Error code
       
   398         */
       
   399         TInt ReadEfEst( TUiccTrId aTraId );
       
   400 
       
   401         /**
       
   402         * Sends INVALIDATE/REHABILITATE command for setting
       
   403         * FDN state in case of ICC card
       
   404         * @return Error code
       
   405         */
       
   406         TInt SendFdnStateCommand();
       
   407 
       
   408         /**
       
   409         * Handle UICC response messages
       
   410         * @param aTraId Transaction ID
       
   411         * @param aFileData Descriptor for file data
       
   412         * @return KErrNone or error code
       
   413         */
       
   414         TInt ProcessUiccMsg(
       
   415             TInt aTraId,
       
   416             TInt aStatus,
       
   417             const TDesC8& aFileData );
       
   418 
       
   419         /**
       
   420         * Handles EFest read response in FDN state setting
       
   421         * @param aStatus Status
       
   422         * @param aFileData EFest data
       
   423         * @return void
       
   424         */
       
   425         void FdnSetReadEfEstResp(
       
   426             TInt aStatus,
       
   427             const TDesC8& aFileData );
       
   428 
       
   429         /**
       
   430         * Handles EFest read response in FDN state getting
       
   431         * @param aStatus Status
       
   432         * @param aFileData EFest data
       
   433         * @return void
       
   434         */
       
   435         void FdnGetReadEfEstResp(
       
   436             TInt aStatus,
       
   437             const TDesC8& aFileData );
       
   438 
       
   439         /**
       
   440         * Handles EFest read response
       
   441         * @param aStatus Status
       
   442         * @return void
       
   443         */
       
   444         void WriteEfEstResp( const TInt aStatus );
       
   445         
       
   446         /**
       
   447         * Handles INVALIDATE/REHABILITATE command response
       
   448         * in case of ICC card
       
   449         * @param aStatus Status
       
   450         * @param aFileData response from ICC card
       
   451         * @return void
       
   452         */
       
   453         void FdnStateCommandResp(
       
   454             TInt aStatus,
       
   455             const TDesC8& aFileData );
       
   456 
       
   457         /**
       
   458         * Sends UICC_APPL_CMD_REQ with service type UICC_APPL_FILE_INFO
       
   459         * for reading file info for elementary file EFadn in case of ICC card.
       
   460         * @param aTraId Transaction ID
       
   461         * @return Error code
       
   462         */
       
   463         TInt ReadEfAdnFileInfo( TUiccTrId aTraId );
       
   464 
       
   465         /**
       
   466         * Handles UICC_APPL_CMD_RESP with service type UICC_APPL_FILE_INFO
       
   467         * for handling file info for elementary file EFadn in case of ICC card
       
   468         * and FDN setting.
       
   469         * @param aStatus Status
       
   470         * @param aFileData response from ICC card
       
   471         * @return void
       
   472         */
       
   473         void FdnSetReadEfAdnFileInfoResp(
       
   474             TInt aStatus,
       
   475             const TDesC8& aFileData );
       
   476 
       
   477         /**
       
   478         * Handles UICC_APPL_CMD_RESP with service type UICC_APPL_FILE_INFO
       
   479         * for handling file info for elementary file EFadn in case of ICC card
       
   480         * and FDN getting.
       
   481         * @param aStatus Status
       
   482         * @param aFileData response from ICC card
       
   483         * @return void
       
   484         */
       
   485         void FdnGetReadEfAdnFileInfoResp(
       
   486             TInt aStatus,
       
   487             const TDesC8& aFileData );
       
   488 
       
   489     protected:
       
   490 
       
   491         /**
       
   492         * C++ default constructor.
       
   493         */
       
   494         CMmSecurityMessHandler();
       
   495 
       
   496     private:    // Data
       
   497 
       
   498         //Pointer to the Message Router
       
   499         CMmMessageRouter* iMessageRouter;
       
   500 
       
   501         //Pointer to the Net Message Handler
       
   502         CMmNetMessHandler* iNetMessHandler;
       
   503 
       
   504         //Pointer to the Call Message Handler
       
   505         CMmCallMessHandler* iCallMessHandler;
       
   506 
       
   507         //ApplicationNumber of ISIM application
       
   508         TUint8 iApplicationNumber;
       
   509 
       
   510         // Type of security code in case verify code
       
   511         RMobilePhone::TMobilePhoneSecurityCode iSecCodeTypeForVerifyCode;
       
   512 
       
   513         // Type of security code in case change code
       
   514         RMobilePhone::TMobilePhoneSecurityCode iSecCodeTypeForChangeCode;
       
   515 
       
   516     protected:  // Data
       
   517 
       
   518         //Pointer to the PhonetSender
       
   519         CMmPhoNetSender* iPhoNetSender;
       
   520 
       
   521         // Pointer to UICC message handler
       
   522         CMmUiccMessHandler* iMmUiccMessHandler;
       
   523 
       
   524         //Boot state
       
   525         CNosBootState iBootState;
       
   526 
       
   527         //Is puk code required
       
   528         TBool iPukCodeRequired;
       
   529 
       
   530         // Active PIN
       
   531         RMobilePhone::TMobilePhoneSecurityCode iActivePin;
       
   532 
       
   533         // Application ID
       
   534         TUint8 iApplicationId;
       
   535 
       
   536         // PIN key reference
       
   537         TUint8 iPinId;
       
   538 
       
   539         // Flag indicating if PIN attempts left query is in case
       
   540         TBool iPinAttemptsLeftQuery;
       
   541 
       
   542         // Flag indicating if lock state query is in case
       
   543         TBool iLockStateQuery;
       
   544 
       
   545         // Security code type
       
   546         RMobilePhone::TMobilePhoneSecurityCode iCodeType;
       
   547         
       
   548         // variable to store FDN state which is going
       
   549         // to be set
       
   550         RMobilePhone::TMobilePhoneFdnSetting iFdnSetting;
       
   551 
       
   552     };
       
   553 
       
   554 
       
   555 #endif // CMMSECURITYMESSHANDLER_H
       
   556 
       
   557 // End of File