natplugins/natptraversalcontroller/inc/cnattraversalconfig.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CNATTRAVERSALCONFIG_H
       
    20 #define CNATTRAVERSALCONFIG_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <centralrepository.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 
       
    28 // CLASS DECLARATION
       
    29 /**
       
    30 * A class for retrieving NAT traversal configuration for a domain.
       
    31 * @lib nattraversalcontroller.lib
       
    32 */
       
    33 class CNATTraversalConfig : public CBase
       
    34     {
       
    35     public: // Enumerations
       
    36 
       
    37 	// Values for KUNSAFProtocolsDomainEnableCRLFRefresh parameter
       
    38     enum TRefreshValue
       
    39         {
       
    40         EDisabled  = 0, // Refresh disabled in repository
       
    41         EEnabled   = 1, // Refresh enabled in repository
       
    42         EUndefined = 2  // Parameter not present in repository
       
    43         };
       
    44 
       
    45     public:  // Constructors and destructor
       
    46 
       
    47         static CNATTraversalConfig* NewL(
       
    48             TUint32 aIapId,
       
    49             const TDesC8& aDomain);
       
    50 
       
    51         static CNATTraversalConfig* NewLC(
       
    52             TUint32 aIapId,
       
    53             const TDesC8& aDomain);
       
    54 
       
    55         ~CNATTraversalConfig();
       
    56 
       
    57     public: // New functions
       
    58 
       
    59         TUint32 IapId() const;
       
    60         const TDesC8& Domain() const;
       
    61         const TDesC8& STUNServer() const;
       
    62         TUint STUNServerPort() const;
       
    63         TInt UDPRefreshInterval() const;
       
    64         TInt TCPRefreshInterval() const;
       
    65         TInt STUNRetransmitTimer() const;
       
    66         TBool CRLFRefreshEnabledToProxy(TUint aProtocol) const;
       
    67         CNATTraversalConfig::TRefreshValue
       
    68         	CRLFRefreshEnabledToProxyValue() const;
       
    69         TBool SharedSecretNotSupported() const;
       
    70         void SetSharedSecretNotSupportedL(TBool aNotSupported=ETrue);
       
    71         TBool BindingRequestFailed() const;
       
    72         void SetBindingRequestFailedL(TBool aFailed=ETrue);
       
    73         const TDesC8& Username() const;
       
    74         const TDesC8& Password() const; 
       
    75 
       
    76     private: // Second phase constructors
       
    77 
       
    78         CNATTraversalConfig(TUint32 aIapId);
       
    79         void ConstructL(const TDesC8& aDomain);
       
    80 
       
    81     private: // New functions
       
    82 
       
    83         void ReadDomainSettingsL(
       
    84             CRepository& aRepository,
       
    85             const TDesC8& aDomain);
       
    86 
       
    87         void ReadIapSettingsL(
       
    88             CRepository& aRepository,
       
    89             TUint32 aIapId);
       
    90 
       
    91 		void ReadCRLFRefreshEnabled(CRepository& aRepository,
       
    92 									const TUint32 aKey);
       
    93 
       
    94         void ReadBoolValue(CRepository& aRepository,
       
    95                            const TUint32& aKey,
       
    96                            TBool& aKeyValue) const;
       
    97 
       
    98         TBool Read(CRepository& aRepository,
       
    99                    const TUint32& aKey,
       
   100                    TInt& aKeyValue) const;
       
   101 
       
   102         void WriteL(TUint32 aFieldMask, TBool aValue);
       
   103 
       
   104         TUint32 CreateNewKeyL(CRepository& aRepository,
       
   105                               TUint32 aKey,
       
   106                               TUint32 aTable) const;
       
   107 
       
   108     private: // Data
       
   109 
       
   110         TUint32 iIapId;
       
   111         CRepository* iCenRep;
       
   112         HBufC8* iDomain;
       
   113         TUint32 iDomainKey;
       
   114         HBufC8* iSTUNServer;
       
   115         TUint iSTUNServerPort;
       
   116         TInt iUDPRefreshInterval;
       
   117         TInt iTCPRefreshInterval;
       
   118         TInt iSTUNRetransmitTimer;
       
   119         TRefreshValue iCRLFRefreshEnabled;
       
   120         TBool iSharedSecretNotSupported;
       
   121         TBool iBindingRequestFailed;
       
   122         HBufC8* iUsername;
       
   123         HBufC8* iPassword;
       
   124 
       
   125     friend class UT_CNATTraversalSession;
       
   126     friend class UT_CNATTraversalController;
       
   127     friend class UT_CNATTraversalConfig;
       
   128     };
       
   129 
       
   130 #endif // CNATTRAVERSALCONFIG_H
       
   131 
       
   132 // End of File