gba/gbaserver/inc/bootstrap.h
changeset 0 164170e6151a
child 1 d5423fbb4f29
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2  * Copyright (c) 2007 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 "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:  Bootstrap classes definitions
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef BOOTSTRAPIMPL_H
       
    19 #define BOOTSTRAPIMPL_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <stringpool.h>
       
    23 #include <http.h>
       
    24 #include <gbautility.h>
       
    25 #include "M3GPPAuthenticationCallback.h"
       
    26 #include "gbauicc.h"
       
    27 
       
    28 void ResetAndDestroyArray(TAny* aArray);
       
    29 
       
    30 class CGbaServerSession;
       
    31 class CDataRetriever;
       
    32 // format for output of data/time values
       
    33 _LIT(KDateFormat,"%D%M%Y%/0%1%/1%2%/2%3%/3 %:0%H%:1%T%:2%S.%C%:3");
       
    34 
       
    35 class MBootstrapCallBack : public M3GPPAuthenticationCallback
       
    36     {
       
    37 public:
       
    38     
       
    39     virtual void CompleteBootStrappingL(TInt aError) = 0;
       
    40     
       
    41     virtual TBool InterfaceIs2G() = 0;
       
    42     
       
    43     };
       
    44 
       
    45 class C3GPPBootstrap : public CActive, public MBootstrapCallBack
       
    46     {
       
    47 public:
       
    48     
       
    49     static C3GPPBootstrap* NewL(CGbaServerSession* aSession);
       
    50     
       
    51     static C3GPPBootstrap* NewLC(CGbaServerSession* aSession);
       
    52     
       
    53     void InitializeL();
       
    54     
       
    55     void GetBootstrappingMaterialL(const TDesC8& aBSFAddress,
       
    56             const TDesC8& aNAFURL, const TDesC8& aUICC_LABEL,
       
    57             const TUint8& aFlags, const TDesC8& aKeyUsage, TDes8 &aKsNAF,
       
    58             TDes8 &aBTID, TTime &aLifetime, EGBARunType& aGBARunType,
       
    59             const TInt& aIAPID);
       
    60     
       
    61     void CancelBootstrap();
       
    62     
       
    63     TInt GetState() const;
       
    64     
       
    65     void Cleanup();
       
    66     
       
    67     TBool GBAUAvailabilityL();
       
    68 
       
    69     // from M3GPPAuthenticationCallback  
       
    70     TBool GetCredentialsL(const TUriC8& aURI, RString aRealm, RString aNonce,
       
    71             RString aAlgorithm, RString& aUsername, RString& aPassword,
       
    72             RString& aResync, TBool& aResyncRequired);
       
    73 
       
    74     virtual ~C3GPPBootstrap();
       
    75 
       
    76     //from MBootstrapCallBack
       
    77     void CompleteBootStrappingL(TInt aError);
       
    78     
       
    79     TBool InterfaceIs2G();
       
    80 
       
    81 private:
       
    82 
       
    83     void DoBootstrapL();
       
    84     
       
    85     TBool GenerateKeyMaterialL();
       
    86     
       
    87     void ConstructL();
       
    88     
       
    89     C3GPPBootstrap(CGbaServerSession* aSession);
       
    90     
       
    91     TBool LoadCredentialsL();
       
    92     
       
    93     void StoreCredentialsL();
       
    94     
       
    95     TBool ConvertStringToTTime(TDesC8& aLifetimeBuf, TTime* aLifetime);
       
    96     
       
    97     TBool IsStillValid(TTime* aLifetime);
       
    98     
       
    99     TInt LoadGBAUAvailabililtyFromStoreL(TBool& aIsfromGBAClient, TBool& aGBAUAvail);
       
   100     
       
   101     void SaveGBAUAvailabilityToStoreL(TBool& aGBAUAvail);
       
   102     
       
   103     TBool CheckGBAUAvailabilityL(TBool aIsfromGBAClient);
       
   104     
       
   105     MUICCInterface* RequestUICCInterfaceL();
       
   106     
       
   107     TBool IsPluginExistL();
       
   108     
       
   109     void MakePrivateFilenameL(RFs& aFs, const TDesC& aLeafName, TDes& aNameOut);
       
   110     
       
   111     void EnsurePathL(RFs& aFs, const TDesC& aFile);
       
   112 
       
   113     //From CActive
       
   114     void RunL();
       
   115     
       
   116     TInt RunError(TInt aError);
       
   117     
       
   118     void DoCancel();
       
   119 
       
   120 public:
       
   121 
       
   122     enum TBootstrapperState
       
   123         {
       
   124         EIdle, EInitialize, EBusy, ECancel
       
   125         };
       
   126 private:
       
   127     enum TSecurityAlgorithm
       
   128         {
       
   129         ESecAlgUnknown, EAKAv1, EAKAv2, ESIMv2
       
   130         };
       
   131 
       
   132 private:
       
   133 
       
   134     MUICCInterface* iSmartCardInterface;
       
   135     TDes8*          iCallerBTIDBuf;     //not owned,  pointer to return buffer
       
   136     TDes8*          iCallerKsNAFBuf;    //not owned,  pointer to return buffer
       
   137     TTime*          iCallerLifetime;    //not owned, pointer to return object
       
   138     EGBARunType*    iCallerGBARunType;  //not owned, pointer to return object
       
   139     HBufC8*         iKsNAF;             //owned
       
   140     HBufC8*         iBTID;              //owned
       
   141     TTime           iLifetime;          //onwed
       
   142     HBufC8*         iIdentity;          //buffer for impi
       
   143     HBufC8*         iNAFID;             //buffer for nafid
       
   144     HBufC8*         iRand;              //buffer for rand
       
   145     HBufC8*         iMasterKey;         //buffer for Ks
       
   146     EGBARunType     iGBARunType;
       
   147     CDataRetriever* iDataRetriever;     //owned
       
   148     TInt            iAuthFailed;
       
   149     TBootstrapperState iBSState;
       
   150     TBool           iGBAUAvailable;
       
   151     TUid            iImplementationUID;
       
   152     TUid            iDtorIDKey;
       
   153     CGbaServerSession* iSession;        //Not owned
       
   154     };
       
   155 
       
   156 #endif
       
   157 //EOF