natfw/natfwsettings/inc/cnatfwstunsettings.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:    Encapsulates STUN related software settings.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_CNATFWSTUNSETTINGS_H
       
    22 #define C_CNATFWSTUNSETTINGS_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <mnatfwstunsettings.h>
       
    26 
       
    27 class CNATFWServerSettings;
       
    28 class CNATFWCenRepHandler;
       
    29 
       
    30 
       
    31 /**
       
    32  *  Class instance encapsulates STUN related software settings.
       
    33  *
       
    34  *  @lib natfwnatsettings.dll
       
    35  *  @since S60 v3.2
       
    36  */
       
    37 class CNATFWStunSettings : public CBase, public MNATFWStunSettings
       
    38     {
       
    39 
       
    40 public:
       
    41 
       
    42     /**
       
    43      * Two-phased constructor.
       
    44      */
       
    45     static CNATFWStunSettings* NewL();
       
    46     
       
    47     /**
       
    48      * Two-phased constructor.
       
    49      */
       
    50     static CNATFWStunSettings* NewLC();
       
    51     
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55     virtual ~CNATFWStunSettings();
       
    56 
       
    57     /**
       
    58      * Sets STUN server array, ownership is transferred
       
    59      * 
       
    60      * @since   S60 v3.2
       
    61      * @param   aStunServers Server array
       
    62      */
       
    63     void SetStunServersL( CArrayPtr<CNATFWServerSettings>* aStunServers );
       
    64     
       
    65     /**
       
    66      * Sets retransmission timeout (RTO).
       
    67      *
       
    68      * @since   S60 v3.2
       
    69      * @param  aRto Retransmission timeout value
       
    70      */  
       
    71     void SetRetransmissionTimeout( TUint aRto );
       
    72    
       
    73     /**
       
    74      * Sets latest connected STUN server address
       
    75      * 
       
    76      * @since   S60 v3.2
       
    77      * @param   aServerAddr Server address
       
    78      */
       
    79     void SetLatestConnectedServerAddrL( const TDesC8& aServerAddr );
       
    80     
       
    81     /**
       
    82      * Sets latest connected STUN server port
       
    83      * 
       
    84      * @since   S60 v3.2
       
    85      * @param   aServerPort Server port
       
    86      */
       
    87     void SetLatestConnectedServerPort( TInt aServerPort );
       
    88     
       
    89     /**
       
    90      * Read settings from Central Repository
       
    91      * 
       
    92      * @since   S60 v3.2
       
    93      * @param   aDomainKey key for domain settings
       
    94      * @param   aRepHandler Central Repository handler
       
    95      */
       
    96     void ReadSettingsL( TUint32 aDomainKey,
       
    97         const CNATFWCenRepHandler& aRepHandler );
       
    98         
       
    99 // from base class MNATFWStunSettings
       
   100 
       
   101     /**
       
   102      * From MNATFWStunSettings.
       
   103      * Method for getting array of STUN server related settings
       
   104      * Ownership is not transferred.
       
   105      *
       
   106      * @since S60 3.2
       
   107      * @param   aServers array of a STUN server settings pointers
       
   108      */
       
   109     void GetStunServerArrayL(
       
   110         RPointerArray<MNATFWServerSettings>& aServers ) const;
       
   111    
       
   112     /**
       
   113      * From MNATFWStunSettings.
       
   114      * Returns initial retransmission timeout (RTO).
       
   115      *
       
   116      * @since   S60 v3.2
       
   117      * @return  Retransmission timeout
       
   118      */  
       
   119     TUint RetransmissionTimeout() const;
       
   120    
       
   121     /**
       
   122      * From MNATFWStunSettings.
       
   123      * Method for getting latest successfully connected STUN server address
       
   124      *
       
   125      * @since S60 3.2
       
   126      * @return latest successfully connected STUN server address
       
   127      */
       
   128     const TDesC8& LatestConnectedServerAddr() const;
       
   129     
       
   130     /**
       
   131      * From MNATFWStunSettings.
       
   132      * Method for getting latest successfully connected STUN server port
       
   133      *
       
   134      * @since S60 3.2
       
   135      * @return latest successfully connected STUN server port
       
   136     */
       
   137     TInt LatestConnectedServerPort() const;
       
   138     
       
   139 private:
       
   140 
       
   141     CNATFWStunSettings();
       
   142 
       
   143     void ConstructL();
       
   144 
       
   145 private: // data
       
   146 
       
   147     /**
       
   148      * Array of server related settings.
       
   149      * own.
       
   150      */
       
   151     CArrayPtr<CNATFWServerSettings>* iServerArray;
       
   152     
       
   153     /**
       
   154      * Retransmission timeout.
       
   155      */
       
   156     TUint iRto;
       
   157     
       
   158     /**
       
   159      * Latest successfully connected STUN server address.
       
   160      * own.
       
   161      */
       
   162     HBufC8* iLatestConnectedServerAddr;
       
   163     
       
   164     /**
       
   165      * Latest successfully connected STUN server port.
       
   166      */
       
   167     TUint iLatestConnectedServerPort;
       
   168 
       
   169     };
       
   170 
       
   171 #endif // C_CNATFWSTUNSETTINGS_H