omaprovisioning/provisioning/ProvisioningEngine/Inc/CWPBootstrap.h
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2002 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:  CWPBootstrap loads/saves settings.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CWPBOOTSTRAP_H
       
    20 #define CWPBOOTSTRAP_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "MWPVisitor.h"
       
    24 #include <e32base.h>
       
    25 #include <etelmm.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CDesC16Array;
       
    29 class CWPPushMessage;
       
    30 class CWPEngine;
       
    31 
       
    32 //  CLASS DEFINITION
       
    33 
       
    34 /**
       
    35 *  Utility class for reading/writing data store.
       
    36 *
       
    37 *  @lib ProvisioningEngine
       
    38 *  @since 2.0
       
    39 */
       
    40 class CWPBootstrap : public CBase, private MWPVisitor
       
    41     {
       
    42     public:
       
    43         enum TBootstrapResult 
       
    44             { 
       
    45             // The message does not contain a bootstrap.
       
    46             ENoBootstrap,
       
    47 
       
    48             // The message contains a bootstrap, but no authentication
       
    49             ENotAuthenticated,
       
    50 
       
    51             // The message contains a bootstrap, and a PIN is required.
       
    52             EPinRequired,
       
    53 
       
    54             // The PIN is wrong.
       
    55             EAuthenticationFailed, 
       
    56 
       
    57             // Bootstrap already exists
       
    58             EBootstrapExists,
       
    59 
       
    60             // Authentication succeeded.
       
    61             ESucceeded
       
    62             };
       
    63 
       
    64     public:  // Constructors and destructor
       
    65         
       
    66         /**
       
    67         * Two-phased constructor.
       
    68         * @param aIMSI The SIM card number
       
    69         */
       
    70         IMPORT_C static CWPBootstrap* NewL( 
       
    71             const TDesC& aIMSI );
       
    72 
       
    73         /**
       
    74         * Two-phased constructor.
       
    75         * @param aIMSI The SIM card number
       
    76         */
       
    77         static CWPBootstrap* NewLC( 
       
    78             const TDesC& aIMSI );
       
    79 
       
    80         /**
       
    81         * Destructor.
       
    82         */
       
    83         ~CWPBootstrap();
       
    84 
       
    85     public:
       
    86         /**
       
    87         * Authenticates a message and tries to perform a
       
    88         * bootstrap if the message authenticated. If the 
       
    89         * message has previously been authenticated, only
       
    90         * bootstrap is performed.
       
    91         * @param aMessage The message to authenticate
       
    92         * @param The Provisioning Engine
       
    93         * @param aPIN The PIN. If empty, no PIN is used.
       
    94         * @return Result of bootstrap. If EPinRequired,
       
    95         *         a PIN must be provided.
       
    96         */
       
    97         IMPORT_C TBootstrapResult BootstrapL( 
       
    98             CWPPushMessage& aMessage,
       
    99             CWPEngine& aEngine,
       
   100             const TDesC& aPIN );
       
   101 
       
   102         /**
       
   103         * The contents of the ProvURL field.
       
   104         * @return ProvURL
       
   105         */
       
   106         IMPORT_C const TDesC& TPS() const;
       
   107 
       
   108     private:    // From MWPVisitor
       
   109         void VisitL(CWPCharacteristic& aCharacteristic);
       
   110         void VisitL(CWPParameter& aParameter);
       
   111         void VisitLinkL(CWPCharacteristic& aCharacteristic );
       
   112 
       
   113     private:
       
   114         /**
       
   115         * C++ default constructor.
       
   116         * @param aIMSI The SIM card number
       
   117         */
       
   118         CWPBootstrap( const TDesC& aIMSI );
       
   119 
       
   120         /**
       
   121         * By default Symbian 2nd phase constructor is private.
       
   122         */
       
   123         void ConstructL();
       
   124 
       
   125         /**
       
   126         * Performs a bootstrap.
       
   127         * @param aEngine The Provisioning Engine
       
   128         * @return Result of bootstrap.
       
   129         */
       
   130         TBootstrapResult DoBootstrapL( CWPEngine& aEngine );
       
   131 
       
   132         /**
       
   133         * Processes bootstrap when the message has to be 
       
   134         * authenticated first.
       
   135         * @param aMessage The message to authenticate
       
   136         * @param aPIN The PIN. If empty, no PIN is used.
       
   137         * @param aEngine The Provisioning Engine
       
   138         * @return Result of bootstrap. If EPinRequired,
       
   139         *         a PIN must be provided.
       
   140         */
       
   141         TBootstrapResult DoAuthenticateL( CWPPushMessage& aMessage,
       
   142             const TDesC& aPIN, 
       
   143             CWPEngine& aEngine );
       
   144 
       
   145         /**
       
   146         * Saves the settings.
       
   147         * @param aEngine The Provisioning Engine
       
   148         */
       
   149         void SaveL( CWPEngine& aEngine );
       
   150 
       
   151         /**
       
   152         * Loads the settings.
       
   153         * @param aEngine The Provisioning Engine
       
   154         */
       
   155         void LoadL( CWPEngine& aEngine );
       
   156 
       
   157         /**
       
   158         * Checks if settings have been loaded.
       
   159         * @return ETrue if settings have been loaded
       
   160         */
       
   161         TBool Loaded() const;
       
   162 
       
   163     private:
       
   164 
       
   165         /// ETrue if settings have been loaded
       
   166         TBool iLoaded;
       
   167 
       
   168         /// The trusted provisioning server. Owns.
       
   169         HBufC* iTPS;
       
   170 
       
   171         /// The name of the bootstrap. Owns.
       
   172         HBufC* iName;
       
   173 
       
   174         /// The IMSI
       
   175         RMobilePhone::TMobilePhoneSubscriberId iIMSI;
       
   176 
       
   177         /// The proxies. Owns.
       
   178         CDesC16Array* iProxies;
       
   179 
       
   180         /// The ID of the current characteristic
       
   181         TInt iCurrentChar;
       
   182 
       
   183     };
       
   184 
       
   185 #endif /* CWPBOOTSTRAP_H */