accesssec_plat/eap_qt_configuration_api/inc/eapqtconfiginterface.h
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
child 55 9c2aa05919d9
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
     1 /*
       
     2  * Copyright (c) 2010 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: 
       
    15  *   EAP method configuration QT interface
       
    16  *
       
    17  */
       
    18 
       
    19 /*
       
    20  * %version: 8 %
       
    21  */
       
    22 
       
    23 #ifndef EAPQTCONFIGINTERFACE_H
       
    24 #define EAPQTCONFIGINTERFACE_H
       
    25 
       
    26 // System includes
       
    27 #include <qglobal.h>
       
    28 #include <eapqtconfig.h>
       
    29 #include <eapqtconfigexport.h>
       
    30 #include <eapqtpacstoreconfig.h>
       
    31 
       
    32 // User includes
       
    33 
       
    34 // Forward declarations
       
    35 class CpBaseSettingView;
       
    36 class EapQtValidator;
       
    37 class EapQtPluginInfo;
       
    38 class EapQtPluginHandle;
       
    39 class EapQtExpandedEapType;
       
    40 class EapQtCertificateInfo;
       
    41 class EapQtConfigInterfacePrivate;
       
    42 
       
    43 // External data types
       
    44 
       
    45 // Constants
       
    46 
       
    47 // Class declaration
       
    48 class EAP_QT_CONFIG_INTERFACE_EXPORT EapQtConfigInterface
       
    49 {
       
    50 
       
    51 public:
       
    52 
       
    53     // Data types
       
    54 
       
    55     // bearer type used for creating an interface object
       
    56     enum EapBearerType
       
    57     {
       
    58         // EAP configuration interface for WLAN
       
    59         EapBearerTypeWlan = 0,
       
    60         // EAP configuration interface for VPN
       
    61         EapBearerTypeVpn
       
    62     };
       
    63 
       
    64     // IAP ID to be used for accessing limited number of
       
    65     // API methods, see below the method descriptions
       
    66     static const int IapIdUndefined = -1;
       
    67 
       
    68     // NOTE: the default constuctor can only be used for creating validators
       
    69     // with validatorEap() and validatorPacStore(), and accessing EAP-FAST PAC store,
       
    70     // any other call throws an exeption;
       
    71     // also, throws an exception if the construction fails
       
    72     EapQtConfigInterface();
       
    73 
       
    74     // this is the constructor for using the interface for all
       
    75     // available operations, including validators;
       
    76     // throws an exception if the construction fails;
       
    77     // the parameter iapId is the identifier of the configured IAP;
       
    78     // if iapId is negative (i.e. IapIdUndefined or negative), only a limited set of
       
    79     // methods are available and setConfigurationReference must be later called to
       
    80     // correct the IAP ID and use the rest of the API methods
       
    81     EapQtConfigInterface(const EapBearerType bearerType, const int iapId);
       
    82 
       
    83     // destructor
       
    84     ~EapQtConfigInterface();
       
    85 
       
    86     // method for creating a setting validator for the specified EAP method
       
    87     // NOTE: CALLER OWNS the returned object
       
    88     // returns NULL on failure (e.g. if the requested validator does not exist)
       
    89     EapQtValidator *validatorEap(const EapQtExpandedEapType &type, const EapQtConfig::SettingsId id) const;
       
    90 
       
    91     // method for creating a EAP-FAST PAC store validator, see also EapQtPacStoreConfig
       
    92     // NOTE: CALLER OWNS the returned object
       
    93     // returns NULL on failure (e.g. if EAP-FAST is not supported)
       
    94     EapQtValidator *validatorPacStore(const EapQtPacStoreConfig::PacStoreSettings id) const;
       
    95 
       
    96     // reads EAP-FAST PAC store configuration, see EapQtPacStoreConfig
       
    97     // returns false on failure (e.g. if EAP-FAST is not supported)
       
    98     bool readPacStoreConfiguration(EapQtPacStoreConfig &config) const;
       
    99 
       
   100     // stores EAP-FAST PAC store configuration, see EapQtPacStoreConfig
       
   101     // returns false on failure (e.g. if EAP-FAST is not supported)
       
   102     bool savePacStoreConfiguration(const EapQtPacStoreConfig &config) const;
       
   103 
       
   104     /**
       
   105      * NOTE: all the following methods throw an exception if the interface
       
   106      * instance was created with the default (validator) constructor;
       
   107      * otherwise the return value is as defined
       
   108      */
       
   109 
       
   110     // sets the IAP ID for accesssing EAP settings with the other methods
       
   111     // returns false on failure (e.g. WLAN IAP with the specified ID
       
   112     // [if the ID is other than IapIdUndefined] does not exist)
       
   113     bool setConfigurationReference(const int iapId) const;
       
   114 
       
   115     // returns supported outer EAP types
       
   116     // returns empty list on failure
       
   117     QList<EapQtPluginInfo> supportedOuterTypes() const;
       
   118 
       
   119     // returns supported inner EAP types for the specified outer type
       
   120     // returns empty list on failure
       
   121     QList<EapQtPluginInfo> supportedInnerTypes(const EapQtPluginHandle &outerType) const;
       
   122 
       
   123     // retrieves the list of installed CA certificates;
       
   124     // list returned from device database only when called for the first time,
       
   125     // otherwise returns the list from cache;
       
   126     // call updateCertificates() to update the cache;
       
   127     // returns empty list on failure or if CA certificates do not exist
       
   128     QList<EapQtCertificateInfo> certificateAuthorityCertificates() const;
       
   129 
       
   130     // retrieves the lsit of installed user certificate list;
       
   131     // list returned from device database only when called for the first time,
       
   132     // otherwise returns the list from cache;
       
   133     // call updateCertificates() to update the cache;
       
   134     // returns empty list on failure or if user certificates do not exist
       
   135     QList<EapQtCertificateInfo> userCertificates() const;
       
   136 
       
   137     // updates CA and user certificate lists from the device database
       
   138     bool updateCertificates() const;
       
   139 
       
   140     // checks if the specified outer EAP is supported
       
   141     // returns true if supported, false otherwise
       
   142     bool isSupportedOuterType(const EapQtPluginHandle &handle) const;
       
   143 
       
   144     // checks if the specified inner EAP is supported inside the specified outer EAP
       
   145     // returns true if supported, false otherwise
       
   146     bool isSupportedInnerType(const EapQtPluginHandle &outerHandle,
       
   147         const EapQtPluginHandle &innerHandle) const;
       
   148 
       
   149     /**
       
   150      * NOTE: all the following methods return failure if the current IAP
       
   151      * ID is IapIdUndefined (or negative);
       
   152      * setConfigurationReference must be called first to correct the IAP ID
       
   153      */
       
   154 
       
   155     // returns the list of activated outer EAP methods for the IAP
       
   156     // returns empty list on failure
       
   157     QList<EapQtPluginHandle> selectedOuterTypes() const;
       
   158 
       
   159     // sets the list of activated outer EAP methods for the IAP
       
   160     // returns empty list on failure
       
   161     bool setSelectedOuterTypes(const QList<EapQtPluginHandle> &outerHandles) const;
       
   162 
       
   163     // reads the configuration for pluginHandle inside outerHandle
       
   164     // if outerHandle is EapQtPluginHandle::PluginUndefined, the configuration is read for
       
   165     // pluginHandle as outer type;
       
   166     // returns false on failure (e.g. outerHandle/pluginHandle is not supported)
       
   167     bool readConfiguration(const EapQtPluginHandle &outerHandle,
       
   168         const EapQtPluginHandle &pluginHandle, EapQtConfig &config) const;
       
   169 
       
   170     // stores the configuration for pluginHandle
       
   171     // in config:
       
   172     // if OuterType is defined, the configuration for pluginHandle is set inside this OuterType
       
   173     // if OuterType is not defined, pluginHandle is for an outer type
       
   174     // if InnerType is defined, the defined inner types in config are activated for pluginHandle
       
   175     // if InnerType is not defined, the pluginHandle does not activate any inner type (or they do not exist)
       
   176     // returns false on failure (e.g. pluginHandle is not supported)
       
   177     bool saveConfiguration(const EapQtPluginHandle &pluginHandle, const EapQtConfig &config) const;
       
   178 
       
   179     // deletes all EAP configurations for the current IAP ID
       
   180     bool deleteConfiguration() const;
       
   181 
       
   182     // returns control panel UI instance for the specified EAP method (pluginHandle)
       
   183     // outerHandle specifies if the UI is for pluginHandle as outer (EapQtPluginHandle::PluginUndefined) or
       
   184     // inner (other than EapQtPluginHandle::PluginUndefined) EAP method;
       
   185     // NOTE: CALLER OWNS the returned object;
       
   186     // returns NULL on failure (e.g. if the combination of outerHandle/pluginHandle is not supported)
       
   187     // NOTE: the method throws an exception if current IAP ID is IapIdUndefined (or negative);
       
   188     CpBaseSettingView *uiInstance(const EapQtPluginHandle &outerHandle,
       
   189         const EapQtPluginHandle &pluginHandle) const;
       
   190 
       
   191 private:
       
   192 
       
   193     Q_DISABLE_COPY(EapQtConfigInterface)
       
   194 
       
   195 private: // data
       
   196 
       
   197     QScopedPointer<EapQtConfigInterfacePrivate> d_ptr;
       
   198 
       
   199 };
       
   200 
       
   201 #endif // EAPQTCONFIGINTERFACE_H
       
   202