wvsettings20/IMPSSrc/CIMPSSAPSettingsBody.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 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:  SAP settings container body.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CIMPSSAPSETTINGSBODY_H
       
    19 #define __CIMPSSAPSETTINGSBODY_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include "MIMPSSapObject.h"
       
    23 #include "CIMPSSAPKeyValuePairs.h"
       
    24 
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <s32strm.h>
       
    28 #include "impssapsettings.h"
       
    29 
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33  * SAP settings container body.
       
    34  */
       
    35 NONSHARABLE_CLASS( CIMPSSAPSettingsBody ): public CBase,
       
    36         public MIMPSSapObject
       
    37     {
       
    38 
       
    39 public:  // Constructors and destructor
       
    40 
       
    41     /**
       
    42      * Two-phased constructor.
       
    43      *
       
    44      * @since 1.2
       
    45      */
       
    46     static CIMPSSAPSettingsBody* NewL();
       
    47 
       
    48     /**
       
    49      * Destructor.
       
    50      */
       
    51     virtual ~CIMPSSAPSettingsBody();
       
    52 
       
    53 
       
    54 protected:  // Constructors
       
    55 
       
    56     /**
       
    57      * C++ default constructor.
       
    58      */
       
    59     CIMPSSAPSettingsBody();
       
    60 
       
    61 
       
    62     /**
       
    63      * Symbian OS constructor.
       
    64      */
       
    65     void ConstructL();
       
    66 
       
    67 
       
    68 public: //Generic object interface from MIMPSSapObject
       
    69 
       
    70     TIMPSSapObjectID ObjectID() const;
       
    71     TInt ObjectVersion() const;
       
    72     void ExternalizeVersionDataL( TInt aVersion, RWriteStream& aStream ) const;
       
    73     void InternalizeVersionDataL( TInt aVersion, RReadStream& aStream );
       
    74     TInt DataSize() const;
       
    75     void Reset();
       
    76 
       
    77 public: // New functions
       
    78 
       
    79     /**
       
    80      * @see CIMPSSAPSettings.
       
    81      * @since 3.0
       
    82      */
       
    83     TUint32 Uid() const;
       
    84     const TDesC& SAPName() const;
       
    85     const TDesC& SAPAddress() const;
       
    86     TInt32 SAPPort() const;
       
    87     const TDesC& SAPUserId() const;
       
    88     const TDesC& SAPUserPassword() const;
       
    89     const TDesC& HTTPProxyAddress() const;
       
    90     TInt32 HTTPProxyPort() const;
       
    91     const TDesC& HTTPProxyUserId() const;
       
    92     const TDesC& HTTPProxyUserPassword() const;
       
    93     TUint32 AccessPoint() const;
       
    94     const TDesC& ClientId() const;
       
    95     TUint32 HighLevelServices() const;
       
    96     const TDesC& ServerAuthenticationName() const;
       
    97     const TDesC& ServerAuthenticationPassword() const;
       
    98     const TDesC& ServerAcceptedContentType() const;
       
    99     TIMPSAccessGroup AccessGroup() const;
       
   100     TUint32 AuthorizationMode() const;
       
   101 
       
   102     /**
       
   103      * @see CIMPSSAPSettings.
       
   104      * @since 3.0
       
   105      */
       
   106     void SetSAPNameL( const TDesC& aName );
       
   107     void SetSAPAddressL( const TDesC& aAddress );
       
   108     TInt SetSAPPort( TInt32 aPort );
       
   109     void SetSAPUserIdL( const TDesC& aUserId );
       
   110     void SetSAPUserPasswordL( const TDesC& aPassword );
       
   111     void SetHTTPProxyAddressL( const TDesC& aAddress );
       
   112     TInt SetHTTPProxyPort( TInt32 aPort );
       
   113     void SetHTTPProxyUserIdL( const TDesC& UserId );
       
   114     void SetHTTPProxyUserPasswordL( const TDesC& aPassword );
       
   115     TInt SetAccessPoint( TUint32 aAP );
       
   116     void SetClientIdL( const TDesC& aClientId );
       
   117     TInt SetHighLevelServices( TUint32 aServices );
       
   118     void SetServerAuthenticationNameL( const TDesC& aAuthenticationName );
       
   119     void SetServerAuthenticationPasswordL( const TDesC& aAuthenticationPassword );
       
   120     void SetServerAcceptedContentTypeL( const TDesC& aAcceptedContentType );
       
   121     TInt SetAuthorizationMode( TUint32 aMode );
       
   122 
       
   123     /**
       
   124      * @see CIMPSSAPSettings.
       
   125      * @since 3.0
       
   126      */
       
   127     void ProtectL( TIMPSSAPProtection aProtection );
       
   128     TIMPSSAPProtection Protection() const;
       
   129     void IncreaseLoginCount();
       
   130     TUint32 LoginCount() const;
       
   131     TBool EqualConnectionSettings( const CIMPSSAPSettingsBody& aOther ) const;
       
   132     TBool EqualUserSettings( const CIMPSSAPSettingsBody& aOther ) const;
       
   133 
       
   134 
       
   135 public: // Internal setters and helpers
       
   136 
       
   137     /**
       
   138      * Setters for internal usage.
       
   139      * @see CIMPSSAPSettings.
       
   140      * @since 3.0
       
   141      */
       
   142     void DoSetUid( TUint32 aUid );
       
   143     void DoSetLoginCount( TUint32 aLoginCount );
       
   144     void DoResetLoginCount();
       
   145     void DoResetProtection();
       
   146     void DoSetAccessGroup( TIMPSAccessGroup aGroup );
       
   147 
       
   148 private: // Own helper functions
       
   149 
       
   150 
       
   151     /**
       
   152      * Allocs given data to given HBufC.
       
   153      * If the new passed data and old data differ,
       
   154      * resets the login count if desired. Checks also is the
       
   155      * operation allowed on current protection level.
       
   156      *
       
   157      * @param aPtr Reference to pointer, where to allocate.
       
   158      * @param aData Data to allocate.
       
   159      * @param aOperation The operation id for protection handler.
       
   160      * @param aAffectsToLoginCount Does the setting affect to login count.
       
   161      */
       
   162     void DoSetBufferL( HBufC*& aPtr, const TDesC& aData,
       
   163                        TInt aOperation, TBool aAffectsToLoginCount );
       
   164 
       
   165 
       
   166     /**
       
   167      * Sets passed integer to passed integer reference.
       
   168      * If the new passed data and old data differ,
       
   169      * resets the login count if desired. Checks also is the
       
   170      * operation allowed on current protection level.
       
   171      * Templated method to handle both TUint32's and
       
   172      * TInt32's sameway.
       
   173      * @param aOldData Reference to old data.
       
   174      * @param aData Data to assign.
       
   175      * @param aOperation The operation id for protection handler.
       
   176      * @param aAffectsToLoginCount Does the setting affect to login count.
       
   177      */
       
   178     template<class T>
       
   179     TInt DoSetNumber( T& aOldData, T aData, TInt aOperation, TBool aAffectsToLoginCount );
       
   180 
       
   181 
       
   182 private:    // Data
       
   183 
       
   184     TInt    iDynamicDataSize;       ///<Cached dynamic data size, owned
       
   185 
       
   186 
       
   187     TUint32 iUID;                   ///< SAPSettings identifier, owned
       
   188 
       
   189     TUint32 iAP;                    ///< Associated AccessPoint, owned
       
   190     HBufC*  iClientId;              ///< SAP client id, owned
       
   191 
       
   192     TIMPSSAPProtection iProtection;   ///< SAP protection, owned
       
   193     TUint32 iLoginCount;            ///< SAP login count, owned
       
   194 
       
   195     HBufC*  iSAPName;               ///< ServiceAccessPoint name, owned
       
   196     TInt32  iSAPPort;               ///< ServiceAccessPoint port, owned
       
   197     HBufC*  iSAPAddress;            ///< ServiceAccessPoint address, owned
       
   198     HBufC*  iSAPUserId;             ///< ServiceAccessPoint user id, owned
       
   199     HBufC*  iSAPUserPassword;       ///< ServiceAccessPoint user password, owned
       
   200 
       
   201     HBufC*  iHTTPProxyAddress;      ///< HTTPProxy address, owned
       
   202     TInt32  iHTTPProxyPort;         ///< HTTPProxy port, owned
       
   203     HBufC*  iHTTPProxyUserId;       ///< HTTPProxy user id, owned
       
   204     HBufC*  iHTTPProxyUserPassword; ///< HTTPProxy user password, owned
       
   205 
       
   206     HBufC*  iServerAuthenticationName; ///< Server authentication name, owned
       
   207     HBufC*  iServerAuthenticationPassword; ///< Server authentication password, owned
       
   208     HBufC*  iServerAcceptedContentType; ///< Content type accepted by the server, owned
       
   209 
       
   210     TUint32	iHighLevelServices;		///< High level services, owned
       
   211     TIMPSAccessGroup iAccessGroup; ///< Access group, owned
       
   212     TUint32	iAuthorizationMode;	///< Authorization mode, owned
       
   213     };
       
   214 
       
   215 #endif      // __CIMPSSAPSETTINGSBODY_H
       
   216 
       
   217 //  End of File