webservices/wsdescription/inc/senpolicy.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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: Header declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef SEN_POLICY_H
       
    26 #define SEN_POLICY_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include <e32base.h> // for CActive
       
    30 #include <badesca.h>
       
    31 
       
    32 #include "SenDomFragment.h"
       
    33 #include "msenpolicy.h"
       
    34 
       
    35 // FORWARD DECLARATION
       
    36 class CSenIdentityProviderIdArray8;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 * Example structure of Policy XML fragment:
       
    42 *   <Policy>
       
    43 *
       
    44 *       <Transport>
       
    45 *           <IapId>
       
    46 *               1234567890
       
    47 *           </IapId>
       
    48 *       </Transport>
       
    49 *
       
    50 *       <IdentityProviderIDs strict="true">
       
    51 *           <IdentityProviderID>
       
    52 *             urn:first.id.example.com
       
    53 *           </IdentityProviderID>
       
    54 *           <IdentityProviderID>
       
    55 *             urn:second.id.example.com
       
    56 *           </IdentityProviderID>
       
    57 *       </IdentityProviderIDs>
       
    58 *
       
    59 *   </Policy>
       
    60 */
       
    61 class CSenPolicy : public CSenDomFragment, public MSenPolicy
       
    62     {
       
    63     public: // Constructors and destructor
       
    64 
       
    65         /**
       
    66         * Two-phased constructors.
       
    67         * These parameterless constructors are ment to be used
       
    68         * for example before parsing XML stream.
       
    69         */
       
    70         IMPORT_C static CSenPolicy* NewL();
       
    71         IMPORT_C static CSenPolicy* NewLC();
       
    72         IMPORT_C static CSenPolicy* NewL(TUint32 aIapId);
       
    73         IMPORT_C static CSenPolicy* NewLC(TUint32 aIapId);
       
    74         IMPORT_C static CSenPolicy* NewL(TUint32 aId, TBool aIsSnapId);
       
    75         IMPORT_C static CSenPolicy* NewLC(TUint32 aId, TBool aIsSnapId);        
       
    76 
       
    77         /**
       
    78         * Destructor
       
    79         */
       
    80         virtual ~CSenPolicy();
       
    81         
       
    82         // Functions from base classes
       
    83         
       
    84         // From MSenPolicy
       
    85     
       
    86         /**
       
    87         * Setter for Internet Access Point (IAP) ID.
       
    88         * Method is used to define default access point
       
    89         * to avoid IAP selection dialog prompt.
       
    90         * @since Series60 3.0
       
    91         * @param aIapId is the ID found from CommDB.
       
    92         */ 
       
    93         IMPORT_C virtual void SetIapIdL(TUint32 aIapId);
       
    94 
       
    95         /**
       
    96         * Getter for IAP ID.
       
    97         * @param aCurrentIapId will contain the current Internet Access Point ID
       
    98         * Max value for IAP ID is 2147483647
       
    99         * @return
       
   100         *  - KErrNone if <IapId> element is found and has valid content
       
   101         *  - KErrNotFound if no <IapId> element has been found or it has
       
   102         *       no content
       
   103         *  - TLex error codes, if <IapId> element has non-numeric value,
       
   104         *    which cannot be resolved
       
   105         */ 
       
   106         IMPORT_C virtual TInt IapId(TUint32& aCurrentIapId);
       
   107 
       
   108         /**
       
   109         * Setter for IdentityProvider IDs. Overrides 
       
   110         * current values with the given values from the array.
       
   111         * When initiating a new service connection, this list of
       
   112         * ProviderIDs define, which IdentityProviders are preferred
       
   113         * OR which are strictly acceptable ones.
       
   114         * @since Series60 3.0
       
   115         * @param aList  list of IdentityProvider IDs.
       
   116         */ 
       
   117         IMPORT_C virtual void SetIdentityProviderIdsL(
       
   118                                         CSenIdentityProviderIdArray8& aList);
       
   119 
       
   120         /**
       
   121         * Adds a new Identity provider ID value at the end of the current list 
       
   122         * values
       
   123         * Checks for duplicate (does not insert new ID elements with equal
       
   124         * content)
       
   125         * @return   KErrAlreadyExists, if a duplicate is tried to add
       
   126         *           KErrArgument if a zero-length descriptor is tried to add
       
   127         *           (aProviderId.Length() == 0)
       
   128         */
       
   129         IMPORT_C virtual TInt AddIdentityProviderIdL(const TDesC8& aProviderId);
       
   130 
       
   131         /**
       
   132         * Method reads provider policy class instance values from given
       
   133         * template. Values may include an IAP ID, preferred IdentityProvider
       
   134         * IDs etc.
       
   135         * @since Series60 3.0
       
   136         * @param aTemplate from which the values are read.
       
   137         * @return       KErrNone            Everything went ok.
       
   138         *               KErrAlreadyExists   Duplicates were found
       
   139         *               KErrArgument        Invalid providerIds were found
       
   140         *               Other error codes are system-wide Symbian error codes.
       
   141         */ 
       
   142         IMPORT_C virtual TInt RebuildFrom(MSenPolicy& aTemplate);
       
   143 
       
   144         /**
       
   145         * Getter for IdentityProvider IDs.
       
   146         * @since Series60 3.0
       
   147         * @return a list of IDP arrays if such value(s) have been set
       
   148         *           or an empty array if no IDP:s have been specified.
       
   149         */ 
       
   150         IMPORT_C virtual const CSenIdentityProviderIdArray8&
       
   151                                                     IdentityProviderIds8L();
       
   152         /**
       
   153         * Checks if policies match.
       
   154         * @param    aPolicyPattern  the policy to match
       
   155         * @return ETrue if policies match, EFalse if not.
       
   156         */
       
   157         IMPORT_C virtual TBool Accepts(MSenPolicy& aPolicyPattern);
       
   158         
       
   159         /**
       
   160         * Sets the SnapId
       
   161         * @param    aSnapId snap id
       
   162         */
       
   163         IMPORT_C virtual void SetSnapIdL(TUint32 aSnapId) ;
       
   164         
       
   165         /**
       
   166         * Gets the SnapId
       
   167         * @param    aCurrentSnapId snap id
       
   168         * @return KErrNone if snap id is get properly
       
   169         */
       
   170         IMPORT_C virtual TInt SnapId(TUint32& aCurrentSnapId) ;         
       
   171 
       
   172     protected: 
       
   173         
       
   174         /**
       
   175         * C++ default constructor.
       
   176         */
       
   177         CSenPolicy();
       
   178         
       
   179         /**
       
   180         * By default Symbian 2nd phase constructor is private.
       
   181         */
       
   182         IMPORT_C void BaseConstructL(const TDesC8& aLocalName);
       
   183         IMPORT_C void BaseConstructL(const TDesC8& aLocalName,
       
   184                                      TUint32 aIapId);
       
   185         IMPORT_C void BaseConstructL(const TDesC8& aLocalName,
       
   186                                      TUint32 aId, TBool aIsSnapId);
       
   187     
       
   188     private: // New functions
       
   189     
       
   190         /**
       
   191         * Leaving variants of the functions.
       
   192         */
       
   193         TBool AcceptsL(MSenPolicy& aPolicyPattern);
       
   194         TInt RebuildFromL(MSenPolicy& aTemplate);
       
   195 
       
   196     private: // Data
       
   197         CSenIdentityProviderIdArray8* iIdpIdList;
       
   198     };
       
   199 
       
   200 #endif //SEN_POLICY_H
       
   201 
       
   202 // End of File